| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- | 1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- |
| 2 * This Source Code Form is subject to the terms of the Mozilla Public | 2 * This Source Code Form is subject to the terms of the Mozilla Public |
| 3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 | 5 |
| 6 package org.mozilla.gecko; | 6 package org.mozilla.gecko; |
| 7 | 7 |
| 8 import org.mozilla.gecko.AppConstants.Versions; | 8 import org.mozilla.gecko.AppConstants.Versions; |
| 9 import org.mozilla.gecko.DynamicToolbar.PinReason; | 9 import org.mozilla.gecko.DynamicToolbar.PinReason; |
| 10 import org.mozilla.gecko.DynamicToolbar.VisibilityTransition; | 10 import org.mozilla.gecko.DynamicToolbar.VisibilityTransition; |
| (...skipping 3519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3530 } | 3530 } |
| 3531 | 3531 |
| 3532 // Check to see how many times the app has been launched. | 3532 // Check to see how many times the app has been launched. |
| 3533 final String keyName = getPackageName() + ".feedback_launch_count"; | 3533 final String keyName = getPackageName() + ".feedback_launch_count"; |
| 3534 final StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskRe ads(); | 3534 final StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskRe ads(); |
| 3535 | 3535 |
| 3536 // Faster on main thread with an async apply(). | 3536 // Faster on main thread with an async apply(). |
| 3537 try { | 3537 try { |
| 3538 SharedPreferences settings = getPreferences(Activity.MODE_PRIVATE); | 3538 SharedPreferences settings = getPreferences(Activity.MODE_PRIVATE); |
| 3539 int launchCount = settings.getInt(keyName, 0); | 3539 int launchCount = settings.getInt(keyName, 0); |
| 3540 if (launchCount < FEEDBACK_LAUNCH_COUNT) { | 3540 // In Adblock Browser, we only want to increment the feedback page |
| 3541 // launch count for release builds that were installed from the | |
| 3542 // Play store, see https://issues.adblockplus.org/ticket/2967 and | |
| 3543 // https://issues.adblockplus.org/ticket/3136. | |
| 3544 if (launchCount < FEEDBACK_LAUNCH_COUNT && | |
|
René Jeschke
2015/10/01 14:38:11
Is it really necessary to check `wasInstalledFromP
Felix Dahlke
2015/10/01 15:30:53
I've changed this mainly to ensure that users that
René Jeschke
2015/10/02 08:22:34
I wasn't really concerned about performance issues
| |
| 3545 AppConstants.ABB_RELEASE_BUILD && wasInstalledFromPlayStore()) { | |
| 3541 // Increment the launch count and store the new value. | 3546 // Increment the launch count and store the new value. |
| 3542 launchCount++; | 3547 launchCount++; |
| 3543 settings.edit().putInt(keyName, launchCount).apply(); | 3548 settings.edit().putInt(keyName, launchCount).apply(); |
| 3544 | 3549 |
| 3545 // If we've reached our magic number, show the feedback page. | 3550 // If we've reached our magic number, show the feedback page. |
| 3546 if (launchCount == FEEDBACK_LAUNCH_COUNT && wasInstalledFromPlay Store()) { | 3551 if (launchCount == FEEDBACK_LAUNCH_COUNT) { |
| 3547 GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEve nt("Feedback:Show", null)); | 3552 GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEve nt("Feedback:Show", null)); |
| 3548 } | 3553 } |
| 3549 } | 3554 } |
| 3550 } finally { | 3555 } finally { |
| 3551 StrictMode.setThreadPolicy(savedPolicy); | 3556 StrictMode.setThreadPolicy(savedPolicy); |
| 3552 } | 3557 } |
| 3553 } | 3558 } |
| 3554 | 3559 |
| 3555 private boolean wasInstalledFromPlayStore() { | 3560 private boolean wasInstalledFromPlayStore() { |
| 3556 final String installer = this.getPackageManager().getInstallerPackageNam e(this.getPackageName()); | 3561 final String installer = this.getPackageManager().getInstallerPackageNam e(this.getPackageName()); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3797 dispatcher, | 3802 dispatcher, |
| 3798 osLocale, | 3803 osLocale, |
| 3799 appLocale, | 3804 appLocale, |
| 3800 previousSession); | 3805 previousSession); |
| 3801 } | 3806 } |
| 3802 | 3807 |
| 3803 public static interface Refreshable { | 3808 public static interface Refreshable { |
| 3804 public void refresh(); | 3809 public void refresh(); |
| 3805 } | 3810 } |
| 3806 } | 3811 } |
| OLD | NEW |