diff options
author | brad kittenbrink <brad@lindenlab.com> | 2010-12-10 18:31:38 -0800 |
---|---|---|
committer | brad kittenbrink <brad@lindenlab.com> | 2010-12-10 18:31:38 -0800 |
commit | e58965255d1edcb44256e1b27d813167df746034 (patch) | |
tree | 8ea943a40cb9434155ae4f8878e6e81f6760bf5b /indra/newview/llappviewer.cpp | |
parent | d85c7264da14a753e055990fe9b653bbd5847300 (diff) |
CHOP-260 implementation. Update Ready notification gets real UI.
reviewed by Mani.
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r-- | indra/newview/llappviewer.cpp | 78 |
1 files changed, 47 insertions, 31 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 5bd0a0d297..eb8d87e184 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2417,55 +2417,71 @@ namespace { LLUpdaterService().startChecking(install_if_ready); } - void on_required_update_downloaded(LLSD const & data) + void on_update_downloaded(LLSD const & data) { std::string notification_name; - if(LLStartUp::getStartupState() <= STATE_LOGIN_WAIT) + void (*apply_callback)(LLSD const &, LLSD const &) = NULL; + + if(data["required"].asBoolean()) { - // The user never saw the progress bar. - notification_name = "RequiredUpdateDownloadedVerboseDialog"; + apply_callback = &apply_update_ok_callback; + if(LLStartUp::getStartupState() <= STATE_LOGIN_WAIT) + { + // The user never saw the progress bar. + notification_name = "RequiredUpdateDownloadedVerboseDialog"; + } + else + { + notification_name = "RequiredUpdateDownloadedDialog"; + } } else { - notification_name = "RequiredUpdateDownloadedDialog"; + apply_callback = &apply_update_callback; + if(LLStartUp::getStartupState() < STATE_STARTED) + { + // CHOP-262 we need to use a different notification + // method prior to login. + notification_name = "DownloadBackgroundDialog"; + } + else + { + notification_name = "DownloadBackgroundTip"; + } } + LLSD substitutions; substitutions["VERSION"] = data["version"]; - LLNotificationsUtil::add(notification_name, substitutions, LLSD(), &apply_update_ok_callback); - } - - void on_optional_update_downloaded(LLSD const & data) - { - std::string notification_name; - if(LLStartUp::getStartupState() < STATE_STARTED) - { - // CHOP-262 we need to use a different notification - // method prior to login. - notification_name = "DownloadBackgroundDialog"; - } - else + + // truncate version at the rightmost '.' + std::string version_short(data["version"]); + size_t short_length = version_short.rfind('.'); + if (short_length != std::string::npos) { - notification_name = "DownloadBackgroundTip"; + version_short.resize(short_length); } - LLSD substitutions; - substitutions["VERSION"] = data["version"]; - LLNotificationsUtil::add(notification_name, substitutions, LLSD(), apply_update_callback); - } + LLUIString relnotes_url("[RELEASE_NOTES_BASE_URL][CHANNEL_URL]/[VERSION_SHORT]"); + relnotes_url.setArg("[VERSION_SHORT]", version_short); + + // *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["RELEASE_NOTES_FULL_URL"] = relnotes_url.getString(); + + LLNotificationsUtil::add(notification_name, substitutions, LLSD(), apply_callback); + } + bool notify_update(LLSD const & evt) { std::string notification_name; switch (evt["type"].asInteger()) { case LLUpdaterService::DOWNLOAD_COMPLETE: - if(evt["required"].asBoolean()) - { - on_required_update_downloaded(evt); - } - else - { - on_optional_update_downloaded(evt); - } + on_update_downloaded(evt); break; case LLUpdaterService::INSTALL_ERROR: LLNotificationsUtil::add("FailedUpdateInstall"); |