Bug 975423 - Don't show sync promo banner ever again after user hits close button. r=bnicholson a=sledru
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Sat, 22 Feb 2014 09:41:31 -0800
changeset 183087 e4d7ae802d570e3a3a5cd5778999dcd106b7e906
parent 183086 aa11ceff55d19295957b96843d87fed28132267a
child 183088 d60e6d4024e7def22bc118fc43ea473c40515a37
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson, sledru
bugs975423
milestone29.0a2
Bug 975423 - Don't show sync promo banner ever again after user hits close button. r=bnicholson a=sledru
mobile/android/components/Snippets.js
--- a/mobile/android/components/Snippets.js
+++ b/mobile/android/components/Snippets.js
@@ -335,21 +335,26 @@ function loadSyncPromoBanner() {
       if (exist) {
         return;
       }
 
       let stringBundle = Services.strings.createBundle("chrome://browser/locale/sync.properties");
       let text = stringBundle.GetStringFromName("promoBanner.message.text");
       let link = stringBundle.GetStringFromName("promoBanner.message.link");
 
-      Home.banner.add({
+      let id = Home.banner.add({
         text: text + "<a href=\"#\">" + link + "</a>",
         icon: "drawable://sync_promo",
         onclick: function() {
           Accounts.launchSetup();
+        },
+        ondismiss: function() {
+          // Remove the sync promo message from the banner and never try to show it again.
+          Home.banner.remove(id);
+          Services.prefs.setBoolPref("browser.snippets.syncPromo.enabled", false);
         }
       });
     },
     (err) => {
       Cu.reportError("Error checking whether sync account exists: " + err);
     }
   );
 }