Bug 599544 - Need notification for when storage format mismatch [r=mbrubeck, r=mconnor]
authorMark Finkle <mfinkle@mozilla.com>
Sun, 24 Oct 2010 13:46:12 -0400
changeset 2276 7b2fed0166ecc9a75b2252c744cd963cf661b7be
parent 2275 3aa1600d143ec3586b6fb42327a13d44c6228ae6
child 2277 5444d0d530ff739ecc95b7d54fc829823eb0e9ba
push id1928
push usermfinkle@mozilla.com
push dateSun, 24 Oct 2010 17:45:18 +0000
reviewersmbrubeck, mconnor
bugs599544
Bug 599544 - Need notification for when storage format mismatch [r=mbrubeck, r=mconnor]
chrome/content/sync.js
locales/en-US/chrome/browser.properties
--- a/chrome/content/sync.js
+++ b/chrome/content/sync.js
@@ -206,16 +206,52 @@ let WeaveGlue = {
       connect.setAttribute("desc", Weave.Utils.getErrorString(Weave.Status.login));
     else
       connect.removeAttribute("desc");
 
     // Reset the auto-connect flag after the first attempted login
     if (aTopic == "weave:service:login:finish" || aTopic == "weave:service:login:error")
       this.autoConnect = false;
 
+    // Check for a storage format update, update the user and load the Sync update page
+    if (aTopic =="weave:service:sync:error") {
+      let clientOutdated = false, remoteOutdated = false;
+      if (Weave.Status.sync == Weave.VERSION_OUT_OF_DATE) {
+        clientOutdated = true;
+      } else if (Weave.Status.sync == Weave.DESKTOP_VERSION_OUT_OF_DATE) {
+        remoteOutdated = true;
+      } else if (Weave.Status.service == Weave.SYNC_FAILED_PARTIAL) {
+        // Some engines failed, check for per-engine compat
+        for (let [engine, reason] in Iterator(Weave.Status.engines)) {
+           clientOutdated = clientOutdated || reason == Weave.VERSION_OUT_OF_DATE;
+           remoteOutdated = remoteOutdated || reason == Weave.DESKTOP_VERSION_OUT_OF_DATE;
+        }
+      }
+
+      if (clientOutdated || remoteOutdated) {
+        let bundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
+        let brand = Services.strings.createBundle("chrome://branding/locale/brand.properties");
+        let brandName = brand.GetStringFromName("brandShortName");
+
+        let type = clientOutdated ? "client" : "remote";
+        let message = bundle.GetStringFromName("sync.update." + type);
+        message = message.replace("#1", brandName);
+        message = message.replace("#2", Services.appinfo.version);
+        let title = bundle.GetStringFromName("sync.update.title")
+        let button = bundle.GetStringFromName("sync.update.button")
+        let close = bundle.GetStringFromName("sync.update.close")
+
+        let flags = Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING +
+                    Services.prompt.BUTTON_POS_1 * Services.prompt.BUTTON_TITLE_IS_STRING;
+        let choice = Services.prompt.confirmEx(window, title, message, flags, button, close, null, null, {});
+        if (choice == 0)
+          Browser.addTab("https://services.mozilla.com/update/", true, Browser.selectedTab);
+      }
+    }
+
     // Load the values for the string inputs
     account.value = Weave.Service.account || "";
     pass.value = Weave.Service.password || "";
     let pp = Weave.Service.passphrase || "";
     if (pp.length == 20)
       pp = this.hyphenatePassphrase(pp);
     secret.value = pp;
     device.value = Weave.Clients.localName || "";
--- a/locales/en-US/chrome/browser.properties
+++ b/locales/en-US/chrome/browser.properties
@@ -184,8 +184,18 @@ homepage.custom2=Custom Page
 pageactions.saveas.pdf=Save As PDF
 pageactions.geo=Location
 pageactions.popup=Popups
 pageactions.offline-app=Offline Storage
 pageactions.password=Password
 
 # Open Search
 opensearch.searchWith=Search With:
+
+# Mobile Sync
+# LOCALIZATION NOTE (sync.clientUpdate, sync.remoteUpdate):
+# #1 is the "application name"
+# #2 is the "version"
+sync.update.client=#1 #2 is not compatible with the latest version of Firefox Sync. Please update to the latest version.
+sync.update.remote=#1 #2 is not compatible with older versions of Firefox Sync. Please update Firefox on your other computer(s).
+sync.update.title=Firefox Sync
+sync.update.button=Learn More
+sync.update.close=Close