Show wallet option in picker even if not set up.
Updates the logic to show the option in the picker as disabled, when the wallet is not yet set up. Fix: 265321396 Test: manually made sure that the wallet option is visible and disabled in the picker before I installed the wallet app. Once a card was added, it became selectable and enabled. Test: updated unit tests. Change-Id: Ie5d854b7314148d3721d6efa2e2e18f883c861c5
This commit is contained in:
committed by
Ale Nijamkin
parent
2f12b73182
commit
bd86eae9a8
@@ -100,9 +100,9 @@ constructor(
|
||||
|
||||
override suspend fun getPickerScreenState(): KeyguardQuickAffordanceConfig.PickerScreenState {
|
||||
return when {
|
||||
!walletController.isWalletEnabled ->
|
||||
!walletController.walletClient.isWalletServiceAvailable ->
|
||||
KeyguardQuickAffordanceConfig.PickerScreenState.UnavailableOnDevice
|
||||
walletController.walletClient.tileIcon == null || queryCards().isEmpty() -> {
|
||||
!walletController.isWalletEnabled || queryCards().isEmpty() -> {
|
||||
val componentName =
|
||||
walletController.walletClient.createWalletSettingsIntent().toComponentName()
|
||||
val actionText =
|
||||
|
||||
@@ -113,21 +113,9 @@ class QuickAccessWalletKeyguardQuickAffordanceConfigTest : SysuiTestCase() {
|
||||
job.cancel()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `affordance - missing icon - model is none`() = runBlockingTest {
|
||||
setUpState(hasWalletIcon = false)
|
||||
var latest: KeyguardQuickAffordanceConfig.LockScreenState? = null
|
||||
|
||||
val job = underTest.lockScreenState.onEach { latest = it }.launchIn(this)
|
||||
|
||||
assertThat(latest).isEqualTo(KeyguardQuickAffordanceConfig.LockScreenState.Hidden)
|
||||
|
||||
job.cancel()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `affordance - no selected card - model is none`() = runBlockingTest {
|
||||
setUpState(hasWalletIcon = false)
|
||||
setUpState(hasSelectedCard = false)
|
||||
var latest: KeyguardQuickAffordanceConfig.LockScreenState? = null
|
||||
|
||||
val job = underTest.lockScreenState.onEach { latest = it }.launchIn(this)
|
||||
@@ -165,7 +153,7 @@ class QuickAccessWalletKeyguardQuickAffordanceConfigTest : SysuiTestCase() {
|
||||
@Test
|
||||
fun `getPickerScreenState - unavailable`() = runTest {
|
||||
setUpState(
|
||||
isWalletEnabled = false,
|
||||
isWalletServiceAvailable = false,
|
||||
)
|
||||
|
||||
assertThat(underTest.getPickerScreenState())
|
||||
@@ -173,9 +161,9 @@ class QuickAccessWalletKeyguardQuickAffordanceConfigTest : SysuiTestCase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `getPickerScreenState - disabled when there is no icon`() = runTest {
|
||||
fun `getPickerScreenState - disabled when the feature is not enabled`() = runTest {
|
||||
setUpState(
|
||||
hasWalletIcon = false,
|
||||
isWalletEnabled = false,
|
||||
)
|
||||
|
||||
assertThat(underTest.getPickerScreenState())
|
||||
@@ -194,20 +182,16 @@ class QuickAccessWalletKeyguardQuickAffordanceConfigTest : SysuiTestCase() {
|
||||
|
||||
private fun setUpState(
|
||||
isWalletEnabled: Boolean = true,
|
||||
isWalletServiceAvailable: Boolean = true,
|
||||
isWalletQuerySuccessful: Boolean = true,
|
||||
hasWalletIcon: Boolean = true,
|
||||
hasSelectedCard: Boolean = true,
|
||||
) {
|
||||
whenever(walletController.isWalletEnabled).thenReturn(isWalletEnabled)
|
||||
|
||||
val walletClient: QuickAccessWalletClient = mock()
|
||||
val icon: Drawable? =
|
||||
if (hasWalletIcon) {
|
||||
ICON
|
||||
} else {
|
||||
null
|
||||
}
|
||||
whenever(walletClient.tileIcon).thenReturn(icon)
|
||||
whenever(walletClient.tileIcon).thenReturn(ICON)
|
||||
whenever(walletClient.isWalletServiceAvailable).thenReturn(isWalletServiceAvailable)
|
||||
|
||||
whenever(walletController.walletClient).thenReturn(walletClient)
|
||||
|
||||
whenever(walletController.queryWalletCards(any())).thenAnswer { invocation ->
|
||||
|
||||
Reference in New Issue
Block a user