summaryrefslogtreecommitdiffstats
path: root/mobile/android/modules/Snackbars.jsm
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-04-23 15:32:23 -0400
committerMatt A. Tobin <email@mattatobin.com>2019-04-23 15:32:23 -0400
commitabe80cc31d5a40ebed743085011fbcda0c1a9a10 (patch)
treefb3762f06b84745b182af281abb107b95a9fcf01 /mobile/android/modules/Snackbars.jsm
parent63295d0087eb58a6eb34cad324c4c53d1b220491 (diff)
downloadUXP-abe80cc31d5a40ebed743085011fbcda0c1a9a10.tar
UXP-abe80cc31d5a40ebed743085011fbcda0c1a9a10.tar.gz
UXP-abe80cc31d5a40ebed743085011fbcda0c1a9a10.tar.lz
UXP-abe80cc31d5a40ebed743085011fbcda0c1a9a10.tar.xz
UXP-abe80cc31d5a40ebed743085011fbcda0c1a9a10.zip
Issue #1053 - Drop support Android and remove Fennec - Part 1a: Remove mobile/android
Diffstat (limited to 'mobile/android/modules/Snackbars.jsm')
-rw-r--r--mobile/android/modules/Snackbars.jsm72
1 files changed, 0 insertions, 72 deletions
diff --git a/mobile/android/modules/Snackbars.jsm b/mobile/android/modules/Snackbars.jsm
deleted file mode 100644
index 066a28c56..000000000
--- a/mobile/android/modules/Snackbars.jsm
+++ /dev/null
@@ -1,72 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-
-this.EXPORTED_SYMBOLS = ["Snackbars"];
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "Messaging", "resource://gre/modules/Messaging.jsm");
-
-const LENGTH_INDEFINITE = -2;
-const LENGTH_LONG = 0;
-const LENGTH_SHORT = -1;
-
-var Snackbars = {
- LENGTH_INDEFINITE: LENGTH_INDEFINITE,
- LENGTH_LONG: LENGTH_LONG,
- LENGTH_SHORT: LENGTH_SHORT,
-
- show: function(aMessage, aDuration, aOptions) {
-
- // Takes care of the deprecated toast calls
- if (typeof aDuration === "string") {
- [aDuration, aOptions] = migrateToastIfNeeded(aDuration, aOptions);
- }
-
- let msg = {
- type: 'Snackbar:Show',
- message: aMessage,
- duration: aDuration,
- };
-
- if (aOptions && aOptions.backgroundColor) {
- msg.backgroundColor = aOptions.backgroundColor;
- }
-
- if (aOptions && aOptions.action) {
- msg.action = {};
-
- if (aOptions.action.label) {
- msg.action.label = aOptions.action.label;
- }
-
- Messaging.sendRequestForResult(msg).then(result => aOptions.action.callback());
- } else {
- Messaging.sendRequest(msg);
- }
- }
-};
-
-function migrateToastIfNeeded(aDuration, aOptions) {
- let duration;
- if (aDuration === "long") {
- duration = LENGTH_LONG;
- }
- else {
- duration = LENGTH_SHORT;
- }
-
- let options = {};
- if (aOptions && aOptions.button) {
- options.action = {
- label: aOptions.button.label,
- callback: () => aOptions.button.callback(),
- };
- }
- return [duration, options];
-} \ No newline at end of file