CHUI-687: Problem: User sees inventory offer notifications for deleted items when logging in from do not disturb mode. Resolution: If an item that is deletes has a DND notification saved, then remove that notification so that it doesn't appear onec the user exists DND mode.
parent
9e6677ffc2
commit
d0204ab367
|
|
@ -399,6 +399,10 @@ LLFolderViewItem* LLFolderView::getCurSelectedItem( void )
|
|||
return NULL;
|
||||
}
|
||||
|
||||
LLFolderView::selected_items_t& LLFolderView::getSelectedItems( void )
|
||||
{
|
||||
return mSelectedItems;
|
||||
}
|
||||
|
||||
// Record the selected item and pass it down the hierachy.
|
||||
BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem,
|
||||
|
|
@ -752,8 +756,8 @@ void LLFolderView::removeSelectedItems()
|
|||
{
|
||||
// change selection on successful delete
|
||||
setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel->hasFocus());
|
||||
}
|
||||
}
|
||||
}
|
||||
arrangeAll();
|
||||
}
|
||||
else if (count > 1)
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ public:
|
|||
};
|
||||
|
||||
friend class LLFolderViewScrollContainer;
|
||||
typedef std::deque<LLFolderViewItem*> selected_items_t;
|
||||
|
||||
LLFolderView(const Params&);
|
||||
virtual ~LLFolderView( void );
|
||||
|
|
@ -138,6 +139,7 @@ public:
|
|||
|
||||
// Get the last selected item
|
||||
virtual LLFolderViewItem* getCurSelectedItem( void );
|
||||
selected_items_t& getSelectedItems( void );
|
||||
|
||||
// Record the selected item and pass it down the hierarchy.
|
||||
virtual BOOL setSelection(LLFolderViewItem* selection, BOOL openitem,
|
||||
|
|
@ -261,7 +263,6 @@ protected:
|
|||
protected:
|
||||
LLHandle<LLView> mPopupMenuHandle;
|
||||
|
||||
typedef std::deque<LLFolderViewItem*> selected_items_t;
|
||||
selected_items_t mSelectedItems;
|
||||
BOOL mKeyboardSelection;
|
||||
BOOL mAllowMultiSelect;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@
|
|||
#include "lluuid.h"
|
||||
|
||||
static const F32 DND_TIMER = 3.0;
|
||||
const std::string toastName = "IMToast";
|
||||
const char * LLDoNotDisturbNotificationStorage::toastName = "IMToast";
|
||||
const char * LLDoNotDisturbNotificationStorage::offerName = "UserGiveItem";
|
||||
|
||||
LLDoNotDisturbNotificationStorageTimer::LLDoNotDisturbNotificationStorageTimer() : LLEventTimer(DND_TIMER)
|
||||
{
|
||||
|
|
@ -72,6 +73,8 @@ LLDoNotDisturbNotificationStorage::LLDoNotDisturbNotificationStorage()
|
|||
, LLNotificationStorage(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "dnd_notifications.xml"))
|
||||
, mDirty(false)
|
||||
{
|
||||
nameToPayloadParameterMap[toastName] = "SESSION_ID";
|
||||
nameToPayloadParameterMap[offerName] = "object_id";
|
||||
}
|
||||
|
||||
LLDoNotDisturbNotificationStorage::~LLDoNotDisturbNotificationStorage()
|
||||
|
|
@ -234,15 +237,16 @@ LLNotificationChannelPtr LLDoNotDisturbNotificationStorage::getCommunicationChan
|
|||
return channelPtr;
|
||||
}
|
||||
|
||||
void LLDoNotDisturbNotificationStorage::removeIMNotification(const LLUUID& session_id)
|
||||
void LLDoNotDisturbNotificationStorage::removeNotification(const char * name, const LLUUID& id)
|
||||
{
|
||||
LLNotifications& instance = LLNotifications::instance();
|
||||
LLNotificationChannelPtr channelPtr = getCommunicationChannel();
|
||||
LLCommunicationChannel *commChannel = dynamic_cast<LLCommunicationChannel*>(channelPtr.get());
|
||||
LLNotificationPtr notification;
|
||||
LLSD substitutions;
|
||||
LLUUID notificationSessionID;
|
||||
LLSD payload;
|
||||
LLUUID notificationObjectID;
|
||||
std::string notificationName;
|
||||
std::string payloadVariable = nameToPayloadParameterMap[name];
|
||||
LLCommunicationChannel::history_list_t::iterator it;
|
||||
std::vector<LLCommunicationChannel::history_list_t::iterator> itemsToRemove;
|
||||
|
||||
|
|
@ -252,18 +256,18 @@ void LLDoNotDisturbNotificationStorage::removeIMNotification(const LLUUID& sessi
|
|||
++it)
|
||||
{
|
||||
notification = it->second;
|
||||
substitutions = notification->getSubstitutions();
|
||||
notificationSessionID = substitutions["SESSION_ID"].asUUID();
|
||||
payload = notification->getPayload();
|
||||
notificationObjectID = payload[payloadVariable].asUUID();
|
||||
notificationName = notification->getName();
|
||||
|
||||
if(notificationName == toastName
|
||||
&& session_id == notificationSessionID)
|
||||
if(notificationName == name
|
||||
&& id == notificationObjectID)
|
||||
{
|
||||
itemsToRemove.push_back(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Remove the notifications
|
||||
if(itemsToRemove.size())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ class LLDoNotDisturbNotificationStorage : public LLSingleton<LLDoNotDisturbNotif
|
|||
{
|
||||
LOG_CLASS(LLDoNotDisturbNotificationStorage);
|
||||
public:
|
||||
static const char * toastName;
|
||||
static const char * offerName;
|
||||
|
||||
LLDoNotDisturbNotificationStorage();
|
||||
~LLDoNotDisturbNotificationStorage();
|
||||
|
||||
|
|
@ -58,7 +61,7 @@ public:
|
|||
void saveNotifications();
|
||||
void loadNotifications();
|
||||
void updateNotifications();
|
||||
void removeIMNotification(const LLUUID& session_id);
|
||||
void removeNotification(const char * name, const LLUUID& id);
|
||||
|
||||
protected:
|
||||
|
||||
|
|
@ -68,6 +71,7 @@ private:
|
|||
|
||||
LLNotificationChannelPtr getCommunicationChannel() const;
|
||||
bool onChannelChanged(const LLSD& pPayload);
|
||||
std::map<std::string, std::string> nameToPayloadParameterMap;
|
||||
};
|
||||
|
||||
#endif // LL_LLDONOTDISTURBNOTIFICATIONSTORAGE_H
|
||||
|
|
|
|||
|
|
@ -1316,7 +1316,7 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool
|
|||
//Nearby chat (Null) IMs are not stored while in DND mode, so can ignore removal
|
||||
if(gAgent.isDoNotDisturb() && session_id.notNull())
|
||||
{
|
||||
LLDoNotDisturbNotificationStorage::getInstance()->removeIMNotification(session_id);
|
||||
LLDoNotDisturbNotificationStorage::getInstance()->removeNotification(LLDoNotDisturbNotificationStorage::toastName, session_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ static void on_avatar_name_cache_toast(const LLUUID& agent_id,
|
|||
args["FROM"] = av_name.getCompleteName();
|
||||
args["FROM_ID"] = msg["from_id"];
|
||||
args["SESSION_ID"] = msg["session_id"];
|
||||
LLNotificationsUtil::add("IMToast", args, LLSD(), boost::bind(&LLFloaterIMContainer::showConversation, LLFloaterIMContainer::getInstance(), msg["session_id"].asUUID()));
|
||||
LLNotificationsUtil::add("IMToast", args, args, boost::bind(&LLFloaterIMContainer::showConversation, LLFloaterIMContainer::getInstance(), msg["session_id"].asUUID()));
|
||||
}
|
||||
|
||||
void on_new_message(const LLSD& msg)
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
#include "llappearancemgr.h"
|
||||
#include "llappviewer.h"
|
||||
#include "llclipboard.h"
|
||||
#include "lldonotdisturbnotificationstorage.h"
|
||||
#include "llfloaterinventory.h"
|
||||
#include "llfloatersidepanelcontainer.h"
|
||||
#include "llfocusmgr.h"
|
||||
|
|
@ -1132,11 +1133,32 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
|
|||
}
|
||||
}
|
||||
|
||||
void LLInventoryAction::removeItemFromDND(LLFolderView* root)
|
||||
{
|
||||
//Get selected items
|
||||
LLFolderView::selected_items_t selectedItems = root->getSelectedItems();
|
||||
LLFolderViewModelItemInventory * viewModel = NULL;
|
||||
|
||||
//If user is in DND and deletes item, make sure the notification is not displayed by removing the notification
|
||||
//from DND history and .xml file. Once this is done, upon exit of DND mode the item deleted will not show a notification.
|
||||
for(LLFolderView::selected_items_t::iterator it = selectedItems.begin(); it != selectedItems.end(); ++it)
|
||||
{
|
||||
viewModel = dynamic_cast<LLFolderViewModelItemInventory *>((*it)->getViewModelItem());
|
||||
|
||||
if(viewModel && viewModel->getUUID().notNull())
|
||||
{
|
||||
//Will remove the item offer notification
|
||||
LLDoNotDisturbNotificationStorage::instance().removeNotification(LLDoNotDisturbNotificationStorage::offerName, viewModel->getUUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLInventoryAction::onItemsRemovalConfirmation( const LLSD& notification, const LLSD& response, LLFolderView* root )
|
||||
{
|
||||
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
|
||||
if (option == 0)
|
||||
{
|
||||
removeItemFromDND(root);
|
||||
root->removeSelectedItems();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -433,6 +433,7 @@ struct LLInventoryAction
|
|||
static void doToSelected(class LLInventoryModel* model, class LLFolderView* root, const std::string& action);
|
||||
|
||||
static void onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, LLFolderView* root);
|
||||
static void removeItemFromDND(LLFolderView* root);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue