fun checkIfFenixIsDefaultBrowserOnAppResume(): Boolean { val prefKey = appContext.getPreferenceKey(R.string.pref_key_default_browser) val isDefaultBrowserNow = isDefaultBrowserBlocking() val wasDefaultBrowserOnLastResume = this.preferences.getBoolean(prefKey, isDefaultBrowserNow) this.preferences.edit().putBoolean(prefKey, isDefaultBrowserNow).apply() return isDefaultBrowserNow && !wasDefaultBrowserOnLastResume }
Declared as a function for performance purposes. This could be declared as a variable using booleanPreference like other members of this class. However, doing so will make it so it will be initialized once Settings.kt is first called, which in turn will call `isDefaultBrowserBlocking()`. This will lead to a performance regression since that function can be expensive to call.