Bug 1246712 - distinguish reader view pages when bookmarking r=margaret
authorAndrzej Hunt <ahunt@mozilla.com>
Mon, 11 Apr 2016 16:23:33 -0700
changeset 352188 88a642111cc13023c64ecca920312e1b3e8b372c
parent 352186 b2c38c677cc7ba0b2b5ceb8f84cdace57ecd8121
child 352189 18514684b3ad0e10e6e1aaaade4bc8435166c6d8
child 352240 15a81c85b9aec2df2a3fd354dee54234dd4f6b1b
push id15639
push userahunt@mozilla.com
push dateFri, 15 Apr 2016 21:19:00 +0000
reviewersmargaret
bugs1246712
milestone48.0a1
Bug 1246712 - distinguish reader view pages when bookmarking r=margaret MozReview-Commit-ID: 8g80ElZf0rU
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
mobile/android/base/java/org/mozilla/gecko/home/HomeFragment.java
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -3454,26 +3454,33 @@ public class BrowserApp extends GeckoApp
         }
         Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.MENU, extras);
 
         mBrowserToolbar.cancelEdit();
 
         if (itemId == R.id.bookmark) {
             tab = Tabs.getInstance().getSelectedTab();
             if (tab != null) {
+                final String extra;
+                if (AboutPages.isAboutReader(tab.getURL())) {
+                    extra = "bookmark_reader";
+                } else {
+                    extra = "bookmark";
+                }
+
                 if (item.isChecked()) {
-                    Telemetry.sendUIEvent(TelemetryContract.Event.UNSAVE, TelemetryContract.Method.MENU, "bookmark");
+                    Telemetry.sendUIEvent(TelemetryContract.Event.UNSAVE, TelemetryContract.Method.MENU, extra);
                     tab.removeBookmark();
                     item.setTitle(resolveBookmarkTitleID(false));
                     if (Versions.feature11Plus) {
                         // We don't use icons on GB builds so not resolving icons might conserve resources.
                         item.setIcon(resolveBookmarkIconID(false));
                     }
                 } else {
-                    Telemetry.sendUIEvent(TelemetryContract.Event.SAVE, TelemetryContract.Method.MENU, "bookmark");
+                    Telemetry.sendUIEvent(TelemetryContract.Event.SAVE, TelemetryContract.Method.MENU, extra);
                     tab.addBookmark();
                     item.setTitle(resolveBookmarkTitleID(true));
                     if (Versions.feature11Plus) {
                         // We don't use icons on GB builds so not resolving icons might conserve resources.
                         item.setIcon(resolveBookmarkIconID(true));
                     }
                 }
             }
--- a/mobile/android/base/java/org/mozilla/gecko/home/HomeFragment.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/HomeFragment.java
@@ -375,21 +375,30 @@ public abstract class HomeFragment exten
                 mDB.unpinSite(cr, mPosition);
                 if (mDB.hideSuggestedSite(mUrl)) {
                     cr.notifyChange(SuggestedSites.CONTENT_URI, null);
                 }
             }
 
             switch (mType) {
                 case BOOKMARKS:
-                    Telemetry.sendUIEvent(TelemetryContract.Event.UNSAVE, TelemetryContract.Method.CONTEXT_MENU, "bookmark");
+                    SavedReaderViewHelper rch = SavedReaderViewHelper.getSavedReaderViewHelper(mContext);
+                    final boolean isReaderViewPage = rch.isURLCached(mUrl);
+
+                    final String extra;
+                    if (isReaderViewPage) {
+                        extra = "bookmark_reader";
+                    } else {
+                        extra = "bookmark";
+                    }
+
+                    Telemetry.sendUIEvent(TelemetryContract.Event.UNSAVE, TelemetryContract.Method.CONTEXT_MENU, extra);
                     mDB.removeBookmarksWithURL(cr, mUrl);
 
-                    SavedReaderViewHelper rch = SavedReaderViewHelper.getSavedReaderViewHelper(mContext);
-                    if (rch.isURLCached(mUrl)) {
+                    if (isReaderViewPage) {
                         ReadingListHelper.removeCachedReaderItem(mUrl, mContext);
                     }
 
                     break;
 
                 case HISTORY:
                     mDB.removeHistoryEntry(cr, mUrl);
                     break;