CHUI-499: Now when existing DND mode, stored IM's will not show a toast but instead flash the conversation line item and Chat FUI button.
parent
aa6fee292d
commit
02ca16c133
|
|
@ -475,7 +475,8 @@ LLNotification::LLNotification(const LLSDParamAdapter<Params>& p) :
|
|||
mIgnored(false),
|
||||
mResponderObj(NULL),
|
||||
mId(p.id.isProvided() ? p.id : LLUUID::generateNewID()),
|
||||
mOfferFromAgent(p.offer_from_agent)
|
||||
mOfferFromAgent(p.offer_from_agent),
|
||||
mIsDND(p.is_dnd)
|
||||
{
|
||||
if (p.functor.name.isChosen())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -316,6 +316,7 @@ public:
|
|||
Optional<LLNotificationContext*> context;
|
||||
Optional<void*> responder;
|
||||
Optional<bool> offer_from_agent;
|
||||
Optional<bool> is_dnd;
|
||||
|
||||
struct Functor : public LLInitParam::ChoiceBlock<Functor>
|
||||
{
|
||||
|
|
@ -342,7 +343,8 @@ public:
|
|||
form_elements("form"),
|
||||
substitutions("substitutions"),
|
||||
expiry("expiry"),
|
||||
offer_from_agent("offer_from_agent", false)
|
||||
offer_from_agent("offer_from_agent", false),
|
||||
is_dnd("is_dnd", false)
|
||||
{
|
||||
time_stamp = LLDate::now();
|
||||
responder = NULL;
|
||||
|
|
@ -356,7 +358,8 @@ public:
|
|||
form_elements("form"),
|
||||
substitutions("substitutions"),
|
||||
expiry("expiry"),
|
||||
offer_from_agent("offer_from_agent", false)
|
||||
offer_from_agent("offer_from_agent", false),
|
||||
is_dnd("is_dnd", false)
|
||||
{
|
||||
functor.name = _name;
|
||||
name = _name;
|
||||
|
|
@ -383,6 +386,7 @@ private:
|
|||
void* mResponderObj; // TODO - refactor/remove this field
|
||||
LLNotificationResponderPtr mResponder;
|
||||
bool mOfferFromAgent;
|
||||
bool mIsDND;
|
||||
|
||||
// a reference to the template
|
||||
LLNotificationTemplatePtr mTemplatep;
|
||||
|
|
@ -523,6 +527,16 @@ public:
|
|||
return mOfferFromAgent;
|
||||
}
|
||||
|
||||
bool isDND() const
|
||||
{
|
||||
return mIsDND;
|
||||
}
|
||||
|
||||
void setDND(const bool flag)
|
||||
{
|
||||
mIsDND = flag;
|
||||
}
|
||||
|
||||
std::string getType() const;
|
||||
std::string getMessage() const;
|
||||
std::string getFooter() const;
|
||||
|
|
|
|||
|
|
@ -109,15 +109,19 @@ void LLDoNotDisturbNotificationStorage::loadNotifications()
|
|||
++notification_it)
|
||||
{
|
||||
LLSD notification_params = *notification_it;
|
||||
LLNotificationPtr notification(new LLNotification(notification_params));
|
||||
const LLUUID& notificationID = notification_params["id"];
|
||||
LLNotificationPtr notification = instance.find(notificationID);
|
||||
|
||||
const LLUUID& notificationID = notification->id();
|
||||
if (instance.find(notificationID))
|
||||
//Notification already exists in notification pipeline (same instance of app running)
|
||||
if (notification)
|
||||
{
|
||||
notification->setDND(true);
|
||||
instance.update(notification);
|
||||
}
|
||||
//Notification doesn't exist (different instance since restarted app while in DND mode)
|
||||
else
|
||||
{
|
||||
notification = (LLNotificationPtr) new LLNotification(notification_params.with("is_dnd", true));
|
||||
LLNotificationResponderInterface* responder = createResponder(notification_params["responder_sd"]["responder_type"], notification_params["responder_sd"]);
|
||||
if (responder == NULL)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@
|
|||
|
||||
using namespace LLNotificationsUI;
|
||||
|
||||
extern void process_dnd_im(const LLSD& notification);
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
LLIMHandler::LLIMHandler()
|
||||
: LLCommunicationNotificationHandler("IM Notifications", "notifytoast")
|
||||
|
|
@ -60,44 +62,52 @@ void LLIMHandler::initChannel()
|
|||
//--------------------------------------------------------------------------
|
||||
bool LLIMHandler::processNotification(const LLNotificationPtr& notification)
|
||||
{
|
||||
if(mChannel.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(notification->isDND())
|
||||
{
|
||||
LLSD data = notification->asLLSD(); //don't need this if retrieve needed data from notification getters
|
||||
process_dnd_im(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(mChannel.isDead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// arrange a channel on a screen
|
||||
if(!mChannel.get()->getVisible())
|
||||
{
|
||||
initChannel();
|
||||
}
|
||||
// arrange a channel on a screen
|
||||
if(!mChannel.get()->getVisible())
|
||||
{
|
||||
initChannel();
|
||||
}
|
||||
|
||||
LLSD substitutions = notification->getSubstitutions();
|
||||
LLSD substitutions = notification->getSubstitutions();
|
||||
|
||||
// According to comments in LLIMMgr::addMessage(), if we get message
|
||||
// from ourselves, the sender id is set to null. This fixes EXT-875.
|
||||
LLUUID avatar_id = substitutions["FROM_ID"].asUUID();
|
||||
if (avatar_id.isNull())
|
||||
avatar_id = gAgentID;
|
||||
// According to comments in LLIMMgr::addMessage(), if we get message
|
||||
// from ourselves, the sender id is set to null. This fixes EXT-875.
|
||||
LLUUID avatar_id = substitutions["FROM_ID"].asUUID();
|
||||
if (avatar_id.isNull())
|
||||
avatar_id = gAgentID;
|
||||
|
||||
LLToastIMPanel::Params im_p;
|
||||
im_p.notification = notification;
|
||||
im_p.avatar_id = avatar_id;
|
||||
im_p.from = substitutions["FROM"].asString();
|
||||
im_p.time = substitutions["TIME"].asString();
|
||||
im_p.message = substitutions["MESSAGE"].asString();
|
||||
im_p.session_id = substitutions["SESSION_ID"].asUUID();
|
||||
LLToastIMPanel::Params im_p;
|
||||
im_p.notification = notification;
|
||||
im_p.avatar_id = avatar_id;
|
||||
im_p.from = substitutions["FROM"].asString();
|
||||
im_p.time = substitutions["TIME"].asString();
|
||||
im_p.message = substitutions["MESSAGE"].asString();
|
||||
im_p.session_id = substitutions["SESSION_ID"].asUUID();
|
||||
|
||||
LLToastIMPanel* im_box = new LLToastIMPanel(im_p);
|
||||
LLToastIMPanel* im_box = new LLToastIMPanel(im_p);
|
||||
|
||||
LLToast::Params p;
|
||||
p.notif_id = notification->getID();
|
||||
p.session_id = im_p.session_id;
|
||||
p.notification = notification;
|
||||
p.panel = im_box;
|
||||
p.can_be_stored = false;
|
||||
LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
|
||||
if(channel)
|
||||
channel->addToast(p);
|
||||
LLToast::Params p;
|
||||
p.notif_id = notification->getID();
|
||||
p.session_id = im_p.session_id;
|
||||
p.notification = notification;
|
||||
p.panel = im_box;
|
||||
p.can_be_stored = false;
|
||||
LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
|
||||
if(channel)
|
||||
channel->addToast(p);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,6 +101,43 @@ BOOL LLSessionTimeoutTimer::tick()
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void process_dnd_im(const LLSD& notification)
|
||||
{
|
||||
LLSD data = notification["substitutions"];
|
||||
LLUUID sessionID = data["SESSION_ID"].asUUID();
|
||||
|
||||
//re-create the IM session if needed
|
||||
//(when coming out of DND mode upon app restart)
|
||||
if(!gIMMgr->hasSession(sessionID))
|
||||
{
|
||||
//reconstruct session using data from the notification
|
||||
std::string name = data["FROM"];
|
||||
LLAvatarName av_name;
|
||||
if (LLAvatarNameCache::get(data["FROM_ID"], &av_name))
|
||||
{
|
||||
name = av_name.getDisplayName();
|
||||
}
|
||||
|
||||
|
||||
LLIMModel::getInstance()->newSession(sessionID,
|
||||
name,
|
||||
IM_NOTHING_SPECIAL,
|
||||
data["FROM_ID"],
|
||||
false,
|
||||
false); //will need slight refactor to retrieve whether offline message or not (assume online for now)
|
||||
}
|
||||
|
||||
//For now always flash conversation line item
|
||||
LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
|
||||
im_box->flashConversationItemWidget(sessionID, true);
|
||||
|
||||
//And flash toolbar button
|
||||
gToolBarView->flashCommand(LLCommandId("chat"), true);
|
||||
}
|
||||
|
||||
|
||||
static void on_avatar_name_cache_toast(const LLUUID& agent_id,
|
||||
const LLAvatarName& av_name,
|
||||
LLSD msg)
|
||||
|
|
|
|||
Loading…
Reference in New Issue