diff options
author | Oz Linden <oz@lindenlab.com> | 2013-02-27 17:40:39 -0500 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2013-02-27 17:40:39 -0500 |
commit | 49ed1a4e32013cda716998784338a01b12c663ef (patch) | |
tree | 9c1f83682d8651160d6a52e26cc267b0d557d794 /indra/newview | |
parent | 13fe905b24546dda39a88466517aa0c6b449fbd8 (diff) |
finish changes to update handling, including notices of channel changes
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappviewer.cpp | 74 | ||||
-rw-r--r-- | indra/newview/lllogininstance.cpp | 28 | ||||
-rwxr-xr-x | indra/newview/llviewerwindow.cpp | 13 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 66 |
4 files changed, 138 insertions, 43 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 6ec6f5489c..18314904a7 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -121,6 +121,7 @@ #include <boost/bind.hpp> #include <boost/foreach.hpp> #include <boost/algorithm/string.hpp> +#include <boost/regex.hpp> #if LL_WINDOWS @@ -2831,25 +2832,46 @@ namespace { std::string notification_name; void (*apply_callback)(LLSD const &, LLSD const &) = NULL; + /* Build up the notification name... + * it can be any of these, which are included here for the sake of grep: + * RequiredUpdateDownloadedDialog + * RequiredUpdateDownloadedVerboseDialog + * OtherChannelRequiredUpdateDownloadedDialog + * OtherChannelRequiredUpdateDownloadedVerbose + * DownloadBackgroundTip + * DownloadBackgroundDialog + * OtherChannelDownloadBackgroundTip + * OtherChannelDownloadBackgroundDialog + */ + { + LL_DEBUGS("UpdaterService") << "data = "; + std::ostringstream data_dump; + LLSDSerialize::toNotation(data, data_dump); + LL_CONT << data_dump.str() << LL_ENDL; + } + if(data["channel"].asString() != LLVersionInfo::getChannel()) + { + notification_name.append("OtherChannel"); + } if(data["required"].asBoolean()) { if(LLStartUp::getStartupState() <= STATE_LOGIN_WAIT) { // The user never saw the progress bar. apply_callback = &apply_update_ok_callback; - notification_name = "RequiredUpdateDownloadedVerboseDialog"; + notification_name += "RequiredUpdateDownloadedVerboseDialog"; } else if(LLStartUp::getStartupState() < STATE_WORLD_INIT) { // The user is logging in but blocked. apply_callback = &apply_update_ok_callback; - notification_name = "RequiredUpdateDownloadedDialog"; + notification_name += "RequiredUpdateDownloadedDialog"; } else { // The user is already logged in; treat like an optional update. apply_callback = &apply_update_callback; - notification_name = "DownloadBackgroundTip"; + notification_name += "DownloadBackgroundTip"; } } else @@ -2859,36 +2881,47 @@ namespace { { // CHOP-262 we need to use a different notification // method prior to login. - notification_name = "DownloadBackgroundDialog"; + notification_name += "DownloadBackgroundDialog"; } else { - notification_name = "DownloadBackgroundTip"; + notification_name += "DownloadBackgroundTip"; } } LLSD substitutions; substitutions["VERSION"] = data["version"]; - - // truncate version at the rightmost '.' - std::string version_short(data["version"]); - size_t short_length = version_short.rfind('.'); - if (short_length != std::string::npos) + std::string new_channel = data["channel"].asString(); + substitutions["NEW_CHANNEL"] = new_channel; + std::string info_url = data["info_url"].asString(); + if ( !info_url.empty() ) { - version_short.resize(short_length); + substitutions["INFO_URL"] = info_url; } + else + { + LL_WARNS("UpdaterService") << "no info url supplied - defaulting to hard coded release notes pattern" << LL_ENDL; - LLUIString relnotes_url("[RELEASE_NOTES_BASE_URL][CHANNEL_URL]/[VERSION_SHORT]"); - relnotes_url.setArg("[VERSION_SHORT]", version_short); + // truncate version at the rightmost '.' + std::string version_short(data["version"]); + size_t short_length = version_short.rfind('.'); + if (short_length != std::string::npos) + { + version_short.resize(short_length); + } - // *TODO thread the update service's response through to this point - std::string const & channel = LLVersionInfo::getChannel(); - boost::shared_ptr<char> channel_escaped(curl_escape(channel.c_str(), channel.size()), &curl_free); + LLUIString relnotes_url("[RELEASE_NOTES_BASE_URL][CHANNEL_URL]/[VERSION_SHORT]"); + relnotes_url.setArg("[VERSION_SHORT]", version_short); - relnotes_url.setArg("[CHANNEL_URL]", channel_escaped.get()); - relnotes_url.setArg("[RELEASE_NOTES_BASE_URL]", LLTrans::getString("RELEASE_NOTES_BASE_URL")); - substitutions["RELEASE_NOTES_FULL_URL"] = relnotes_url.getString(); + // *TODO thread the update service's response through to this point + std::string const & channel = LLVersionInfo::getChannel(); + boost::shared_ptr<char> channel_escaped(curl_escape(channel.c_str(), channel.size()), &curl_free); + relnotes_url.setArg("[CHANNEL_URL]", channel_escaped.get()); + relnotes_url.setArg("[RELEASE_NOTES_BASE_URL]", LLTrans::getString("RELEASE_NOTES_BASE_URL")); + substitutions["INFO_URL"] = relnotes_url.getString(); + } + LLNotificationsUtil::add(notification_name, substitutions, LLSD(), apply_callback); } @@ -2940,7 +2973,8 @@ void LLAppViewer::initUpdater() U32 check_period = gSavedSettings.getU32("UpdaterServiceCheckPeriod"); bool willing_to_test; LL_DEBUGS("UpdaterService") << "channel " << channel << LL_ENDL; - if (channel.find("Test") != std::string::npos) // TBD - should be a regex + static const boost::regex is_test_channel("\\bTest$"); + if (boost::regex_search(channel, is_test_channel)) { LL_INFOS("UpdaterService") << "Test build: overriding willing_to_test by sending testno" << LL_ENDL; willing_to_test = false; diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index 12796ca262..b27a566c23 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -777,20 +777,20 @@ void LLLoginInstance::updateApp(bool mandatory, const std::string& auth_msg) LLSD payload; payload["mandatory"] = mandatory; -/* - We're constructing one of the following 9 strings here: - "DownloadWindowsMandatory" - "DownloadWindowsReleaseForDownload" - "DownloadWindows" - "DownloadMacMandatory" - "DownloadMacReleaseForDownload" - "DownloadMac" - "DownloadLinuxMandatory" - "DownloadLinuxReleaseForDownload" - "DownloadLinux" - - I've called them out explicitly in this comment so that they can be grepped for. - */ + /* + * We're constructing one of the following 9 strings here: + * "DownloadWindowsMandatory" + * "DownloadWindowsReleaseForDownload" + * "DownloadWindows" + * "DownloadMacMandatory" + * "DownloadMacReleaseForDownload" + * "DownloadMac" + * "DownloadLinuxMandatory" + * "DownloadLinuxReleaseForDownload" + * "DownloadLinux" + * + * I've called them out explicitly in this comment so that they can be grepped for. + */ std::string notification_name = "Download"; #if LL_WINDOWS diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 8c72421888..2d9c127b87 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -34,6 +34,7 @@ #include <fstream> #include <algorithm> #include <boost/lambda/core.hpp> +#include <boost/regex.hpp> #include "llagent.h" #include "llagentcamera.h" @@ -2235,9 +2236,9 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid) // no l10n problem because channel is always an english string std::string channel = LLVersionInfo::getChannel(); - bool isProject = (channel.find("Project") != std::string::npos); // TBD - should be a regex - bool isBeta = (channel.find("Beta") != std::string::npos); // TBD - should be a regex - bool isTest = (channel.find("Test") != std::string::npos); // TBD - should be a regex + static const boost::regex is_beta_channel("\\bBeta\\b"); + static const boost::regex is_project_channel("\\bProject\\b"); + static const boost::regex is_test_channel("\\bTest$"); // god more important than project, proj more important than grid if ( god_mode ) @@ -2251,15 +2252,15 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid) new_bg_color = LLUIColorTable::instance().getColor( "MenuNonProductionGodBgColor" ); } } - else if (isBeta) + else if (boost::regex_search(channel, is_beta_channel)) { new_bg_color = LLUIColorTable::instance().getColor( "MenuBarBetaBgColor" ); } - else if (isProject) + else if (boost::regex_search(channel, is_project_channel)) { new_bg_color = LLUIColorTable::instance().getColor( "MenuBarProjectBgColor" ); } - else if (isTest) + else if (boost::regex_search(channel, is_test_channel)) { new_bg_color = LLUIColorTable::instance().getColor( "MenuBarTestBgColor" ); } diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index c8f5cbb2b0..2319729339 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -3452,7 +3452,7 @@ or you can install it now. name="DownloadBackgroundTip" type="notify"> We have downloaded an update to your [APP_NAME] installation. -Version [VERSION] [[RELEASE_NOTES_FULL_URL] Information about this update] +Version [VERSION] [[INFO_URL] Information about this update] <tag>confirm</tag> <usetemplate name="okcancelbuttons" @@ -3465,7 +3465,7 @@ Version [VERSION] [[RELEASE_NOTES_FULL_URL] Information about this update] name="DownloadBackgroundDialog" type="alertmodal"> We have downloaded an update to your [APP_NAME] installation. -Version [VERSION] [[RELEASE_NOTES_FULL_URL] Information about this update] +Version [VERSION] [[INFO_URL] Information about this update] <tag>confirm</tag> <usetemplate name="okcancelbuttons" @@ -3478,7 +3478,7 @@ Version [VERSION] [[RELEASE_NOTES_FULL_URL] Information about this update] name="RequiredUpdateDownloadedVerboseDialog" type="alertmodal"> We have downloaded a required software update. -Version [VERSION] +Version [VERSION] [[INFO_URL] Information about this update] We must restart [APP_NAME] to install the update. <tag>confirm</tag> @@ -3492,6 +3492,66 @@ We must restart [APP_NAME] to install the update. name="RequiredUpdateDownloadedDialog" type="alertmodal"> We must restart [APP_NAME] to install the update. +[[INFO_URL] Information about this update] + <tag>confirm</tag> + <usetemplate + name="okbutton" + yestext="OK"/> + </notification> + + <notification + icon="notify.tga" + name="OtherChannelDownloadBackgroundTip" + type="notify"> +We have downloaded an update to your [APP_NAME] installation. +Version [VERSION] +This experimental viewer has been replaced by a [NEW_CHANNEL] viewer; +see [[INFO_URL] for details about this update] + <tag>confirm</tag> + <usetemplate + name="okcancelbuttons" + notext="Later..." + yestext="Install now and restart [APP_NAME]"/> + </notification> + + <notification + icon="alertmodal.tga" + name="OtherChannelDownloadBackgroundDialog" + type="alertmodal"> +We have downloaded an update to your [APP_NAME] installation. +Version [VERSION] +This experimental viewer has been replaced by a [NEW_CHANNEL] viewer; +see [[INFO_URL] Information about this update] + <tag>confirm</tag> + <usetemplate + name="okcancelbuttons" + notext="Later..." + yestext="Install now and restart [APP_NAME]"/> + </notification> + + <notification + icon="alertmodal.tga" + name="OtherChannelRequiredUpdateDownloadedVerboseDialog" + type="alertmodal"> +We have downloaded a required software update. +Version [VERSION] +This experimental viewer has been replaced by a [NEW_CHANNEL] viewer; +see [[INFO_URL] Information about this update] + +We must restart [APP_NAME] to install the update. + <tag>confirm</tag> + <usetemplate + name="okbutton" + yestext="OK"/> + </notification> + + <notification + icon="alertmodal.tga" + name="OtherChannelRequiredUpdateDownloadedDialog" + type="alertmodal"> +We must restart [APP_NAME] to install the update. +This experimental viewer has been replaced by a [NEW_CHANNEL] viewer; +see [[INFO_URL] Information about this update] <tag>confirm</tag> <usetemplate name="okbutton" |