summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-08-18 18:51:42 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-08-18 18:53:11 +0300
commitd32e685d96e19be3711e09ab626203d248d3594b (patch)
tree338c065af93e5467276e15bbf3450277a7e4d72a
parent4800e3e4164640bc98f92f9c50d2ab7b882f97a1 (diff)
SL-19929 Small rework of a 'feature' notification
To make multiple parallel features possible
-rw-r--r--indra/newview/app_settings/settings.xml4
-rw-r--r--indra/newview/llagent.cpp80
-rw-r--r--indra/newview/llagent.h5
-rw-r--r--indra/newview/llfloaternewfeaturenotification.cpp8
-rw-r--r--indra/newview/llsidepanelinventory.cpp2
-rw-r--r--indra/newview/skins/default/xui/en/floater_new_feature_notification.xml12
6 files changed, 90 insertions, 21 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index b812219685..edb0c6b4d1 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -5504,9 +5504,9 @@
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
- <string>S32</string>
+ <string>LLSD</string>
<key>Value</key>
- <integer>0</integer>
+ <string></string>
</map>
<key>LastFindPanel</key>
<map>
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 8574134032..8cda46d390 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -121,6 +121,8 @@ const F32 MIN_FIDGET_TIME = 8.f; // seconds
const F32 MAX_FIDGET_TIME = 20.f; // seconds
const S32 UI_FEATURE_VERSION = 1;
+// for version 1: 1 - inventory, 2 - gltf
+const S32 UI_FEATURE_FLAGS = 1;
// The agent instance.
LLAgent gAgent;
@@ -568,27 +570,77 @@ void LLAgent::setFirstLogin(bool b)
if (mFirstLogin)
{
// Don't notify new users about new features
- S32 feature_version = gSavedSettings.getS32("LastUIFeatureVersion");
- if (feature_version < UI_FEATURE_VERSION)
+ if (getFeatureVersion() <= UI_FEATURE_VERSION)
{
- gSavedSettings.setS32("LastUIFeatureVersion", UI_FEATURE_VERSION);
+ setFeatureVersion(UI_FEATURE_VERSION, UI_FEATURE_FLAGS);
}
}
}
-void LLAgent::showLatestFeatureNotification()
+void LLAgent::setFeatureVersion(S32 version, S32 flags)
{
- // Notify user about new thumbnail support
- S32 feature_version = gSavedSettings.getS32("LastUIFeatureVersion");
- if (feature_version < UI_FEATURE_VERSION)
+ LLSD updated_version;
+ updated_version["version"] = version;
+ updated_version["flags"] = flags;
+ gSavedSettings.setLLSD("LastUIFeatureVersion", updated_version);
+}
+
+S32 LLAgent::getFeatureVersion()
+{
+ S32 version;
+ S32 flags;
+ getFeatureVersionAndFlags(version, flags);
+ return version;
+}
+
+void LLAgent::getFeatureVersionAndFlags(S32& version, S32& flags)
+{
+ version = 0;
+ flags = 0;
+ LLSD feature_version = gSavedSettings.getLLSD("LastUIFeatureVersion");
+ if (feature_version.isInteger())
+ {
+ version = feature_version.asInteger();
+ flags = UI_FEATURE_FLAGS;
+ }
+ else if (feature_version.isMap())
+ {
+ version = feature_version["version"];
+ flags = feature_version["flags"];
+ }
+ else if (!feature_version.isString() && !feature_version.isUndefined())
{
- // Need to open on top even if called from onOpen,
- // do on idle to make sure it's on top
- doOnIdleOneTime([]()
- {
- LLFloaterReg::showInstance("new_feature_notification");
- });
- gSavedSettings.setS32("LastUIFeatureVersion", UI_FEATURE_VERSION);
+ // is something newer inside?
+ version = UI_FEATURE_VERSION;
+ flags = UI_FEATURE_FLAGS;
+ }
+}
+
+void LLAgent::showLatestFeatureNotification(const std::string key)
+{
+ S32 version;
+ S32 flags; // a single release can have multiple new features
+ getFeatureVersionAndFlags(version, flags);
+ if (version <= UI_FEATURE_VERSION && (flags & UI_FEATURE_FLAGS) != UI_FEATURE_FLAGS)
+ {
+ if (key == "inventory")
+ {
+ S32 flag = 1;
+
+ // Notify user about new thumbnail support
+ if ((flags & flag) == 0)
+ {
+ // Need to open on top even if called from onOpen,
+ // do on idle to make sure it's on top
+ LLSD floater_key(key);
+ doOnIdleOneTime([floater_key]()
+ {
+ LLFloaterReg::showInstance("new_feature_notification", floater_key);
+ });
+
+ setFeatureVersion(UI_FEATURE_VERSION, flags | flag);
+ }
+ }
}
}
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index fb9ac402e1..0ce6fda131 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -122,7 +122,10 @@ public:
bool isFirstLogin() const { return mFirstLogin; }
bool isInitialized() const { return mInitialized; }
- void showLatestFeatureNotification();
+ void setFeatureVersion(S32 version, S32 flags);
+ S32 getFeatureVersion();
+ void getFeatureVersionAndFlags(S32 &version, S32 &flags);
+ void showLatestFeatureNotification(const std::string key);
public:
std::string mMOTD; // Message of the day
private:
diff --git a/indra/newview/llfloaternewfeaturenotification.cpp b/indra/newview/llfloaternewfeaturenotification.cpp
index 7c3fe8cdc8..3a2035b9b9 100644
--- a/indra/newview/llfloaternewfeaturenotification.cpp
+++ b/indra/newview/llfloaternewfeaturenotification.cpp
@@ -42,6 +42,14 @@ BOOL LLFloaterNewFeatureNotification::postBuild()
{
setCanDrag(FALSE);
getChild<LLButton>("close_btn")->setCommitCallback(boost::bind(&LLFloaterNewFeatureNotification::onCloseBtn, this));
+
+ const std::string title_txt = "title_txt";
+ const std::string dsc_txt = "description_txt";
+ std::string feature = "_" + getKey().asString();
+
+ getChild<LLUICtrl>(title_txt)->setValue(getString(title_txt + feature));
+ getChild<LLUICtrl>(dsc_txt)->setValue(getString(dsc_txt + feature));
+
return TRUE;
}
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index dde260eb7f..e970f70e92 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -401,7 +401,7 @@ void LLSidepanelInventory::onOpen(const LLSD& key)
}
#endif
- gAgent.showLatestFeatureNotification();
+ gAgent.showLatestFeatureNotification("inventory");
}
void LLSidepanelInventory::performActionOnSelection(const std::string &action)
diff --git a/indra/newview/skins/default/xui/en/floater_new_feature_notification.xml b/indra/newview/skins/default/xui/en/floater_new_feature_notification.xml
index 370a08f16a..5f0eeab71c 100644
--- a/indra/newview/skins/default/xui/en/floater_new_feature_notification.xml
+++ b/indra/newview/skins/default/xui/en/floater_new_feature_notification.xml
@@ -13,6 +13,13 @@
can_drag_on_left="false"
can_minimize="false"
can_close="false">
+ <floater.string name="title_txt_inventory">
+New inventory features
+ </floater.string>
+ <floater.string name="description_txt_inventory">
+You can now add preview images to inventory items and view a folder in its own window.
+Learn more in this [https://community.secondlife.com/blogs/entry/13637-new-features-inventory-item-preview-and-single-folder-view/ blogpost]
+ </floater.string>
<text
type="string"
length="1"
@@ -25,7 +32,7 @@
top="10"
right="-10"
name="title_txt">
-New inventory features
+New feature
</text>
<text
type="string"
@@ -39,8 +46,7 @@ New inventory features
right="-10"
word_wrap="true"
name="description_txt">
-You can now add preview images to inventory items and view a folder in its own window.
-Learn more in this [https://community.secondlife.com/blogs/entry/13637-new-features-inventory-item-preview-and-single-folder-view/ blogpost]
+Feature description
</text>
<button
follows="bottom|left|right"