diff --git a/browser/modules/ReaderParent.jsm b/browser/modules/ReaderParent.jsm index e559fef48c03..24890d05c9f1 100644 --- a/browser/modules/ReaderParent.jsm +++ b/browser/modules/ReaderParent.jsm @@ -23,12 +23,8 @@ var ReaderParent = { _readerModeInfoPanelOpen: false, MESSAGES: [ - "Reader:AddToList", "Reader:ArticleGet", "Reader:FaviconRequest", - "Reader:ListStatusRequest", - "Reader:RemoveFromList", - "Reader:SystemUIVisibility", "Reader:UpdateReaderButton", "Reader:SetIntPref", "Reader:SetCharPref", @@ -72,10 +68,6 @@ var ReaderParent = { break; } - case "Reader:SystemUIVisibility": - // XXX: To implement. - break; - case "Reader:UpdateReaderButton": { let browser = message.target; if (message.data && message.data.isArticle !== undefined) { diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js index 1a8101a25e97..c7c9b26d9086 100644 --- a/mobile/android/app/mobile.js +++ b/mobile/android/app/mobile.js @@ -928,9 +928,6 @@ pref("reader.color_scheme.values", "[\"dark\",\"auto\",\"light\"]"); // Whether to use a vertical or horizontal toolbar. pref("reader.toolbar.vertical", false); -// Whether or not to display buttons related to reading list in reader view. -pref("browser.readinglist.enabled", true); - // Telemetry settings. // Whether to use the unified telemetry behavior, requires a restart. pref("toolkit.telemetry.unified", false); diff --git a/mobile/android/base/java/org/mozilla/gecko/ReadingListHelper.java b/mobile/android/base/java/org/mozilla/gecko/ReadingListHelper.java index a768b252f922..fb90f2924929 100644 --- a/mobile/android/base/java/org/mozilla/gecko/ReadingListHelper.java +++ b/mobile/android/base/java/org/mozilla/gecko/ReadingListHelper.java @@ -53,7 +53,7 @@ public final class ReadingListHelper implements NativeEventListener { this.readingListAccessor = db.getReadingListAccessor(); EventDispatcher.getInstance().registerGeckoThreadListener((NativeEventListener) this, - "Reader:AddToList", "Reader:UpdateList", "Reader:FaviconRequest", "Reader:ListStatusRequest", "Reader:RemoveFromList"); + "Reader:AddToList", "Reader:UpdateList", "Reader:FaviconRequest"); contentObserver = new ContentObserver(null) { @@ -72,7 +72,7 @@ public final class ReadingListHelper implements NativeEventListener { public void uninit() { EventDispatcher.getInstance().unregisterGeckoThreadListener((NativeEventListener) this, - "Reader:AddToList", "Reader:UpdateList", "Reader:FaviconRequest", "Reader:ListStatusRequest", "Reader:RemoveFromList"); + "Reader:AddToList", "Reader:UpdateList", "Reader:FaviconRequest"); context.getContentResolver().unregisterContentObserver(contentObserver); } @@ -81,6 +81,7 @@ public final class ReadingListHelper implements NativeEventListener { public void handleMessage(final String event, final NativeJSObject message, final EventCallback callback) { switch(event) { + // Added from web context menu. case "Reader:AddToList": { handleAddToList(callback, message); break; @@ -93,14 +94,6 @@ public final class ReadingListHelper implements NativeEventListener { handleReaderModeFaviconRequest(callback, message.getString("url")); break; } - case "Reader:RemoveFromList": { - handleRemoveFromList(message.getString("url")); - break; - } - case "Reader:ListStatusRequest": { - handleReadingListStatusRequest(callback, message.getString("url")); - break; - } } } @@ -230,44 +223,6 @@ public final class ReadingListHelper implements NativeEventListener { }).execute(); } - /** - * A page can be removed from the ReadingList by panel context menu, - * or by tapping the readinglist-remove icon in the ReaderMode banner. - */ - private void handleRemoveFromList(final String url) { - ThreadUtils.postToBackgroundThread(new Runnable() { - @Override - public void run() { - readingListAccessor.removeReadingListItemWithURL(context.getContentResolver(), url); - handleEvent(ReadingListEvent.REMOVED, url); - } - }); - } - - /** - * Gecko (ReaderMode) requests the page ReadingList status, to display - * the proper ReaderMode banner icon (readinglist-add / readinglist-remove). - */ - private void handleReadingListStatusRequest(final EventCallback callback, final String url) { - ThreadUtils.postToBackgroundThread(new Runnable() { - @Override - public void run() { - final int inReadingList = readingListAccessor.isReadingListItem(context.getContentResolver(), url) ? 1 : 0; - - final JSONObject json = new JSONObject(); - try { - json.put("url", url); - json.put("inReadingList", inReadingList); - } catch (JSONException e) { - Log.e(LOGTAG, "JSON error - failed to return inReadingList status", e); - } - - // Return the json object to fulfill the promise. - callback.sendSuccess(json.toString()); - } - }); - } - /** * Handle various reading list events (and display appropriate toasts). */ diff --git a/mobile/android/chrome/content/Reader.js b/mobile/android/chrome/content/Reader.js index a67e82ddcb56..f184b433efeb 100644 --- a/mobile/android/chrome/content/Reader.js +++ b/mobile/android/chrome/content/Reader.js @@ -76,17 +76,8 @@ var Reader = { break; } - case "Reader:Added": { - let mm = window.getGroupMessageManager("browsers"); - mm.broadcastAsyncMessage("Reader:Added", { url: aData }); - break; - } - case "Reader:Removed": { ReaderMode.removeArticleFromCache(aData).catch(e => Cu.reportError("Error removing article from cache: " + e)); - - let mm = window.getGroupMessageManager("browsers"); - mm.broadcastAsyncMessage("Reader:Removed", { url: aData }); break; } } @@ -94,13 +85,6 @@ var Reader = { receiveMessage: function(message) { switch (message.name) { - case "Reader:AddToList": { - // If the article is coming from reader mode, we must have fetched it already. - let article = message.data.article; - article.status = this.STATUS_FETCHED_ARTICLE; - this._addArticleToReadingList(article); - break; - } case "Reader:ArticleGet": this._getArticle(message.data.url).then((article) => { // Make sure the target browser is still alive before trying to send data back. @@ -147,22 +131,6 @@ var Reader = { break; } - case "Reader:ListStatusRequest": - Messaging.sendRequestForResult({ - type: "Reader:ListStatusRequest", - url: message.data.url - }).then((data) => { - message.target.messageManager.sendAsyncMessage("Reader:ListStatusData", JSON.parse(data)); - }); - break; - - case "Reader:RemoveFromList": - Messaging.sendRequest({ - type: "Reader:RemoveFromList", - url: message.data.url - }); - break; - case "Reader:SystemUIVisibility": Messaging.sendRequest({ type: "SystemUI:Visibility", @@ -296,19 +264,6 @@ var Reader = { return article; }), - _addArticleToReadingList: function(article) { - Messaging.sendRequestForResult({ - type: "Reader:AddToList", - url: truncate(article.url, MAX_URI_LENGTH), - title: truncate(article.title, MAX_TITLE_LENGTH), - length: article.length, - excerpt: article.excerpt, - status: article.status, - }).then((url) => { - ReaderMode.storeArticleInCache(article).catch(e => Cu.reportError("Error storing article in cache: " + e)); - }).catch(Cu.reportError); - }, - /** * Gets an article for a given URL. This method will download and parse a document * if it does not find the article in the cache. diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 0cdb4f64f5f1..ad032bcfcc11 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -155,7 +155,7 @@ var lazilyLoadedObserverScripts = [ ["Feedback", ["Feedback:Show"], "chrome://browser/content/Feedback.js"], ["SelectionHandler", ["TextSelection:Get"], "chrome://browser/content/SelectionHandler.js"], ["EmbedRT", ["GeckoView:ImportScript"], "chrome://browser/content/EmbedRT.js"], - ["Reader", ["Reader:FetchContent", "Reader:Added", "Reader:Removed"], "chrome://browser/content/Reader.js"], + ["Reader", ["Reader:FetchContent", "Reader:Removed"], "chrome://browser/content/Reader.js"], ["PrintHelper", ["Print:PDF"], "chrome://browser/content/PrintHelper.js"], ]; if (AppConstants.NIGHTLY_BUILD) { @@ -191,13 +191,10 @@ lazilyLoadedObserverScripts.forEach(function (aScript) { // Lazily-loaded browser scripts that use message listeners. [ ["Reader", [ - ["Reader:AddToList", false], ["Reader:ArticleGet", false], ["Reader:DropdownClosed", true], // 'true' allows us to survive mid-air cycle-collection. ["Reader:DropdownOpened", false], ["Reader:FaviconRequest", false], - ["Reader:ListStatusRequest", false], - ["Reader:RemoveFromList", false], ["Reader:ToolbarHidden", false], ["Reader:SystemUIVisibility", false], ["Reader:UpdateReaderButton", false], diff --git a/mobile/android/themes/core/aboutReaderControls.css b/mobile/android/themes/core/aboutReaderControls.css index e06fd6748a5c..ba14ff5c1f99 100644 --- a/mobile/android/themes/core/aboutReaderControls.css +++ b/mobile/android/themes/core/aboutReaderControls.css @@ -65,7 +65,6 @@ list-style: none; background-color: #EBEBF0; border-top: 1px solid #D7D9DB; - display: none; } .toolbar[visible] { @@ -244,14 +243,6 @@ display: none; } -.toggle-button.on { - background-image: url('chrome://browser/skin/images/reader-toggle-on-icon-mdpi.png'); -} - -.toggle-button { - background-image: url('chrome://browser/skin/images/reader-toggle-off-icon-mdpi.png'); -} - .style-button { background-image: url('chrome://browser/skin/images/reader-style-icon-mdpi.png'); } @@ -269,14 +260,6 @@ } @media screen and (min-resolution: 1.25dppx) { - .toggle-button.on { - background-image: url('chrome://browser/skin/images/reader-toggle-on-icon-hdpi.png'); - } - - .toggle-button { - background-image: url('chrome://browser/skin/images/reader-toggle-off-icon-hdpi.png'); - } - .style-button { background-image: url('chrome://browser/skin/images/reader-style-icon-hdpi.png'); } @@ -295,14 +278,6 @@ } @media screen and (min-resolution: 2dppx) { - .toggle-button.on { - background-image: url('chrome://browser/skin/images/reader-toggle-on-icon-xhdpi.png'); - } - - .toggle-button { - background-image: url('chrome://browser/skin/images/reader-toggle-off-icon-xhdpi.png'); - } - .style-button { background-image: url('chrome://browser/skin/images/reader-style-icon-xhdpi.png'); } @@ -321,14 +296,6 @@ } @media screen and (min-resolution: 3dppx) { - .toggle-button.on { - background-image: url('chrome://browser/skin/images/reader-toggle-on-icon-xxhdpi.png'); - } - - .toggle-button { - background-image: url('chrome://browser/skin/images/reader-toggle-off-icon-xxhdpi.png'); - } - .style-button { background-image: url('chrome://browser/skin/images/reader-style-icon-xxhdpi.png'); } diff --git a/mobile/android/themes/core/images/reader-toggle-off-icon-hdpi.png b/mobile/android/themes/core/images/reader-toggle-off-icon-hdpi.png deleted file mode 100644 index 90402468bfe3..000000000000 Binary files a/mobile/android/themes/core/images/reader-toggle-off-icon-hdpi.png and /dev/null differ diff --git a/mobile/android/themes/core/images/reader-toggle-off-icon-mdpi.png b/mobile/android/themes/core/images/reader-toggle-off-icon-mdpi.png deleted file mode 100644 index fd8f4b206aa9..000000000000 Binary files a/mobile/android/themes/core/images/reader-toggle-off-icon-mdpi.png and /dev/null differ diff --git a/mobile/android/themes/core/images/reader-toggle-off-icon-xhdpi.png b/mobile/android/themes/core/images/reader-toggle-off-icon-xhdpi.png deleted file mode 100644 index 8b57ad9fb0a4..000000000000 Binary files a/mobile/android/themes/core/images/reader-toggle-off-icon-xhdpi.png and /dev/null differ diff --git a/mobile/android/themes/core/images/reader-toggle-off-icon-xxhdpi.png b/mobile/android/themes/core/images/reader-toggle-off-icon-xxhdpi.png deleted file mode 100644 index f3228599d381..000000000000 Binary files a/mobile/android/themes/core/images/reader-toggle-off-icon-xxhdpi.png and /dev/null differ diff --git a/mobile/android/themes/core/images/reader-toggle-on-icon-hdpi.png b/mobile/android/themes/core/images/reader-toggle-on-icon-hdpi.png deleted file mode 100644 index 9495bc0b3de5..000000000000 Binary files a/mobile/android/themes/core/images/reader-toggle-on-icon-hdpi.png and /dev/null differ diff --git a/mobile/android/themes/core/images/reader-toggle-on-icon-mdpi.png b/mobile/android/themes/core/images/reader-toggle-on-icon-mdpi.png deleted file mode 100644 index b1991ac54b7e..000000000000 Binary files a/mobile/android/themes/core/images/reader-toggle-on-icon-mdpi.png and /dev/null differ diff --git a/mobile/android/themes/core/images/reader-toggle-on-icon-xhdpi.png b/mobile/android/themes/core/images/reader-toggle-on-icon-xhdpi.png deleted file mode 100644 index 109e3571aa2f..000000000000 Binary files a/mobile/android/themes/core/images/reader-toggle-on-icon-xhdpi.png and /dev/null differ diff --git a/mobile/android/themes/core/images/reader-toggle-on-icon-xxhdpi.png b/mobile/android/themes/core/images/reader-toggle-on-icon-xxhdpi.png deleted file mode 100644 index 91446889788c..000000000000 Binary files a/mobile/android/themes/core/images/reader-toggle-on-icon-xxhdpi.png and /dev/null differ diff --git a/mobile/android/themes/core/jar.mn b/mobile/android/themes/core/jar.mn index 57071c66aef6..ab2722e31787 100644 --- a/mobile/android/themes/core/jar.mn +++ b/mobile/android/themes/core/jar.mn @@ -98,14 +98,6 @@ chrome.jar: skin/images/reader-plus-hdpi.png (images/reader-plus-hdpi.png) skin/images/reader-plus-xhdpi.png (images/reader-plus-xhdpi.png) skin/images/reader-plus-xxhdpi.png (images/reader-plus-xxhdpi.png) - skin/images/reader-toggle-on-icon-mdpi.png (images/reader-toggle-on-icon-mdpi.png) - skin/images/reader-toggle-on-icon-hdpi.png (images/reader-toggle-on-icon-hdpi.png) - skin/images/reader-toggle-on-icon-xhdpi.png (images/reader-toggle-on-icon-xhdpi.png) - skin/images/reader-toggle-on-icon-xxhdpi.png (images/reader-toggle-on-icon-xxhdpi.png) - skin/images/reader-toggle-off-icon-mdpi.png (images/reader-toggle-off-icon-mdpi.png) - skin/images/reader-toggle-off-icon-hdpi.png (images/reader-toggle-off-icon-hdpi.png) - skin/images/reader-toggle-off-icon-xhdpi.png (images/reader-toggle-off-icon-xhdpi.png) - skin/images/reader-toggle-off-icon-xxhdpi.png (images/reader-toggle-off-icon-xxhdpi.png) skin/images/reader-style-icon-active-mdpi.png (images/reader-style-icon-active-mdpi.png) skin/images/reader-style-icon-active-hdpi.png (images/reader-style-icon-active-hdpi.png) skin/images/reader-style-icon-active-xhdpi.png (images/reader-style-icon-active-xhdpi.png) diff --git a/toolkit/components/reader/AboutReader.jsm b/toolkit/components/reader/AboutReader.jsm index c0f4b9a4bc8b..594ed38134fa 100644 --- a/toolkit/components/reader/AboutReader.jsm +++ b/toolkit/components/reader/AboutReader.jsm @@ -32,8 +32,6 @@ var AboutReader = function(mm, win, articlePromise) { let doc = win.document; this._mm = mm; - this._mm.addMessageListener("Reader:Added", this); - this._mm.addMessageListener("Reader:Removed", this); this._mm.addMessageListener("Reader:CloseDropdown", this); this._mm.addMessageListener("Reader:AddButton", this); this._mm.addMessageListener("Reader:RemoveButton", this); @@ -68,14 +66,6 @@ var AboutReader = function(mm, win, articlePromise) { this._setupStyleDropdown(); this._setupButton("close-button", this._onReaderClose.bind(this), "aboutReader.toolbar.close"); - try { - if (Services.prefs.getBoolPref("browser.readinglist.enabled")) { - this._setupButton("toggle-button", this._onReaderToggle.bind(this, "button"), "aboutReader.toolbar.addToReadingList"); - } - } catch (e) { - // Pref doesn't exist. - } - const gIsFirefoxDesktop = Services.appinfo.ID == "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"; if (gIsFirefoxDesktop) { // we're ready for any external setup, send a signal for that. @@ -112,10 +102,6 @@ var AboutReader = function(mm, win, articlePromise) { this._setupFontSizeButtons(); - // Track status of reader toolbar add/remove toggle button - this._isReadingListItem = -1; - this._updateToggleButton(); - this._loadArticle(); } @@ -179,17 +165,6 @@ AboutReader.prototype = { receiveMessage: function (message) { switch (message.name) { - case "Reader:Added": { - // Page can be added by long-press pageAction, or by tap on banner icon. - if (message.data.url == this._article.url) { - if (this._isReadingListItem != 1) { - this._isReadingListItem = 1; - this._updateToggleButton(); - } - } - break; - } - // Triggered by Android user pressing BACK while the banner font-dropdown is open. case "Reader:CloseDropdown": { // Just close it. @@ -197,15 +172,6 @@ AboutReader.prototype = { break; } - case "Reader:Removed": { - if (message.data.url == this._article.url) { - if (this._isReadingListItem != 0) { - this._isReadingListItem = 0; - this._updateToggleButton(); - } - } - break; - } case "Reader:AddButton": { if (message.data.id && message.data.image) { let btn = this._doc.createElement("button"); @@ -267,8 +233,6 @@ AboutReader.prototype = { // Close the Banners Font-dropdown, cleanup Android BackPressListener. this._closeDropdown(); - this._mm.removeMessageListener("Reader:Added", this); - this._mm.removeMessageListener("Reader:Removed", this); this._mm.removeMessageListener("Reader:CloseDropdown", this); this._mm.removeMessageListener("Reader:AddButton", this); this._mm.removeMessageListener("Reader:RemoveButton", this); @@ -277,63 +241,10 @@ AboutReader.prototype = { } }, - _updateToggleButton: function() { - let button = this._doc.getElementById("toggle-button"); - - if (this._isReadingListItem == 1) { - button.classList.add("on"); - button.setAttribute("title", gStrings.GetStringFromName("aboutReader.toolbar.removeFromReadingList")); - } else { - button.classList.remove("on"); - button.setAttribute("title", gStrings.GetStringFromName("aboutReader.toolbar.addToReadingList")); - } - }, - - _requestReadingListStatus: function() { - let handleListStatusData = (message) => { - this._mm.removeMessageListener("Reader:ListStatusData", handleListStatusData); - - let args = message.data; - if (args.url == this._article.url) { - if (this._isReadingListItem != args.inReadingList) { - let isInitialStateChange = (this._isReadingListItem == -1); - this._isReadingListItem = args.inReadingList; - this._updateToggleButton(); - - // Display the toolbar when all its initial component states are known - if (isInitialStateChange) { - // Toolbar display is updated here to avoid it appearing in the middle of the screen on page load. See bug 1145567. - this._win.setTimeout(() => { - this._toolbarElement.style.display = "block"; - // Delay showing the toolbar to have a nice slide from bottom animation. - this._win.setTimeout(() => this._setToolbarVisibility(true), 200); - }, 500); - } - } - } - }; - - this._mm.addMessageListener("Reader:ListStatusData", handleListStatusData); - this._mm.sendAsyncMessage("Reader:ListStatusRequest", { url: this._article.url }); - }, - _onReaderClose: function() { this._win.location.href = this._getOriginalUrl(); }, - _onReaderToggle: function(aMethod) { - if (!this._article) - return; - - if (this._isReadingListItem == 0) { - this._mm.sendAsyncMessage("Reader:AddToList", { article: this._article }); - UITelemetry.addEvent("save.1", aMethod, null, "reading_list"); - } else { - this._mm.sendAsyncMessage("Reader:RemoveFromList", { url: this._article.url }); - UITelemetry.addEvent("unsave.1", aMethod, null, "reading_list"); - } - }, - _setFontSize: function(newFontSize) { let containerClasses = this._doc.getElementById("container").classList; @@ -712,7 +623,6 @@ AboutReader.prototype = { this._contentElement.style.display = "block"; this._updateImageMargins(); - this._requestReadingListStatus(); this._requestFavicon(); this._doc.body.classList.add("loaded"); diff --git a/toolkit/components/reader/content/aboutReader.html b/toolkit/components/reader/content/aboutReader.html index 31cba5326b09..bfd53b0cb55f 100644 --- a/toolkit/components/reader/content/aboutReader.html +++ b/toolkit/components/reader/content/aboutReader.html @@ -57,7 +57,6 @@