For #4063: Remove SendTab feature flags
parent
04f364a883
commit
18ca62b887
|
@ -17,17 +17,6 @@ object FeatureFlags {
|
||||||
// A convenience flag for enabling in all builds (a feature that can still be toggled off).
|
// A convenience flag for enabling in all builds (a feature that can still be toggled off).
|
||||||
private val all = production or beta or nightly or debug
|
private val all = production or beta or nightly or debug
|
||||||
|
|
||||||
/**
|
|
||||||
* Send Tab is a feature to lets you send a url/tab from a desktop to device and vice versa.
|
|
||||||
*
|
|
||||||
* NB: flipping this flag back and worth is currently not well supported and may need
|
|
||||||
* hand-holding. Consult with the android-components peers before changing.
|
|
||||||
*
|
|
||||||
* This flag is temporarily also used for the push service that is requires it to.
|
|
||||||
* See: https://github.com/mozilla-mobile/fenix/issues/4063
|
|
||||||
*/
|
|
||||||
val sendTabEnabled = all
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pull-to-refresh allows you to pull the web content down far enough to have the page to
|
* Pull-to-refresh allows you to pull the web content down far enough to have the page to
|
||||||
* reload.
|
* reload.
|
||||||
|
|
|
@ -191,7 +191,7 @@ open class FenixApplication : Application() {
|
||||||
// Sets the PushFeature as the singleton instance for push messages to go to.
|
// Sets the PushFeature as the singleton instance for push messages to go to.
|
||||||
// We need the push feature setup here to deliver messages in the case where the service
|
// We need the push feature setup here to deliver messages in the case where the service
|
||||||
// starts up the app first.
|
// starts up the app first.
|
||||||
if (FeatureFlags.sendTabEnabled && components.backgroundServices.pushConfig != null) {
|
if (components.backgroundServices.pushConfig != null) {
|
||||||
val push = components.backgroundServices.push
|
val push = components.backgroundServices.push
|
||||||
|
|
||||||
// Install the AutoPush singleton to receive messages.
|
// Install the AutoPush singleton to receive messages.
|
||||||
|
|
|
@ -34,7 +34,6 @@ import mozilla.components.service.fxa.manager.FxaAccountManager
|
||||||
import mozilla.components.service.fxa.sync.GlobalSyncableStoreProvider
|
import mozilla.components.service.fxa.sync.GlobalSyncableStoreProvider
|
||||||
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.Experiments
|
||||||
import org.mozilla.fenix.FeatureFlags
|
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.components.metrics.Event
|
import org.mozilla.fenix.components.metrics.Event
|
||||||
import org.mozilla.fenix.ext.components
|
import org.mozilla.fenix.ext.components
|
||||||
|
@ -72,11 +71,7 @@ class BackgroundServices(
|
||||||
// NB: flipping this flag back and worth is currently not well supported and may need hand-holding.
|
// NB: flipping this flag back and worth is currently not well supported and may need hand-holding.
|
||||||
// Consult with the android-components peers before changing.
|
// Consult with the android-components peers before changing.
|
||||||
// See https://github.com/mozilla/application-services/issues/1308
|
// See https://github.com/mozilla/application-services/issues/1308
|
||||||
capabilities = if (FeatureFlags.sendTabEnabled) {
|
capabilities = setOf(DeviceCapability.SEND_TAB)
|
||||||
setOf(DeviceCapability.SEND_TAB)
|
|
||||||
} else {
|
|
||||||
emptySet()
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
// If sync has been turned off on the server then disable syncing.
|
// If sync has been turned off on the server then disable syncing.
|
||||||
private val syncConfig = if (context.isInExperiment(Experiments.asFeatureSyncDisabled)) {
|
private val syncConfig = if (context.isInExperiment(Experiments.asFeatureSyncDisabled)) {
|
||||||
|
@ -175,58 +170,56 @@ class BackgroundServices(
|
||||||
).also {
|
).also {
|
||||||
Settings.getInstance(context).fxaHasSyncedItems = syncConfig?.syncableStores?.isNotEmpty() ?: false
|
Settings.getInstance(context).fxaHasSyncedItems = syncConfig?.syncableStores?.isNotEmpty() ?: false
|
||||||
|
|
||||||
if (FeatureFlags.sendTabEnabled) {
|
it.registerForDeviceEvents(deviceEventObserver, ProcessLifecycleOwner.get(), false)
|
||||||
it.registerForDeviceEvents(deviceEventObserver, ProcessLifecycleOwner.get(), false)
|
|
||||||
|
|
||||||
// Enable push if we have the config.
|
// Enable push if we have the config.
|
||||||
if (pushConfig != null) {
|
if (pushConfig != null) {
|
||||||
|
|
||||||
// Register our account observer so we know how to update our push subscriptions.
|
// Register our account observer so we know how to update our push subscriptions.
|
||||||
it.register(accountObserver)
|
it.register(accountObserver)
|
||||||
|
|
||||||
val logger = Logger("AutoPushFeature")
|
val logger = Logger("AutoPushFeature")
|
||||||
|
|
||||||
// Notify observers for Services' messages.
|
// Notify observers for Services' messages.
|
||||||
push.registerForPushMessages(
|
push.registerForPushMessages(
|
||||||
PushType.Services,
|
PushType.Services,
|
||||||
object : Bus.Observer<PushType, String> {
|
object : Bus.Observer<PushType, String> {
|
||||||
override fun onEvent(type: PushType, message: String) {
|
override fun onEvent(type: PushType, message: String) {
|
||||||
it.authenticatedAccount()?.deviceConstellation()
|
it.authenticatedAccount()?.deviceConstellation()
|
||||||
?.processRawEventAsync(message)
|
?.processRawEventAsync(message)
|
||||||
}
|
|
||||||
},
|
|
||||||
ProcessLifecycleOwner.get(),
|
|
||||||
false
|
|
||||||
)
|
|
||||||
|
|
||||||
// Notify observers for subscription changes.
|
|
||||||
push.registerForSubscriptions(object : PushSubscriptionObserver {
|
|
||||||
override fun onSubscriptionAvailable(subscription: AutoPushSubscription) {
|
|
||||||
// Update for only the services subscription.
|
|
||||||
if (subscription.type == PushType.Services) {
|
|
||||||
logger.info("New push subscription received for FxA")
|
|
||||||
it.authenticatedAccount()?.deviceConstellation()
|
|
||||||
?.setDevicePushSubscriptionAsync(
|
|
||||||
DevicePushSubscription(
|
|
||||||
endpoint = subscription.endpoint,
|
|
||||||
publicKey = subscription.publicKey,
|
|
||||||
authKey = subscription.authKey
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, ProcessLifecycleOwner.get(), false)
|
},
|
||||||
|
ProcessLifecycleOwner.get(),
|
||||||
|
false
|
||||||
|
)
|
||||||
|
|
||||||
// For all the current Fenix users, we need to remove the current push token and
|
// Notify observers for subscription changes.
|
||||||
// re-subscribe again on the right push server. We should never do this otherwise!
|
push.registerForSubscriptions(object : PushSubscriptionObserver {
|
||||||
// Should be removed after majority of our users are correctly subscribed.
|
override fun onSubscriptionAvailable(subscription: AutoPushSubscription) {
|
||||||
// See: https://github.com/mozilla-mobile/fenix/issues/4218
|
// Update for only the services subscription.
|
||||||
val prefResetSubKey = "reset_broken_push_subscription"
|
if (subscription.type == PushType.Services) {
|
||||||
if (!preferences.getBoolean(prefResetSubKey, false)) {
|
logger.info("New push subscription received for FxA")
|
||||||
preferences.edit().putBoolean(prefResetSubKey, true).apply()
|
it.authenticatedAccount()?.deviceConstellation()
|
||||||
logger.info("Forcing push registration renewal")
|
?.setDevicePushSubscriptionAsync(
|
||||||
push.forceRegistrationRenewal()
|
DevicePushSubscription(
|
||||||
|
endpoint = subscription.endpoint,
|
||||||
|
publicKey = subscription.publicKey,
|
||||||
|
authKey = subscription.authKey
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}, ProcessLifecycleOwner.get(), false)
|
||||||
|
|
||||||
|
// For all the current Fenix users, we need to remove the current push token and
|
||||||
|
// re-subscribe again on the right push server. We should never do this otherwise!
|
||||||
|
// Should be removed after majority of our users are correctly subscribed.
|
||||||
|
// See: https://github.com/mozilla-mobile/fenix/issues/4218
|
||||||
|
val prefResetSubKey = "reset_broken_push_subscription"
|
||||||
|
if (!preferences.getBoolean(prefResetSubKey, false)) {
|
||||||
|
preferences.edit().putBoolean(prefResetSubKey, true).apply()
|
||||||
|
logger.info("Forcing push registration renewal")
|
||||||
|
push.forceRegistrationRenewal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CoroutineScope(Dispatchers.Main).launch { it.initAsync().await() }
|
CoroutineScope(Dispatchers.Main).launch { it.initAsync().await() }
|
||||||
|
|
|
@ -12,7 +12,6 @@ import io.reactivex.Observable
|
||||||
import io.reactivex.Observer
|
import io.reactivex.Observer
|
||||||
import io.reactivex.functions.Consumer
|
import io.reactivex.functions.Consumer
|
||||||
import kotlinx.android.synthetic.main.component_share.*
|
import kotlinx.android.synthetic.main.component_share.*
|
||||||
import org.mozilla.fenix.FeatureFlags
|
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.ext.components
|
import org.mozilla.fenix.ext.components
|
||||||
import org.mozilla.fenix.mvi.UIView
|
import org.mozilla.fenix.mvi.UIView
|
||||||
|
@ -40,14 +39,12 @@ class ShareUIView(
|
||||||
}
|
}
|
||||||
intent_handler_recyclerview.adapter = adapter
|
intent_handler_recyclerview.adapter = adapter
|
||||||
|
|
||||||
// And authorized
|
if (view.context.components.backgroundServices.accountManager.accountNeedsReauth()) {
|
||||||
if (FeatureFlags.sendTabEnabled &&
|
|
||||||
!view.context.components.backgroundServices.accountManager.accountNeedsReauth()
|
|
||||||
) {
|
|
||||||
account_devices_recyclerview.adapter = AccountDevicesShareAdapter(view.context, actionEmitter)
|
|
||||||
} else {
|
|
||||||
send_tab_group.visibility = View.GONE
|
send_tab_group.visibility = View.GONE
|
||||||
account_header.visibility = View.GONE
|
account_header.visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
account_devices_recyclerview.adapter =
|
||||||
|
AccountDevicesShareAdapter(view.context, actionEmitter)
|
||||||
}
|
}
|
||||||
|
|
||||||
container.setOnClickListener { actionEmitter.onNext(ShareAction.Close) }
|
container.setOnClickListener { actionEmitter.onNext(ShareAction.Close) }
|
||||||
|
|
Loading…
Reference in New Issue