Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update account item UI to support NME #8729

Open
wants to merge 2 commits into
base: carlosmuvi/generic-pane-responses
Choose a base branch
from

Conversation

carlosmuvi-stripe
Copy link
Collaborator

@carlosmuvi-stripe carlosmuvi-stripe commented Jul 3, 2024

Summary

Some UI and interaction changes related to the account view:

  • Reduces disabled alpha, so that we better hint that the account is still clickable (also to match web)
  • Introduces new state, "visually disabled", for accounts that have a drawer on selection (matching web)
  • Underlines subtitles when available
  • Uses account icon when available

Motivation

📔  Support clickable + disabled accounts on LinkAccountPicker
🌐  BANKCON-11422

Testing

  • Added tests (UI tests for now)
  • Modified tests
  • Manually verified

Screenshots

See generated screenshots

Changelog

No public changes, everything's behind a feature flag.

@carlosmuvi-stripe carlosmuvi-stripe added the work-cli Added to pull requests created with #work-cli for usage tracking. label Jul 3, 2024
@carlosmuvi-stripe carlosmuvi-stripe self-assigned this Jul 3, 2024
@carlosmuvi-stripe carlosmuvi-stripe changed the title Support clickable + disabled accounts on LinkAccountPicker Update account item UI to support NME Jul 3, 2024
@carlosmuvi-stripe carlosmuvi-stripe changed the base branch from master to carlosmuvi/generic-pane-responses July 3, 2024 20:51
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/BANKCON-11422/support-clickable--disabled-accounts-on-linkaccoun branch from f020998 to 062dae3 Compare July 3, 2024 20:51
Copy link
Contributor

github-actions bot commented Jul 3, 2024

Diffuse output:

OLD: identity-example-release-base.apk (signature: V1, V2)
NEW: identity-example-release-pr.apk (signature: V1, V2)

          │            compressed            │           uncompressed           
          ├─────────────┬─────────────┬──────┼─────────────┬─────────────┬──────
 APK      │ old         │ new         │ diff │ old         │ new         │ diff 
──────────┼─────────────┼─────────────┼──────┼─────────────┼─────────────┼──────
      dex │       2 MiB │       2 MiB │  0 B │     4.2 MiB │     4.2 MiB │  0 B 
     arsc │ 1,023.8 KiB │ 1,023.8 KiB │  0 B │ 1,023.7 KiB │ 1,023.7 KiB │  0 B 
 manifest │     2.3 KiB │     2.3 KiB │  0 B │       8 KiB │       8 KiB │  0 B 
      res │   301.5 KiB │   301.5 KiB │  0 B │     455 KiB │     455 KiB │  0 B 
   native │     6.2 MiB │     6.2 MiB │  0 B │    15.8 MiB │    15.8 MiB │  0 B 
    asset │     6.7 KiB │     6.7 KiB │  0 B │     6.5 KiB │     6.5 KiB │  0 B 
    other │    85.5 KiB │    85.5 KiB │ +3 B │   158.7 KiB │   158.7 KiB │  0 B 
──────────┼─────────────┼─────────────┼──────┼─────────────┼─────────────┼──────
    total │     9.6 MiB │     9.6 MiB │ +3 B │    21.6 MiB │    21.6 MiB │  0 B 

 DEX     │ old   │ new   │ diff      
─────────┼───────┼───────┼───────────
   files │     1 │     1 │ 0         
 strings │ 21305 │ 21305 │ 0 (+0 -0) 
   types │  6770 │  6770 │ 0 (+0 -0) 
 classes │  5559 │  5559 │ 0 (+0 -0) 
 methods │ 31121 │ 31121 │ 0 (+0 -0) 
  fields │ 18141 │ 18141 │ 0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  164 │  164 │  0   
 entries │ 3392 │ 3392 │  0
APK
  compressed  │ uncompressed │                                           
───────┬──────┼───────┬──────┤                                           
 size  │ diff │ size  │ diff │ path                                      
───────┼──────┼───────┼──────┼───────────────────────────────────────────
 272 B │ +3 B │ 120 B │  0 B │ ∆ META-INF/version-control-info.textproto 
───────┼──────┼───────┼──────┼───────────────────────────────────────────
 272 B │ +3 B │ 120 B │  0 B │ (total)

@carlosmuvi-stripe carlosmuvi-stripe marked this pull request as ready for review July 3, 2024 23:39
@carlosmuvi-stripe carlosmuvi-stripe requested review from a team as code owners July 3, 2024 23:39
@carlosmuvi-stripe carlosmuvi-stripe requested review from tillh-stripe and removed request for a team July 3, 2024 23:39
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure about underlining the subtitles here? It looks rather jarring, and the container is already a selectable element.

@@ -63,8 +66,8 @@ internal fun AccountItem(
networkedAccount: NetworkedAccount? = null,
) {
val view = LocalView.current
// networked account's allowSelection takes precedence over the account's.
val selectable = networkedAccount?.allowSelection ?: account.allowSelection
val viewState = remember { getVisibilityState(account, networkedAccount) }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val viewState = remember { getVisibilityState(account, networkedAccount) }
val viewState = remember(account, networkedAccount) {
getVisibilityState(account, networkedAccount)
}

if (SDK_INT >= M) view.performHapticFeedback(CONTEXT_CLICK)
onAccountClicked(account)
}
.alpha(if (selectable) 1f else ContentAlpha.disabled)
// Reduce
.alpha(if (viewState == Enabled) 1f else VISUALLY_DISABLED_ALPHA)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We could add alpha to ViewState to simplify this.

@@ -180,6 +197,16 @@ private fun PartnerAccount.getFormattedBalance(): String? {
}
}

private enum class ViewState {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should name this something else, as ViewState is overly broad.

@@ -277,9 +277,18 @@ internal class LinkAccountPickerViewModel @AssistedInject constructor(
eventTracker.track(event)
}

fun onAccountClick(partnerAccount: PartnerAccount) {
fun onAccountClick(partnerAccount: PartnerAccount) = viewModelScope.launch {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn’t seem necessary to launch a coroutine here. Can you remove it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
work-cli Added to pull requests created with #work-cli for usage tracking.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants