From f3d586266862b39afb1e787270ef6ab0bd8196fd Mon Sep 17 00:00:00 2001 From: Mugurell Date: Wed, 4 Nov 2020 17:23:19 +0200 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/6521 - Remove auto sigin onboarding card (https://github.com/mozilla-mobile/fenix/pull/16315) With the Fennec -> Fenix migration complete there is no other Mozilla application that would serve as a custom account provider hence the automatic signin would not be possible. Make this more obvious by commenting out the code that would trigger an onboarding banner for it but keep the code in the app for when https://github.com/mozilla-mobile/fenix/issues/15694 would add to Fenix the ability to serve as a custom account provider. --- .../main/java/org/mozilla/fenix/home/Mode.kt | 10 +++---- .../java/org/mozilla/fenix/home/ModeTest.kt | 26 +++++++++---------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/home/Mode.kt b/app/src/main/java/org/mozilla/fenix/home/Mode.kt index f4e60ea187..d9eea41727 100644 --- a/app/src/main/java/org/mozilla/fenix/home/Mode.kt +++ b/app/src/main/java/org/mozilla/fenix/home/Mode.kt @@ -59,12 +59,10 @@ class CurrentMode( if (account != null) { Mode.Onboarding(OnboardingState.SignedIn) } else { - val availableAccounts = accountManager.shareableAccounts(context) - if (availableAccounts.isEmpty()) { - Mode.Onboarding(OnboardingState.SignedOutNoAutoSignIn) - } else { - Mode.Onboarding(OnboardingState.SignedOutCanAutoSignIn(availableAccounts[0])) - } + Mode.Onboarding(OnboardingState.SignedOutNoAutoSignIn) + // The following other state is effectively disabled - #6521 + // Code still exists in app for when it will be used again - #15694 + // Mode.Onboarding(OnboardingState.SignedOutCanAutoSignIn(accountManager.shareableAccounts(context)[0])) } } diff --git a/app/src/test/java/org/mozilla/fenix/home/ModeTest.kt b/app/src/test/java/org/mozilla/fenix/home/ModeTest.kt index 1b273b87f1..71d9ff55e5 100644 --- a/app/src/test/java/org/mozilla/fenix/home/ModeTest.kt +++ b/app/src/test/java/org/mozilla/fenix/home/ModeTest.kt @@ -10,7 +10,6 @@ import io.mockk.mockk import io.mockk.spyk import io.mockk.verify import mozilla.components.service.fxa.manager.FxaAccountManager -import mozilla.components.service.fxa.sharing.ShareableAccount import org.junit.Assert.assertEquals import org.junit.Before import org.junit.Test @@ -79,18 +78,19 @@ class ModeTest { assertEquals(Mode.Onboarding(OnboardingState.SignedOutNoAutoSignIn), currentMode.getCurrentMode()) } - @Test - fun `get current onboarding mode when can auto sign in`() { - val shareableAccount: ShareableAccount = mockk() - every { onboarding.userHasBeenOnboarded() } returns false - every { accountManager.authenticatedAccount() } returns null - every { accountManager.shareableAccounts(context) } returns listOf(shareableAccount) - - assertEquals( - Mode.Onboarding(OnboardingState.SignedOutCanAutoSignIn(shareableAccount)), - currentMode.getCurrentMode() - ) - } + // Temporarily disabled. See #6521 + // @Test + // fun `get current onboarding mode when can auto sign in`() { + // val shareableAccount: ShareableAccount = mockk() + // every { onboarding.userHasBeenOnboarded() } returns false + // every { accountManager.authenticatedAccount() } returns null + // every { accountManager.shareableAccounts(context) } returns listOf(shareableAccount) + // + // assertEquals( + // Mode.Onboarding(OnboardingState.SignedOutCanAutoSignIn(shareableAccount)), + // currentMode.getCurrentMode() + // ) + // } @Test fun `emit mode change`() {