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

Link Verification VM #9542

Merged
merged 8 commits into from
Nov 12, 2024
Merged

Link Verification VM #9542

merged 8 commits into from
Nov 12, 2024

Conversation

toluo-stripe
Copy link
Contributor

@toluo-stripe toluo-stripe commented Oct 31, 2024

Summary

View model to handle link account verification

Motivation

JIRA

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Screen.Recording.2024-10-30.at.1.58.45.PM.mov

Changelog

Copy link
Contributor

github-actions bot commented Oct 31, 2024

Diffuse output:

OLD: paymentsheet-example-release-master.apk (signature: V1, V2)
NEW: paymentsheet-example-release-pr.apk (signature: V1, V2)

          │            compressed            │           uncompressed           
          ├───────────┬───────────┬──────────┼───────────┬───────────┬──────────
 APK      │ old       │ new       │ diff     │ old       │ new       │ diff     
──────────┼───────────┼───────────┼──────────┼───────────┼───────────┼──────────
      dex │   3.8 MiB │   3.9 MiB │   +3 KiB │   8.4 MiB │   8.4 MiB │   +8 KiB 
     arsc │   2.3 MiB │   2.3 MiB │      0 B │   2.3 MiB │   2.3 MiB │      0 B 
 manifest │     5 KiB │     5 KiB │      0 B │  24.9 KiB │  24.9 KiB │      0 B 
      res │ 902.3 KiB │ 902.3 KiB │      0 B │   1.4 MiB │   1.4 MiB │      0 B 
   native │   2.6 MiB │   2.6 MiB │      0 B │     6 MiB │     6 MiB │      0 B 
    asset │   1.6 MiB │   1.6 MiB │ +1.4 KiB │   1.6 MiB │   1.6 MiB │ +1.4 KiB 
    other │ 199.8 KiB │ 199.8 KiB │    +14 B │ 440.1 KiB │ 440.1 KiB │      0 B 
──────────┼───────────┼───────────┼──────────┼───────────┼───────────┼──────────
    total │  11.4 MiB │  11.4 MiB │ +4.4 KiB │  20.2 MiB │  20.2 MiB │ +9.4 KiB 

 DEX     │ old   │ new   │ diff            
─────────┼───────┼───────┼─────────────────
   files │     1 │     1 │   0             
 strings │ 39771 │ 39801 │ +30 (+36 -6)    
   types │ 13720 │ 13733 │ +13 (+18 -5)    
 classes │ 11412 │ 11425 │ +13 (+16 -3)    
 methods │ 58632 │ 58671 │ +39 (+900 -861) 
  fields │ 38947 │ 38996 │ +49 (+323 -274) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  242 │  242 │  0   
 entries │ 6190 │ 6190 │  0
APK
     compressed      │     uncompressed     │                                
──────────┬──────────┼───────────┬──────────┤                                
 size     │ diff     │ size      │ diff     │ path                           
──────────┼──────────┼───────────┼──────────┼────────────────────────────────
  3.9 MiB │   +3 KiB │   8.4 MiB │   +8 KiB │ ∆ classes.dex                  
  7.8 KiB │ +1.4 KiB │   7.7 KiB │ +1.4 KiB │ ∆ assets/dexopt/baseline.prof  
   53 KiB │     +9 B │ 117.6 KiB │      0 B │ ∆ META-INF/CERT.SF             
 49.8 KiB │     +6 B │ 117.5 KiB │      0 B │ ∆ META-INF/MANIFEST.MF         
    1 KiB │     -1 B │     901 B │     -1 B │ ∆ assets/dexopt/baseline.profm 
  1.2 KiB │     -1 B │   1.2 KiB │      0 B │ ∆ META-INF/CERT.RSA            
──────────┼──────────┼───────────┼──────────┼────────────────────────────────
    4 MiB │ +4.4 KiB │   8.7 MiB │ +9.4 KiB │ (total)
DEX
STRINGS:

   old   │ new   │ diff         
  ───────┼───────┼──────────────
   39771 │ 39801 │ +30 (+36 -6) 
  
  + _this_navigate
  + _this_popUpTo
  + , didSendNewCode=
  + , isSendingNewCode=
  + , requestFocus=
  + LLZLZI
  + Lc2/L;
  + Ll6/E;
  + Ll6/F;
  + Lm6/m;
  + Lm6/n;
  + Lq2/c;
  + Lq6/l;
  + Lq6/m;
  + Lt6/t;
  + Lt6/u;
  + Lt6/v;
  + Ly6/a;
  + Ly6/b;
  + Ly6/c;
  + Ly6/d;
  + Ly6/e;
  + No link account found
  + VZZLZZLL
  + VerificationViewModel Error: 
  + VerificationViewState(isProcessing=
  + [Ll6/z;
  + [Lt6/v;
  + goBack()V
  + link.2fa.complete
  + link.2fa.failure
  + link.2fa.start
  + link.2fa.start_failure
  + navigateAndClearStack
  + no link account found
  + ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"ccc18f4","r8-mode":"full","version":"8.7.14"}
  
  - Lm3/q;
  - Lr0/g;
  - Lz6/a;
  - [Ll6/y;
  - [Lt6/s;
  - ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"0d81ddc","r8-mode":"full","version":"8.7.14"}
  

TYPES:

   old   │ new   │ diff         
  ───────┼───────┼──────────────
   13720 │ 13733 │ +13 (+18 -5) 
  
  + Lc2/L;
  + Ll6/E;
  + Ll6/F;
  + Lm6/m;
  + Lm6/n;
  + Lq2/c;
  + Lq6/l;
  + Lq6/m;
  + Lt6/t;
  + Lt6/u;
  + Lt6/v;
  + Ly6/a;
  + Ly6/b;
  + Ly6/c;
  + Ly6/d;
  + Ly6/e;
  + [Ll6/z;
  + [Lt6/v;
  
  - Lm3/q;
  - Lr0/g;
  - Lz6/a;
  - [Ll6/y;
  - [Lt6/s;
  

METHODS:

   old   │ new   │ diff            
  ───────┼───────┼─────────────────
   58632 │ 58671 │ +39 (+900 -861) 
  
  + B5.e0 <init>(F, q, G, boolean, c, int)
  + C0.c O(f0, d, int) → long
  + C0.c q(f0, d, d, int) → long
  + C5.c <init>(b, e, a, c)
  + D.t <init>(d, v, long, l)
  + D1.e <init>(c, F, c, I1, J1)
  + D6.t <init>(c, F, Map, Map, String, c, F1, boolean, c, a)
  + E0.e e(o)
  + F.k A0(d, long) → boolean
  + F.k C0(d, long) → long
  + F.k z0() → d
  + F6.a <init>(b, F, c)
  + F8.P1 <init>(A, a, c, a, c)
  + G5.a <init>(Object, Object, Object, Object, Object, int, int)
  + H5.D <init>(e, e, e, a, a, a, m, a, k, a, a)
  + H5.D <init>(a, e, g, a, e, a, a, c, p, d, m)
  + I0.G h(r, boolean) → d
  + I0.X d(r) → d
  + I0.X e(r) → d
  + I0.r h(r, boolean) → d
  + I5.g <init>(a, v, Integer, String, Integer)
  + K.c a(d, c) → Object
  + K.i y0(i, d0, a) → d
  + K0.d0 W0(b, boolean, boolean)
  + K0.d0 h(r, boolean) → d
  + K0.d0 w0(d0, b, boolean)
  + K0.i0 i(b, boolean)
  + K3.k E(l) → float
  + K3.k W(l, float)
  + K7.e <init>(F)
  + K7.x <init>(c, c, q, j, g, d, b, f, i, e, n, C0, j, a)
  + L0.N0 i(b, boolean)
  + L0.h1 i(b, boolean)
  + L0.v B() → d
  + L0.v k(v, b, d) → boolean
  + L0.y0 i(b, boolean)
  + N.H0 a(Z, d, int, int)
  + N.b0 k(b, int, H, H, boolean, int) → d
  + N6.b a() → l
  + P.f a(A, u, H, s, d, d)
  + P.f b(d)
  + P.j a(CursorAnchorInfo_Builder, d) → CursorAnchorInfo_Builder
  + P.k a(CursorAnchorInfo_Builder, H, d) → CursorAnchorInfo_Builder
  + Q.b A(int, ArrayList) → int
  + Q.b B(ArrayList, float) → int
  + Q.b C(ArrayList, long, c)
  + Q.b D(Object)
  + Q.b E(d) → p
  + Q.b F(u0, e, String, r0, c) → p0
  + Q.b G(int, int, TextPaint, CharSequence) → Rect
  + Q.b H(j, v) → Object
  + Q.b I(int, int, int) → int
  + Q.b J(Throwable) → String
  + Q.b K(EditText) → boolean
  + Q.b L(e, c) → e
  + Q.b M(View, A)
  + Q.b N(Typeface, w, Context) → Typeface
  + Q.b O(String)
  + Q.b P(Object)
  + Q.b Q(long) → String
  + Q.b R(d2) → e0
  + Q.b S(v, b, g1)
  + Q.b T(e, u0, String, r0, c, p) → p0
  + Q.b U(int, int)
  + Q.b V(int, int, int)
  + Q.b W(int, int, String) → String
  + Q.b a(boolean, a, p, int, int)
  + Q.b b(String, boolean, p, c, boolean, boolean, e0, d0, e, J, e, e, e, p, int, int, int)
  + Q.b c(k, c, a, p, int)
  + Q.b d(A, x, p, c, c, c, c, c, p, int)
  + Q.b e(A, String, p, c, String, c, c, c, c, c, p, int)
  + Q.b f(k, boolean, h, boolean, long, SuspendPointerInputElement, p, int)
  + Q.b g(int, p, a, p, boolean)
  + Q.b h(a, e, c) → Object
  + Q.b i(p, y, Z, boolean, boolean, int) → p
  + Q.b j(y, Object, float, c) → Object
  + Q.b k(p, c) → Object
  + Q.b l(long, float, long, long) → float
  + Q.b m(short[]) → byte[]
  + Q.b n(byte[]) → short[]
  + Q.b o(short[][]) → byte[][]
  + Q.b p(byte[][]) → short[][]
  + Q.b q(short[][][]) → byte[][][]
  + Q.b r(byte[][][]) → short[][][]
  + Q.b s(int, int)
  + Q.b t(Throwable) → k
  + Q.b u(c, float) → g
  + Q.b v(short[], short[]) → boolean
  + Q.b w(short[][], short[][]) → boolean
  + Q.b x(g1, b) → String
  + Q.b y(long, boolean, 
...✂

@toluo-stripe toluo-stripe changed the title Link Verification Screen Link Verification VM Nov 1, 2024
value = run {
val linkAccount = linkAccountManager.linkAccount.value
if (linkAccount == null) {
dismissWithResult(LinkActivityResult.Failed(NoLinkAccountFoundForVerification()))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There should be a link account (unverified) in the link account manager at this point

@toluo-stripe toluo-stripe marked this pull request as ready for review November 1, 2024 15:07
@toluo-stripe toluo-stripe requested review from a team as code owners November 1, 2024 15:07
Comment on lines 91 to 92
viewModelScope.launch {
linkAccountManager.confirmVerification(code).fold(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think having a launch here means that we effectively have some code like:

viewModelScope.launch {
    otpCode.collect {
         viewModelScope.launch { ...

Should we instead just have the second launch also be on the top-level? That seems better than having them nested (from a clarity perspective and also efficiency)

Comment on lines 90 to 92
for (i in 0 until otpElement.controller.otpLength) {
otpElement.controller.onValueChanged(i, "")
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you use otpElement.controller.reset here instead of needing to call onValueChanged for each index? It looks like the reset function is doing this same thing

}

@Test
fun `init sends analytics event`() = runTest(dispatcher) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This test name doesn't seem accurate anymore - it looks like this is testing that start verification is called, but doesn't actually test analytics

Copy link
Collaborator

Choose a reason for hiding this comment

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

there are several other tests which mention analytics in their names but which don't actually test analytics anymore. Can you update them please?

@toluo-stripe toluo-stripe merged commit 938f70e into master Nov 12, 2024
16 checks passed
@toluo-stripe toluo-stripe deleted the tolu/link_verf_screen branch November 12, 2024 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants