diff --git a/components/feature/accounts-push/src/main/java/mozilla/components/feature/accounts/push/FxaPushSupportFeature.kt b/components/feature/accounts-push/src/main/java/mozilla/components/feature/accounts/push/FxaPushSupportFeature.kt index d99752f7161..c76439775d7 100644 --- a/components/feature/accounts-push/src/main/java/mozilla/components/feature/accounts/push/FxaPushSupportFeature.kt +++ b/components/feature/accounts-push/src/main/java/mozilla/components/feature/accounts/push/FxaPushSupportFeature.kt @@ -76,17 +76,20 @@ class FxaPushSupportFeature( * Initialize the support feature to launch the appropriate observers. */ fun initialize() = coroutineScope.launch { - val autoPushObserver = AutoPushObserver(accountManager, pushFeature, pushScope.value()) + val scopeValue = pushScope.value() + + val autoPushObserver = AutoPushObserver(accountManager, pushFeature, scopeValue) val accountObserver = AccountObserver( context, pushFeature, - pushScope.value(), + scopeValue, crashReporter, owner, autoPause ) + // Registration should always be done on the Main dispatcher. coroutineScope.launch(Main) { accountManager.register(accountObserver) @@ -130,7 +133,7 @@ internal class AccountObserver( // registration could happen after onDevicesUpdate has been called, without having to tie this // into the account "auth lifecycle". // See https://github.com/mozilla-mobile/android-components/issues/8766 - GlobalScope.launch(Dispatchers.Main) { + GlobalScope.launch(Main) { account.deviceConstellation().registerDeviceObserver(constellationObserver, lifecycleOwner, autoPause) account.deviceConstellation().refreshDevices() } @@ -183,7 +186,7 @@ internal fun pushSubscribe( currentDevice.subscription?.endpoint != subscription.endpoint ) { logger.info("Updating account with new subscription info.") - CoroutineScope(Dispatchers.Main).launch { + CoroutineScope(Main).launch { account.deviceConstellation().setDevicePushSubscription(subscription.into()) } } @@ -259,7 +262,7 @@ internal class AutoPushObserver( val rawEvent = message ?: return accountManager.withConstellation { - CoroutineScope(Dispatchers.Main).launch { + CoroutineScope(Main).launch { processRawEvent(String(rawEvent)) } } diff --git a/docs/changelog.md b/docs/changelog.md index 512ead0518b..84a367f7e7d 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -21,6 +21,9 @@ permalink: /changelog/ * ⚠️ **This is a breaking change**: `FxaPushSupportFeature` now requires to be explicitly started with `initialize`. * The constructor for `FxaPushSupportFeature` has a `coroutineScope` parameter that defaults to a `CoroutineScope(Dispatchers.IO)`. +* **support-ktx** + * 🚒 Bug fixed [issue #12689](https://github.com/mozilla-mobile/android-components/issues/12689) Make `Context.shareMedia` work with Android Direct Share. + # 105.0.0 * [Commits](https://github.com/mozilla-mobile/android-components/compare/v104.0.0...v105.0.0) * [Milestone](https://github.com/mozilla-mobile/android-components/milestone/152?closed=1)