Added COMBINE_WITH_NEW for notifications for ACME-1471

master
Cho 2014-05-17 04:21:56 +01:00
parent 9a7458f9e3
commit 43d12faffe
4 changed files with 37 additions and 2 deletions

View File

@ -678,7 +678,7 @@ void LLNotification::respond(const LLSD& response)
// and then call it
functor(asLLSD(), response);
}
else
else if (mCombinedNotifications.empty())
{
// no registered responder
return;
@ -700,6 +700,14 @@ void LLNotification::respond(const LLSD& response)
}
}
for (std::vector<LLNotificationPtr>::const_iterator it = mCombinedNotifications.begin(); it != mCombinedNotifications.end(); ++it)
{
if ((*it))
{
(*it)->respond(response);
}
}
update();
}
@ -1321,6 +1329,28 @@ bool LLNotifications::failedUniquenessTest(const LLSD& payload)
}
}
break;
case LLNotification::COMBINE_WITH_NEW:
// Add to the existing unique notification with the data from this particular instance...
// This guarantees that duplicate notifications will be collapsed to the one
// most recently triggered
for (LLNotificationMap::iterator existing_it = mUniqueNotifications.find(pNotif->getName());
existing_it != mUniqueNotifications.end();
++existing_it)
{
LLNotificationPtr existing_notification = existing_it->second;
if (pNotif != existing_notification
&& pNotif->isEquivalentTo(existing_notification))
{
// copy the notifications from the newest instance into the oldest
existing_notification->mCombinedNotifications.push_back(pNotif);
existing_notification->mCombinedNotifications.insert(existing_notification->mCombinedNotifications.end(),
pNotif->mCombinedNotifications.begin(), pNotif->mCombinedNotifications.end());
// pop up again
existing_notification->update();
}
}
break;
case LLNotification::KEEP_OLD:
break;
case LLNotification::CANCEL_OLD:

View File

@ -413,6 +413,9 @@ private:
using the same mechanism.
*/
bool mTemporaryResponder;
// keep track of other notifications combined with COMBINE_WITH_NEW
std::vector<LLNotificationPtr> mCombinedNotifications;
void init(const std::string& template_name, const LLSD& form_elements);
@ -559,6 +562,7 @@ public:
typedef enum e_combine_behavior
{
REPLACE_WITH_NEW,
COMBINE_WITH_NEW,
KEEP_OLD,
CANCEL_OLD

View File

@ -43,6 +43,7 @@ struct LLNotificationTemplate
static void declareValues()
{
declare("replace_with_new", LLNotification::REPLACE_WITH_NEW);
declare("combine_with_new", LLNotification::COMBINE_WITH_NEW);
declare("keep_old", LLNotification::KEEP_OLD);
declare("cancel_old", LLNotification::CANCEL_OLD);
}

View File

@ -7116,7 +7116,7 @@ Scripts associated with this experience will be able to do the following on regi
[QUESTIONS]Is this OK?
<unique combine="replace_with_new">
<unique combine="combine_with_new">
<context>experience</context>
</unique>
<tag>confirm</tag>