Add application-services fretboard feature flags
parent
ce33054173
commit
dfe181aa0a
|
@ -55,6 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- #2903 - Fixed crash when trying to rate the app on a devices without the play store app.
|
- #2903 - Fixed crash when trying to rate the app on a devices without the play store app.
|
||||||
- #2419 - Adds a deletion state to the history component
|
- #2419 - Adds a deletion state to the history component
|
||||||
- #1570 - Enables the opening of links by other apps. Disabled in #3359.
|
- #1570 - Enables the opening of links by other apps. Disabled in #3359.
|
||||||
|
- #3200 - Adds application-services fretboard feature flags for FxA and Sync.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- #2673 - Fixed can't upload files using third party apps from the file manager.
|
- #2673 - Fixed can't upload files using third party apps from the file manager.
|
||||||
|
|
|
@ -10,11 +10,15 @@ import mozilla.components.service.fretboard.ExperimentDescriptor
|
||||||
const val EXPERIMENTS_JSON_FILENAME = "experiments.json"
|
const val EXPERIMENTS_JSON_FILENAME = "experiments.json"
|
||||||
const val EXPERIMENTS_BASE_URL = "https://settings.prod.mozaws.net/v1"
|
const val EXPERIMENTS_BASE_URL = "https://settings.prod.mozaws.net/v1"
|
||||||
const val EXPERIMENTS_BUCKET_NAME = "main"
|
const val EXPERIMENTS_BUCKET_NAME = "main"
|
||||||
// TODO Change this after fenix-experiments is created
|
// collection name below, see https://bugzilla.mozilla.org/show_bug.cgi?id=1523395 for ownership details
|
||||||
const val EXPERIMENTS_COLLECTION_NAME = "focus-experiments"
|
const val EXPERIMENTS_COLLECTION_NAME = "fenix-experiments"
|
||||||
|
|
||||||
object Experiments {
|
object Experiments {
|
||||||
val AATestDescriptor = ExperimentDescriptor("AAtest")
|
val AATestDescriptor = ExperimentDescriptor("AAtest")
|
||||||
|
// application services flag to disable the Firefox Sync syncManager
|
||||||
|
val asFeatureSyncDisabled = ExperimentDescriptor("asFeatureSyncDisabled")
|
||||||
|
// application services flag to disable Firefox Accounts pairing button.
|
||||||
|
val asFeatureFxAPairingDisabled = ExperimentDescriptor("asFeatureFxAPairingDisabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
val Context.app: FenixApplication
|
val Context.app: FenixApplication
|
||||||
|
|
|
@ -115,7 +115,7 @@ open class HomeActivity : AppCompatActivity() {
|
||||||
components.backgroundServices.accountManager.initAsync().await()
|
components.backgroundServices.accountManager.initAsync().await()
|
||||||
// If we're authenticated, kick-off a sync and a device state refresh.
|
// If we're authenticated, kick-off a sync and a device state refresh.
|
||||||
components.backgroundServices.accountManager.authenticatedAccount()?.let {
|
components.backgroundServices.accountManager.authenticatedAccount()?.let {
|
||||||
components.backgroundServices.syncManager.syncNow(startup = true)
|
components.backgroundServices.syncManager?.syncNow(startup = true)
|
||||||
it.deviceConstellation().refreshDeviceStateAsync().await()
|
it.deviceConstellation().refreshDeviceStateAsync().await()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ package org.mozilla.fenix.components
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.lifecycle.ProcessLifecycleOwner
|
import androidx.lifecycle.ProcessLifecycleOwner
|
||||||
|
import androidx.work.WorkManager
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
@ -21,7 +22,9 @@ import mozilla.components.service.fxa.Config
|
||||||
import mozilla.components.service.fxa.manager.DeviceTuple
|
import mozilla.components.service.fxa.manager.DeviceTuple
|
||||||
import mozilla.components.service.fxa.manager.FxaAccountManager
|
import mozilla.components.service.fxa.manager.FxaAccountManager
|
||||||
import mozilla.components.support.base.log.logger.Logger
|
import mozilla.components.support.base.log.logger.Logger
|
||||||
|
import org.mozilla.fenix.Experiments
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
|
import org.mozilla.fenix.isInExperiment
|
||||||
import org.mozilla.fenix.test.Mockable
|
import org.mozilla.fenix.test.Mockable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,9 +56,15 @@ class BackgroundServices(
|
||||||
GlobalSyncableStoreProvider.configureStore("bookmarks" to bookmarkStorage)
|
GlobalSyncableStoreProvider.configureStore("bookmarks" to bookmarkStorage)
|
||||||
}
|
}
|
||||||
|
|
||||||
val syncManager = BackgroundSyncManager("https://identity.mozilla.com/apps/oldsync").also {
|
// if sync has been turned off on the server then make `syncManager` null
|
||||||
it.addStore("history")
|
val syncManager = if (context.isInExperiment(Experiments.asFeatureSyncDisabled)) {
|
||||||
it.addStore("bookmarks")
|
WorkManager.getInstance().cancelUniqueWork("Periodic")
|
||||||
|
null
|
||||||
|
} else {
|
||||||
|
BackgroundSyncManager("https://identity.mozilla.com/apps/oldsync").also {
|
||||||
|
it.addStore("history")
|
||||||
|
it.addStore("bookmarks")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val deviceEventObserver = object : DeviceEventsObserver {
|
private val deviceEventObserver = object : DeviceEventsObserver {
|
||||||
|
|
|
@ -108,11 +108,13 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), CoroutineScope {
|
||||||
|
|
||||||
// Current sync state
|
// Current sync state
|
||||||
updateLastSyncedTimePref(context!!, preferenceSyncNow)
|
updateLastSyncedTimePref(context!!, preferenceSyncNow)
|
||||||
if (requireComponents.backgroundServices.syncManager.isSyncRunning()) {
|
requireComponents.backgroundServices.syncManager?.let {
|
||||||
preferenceSyncNow.title = getString(R.string.sync_syncing_in_progress)
|
if (it.isSyncRunning()) {
|
||||||
preferenceSyncNow.isEnabled = false
|
preferenceSyncNow.title = getString(R.string.sync_syncing_in_progress)
|
||||||
} else {
|
preferenceSyncNow.isEnabled = false
|
||||||
preferenceSyncNow.isEnabled = true
|
} else {
|
||||||
|
preferenceSyncNow.isEnabled = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +135,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), CoroutineScope {
|
||||||
|
|
||||||
// NB: ObserverRegistry will take care of cleaning up internal references to 'observer' and
|
// NB: ObserverRegistry will take care of cleaning up internal references to 'observer' and
|
||||||
// 'owner' when appropriate.
|
// 'owner' when appropriate.
|
||||||
requireComponents.backgroundServices.syncManager.register(syncStatusObserver, owner = this, autoPause = true)
|
requireComponents.backgroundServices.syncManager?.register(syncStatusObserver, owner = this, autoPause = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getClickListenerForSignOut(): Preference.OnPreferenceClickListener {
|
private fun getClickListenerForSignOut(): Preference.OnPreferenceClickListener {
|
||||||
|
@ -150,7 +152,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), CoroutineScope {
|
||||||
return Preference.OnPreferenceClickListener {
|
return Preference.OnPreferenceClickListener {
|
||||||
// Trigger a sync.
|
// Trigger a sync.
|
||||||
requireComponents.analytics.metrics.track(Event.SyncAccountSyncNow)
|
requireComponents.analytics.metrics.track(Event.SyncAccountSyncNow)
|
||||||
requireComponents.backgroundServices.syncManager.syncNow()
|
requireComponents.backgroundServices.syncManager?.syncNow()
|
||||||
// Poll for device events.
|
// Poll for device events.
|
||||||
launch {
|
launch {
|
||||||
accountManager.authenticatedAccount()
|
accountManager.authenticatedAccount()
|
||||||
|
|
|
@ -14,11 +14,13 @@ import mozilla.components.concept.sync.AccountObserver
|
||||||
import mozilla.components.concept.sync.OAuthAccount
|
import mozilla.components.concept.sync.OAuthAccount
|
||||||
import mozilla.components.concept.sync.Profile
|
import mozilla.components.concept.sync.Profile
|
||||||
import mozilla.components.support.ktx.android.content.hasCamera
|
import mozilla.components.support.ktx.android.content.hasCamera
|
||||||
|
import org.mozilla.fenix.Experiments
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.components.FenixSnackbar
|
import org.mozilla.fenix.components.FenixSnackbar
|
||||||
import org.mozilla.fenix.components.metrics.Event
|
import org.mozilla.fenix.components.metrics.Event
|
||||||
import org.mozilla.fenix.ext.getPreferenceKey
|
import org.mozilla.fenix.ext.getPreferenceKey
|
||||||
import org.mozilla.fenix.ext.requireComponents
|
import org.mozilla.fenix.ext.requireComponents
|
||||||
|
import org.mozilla.fenix.isInExperiment
|
||||||
|
|
||||||
@SuppressWarnings("TooManyFunctions")
|
@SuppressWarnings("TooManyFunctions")
|
||||||
class TurnOnSyncFragment : PreferenceFragmentCompat(), AccountObserver {
|
class TurnOnSyncFragment : PreferenceFragmentCompat(), AccountObserver {
|
||||||
|
@ -57,6 +59,11 @@ class TurnOnSyncFragment : PreferenceFragmentCompat(), AccountObserver {
|
||||||
preferenceNewAccount?.onPreferenceClickListener = getClickListenerForCreateAccount()
|
preferenceNewAccount?.onPreferenceClickListener = getClickListenerForCreateAccount()
|
||||||
preferencePairSignIn?.onPreferenceClickListener = getClickListenerForPairing()
|
preferencePairSignIn?.onPreferenceClickListener = getClickListenerForPairing()
|
||||||
preferencePairSignIn?.isVisible = context?.hasCamera() ?: true
|
preferencePairSignIn?.isVisible = context?.hasCamera() ?: true
|
||||||
|
|
||||||
|
// if FxA pairing has been turned off on the server
|
||||||
|
if (context?.isInExperiment(Experiments.asFeatureFxAPairingDisabled)!!) {
|
||||||
|
preferencePairSignIn?.isVisible = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getClickListenerForSignIn(): Preference.OnPreferenceClickListener {
|
private fun getClickListenerForSignIn(): Preference.OnPreferenceClickListener {
|
||||||
|
|
Loading…
Reference in New Issue