Unverified Commit 636f214a authored by Matthew Finkel's avatar Matthew Finkel
Browse files

fixup! Bug 40028: Define bootstrapping events and Quick Start

Bug 40100: Resolve startup crashes in debug build
parent 5c08ba43
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -6,20 +6,24 @@ package org.mozilla.fenix.tor.bootstrap

import android.content.Context
import android.content.SharedPreferences
import android.os.StrictMode
import androidx.annotation.VisibleForTesting
import mozilla.components.support.ktx.android.content.PreferencesHolder
import mozilla.components.support.ktx.android.content.booleanPreference
import org.mozilla.fenix.ext.resetPoliciesAfter

class TorQuickStart(context: Context) : PreferencesHolder {

    override val preferences: SharedPreferences = context.getSharedPreferences(
    override val preferences: SharedPreferences = StrictMode.allowThreadDiskReads().resetPoliciesAfter {
        context.getSharedPreferences(
            PREF_NAME_TOR_BOOTSTRAP_KEY,
            Context.MODE_PRIVATE
        )
    }

    private var torQuickStart by booleanPreference(TOR_QUICK_START, default = false)

    fun quickStartTor() = torQuickStart
    fun quickStartTor() = StrictMode.allowThreadDiskReads().resetPoliciesAfter { torQuickStart }

    fun enableQuickStartTor() {
        torQuickStart = true