Unverified Commit 9113a20a authored by Jonathan Almeida's avatar Jonathan Almeida
Browse files

Close #6847: Use constellation as receiver

parent ee10c758
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -191,7 +191,7 @@ internal class AutoPushObserver(
        val rawEvent = message ?: return

        accountManager.withConstellation {
            it.processRawEventAsync(String(rawEvent))
            processRawEventAsync(String(rawEvent))
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ class SendTabFeatureKtTest {
    @Test
    fun `block is executed only account is available`() {
        val accountManager: FxaAccountManager = mock()
        val block: (DeviceConstellation) -> Unit = mock()
        val block: DeviceConstellation.() -> Unit = mock()
        val account: OAuthAccount = mock()
        val constellation: DeviceConstellation = mock()

+2 −2
Original line number Diff line number Diff line
@@ -76,8 +76,8 @@ class SyncedTabsFeature(
     */
    @VisibleForTesting
    internal fun syncClients(): List<Device>? {
        accountManager.withConstellation { constellation ->
            return constellation.state()?.otherDevices
        accountManager.withConstellation {
            return state()?.otherDevices
        }
        return null
    }
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ import mozilla.components.service.fxa.manager.FxaAccountManager
/**
 * Executes [block] and provides the [DeviceConstellation] of an [OAuthAccount] if present.
 */
inline fun FxaAccountManager.withConstellation(block: (DeviceConstellation) -> Unit) {
inline fun FxaAccountManager.withConstellation(block: DeviceConstellation.() -> Unit) {
    authenticatedAccount()?.let {
        block(it.deviceConstellation())
    }
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ class FxaAccountManagerKtTest {
    @Test
    fun `block is executed only account is available`() {
        val accountManager: FxaAccountManager = mock()
        val block: (DeviceConstellation) -> Unit = mock()
        val block: DeviceConstellation.() -> Unit = mock()
        val account: OAuthAccount = mock()
        val constellation: DeviceConstellation = mock()