Bug 1414084 - Part 14 - Rename isPwaAdded for more clarity. r?grisha draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Sun, 18 Mar 2018 20:39:00 +0100
changeset 823889 73af07e0d7456d324113079928b9910a08ca4bf5
parent 823888 b3b141829012f006aaeddd3b09f387120ffc5faf
child 823890 aa5fd217ec44e9234c186879b8666cf9c472f4e0
push id117809
push usermozilla@buttercookie.de
push dateSun, 29 Jul 2018 18:19:15 +0000
reviewersgrisha
bugs1414084
milestone63.0a1
Bug 1414084 - Part 14 - Rename isPwaAdded for more clarity. r?grisha Despite its name and the original purpose for which it was added, that function generically checks for duplicates among all PageActions, not just the PWA badge. MozReview-Commit-ID: Ae6FsLb9F3S
mobile/android/base/java/org/mozilla/gecko/toolbar/PageActionLayout.java
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/PageActionLayout.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/PageActionLayout.java
@@ -144,18 +144,17 @@ public class PageActionLayout extends Th
 
     private void onAddPageAction(final GeckoBundle message) {
         ThreadUtils.assertOnUiThread();
 
         hidePreviousConfirmPrompt();
 
         final String id = message.getString("id");
 
-        boolean alreadyAdded = isPwaAdded(id);
-        if (alreadyAdded) {
+        if (isPageActionAlreadyAdded(id)) {
             return;
         }
 
         maybeShowPwaOnboarding(id);
 
         final String title = message.getString("title");
         final String imageURL = message.getString("icon");
         final boolean important = message.getBoolean("important");
@@ -201,17 +200,17 @@ public class PageActionLayout extends Th
             final boolean show = prefs.getBoolean(PREF_PWA_ONBOARDING, true);
             if (show && ShortcutUtils.isPinShortcutSupported()) {
                 PwaOnboarding.show(getContext());
                 prefs.edit().putBoolean(PREF_PWA_ONBOARDING, false).apply();
             }
         }
     }
 
-    private boolean isPwaAdded(String id) {
+    private boolean isPageActionAlreadyAdded(String id) {
         for (PageAction pageAction : mPageActionList) {
             if (pageAction.getID() != null && pageAction.getID().equals(id)) {
                 return true;
             }
         }
         return false;
     }