Bug 1157526 - (Part 6) Replace "Already signed in" toast with snackbar. r=mcomella
authorSebastian Kaspari <s.kaspari@gmail.com>
Thu, 12 Nov 2015 18:23:32 +0100
changeset 308716 68df6df19968bf7015ace65985e63a577a7d4725
parent 308715 a0d08563a76e53b393b81d73538e43e6591b3797
child 308717 066ea49889a89021872b6ed2845ff8234b90466e
child 308793 e68c0bbf6818f1e1128595d2012273f22770b352
push id7514
push users.kaspari@gmail.com
push dateFri, 13 Nov 2015 14:12:41 +0000
reviewersmcomella
bugs1157526
milestone45.0a1
Bug 1157526 - (Part 6) Replace "Already signed in" toast with snackbar. r=mcomella
mobile/android/modules/FxAccountsWebChannel.jsm
--- a/mobile/android/modules/FxAccountsWebChannel.jsm
+++ b/mobile/android/modules/FxAccountsWebChannel.jsm
@@ -32,16 +32,18 @@ const COMMAND_DELETE_ACCOUNT       = "fx
 const COMMAND_PROFILE_CHANGE       = "profile:change";
 const COMMAND_SYNC_PREFERENCES     = "fxaccounts:sync_preferences";
 
 const PREF_LAST_FXA_USER           = "identity.fxaccounts.lastSignedInUserHash";
 
 XPCOMUtils.defineLazyGetter(this, "strings",
                             () => Services.strings.createBundle("chrome://browser/locale/aboutAccounts.properties")); /*global strings */
 
+XPCOMUtils.defineLazyModuleGetter(this, "Snackbars", "resource://gre/modules/Snackbars.jsm");
+
 Object.defineProperty(this, "NativeWindow",
                       { get: () => Services.wm.getMostRecentWindow("navigator:browser").NativeWindow }); /*global NativeWindow */
 
 this.FxAccountsWebChannelHelpers = function() {
 };
 
 this.FxAccountsWebChannelHelpers.prototype = {
   /**
@@ -216,19 +218,18 @@ this.FxAccountsWebChannel.prototype = {
                 if (account.email == data.email) {
                   // In future, we should use a UID for this comparison.
                   log.d("Relinking existing Android Account: email addresses agree.");
                   respond({ok: true});
                 } else {
                   log.w("Not relinking existing Android Account: email addresses disagree!");
                   let message = strings.GetStringFromName("relinkDenied.message");
                   let buttonLabel = strings.GetStringFromName("relinkDenied.openPrefs");
-                  NativeWindow.toast.show(message, "long", {
-                    button: {
-                      icon: "drawable://switch_button_icon",
+                  Snackbars.show(message, Snackbars.LENGTH_LONG, {
+                    action: {
                       label: buttonLabel,
                       callback: () => {
                         // We have an account, so this opens Sync native preferences.
                         Accounts.launchSetup();
                       },
                     }
                   });
                   respond({ok: false});