2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-11 13:11:01 +00:00

For #11531: Fixes some issues with default event not firing

This commit is contained in:
Sawyer Blatz 2020-08-12 12:00:09 -07:00
parent ba0c0b134b
commit e42a8f5fa2
2 changed files with 4 additions and 7 deletions

View File

@ -252,10 +252,12 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
lifecycleScope.launch(IO) { lifecycleScope.launch(IO) {
if ( if (
settings().isDefaultBrowser() && settings().isDefaultBrowser() &&
settings().wasDefaultBrowserOnLastPause != settings().isDefaultBrowser() settings().wasDefaultBrowserOnLastResume != settings().isDefaultBrowser()
) { ) {
metrics.track(Event.ChangedToDefaultBrowser) metrics.track(Event.ChangedToDefaultBrowser)
} }
settings().wasDefaultBrowserOnLastResume = settings().isDefaultBrowser()
} }
} }
@ -264,11 +266,6 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE) window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
} }
if (settings().wasDefaultBrowserOnLastPause != settings().isDefaultBrowser()
) {
settings().wasDefaultBrowserOnLastPause = settings().isDefaultBrowser()
}
super.onPause() super.onPause()
// Every time the application goes into the background, it is possible that the user // Every time the application goes into the background, it is possible that the user

View File

@ -340,7 +340,7 @@ class Settings(private val appContext: Context) : PreferencesHolder {
* Caches the last known "is default browser" state when the app was paused. * Caches the last known "is default browser" state when the app was paused.
* For an up to do date state use `isDefaultBrowser` instead. * For an up to do date state use `isDefaultBrowser` instead.
*/ */
var wasDefaultBrowserOnLastPause by booleanPreference( var wasDefaultBrowserOnLastResume by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_default_browser), appContext.getPreferenceKey(R.string.pref_key_default_browser),
default = isDefaultBrowser() default = isDefaultBrowser()
) )