GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still and

Commit e4626405 authored by Matthew Finkel's avatar Matthew Finkel

Bug 40028: Define bootstrapping events and Quick Start

parent 2e95f21b
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at */
package org.mozilla.fenix.tor.bootstrap
import android.content.Context
import android.content.SharedPreferences
import android.os.StrictMode
import androidx.annotation.VisibleForTesting
import org.mozilla.fenix.ext.application
import org.mozilla.fenix.ext.components
class TorQuickStart(val context: Context) : PreferencesHolder {
override val preferences: SharedPreferences =
context.components.strictMode.resetAfter(StrictMode.allowThreadDiskReads()) {
private var torQuickStart by booleanPreference(TOR_QUICK_START, default = false)
fun quickStartTor() =
context.components.strictMode.resetAfter(StrictMode.allowThreadDiskReads()) { torQuickStart }
fun enableQuickStartTor() {
torQuickStart = true
fun disableQuickStartTor() {
torQuickStart = false
fun setQuickStartTor(enabled: Boolean) = if (enabled) {
} else {
companion object {
* Name of the shared preferences file.
private const val PREF_NAME_TOR_BOOTSTRAP_KEY = "tor.bootstrap"
* Key for [quickStartTor].
internal const val TOR_QUICK_START = "tor.bootstrap.quick_start_enabled"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment