CHUI-850 FIXED Unread notifications are lost after relog in certain circumstances
parent
2b8beeeff1
commit
725b107e08
|
|
@ -139,8 +139,6 @@ void LLChannelManager::onLoginCompleted()
|
|||
}
|
||||
|
||||
LLPersistentNotificationStorage::getInstance()->loadNotifications();
|
||||
|
||||
LLDoNotDisturbNotificationStorage::getInstance()->initialize();
|
||||
LLDoNotDisturbNotificationStorage::getInstance()->loadNotifications();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ BOOL LLDoNotDisturbNotificationStorageTimer::tick()
|
|||
|
||||
LLDoNotDisturbNotificationStorage::LLDoNotDisturbNotificationStorage()
|
||||
: LLSingleton<LLDoNotDisturbNotificationStorage>()
|
||||
, LLNotificationStorage(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "dnd_notifications.xml"))
|
||||
, LLNotificationStorage("")
|
||||
, mDirty(false)
|
||||
{
|
||||
nameToPayloadParameterMap[toastName] = "SESSION_ID";
|
||||
|
|
@ -83,6 +83,7 @@ LLDoNotDisturbNotificationStorage::~LLDoNotDisturbNotificationStorage()
|
|||
|
||||
void LLDoNotDisturbNotificationStorage::initialize()
|
||||
{
|
||||
setFileName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "dnd_notifications.xml"));
|
||||
getCommunicationChannel()->connectFailedFilter(boost::bind(&LLDoNotDisturbNotificationStorage::onChannelChanged, this, _1));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ public:
|
|||
protected:
|
||||
bool writeNotifications(const LLSD& pNotificationData) const;
|
||||
bool readNotifications(LLSD& pNotificationData) const;
|
||||
void setFileName(std::string pFileName) {mFileName = pFileName;}
|
||||
|
||||
LLNotificationResponderInterface* createResponder(const std::string& pNotificationName, const LLSD& pParams) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@
|
|||
|
||||
LLPersistentNotificationStorage::LLPersistentNotificationStorage()
|
||||
: LLSingleton<LLPersistentNotificationStorage>()
|
||||
, LLNotificationStorage(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "open_notifications.xml"))
|
||||
, LLNotificationStorage("")
|
||||
, mLoaded(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -89,8 +90,13 @@ void LLPersistentNotificationStorage::loadNotifications()
|
|||
|
||||
LL_INFOS("LLPersistentNotificationStorage") << "start loading notifications" << LL_ENDL;
|
||||
|
||||
LLNotifications::instance().getChannel("Persistent")->
|
||||
connectChanged(boost::bind(&LLPersistentNotificationStorage::onPersistentChannelChanged, this, _1));
|
||||
if (mLoaded)
|
||||
{
|
||||
LL_INFOS("LLPersistentNotificationStorage") << "notifications already loaded, exiting" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
|
||||
mLoaded = true;
|
||||
|
||||
LLSD input;
|
||||
if (!readNotifications(input) ||input.isUndefined())
|
||||
|
|
@ -135,8 +141,20 @@ void LLPersistentNotificationStorage::loadNotifications()
|
|||
LL_INFOS("LLPersistentNotificationStorage") << "finished loading notifications" << LL_ENDL;
|
||||
}
|
||||
|
||||
void LLPersistentNotificationStorage::initialize()
|
||||
{
|
||||
setFileName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "open_notifications.xml"));
|
||||
LLNotifications::instance().getChannel("Persistent")->
|
||||
connectChanged(boost::bind(&LLPersistentNotificationStorage::onPersistentChannelChanged, this, _1));
|
||||
}
|
||||
|
||||
bool LLPersistentNotificationStorage::onPersistentChannelChanged(const LLSD& payload)
|
||||
{
|
||||
// In case we received channel changed signal but haven't yet loaded notifications, do it
|
||||
if (!mLoaded)
|
||||
{
|
||||
loadNotifications();
|
||||
}
|
||||
// we ignore "load" messages, but rewrite the persistence file on any other
|
||||
const std::string sigtype = payload["sigtype"].asString();
|
||||
if ("load" != sigtype)
|
||||
|
|
|
|||
|
|
@ -53,10 +53,13 @@ public:
|
|||
void saveNotifications();
|
||||
void loadNotifications();
|
||||
|
||||
void initialize();
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
bool onPersistentChannelChanged(const LLSD& payload);
|
||||
bool mLoaded;
|
||||
};
|
||||
|
||||
#endif // LL_LLPERSISTENTNOTIFICATIONSTORAGE_H
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
#include "lllandmark.h"
|
||||
#include "llcachename.h"
|
||||
#include "lldir.h"
|
||||
#include "lldonotdisturbnotificationstorage.h"
|
||||
#include "llerrorcontrol.h"
|
||||
#include "llfloaterreg.h"
|
||||
#include "llfocusmgr.h"
|
||||
|
|
@ -68,6 +69,7 @@
|
|||
#include "llfloaterimnearbychat.h"
|
||||
#include "llnotifications.h"
|
||||
#include "llnotificationsutil.h"
|
||||
#include "llpersistentnotificationstorage.h"
|
||||
#include "llteleporthistory.h"
|
||||
#include "llregionhandle.h"
|
||||
#include "llsd.h"
|
||||
|
|
@ -900,6 +902,10 @@ bool idle_startup()
|
|||
gDirUtilp->setLindenUserDir(userid);
|
||||
LLFile::mkdir(gDirUtilp->getLindenUserDir());
|
||||
|
||||
// As soon as directories are ready initialize notification storages
|
||||
LLPersistentNotificationStorage::getInstance()->initialize();
|
||||
LLDoNotDisturbNotificationStorage::getInstance()->initialize();
|
||||
|
||||
// Set PerAccountSettingsFile to the default value.
|
||||
gSavedSettings.setString("PerAccountSettingsFile",
|
||||
gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,
|
||||
|
|
|
|||
Loading…
Reference in New Issue