From 8b8043cfa8c8012668a5655cce3c06fd8534b21e Mon Sep 17 00:00:00 2001 From: Carlos M <99293320+carlosmuvi-stripe@users.noreply.github.com> Date: Fri, 22 Mar 2024 16:35:07 -0700 Subject: [PATCH 1/7] [FC] Moves Activities and some Panes out of Mavericks (#8125) * Removes mackericks references on Consent screen. * Updates files. * Uses viewmodel factory builder. * Updates functions. * Updates execute. * Updates compose util. * Adds missing side effects. * Simplifies code. * Renames viewmodel. * Updates async. * Removes mavericks from institution picker. * Reverts rename. * Updates baseline. * Adds setState and persists state. * Renames result error to fail. * Migrates Initial activity out of mavericks. * Removes persist state. * Updates tests. * Regenerates API. * filterNotNull. * Nits. * Updates async. * use suspend block. * Update financial-connections/src/main/java/com/stripe/android/financialconnections/core/FinancialConnectionsViewModel.kt Co-authored-by: Till Hellmund * Tries onAsync. * Moves activity to stripe ui core. * PR feedback. * Regenerates deps. --------- Co-authored-by: Till Hellmund --- example/dependencies/dependencies.txt | 57 +++--- .../dependencies/dependencies.txt | 171 +++++++++--------- .../dependencies/dependencies.txt | 165 ++++++++--------- financial-connections/detekt-baseline.xml | 2 +- .../FinancialConnectionsSheetActivity.kt | 90 +++++---- .../FinancialConnectionsSheetState.kt | 34 ++-- .../FinancialConnectionsSheetViewModel.kt | 137 ++++++++------ .../core/ComposeExtensions.kt | 47 +++++ .../core/FinancialConnectionsViewModel.kt | 81 +++++++++ .../di/FinancialConnectionsSheetComponent.kt | 4 + ...inancialConnectionsSheetNativeComponent.kt | 6 + .../features/common/SharedPartnerAuth.kt | 5 +- .../ConsentPreviewParameterProvider.kt | 2 +- .../features/consent/ConsentScreen.kt | 43 ++--- .../features/consent/ConsentState.kt | 11 +- .../features/consent/ConsentViewModel.kt | 37 ++-- ...stitutionPickerPreviewParameterProvider.kt | 18 +- .../InstitutionPickerScreen.kt | 19 +- .../InstitutionPickerViewModel.kt | 50 +++-- ...inancialConnectionsSheetNativeViewModel.kt | 103 +++++++---- ...FinancialConnectionsSheetNativeActivity.kt | 68 +++---- .../utils/MavericksExtensions.kt | 12 +- .../financialconnections/CoroutineTestRule.kt | 25 +++ .../FinancialConnectionsSheetViewModelTest.kt | 39 ++-- .../InstitutionPickerViewModelTest.kt | 25 ++- ...inancialConnectionsSheetNativeStateTest.kt | 6 +- ...cialConnectionsSheetNativeViewModelTest.kt | 35 ++-- identity/dependencies/dependencies.txt | 57 +++--- link/dependencies/dependencies.txt | 57 +++--- network-testing/dependencies/dependencies.txt | 53 +++--- .../dependencies/dependencies.txt | 57 +++--- .../dependencies/dependencies.txt | 53 +++--- payments-core/dependencies/dependencies.txt | 53 +++--- .../dependencies/dependencies.txt | 53 +++--- payments/dependencies/dependencies.txt | 57 +++--- .../dependencies/dependencies.txt | 57 +++--- paymentsheet/dependencies/dependencies.txt | 57 +++--- stripe-test-e2e/dependencies/dependencies.txt | 57 +++--- stripe-ui-core/build.gradle | 1 + stripe-ui-core/dependencies/dependencies.txt | 167 ++++++++--------- .../uicore/utils/ActivityExtensions.kt | 25 +++ wechatpay/dependencies/dependencies.txt | 53 +++--- 42 files changed, 1228 insertions(+), 921 deletions(-) create mode 100644 financial-connections/src/main/java/com/stripe/android/financialconnections/core/ComposeExtensions.kt create mode 100644 financial-connections/src/main/java/com/stripe/android/financialconnections/core/FinancialConnectionsViewModel.kt create mode 100644 financial-connections/src/test/java/com/stripe/android/financialconnections/CoroutineTestRule.kt create mode 100644 stripe-ui-core/src/main/java/com/stripe/android/uicore/utils/ActivityExtensions.kt diff --git a/example/dependencies/dependencies.txt b/example/dependencies/dependencies.txt index cc4818ccde8..a19c531f529 100644 --- a/example/dependencies/dependencies.txt +++ b/example/dependencies/dependencies.txt @@ -336,6 +336,34 @@ | | +--- project :stripe-ui-core | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) | | | +--- project :stripe-core (*) +| | | +--- androidx.activity:activity-ktx:1.8.2 +| | | | +--- androidx.activity:activity:1.8.2 (*) +| | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) +| | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 +| | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) +| | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) +| | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 +| | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | +--- androidx.activity:activity:1.8.2 (c) +| | | | \--- androidx.activity:activity-compose:1.8.2 (c) | | | +--- androidx.annotation:annotation:1.7.1 (*) | | | +--- androidx.core:core-ktx:1.12.0 (*) | | | +--- androidx.compose.foundation:foundation:1.5.4 @@ -358,34 +386,7 @@ | | | | | | | \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c) | | | | | | +--- androidx.compose.ui:ui:1.5.4 | | | | | | | \--- androidx.compose.ui:ui-android:1.5.4 -| | | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 -| | | | | | | | +--- androidx.activity:activity:1.8.2 (*) -| | | | | | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 -| | | | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) -| | | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) -| | | | | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 -| | | | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | +--- androidx.activity:activity:1.8.2 (c) -| | | | | | | | \--- androidx.activity:activity-compose:1.8.2 (c) +| | | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 (*) | | | | | | | +--- androidx.annotation:annotation:1.5.0 -> 1.7.1 (*) | | | | | | | +--- androidx.autofill:autofill:1.0.0 | | | | | | | | \--- androidx.core:core:1.1.0 -> 1.12.0 (*) diff --git a/financial-connections-example/dependencies/dependencies.txt b/financial-connections-example/dependencies/dependencies.txt index e5d57aba731..effcb618c42 100644 --- a/financial-connections-example/dependencies/dependencies.txt +++ b/financial-connections-example/dependencies/dependencies.txt @@ -145,12 +145,92 @@ | +--- project :stripe-ui-core | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) | | +--- project :stripe-core (*) -| | +--- androidx.annotation:annotation:1.7.1 (*) -| | +--- androidx.core:core-ktx:1.12.0 -| | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) -| | | +--- androidx.core:core:1.12.0 (*) +| | +--- androidx.activity:activity-ktx:1.8.2 +| | | +--- androidx.activity:activity:1.8.2 +| | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) +| | | | +--- androidx.collection:collection:1.0.0 -> 1.1.0 (*) +| | | | +--- androidx.core:core:1.8.0 -> 1.12.0 (*) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.6.1 -> 2.7.0 (*) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.6.1 -> 2.7.0 (*) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.6.1 -> 2.7.0 +| | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | | | +--- androidx.core:core-ktx:1.2.0 -> 1.12.0 +| | | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) +| | | | | | +--- androidx.core:core:1.12.0 (*) +| | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | | | \--- androidx.core:core:1.12.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 +| | | | | | +--- androidx.arch.core:core-common:2.2.0 (*) +| | | | | | +--- androidx.arch.core:core-runtime:2.2.0 (*) +| | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (*) +| | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) +| | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) +| | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) +| | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (*) +| | | | | +--- androidx.savedstate:savedstate:1.2.1 +| | | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) +| | | | | | +--- androidx.arch.core:core-common:2.1.0 -> 2.2.0 (*) +| | | | | | +--- androidx.lifecycle:lifecycle-common:2.6.1 -> 2.7.0 (*) +| | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | | | | \--- androidx.savedstate:savedstate-ktx:1.2.1 (c) +| | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | | +--- androidx.profileinstaller:profileinstaller:1.3.0 (*) +| | | | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | | | +--- androidx.tracing:tracing:1.0.0 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | +--- androidx.activity:activity-compose:1.8.2 (c) +| | | | \--- androidx.activity:activity-ktx:1.8.2 (c) +| | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) +| | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 +| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) +| | | +--- androidx.savedstate:savedstate-ktx:1.2.1 +| | | | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | | \--- androidx.savedstate:savedstate:1.2.1 (c) | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | \--- androidx.core:core:1.12.0 (c) +| | | +--- androidx.activity:activity:1.8.2 (c) +| | | \--- androidx.activity:activity-compose:1.8.2 (c) +| | +--- androidx.annotation:annotation:1.7.1 (*) +| | +--- androidx.core:core-ktx:1.12.0 (*) | | +--- androidx.compose.foundation:foundation:1.5.4 | | | \--- androidx.compose.foundation:foundation-android:1.5.4 | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) @@ -171,86 +251,7 @@ | | | | | | \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c) | | | | | +--- androidx.compose.ui:ui:1.5.4 | | | | | | \--- androidx.compose.ui:ui-android:1.5.4 -| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 -| | | | | | | +--- androidx.activity:activity:1.8.2 -| | | | | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) -| | | | | | | | +--- androidx.collection:collection:1.0.0 -> 1.1.0 (*) -| | | | | | | | +--- androidx.core:core:1.8.0 -> 1.12.0 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.6.1 -> 2.7.0 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.6.1 -> 2.7.0 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.6.1 -> 2.7.0 -| | | | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | | | +--- androidx.core:core-ktx:1.2.0 -> 1.12.0 (*) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 -| | | | | | | | | | +--- androidx.arch.core:core-common:2.2.0 (*) -| | | | | | | | | | +--- androidx.arch.core:core-runtime:2.2.0 (*) -| | | | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (*) -| | | | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) -| | | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) -| | | | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) -| | | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (*) -| | | | | | | | | +--- androidx.savedstate:savedstate:1.2.1 -| | | | | | | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) -| | | | | | | | | | +--- androidx.arch.core:core-common:2.1.0 -> 2.2.0 (*) -| | | | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.6.1 -> 2.7.0 (*) -| | | | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | | | | \--- androidx.savedstate:savedstate-ktx:1.2.1 (c) -| | | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | | +--- androidx.profileinstaller:profileinstaller:1.3.0 (*) -| | | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | | | +--- androidx.tracing:tracing:1.0.0 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | +--- androidx.activity:activity-compose:1.8.2 (c) -| | | | | | | | \--- androidx.activity:activity-ktx:1.8.2 (c) -| | | | | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 -| | | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) -| | | | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 -| | | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | +--- androidx.activity:activity:1.8.2 (c) -| | | | | | | \--- androidx.activity:activity-compose:1.8.2 (c) +| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 (*) | | | | | | +--- androidx.annotation:annotation:1.5.0 -> 1.7.1 (*) | | | | | | +--- androidx.autofill:autofill:1.0.0 | | | | | | | \--- androidx.core:core:1.1.0 -> 1.12.0 (*) diff --git a/financial-connections/dependencies/dependencies.txt b/financial-connections/dependencies/dependencies.txt index 84fbb58eae3..2527a93ce58 100644 --- a/financial-connections/dependencies/dependencies.txt +++ b/financial-connections/dependencies/dependencies.txt @@ -138,12 +138,89 @@ +--- project :stripe-ui-core | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) | +--- project :stripe-core (*) -| +--- androidx.annotation:annotation:1.7.1 (*) -| +--- androidx.core:core-ktx:1.12.0 -| | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) -| | +--- androidx.core:core:1.12.0 (*) +| +--- androidx.activity:activity-ktx:1.8.2 +| | +--- androidx.activity:activity:1.8.2 +| | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) +| | | +--- androidx.collection:collection:1.0.0 -> 1.1.0 (*) +| | | +--- androidx.core:core:1.8.0 -> 1.12.0 (*) +| | | +--- androidx.lifecycle:lifecycle-runtime:2.6.1 -> 2.7.0 (*) +| | | +--- androidx.lifecycle:lifecycle-viewmodel:2.6.1 -> 2.7.0 (*) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.6.1 -> 2.7.0 +| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | | +--- androidx.core:core-ktx:1.2.0 -> 1.12.0 +| | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) +| | | | | +--- androidx.core:core:1.12.0 (*) +| | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | | \--- androidx.core:core:1.12.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 +| | | | | +--- androidx.arch.core:core-common:2.2.0 (*) +| | | | | +--- androidx.arch.core:core-runtime:2.2.0 (*) +| | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (*) +| | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | | \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (*) +| | | | +--- androidx.savedstate:savedstate:1.2.1 +| | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) +| | | | | +--- androidx.arch.core:core-common:2.1.0 -> 2.2.0 (*) +| | | | | +--- androidx.lifecycle:lifecycle-common:2.6.1 -> 2.7.0 (*) +| | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | | | \--- androidx.savedstate:savedstate-ktx:1.2.1 (c) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | +--- androidx.profileinstaller:profileinstaller:1.3.0 (*) +| | | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | | +--- androidx.tracing:tracing:1.0.0 (*) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | +--- androidx.activity:activity-compose:1.8.2 (c) +| | | \--- androidx.activity:activity-ktx:1.8.2 (c) +| | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) +| | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 +| | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) +| | +--- androidx.savedstate:savedstate-ktx:1.2.1 +| | | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | \--- androidx.savedstate:savedstate:1.2.1 (c) | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | \--- androidx.core:core:1.12.0 (c) +| | +--- androidx.activity:activity:1.8.2 (c) +| | \--- androidx.activity:activity-compose:1.8.2 (c) +| +--- androidx.annotation:annotation:1.7.1 (*) +| +--- androidx.core:core-ktx:1.12.0 (*) | +--- androidx.compose.foundation:foundation:1.5.4 | | \--- androidx.compose.foundation:foundation-android:1.5.4 | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) @@ -163,83 +240,7 @@ | | | | | \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c) | | | | +--- androidx.compose.ui:ui:1.5.4 | | | | | \--- androidx.compose.ui:ui-android:1.5.4 -| | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 -| | | | | | +--- androidx.activity:activity:1.8.2 -| | | | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) -| | | | | | | +--- androidx.collection:collection:1.0.0 -> 1.1.0 (*) -| | | | | | | +--- androidx.core:core:1.8.0 -> 1.12.0 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.6.1 -> 2.7.0 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.6.1 -> 2.7.0 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.6.1 -> 2.7.0 -| | | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | | +--- androidx.core:core-ktx:1.2.0 -> 1.12.0 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 -| | | | | | | | | +--- androidx.arch.core:core-common:2.2.0 (*) -| | | | | | | | | +--- androidx.arch.core:core-runtime:2.2.0 (*) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (*) -| | | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | | | \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (*) -| | | | | | | | +--- androidx.savedstate:savedstate:1.2.1 -| | | | | | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) -| | | | | | | | | +--- androidx.arch.core:core-common:2.1.0 -> 2.2.0 (*) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.6.1 -> 2.7.0 (*) -| | | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | | | \--- androidx.savedstate:savedstate-ktx:1.2.1 (c) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | | \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | +--- androidx.profileinstaller:profileinstaller:1.3.0 (*) -| | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | | +--- androidx.tracing:tracing:1.0.0 (*) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | +--- androidx.activity:activity-compose:1.8.2 (c) -| | | | | | | \--- androidx.activity:activity-ktx:1.8.2 (c) -| | | | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) -| | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 -| | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) -| | | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 -| | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) -| | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | +--- androidx.activity:activity:1.8.2 (c) -| | | | | | \--- androidx.activity:activity-compose:1.8.2 (c) +| | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 (*) | | | | | +--- androidx.annotation:annotation:1.5.0 -> 1.7.1 (*) | | | | | +--- androidx.autofill:autofill:1.0.0 | | | | | | \--- androidx.core:core:1.1.0 -> 1.12.0 (*) diff --git a/financial-connections/detekt-baseline.xml b/financial-connections/detekt-baseline.xml index b8b46c731ae..099fdef0d71 100644 --- a/financial-connections/detekt-baseline.xml +++ b/financial-connections/detekt-baseline.xml @@ -36,6 +36,6 @@ SwallowedException:PostAuthorizationSession.kt$PostAuthorizationSession$e: StripeException TooManyFunctions:FinancialConnectionsManifestRepository.kt$FinancialConnectionsManifestRepository TooManyFunctions:FinancialConnectionsManifestRepository.kt$FinancialConnectionsManifestRepositoryImpl : FinancialConnectionsManifestRepository - TooManyFunctions:FinancialConnectionsSheetNativeViewModel.kt$FinancialConnectionsSheetNativeViewModel : MavericksViewModel + TooManyFunctions:FinancialConnectionsSheetNativeViewModel.kt$FinancialConnectionsSheetNativeViewModel : FinancialConnectionsViewModel diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetActivity.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetActivity.kt index fe3376f566f..11946f3bf9b 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetActivity.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetActivity.kt @@ -7,6 +7,7 @@ import android.widget.Toast import androidx.activity.addCallback import androidx.activity.compose.setContent import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult +import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize @@ -15,9 +16,10 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle import com.airbnb.mvrx.Mavericks -import com.airbnb.mvrx.MavericksView -import com.airbnb.mvrx.withState import com.stripe.android.financialconnections.FinancialConnectionsSheetViewEffect.FinishWithResult import com.stripe.android.financialconnections.FinancialConnectionsSheetViewEffect.OpenAuthFlowWithUrl import com.stripe.android.financialconnections.FinancialConnectionsSheetViewEffect.OpenNativeAuthFlow @@ -29,11 +31,16 @@ import com.stripe.android.financialconnections.launcher.FinancialConnectionsShee import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.ui.theme.FinancialConnectionsTheme import com.stripe.android.financialconnections.utils.argsOrNull -import com.stripe.android.financialconnections.utils.viewModelLazy +import kotlinx.coroutines.flow.distinctUntilChanged +import kotlinx.coroutines.flow.filterNotNull +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.launch -internal class FinancialConnectionsSheetActivity : AppCompatActivity(), MavericksView { +internal class FinancialConnectionsSheetActivity : AppCompatActivity() { - val viewModel: FinancialConnectionsSheetViewModel by viewModelLazy() + val viewModel: FinancialConnectionsSheetViewModel by viewModels( + factoryProducer = { FinancialConnectionsSheetViewModel.Factory } + ) val args by argsOrNull() @@ -52,7 +59,7 @@ internal class FinancialConnectionsSheetActivity : AppCompatActivity(), Maverick if (args == null) { finish() } else { - viewModel.onEach { postInvalidate() } + observeViewEffects() browserManager = BrowserManager(application) if (savedInstanceState != null) viewModel.onActivityRecreated() } @@ -91,42 +98,55 @@ internal class FinancialConnectionsSheetActivity : AppCompatActivity(), Maverick /** * handle state changes here. */ - override fun invalidate() { - withState(viewModel) { state -> - state.viewEffect?.let { viewEffect -> - when (viewEffect) { - is OpenAuthFlowWithUrl -> startBrowserForResult.launch( - browserManager.createBrowserIntentForUrl( - uri = Uri.parse(viewEffect.url) + + private fun observeViewEffects() = lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.STARTED) { + viewModel.stateFlow + .map { it.viewEffect } + .distinctUntilChanged() + .filterNotNull() + .collect { viewEffect -> + when (viewEffect) { + is OpenAuthFlowWithUrl -> startBrowserForResult.launch( + browserManager.createBrowserIntentForUrl( + uri = Uri.parse(viewEffect.url) + ) ) - ) - is FinishWithResult -> { - viewEffect.finishToast?.let { - Toast.makeText(this, it, Toast.LENGTH_LONG).show() + is FinishWithResult -> { + viewEffect.finishToast?.let { resId -> + Toast.makeText( + this@FinancialConnectionsSheetActivity, + resId, + Toast.LENGTH_LONG + ).show() + } + finishWithResult(viewEffect.result) } - finishWithResult(viewEffect.result) + + is OpenNativeAuthFlow -> openNativeAuthFlow(viewEffect) } + viewModel.onViewEffectLaunched() + } + } + } - is OpenNativeAuthFlow -> startNativeAuthFlowForResult.launch( - Intent( - this, - FinancialConnectionsSheetNativeActivity::class.java - ).also { - it.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION) - it.putExtra( - Mavericks.KEY_ARG, - FinancialConnectionsSheetNativeActivityArgs( - initialSyncResponse = viewEffect.initialSyncResponse, - configuration = viewEffect.configuration - ) - ) - } + private fun openNativeAuthFlow(viewEffect: OpenNativeAuthFlow) { + startNativeAuthFlowForResult.launch( + Intent( + this@FinancialConnectionsSheetActivity, + FinancialConnectionsSheetNativeActivity::class.java + ).also { + it.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION) + it.putExtra( + Mavericks.KEY_ARG, + FinancialConnectionsSheetNativeActivityArgs( + initialSyncResponse = viewEffect.initialSyncResponse, + configuration = viewEffect.configuration ) - } - viewModel.onViewEffectLaunched() + ) } - } + ) } private fun finishWithResult(result: FinancialConnectionsSheetActivityResult) { diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetState.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetState.kt index 50886478de1..6ec67c4a3bd 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetState.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetState.kt @@ -1,8 +1,8 @@ package com.stripe.android.financialconnections +import android.os.Bundle import androidx.annotation.StringRes import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.PersistState import com.stripe.android.financialconnections.launcher.FinancialConnectionsSheetActivityArgs import com.stripe.android.financialconnections.launcher.FinancialConnectionsSheetActivityResult import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest @@ -13,15 +13,28 @@ import com.stripe.android.financialconnections.model.SynchronizeSessionResponse */ internal data class FinancialConnectionsSheetState( val initialArgs: FinancialConnectionsSheetActivityArgs, - val activityRecreated: Boolean = false, - @PersistState val manifest: FinancialConnectionsSessionManifest? = null, - @PersistState val webAuthFlowStatus: AuthFlowStatus = AuthFlowStatus.NONE, - val viewEffect: FinancialConnectionsSheetViewEffect? = null + val activityRecreated: Boolean, + val manifest: FinancialConnectionsSessionManifest?, + val webAuthFlowStatus: AuthFlowStatus, + val viewEffect: FinancialConnectionsSheetViewEffect? ) : MavericksState { val sessionSecret: String get() = initialArgs.configuration.financialConnectionsSessionClientSecret + /** + * Constructor used to build the initial state. + */ + constructor(args: FinancialConnectionsSheetActivityArgs, savedState: Bundle?) : this( + initialArgs = args, + activityRecreated = false, + manifest = savedState?.getParcelable(KEY_MANIFEST), + webAuthFlowStatus = savedState?.getSerializable(KEY_WEB_AUTH_FLOW_STATUS) + as? AuthFlowStatus + ?: AuthFlowStatus.NONE, + viewEffect = null + ) + enum class AuthFlowStatus { /** * AuthFlow is happening outside of the SDK (app2app, web browser, etc). @@ -47,12 +60,11 @@ internal data class FinancialConnectionsSheetState( NONE } - /** - * Constructor used by Mavericks to build the initial state. - */ - constructor(args: FinancialConnectionsSheetActivityArgs) : this( - initialArgs = args - ) + companion object { + const val KEY_SAVED_STATE = "financial_connections_sheet_state" + const val KEY_MANIFEST = "financial_connections_sheet_manifest" + const val KEY_WEB_AUTH_FLOW_STATUS = "financial_connections_sheet_web_auth_flow_status" + } } /** diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModel.kt index c661f97c982..295f8df1de8 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModel.kt @@ -1,13 +1,19 @@ package com.stripe.android.financialconnections import android.app.Activity +import android.app.Application import android.content.Intent import android.net.Uri +import android.os.Bundle import androidx.activity.result.ActivityResult import androidx.annotation.StringRes -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.SavedStateHandle +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.createSavedStateHandle +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory +import com.airbnb.mvrx.Mavericks import com.stripe.android.core.Logger import com.stripe.android.financialconnections.FinancialConnectionsSheetState.AuthFlowStatus import com.stripe.android.financialconnections.FinancialConnectionsSheetViewEffect.FinishWithResult @@ -20,6 +26,7 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsEve import com.stripe.android.financialconnections.analytics.FinancialConnectionsEventReporter import com.stripe.android.financialconnections.analytics.logError import com.stripe.android.financialconnections.browser.BrowserManager +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.APPLICATION_ID import com.stripe.android.financialconnections.di.DaggerFinancialConnectionsSheetComponent import com.stripe.android.financialconnections.domain.FetchFinancialConnectionsSession @@ -29,6 +36,7 @@ import com.stripe.android.financialconnections.domain.SynchronizeFinancialConnec import com.stripe.android.financialconnections.exception.AppInitializationError import com.stripe.android.financialconnections.exception.CustomManualEntryRequiredError import com.stripe.android.financialconnections.features.manualentry.isCustomManualEntryError +import com.stripe.android.financialconnections.launcher.FinancialConnectionsSheetActivityArgs import com.stripe.android.financialconnections.launcher.FinancialConnectionsSheetActivityArgs.ForData import com.stripe.android.financialconnections.launcher.FinancialConnectionsSheetActivityArgs.ForLink import com.stripe.android.financialconnections.launcher.FinancialConnectionsSheetActivityArgs.ForToken @@ -50,6 +58,7 @@ import javax.inject.Named internal class FinancialConnectionsSheetViewModel @Inject constructor( @Named(APPLICATION_ID) private val applicationId: String, + savedStateHandle: SavedStateHandle, private val synchronizeFinancialConnectionsSession: SynchronizeFinancialConnectionsSession, private val fetchFinancialConnectionsSession: FetchFinancialConnectionsSession, private val fetchFinancialConnectionsSessionForToken: FetchFinancialConnectionsSessionForToken, @@ -59,11 +68,12 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( private val analyticsTracker: FinancialConnectionsAnalyticsTracker, private val nativeRouter: NativeAuthFlowRouter, initialState: FinancialConnectionsSheetState -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { private val mutex = Mutex() init { + savedStateHandle.registerSavedStateProvider() if (initialState.initialArgs.isValid()) { eventReporter.onPresented(initialState.initialArgs.configuration) // avoid re-fetching manifest if already exists (this will happen on process recreations) @@ -76,20 +86,27 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( } } + private fun SavedStateHandle.registerSavedStateProvider() = + setSavedStateProvider(FinancialConnectionsSheetState.KEY_SAVED_STATE) { + val state = stateFlow.value + Bundle().apply { + putParcelable(FinancialConnectionsSheetState.KEY_MANIFEST, state.manifest) + putSerializable(FinancialConnectionsSheetState.KEY_WEB_AUTH_FLOW_STATUS, state.webAuthFlowStatus) + } + } + /** * Fetches the [FinancialConnectionsSessionManifest] from the Stripe API to get the hosted auth flow URL * as well as the success and cancel callback URLs to verify. */ private fun fetchManifest() { - withState { state -> - viewModelScope.launch { - kotlin.runCatching { - synchronizeFinancialConnectionsSession() - }.onFailure { - finishWithResult(state, Failed(it)) - }.onSuccess { - openAuthFlow(it) - } + viewModelScope.launch { + kotlin.runCatching { + synchronizeFinancialConnectionsSession() + }.onFailure { + finishWithResult(stateFlow.value, Failed(it)) + }.onSuccess { + openAuthFlow(it) } } } @@ -108,12 +125,10 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( val nativeAuthFlowEnabled = nativeRouter.nativeAuthFlowEnabled(sync.manifest) viewModelScope.launch { nativeRouter.logExposure(sync.manifest) } if (sync.manifest.hostedAuthUrl == null) { - withState { - finishWithResult( - state = it, - result = Failed(IllegalArgumentException("hostedAuthUrl is required!")) - ) - } + finishWithResult( + state = stateFlow.value, + result = Failed(IllegalArgumentException("hostedAuthUrl is required!")) + ) } else { FinancialConnections.emitEvent(name = Name.OPEN) if (nativeAuthFlowEnabled) { @@ -138,19 +153,17 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( } private fun logNoBrowserAvailableAndFinish() { - withState { state -> - val error = AppInitializationError("No Web browser available to launch AuthFlow") - analyticsTracker.logError( - "error Launching the Auth Flow", - logger = logger, - pane = Pane.UNEXPECTED_ERROR, - error = error - ) - finishWithResult( - state = state, - result = Failed(error) - ) - } + val error = AppInitializationError("No Web browser available to launch AuthFlow") + analyticsTracker.logError( + "error Launching the Auth Flow", + logger = logger, + pane = Pane.UNEXPECTED_ERROR, + error = error + ) + finishWithResult( + state = stateFlow.value, + result = Failed(error) + ) } /** @@ -187,7 +200,7 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( internal fun onResume() { viewModelScope.launch { mutex.withLock { - val state = awaitState() + val state = stateFlow.value if (state.activityRecreated.not()) { when (state.webAuthFlowStatus) { AuthFlowStatus.ON_EXTERNAL_ACTIVITY -> finishWithResult( @@ -216,7 +229,7 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( internal fun onBrowserActivityResult() { viewModelScope.launch { mutex.withLock { - val state = awaitState() + val state = stateFlow.value if (state.activityRecreated) { when (state.webAuthFlowStatus) { AuthFlowStatus.ON_EXTERNAL_ACTIVITY -> finishWithResult( @@ -241,9 +254,9 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( val result: FinancialConnectionsSheetActivityResult? = activityResult.data ?.parcelable(FinancialConnectionsSheetNativeActivity.EXTRA_RESULT) if (activityResult.resultCode == Activity.RESULT_OK && result != null) { - withState { finishWithResult(it, result, fromNative = true) } + finishWithResult(stateFlow.value, result, fromNative = true) } else { - withState { finishWithResult(it, Canceled, fromNative = true) } + finishWithResult(stateFlow.value, Canceled, fromNative = true) } } @@ -264,7 +277,7 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( result = Completed(financialConnectionsSession = it) ) }.onFailure { error -> - withState { finishWithResult(it, Failed(error)) } + finishWithResult(stateFlow.value, Failed(error)) } } } @@ -286,7 +299,7 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( result = Completed(financialConnectionsSession = las, token = token) ) }.onFailure { error -> - withState { finishWithResult(it, Failed(error)) } + finishWithResult(stateFlow.value, Failed(error)) } } } @@ -311,7 +324,7 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( } ) }.onFailure { error -> - withState { finishWithResult(it, Failed(error)) } + finishWithResult(stateFlow.value, Failed(error)) } } } @@ -328,7 +341,7 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( viewModelScope.launch { mutex.withLock { val receivedUrl: Uri? = intent?.data?.toString()?.toUriOrNull() - val state = awaitState() + val state = stateFlow.value when { // stripe-auth://native-redirect receivedUrl?.host == "native-redirect" -> @@ -423,15 +436,13 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( kotlin.runCatching { requireNotNull(url.getQueryParameter(QUERY_PARAM_LINKED_ACCOUNT)) }.onSuccess { linkedAccountId -> - withState { - finishWithResult( - state = it, - result = Completed(linkedAccountId = linkedAccountId) - ) - } + finishWithResult( + state = stateFlow.value, + result = Completed(linkedAccountId = linkedAccountId) + ) }.onFailure { error -> logger.error("Could not retrieve linked account from success url", error) - withState { state -> finishWithResult(state, Failed(error)) } + finishWithResult(stateFlow.value, Failed(error)) } } @@ -465,19 +476,25 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( setState { copy(viewEffect = FinishWithResult(result, finishMessage)) } } - companion object : - MavericksViewModelFactory { - - override fun create( - viewModelContext: ViewModelContext, - state: FinancialConnectionsSheetState - ): FinancialConnectionsSheetViewModel { - return DaggerFinancialConnectionsSheetComponent - .builder() - .application(viewModelContext.app()) - .initialState(state) - .configuration(state.initialArgs.configuration) - .build().viewModel + companion object { + + val Factory = viewModelFactory { + initializer { + val savedStateHandle: SavedStateHandle = createSavedStateHandle() + // If the ViewModel is recreated, it will be provided with the saved state. + val savedState = savedStateHandle.get(FinancialConnectionsSheetState.KEY_SAVED_STATE) + val app = this[ViewModelProvider.AndroidViewModelFactory.APPLICATION_KEY] as Application + // Arguments passed to the activity + val args: FinancialConnectionsSheetActivityArgs = requireNotNull(savedStateHandle[Mavericks.KEY_ARG]) + val state = FinancialConnectionsSheetState(args, savedState) + DaggerFinancialConnectionsSheetComponent + .builder() + .application(app) + .savedStateHandle(savedStateHandle) + .initialState(state) + .configuration(state.initialArgs.configuration) + .build().viewModel + } } internal const val MAX_ACCOUNTS = 100 diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/core/ComposeExtensions.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/core/ComposeExtensions.kt new file mode 100644 index 00000000000..9d158e31d0f --- /dev/null +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/core/ComposeExtensions.kt @@ -0,0 +1,47 @@ +package com.stripe.android.financialconnections.core + +import androidx.compose.runtime.Composable +import androidx.compose.runtime.State +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.remember +import androidx.compose.ui.platform.LocalContext +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewmodel.compose.viewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent +import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity +import com.stripe.android.uicore.utils.extractActivity +import kotlinx.coroutines.flow.distinctUntilChanged +import kotlinx.coroutines.flow.map +import kotlin.reflect.KProperty1 + +/** + * Retrieves or builds a ViewModel instance, providing the [FinancialConnectionsSheetNativeComponent] (activity + * retained component) to the factory to facilitate its creation via dependency injection. + */ +@Composable +internal inline fun , S> paneViewModel( + factory: (FinancialConnectionsSheetNativeComponent) -> ViewModelProvider.Factory +): T { return viewModel(factory = factory(parentActivity().viewModel.activityRetainedComponent)) } + +/** + * Retrieves the parent [FinancialConnectionsSheetNativeActivity] from the current Compose context. + */ +@Composable +internal fun parentActivity(): FinancialConnectionsSheetNativeActivity { + return LocalContext.current.extractActivity() as FinancialConnectionsSheetNativeActivity +} + +/** + * Creates a Compose State variable that will only update when the value of this property changes. + * Prefer this to subscribing to entire state classes which will trigger a recomposition whenever + * any state variable changes. + * + * If you find yourself subscribing to many state properties in a single composable, + * consider breaking it up into smaller ones. + */ +@Composable +internal fun , S, A> VM.collectAsState(prop1: KProperty1): State { + val mappedFlow = remember(prop1) { stateFlow.map { prop1.get(it) }.distinctUntilChanged() } + val initialValue = remember { stateFlow.value } + return mappedFlow.collectAsState(initial = prop1.get(initialValue)) +} diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/core/FinancialConnectionsViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/core/FinancialConnectionsViewModel.kt new file mode 100644 index 00000000000..604fcfa4912 --- /dev/null +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/core/FinancialConnectionsViewModel.kt @@ -0,0 +1,81 @@ +package com.stripe.android.financialconnections.core + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import kotlinx.coroutines.Job +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.distinctUntilChanged +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.flow.update +import kotlinx.coroutines.launch +import kotlin.reflect.KProperty1 + +internal abstract class FinancialConnectionsViewModel( + initialState: S +) : ViewModel() { + + private val _stateFlow: MutableStateFlow = MutableStateFlow(initialState) + val stateFlow: StateFlow = _stateFlow.asStateFlow() + + protected open fun (suspend () -> T).execute( + onSuccess: (T) -> Unit = {}, + onFail: (Throwable) -> Unit = {}, + reducer: S.(Async) -> S + ): Job { + return viewModelScope.launch { + setState { reducer(Loading) } + val result = runCatching { this@execute() } + // update state. + result.fold( + onSuccess = { data -> + setState { reducer(Success(data)) } + onSuccess(data) + }, + onFailure = { throwable -> + setState { reducer(Fail(throwable)) } + onFail(throwable) + } + ) + } + } + + protected open fun onAsync( + prop: KProperty1>, + onSuccess: (T) -> Unit = {}, + onFail: (Throwable) -> Unit = {} + ) { + viewModelScope.launch { + stateFlow.map { prop.get(it) } + .distinctUntilChanged() + .collect { async -> + when (async) { + is Success -> onSuccess(async()) + is Fail -> onFail(async.error) + Loading -> Unit + Async.Uninitialized -> Unit + } + } + } + } + + protected fun setState(reducer: S.() -> S) = _stateFlow.update(reducer) +} + +internal sealed class Async( + private val value: T? +) { + data object Uninitialized : Async(value = null) + data object Loading : Async(value = null) + data class Success(private val value: T) : Async(value = value) { + override operator fun invoke(): T = value + } + + data class Fail(val error: Throwable) : Async(value = null) + + open operator fun invoke(): T? = value +} diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetComponent.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetComponent.kt index c62cf42b946..0ba94d9ba49 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetComponent.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetComponent.kt @@ -1,6 +1,7 @@ package com.stripe.android.financialconnections.di import android.app.Application +import androidx.lifecycle.SavedStateHandle import com.stripe.android.core.injection.CoreCommonModule import com.stripe.android.core.injection.CoroutineContextModule import com.stripe.android.financialconnections.FinancialConnectionsSheet @@ -27,6 +28,9 @@ internal interface FinancialConnectionsSheetComponent { @BindsInstance fun application(application: Application): Builder + @BindsInstance + fun savedStateHandle(savedStateHandle: SavedStateHandle): Builder + @BindsInstance fun initialState(initialState: FinancialConnectionsSheetState): Builder diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeComponent.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeComponent.kt index a4292f0278b..1bc155e6d70 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeComponent.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeComponent.kt @@ -1,6 +1,7 @@ package com.stripe.android.financialconnections.di import android.app.Application +import androidx.lifecycle.SavedStateHandle import com.stripe.android.core.injection.CoreCommonModule import com.stripe.android.core.injection.CoroutineContextModule import com.stripe.android.financialconnections.FinancialConnectionsSheet @@ -73,6 +74,11 @@ internal interface FinancialConnectionsSheetNativeComponent { @Named(INITIAL_SYNC_RESPONSE) initialSyncResponse: SynchronizeSessionResponse? ): Builder + @BindsInstance + fun savedStateHandle( + savedStateHandle: SavedStateHandle + ): Builder + @BindsInstance fun application(application: Application): Builder diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/common/SharedPartnerAuth.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/common/SharedPartnerAuth.kt index 203e0b14371..f4515fd247f 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/common/SharedPartnerAuth.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/common/SharedPartnerAuth.kt @@ -46,8 +46,8 @@ import com.airbnb.mvrx.Fail import com.airbnb.mvrx.Loading import com.airbnb.mvrx.Success import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.compose.collectAsState import com.stripe.android.financialconnections.R +import com.stripe.android.financialconnections.core.collectAsState import com.stripe.android.financialconnections.features.partnerauth.PartnerAuthPreviewParameterProvider import com.stripe.android.financialconnections.features.partnerauth.SharedPartnerAuthState import com.stripe.android.financialconnections.features.partnerauth.SharedPartnerAuthState.AuthenticationStatus @@ -55,6 +55,7 @@ import com.stripe.android.financialconnections.features.partnerauth.SharedPartne import com.stripe.android.financialconnections.features.partnerauth.SharedPartnerAuthState.ViewEffect import com.stripe.android.financialconnections.model.Entry import com.stripe.android.financialconnections.model.OauthPrepane +import com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeState import com.stripe.android.financialconnections.presentation.WebAuthFlowState import com.stripe.android.financialconnections.presentation.parentViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview @@ -83,7 +84,7 @@ internal fun SharedPartnerAuth( ) { val viewModel = parentViewModel() - val webAuthFlow = viewModel.collectAsState { it.webAuthFlow } + val webAuthFlow = viewModel.collectAsState(FinancialConnectionsSheetNativeState::webAuthFlow) val uriHandler = LocalUriHandler.current val bottomSheetState = rememberModalBottomSheetState( diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentPreviewParameterProvider.kt index 1e4de0c3b73..a95fa1ae314 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentPreviewParameterProvider.kt @@ -3,7 +3,7 @@ package com.stripe.android.financialconnections.features.consent import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.ModalBottomSheetValue import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.airbnb.mvrx.Success +import com.stripe.android.financialconnections.core.Async.Success import com.stripe.android.financialconnections.model.Bullet import com.stripe.android.financialconnections.model.ConnectedAccessNotice import com.stripe.android.financialconnections.model.ConsentPane diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentScreen.kt index 0fa834e059a..0177617881c 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentScreen.kt @@ -17,6 +17,7 @@ import androidx.compose.material.Text import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.collectAsState import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment @@ -30,13 +31,12 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.DataAccessBottomSheetContent import com.stripe.android.financialconnections.features.common.LegalDetailsBottomSheetContent import com.stripe.android.financialconnections.features.common.ListItem @@ -45,6 +45,7 @@ import com.stripe.android.financialconnections.features.consent.ConsentState.Vie import com.stripe.android.financialconnections.features.consent.ConsentState.ViewEffect.OpenUrl import com.stripe.android.financialconnections.features.consent.ui.ConsentLogoHeader import com.stripe.android.financialconnections.model.ConsentPane +import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.presentation.parentViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview @@ -66,10 +67,9 @@ import kotlinx.coroutines.launch @ExperimentalMaterialApi @Composable internal fun ConsentScreen() { - // update step state when manifest changes - val viewModel: ConsentViewModel = mavericksViewModel() + val viewModel: ConsentViewModel = paneViewModel { ConsentViewModel.factory(it) } val parentViewModel = parentViewModel() - val state = viewModel.collectAsState() + val state = viewModel.stateFlow.collectAsState() val uriHandler = LocalUriHandler.current val scope = rememberCoroutineScope() @@ -113,20 +113,21 @@ private fun ConsentContent( onCloseClick: () -> Unit, onCloseFromErrorClick: (Throwable) -> Unit ) { - when (val consent = state.consent) { - Uninitialized, is Loading -> ConsentLoadingContent() + when (val result = state.consent) { + Uninitialized, Loading -> ConsentLoadingContent() + is Success -> LoadedContent( - payload = consent(), - bottomSheetMode = state.currentBottomSheet, - acceptConsent = state.acceptConsent, + payload = result(), bottomSheetState = bottomSheetState, + acceptConsent = state.acceptConsent, + bottomSheetMode = state.currentBottomSheet, onClickableTextClick = onClickableTextClick, + onContinueClick = onContinueClick, onCloseClick = onCloseClick, - onConfirmModalClick = onConfirmModalClick, - onContinueClick = onContinueClick + onConfirmModalClick = onConfirmModalClick ) - is Fail -> UnclassifiedErrorContent { onCloseFromErrorClick(consent.error) } + is Fail -> UnclassifiedErrorContent { onCloseFromErrorClick(result.error) } } } @@ -147,7 +148,7 @@ private fun ConsentLoadingContent() { @Composable private fun ConsentMainContent( payload: ConsentState.Payload, - acceptConsent: Async, + acceptConsent: Async, onClickableTextClick: (String) -> Unit, onContinueClick: () -> Unit, onCloseClick: () -> Unit @@ -230,7 +231,7 @@ private fun LazyListScope.consentBody( private fun LoadedContent( payload: ConsentState.Payload, bottomSheetState: ModalBottomSheetState, - acceptConsent: Async, + acceptConsent: Async, onContinueClick: () -> Unit, onCloseClick: () -> Unit, onClickableTextClick: (String) -> Unit, @@ -271,7 +272,7 @@ private fun LoadedContent( @OptIn(ExperimentalComposeUiApi::class) @Composable private fun ConsentFooter( - acceptConsent: Async, + acceptConsent: Async, consent: ConsentPane, onClickableTextClick: (String) -> Unit, onContinueClick: () -> Unit, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentState.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentState.kt index de5ec0d693a..b2eb24f1718 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentState.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentState.kt @@ -1,17 +1,16 @@ package com.stripe.android.financialconnections.features.consent -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.Uninitialized +import com.stripe.android.financialconnections.core.Async import com.stripe.android.financialconnections.model.ConsentPane +import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest internal data class ConsentState( - val consent: Async = Uninitialized, + val consent: Async = Async.Uninitialized, val merchantLogos: List = emptyList(), val currentBottomSheet: BottomSheetContent = BottomSheetContent.DATA, - val acceptConsent: Async = Uninitialized, + val acceptConsent: Async = Async.Uninitialized, val viewEffect: ViewEffect? = null -) : MavericksState { +) { data class Payload( val consent: ConsentPane, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentViewModel.kt index 1eac34eb74f..4e5bd773a09 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentViewModel.kt @@ -1,8 +1,9 @@ package com.stripe.android.financialconnections.features.consent -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.core.Logger import com.stripe.android.financialconnections.FinancialConnections import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.ConsentAgree @@ -10,6 +11,8 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Name import com.stripe.android.financialconnections.analytics.logError +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.AcceptConsent import com.stripe.android.financialconnections.domain.GetOrFetchSync import com.stripe.android.financialconnections.features.consent.ConsentState.BottomSheetContent @@ -20,7 +23,6 @@ import com.stripe.android.financialconnections.model.FinancialConnectionsSession import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.destination -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.ui.HandleClickableUrl import com.stripe.android.financialconnections.utils.Experiment.CONNECTIONS_CONSENT_COMBINED_LOGO import com.stripe.android.financialconnections.utils.experimentAssignment @@ -37,7 +39,7 @@ internal class ConsentViewModel @Inject constructor( private val eventTracker: FinancialConnectionsAnalyticsTracker, private val handleClickableUrl: HandleClickableUrl, private val logger: Logger -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { init { logErrors() @@ -77,6 +79,7 @@ internal class ConsentViewModel @Inject constructor( FinancialConnections.emitEvent(Name.CONSENT_ACQUIRED) val updatedManifest: FinancialConnectionsSessionManifest = acceptConsent() navigationManager.tryNavigateTo(updatedManifest.nextPane.destination(referrer = Pane.CONSENT)) + updatedManifest }.execute { copy(acceptConsent = it) } } @@ -117,19 +120,17 @@ internal class ConsentViewModel @Inject constructor( setState { copy(viewEffect = null) } } - companion object : MavericksViewModelFactory { + companion object { - override fun create( - viewModelContext: ViewModelContext, - state: ConsentState - ): ConsentViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .consentBuilder - .initialState(state) - .build() - .viewModel - } + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = + viewModelFactory { + initializer { + parentComponent + .consentBuilder + .initialState(ConsentState()) + .build() + .viewModel + } + } } } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerPreviewParameterProvider.kt index 04cbaa75798..6dcddd6ba62 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerPreviewParameterProvider.kt @@ -1,10 +1,10 @@ package com.stripe.android.financialconnections.features.institutionpicker import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.model.FinancialConnectionsInstitution import com.stripe.android.financialconnections.model.InstitutionResponse @@ -28,7 +28,7 @@ internal class InstitutionPickerPreviewParameterProvider : private fun initialLoading() = InstitutionPreviewState( state = InstitutionPickerState( previewText = null, - payload = Loading(), + payload = Loading, searchInstitutions = Uninitialized, ), initialScroll = 0 @@ -47,7 +47,7 @@ internal class InstitutionPickerPreviewParameterProvider : state = InstitutionPickerState( previewText = "Some query", payload = Success(payload()), - searchInstitutions = Loading(), + searchInstitutions = Loading, ), initialScroll = 0 ) @@ -102,7 +102,7 @@ internal class InstitutionPickerPreviewParameterProvider : state = InstitutionPickerState( previewText = "Some query", payload = Success(payload(manualEntry = true)), - searchInstitutions = Fail(java.lang.Exception("Something went wrong")), + searchInstitutions = Fail(Exception("Something went wrong")), ), initialScroll = 0 ) @@ -111,7 +111,7 @@ internal class InstitutionPickerPreviewParameterProvider : state = InstitutionPickerState( previewText = "Some query", payload = Success(payload(manualEntry = false)), - searchInstitutions = Fail(java.lang.Exception("Something went wrong")), + searchInstitutions = Fail(Exception("Something went wrong")), ), initialScroll = 0 ) @@ -122,7 +122,7 @@ internal class InstitutionPickerPreviewParameterProvider : payload = Success(payload()), searchInstitutions = Success(institutionResponse(FEW_INSTITUTIONS)), selectedInstitutionId = "2", - createSessionForInstitution = Loading(), + createSessionForInstitution = Loading, ), initialScroll = 0 ) diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerScreen.kt index ac6f7e816e1..90f74f83554 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerScreen.kt @@ -32,6 +32,7 @@ import androidx.compose.material.icons.filled.Clear import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -58,14 +59,13 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel import com.stripe.android.financialconnections.R +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.FullScreenGenericLoading import com.stripe.android.financialconnections.features.common.InstitutionIcon import com.stripe.android.financialconnections.features.common.LoadingShimmerEffect @@ -91,9 +91,9 @@ import kotlinx.coroutines.launch @Composable internal fun InstitutionPickerScreen() { - val viewModel: InstitutionPickerViewModel = mavericksViewModel() + val viewModel: InstitutionPickerViewModel = paneViewModel { InstitutionPickerViewModel.factory(it) } val parentViewModel = parentViewModel() - val state: InstitutionPickerState by viewModel.collectAsState() + val state: InstitutionPickerState by viewModel.stateFlow.collectAsState() val listState = rememberLazyListState() InstitutionPickerContent( @@ -135,7 +135,6 @@ private fun InstitutionPickerContent( is Uninitialized, is Loading, is Fail -> FullScreenGenericLoading() - is Success -> LoadedContent( listState = listState, previewText = previewText, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModel.kt index 36ab15ff383..ad61a1e4ae6 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModel.kt @@ -1,12 +1,9 @@ package com.stripe.android.financialconnections.features.institutionpicker -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.core.Logger import com.stripe.android.financialconnections.FinancialConnections import com.stripe.android.financialconnections.FinancialConnectionsSheet @@ -19,6 +16,11 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Metadata import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Name import com.stripe.android.financialconnections.analytics.logError +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.FeaturedInstitutions import com.stripe.android.financialconnections.domain.GetOrFetchSync import com.stripe.android.financialconnections.domain.HandleError @@ -34,7 +36,6 @@ import com.stripe.android.financialconnections.navigation.Destination.ManualEntr import com.stripe.android.financialconnections.navigation.Destination.PartnerAuth import com.stripe.android.financialconnections.navigation.Destination.PartnerAuthDrawer import com.stripe.android.financialconnections.navigation.NavigationManager -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.utils.ConflatedJob import com.stripe.android.financialconnections.utils.isCancellationError import com.stripe.android.financialconnections.utils.measureTimeMillis @@ -54,7 +55,7 @@ internal class InstitutionPickerViewModel @Inject constructor( private val updateLocalManifest: UpdateLocalManifest, private val logger: Logger, initialState: InstitutionPickerState -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { private var searchJob = ConflatedJob() @@ -163,7 +164,7 @@ internal class InstitutionPickerViewModel @Inject constructor( ) } }.execute { - copy(searchInstitutions = if (it.isCancellationError()) Loading() else it) + copy(searchInstitutions = if (it.isCancellationError()) Loading else it) } } @@ -226,7 +227,7 @@ internal class InstitutionPickerViewModel @Inject constructor( eventTracker.track( SearchScroll( pane = PANE, - institutionIds = awaitState().searchInstitutions() + institutionIds = stateFlow.value.searchInstitutions() ?.data ?.map { it.id } ?.toSet() ?: emptySet(), @@ -235,23 +236,20 @@ internal class InstitutionPickerViewModel @Inject constructor( } } - companion object : - MavericksViewModelFactory { + companion object { + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = + viewModelFactory { + initializer { + parentComponent + .institutionPickerBuilder + .initialState(InstitutionPickerState()) + .build() + .viewModel + } + } private const val SEARCH_DEBOUNCE_MS = 300L private val PANE = Pane.INSTITUTION_PICKER - override fun create( - viewModelContext: ViewModelContext, - state: InstitutionPickerState - ): InstitutionPickerViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .institutionPickerBuilder - .initialState(state) - .build() - .viewModel - } } } @@ -262,7 +260,7 @@ internal data class InstitutionPickerState( val payload: Async = Uninitialized, val searchInstitutions: Async = Uninitialized, val createSessionForInstitution: Async = Uninitialized -) : MavericksState { +) { data class Payload( val featuredInstitutions: InstitutionResponse, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModel.kt index c0890eb9d99..c5f2787e1bc 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModel.kt @@ -1,16 +1,20 @@ package com.stripe.android.financialconnections.presentation +import android.app.Application import android.content.Intent +import android.os.Bundle import android.os.Parcelable import androidx.compose.runtime.Composable +import androidx.lifecycle.SavedStateHandle +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory.Companion.APPLICATION_KEY +import androidx.lifecycle.createSavedStateHandle +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import androidx.navigation.NavDestination import androidx.navigation.compose.NavHost -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.PersistState -import com.airbnb.mvrx.ViewModelContext -import com.airbnb.mvrx.compose.mavericksActivityViewModel +import com.airbnb.mvrx.Mavericks import com.stripe.android.core.Logger import com.stripe.android.financialconnections.FinancialConnections import com.stripe.android.financialconnections.FinancialConnectionsSheet @@ -22,6 +26,8 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Metadata import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Name +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.core.parentActivity import com.stripe.android.financialconnections.di.APPLICATION_ID import com.stripe.android.financialconnections.di.DaggerFinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent @@ -45,6 +51,9 @@ import com.stripe.android.financialconnections.model.FinancialConnectionsSession import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.pane +import com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeState.Companion.KEY_FIRST_INIT +import com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeState.Companion.KEY_SAVED_STATE +import com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeState.Companion.KEY_WEB_AUTH_FLOW import com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeViewEffect.Finish import com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeViewEffect.OpenUrl import com.stripe.android.financialconnections.utils.UriUtils @@ -61,6 +70,7 @@ internal class FinancialConnectionsSheetNativeViewModel @Inject constructor( * No other dependencies should be exposed from the viewModel */ val activityRetainedComponent: FinancialConnectionsSheetNativeComponent, + savedStateHandle: SavedStateHandle, private val nativeAuthFlowCoordinator: NativeAuthFlowCoordinator, private val uriUtils: UriUtils, private val completeFinancialConnectionsSession: CompleteFinancialConnectionsSession, @@ -69,12 +79,13 @@ internal class FinancialConnectionsSheetNativeViewModel @Inject constructor( private val navigationManager: NavigationManager, @Named(APPLICATION_ID) private val applicationId: String, initialState: FinancialConnectionsSheetNativeState -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { private val mutex = Mutex() val navigationFlow = navigationManager.navigationFlow init { + savedStateHandle.registerSavedStateProvider() setState { copy(firstInit = false) } viewModelScope.launch { nativeAuthFlowCoordinator().collect { message -> @@ -95,6 +106,16 @@ internal class FinancialConnectionsSheetNativeViewModel @Inject constructor( } } + private fun SavedStateHandle.registerSavedStateProvider() { + setSavedStateProvider(KEY_SAVED_STATE) { + val state = stateFlow.value + Bundle().apply { + putParcelable(KEY_WEB_AUTH_FLOW, state.webAuthFlow) + putBoolean(KEY_FIRST_INIT, state.firstInit) + } + } + } + /** * When authorization flow finishes, it will redirect to a URL scheme stripe-auth://link-accounts * captured by [com.stripe.android.financialconnections.FinancialConnectionsSheetRedirectActivity] @@ -161,7 +182,7 @@ internal class FinancialConnectionsSheetNativeViewModel @Inject constructor( */ fun onResume() = viewModelScope.launch { mutex.withLock { - val state = awaitState() + val state = stateFlow.value if (state.webAuthFlow is WebAuthFlowState.InProgress) { setState { copy(webAuthFlow = WebAuthFlowState.Canceled(url = null)) } } @@ -227,7 +248,7 @@ internal class FinancialConnectionsSheetNativeViewModel @Inject constructor( ) = viewModelScope.launch { mutex.withLock { // prevents multiple complete triggers. - if (awaitState().completed) return@launch + if (stateFlow.value.completed) return@launch setState { copy(completed = true) } runCatching { val session = completeFinancialConnectionsSession(earlyTerminationCause?.value) @@ -321,8 +342,7 @@ internal class FinancialConnectionsSheetNativeViewModel @Inject constructor( } } - companion object : - MavericksViewModelFactory { + companion object { private fun baseUrl(applicationId: String) = "stripe://auth-redirect/$applicationId" @@ -333,30 +353,38 @@ internal class FinancialConnectionsSheetNativeViewModel @Inject constructor( private const val STATUS_SUCCESS = "success" private const val STATUS_FAILURE = "failure" - override fun create( - viewModelContext: ViewModelContext, - state: FinancialConnectionsSheetNativeState - ): FinancialConnectionsSheetNativeViewModel { - val args = viewModelContext.args() - return DaggerFinancialConnectionsSheetNativeComponent - .builder() - .initialSyncResponse(args.initialSyncResponse.takeIf { state.firstInit }) - .application(viewModelContext.app()) - .configuration(state.configuration) - .initialState(state) - .build() - .viewModel + val Factory: ViewModelProvider.Factory = viewModelFactory { + initializer { + val savedStateHandle: SavedStateHandle = createSavedStateHandle() + val app = this[APPLICATION_KEY] as Application + // Arguments passed to the activity + val args: FinancialConnectionsSheetNativeActivityArgs = + requireNotNull(savedStateHandle[Mavericks.KEY_ARG]) + // If the ViewModel is recreated, it will be provided with the saved state. + val savedState = savedStateHandle.get(KEY_SAVED_STATE) + val state = FinancialConnectionsSheetNativeState( + args = args, + savedState = savedState + ) + DaggerFinancialConnectionsSheetNativeComponent + .builder() + .initialSyncResponse(args.initialSyncResponse.takeIf { state.firstInit }) + .application(app) + .configuration(state.configuration) + .savedStateHandle(savedStateHandle) + .initialState(state) + .build() + .viewModel + } } } } internal data class FinancialConnectionsSheetNativeState( - @PersistState val webAuthFlow: WebAuthFlowState, /** * Tracks whether this state was recreated from a process kill. */ - @PersistState val firstInit: Boolean, val configuration: FinancialConnectionsSheet.Configuration, val reducedBranding: Boolean, @@ -364,22 +392,30 @@ internal data class FinancialConnectionsSheetNativeState( val viewEffect: FinancialConnectionsSheetNativeViewEffect?, val completed: Boolean, val initialPane: Pane -) : MavericksState { +) { /** - * Used by Mavericks to build initial state based on args. + * Used to build initial state based on args. */ - @Suppress("Unused") - constructor(args: FinancialConnectionsSheetNativeActivityArgs) : this( - webAuthFlow = WebAuthFlowState.Uninitialized, + constructor( + args: FinancialConnectionsSheetNativeActivityArgs, + savedState: Bundle? + ) : this( + webAuthFlow = savedState?.getParcelable(KEY_WEB_AUTH_FLOW) ?: WebAuthFlowState.Uninitialized, reducedBranding = args.initialSyncResponse.visual.reducedBranding, testMode = args.initialSyncResponse.manifest.livemode.not(), - firstInit = true, + firstInit = savedState?.getBoolean(KEY_FIRST_INIT, true) ?: true, completed = false, initialPane = args.initialSyncResponse.manifest.nextPane, configuration = args.configuration, viewEffect = null ) + + companion object { + const val KEY_SAVED_STATE = "FinancialConnectionsSheetNativeState" + const val KEY_WEB_AUTH_FLOW = "webAuthFlow" + const val KEY_FIRST_INIT = "firstInit" + } } /** @@ -430,8 +466,7 @@ internal sealed class WebAuthFlowState : Parcelable { } @Composable -internal fun parentViewModel(): FinancialConnectionsSheetNativeViewModel = - mavericksActivityViewModel() +internal fun parentViewModel(): FinancialConnectionsSheetNativeViewModel = parentActivity().viewModel internal sealed interface FinancialConnectionsSheetNativeViewEffect { /** diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/ui/FinancialConnectionsSheetNativeActivity.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/ui/FinancialConnectionsSheetNativeActivity.kt index fcb1e7e02fb..a42b67bd838 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/ui/FinancialConnectionsSheetNativeActivity.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/ui/FinancialConnectionsSheetNativeActivity.kt @@ -7,6 +7,7 @@ import android.os.Bundle import androidx.activity.addCallback import androidx.activity.compose.BackHandler import androidx.activity.compose.setContent +import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity import androidx.compose.material.ModalBottomSheetValue import androidx.compose.material.rememberModalBottomSheetState @@ -14,6 +15,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.runtime.staticCompositionLocalOf @@ -21,14 +23,14 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalLifecycleOwner import androidx.compose.ui.platform.LocalUriHandler import androidx.lifecycle.DefaultLifecycleObserver +import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleOwner +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle import androidx.navigation.NavHostController import androidx.navigation.NavOptionsBuilder import androidx.navigation.compose.NavHost import androidx.navigation.compose.rememberNavController -import com.airbnb.mvrx.MavericksView -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.withState import com.stripe.android.core.Logger import com.stripe.android.financialconnections.browser.BrowserManager import com.stripe.android.financialconnections.launcher.FinancialConnectionsSheetNativeActivityArgs @@ -49,18 +51,23 @@ import com.stripe.android.financialconnections.ui.theme.FinancialConnectionsThem import com.stripe.android.financialconnections.utils.KeyboardController import com.stripe.android.financialconnections.utils.argsOrNull import com.stripe.android.financialconnections.utils.rememberKeyboardController -import com.stripe.android.financialconnections.utils.viewModelLazy import com.stripe.android.uicore.image.StripeImageLoader import kotlinx.coroutines.flow.SharedFlow +import kotlinx.coroutines.flow.distinctUntilChanged +import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.launchIn +import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onEach +import kotlinx.coroutines.launch import javax.inject.Inject -internal class FinancialConnectionsSheetNativeActivity : AppCompatActivity(), MavericksView { +internal class FinancialConnectionsSheetNativeActivity : AppCompatActivity() { val args by argsOrNull() - val viewModel: FinancialConnectionsSheetNativeViewModel by viewModelLazy() + val viewModel: FinancialConnectionsSheetNativeViewModel by viewModels( + factoryProducer = { FinancialConnectionsSheetNativeViewModel.Factory } + ) @Inject lateinit var logger: Logger @@ -77,44 +84,43 @@ internal class FinancialConnectionsSheetNativeActivity : AppCompatActivity(), Ma finish() } else { viewModel.activityRetainedComponent.inject(this) - viewModel.onEach { postInvalidate() } onBackPressedDispatcher.addCallback { viewModel.onBackPressed() } + observeViewEffects() setContent { FinancialConnectionsTheme { - val firstPane by viewModel.collectAsState { it.initialPane } - val reducedBranding by viewModel.collectAsState { it.reducedBranding } - val testMode by viewModel.collectAsState { it.testMode } + val state by viewModel.stateFlow.collectAsState() NavHost( - initialPane = firstPane, - testMode = testMode, - reducedBranding = reducedBranding + initialPane = state.initialPane, + testMode = state.testMode, + reducedBranding = state.reducedBranding ) } } } } - /** - * handle state changes here. - */ - override fun invalidate() { - withState(viewModel) { state -> - state.viewEffect?.let { viewEffect -> - when (viewEffect) { - is OpenUrl -> startActivity( - browserManager.createBrowserIntentForUrl(uri = Uri.parse(viewEffect.url)) - ) - - is Finish -> { - setResult( - Activity.RESULT_OK, - Intent().putExtra(EXTRA_RESULT, viewEffect.result) + private fun observeViewEffects() = lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.STARTED) { + viewModel.stateFlow + .map { it.viewEffect } + .distinctUntilChanged() + .filterNotNull() + .collect { viewEffect -> + when (viewEffect) { + is OpenUrl -> startActivity( + browserManager.createBrowserIntentForUrl(uri = Uri.parse(viewEffect.url)) ) - finish() + + is Finish -> { + setResult( + Activity.RESULT_OK, + Intent().putExtra(EXTRA_RESULT, viewEffect.result) + ) + finish() + } } + viewModel.onViewEffectLaunched() } - viewModel.onViewEffectLaunched() - } } } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/utils/MavericksExtensions.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/utils/MavericksExtensions.kt index b70d767e08c..ed0c55c723c 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/utils/MavericksExtensions.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/utils/MavericksExtensions.kt @@ -2,7 +2,6 @@ package com.stripe.android.financialconnections.utils import androidx.activity.ComponentActivity import com.airbnb.mvrx.ActivityViewModelContext -import com.airbnb.mvrx.Async import com.airbnb.mvrx.Fail import com.airbnb.mvrx.InternalMavericksApi import com.airbnb.mvrx.Loading @@ -12,10 +11,12 @@ import com.airbnb.mvrx.MavericksViewModel import com.airbnb.mvrx.MavericksViewModelFactory import com.airbnb.mvrx.MavericksViewModelProvider import com.stripe.android.core.exception.StripeException +import com.stripe.android.financialconnections.core.Async import kotlinx.coroutines.CancellationException import kotlin.properties.ReadOnlyProperty import kotlin.reflect.KClass import kotlin.reflect.KProperty +import com.airbnb.mvrx.Async as MvrxAsync /** * Replicates [com.airbnb.mvrx.viewModel] delegate, but without using [com.airbnb.mvrx.lifecycleAwareLazy] @@ -63,9 +64,16 @@ internal fun argsOrNull() = object : ReadOnlyProperty * Prevents [CancellationException] to map to [Fail] when coroutine being cancelled * due to search query changes. In these cases, re-map the [Async] instance to [Loading] */ -internal fun Async<*>.isCancellationError(): Boolean = when { +internal fun MvrxAsync<*>.isCancellationError(): Boolean = when { this !is Fail -> false error is CancellationException -> true error is StripeException && error.cause is CancellationException -> true else -> false } + +internal fun Async<*>.isCancellationError(): Boolean = when { + this !is Async.Fail -> false + error is CancellationException -> true + error is StripeException && error.cause is CancellationException -> true + else -> false +} diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/CoroutineTestRule.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/CoroutineTestRule.kt new file mode 100644 index 00000000000..fdf557caa3f --- /dev/null +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/CoroutineTestRule.kt @@ -0,0 +1,25 @@ +package com.stripe.android.financialconnections + +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.test.TestDispatcher +import kotlinx.coroutines.test.resetMain +import kotlinx.coroutines.test.setMain +import org.junit.rules.TestWatcher +import org.junit.runner.Description + +@ExperimentalCoroutinesApi +class CoroutineTestRule( + private val testDispatcher: TestDispatcher, +) : TestWatcher() { + + override fun starting(description: Description) { + super.starting(description) + Dispatchers.setMain(testDispatcher) + } + + override fun finished(description: Description) { + Dispatchers.resetMain() + super.finished(description) + } +} diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModelTest.kt index 9206bbc1a30..811e24970dc 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModelTest.kt @@ -2,9 +2,8 @@ package com.stripe.android.financialconnections import android.content.Intent import android.net.Uri +import androidx.lifecycle.SavedStateHandle import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.airbnb.mvrx.test.MavericksTestRule -import com.airbnb.mvrx.withState import com.google.common.truth.Truth.assertThat import com.stripe.android.core.Logger import com.stripe.android.core.exception.APIException @@ -34,6 +33,7 @@ import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.Rule import org.junit.Test +import org.junit.rules.TestRule import org.junit.runner.RunWith import org.mockito.kotlin.any import org.mockito.kotlin.eq @@ -47,7 +47,7 @@ import org.mockito.kotlin.whenever class FinancialConnectionsSheetViewModelTest { @get:Rule - val mavericksRule = MavericksTestRule(testDispatcher = UnconfinedTestDispatcher()) + val rule: TestRule = CoroutineTestRule(UnconfinedTestDispatcher()) private val eventReporter = mock() private val configuration = FinancialConnectionsSheet.Configuration( @@ -65,7 +65,8 @@ class FinancialConnectionsSheetViewModelTest { private val synchronizeFinancialConnectionsSession = mock() private val defaultInitialState = FinancialConnectionsSheetState( - FinancialConnectionsSheetActivityArgs.ForData(configuration) + args = FinancialConnectionsSheetActivityArgs.ForData(configuration), + savedState = null ) @Test @@ -105,7 +106,7 @@ class FinancialConnectionsSheetViewModelTest { val viewModel = createViewModel(defaultInitialState) // Then - withState(viewModel) { + viewModel.stateFlow.value.let { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.NONE) require(it.viewEffect is FinishWithResult) require(it.viewEffect.result is Failed) @@ -160,7 +161,7 @@ class FinancialConnectionsSheetViewModelTest { ) // Then - withState(viewModel) { + viewModel.stateFlow.value.let { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.NONE) val viewEffect = it.viewEffect as FinishWithResult assertThat(viewEffect.result).isEqualTo( @@ -188,7 +189,7 @@ class FinancialConnectionsSheetViewModelTest { ) // Then - withState(viewModel) { + viewModel.stateFlow.value.let { val viewEffect = it.viewEffect as FinishWithResult assertThat(viewEffect.result).isInstanceOf(Failed::class.java) } @@ -232,8 +233,7 @@ class FinancialConnectionsSheetViewModelTest { // end auth flow viewModel.handleOnNewIntent(cancelIntent()) - // Then - withState(viewModel) { + viewModel.stateFlow.value.let { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.NONE) assertThat(it.viewEffect).isEqualTo(FinishWithResult(Canceled)) } @@ -260,7 +260,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.handleOnNewIntent(cancelIntent()) // Then - withState(viewModel) { + viewModel.stateFlow.value.let { require(it.viewEffect is FinishWithResult) require(it.viewEffect.result is Failed) assertThat(it.viewEffect.result.error).isInstanceOf(CustomManualEntryRequiredError::class.java) @@ -281,7 +281,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.handleOnNewIntent(errorIntent) // Then - withState(viewModel) { + viewModel.stateFlow.value.let { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.NONE) val viewEffect = it.viewEffect as FinishWithResult assertThat(viewEffect.result).isInstanceOf(Failed::class.java) @@ -304,7 +304,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.handleOnNewIntent(successIntent()) // Then - withState(viewModel) { + viewModel.stateFlow.value.let { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.NONE) val viewEffect = it.viewEffect as FinishWithResult assertThat(viewEffect.result).isEqualTo( @@ -331,7 +331,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.handleOnNewIntent(Intent().apply { data = Uri.parse(nativeRedirectUrl) }) // Then - withState(viewModel) { + viewModel.stateFlow.value.let { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.INTERMEDIATE_DEEPLINK) val viewEffect = it.viewEffect as OpenAuthFlowWithUrl assertThat(viewEffect.url).isEqualTo(aggregatorUrl) @@ -357,7 +357,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.handleOnNewIntent(Intent().apply { data = Uri.parse(returnUrl) }) // Then - withState(viewModel) { + viewModel.stateFlow.value.let { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.INTERMEDIATE_DEEPLINK) val viewEffect = it.viewEffect as OpenAuthFlowWithUrl assertThat(viewEffect.url).isEqualTo( @@ -381,7 +381,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.handleOnNewIntent(successIntent()) // Then - withState(viewModel) { + viewModel.stateFlow.value.let { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.NONE) val viewEffect = it.viewEffect as FinishWithResult assertThat(viewEffect.result).isEqualTo(Failed(apiException)) @@ -402,7 +402,7 @@ class FinancialConnectionsSheetViewModelTest { // Then // Then - withState(viewModel) { + viewModel.stateFlow.value.let { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.NONE) val viewEffect = it.viewEffect as FinishWithResult assertThat(viewEffect.result).isEqualTo(Failed(APIException())) @@ -429,7 +429,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.onResume() // Then - withState(viewModel) { + viewModel.stateFlow.value.let { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.ON_EXTERNAL_ACTIVITY) val viewEffect = it.viewEffect as FinishWithResult assertThat(viewEffect.result).isEqualTo(Canceled) @@ -456,7 +456,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.onBrowserActivityResult() // Then - withState(viewModel) { + viewModel.stateFlow.value.let { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.ON_EXTERNAL_ACTIVITY) val viewEffect = it.viewEffect as FinishWithResult assertThat(viewEffect.result).isEqualTo(Canceled) @@ -476,7 +476,7 @@ class FinancialConnectionsSheetViewModelTest { val viewModel = createViewModel(defaultInitialState) // Then - withState(viewModel) { assertThat(it.manifest).isEqualTo(syncResponse.manifest) } + assertThat(viewModel.stateFlow.value.manifest).isEqualTo(syncResponse.manifest) } } @@ -517,6 +517,7 @@ class FinancialConnectionsSheetViewModelTest { nativeRouter = mock(), analyticsTracker = analyticsTracker, browserManager = browserManager, + savedStateHandle = SavedStateHandle(), logger = Logger.noop() ) } diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModelTest.kt index 475f85539ee..057f6709f84 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModelTest.kt @@ -1,12 +1,11 @@ package com.stripe.android.financialconnections.features.institutionpicker -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.test.MavericksTestRule -import com.airbnb.mvrx.withState import com.stripe.android.core.Logger import com.stripe.android.financialconnections.ApiKeyFixtures +import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.FinancialConnectionsSheet import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker +import com.stripe.android.financialconnections.core.Async import com.stripe.android.financialconnections.domain.FeaturedInstitutions import com.stripe.android.financialconnections.domain.GetOrFetchSync import com.stripe.android.financialconnections.domain.PostAuthorizationSession @@ -22,10 +21,12 @@ import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.utils.TestHandleError import com.stripe.android.financialconnections.utils.TestNavigationManager import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runTest import org.junit.Rule import org.junit.Test +import org.junit.rules.TestRule import org.mockito.kotlin.any import org.mockito.kotlin.mock import org.mockito.kotlin.verifyNoInteractions @@ -38,7 +39,7 @@ import kotlin.test.assertTrue internal class InstitutionPickerViewModelTest { @get:Rule - val mavericksTestRule = MavericksTestRule() + val rule: TestRule = CoroutineTestRule(UnconfinedTestDispatcher()) private val searchInstitutions = mock() private val featuredInstitutions = mock() @@ -92,9 +93,9 @@ internal class InstitutionPickerViewModelTest { val viewModel = buildViewModel(InstitutionPickerState()) - withState(viewModel) { state -> + viewModel.stateFlow.value.let { state -> assertEquals(state.payload()!!.featuredInstitutions, institutionResponse) - assertIs(state.searchInstitutions) + assertIs(state.searchInstitutions) } } @@ -108,10 +109,8 @@ internal class InstitutionPickerViewModelTest { val viewModel = buildViewModel(InstitutionPickerState()) - withState(viewModel) { state -> - // payload with empty list - assertTrue(state.payload()!!.featuredInstitutions.data.isEmpty()) - } + // payload with empty list + assertTrue(viewModel.stateFlow.value.payload()!!.featuredInstitutions.data.isEmpty()) } @Test @@ -121,7 +120,7 @@ internal class InstitutionPickerViewModelTest { val viewModel = buildViewModel(InstitutionPickerState()) - withState(viewModel) { state -> + viewModel.stateFlow.value.let { state -> assertTrue(state.payload() == null) handleError.assertError( error = error, @@ -170,7 +169,7 @@ internal class InstitutionPickerViewModelTest { viewModel.onQueryChanged(query) advanceUntilIdle() - withState(viewModel) { state -> + viewModel.stateFlow.value.let { state -> assertEquals(state.payload()!!.featuredInstitutions, featuredResults) assertEquals(state.searchInstitutions()!!, searchResults) eventTracker.assertContainsEvent( @@ -193,7 +192,7 @@ internal class InstitutionPickerViewModelTest { viewModel.onQueryChanged(query) advanceUntilIdle() - withState(viewModel) { state -> + viewModel.stateFlow.value.let { state -> verifyNoInteractions(searchInstitutions) assertTrue(eventTracker.sentEvents.none { it.eventName == "linked_accounts.search.succeeded" }) assertEquals(state.searchInstitutions()!!.data, emptyList()) diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeStateTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeStateTest.kt index 166f1c60cb2..af092b6a84a 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeStateTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeStateTest.kt @@ -24,7 +24,8 @@ internal class FinancialConnectionsSheetNativeStateTest { reducedManualEntryProminenceInErrors = false, merchantLogos = emptyList() ) - ) + ), + savedState = null ).reducedBranding, ).isTrue() } @@ -39,7 +40,8 @@ internal class FinancialConnectionsSheetNativeStateTest { reducedManualEntryProminenceInErrors = false, merchantLogos = emptyList() ) - ) + ), + savedState = null ).reducedBranding, ).isFalse() } diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModelTest.kt index cb64b9551f3..209703dfe22 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModelTest.kt @@ -2,13 +2,13 @@ package com.stripe.android.financialconnections.presentation import android.content.Intent import android.net.Uri +import androidx.lifecycle.SavedStateHandle import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.airbnb.mvrx.test.MavericksTestRule -import com.airbnb.mvrx.withState import com.google.common.truth.Truth.assertThat import com.stripe.android.core.Logger import com.stripe.android.financialconnections.ApiKeyFixtures import com.stripe.android.financialconnections.ApiKeyFixtures.financialConnectionsSessionNoAccounts +import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.FinancialConnections import com.stripe.android.financialconnections.FinancialConnectionsSheet import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent @@ -38,6 +38,7 @@ import org.junit.After import org.junit.Before import org.junit.Rule import org.junit.Test +import org.junit.rules.TestRule import org.junit.runner.RunWith import org.mockito.kotlin.any import org.mockito.kotlin.anyOrNull @@ -50,7 +51,7 @@ import kotlin.test.assertIs internal class FinancialConnectionsSheetNativeViewModelTest { @get:Rule - val mavericksTestRule = MavericksTestRule(testDispatcher = UnconfinedTestDispatcher()) + val rule: TestRule = CoroutineTestRule(UnconfinedTestDispatcher()) private val nativeAuthFlowCoordinator = mock() private val completeFinancialConnectionsSession = mock() @@ -87,7 +88,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { messagesFlow.emit(Complete(EarlyTerminationCause.USER_INITIATED_WITH_CUSTOM_MANUAL_ENTRY)) - withState(viewModel) { + viewModel.stateFlow.value.let { require(it.viewEffect is Finish) require(it.viewEffect.result is Failed) assertThat(it.viewEffect.result.error).isInstanceOf(CustomManualEntryRequiredError::class.java) @@ -107,7 +108,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { messagesFlow.emit(Complete(null)) - withState(viewModel) { + viewModel.stateFlow.value.let { require(it.viewEffect is Finish) require(it.viewEffect.result is Completed) } @@ -133,7 +134,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { messagesFlow.emit(Complete(null)) - withState(viewModel) { + viewModel.stateFlow.value.let { require(it.viewEffect is Finish) require(it.viewEffect.result is Canceled) } @@ -165,7 +166,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { messagesFlow.emit(Complete(null)) - withState(viewModel) { + viewModel.stateFlow.value.let { require(it.viewEffect is Finish) require(it.viewEffect.result is Failed) } @@ -186,7 +187,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { val intent = intent("stripe://auth-redirect/$applicationId?status=success") viewModel.handleOnNewIntent(intent) - withState(viewModel) { + viewModel.stateFlow.value.let { assertThat(it.webAuthFlow).isEqualTo(WebAuthFlowState.Success(intent.data!!.toString())) } } @@ -201,7 +202,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { ) viewModel.handleOnNewIntent(intent) - withState(viewModel) { + viewModel.stateFlow.value.let { val webAuthFlow = it.webAuthFlow assertIs(webAuthFlow) assertThat(webAuthFlow.reason).isEqualTo(errorReason) @@ -217,7 +218,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { ) viewModel.handleOnNewIntent(intent) - withState(viewModel) { + viewModel.stateFlow.value.let { val webAuthFlow = it.webAuthFlow assertIs(webAuthFlow) } @@ -232,7 +233,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { ) viewModel.handleOnNewIntent(intent) - withState(viewModel) { + viewModel.stateFlow.value.let { val webAuthFlow = it.webAuthFlow assertIs(webAuthFlow) } @@ -245,7 +246,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { val intent = intent("stripe://auth-redirect/$applicationId?status=unknown") viewModel.handleOnNewIntent(intent) - withState(viewModel) { + viewModel.stateFlow.value.let { val webAuthFlow = it.webAuthFlow assertIs(webAuthFlow) } @@ -258,7 +259,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { val intent = intent("stripe://auth-redirect/$applicationId?status=cancel") viewModel.handleOnNewIntent(intent) - withState(viewModel) { + viewModel.stateFlow.value.let { val webAuthFlow = it.webAuthFlow assertIs(webAuthFlow) } @@ -271,7 +272,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { val intent = intent("stripe://auth-redirect/other-app-id?code=success") viewModel.handleOnNewIntent(intent) - withState(viewModel) { + viewModel.stateFlow.value.let { val webAuthFlow = it.webAuthFlow assertIs(webAuthFlow) } @@ -286,10 +287,11 @@ internal class FinancialConnectionsSheetNativeViewModelTest { private fun createViewModel( initialState: FinancialConnectionsSheetNativeState = FinancialConnectionsSheetNativeState( - FinancialConnectionsSheetNativeActivityArgs( + args = FinancialConnectionsSheetNativeActivityArgs( configuration = configuration, initialSyncResponse = ApiKeyFixtures.syncResponse(), - ) + ), + savedState = null ) ) = FinancialConnectionsSheetNativeViewModel( eventTracker = mock(), @@ -300,6 +302,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { nativeAuthFlowCoordinator = nativeAuthFlowCoordinator, logger = mock(), navigationManager = TestNavigationManager(), + savedStateHandle = SavedStateHandle(), initialState = initialState ) } diff --git a/identity/dependencies/dependencies.txt b/identity/dependencies/dependencies.txt index 188f606d752..e11c19e1994 100644 --- a/identity/dependencies/dependencies.txt +++ b/identity/dependencies/dependencies.txt @@ -392,6 +392,34 @@ +--- project :stripe-ui-core | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) | +--- project :stripe-core (*) +| +--- androidx.activity:activity-ktx:1.8.2 +| | +--- androidx.activity:activity:1.8.2 (*) +| | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) +| | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 +| | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) +| | +--- androidx.savedstate:savedstate-ktx:1.2.1 +| | | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | \--- androidx.savedstate:savedstate:1.2.1 (c) +| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | +--- androidx.activity:activity:1.8.2 (c) +| | \--- androidx.activity:activity-compose:1.8.2 (c) | +--- androidx.annotation:annotation:1.7.1 (*) | +--- androidx.core:core-ktx:1.12.0 (*) | +--- androidx.compose.foundation:foundation:1.5.4 @@ -414,34 +442,7 @@ | | | | | \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c) | | | | +--- androidx.compose.ui:ui:1.5.4 | | | | | \--- androidx.compose.ui:ui-android:1.5.4 -| | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 -| | | | | | +--- androidx.activity:activity:1.8.2 (*) -| | | | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) -| | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 -| | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) -| | | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 -| | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) -| | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | +--- androidx.activity:activity:1.8.2 (c) -| | | | | | \--- androidx.activity:activity-compose:1.8.2 (c) +| | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 (*) | | | | | +--- androidx.annotation:annotation:1.5.0 -> 1.7.1 (*) | | | | | +--- androidx.autofill:autofill:1.0.0 | | | | | | \--- androidx.core:core:1.1.0 -> 1.12.0 (*) diff --git a/link/dependencies/dependencies.txt b/link/dependencies/dependencies.txt index 2c36466f4f0..21622d211d3 100644 --- a/link/dependencies/dependencies.txt +++ b/link/dependencies/dependencies.txt @@ -334,6 +334,34 @@ | +--- project :stripe-ui-core | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) | | +--- project :stripe-core (*) +| | +--- androidx.activity:activity-ktx:1.8.2 +| | | +--- androidx.activity:activity:1.8.2 (*) +| | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) +| | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 +| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) +| | | +--- androidx.savedstate:savedstate-ktx:1.2.1 +| | | | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | | \--- androidx.savedstate:savedstate:1.2.1 (c) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | +--- androidx.activity:activity:1.8.2 (c) +| | | \--- androidx.activity:activity-compose:1.8.2 (c) | | +--- androidx.annotation:annotation:1.7.1 (*) | | +--- androidx.core:core-ktx:1.12.0 (*) | | +--- androidx.compose.foundation:foundation:1.5.4 @@ -356,34 +384,7 @@ | | | | | | \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c) | | | | | +--- androidx.compose.ui:ui:1.5.4 | | | | | | \--- androidx.compose.ui:ui-android:1.5.4 -| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 -| | | | | | | +--- androidx.activity:activity:1.8.2 (*) -| | | | | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 -| | | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) -| | | | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 -| | | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | +--- androidx.activity:activity:1.8.2 (c) -| | | | | | | \--- androidx.activity:activity-compose:1.8.2 (c) +| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 (*) | | | | | | +--- androidx.annotation:annotation:1.5.0 -> 1.7.1 (*) | | | | | | +--- androidx.autofill:autofill:1.0.0 | | | | | | | \--- androidx.core:core:1.1.0 -> 1.12.0 (*) diff --git a/network-testing/dependencies/dependencies.txt b/network-testing/dependencies/dependencies.txt index 07f55395351..16fa69fc2c1 100644 --- a/network-testing/dependencies/dependencies.txt +++ b/network-testing/dependencies/dependencies.txt @@ -325,6 +325,32 @@ | +--- project :stripe-ui-core | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) | | +--- project :stripe-core (*) +| | +--- androidx.activity:activity-ktx:1.8.2 +| | | +--- androidx.activity:activity:1.8.2 (*) +| | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) +| | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 +| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) +| | | +--- androidx.savedstate:savedstate-ktx:1.2.1 +| | | | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | | \--- androidx.savedstate:savedstate:1.2.1 (c) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | +--- androidx.activity:activity:1.8.2 (c) +| | | \--- androidx.activity:activity-compose:1.8.2 (c) | | +--- androidx.annotation:annotation:1.7.1 (*) | | +--- androidx.core:core-ktx:1.12.0 (*) | | +--- androidx.compose.foundation:foundation:1.5.4 @@ -346,32 +372,7 @@ | | | | | | \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c) | | | | | +--- androidx.compose.ui:ui:1.5.4 | | | | | | \--- androidx.compose.ui:ui-android:1.5.4 -| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 -| | | | | | | +--- androidx.activity:activity:1.8.2 (*) -| | | | | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 -| | | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) -| | | | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 -| | | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | +--- androidx.activity:activity:1.8.2 (c) -| | | | | | | \--- androidx.activity:activity-compose:1.8.2 (c) +| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 (*) | | | | | | +--- androidx.annotation:annotation:1.5.0 -> 1.7.1 (*) | | | | | | +--- androidx.autofill:autofill:1.0.0 | | | | | | | \--- androidx.core:core:1.1.0 -> 1.12.0 (*) diff --git a/payment-method-messaging/dependencies/dependencies.txt b/payment-method-messaging/dependencies/dependencies.txt index d53e39db39d..f132887ec20 100644 --- a/payment-method-messaging/dependencies/dependencies.txt +++ b/payment-method-messaging/dependencies/dependencies.txt @@ -335,6 +335,34 @@ | +--- project :stripe-ui-core | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) | | +--- project :stripe-core (*) +| | +--- androidx.activity:activity-ktx:1.8.2 +| | | +--- androidx.activity:activity:1.8.2 (*) +| | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) +| | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 +| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) +| | | +--- androidx.savedstate:savedstate-ktx:1.2.1 +| | | | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | | \--- androidx.savedstate:savedstate:1.2.1 (c) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | +--- androidx.activity:activity:1.8.2 (c) +| | | \--- androidx.activity:activity-compose:1.8.2 (c) | | +--- androidx.annotation:annotation:1.7.1 (*) | | +--- androidx.core:core-ktx:1.12.0 (*) | | +--- androidx.compose.foundation:foundation:1.5.4 @@ -356,34 +384,7 @@ | | | | | | \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c) | | | | | +--- androidx.compose.ui:ui:1.5.4 | | | | | | \--- androidx.compose.ui:ui-android:1.5.4 -| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 -| | | | | | | +--- androidx.activity:activity:1.8.2 (*) -| | | | | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 -| | | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) -| | | | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 -| | | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | +--- androidx.activity:activity:1.8.2 (c) -| | | | | | | \--- androidx.activity:activity-compose:1.8.2 (c) +| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 (*) | | | | | | +--- androidx.annotation:annotation:1.5.0 -> 1.7.1 (*) | | | | | | +--- androidx.autofill:autofill:1.0.0 | | | | | | | \--- androidx.core:core:1.1.0 -> 1.12.0 (*) diff --git a/payments-core-testing/dependencies/dependencies.txt b/payments-core-testing/dependencies/dependencies.txt index 793f278ae50..bd97f4aee9a 100644 --- a/payments-core-testing/dependencies/dependencies.txt +++ b/payments-core-testing/dependencies/dependencies.txt @@ -317,6 +317,32 @@ | +--- project :stripe-ui-core | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) | | +--- project :stripe-core (*) +| | +--- androidx.activity:activity-ktx:1.8.2 +| | | +--- androidx.activity:activity:1.8.2 (*) +| | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) +| | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 +| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) +| | | +--- androidx.savedstate:savedstate-ktx:1.2.1 +| | | | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | | \--- androidx.savedstate:savedstate:1.2.1 (c) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | +--- androidx.activity:activity:1.8.2 (c) +| | | \--- androidx.activity:activity-compose:1.8.2 (c) | | +--- androidx.annotation:annotation:1.7.1 (*) | | +--- androidx.core:core-ktx:1.12.0 (*) | | +--- androidx.compose.foundation:foundation:1.5.4 @@ -338,32 +364,7 @@ | | | | | | \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c) | | | | | +--- androidx.compose.ui:ui:1.5.4 | | | | | | \--- androidx.compose.ui:ui-android:1.5.4 -| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 -| | | | | | | +--- androidx.activity:activity:1.8.2 (*) -| | | | | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 -| | | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) -| | | | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 -| | | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | +--- androidx.activity:activity:1.8.2 (c) -| | | | | | | \--- androidx.activity:activity-compose:1.8.2 (c) +| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 (*) | | | | | | +--- androidx.annotation:annotation:1.5.0 -> 1.7.1 (*) | | | | | | +--- androidx.autofill:autofill:1.0.0 | | | | | | | \--- androidx.core:core:1.1.0 -> 1.12.0 (*) diff --git a/payments-core/dependencies/dependencies.txt b/payments-core/dependencies/dependencies.txt index adcd1cecd8a..9f3056c50cc 100644 --- a/payments-core/dependencies/dependencies.txt +++ b/payments-core/dependencies/dependencies.txt @@ -313,6 +313,32 @@ +--- project :stripe-ui-core | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) | +--- project :stripe-core (*) +| +--- androidx.activity:activity-ktx:1.8.2 +| | +--- androidx.activity:activity:1.8.2 (*) +| | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) +| | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 +| | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) +| | +--- androidx.savedstate:savedstate-ktx:1.2.1 +| | | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | \--- androidx.savedstate:savedstate:1.2.1 (c) +| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | +--- androidx.activity:activity:1.8.2 (c) +| | \--- androidx.activity:activity-compose:1.8.2 (c) | +--- androidx.annotation:annotation:1.7.1 (*) | +--- androidx.core:core-ktx:1.12.0 (*) | +--- androidx.compose.foundation:foundation:1.5.4 @@ -334,32 +360,7 @@ | | | | | \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c) | | | | +--- androidx.compose.ui:ui:1.5.4 | | | | | \--- androidx.compose.ui:ui-android:1.5.4 -| | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 -| | | | | | +--- androidx.activity:activity:1.8.2 (*) -| | | | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) -| | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 -| | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) -| | | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 -| | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) -| | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | +--- androidx.activity:activity:1.8.2 (c) -| | | | | | \--- androidx.activity:activity-compose:1.8.2 (c) +| | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 (*) | | | | | +--- androidx.annotation:annotation:1.5.0 -> 1.7.1 (*) | | | | | +--- androidx.autofill:autofill:1.0.0 | | | | | | \--- androidx.core:core:1.1.0 -> 1.12.0 (*) diff --git a/payments-ui-core/dependencies/dependencies.txt b/payments-ui-core/dependencies/dependencies.txt index cbfd74e9d39..47037bdf288 100644 --- a/payments-ui-core/dependencies/dependencies.txt +++ b/payments-ui-core/dependencies/dependencies.txt @@ -318,6 +318,32 @@ | +--- project :stripe-ui-core | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) | | +--- project :stripe-core (*) +| | +--- androidx.activity:activity-ktx:1.8.2 +| | | +--- androidx.activity:activity:1.8.2 (*) +| | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) +| | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 +| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) +| | | +--- androidx.savedstate:savedstate-ktx:1.2.1 +| | | | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | | \--- androidx.savedstate:savedstate:1.2.1 (c) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | +--- androidx.activity:activity:1.8.2 (c) +| | | \--- androidx.activity:activity-compose:1.8.2 (c) | | +--- androidx.annotation:annotation:1.7.1 (*) | | +--- androidx.core:core-ktx:1.12.0 (*) | | +--- androidx.compose.foundation:foundation:1.5.4 @@ -339,32 +365,7 @@ | | | | | | \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c) | | | | | +--- androidx.compose.ui:ui:1.5.4 | | | | | | \--- androidx.compose.ui:ui-android:1.5.4 -| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 -| | | | | | | +--- androidx.activity:activity:1.8.2 (*) -| | | | | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 -| | | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) -| | | | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 -| | | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | +--- androidx.activity:activity:1.8.2 (c) -| | | | | | | \--- androidx.activity:activity-compose:1.8.2 (c) +| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 (*) | | | | | | +--- androidx.annotation:annotation:1.5.0 -> 1.7.1 (*) | | | | | | +--- androidx.autofill:autofill:1.0.0 | | | | | | | \--- androidx.core:core:1.1.0 -> 1.12.0 (*) diff --git a/payments/dependencies/dependencies.txt b/payments/dependencies/dependencies.txt index 020fbccb9fa..fac48acd931 100644 --- a/payments/dependencies/dependencies.txt +++ b/payments/dependencies/dependencies.txt @@ -333,6 +333,34 @@ | +--- project :stripe-ui-core | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) | | +--- project :stripe-core (*) +| | +--- androidx.activity:activity-ktx:1.8.2 +| | | +--- androidx.activity:activity:1.8.2 (*) +| | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) +| | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 +| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) +| | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) +| | | +--- androidx.savedstate:savedstate-ktx:1.2.1 +| | | | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | | \--- androidx.savedstate:savedstate:1.2.1 (c) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | +--- androidx.activity:activity:1.8.2 (c) +| | | \--- androidx.activity:activity-compose:1.8.2 (c) | | +--- androidx.annotation:annotation:1.7.1 (*) | | +--- androidx.core:core-ktx:1.12.0 (*) | | +--- androidx.compose.foundation:foundation:1.5.4 @@ -355,34 +383,7 @@ | | | | | | \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c) | | | | | +--- androidx.compose.ui:ui:1.5.4 | | | | | | \--- androidx.compose.ui:ui-android:1.5.4 -| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 -| | | | | | | +--- androidx.activity:activity:1.8.2 (*) -| | | | | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 -| | | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) -| | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) -| | | | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 -| | | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | +--- androidx.activity:activity:1.8.2 (c) -| | | | | | | \--- androidx.activity:activity-compose:1.8.2 (c) +| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 (*) | | | | | | +--- androidx.annotation:annotation:1.5.0 -> 1.7.1 (*) | | | | | | +--- androidx.autofill:autofill:1.0.0 | | | | | | | \--- androidx.core:core:1.1.0 -> 1.12.0 (*) diff --git a/paymentsheet-example/dependencies/dependencies.txt b/paymentsheet-example/dependencies/dependencies.txt index 420660e0c34..32f683a3591 100644 --- a/paymentsheet-example/dependencies/dependencies.txt +++ b/paymentsheet-example/dependencies/dependencies.txt @@ -336,6 +336,34 @@ | | +--- project :stripe-ui-core | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) | | | +--- project :stripe-core (*) +| | | +--- androidx.activity:activity-ktx:1.8.2 +| | | | +--- androidx.activity:activity:1.8.2 (*) +| | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) +| | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 +| | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) +| | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) +| | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 +| | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | +--- androidx.activity:activity:1.8.2 (c) +| | | | \--- androidx.activity:activity-compose:1.8.2 (c) | | | +--- androidx.annotation:annotation:1.7.1 (*) | | | +--- androidx.core:core-ktx:1.12.0 (*) | | | +--- androidx.compose.foundation:foundation:1.5.4 @@ -358,34 +386,7 @@ | | | | | | | \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c) | | | | | | +--- androidx.compose.ui:ui:1.5.4 | | | | | | | \--- androidx.compose.ui:ui-android:1.5.4 -| | | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 -| | | | | | | | +--- androidx.activity:activity:1.8.2 (*) -| | | | | | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 -| | | | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) -| | | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) -| | | | | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 -| | | | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | +--- androidx.activity:activity:1.8.2 (c) -| | | | | | | | \--- androidx.activity:activity-compose:1.8.2 (c) +| | | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 (*) | | | | | | | +--- androidx.annotation:annotation:1.5.0 -> 1.7.1 (*) | | | | | | | +--- androidx.autofill:autofill:1.0.0 | | | | | | | | \--- androidx.core:core:1.1.0 -> 1.12.0 (*) diff --git a/paymentsheet/dependencies/dependencies.txt b/paymentsheet/dependencies/dependencies.txt index d37b2c5ac70..00b5f215929 100644 --- a/paymentsheet/dependencies/dependencies.txt +++ b/paymentsheet/dependencies/dependencies.txt @@ -333,6 +333,34 @@ | +--- project :stripe-ui-core | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) | | +--- project :stripe-core (*) +| | +--- androidx.activity:activity-ktx:1.8.2 +| | | +--- androidx.activity:activity:1.8.2 (*) +| | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) +| | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 +| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) +| | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) +| | | +--- androidx.savedstate:savedstate-ktx:1.2.1 +| | | | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | | \--- androidx.savedstate:savedstate:1.2.1 (c) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | +--- androidx.activity:activity:1.8.2 (c) +| | | \--- androidx.activity:activity-compose:1.8.2 (c) | | +--- androidx.annotation:annotation:1.7.1 (*) | | +--- androidx.core:core-ktx:1.12.0 (*) | | +--- androidx.compose.foundation:foundation:1.5.4 @@ -355,34 +383,7 @@ | | | | | | \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c) | | | | | +--- androidx.compose.ui:ui:1.5.4 | | | | | | \--- androidx.compose.ui:ui-android:1.5.4 -| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 -| | | | | | | +--- androidx.activity:activity:1.8.2 (*) -| | | | | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 -| | | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) -| | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) -| | | | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 -| | | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | +--- androidx.activity:activity:1.8.2 (c) -| | | | | | | \--- androidx.activity:activity-compose:1.8.2 (c) +| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 (*) | | | | | | +--- androidx.annotation:annotation:1.5.0 -> 1.7.1 (*) | | | | | | +--- androidx.autofill:autofill:1.0.0 | | | | | | | \--- androidx.core:core:1.1.0 -> 1.12.0 (*) diff --git a/stripe-test-e2e/dependencies/dependencies.txt b/stripe-test-e2e/dependencies/dependencies.txt index e8b7c01325b..f88fd5447de 100644 --- a/stripe-test-e2e/dependencies/dependencies.txt +++ b/stripe-test-e2e/dependencies/dependencies.txt @@ -335,6 +335,34 @@ | +--- project :stripe-ui-core | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) | | +--- project :stripe-core (*) + | | +--- androidx.activity:activity-ktx:1.8.2 + | | | +--- androidx.activity:activity:1.8.2 (*) + | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) + | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 + | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) + | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) + | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) + | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) + | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) + | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) + | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) + | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) + | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) + | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) + | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) + | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) + | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) + | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) + | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) + | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) + | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) + | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 + | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) + | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) + | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) + | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) + | | | +--- androidx.activity:activity:1.8.2 (c) + | | | \--- androidx.activity:activity-compose:1.8.2 (c) | | +--- androidx.annotation:annotation:1.7.1 (*) | | +--- androidx.core:core-ktx:1.12.0 (*) | | +--- androidx.compose.foundation:foundation:1.5.4 @@ -357,34 +385,7 @@ | | | | | | \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c) | | | | | +--- androidx.compose.ui:ui:1.5.4 | | | | | | \--- androidx.compose.ui:ui-android:1.5.4 - | | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 - | | | | | | | +--- androidx.activity:activity:1.8.2 (*) - | | | | | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) - | | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 - | | | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) - | | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) - | | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) - | | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) - | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) - | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) - | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) - | | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) - | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) - | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) - | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) - | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) - | | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) - | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) - | | | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) - | | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) - | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) - | | | | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 - | | | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) - | | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) - | | | | | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) - | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) - | | | | | | | +--- androidx.activity:activity:1.8.2 (c) - | | | | | | | \--- androidx.activity:activity-compose:1.8.2 (c) + | | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 (*) | | | | | | +--- androidx.annotation:annotation:1.5.0 -> 1.7.1 (*) | | | | | | +--- androidx.autofill:autofill:1.0.0 | | | | | | | \--- androidx.core:core:1.1.0 -> 1.12.0 (*) diff --git a/stripe-ui-core/build.gradle b/stripe-ui-core/build.gradle index 5e863d7f012..149f137c8d9 100644 --- a/stripe-ui-core/build.gradle +++ b/stripe-ui-core/build.gradle @@ -34,6 +34,7 @@ android { dependencies { implementation project(":stripe-core") + implementation libs.androidx.activity implementation libs.androidx.annotation implementation libs.androidx.coreKtx implementation libs.compose.foundation diff --git a/stripe-ui-core/dependencies/dependencies.txt b/stripe-ui-core/dependencies/dependencies.txt index 27921d72ec0..2372c12f8fd 100644 --- a/stripe-ui-core/dependencies/dependencies.txt +++ b/stripe-ui-core/dependencies/dependencies.txt @@ -47,13 +47,13 @@ | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.7.3 (*) | | | | | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20 (*) | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1 -> 1.7.3 (*) +| | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | \--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | | \--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) | | | | +--- androidx.profileinstaller:profileinstaller:1.3.0 | | | | | +--- androidx.annotation:annotation:1.2.0 -> 1.7.1 (*) | | | | | +--- androidx.concurrent:concurrent-futures:1.1.0 (*) @@ -64,12 +64,12 @@ | | | | | \--- com.google.guava:listenablefuture:1.0 | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | \--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | +--- androidx.versionedparcelable:versionedparcelable:1.1.1 | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) | | | | \--- androidx.collection:collection:1.0.0 -> 1.1.0 (*) @@ -101,31 +101,94 @@ | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | \--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | \--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | \--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.22 | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) | \--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.9.22 | \--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) -+--- androidx.annotation:annotation:1.7.1 (*) -+--- androidx.core:core-ktx:1.12.0 -| +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) -| +--- androidx.core:core:1.12.0 (*) ++--- androidx.activity:activity-ktx:1.8.2 +| +--- androidx.activity:activity:1.8.2 +| | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) +| | +--- androidx.collection:collection:1.0.0 -> 1.1.0 (*) +| | +--- androidx.core:core:1.8.0 -> 1.12.0 (*) +| | +--- androidx.lifecycle:lifecycle-runtime:2.6.1 -> 2.7.0 (*) +| | +--- androidx.lifecycle:lifecycle-viewmodel:2.6.1 -> 2.7.0 (*) +| | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.6.1 -> 2.7.0 +| | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | +--- androidx.core:core-ktx:1.2.0 -> 1.12.0 +| | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) +| | | | +--- androidx.core:core:1.12.0 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | \--- androidx.core:core:1.12.0 (c) +| | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 +| | | | +--- androidx.arch.core:core-common:2.2.0 (*) +| | | | +--- androidx.arch.core:core-runtime:2.2.0 (*) +| | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | | \--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (*) +| | | +--- androidx.savedstate:savedstate:1.2.1 +| | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) +| | | | +--- androidx.arch.core:core-common:2.1.0 -> 2.2.0 (*) +| | | | +--- androidx.lifecycle:lifecycle-common:2.6.1 -> 2.7.0 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | | \--- androidx.savedstate:savedstate-ktx:1.2.1 (c) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | +--- androidx.profileinstaller:profileinstaller:1.3.0 (*) +| | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | +--- androidx.tracing:tracing:1.0.0 (*) +| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | \--- androidx.activity:activity-ktx:1.8.2 (c) +| +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) +| +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 +| | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) +| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) +| +--- androidx.savedstate:savedstate-ktx:1.2.1 +| | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | \--- androidx.savedstate:savedstate:1.2.1 (c) | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| \--- androidx.core:core:1.12.0 (c) +| \--- androidx.activity:activity:1.8.2 (c) ++--- androidx.annotation:annotation:1.7.1 (*) ++--- androidx.core:core-ktx:1.12.0 (*) +--- androidx.compose.foundation:foundation:1.5.4 | \--- androidx.compose.foundation:foundation-android:1.5.4 | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) @@ -144,69 +207,7 @@ | | | | \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c) | | | +--- androidx.compose.ui:ui:1.5.4 | | | | \--- androidx.compose.ui:ui-android:1.5.4 -| | | | +--- androidx.activity:activity-ktx:1.7.0 -| | | | | +--- androidx.activity:activity:1.7.0 -| | | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) -| | | | | | +--- androidx.collection:collection:1.0.0 -> 1.1.0 (*) -| | | | | | +--- androidx.core:core:1.8.0 -> 1.12.0 (*) -| | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.6.1 -> 2.7.0 (*) -| | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.6.1 -> 2.7.0 (*) -| | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.6.1 -> 2.7.0 -| | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | +--- androidx.core:core-ktx:1.2.0 -> 1.12.0 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 -| | | | | | | | +--- androidx.arch.core:core-common:2.2.0 (*) -| | | | | | | | +--- androidx.arch.core:core-runtime:2.2.0 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | \--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (*) -| | | | | | | +--- androidx.savedstate:savedstate:1.2.1 -| | | | | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) -| | | | | | | | +--- androidx.arch.core:core-common:2.1.0 -> 2.2.0 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.6.1 -> 2.7.0 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | | \--- androidx.savedstate:savedstate-ktx:1.2.1 (c) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | \--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | +--- androidx.profileinstaller:profileinstaller:1.3.0 (*) -| | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | +--- androidx.tracing:tracing:1.0.0 (*) -| | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | \--- androidx.activity:activity-ktx:1.7.0 (c) -| | | | | +--- androidx.core:core-ktx:1.1.0 -> 1.12.0 (*) -| | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 -| | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) -| | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | \--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) -| | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 -| | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) -| | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | \--- androidx.activity:activity:1.7.0 (c) +| | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 (*) | | | | +--- androidx.annotation:annotation:1.5.0 -> 1.7.1 (*) | | | | +--- androidx.autofill:autofill:1.0.0 | | | | | \--- androidx.core:core:1.1.0 -> 1.12.0 (*) @@ -282,12 +283,12 @@ | | | | | | | +--- androidx.startup:startup-runtime:1.1.1 (*) | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | \--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | | | | \--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) | | | | | | \--- androidx.startup:startup-runtime:1.0.0 -> 1.1.1 (*) | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.21 -> 1.9.22 (*) | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4 -> 1.7.3 (*) diff --git a/stripe-ui-core/src/main/java/com/stripe/android/uicore/utils/ActivityExtensions.kt b/stripe-ui-core/src/main/java/com/stripe/android/uicore/utils/ActivityExtensions.kt new file mode 100644 index 00000000000..5e4f09194d8 --- /dev/null +++ b/stripe-ui-core/src/main/java/com/stripe/android/uicore/utils/ActivityExtensions.kt @@ -0,0 +1,25 @@ +package com.stripe.android.uicore.utils + +import android.content.Context +import android.content.ContextWrapper +import androidx.activity.ComponentActivity +import androidx.annotation.RestrictTo + +/** + * Extracts the [ComponentActivity] from the given [Context]. + */ +@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) +fun Context.extractActivity(): ComponentActivity? { + var currentContext = this + if (currentContext is ComponentActivity) { + return currentContext + } else { + while (currentContext is ContextWrapper) { + if (currentContext is ComponentActivity) { + return currentContext + } + currentContext = currentContext.baseContext + } + } + return null +} diff --git a/wechatpay/dependencies/dependencies.txt b/wechatpay/dependencies/dependencies.txt index 615ceeb1a6b..79fdd538c5f 100644 --- a/wechatpay/dependencies/dependencies.txt +++ b/wechatpay/dependencies/dependencies.txt @@ -315,6 +315,32 @@ | +--- project :stripe-ui-core | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) | | +--- project :stripe-core (*) +| | +--- androidx.activity:activity-ktx:1.8.2 +| | | +--- androidx.activity:activity:1.8.2 (*) +| | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) +| | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 +| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) +| | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) +| | | +--- androidx.savedstate:savedstate-ktx:1.2.1 +| | | | +--- androidx.savedstate:savedstate:1.2.1 (*) +| | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) +| | | | \--- androidx.savedstate:savedstate:1.2.1 (c) +| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | +--- androidx.activity:activity:1.8.2 (c) +| | | \--- androidx.activity:activity-compose:1.8.2 (c) | | +--- androidx.annotation:annotation:1.7.1 (*) | | +--- androidx.core:core-ktx:1.12.0 (*) | | +--- androidx.compose.foundation:foundation:1.5.4 @@ -336,32 +362,7 @@ | | | | | | \--- androidx.compose.runtime:runtime-saveable:1.5.4 (c) | | | | | +--- androidx.compose.ui:ui:1.5.4 | | | | | | \--- androidx.compose.ui:ui-android:1.5.4 -| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 -| | | | | | | +--- androidx.activity:activity:1.8.2 (*) -| | | | | | | +--- androidx.core:core-ktx:1.9.0 -> 1.12.0 (*) -| | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.6.1 -> 2.7.0 -| | | | | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) -| | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) -| | | | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 -| | | | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) -| | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.10 -> 1.9.22 (*) -| | | | | | | | \--- androidx.savedstate:savedstate:1.2.1 (c) -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | +--- androidx.activity:activity:1.8.2 (c) -| | | | | | | \--- androidx.activity:activity-compose:1.8.2 (c) +| | | | | | +--- androidx.activity:activity-ktx:1.7.0 -> 1.8.2 (*) | | | | | | +--- androidx.annotation:annotation:1.5.0 -> 1.7.1 (*) | | | | | | +--- androidx.autofill:autofill:1.0.0 | | | | | | | \--- androidx.core:core:1.1.0 -> 1.12.0 (*) From 6ca00250edc20c28613d3790201c3000b6e8f439 Mon Sep 17 00:00:00 2001 From: Carlos M <99293320+carlosmuvi-stripe@users.noreply.github.com> Date: Tue, 26 Mar 2024 09:31:12 -0700 Subject: [PATCH 2/7] [FC] Removes mavericks from repositories and more panes. (#8154) * Migrates more screens out of mavs. * Migrates partner auth. * Removes active auth session field. * Updates tests. * Updates attach payment viewmodel. * PR feedback. * Api dump. --- financial-connections/detekt-baseline.xml | 1 + .../core/FinancialConnectionsViewModel.kt | 25 +++++---- .../FinancialConnectionsSheetNativeModule.kt | 12 +--- .../AccountPickerPreviewParameterProvider.kt | 6 +- .../accountpicker/AccountPickerScreen.kt | 18 +++--- .../accountpicker/AccountPickerViewModel.kt | 50 ++++++++--------- .../attachpayment/AttachPaymentScreen.kt | 20 ++++--- .../attachpayment/AttachPaymentViewModel.kt | 42 +++++++------- .../bankauthrepair/BankAuthRepairScreen.kt | 8 +-- .../bankauthrepair/BankAuthRepairViewModel.kt | 39 ++++++------- .../features/common/SharedPartnerAuth.kt | 10 ++-- .../features/consent/ConsentScreen.kt | 3 +- ...stitutionPickerPreviewParameterProvider.kt | 6 +- .../InstitutionPickerViewModel.kt | 2 +- .../ManualEntrySuccessScreen.kt | 8 +-- .../ManualEntrySuccessViewModel.kt | 46 ++++++++------- .../PartnerAuthPreviewParameterProvider.kt | 9 +-- .../features/partnerauth/PartnerAuthScreen.kt | 8 +-- .../partnerauth/PartnerAuthViewModel.kt | 56 +++++++++---------- .../partnerauth/SharedPartnerAuthState.kt | 37 ++++++------ .../features/success/SuccessContent.kt | 4 +- .../SuccessPreviewParameterProvider.kt | 4 +- .../features/success/SuccessScreen.kt | 8 +-- .../features/success/SuccessViewModel.kt | 45 ++++++++------- .../FinancialConnectionsErrorRepository.kt | 25 ++++----- .../repository/SuccessContentRepository.kt | 22 ++------ .../FinancialConnectionsSheetViewModelTest.kt | 32 +++++------ .../AccountPickerViewModelTest.kt | 2 +- .../InstitutionPickerViewModelTest.kt | 9 +-- .../partnerauth/PartnerAuthViewModelTest.kt | 26 +++------ ...cialConnectionsSheetNativeViewModelTest.kt | 23 ++++---- 31 files changed, 280 insertions(+), 326 deletions(-) diff --git a/financial-connections/detekt-baseline.xml b/financial-connections/detekt-baseline.xml index 099fdef0d71..1257a434854 100644 --- a/financial-connections/detekt-baseline.xml +++ b/financial-connections/detekt-baseline.xml @@ -30,6 +30,7 @@ MaximumLineLength:com.stripe.android.financialconnections.presentation.FinancialConnectionsUrls.kt:41 MaximumLineLength:com.stripe.android.financialconnections.presentation.FinancialConnectionsUrls.kt:46 MaximumLineLength:com.stripe.android.financialconnections.presentation.FinancialConnectionsUrls.kt:9 + NestedBlockDepth:AccountPickerViewModel.kt$AccountPickerViewModel$fun onAccountClicked(account: PartnerAccount) NestedBlockDepth:InstitutionPickerScreen.kt$private fun LazyListScope.searchResults( isInputEmpty: Boolean, payload: Payload, selectedInstitutionId: String?, onInstitutionSelected: (FinancialConnectionsInstitution, Boolean) -> Unit, institutions: Async<InstitutionResponse>, onManualEntryClick: () -> Unit, onSearchMoreClick: () -> Unit ) SwallowedException:PollAttachPaymentAccount.kt$PollAttachPaymentAccount$e: StripeException SwallowedException:PollAuthorizationSessionAccounts.kt$PollAuthorizationSessionAccounts$e: StripeException diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/core/FinancialConnectionsViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/core/FinancialConnectionsViewModel.kt index 604fcfa4912..60bc999be06 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/core/FinancialConnectionsViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/core/FinancialConnectionsViewModel.kt @@ -5,6 +5,7 @@ import androidx.lifecycle.viewModelScope import com.stripe.android.financialconnections.core.Async.Fail import com.stripe.android.financialconnections.core.Async.Loading import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized import kotlinx.coroutines.Job import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow @@ -23,31 +24,30 @@ internal abstract class FinancialConnectionsViewModel( val stateFlow: StateFlow = _stateFlow.asStateFlow() protected open fun (suspend () -> T).execute( - onSuccess: (T) -> Unit = {}, - onFail: (Throwable) -> Unit = {}, - reducer: S.(Async) -> S + retainValue: KProperty1>? = null, + reducer: S.(Async) -> S, ): Job { return viewModelScope.launch { - setState { reducer(Loading) } + setState { reducer(Loading(value = retainValue?.get(this)?.invoke())) } val result = runCatching { this@execute() } // update state. result.fold( onSuccess = { data -> setState { reducer(Success(data)) } - onSuccess(data) }, onFailure = { throwable -> setState { reducer(Fail(throwable)) } - onFail(throwable) } ) } } + protected fun withState(action: (state: S) -> Unit) = stateFlow.value.let(action) + protected open fun onAsync( prop: KProperty1>, - onSuccess: (T) -> Unit = {}, - onFail: (Throwable) -> Unit = {} + onSuccess: suspend (T) -> Unit = {}, + onFail: suspend (Throwable) -> Unit = {} ) { viewModelScope.launch { stateFlow.map { prop.get(it) } @@ -56,8 +56,8 @@ internal abstract class FinancialConnectionsViewModel( when (async) { is Success -> onSuccess(async()) is Fail -> onFail(async.error) - Loading -> Unit - Async.Uninitialized -> Unit + is Loading -> Unit + Uninitialized -> Unit } } } @@ -70,7 +70,7 @@ internal sealed class Async( private val value: T? ) { data object Uninitialized : Async(value = null) - data object Loading : Async(value = null) + data class Loading(val value: T? = null) : Async(value = value) data class Success(private val value: T) : Async(value = value) { override operator fun invoke(): T = value } @@ -79,3 +79,6 @@ internal sealed class Async( open operator fun invoke(): T? = value } + +internal fun , B, C> withState(viewModel: A, block: (B) -> C) = + block(viewModel.stateFlow.value) diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeModule.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeModule.kt index 296fff840cf..549abb755e0 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeModule.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeModule.kt @@ -153,19 +153,11 @@ internal interface FinancialConnectionsSheetNativeModule { @Singleton @Provides - fun providesSaveToLinkWithStripeSucceededRepository( - @IOContext workContext: CoroutineContext - ): SuccessContentRepository = SuccessContentRepositoryImpl( - CoroutineScope(SupervisorJob() + workContext) - ) + fun providesSaveToLinkWithStripeSucceededRepository(): SuccessContentRepository = SuccessContentRepositoryImpl() @Singleton @Provides - fun providesFinancialConnectionsErrorRepository( - @IOContext workContext: CoroutineContext - ) = FinancialConnectionsErrorRepository( - CoroutineScope(SupervisorJob() + workContext) - ) + fun providesFinancialConnectionsErrorRepository() = FinancialConnectionsErrorRepository() @Singleton @Provides diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerPreviewParameterProvider.kt index 22422523b05..a953a90e9a9 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerPreviewParameterProvider.kt @@ -1,10 +1,10 @@ package com.stripe.android.financialconnections.features.accountpicker import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success import com.stripe.android.core.exception.APIException +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success import com.stripe.android.financialconnections.exception.AccountNoneEligibleForPaymentMethodError import com.stripe.android.financialconnections.features.accountpicker.AccountPickerState.SelectionMode import com.stripe.android.financialconnections.features.common.MerchantDataAccessModel diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerScreen.kt index 52835a7a076..1b55de0d699 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerScreen.kt @@ -22,6 +22,7 @@ import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.State +import androidx.compose.runtime.collectAsState import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip @@ -31,14 +32,13 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel import com.stripe.android.financialconnections.R +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.exception.AccountLoadError import com.stripe.android.financialconnections.exception.AccountNoneEligibleForPaymentMethodError import com.stripe.android.financialconnections.features.accountpicker.AccountPickerClickableText.DATA @@ -68,9 +68,9 @@ import kotlinx.coroutines.launch @Composable internal fun AccountPickerScreen() { - val viewModel: AccountPickerViewModel = mavericksViewModel() + val viewModel: AccountPickerViewModel = paneViewModel { AccountPickerViewModel.factory(it) } val parentViewModel = parentViewModel() - val state: State = viewModel.collectAsState() + val state: State = viewModel.stateFlow.collectAsState() BackHandler(true) {} val bottomSheetState = rememberModalBottomSheetState( diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModel.kt index b54949260de..52909c16d28 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModel.kt @@ -1,12 +1,9 @@ package com.stripe.android.financialconnections.features.accountpicker -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.core.Logger import com.stripe.android.financialconnections.FinancialConnections import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.AccountSelected @@ -19,6 +16,11 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Name import com.stripe.android.financialconnections.analytics.logError +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.GetOrFetchSync import com.stripe.android.financialconnections.domain.PollAuthorizationSessionAccounts import com.stripe.android.financialconnections.domain.SelectAccounts @@ -35,7 +37,6 @@ import com.stripe.android.financialconnections.navigation.Destination.ManualEntr import com.stripe.android.financialconnections.navigation.Destination.Reset import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.destination -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.ui.HandleClickableUrl import com.stripe.android.financialconnections.utils.measureTimeMillis import kotlinx.coroutines.launch @@ -51,7 +52,7 @@ internal class AccountPickerViewModel @Inject constructor( private val handleClickableUrl: HandleClickableUrl, private val logger: Logger, private val pollAuthorizationSessionAccounts: PollAuthorizationSessionAccounts -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { init { logErrors() @@ -61,7 +62,7 @@ internal class AccountPickerViewModel @Inject constructor( private fun loadAccounts() { suspend { - val state = awaitState() + val state = stateFlow.value val sync = getOrFetchSync() val dataAccessNotice = sync.text?.consent?.dataAccessNotice val manifest = sync.manifest @@ -308,21 +309,18 @@ internal class AccountPickerViewModel @Inject constructor( setState { copy(viewEffect = null) } } - companion object : - MavericksViewModelFactory { - - override fun create( - viewModelContext: ViewModelContext, - state: AccountPickerState - ): AccountPickerViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .accountPickerBuilder - .initialState(state) - .build() - .viewModel - } + companion object { + + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = + viewModelFactory { + initializer { + parentComponent + .accountPickerBuilder + .initialState(AccountPickerState()) + .build() + .viewModel + } + } private val PANE = Pane.ACCOUNT_PICKER } @@ -334,7 +332,7 @@ internal data class AccountPickerState( val selectAccounts: Async = Uninitialized, val selectedIds: Set = emptySet(), val viewEffect: ViewEffect? = null -) : MavericksState { +) { val submitLoading: Boolean get() = payload is Loading || selectAccounts is Loading diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/attachpayment/AttachPaymentScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/attachpayment/AttachPaymentScreen.kt index 21dbb3934ee..c6927f5a7de 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/attachpayment/AttachPaymentScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/attachpayment/AttachPaymentScreen.kt @@ -2,14 +2,14 @@ package com.stripe.android.financialconnections.features.attachpayment import androidx.activity.compose.BackHandler import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState import androidx.compose.ui.tooling.preview.Preview -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.exception.AccountNumberRetrievalError import com.stripe.android.financialconnections.features.common.AccountNumberRetrievalErrorContent import com.stripe.android.financialconnections.features.common.FullScreenGenericLoading @@ -23,9 +23,9 @@ import com.stripe.android.financialconnections.ui.components.FinancialConnection @Composable internal fun AttachPaymentScreen() { - val viewModel: AttachPaymentViewModel = mavericksViewModel() + val viewModel: AttachPaymentViewModel = paneViewModel { AttachPaymentViewModel.factory(it) } val parentViewModel = parentViewModel() - val state = viewModel.collectAsState() + val state = viewModel.stateFlow.collectAsState() BackHandler(enabled = true) {} AttachPaymentContent( attachPayment = state.value.linkPaymentAccount, @@ -56,6 +56,7 @@ private fun AttachPaymentContent( is Loading, is Uninitialized, is Success -> FullScreenGenericLoading() + is Fail -> ErrorContent( error = attachPayment.error, onSelectAnotherBank = onSelectAnotherBank, @@ -79,6 +80,7 @@ private fun ErrorContent( onSelectAnotherBank = onSelectAnotherBank, onEnterDetailsManually = onEnterDetailsManually ) + else -> UnclassifiedErrorContent { onCloseFromErrorClick(error) } } } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/attachpayment/AttachPaymentViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/attachpayment/AttachPaymentViewModel.kt index 31199a518b5..3733654cb01 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/attachpayment/AttachPaymentViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/attachpayment/AttachPaymentViewModel.kt @@ -1,16 +1,17 @@ package com.stripe.android.financialconnections.features.attachpayment -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.core.Logger import com.stripe.android.financialconnections.R import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.PollAttachPaymentsSucceeded import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.GetCachedAccounts import com.stripe.android.financialconnections.domain.GetCachedConsumerSession import com.stripe.android.financialconnections.domain.GetOrFetchSync @@ -23,7 +24,6 @@ import com.stripe.android.financialconnections.navigation.Destination.Reset import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.destination import com.stripe.android.financialconnections.repository.SuccessContentRepository -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.ui.TextResource.PluralId import com.stripe.android.financialconnections.utils.measureTimeMillis import javax.inject.Inject @@ -38,7 +38,7 @@ internal class AttachPaymentViewModel @Inject constructor( private val getOrFetchSync: GetOrFetchSync, private val getCachedConsumerSession: GetCachedConsumerSession, private val logger: Logger -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { init { logErrors() @@ -103,20 +103,18 @@ internal class AttachPaymentViewModel @Inject constructor( fun onSelectAnotherBank() = navigationManager.tryNavigateTo(Reset(referrer = PANE)) - companion object : MavericksViewModelFactory { + companion object { - override fun create( - viewModelContext: ViewModelContext, - state: AttachPaymentState - ): AttachPaymentViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .attachPaymentSubcomponent - .initialState(state) - .build() - .viewModel - } + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = + viewModelFactory { + initializer { + parentComponent + .attachPaymentSubcomponent + .initialState(AttachPaymentState()) + .build() + .viewModel + } + } private val PANE = Pane.ATTACH_LINKED_PAYMENT_ACCOUNT } @@ -124,4 +122,4 @@ internal class AttachPaymentViewModel @Inject constructor( internal data class AttachPaymentState( val linkPaymentAccount: Async = Uninitialized -) : MavericksState +) diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairScreen.kt index f469803e8dd..d30fdbdeb85 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairScreen.kt @@ -2,16 +2,16 @@ package com.stripe.android.financialconnections.features.bankauthrepair import androidx.compose.runtime.Composable import androidx.compose.runtime.State -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel +import androidx.compose.runtime.collectAsState +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.SharedPartnerAuth import com.stripe.android.financialconnections.features.partnerauth.SharedPartnerAuthState @Composable internal fun BankAuthRepairScreen() { // step view model - val viewModel: BankAuthRepairViewModel = mavericksViewModel() - val state: State = viewModel.collectAsState() + val viewModel: BankAuthRepairViewModel = paneViewModel { BankAuthRepairViewModel.factory(it) } + val state: State = viewModel.stateFlow.collectAsState() SharedPartnerAuth( state = state.value, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairViewModel.kt index ba8fc3c480a..30482f3539a 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairViewModel.kt @@ -1,35 +1,30 @@ package com.stripe.android.financialconnections.features.bankauthrepair -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.features.partnerauth.SharedPartnerAuthState import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import javax.inject.Inject internal class BankAuthRepairViewModel @Inject constructor( initialState: SharedPartnerAuthState -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { - internal companion object : - MavericksViewModelFactory { + internal companion object { - override fun initialState(viewModelContext: ViewModelContext) = - SharedPartnerAuthState(pane = PANE) - - override fun create( - viewModelContext: ViewModelContext, - state: SharedPartnerAuthState - ): BankAuthRepairViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .bankAuthRepairSubcomponent - .initialState(state) - .build() - .viewModel - } + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = + viewModelFactory { + initializer { + parentComponent + .bankAuthRepairSubcomponent + .initialState(SharedPartnerAuthState(pane = PANE)) + .build() + .viewModel + } + } val PANE = Pane.BANK_AUTH_REPAIR } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/common/SharedPartnerAuth.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/common/SharedPartnerAuth.kt index f4515fd247f..26e81ebf434 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/common/SharedPartnerAuth.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/common/SharedPartnerAuth.kt @@ -41,12 +41,12 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import androidx.compose.ui.viewinterop.AndroidView -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized import com.stripe.android.financialconnections.R +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.core.collectAsState import com.stripe.android.financialconnections.features.partnerauth.PartnerAuthPreviewParameterProvider import com.stripe.android.financialconnections.features.partnerauth.SharedPartnerAuthState diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentScreen.kt index 0177617881c..a77ea1919bc 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentScreen.kt @@ -114,7 +114,8 @@ private fun ConsentContent( onCloseFromErrorClick: (Throwable) -> Unit ) { when (val result = state.consent) { - Uninitialized, Loading -> ConsentLoadingContent() + Uninitialized, + is Loading -> ConsentLoadingContent() is Success -> LoadedContent( payload = result(), diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerPreviewParameterProvider.kt index 6dcddd6ba62..2e5c1f894f4 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerPreviewParameterProvider.kt @@ -28,7 +28,7 @@ internal class InstitutionPickerPreviewParameterProvider : private fun initialLoading() = InstitutionPreviewState( state = InstitutionPickerState( previewText = null, - payload = Loading, + payload = Loading(), searchInstitutions = Uninitialized, ), initialScroll = 0 @@ -47,7 +47,7 @@ internal class InstitutionPickerPreviewParameterProvider : state = InstitutionPickerState( previewText = "Some query", payload = Success(payload()), - searchInstitutions = Loading, + searchInstitutions = Loading(), ), initialScroll = 0 ) @@ -122,7 +122,7 @@ internal class InstitutionPickerPreviewParameterProvider : payload = Success(payload()), searchInstitutions = Success(institutionResponse(FEW_INSTITUTIONS)), selectedInstitutionId = "2", - createSessionForInstitution = Loading, + createSessionForInstitution = Loading(), ), initialScroll = 0 ) diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModel.kt index ad61a1e4ae6..a1ff054c2e0 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModel.kt @@ -164,7 +164,7 @@ internal class InstitutionPickerViewModel @Inject constructor( ) } }.execute { - copy(searchInstitutions = if (it.isCancellationError()) Loading else it) + copy(searchInstitutions = if (it.isCancellationError()) Loading() else it) } } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentrysuccess/ManualEntrySuccessScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentrysuccess/ManualEntrySuccessScreen.kt index d6ef96adf34..bdaa5ba5de2 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentrysuccess/ManualEntrySuccessScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentrysuccess/ManualEntrySuccessScreen.kt @@ -2,9 +2,9 @@ package com.stripe.android.financialconnections.features.manualentrysuccess import androidx.activity.compose.BackHandler import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.success.SuccessContent import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest import com.stripe.android.financialconnections.presentation.parentViewModel @@ -12,8 +12,8 @@ import com.stripe.android.financialconnections.presentation.parentViewModel @Composable internal fun ManualEntrySuccessScreen() { val parentViewModel = parentViewModel() - val viewModel: ManualEntrySuccessViewModel = mavericksViewModel() - val state by viewModel.collectAsState() + val viewModel: ManualEntrySuccessViewModel = paneViewModel { ManualEntrySuccessViewModel.factory(it) } + val state by viewModel.stateFlow.collectAsState() BackHandler(true) {} SuccessContent( completeSessionAsync = state.completeSession, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentrysuccess/ManualEntrySuccessViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentrysuccess/ManualEntrySuccessViewModel.kt index 030ba06d0d7..5035cf60621 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentrysuccess/ManualEntrySuccessViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentrysuccess/ManualEntrySuccessViewModel.kt @@ -1,22 +1,23 @@ package com.stripe.android.financialconnections.features.manualentrysuccess -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.ClickDone import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.PaneLoaded import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.GetManifest import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator import com.stripe.android.financialconnections.features.success.SuccessState import com.stripe.android.financialconnections.model.FinancialConnectionsSession import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.repository.SuccessContentRepository -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import kotlinx.coroutines.launch import javax.inject.Inject @@ -26,7 +27,7 @@ internal class ManualEntrySuccessViewModel @Inject constructor( private val successContentRepository: SuccessContentRepository, private val eventTracker: FinancialConnectionsAnalyticsTracker, private val nativeAuthFlowCoordinator: NativeAuthFlowCoordinator, -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { init { suspend { @@ -50,25 +51,22 @@ internal class ManualEntrySuccessViewModel @Inject constructor( } } - companion object : - MavericksViewModelFactory { + companion object { - override fun create( - viewModelContext: ViewModelContext, - state: ManualEntrySuccessState - ): ManualEntrySuccessViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .manualEntrySuccessBuilder - .initialState(state) - .build() - .viewModel - } + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = + viewModelFactory { + initializer { + parentComponent + .manualEntrySuccessBuilder + .initialState(ManualEntrySuccessState()) + .build() + .viewModel + } + } } } internal data class ManualEntrySuccessState( val payload: Async = Uninitialized, val completeSession: Async = Uninitialized -) : MavericksState +) diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthPreviewParameterProvider.kt index 052016136bc..064dc7e1bbc 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthPreviewParameterProvider.kt @@ -1,9 +1,9 @@ package com.stripe.android.financialconnections.features.partnerauth import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.model.Body import com.stripe.android.financialconnections.model.Cta import com.stripe.android.financialconnections.model.Display @@ -46,7 +46,6 @@ internal class PartnerAuthPreviewParameterProvider : ), authenticationStatus = Uninitialized, viewEffect = null, - activeAuthSession = null, pane = Pane.PARTNER_AUTH ) @@ -54,7 +53,6 @@ internal class PartnerAuthPreviewParameterProvider : payload = Loading(), authenticationStatus = Uninitialized, viewEffect = null, - activeAuthSession = null, pane = Pane.PARTNER_AUTH ) @@ -78,7 +76,6 @@ internal class PartnerAuthPreviewParameterProvider : // While browser is showing, this Async is loading. authenticationStatus = Loading(), viewEffect = null, - activeAuthSession = null, pane = Pane.PARTNER_AUTH ) diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthScreen.kt index a5b11b0a818..23406afe5d3 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthScreen.kt @@ -2,14 +2,14 @@ package com.stripe.android.financialconnections.features.partnerauth import androidx.compose.runtime.Composable import androidx.compose.runtime.State -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel +import androidx.compose.runtime.collectAsState +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.SharedPartnerAuth @Composable internal fun PartnerAuthScreen(inModal: Boolean) { - val viewModel: PartnerAuthViewModel = mavericksViewModel() - val state: State = viewModel.collectAsState() + val viewModel: PartnerAuthViewModel = paneViewModel { PartnerAuthViewModel.factory(it) } + val state: State = viewModel.stateFlow.collectAsState() SharedPartnerAuth( inModal = inModal, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthViewModel.kt index 7820ff45f37..0546938e0b8 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthViewModel.kt @@ -2,12 +2,10 @@ package com.stripe.android.financialconnections.features.partnerauth import android.webkit.URLUtil import androidx.core.net.toUri -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.core.Logger import com.stripe.android.financialconnections.FinancialConnections import com.stripe.android.financialconnections.analytics.AuthSessionEvent @@ -23,7 +21,12 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Name import com.stripe.android.financialconnections.analytics.logError import com.stripe.android.financialconnections.browser.BrowserManager +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.APPLICATION_ID +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.CancelAuthorizationSession import com.stripe.android.financialconnections.domain.CompleteAuthorizationSession import com.stripe.android.financialconnections.domain.GetOrFetchSync @@ -49,7 +52,6 @@ import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.PopUpToBehavior import com.stripe.android.financialconnections.navigation.destination import com.stripe.android.financialconnections.presentation.WebAuthFlowState -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.utils.UriUtils import kotlinx.coroutines.launch import java.util.Date @@ -73,7 +75,7 @@ internal class PartnerAuthViewModel @Inject constructor( private val pollAuthorizationSessionOAuthResults: PollAuthorizationSessionOAuthResults, private val logger: Logger, initialState: SharedPartnerAuthState -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { init { handleErrors() @@ -97,7 +99,9 @@ internal class PartnerAuthViewModel @Inject constructor( institution = requireNotNull(manifest.activeInstitution), authSession = authSession, ) - }.execute { copy(payload = it) } + }.execute { + copy(payload = it) + } private fun recreateAuthSession() = suspend { val launchedEvent = Launched(Date()) @@ -124,15 +128,12 @@ internal class PartnerAuthViewModel @Inject constructor( // keeps existing payload to prevent showing full-screen loading. retainValue = SharedPartnerAuthState::payload ) { - copy( - payload = it, - activeAuthSession = it()?.authSession?.id - ) + copy(payload = it) } private fun launchBrowserIfNonOauth() { onAsync( - asyncProp = SharedPartnerAuthState::payload, + prop = SharedPartnerAuthState::payload, onSuccess = { // launch auth for non-OAuth (skip pre-pane). if (!it.authSession.isOAuth) { @@ -437,23 +438,18 @@ internal class PartnerAuthViewModel @Inject constructor( navigationManager.tryNavigateBack() } - companion object : MavericksViewModelFactory { - - override fun initialState(viewModelContext: ViewModelContext) = - SharedPartnerAuthState(pane = PANE) + companion object { - override fun create( - viewModelContext: ViewModelContext, - state: SharedPartnerAuthState - ): PartnerAuthViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .partnerAuthSubcomponent - .initialState(state) - .build() - .viewModel - } + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = + viewModelFactory { + initializer { + parentComponent + .partnerAuthSubcomponent + .initialState(SharedPartnerAuthState(pane = PANE)) + .build() + .viewModel + } + } private val PANE = Pane.PARTNER_AUTH } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/SharedPartnerAuthState.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/SharedPartnerAuthState.kt index be7e55237d8..574c20b09db 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/SharedPartnerAuthState.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/SharedPartnerAuthState.kt @@ -1,28 +1,27 @@ package com.stripe.android.financialconnections.features.partnerauth -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.PersistState -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.model.FinancialConnectionsAuthorizationSession import com.stripe.android.financialconnections.model.FinancialConnectionsInstitution -import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest +import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane internal data class SharedPartnerAuthState( - /** - * The active auth session id. Used across process kills to prevent re-creating the session - * if one is already active. - */ - @PersistState - val activeAuthSession: String? = null, - val pane: FinancialConnectionsSessionManifest.Pane, - val payload: Async = Uninitialized, - val viewEffect: ViewEffect? = null, - val authenticationStatus: Async = Uninitialized, -) : MavericksState { + val pane: Pane, + val payload: Async, + val viewEffect: ViewEffect?, + val authenticationStatus: Async, +) { + + constructor(pane: Pane) : this( + pane = pane, + payload = Uninitialized, + viewEffect = null, + authenticationStatus = Uninitialized + ) data class Payload( val isStripeDirect: Boolean, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessContent.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessContent.kt index 63740c3632a..dde88ba260a 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessContent.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessContent.kt @@ -41,9 +41,9 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Loading import com.stripe.android.financialconnections.R +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Loading import com.stripe.android.financialconnections.features.common.LoadingSpinner import com.stripe.android.financialconnections.features.success.SuccessState.Payload import com.stripe.android.financialconnections.model.FinancialConnectionsSession diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessPreviewParameterProvider.kt index 3a8d7486303..3a76e491b18 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessPreviewParameterProvider.kt @@ -1,8 +1,8 @@ package com.stripe.android.financialconnections.features.success import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.ui.TextResource internal class SuccessPreviewParameterProvider : diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessScreen.kt index babfad2aa79..d51b1964206 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessScreen.kt @@ -3,16 +3,16 @@ package com.stripe.android.financialconnections.features.success import androidx.activity.compose.BackHandler import androidx.compose.runtime.Composable import androidx.compose.runtime.State -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel +import androidx.compose.runtime.collectAsState +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.presentation.parentViewModel @Composable internal fun SuccessScreen() { - val viewModel: SuccessViewModel = mavericksViewModel() + val viewModel: SuccessViewModel = paneViewModel { SuccessViewModel.factory(it) } val parentViewModel = parentViewModel() - val state: State = viewModel.collectAsState() + val state: State = viewModel.stateFlow.collectAsState() BackHandler(enabled = true) {} SuccessContent( completeSessionAsync = state.value.completeSession, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessViewModel.kt index f7197c784ad..d38ba45a0a7 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessViewModel.kt @@ -1,16 +1,18 @@ package com.stripe.android.financialconnections.features.success -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.core.Logger import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.ClickDone import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.PaneLoaded import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.GetCachedAccounts import com.stripe.android.financialconnections.domain.GetManifest import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator @@ -19,7 +21,6 @@ import com.stripe.android.financialconnections.features.common.useContinueWithMe import com.stripe.android.financialconnections.model.FinancialConnectionsSession import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.repository.SuccessContentRepository -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.ui.TextResource import kotlinx.coroutines.launch import javax.inject.Inject @@ -32,7 +33,7 @@ internal class SuccessViewModel @Inject constructor( private val eventTracker: FinancialConnectionsAnalyticsTracker, private val logger: Logger, private val nativeAuthFlowCoordinator: NativeAuthFlowCoordinator -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { init { observeAsyncs() @@ -78,20 +79,18 @@ internal class SuccessViewModel @Inject constructor( nativeAuthFlowCoordinator().emit(Complete()) } - companion object : MavericksViewModelFactory { + companion object { - override fun create( - viewModelContext: ViewModelContext, - state: SuccessState - ): SuccessViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .successSubcomponent - .initialState(state) - .build() - .viewModel - } + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = + viewModelFactory { + initializer { + parentComponent + .successSubcomponent + .initialState(SuccessState()) + .build() + .viewModel + } + } private val PANE = Pane.SUCCESS } @@ -100,7 +99,7 @@ internal class SuccessViewModel @Inject constructor( internal data class SuccessState( val payload: Async = Uninitialized, val completeSession: Async = Uninitialized -) : MavericksState { +) { data class Payload( val businessName: String?, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/FinancialConnectionsErrorRepository.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/FinancialConnectionsErrorRepository.kt index 5857fcd2311..dc1ecd9f23f 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/FinancialConnectionsErrorRepository.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/FinancialConnectionsErrorRepository.kt @@ -1,30 +1,25 @@ package com.stripe.android.financialconnections.repository -import com.airbnb.mvrx.ExperimentalMavericksApi -import com.airbnb.mvrx.MavericksRepository import com.airbnb.mvrx.MavericksState -import com.stripe.android.financialconnections.BuildConfig -import kotlinx.coroutines.CoroutineScope -@OptIn(ExperimentalMavericksApi::class) -internal class FinancialConnectionsErrorRepository( - coroutineScope: CoroutineScope -) : MavericksRepository( - initialState = State(), - coroutineScope = coroutineScope, - performCorrectnessValidations = BuildConfig.DEBUG, -) { +internal class FinancialConnectionsErrorRepository { - suspend fun get() = awaitState().error + private var state = State() + + fun get() = state.error + + fun update(reducer: State.() -> State) { + state = reducer(state) + } fun set(error: Throwable) { - setState { + update { copy(error = error) } } fun clear() { - setState { + update { copy(error = null) } } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/SuccessContentRepository.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/SuccessContentRepository.kt index be7eb7cd959..ee7064764ac 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/SuccessContentRepository.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/SuccessContentRepository.kt @@ -1,12 +1,7 @@ package com.stripe.android.financialconnections.repository -import com.airbnb.mvrx.ExperimentalMavericksApi -import com.airbnb.mvrx.MavericksRepository -import com.airbnb.mvrx.MavericksState -import com.stripe.android.financialconnections.BuildConfig import com.stripe.android.financialconnections.repository.SuccessContentRepository.State import com.stripe.android.financialconnections.ui.TextResource -import kotlinx.coroutines.CoroutineScope import javax.inject.Inject internal interface SuccessContentRepository { @@ -15,21 +10,16 @@ internal interface SuccessContentRepository { data class State( val customSuccessMessage: TextResource? = null - ) : MavericksState + ) } -@OptIn(ExperimentalMavericksApi::class) -internal class SuccessContentRepositoryImpl @Inject constructor( - coroutineScope: CoroutineScope -) : SuccessContentRepository, MavericksRepository( - initialState = State(), - coroutineScope = coroutineScope, - performCorrectnessValidations = BuildConfig.DEBUG, -) { +internal class SuccessContentRepositoryImpl @Inject constructor() : SuccessContentRepository { - override suspend fun get() = awaitState() + private var state = State() + + override suspend fun get() = state override fun update(reducer: State.() -> State) { - setState(reducer) + state = reducer(state) } } diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModelTest.kt index 811e24970dc..fddc086c423 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModelTest.kt @@ -14,6 +14,7 @@ import com.stripe.android.financialconnections.FinancialConnectionsSheetViewEffe import com.stripe.android.financialconnections.FinancialConnectionsSheetViewEffect.OpenAuthFlowWithUrl import com.stripe.android.financialconnections.analytics.FinancialConnectionsEventReporter import com.stripe.android.financialconnections.browser.BrowserManager +import com.stripe.android.financialconnections.core.withState import com.stripe.android.financialconnections.domain.FetchFinancialConnectionsSession import com.stripe.android.financialconnections.domain.FetchFinancialConnectionsSessionForToken import com.stripe.android.financialconnections.domain.SynchronizeFinancialConnectionsSession @@ -106,7 +107,7 @@ class FinancialConnectionsSheetViewModelTest { val viewModel = createViewModel(defaultInitialState) // Then - viewModel.stateFlow.value.let { + withState(viewModel) { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.NONE) require(it.viewEffect is FinishWithResult) require(it.viewEffect.result is Failed) @@ -161,12 +162,10 @@ class FinancialConnectionsSheetViewModelTest { ) // Then - viewModel.stateFlow.value.let { + withState(viewModel) { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.NONE) val viewEffect = it.viewEffect as FinishWithResult - assertThat(viewEffect.result).isEqualTo( - Completed(linkedAccountId = linkedAccountId) - ) + assertThat(viewEffect.result).isEqualTo(Completed(linkedAccountId = linkedAccountId)) } } } @@ -189,7 +188,7 @@ class FinancialConnectionsSheetViewModelTest { ) // Then - viewModel.stateFlow.value.let { + withState(viewModel) { val viewEffect = it.viewEffect as FinishWithResult assertThat(viewEffect.result).isInstanceOf(Failed::class.java) } @@ -233,7 +232,7 @@ class FinancialConnectionsSheetViewModelTest { // end auth flow viewModel.handleOnNewIntent(cancelIntent()) - viewModel.stateFlow.value.let { + withState(viewModel) { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.NONE) assertThat(it.viewEffect).isEqualTo(FinishWithResult(Canceled)) } @@ -260,7 +259,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.handleOnNewIntent(cancelIntent()) // Then - viewModel.stateFlow.value.let { + withState(viewModel) { require(it.viewEffect is FinishWithResult) require(it.viewEffect.result is Failed) assertThat(it.viewEffect.result.error).isInstanceOf(CustomManualEntryRequiredError::class.java) @@ -281,7 +280,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.handleOnNewIntent(errorIntent) // Then - viewModel.stateFlow.value.let { + withState(viewModel) { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.NONE) val viewEffect = it.viewEffect as FinishWithResult assertThat(viewEffect.result).isInstanceOf(Failed::class.java) @@ -304,7 +303,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.handleOnNewIntent(successIntent()) // Then - viewModel.stateFlow.value.let { + withState(viewModel) { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.NONE) val viewEffect = it.viewEffect as FinishWithResult assertThat(viewEffect.result).isEqualTo( @@ -331,7 +330,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.handleOnNewIntent(Intent().apply { data = Uri.parse(nativeRedirectUrl) }) // Then - viewModel.stateFlow.value.let { + withState(viewModel) { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.INTERMEDIATE_DEEPLINK) val viewEffect = it.viewEffect as OpenAuthFlowWithUrl assertThat(viewEffect.url).isEqualTo(aggregatorUrl) @@ -357,7 +356,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.handleOnNewIntent(Intent().apply { data = Uri.parse(returnUrl) }) // Then - viewModel.stateFlow.value.let { + withState(viewModel) { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.INTERMEDIATE_DEEPLINK) val viewEffect = it.viewEffect as OpenAuthFlowWithUrl assertThat(viewEffect.url).isEqualTo( @@ -381,7 +380,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.handleOnNewIntent(successIntent()) // Then - viewModel.stateFlow.value.let { + withState(viewModel) { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.NONE) val viewEffect = it.viewEffect as FinishWithResult assertThat(viewEffect.result).isEqualTo(Failed(apiException)) @@ -401,8 +400,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.handleOnNewIntent(successIntent()) // Then - // Then - viewModel.stateFlow.value.let { + withState(viewModel) { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.NONE) val viewEffect = it.viewEffect as FinishWithResult assertThat(viewEffect.result).isEqualTo(Failed(APIException())) @@ -429,7 +427,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.onResume() // Then - viewModel.stateFlow.value.let { + withState(viewModel) { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.ON_EXTERNAL_ACTIVITY) val viewEffect = it.viewEffect as FinishWithResult assertThat(viewEffect.result).isEqualTo(Canceled) @@ -456,7 +454,7 @@ class FinancialConnectionsSheetViewModelTest { viewModel.onBrowserActivityResult() // Then - viewModel.stateFlow.value.let { + withState(viewModel) { assertThat(it.webAuthFlowStatus).isEqualTo(AuthFlowStatus.ON_EXTERNAL_ACTIVITY) val viewEffect = it.viewEffect as FinishWithResult assertThat(viewEffect.result).isEqualTo(Canceled) diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModelTest.kt index 1577b4cd713..ece09b1851f 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModelTest.kt @@ -1,7 +1,6 @@ package com.stripe.android.financialconnections.features.accountpicker import com.airbnb.mvrx.test.MavericksTestRule -import com.airbnb.mvrx.withState import com.google.common.truth.Truth.assertThat import com.stripe.android.core.Logger import com.stripe.android.financialconnections.ApiKeyFixtures.authorizationSession @@ -10,6 +9,7 @@ import com.stripe.android.financialconnections.ApiKeyFixtures.partnerAccountList import com.stripe.android.financialconnections.ApiKeyFixtures.sessionManifest import com.stripe.android.financialconnections.ApiKeyFixtures.syncResponse import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker +import com.stripe.android.financialconnections.core.withState import com.stripe.android.financialconnections.domain.GetOrFetchSync import com.stripe.android.financialconnections.domain.PollAuthorizationSessionAccounts import com.stripe.android.financialconnections.domain.SelectAccounts diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModelTest.kt index 057f6709f84..cdba96eef43 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModelTest.kt @@ -6,6 +6,7 @@ import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.FinancialConnectionsSheet import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.withState import com.stripe.android.financialconnections.domain.FeaturedInstitutions import com.stripe.android.financialconnections.domain.GetOrFetchSync import com.stripe.android.financialconnections.domain.PostAuthorizationSession @@ -93,7 +94,7 @@ internal class InstitutionPickerViewModelTest { val viewModel = buildViewModel(InstitutionPickerState()) - viewModel.stateFlow.value.let { state -> + withState(viewModel) { state -> assertEquals(state.payload()!!.featuredInstitutions, institutionResponse) assertIs(state.searchInstitutions) } @@ -120,7 +121,7 @@ internal class InstitutionPickerViewModelTest { val viewModel = buildViewModel(InstitutionPickerState()) - viewModel.stateFlow.value.let { state -> + withState(viewModel) { state -> assertTrue(state.payload() == null) handleError.assertError( error = error, @@ -169,7 +170,7 @@ internal class InstitutionPickerViewModelTest { viewModel.onQueryChanged(query) advanceUntilIdle() - viewModel.stateFlow.value.let { state -> + withState(viewModel) { state -> assertEquals(state.payload()!!.featuredInstitutions, featuredResults) assertEquals(state.searchInstitutions()!!, searchResults) eventTracker.assertContainsEvent( @@ -192,7 +193,7 @@ internal class InstitutionPickerViewModelTest { viewModel.onQueryChanged(query) advanceUntilIdle() - viewModel.stateFlow.value.let { state -> + withState(viewModel) { state -> verifyNoInteractions(searchInstitutions) assertTrue(eventTracker.sentEvents.none { it.eventName == "linked_accounts.search.succeeded" }) assertEquals(state.searchInstitutions()!!.data, emptyList()) diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthViewModelTest.kt index afe87cbf1d5..ec4e31078ca 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthViewModelTest.kt @@ -1,8 +1,6 @@ package com.stripe.android.financialconnections.features.partnerauth -import com.airbnb.mvrx.Uninitialized import com.airbnb.mvrx.test.MavericksTestRule -import com.airbnb.mvrx.withState import com.google.common.truth.Truth.assertThat import com.stripe.android.core.Logger import com.stripe.android.core.exception.APIException @@ -73,16 +71,14 @@ internal class PartnerAuthViewModelTest { throw unplannedDowntimeError } - val viewModel = createViewModel() + createViewModel() - withState(viewModel) { - handleError.assertError( - extraMessage = "Error fetching payload / posting AuthSession", - error = unplannedDowntimeError, - pane = Pane.PARTNER_AUTH, - displayErrorScreen = true - ) - } + handleError.assertError( + extraMessage = "Error fetching payload / posting AuthSession", + error = unplannedDowntimeError, + pane = Pane.PARTNER_AUTH, + displayErrorScreen = true + ) } @Test @@ -272,13 +268,7 @@ internal class PartnerAuthViewModelTest { } private fun createViewModel( - initialState: SharedPartnerAuthState = SharedPartnerAuthState( - activeAuthSession = null, - pane = Pane.PARTNER_AUTH, - payload = Uninitialized, - viewEffect = null, - authenticationStatus = Uninitialized - ) + initialState: SharedPartnerAuthState = SharedPartnerAuthState(Pane.PARTNER_AUTH) ): PartnerAuthViewModel { return PartnerAuthViewModel( navigationManager = TestNavigationManager(), diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModelTest.kt index 209703dfe22..c45801aa860 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModelTest.kt @@ -14,6 +14,7 @@ import com.stripe.android.financialconnections.FinancialConnectionsSheet import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Metadata import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Name +import com.stripe.android.financialconnections.core.withState import com.stripe.android.financialconnections.domain.CompleteFinancialConnectionsSession import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator.Message.Complete @@ -88,7 +89,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { messagesFlow.emit(Complete(EarlyTerminationCause.USER_INITIATED_WITH_CUSTOM_MANUAL_ENTRY)) - viewModel.stateFlow.value.let { + withState(viewModel) { require(it.viewEffect is Finish) require(it.viewEffect.result is Failed) assertThat(it.viewEffect.result.error).isInstanceOf(CustomManualEntryRequiredError::class.java) @@ -108,7 +109,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { messagesFlow.emit(Complete(null)) - viewModel.stateFlow.value.let { + withState(viewModel) { require(it.viewEffect is Finish) require(it.viewEffect.result is Completed) } @@ -134,7 +135,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { messagesFlow.emit(Complete(null)) - viewModel.stateFlow.value.let { + withState(viewModel) { require(it.viewEffect is Finish) require(it.viewEffect.result is Canceled) } @@ -166,7 +167,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { messagesFlow.emit(Complete(null)) - viewModel.stateFlow.value.let { + withState(viewModel) { require(it.viewEffect is Finish) require(it.viewEffect.result is Failed) } @@ -187,7 +188,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { val intent = intent("stripe://auth-redirect/$applicationId?status=success") viewModel.handleOnNewIntent(intent) - viewModel.stateFlow.value.let { + withState(viewModel) { assertThat(it.webAuthFlow).isEqualTo(WebAuthFlowState.Success(intent.data!!.toString())) } } @@ -202,7 +203,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { ) viewModel.handleOnNewIntent(intent) - viewModel.stateFlow.value.let { + withState(viewModel) { val webAuthFlow = it.webAuthFlow assertIs(webAuthFlow) assertThat(webAuthFlow.reason).isEqualTo(errorReason) @@ -218,7 +219,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { ) viewModel.handleOnNewIntent(intent) - viewModel.stateFlow.value.let { + withState(viewModel) { val webAuthFlow = it.webAuthFlow assertIs(webAuthFlow) } @@ -233,7 +234,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { ) viewModel.handleOnNewIntent(intent) - viewModel.stateFlow.value.let { + withState(viewModel) { val webAuthFlow = it.webAuthFlow assertIs(webAuthFlow) } @@ -246,7 +247,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { val intent = intent("stripe://auth-redirect/$applicationId?status=unknown") viewModel.handleOnNewIntent(intent) - viewModel.stateFlow.value.let { + withState(viewModel) { val webAuthFlow = it.webAuthFlow assertIs(webAuthFlow) } @@ -259,7 +260,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { val intent = intent("stripe://auth-redirect/$applicationId?status=cancel") viewModel.handleOnNewIntent(intent) - viewModel.stateFlow.value.let { + withState(viewModel) { val webAuthFlow = it.webAuthFlow assertIs(webAuthFlow) } @@ -272,7 +273,7 @@ internal class FinancialConnectionsSheetNativeViewModelTest { val intent = intent("stripe://auth-redirect/other-app-id?code=success") viewModel.handleOnNewIntent(intent) - viewModel.stateFlow.value.let { + withState(viewModel) { val webAuthFlow = it.webAuthFlow assertIs(webAuthFlow) } From 1f0f3972bc1685eb4cb02250e8a430191be5794f Mon Sep 17 00:00:00 2001 From: Carlos M <99293320+carlosmuvi-stripe@users.noreply.github.com> Date: Tue, 26 Mar 2024 17:41:22 -0700 Subject: [PATCH 3/7] [FC] Removes mavericks from all viewmodels and tests (#8155) * Migrates more screens out of mavs. * Migrates partner auth. * Removes active auth session field. * Updates tests. * Updates attach payment viewmodel. * PR feedback. * Api dump. * Migrates missing viewmodels. * Updates dependencies. * PR feedback. --- example/dependencies/dependencies.txt | 9 --- .../dependencies/dependencies.txt | 9 --- financial-connections/build.gradle | 2 - .../dependencies/dependencies.txt | 9 --- .../FinancialConnectionsSheetState.kt | 3 +- .../FinancialConnectionsSheetNativeModule.kt | 13 +--- .../error/ErrorPreviewParameterProvider.kt | 4 +- .../features/error/ErrorScreen.kt | 21 +++--- .../features/error/ErrorViewModel.kt | 43 ++++++------ .../features/exit/ExitModal.kt | 10 +-- .../features/exit/ExitViewModel.kt | 39 +++++------ ...nkAccountPickerPreviewParameterProvider.kt | 4 +- .../LinkAccountPickerScreen.kt | 18 ++--- .../LinkAccountPickerViewModel.kt | 48 +++++++------ ...pUpVerificationPreviewParameterProvider.kt | 8 +-- .../LinkStepUpVerificationScreen.kt | 18 ++--- .../LinkStepUpVerificationViewModel.kt | 54 +++++++-------- .../ManualEntryPreviewParameterProvider.kt | 8 +-- .../features/manualentry/ManualEntryScreen.kt | 25 +++---- .../manualentry/ManualEntryViewModel.kt | 46 ++++++------- ...LinkLoginWarmupPreviewParameterProvider.kt | 8 +-- .../NetworkingLinkLoginWarmupScreen.kt | 14 ++-- .../NetworkingLinkLoginWarmupViewModel.kt | 47 ++++++------- ...rkingLinkSignupPreviewParameterProvider.kt | 4 +- .../NetworkingLinkSignupScreen.kt | 18 ++--- .../NetworkingLinkSignupViewModel.kt | 56 ++++++++-------- ...inkVerificationPreviewParameterProvider.kt | 8 +-- .../NetworkingLinkVerificationScreen.kt | 18 ++--- .../NetworkingLinkVerificationViewModel.kt | 52 +++++++------- ...inkVerificationPreviewParameterProvider.kt | 8 +-- .../NetworkingSaveToLinkVerificationScreen.kt | 20 +++--- ...tworkingSaveToLinkVerificationViewModel.kt | 54 +++++++-------- .../features/reset/ResetScreen.kt | 23 ++++--- .../features/reset/ResetViewModel.kt | 42 ++++++------ ...zationPendingNetworkingRepairRepository.kt | 39 ++--------- .../utils/MavericksExtensions.kt | 38 ----------- .../financialconnections/CoroutineTestRule.kt | 3 +- .../AccountPickerViewModelTest.kt | 4 +- .../LinkAccountPickerViewModelTest.kt | 6 +- .../LinkStepUpVerificationViewModelTest.kt | 67 ++++++++++--------- .../manualentry/ManualEntryViewModelTest.kt | 10 +-- .../NetworkingLinkLoginWarmupViewModelTest.kt | 6 +- .../NetworkingLinkSignupViewModelTest.kt | 13 ++-- ...NetworkingLinkVerificationViewModelTest.kt | 18 ++--- ...kingSaveToLinkVerificationViewModelTest.kt | 14 ++-- .../partnerauth/PartnerAuthViewModelTest.kt | 7 +- .../features/success/SuccessViewModelTest.kt | 7 +- .../dependencies/dependencies.txt | 9 --- 48 files changed, 442 insertions(+), 562 deletions(-) diff --git a/example/dependencies/dependencies.txt b/example/dependencies/dependencies.txt index a19c531f529..5f5e02888ac 100644 --- a/example/dependencies/dependencies.txt +++ b/example/dependencies/dependencies.txt @@ -994,15 +994,6 @@ | | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 -> 1.9.10 (*) | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:{require 1.6.4; reject _} -> 1.7.3 (*) | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 -> 1.9.10 (*) -| +--- com.airbnb.android:mavericks-compose:3.0.9 -| | +--- androidx.lifecycle:lifecycle-common-java8:{require 2.6.1; reject _} -> 2.7.0 (*) -| | +--- androidx.fragment:fragment:{require 1.5.2; reject _} -> 1.6.2 (*) -| | +--- androidx.appcompat:appcompat:{require 1.5.0; reject _} -> 1.6.1 (*) -| | +--- androidx.compose.foundation:foundation:{require 1.2.1; reject _} -> 1.5.4 (*) -| | +--- androidx.compose.ui:ui:{require 1.2.1; reject _} -> 1.5.4 (*) -| | +--- androidx.lifecycle:lifecycle-viewmodel-compose:{require 2.6.1; reject _} -> 2.7.0 (*) -| | +--- com.airbnb.android:mavericks:3.0.9 (*) -| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 -> 1.9.10 (*) | \--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.22 (*) +--- com.google.accompanist:accompanist-themeadapter-material:0.32.0 (*) +--- com.alipay.sdk:alipaysdk-android:15.8.12 diff --git a/financial-connections-example/dependencies/dependencies.txt b/financial-connections-example/dependencies/dependencies.txt index effcb618c42..6e97dab45b8 100644 --- a/financial-connections-example/dependencies/dependencies.txt +++ b/financial-connections-example/dependencies/dependencies.txt @@ -685,15 +685,6 @@ | | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 -> 1.9.10 (*) | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:{require 1.6.4; reject _} -> 1.7.3 (*) | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 -> 1.9.10 (*) -| +--- com.airbnb.android:mavericks-compose:3.0.9 -| | +--- androidx.lifecycle:lifecycle-common-java8:{require 2.6.1; reject _} -> 2.7.0 (*) -| | +--- androidx.fragment:fragment:{require 1.5.2; reject _} -> 1.6.2 (*) -| | +--- androidx.appcompat:appcompat:{require 1.5.0; reject _} -> 1.6.1 (*) -| | +--- androidx.compose.foundation:foundation:{require 1.2.1; reject _} -> 1.5.4 (*) -| | +--- androidx.compose.ui:ui:{require 1.2.1; reject _} -> 1.5.4 (*) -| | +--- androidx.lifecycle:lifecycle-viewmodel-compose:{require 2.6.1; reject _} -> 2.7.0 (*) -| | +--- com.airbnb.android:mavericks:3.0.9 (*) -| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 -> 1.9.10 (*) | \--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.22 (*) +--- project :payments-core | +--- project :stripe-core (*) diff --git a/financial-connections/build.gradle b/financial-connections/build.gradle index 0ba7b8db0ba..35da6c4834a 100644 --- a/financial-connections/build.gradle +++ b/financial-connections/build.gradle @@ -42,7 +42,6 @@ dependencies { implementation libs.kotlin.coroutinesAndroid implementation libs.kotlin.serialization implementation libs.mavericks - implementation libs.mavericksCompose debugImplementation libs.compose.uiTestManifest debugImplementation libs.compose.uiTooling @@ -64,7 +63,6 @@ dependencies { testImplementation testLibs.mockito.core testImplementation testLibs.mockito.inline testImplementation testLibs.mockito.kotlin - testImplementation testLibs.mavericks testImplementation testLibs.robolectric testImplementation testLibs.testParameterInjector testImplementation testLibs.turbine diff --git a/financial-connections/dependencies/dependencies.txt b/financial-connections/dependencies/dependencies.txt index 2527a93ce58..01b29065162 100644 --- a/financial-connections/dependencies/dependencies.txt +++ b/financial-connections/dependencies/dependencies.txt @@ -658,13 +658,4 @@ | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 (*) | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:{require 1.6.4; reject _} -> 1.7.3 (*) | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 (*) -+--- com.airbnb.android:mavericks-compose:3.0.9 -| +--- androidx.lifecycle:lifecycle-common-java8:{require 2.6.1; reject _} -> 2.7.0 (*) -| +--- androidx.fragment:fragment:{require 1.5.2; reject _} -> 1.5.2 (*) -| +--- androidx.appcompat:appcompat:{require 1.5.0; reject _} -> 1.6.1 (*) -| +--- androidx.compose.foundation:foundation:{require 1.2.1; reject _} -> 1.5.4 (*) -| +--- androidx.compose.ui:ui:{require 1.2.1; reject _} -> 1.5.4 (*) -| +--- androidx.lifecycle:lifecycle-viewmodel-compose:{require 2.6.1; reject _} -> 2.7.0 (*) -| +--- com.airbnb.android:mavericks:3.0.9 (*) -| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 (*) \--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.22 (*) \ No newline at end of file diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetState.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetState.kt index 6ec67c4a3bd..1bd27c66b67 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetState.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetState.kt @@ -2,7 +2,6 @@ package com.stripe.android.financialconnections import android.os.Bundle import androidx.annotation.StringRes -import com.airbnb.mvrx.MavericksState import com.stripe.android.financialconnections.launcher.FinancialConnectionsSheetActivityArgs import com.stripe.android.financialconnections.launcher.FinancialConnectionsSheetActivityResult import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest @@ -17,7 +16,7 @@ internal data class FinancialConnectionsSheetState( val manifest: FinancialConnectionsSessionManifest?, val webAuthFlowStatus: AuthFlowStatus, val viewEffect: FinancialConnectionsSheetViewEffect? -) : MavericksState { +) { val sessionSecret: String get() = initialArgs.configuration.financialConnectionsSessionClientSecret diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeModule.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeModule.kt index 549abb755e0..5c6a97a0c71 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeModule.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/di/FinancialConnectionsSheetNativeModule.kt @@ -3,11 +3,9 @@ package com.stripe.android.financialconnections.di import android.app.Application import com.stripe.android.core.ApiVersion import com.stripe.android.core.Logger -import com.stripe.android.core.injection.IOContext import com.stripe.android.core.networking.ApiRequest import com.stripe.android.core.networking.StripeNetworkClient import com.stripe.android.core.version.StripeSdkVersion -import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.domain.HandleError import com.stripe.android.financialconnections.domain.RealHandleError import com.stripe.android.financialconnections.features.accountpicker.AccountPickerSubcomponent @@ -37,12 +35,9 @@ import com.stripe.android.uicore.image.StripeImageLoader import dagger.Binds import dagger.Module import dagger.Provides -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.SupervisorJob import java.util.Locale import javax.inject.Named import javax.inject.Singleton -import kotlin.coroutines.CoroutineContext @Module( subcomponents = [ @@ -162,13 +157,9 @@ internal interface FinancialConnectionsSheetNativeModule { @Singleton @Provides fun providesPartnerToCoreAuthsRepository( - logger: Logger, - @IOContext workContext: CoroutineContext, - analyticsTracker: FinancialConnectionsAnalyticsTracker + logger: Logger ) = CoreAuthorizationPendingNetworkingRepairRepository( - coroutineScope = CoroutineScope(SupervisorJob() + workContext), - logger = logger, - analyticsTracker = analyticsTracker + logger = logger ) @Provides diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorPreviewParameterProvider.kt index 48a5f15f9be..cae4a302420 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorPreviewParameterProvider.kt @@ -1,9 +1,9 @@ package com.stripe.android.financialconnections.features.error import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success import com.stripe.android.core.exception.APIException +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success import com.stripe.android.financialconnections.exception.InstitutionPlannedDowntimeError import com.stripe.android.financialconnections.exception.InstitutionUnplannedDowntimeError import com.stripe.android.financialconnections.model.FinancialConnectionsInstitution diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorScreen.kt index 4172af0fba5..4131bfb5290 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorScreen.kt @@ -2,15 +2,16 @@ package com.stripe.android.financialconnections.features.error import androidx.activity.compose.BackHandler import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.exception.InstitutionPlannedDowntimeError import com.stripe.android.financialconnections.exception.InstitutionUnplannedDowntimeError import com.stripe.android.financialconnections.exception.PartnerAuthError @@ -26,12 +27,12 @@ import com.stripe.android.financialconnections.ui.components.FinancialConnection @Composable internal fun ErrorScreen() { - val viewModel: ErrorViewModel = mavericksViewModel() + val viewModel: ErrorViewModel = paneViewModel(ErrorViewModel.Companion::factory) val parentViewModel = parentViewModel() BackHandler(true) { } - val payload = viewModel.collectAsState { it.payload } + val state by viewModel.stateFlow.collectAsState() ErrorContent( - payload = payload.value, + payload = state.payload, onManualEntryClick = viewModel::onManualEntryClick, onSelectBankClick = viewModel::onSelectAnotherBank, onCloseFromErrorClick = parentViewModel::onCloseFromErrorClick diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorViewModel.kt index a84e837f654..51e028ff8e6 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorViewModel.kt @@ -1,14 +1,16 @@ package com.stripe.android.financialconnections.features.error -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.core.Logger import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.GetManifest import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator.Message @@ -17,7 +19,6 @@ import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.PopUpToBehavior import com.stripe.android.financialconnections.repository.FinancialConnectionsErrorRepository -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import kotlinx.coroutines.launch import javax.inject.Inject @@ -29,7 +30,7 @@ internal class ErrorViewModel @Inject constructor( private val eventTracker: FinancialConnectionsAnalyticsTracker, private val navigationManager: NavigationManager, private val logger: Logger -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { init { logErrors() @@ -83,7 +84,7 @@ internal class ErrorViewModel @Inject constructor( fun onSelectAnotherBank() = viewModelScope.launch { kotlin.runCatching { - val payload = requireNotNull(awaitState().payload()) + val payload = requireNotNull(stateFlow.value.payload()) if (payload.disableLinkMoreAccounts) { close(payload.error) } else { @@ -99,19 +100,17 @@ internal class ErrorViewModel @Inject constructor( super.onCleared() } - companion object : MavericksViewModelFactory { + companion object { - override fun create( - viewModelContext: ViewModelContext, - state: ErrorState - ): ErrorViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .errorSubcomponent - .create(state) - .viewModel - } + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = + viewModelFactory { + initializer { + parentComponent + .errorSubcomponent + .create(ErrorState()) + .viewModel + } + } internal val PANE = Pane.UNEXPECTED_ERROR } @@ -119,7 +118,7 @@ internal class ErrorViewModel @Inject constructor( internal data class ErrorState( val payload: Async = Uninitialized -) : MavericksState { +) { data class Payload( val error: Throwable, val disableLinkMoreAccounts: Boolean, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/exit/ExitModal.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/exit/ExitModal.kt index 8862c8d17c0..7017055f218 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/exit/ExitModal.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/exit/ExitModal.kt @@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.size import androidx.compose.material.Surface import androidx.compose.material.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource @@ -14,9 +15,8 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.navigation.NavBackStackEntry -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel import com.stripe.android.financialconnections.R +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.ShapedIcon import com.stripe.android.financialconnections.ui.TextResource import com.stripe.android.financialconnections.ui.components.FinancialConnectionsButton @@ -29,9 +29,11 @@ import com.stripe.android.financialconnections.ui.theme.Layout internal fun ExitModal( backStackEntry: NavBackStackEntry ) { - val viewModel: ExitViewModel = mavericksViewModel(argsFactory = { backStackEntry.arguments }) + val viewModel: ExitViewModel = paneViewModel { + ExitViewModel.factory(it, backStackEntry.arguments) + } - val state by viewModel.collectAsState() + val state by viewModel.stateFlow.collectAsState() state.payload()?.let { ExitModalContent( description = it.description, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/exit/ExitViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/exit/ExitViewModel.kt index 37e98ec4c34..c6a6a21827c 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/exit/ExitViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/exit/ExitViewModel.kt @@ -1,16 +1,17 @@ package com.stripe.android.financialconnections.features.exit import android.os.Bundle -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.core.Logger import com.stripe.android.financialconnections.R import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.GetManifest import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator.Message @@ -18,7 +19,6 @@ import com.stripe.android.financialconnections.features.common.getBusinessName import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.navigation.NavigationManager -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.ui.TextResource import kotlinx.coroutines.launch import javax.inject.Inject @@ -30,7 +30,7 @@ internal class ExitViewModel @Inject constructor( private val eventTracker: FinancialConnectionsAnalyticsTracker, private val navigationManager: NavigationManager, private val logger: Logger -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { init { logErrors() @@ -38,7 +38,7 @@ internal class ExitViewModel @Inject constructor( val manifest = kotlin.runCatching { getManifest() }.getOrNull() val businessName = manifest?.getBusinessName() val isNetworkingSignupPane = - manifest?.isNetworkingUserFlow == true && awaitState().referrer == Pane.NETWORKING_LINK_SIGNUP_PANE + manifest?.isNetworkingUserFlow == true && stateFlow.value.referrer == Pane.NETWORKING_LINK_SIGNUP_PANE val description = when { isNetworkingSignupPane -> when (businessName) { null -> TextResource.StringId(R.string.stripe_close_dialog_networking_desc_no_business) @@ -85,18 +85,15 @@ internal class ExitViewModel @Inject constructor( ) } - companion object : MavericksViewModelFactory { + companion object { - override fun create( - viewModelContext: ViewModelContext, - state: ExitState - ): ExitViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .exitSubcomponent - .create(state) - .viewModel + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent, arguments: Bundle?) = viewModelFactory { + initializer { + parentComponent + .exitSubcomponent + .create(ExitState(arguments)) + .viewModel + } } internal val PANE = Pane.EXIT @@ -107,7 +104,7 @@ internal data class ExitState( val referrer: Pane?, val payload: Async, val closing: Boolean -) : MavericksState { +) { data class Payload( val description: TextResource, ) diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerPreviewParameterProvider.kt index 72d201d2f8f..4e54d9cb033 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerPreviewParameterProvider.kt @@ -1,8 +1,8 @@ package com.stripe.android.financialconnections.features.linkaccountpicker import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success import com.stripe.android.financialconnections.features.common.MerchantDataAccessModel import com.stripe.android.financialconnections.model.AddNewAccount import com.stripe.android.financialconnections.model.Bullet diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerScreen.kt index e71952527ad..5f8f4c4a482 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerScreen.kt @@ -28,6 +28,7 @@ import androidx.compose.material.Text import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.collectAsState import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment @@ -41,14 +42,13 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel import com.stripe.android.financialconnections.R +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.AccountItem import com.stripe.android.financialconnections.features.common.DataAccessBottomSheetContent import com.stripe.android.financialconnections.features.common.LoadingShimmerEffect @@ -94,9 +94,9 @@ import kotlinx.coroutines.launch */ @Composable internal fun LinkAccountPickerScreen() { - val viewModel: LinkAccountPickerViewModel = mavericksViewModel() + val viewModel: LinkAccountPickerViewModel = paneViewModel { LinkAccountPickerViewModel.factory(it) } val parentViewModel = parentViewModel() - val state = viewModel.collectAsState() + val state = viewModel.stateFlow.collectAsState() BackHandler(enabled = true) {} val bottomSheetState = rememberModalBottomSheetState( diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerViewModel.kt index 23d34ae0a2a..6ab2f792de5 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerViewModel.kt @@ -1,11 +1,9 @@ package com.stripe.android.financialconnections.features.linkaccountpicker -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.core.Logger import com.stripe.android.financialconnections.FinancialConnections import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent @@ -15,6 +13,10 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Name import com.stripe.android.financialconnections.analytics.logError +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.FetchNetworkedAccounts import com.stripe.android.financialconnections.domain.GetCachedConsumerSession import com.stripe.android.financialconnections.domain.GetOrFetchSync @@ -34,7 +36,6 @@ import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.destination import com.stripe.android.financialconnections.repository.CoreAuthorizationPendingNetworkingRepairRepository -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.ui.HandleClickableUrl import kotlinx.coroutines.launch import java.util.Date @@ -53,7 +54,7 @@ internal class LinkAccountPickerViewModel @Inject constructor( private val getSync: GetOrFetchSync, private val navigationManager: NavigationManager, private val logger: Logger -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { init { observeAsyncs() @@ -141,12 +142,12 @@ internal class LinkAccountPickerViewModel @Inject constructor( fun onNewBankAccountClick() = viewModelScope.launch { eventTracker.track(Click("click.new_account", PANE)) - val nextPane = awaitState().payload()?.nextPaneOnNewAccount ?: Pane.INSTITUTION_PICKER + val nextPane = stateFlow.value.payload()?.nextPaneOnNewAccount ?: Pane.INSTITUTION_PICKER navigationManager.tryNavigateTo(nextPane.destination(referrer = PANE)) } fun onSelectAccountClick() = suspend { - val state = awaitState() + val state = stateFlow.value val payload = requireNotNull(state.payload()) val (account, _) = requireNotNull(payload.accounts.first { it.first.id == state.selectedAccountId }) @@ -200,23 +201,20 @@ internal class LinkAccountPickerViewModel @Inject constructor( setState { copy(viewEffect = null) } } - companion object : - MavericksViewModelFactory { + companion object { internal val PANE = Pane.LINK_ACCOUNT_PICKER - override fun create( - viewModelContext: ViewModelContext, - state: LinkAccountPickerState - ): LinkAccountPickerViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .linkAccountPickerSubcomponent - .initialState(state) - .build() - .viewModel - } + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = + viewModelFactory { + initializer { + parentComponent + .linkAccountPickerSubcomponent + .initialState(LinkAccountPickerState()) + .build() + .viewModel + } + } } } @@ -225,7 +223,7 @@ internal data class LinkAccountPickerState( val selectNetworkedAccountAsync: Async = Uninitialized, val selectedAccountId: String? = null, val viewEffect: ViewEffect? = null -) : MavericksState { +) { data class Payload( val title: String, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationPreviewParameterProvider.kt index fb2bb75c8d3..28b11c2f2f3 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationPreviewParameterProvider.kt @@ -1,10 +1,10 @@ package com.stripe.android.financialconnections.features.linkstepupverification import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.domain.ConfirmVerification import com.stripe.android.uicore.elements.IdentifierSpec import com.stripe.android.uicore.elements.OTPController diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationScreen.kt index b8c2d9298ed..6a04c242f84 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationScreen.kt @@ -14,6 +14,7 @@ import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.collectAsState import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -24,13 +25,12 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel import com.stripe.android.financialconnections.R +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.domain.ConfirmVerification.OTPError import com.stripe.android.financialconnections.features.common.FullScreenGenericLoading import com.stripe.android.financialconnections.features.common.LoadingSpinner @@ -52,9 +52,11 @@ import com.stripe.android.financialconnections.ui.theme.LazyLayout @Composable internal fun LinkStepUpVerificationScreen() { - val viewModel: LinkStepUpVerificationViewModel = mavericksViewModel() + val viewModel: LinkStepUpVerificationViewModel = paneViewModel { + LinkStepUpVerificationViewModel.factory(it) + } val parentViewModel = parentViewModel() - val state = viewModel.collectAsState() + val state = viewModel.stateFlow.collectAsState() BackHandler(enabled = true) {} LinkStepUpVerificationContent( state = state.value, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationViewModel.kt index 64e308810be..206e691e6d2 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationViewModel.kt @@ -1,14 +1,9 @@ package com.stripe.android.financialconnections.features.linkstepupverification -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider.Factory +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.core.Logger import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.VerificationStepUpError import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.VerificationStepUpError.Error.ConsumerNotFoundError @@ -18,6 +13,13 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.VerificationStepUpSuccess import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.ConfirmVerification import com.stripe.android.financialconnections.domain.GetCachedAccounts import com.stripe.android.financialconnections.domain.GetManifest @@ -31,7 +33,6 @@ import com.stripe.android.financialconnections.model.FinancialConnectionsSession import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.navigation.Destination.InstitutionPicker import com.stripe.android.financialconnections.navigation.NavigationManager -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.model.ConsumerSession import com.stripe.android.model.VerificationType import com.stripe.android.uicore.elements.IdentifierSpec @@ -55,7 +56,7 @@ internal class LinkStepUpVerificationViewModel @Inject constructor( private val updateCachedAccounts: UpdateCachedAccounts, private val navigationManager: NavigationManager, private val logger: Logger -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { init { logErrors() @@ -133,7 +134,7 @@ internal class LinkStepUpVerificationViewModel @Inject constructor( } private fun onOTPEntered(otp: String) = suspend { - val payload = requireNotNull(awaitState().payload()) + val payload = requireNotNull(stateFlow.value.payload()) // Confirm email. confirmVerification.email( consumerSessionClientSecret = payload.consumerSessionClientSecret, @@ -203,21 +204,18 @@ internal class LinkStepUpVerificationViewModel @Inject constructor( ) } - companion object : - MavericksViewModelFactory { - - override fun create( - viewModelContext: ViewModelContext, - state: LinkStepUpVerificationState - ): LinkStepUpVerificationViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .linkStepUpVerificationSubcomponent - .initialState(state) - .build() - .viewModel - } + companion object { + + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): Factory = + viewModelFactory { + initializer { + parentComponent + .linkStepUpVerificationSubcomponent + .initialState(LinkStepUpVerificationState()) + .build() + .viewModel + } + } private const val CLICKABLE_TEXT_RESEND_CODE = "resend_code" internal val PANE = Pane.LINK_STEP_UP_VERIFICATION @@ -228,7 +226,7 @@ internal data class LinkStepUpVerificationState( val payload: Async = Uninitialized, val confirmVerification: Async = Uninitialized, val resendOtp: Async = Uninitialized, -) : MavericksState { +) { val submitLoading: Boolean get() = confirmVerification is Loading || resendOtp is Loading diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryPreviewParameterProvider.kt index 54999334329..245d7ea518e 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryPreviewParameterProvider.kt @@ -1,12 +1,12 @@ package com.stripe.android.financialconnections.features.manualentry import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized import com.stripe.android.core.exception.APIException import com.stripe.android.financialconnections.R +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.features.manualentry.ManualEntryPreviewParameterProvider.PreviewState internal class ManualEntryPreviewParameterProvider : PreviewParameterProvider { diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryScreen.kt index c9f093bc31e..b12a7a9abb2 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryScreen.kt @@ -24,15 +24,14 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel import com.stripe.android.core.exception.StripeException import com.stripe.android.financialconnections.R +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.FullScreenGenericLoading import com.stripe.android.financialconnections.features.common.UnclassifiedErrorContent import com.stripe.android.financialconnections.features.manualentry.ManualEntryPreviewParameterProvider.PreviewState @@ -52,16 +51,18 @@ import com.stripe.android.financialconnections.ui.theme.Layout @Composable internal fun ManualEntryScreen() { - val viewModel: ManualEntryViewModel = mavericksViewModel() + val viewModel: ManualEntryViewModel = paneViewModel { + ManualEntryViewModel.factory(it) + } val parentViewModel = parentViewModel() - val state: ManualEntryState by viewModel.collectAsState() + val state: ManualEntryState by viewModel.stateFlow.collectAsState() val form by viewModel.form.collectAsState() ManualEntryContent( - routing = viewModel.routing ?: "", + routing = viewModel.routing, routingError = form.routingError, - account = viewModel.account ?: "", + account = viewModel.account, accountError = form.accountError, - accountConfirm = viewModel.accountConfirm ?: "", + accountConfirm = viewModel.accountConfirm, accountConfirmError = form.accountConfirmError, isValidForm = form.isValid, payload = state.payload, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryViewModel.kt index 1cb782327ad..a4e661653f6 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryViewModel.kt @@ -4,17 +4,19 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import androidx.compose.runtime.snapshotFlow -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.core.Logger import com.stripe.android.financialconnections.R import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.PaneLoaded import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.GetOrFetchSync import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator.Message.Complete @@ -27,7 +29,6 @@ import com.stripe.android.financialconnections.model.PaymentAccountParams import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.repository.SuccessContentRepository -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.ui.TextResource import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow @@ -44,7 +45,7 @@ internal class ManualEntryViewModel @Inject constructor( private val getOrFetchSync: GetOrFetchSync, private val navigationManager: NavigationManager, private val logger: Logger -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { // Keep form fields outside of State for immediate updates. private var _routing: String? by mutableStateOf(null) @@ -158,21 +159,18 @@ internal class ManualEntryViewModel @Inject constructor( onSubmit() } - companion object : - MavericksViewModelFactory { - - override fun create( - viewModelContext: ViewModelContext, - state: ManualEntryState - ): ManualEntryViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .manualEntryBuilder - .initialState(state) - .build() - .viewModel - } + companion object { + + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = + viewModelFactory { + initializer { + parentComponent + .manualEntryBuilder + .initialState(ManualEntryState()) + .build() + .viewModel + } + } private val PANE = Pane.MANUAL_ENTRY } @@ -181,7 +179,7 @@ internal class ManualEntryViewModel @Inject constructor( internal data class ManualEntryState( val payload: Async = Uninitialized, val linkPaymentAccount: Async = Uninitialized -) : MavericksState { +) { data class Payload( val verifyWithMicrodeposits: Boolean, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupPreviewParameterProvider.kt index f5b2cc3c40d..35d195d4a16 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupPreviewParameterProvider.kt @@ -1,10 +1,10 @@ package com.stripe.android.financialconnections.features.networkinglinkloginwarmup import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized internal class NetworkingLinkLoginWarmupPreviewParameterProvider : PreviewParameterProvider { diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupScreen.kt index 51ad34ccf7a..012ead6045f 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupScreen.kt @@ -18,6 +18,7 @@ import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi @@ -33,10 +34,9 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import androidx.navigation.NavBackStackEntry -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel import com.stripe.android.financialconnections.R +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.ShapedIcon import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview import com.stripe.android.financialconnections.ui.components.FinancialConnectionsButton @@ -50,10 +50,10 @@ import com.stripe.android.financialconnections.ui.theme.LinkColors internal fun NetworkingLinkLoginWarmupScreen( backStackEntry: NavBackStackEntry, ) { - val viewModel: NetworkingLinkLoginWarmupViewModel = mavericksViewModel( - argsFactory = { backStackEntry.arguments }, - ) - val state by viewModel.collectAsState() + val viewModel: NetworkingLinkLoginWarmupViewModel = paneViewModel { + NetworkingLinkLoginWarmupViewModel.factory(it, backStackEntry.arguments) + } + val state by viewModel.stateFlow.collectAsState() NetworkingLinkLoginWarmupContent( state = state, onSkipClicked = viewModel::onSkipClicked, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupViewModel.kt index 30be9b816aa..82da8bc4864 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupViewModel.kt @@ -1,15 +1,17 @@ package com.stripe.android.financialconnections.features.networkinglinkloginwarmup import android.os.Bundle -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider.Factory +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.Click import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.PaneLoaded import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.DisableNetworking import com.stripe.android.financialconnections.domain.GetManifest import com.stripe.android.financialconnections.domain.HandleError @@ -21,7 +23,6 @@ import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.PopUpToBehavior import com.stripe.android.financialconnections.navigation.destination -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import kotlinx.coroutines.launch import javax.inject.Inject @@ -32,7 +33,7 @@ internal class NetworkingLinkLoginWarmupViewModel @Inject constructor( private val getManifest: GetManifest, private val disableNetworking: DisableNetworking, private val navigationManager: NavigationManager -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { init { logErrors() @@ -93,7 +94,7 @@ internal class NetworkingLinkLoginWarmupViewModel @Inject constructor( // Skipping disables networking, which means we don't want the user to navigate back to // the warm-up pane. Since the warmup pane is displayed as a bottom sheet, we need to // pop up all the way to the pane that opened it. - val referrer = awaitState().referrer + val referrer = stateFlow.value.referrer return if (referrer != null) { PopUpToBehavior.Route( @@ -106,23 +107,20 @@ internal class NetworkingLinkLoginWarmupViewModel @Inject constructor( } } - companion object : - MavericksViewModelFactory { + companion object { internal val PANE = Pane.NETWORKING_LINK_LOGIN_WARMUP - override fun create( - viewModelContext: ViewModelContext, - state: NetworkingLinkLoginWarmupState - ): NetworkingLinkLoginWarmupViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .networkingLinkLoginWarmupSubcomponent - .initialState(state) - .build() - .viewModel - } + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent, arguments: Bundle?): Factory = + viewModelFactory { + initializer { + parentComponent + .networkingLinkLoginWarmupSubcomponent + .initialState(NetworkingLinkLoginWarmupState(arguments)) + .build() + .viewModel + } + } } } @@ -130,9 +128,8 @@ internal data class NetworkingLinkLoginWarmupState( val referrer: Pane? = null, val payload: Async = Uninitialized, val disableNetworkingAsync: Async = Uninitialized, -) : MavericksState { +) { - @Suppress("unused") // used by mavericks to create initial state. constructor(args: Bundle?) : this( referrer = Destination.referrer(args), payload = Uninitialized, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupPreviewParameterProvider.kt index e40f4e89a7d..76f6b34895c 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupPreviewParameterProvider.kt @@ -1,8 +1,8 @@ package com.stripe.android.financialconnections.features.networkinglinksignup import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.model.Bullet import com.stripe.android.financialconnections.model.NetworkingLinkSignupBody import com.stripe.android.financialconnections.model.NetworkingLinkSignupPane diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupScreen.kt index 6a15d17b500..488032e4682 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupScreen.kt @@ -22,6 +22,7 @@ import androidx.compose.material.Text import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -42,13 +43,12 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.FullScreenGenericLoading import com.stripe.android.financialconnections.features.common.LegalDetailsBottomSheetContent import com.stripe.android.financialconnections.features.common.ListItem @@ -82,9 +82,9 @@ import kotlinx.coroutines.launch @Composable internal fun NetworkingLinkSignupScreen() { - val viewModel: NetworkingLinkSignupViewModel = mavericksViewModel() + val viewModel: NetworkingLinkSignupViewModel = paneViewModel(NetworkingLinkSignupViewModel.Companion::factory) val parentViewModel = parentViewModel() - val state = viewModel.collectAsState() + val state = viewModel.stateFlow.collectAsState() BackHandler(enabled = true) {} val uriHandler = LocalUriHandler.current val bottomSheetState: ModalBottomSheetState = rememberModalBottomSheetState( diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupViewModel.kt index fa62f1bce9c..151ad1a601e 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupViewModel.kt @@ -1,12 +1,10 @@ package com.stripe.android.financialconnections.features.networkinglinksignup import android.webkit.URLUtil -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.core.Logger import com.stripe.android.financialconnections.R import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.Click @@ -15,6 +13,10 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.PaneLoaded import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.GetCachedAccounts import com.stripe.android.financialconnections.domain.GetManifest import com.stripe.android.financialconnections.domain.LookupAccount @@ -27,9 +29,7 @@ import com.stripe.android.financialconnections.model.FinancialConnectionsSession import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.model.NetworkingLinkSignupPane import com.stripe.android.financialconnections.navigation.Destination.NetworkingSaveToLinkVerification -import com.stripe.android.financialconnections.navigation.Destination.Success import com.stripe.android.financialconnections.navigation.NavigationManager -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.utils.ConflatedJob import com.stripe.android.financialconnections.utils.UriUtils import com.stripe.android.financialconnections.utils.isCancellationError @@ -46,6 +46,7 @@ import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.launch import java.util.Date import javax.inject.Inject +import com.stripe.android.financialconnections.navigation.Destination.Success as SuccessDestination internal class NetworkingLinkSignupViewModel @Inject constructor( initialState: NetworkingLinkSignupState, @@ -58,7 +59,7 @@ internal class NetworkingLinkSignupViewModel @Inject constructor( private val sync: SynchronizeFinancialConnectionsSession, private val navigationManager: NavigationManager, private val logger: Logger -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { private var searchJob = ConflatedJob() @@ -114,7 +115,7 @@ internal class NetworkingLinkSignupViewModel @Inject constructor( onAsync( NetworkingLinkSignupState::saveAccountToLink, onSuccess = { - navigationManager.tryNavigateTo(Success(referrer = PANE)) + navigationManager.tryNavigateTo(SuccessDestination(referrer = PANE)) }, onFail = { error -> eventTracker.logError( @@ -123,7 +124,7 @@ internal class NetworkingLinkSignupViewModel @Inject constructor( logger = logger, pane = PANE ) - navigationManager.tryNavigateTo(Success(referrer = PANE)) + navigationManager.tryNavigateTo(SuccessDestination(referrer = PANE)) }, ) } @@ -185,7 +186,7 @@ internal class NetworkingLinkSignupViewModel @Inject constructor( fun onSkipClick() = viewModelScope.launch { eventTracker.track(Click(eventName = "click.not_now", pane = PANE)) - navigationManager.tryNavigateTo(Success(referrer = PANE)) + navigationManager.tryNavigateTo(SuccessDestination(referrer = PANE)) } fun onSaveAccount() { @@ -204,7 +205,7 @@ internal class NetworkingLinkSignupViewModel @Inject constructor( private fun saveNewAccount() { suspend { eventTracker.track(Click(eventName = "click.save_to_link", pane = PANE)) - val state = awaitState() + val state = stateFlow.value val selectedAccounts = getCachedAccounts() val phoneController = state.payload()!!.phoneController require(state.valid) { "Form invalid! ${state.validEmail} ${state.validPhone}" } @@ -230,7 +231,7 @@ internal class NetworkingLinkSignupViewModel @Inject constructor( if (URLUtil.isNetworkUrl(uri)) { setState { copy(viewEffect = OpenUrl(uri, date.time)) } } else { - val managedUri = NetworkingLinkSignupClickableText.values() + val managedUri = NetworkingLinkSignupClickableText.entries .firstOrNull { uriUtils.compareSchemeAuthorityAndPath(it.value, uri) } when (managedUri) { NetworkingLinkSignupClickableText.LEGAL_DETAILS -> { @@ -256,21 +257,18 @@ internal class NetworkingLinkSignupViewModel @Inject constructor( setState { copy(viewEffect = null) } } - companion object : - MavericksViewModelFactory { + companion object { - override fun create( - viewModelContext: ViewModelContext, - state: NetworkingLinkSignupState - ): NetworkingLinkSignupViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .networkingLinkSignupSubcomponent - .initialState(state) - .build() - .viewModel - } + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = + viewModelFactory { + initializer { + parentComponent + .networkingLinkSignupSubcomponent + .initialState(NetworkingLinkSignupState()) + .build() + .viewModel + } + } private const val SEARCH_DEBOUNCE_MS = 1000L private const val SEARCH_DEBOUNCE_FINISHED_EMAIL_MS = 300L @@ -285,7 +283,7 @@ internal data class NetworkingLinkSignupState( val saveAccountToLink: Async = Uninitialized, val lookupAccount: Async = Uninitialized, val viewEffect: ViewEffect? = null -) : MavericksState { +) { val showFullForm: Boolean get() = lookupAccount()?.let { !it.exists } ?: false diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationPreviewParameterProvider.kt index 31360bf707c..933048eef09 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationPreviewParameterProvider.kt @@ -1,10 +1,10 @@ package com.stripe.android.financialconnections.features.networkinglinkverification import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.domain.ConfirmVerification import com.stripe.android.uicore.elements.IdentifierSpec import com.stripe.android.uicore.elements.OTPController diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationScreen.kt index cc83a54f60f..f25965f07a1 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationScreen.kt @@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.size import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.collectAsState import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -21,14 +22,13 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel import com.stripe.android.financialconnections.R +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.domain.ConfirmVerification.OTPError import com.stripe.android.financialconnections.features.common.FullScreenGenericLoading import com.stripe.android.financialconnections.features.common.LoadingSpinner @@ -45,9 +45,9 @@ import com.stripe.android.financialconnections.ui.theme.LazyLayout @Composable internal fun NetworkingLinkVerificationScreen() { - val viewModel: NetworkingLinkVerificationViewModel = mavericksViewModel() + val viewModel: NetworkingLinkVerificationViewModel = paneViewModel(NetworkingLinkVerificationViewModel::factory) val parentViewModel = parentViewModel() - val state = viewModel.collectAsState() + val state = viewModel.stateFlow.collectAsState() NetworkingLinkVerificationContent( state = state.value, onCloseClick = { parentViewModel.onCloseWithConfirmationClick(Pane.NETWORKING_LINK_VERIFICATION) }, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationViewModel.kt index e1b96ee38fb..315c0cb5a94 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationViewModel.kt @@ -1,14 +1,9 @@ package com.stripe.android.financialconnections.features.networkinglinkverification -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.core.Logger import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.VerificationError import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.VerificationError.Error.ConsumerNotFoundError @@ -18,6 +13,13 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.VerificationSuccess import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.ConfirmVerification import com.stripe.android.financialconnections.domain.GetManifest import com.stripe.android.financialconnections.domain.LookupConsumerAndStartVerification @@ -30,7 +32,6 @@ import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.navigation.Destination.InstitutionPicker import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.destination -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.model.ConsumerSession import com.stripe.android.model.VerificationType import com.stripe.android.uicore.elements.IdentifierSpec @@ -50,7 +51,7 @@ internal class NetworkingLinkVerificationViewModel @Inject constructor( private val analyticsTracker: FinancialConnectionsAnalyticsTracker, private val lookupConsumerAndStartVerification: LookupConsumerAndStartVerification, private val logger: Logger -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { init { observeAsyncs() @@ -121,7 +122,7 @@ internal class NetworkingLinkVerificationViewModel @Inject constructor( } private fun onOTPEntered(otp: String) = suspend { - val payload = requireNotNull(awaitState().payload()) + val payload = requireNotNull(stateFlow.value.payload()) confirmVerification.sms( consumerSessionClientSecret = payload.consumerSessionClientSecret, verificationCode = otp @@ -150,21 +151,18 @@ internal class NetworkingLinkVerificationViewModel @Inject constructor( ) }.execute { copy(confirmVerification = it) } - companion object : - MavericksViewModelFactory { + companion object { - override fun create( - viewModelContext: ViewModelContext, - state: NetworkingLinkVerificationState - ): NetworkingLinkVerificationViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .networkingLinkVerificationSubcomponent - .initialState(state) - .build() - .viewModel - } + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = + viewModelFactory { + initializer { + parentComponent + .networkingLinkVerificationSubcomponent + .initialState(NetworkingLinkVerificationState()) + .build() + .viewModel + } + } internal val PANE = Pane.NETWORKING_LINK_VERIFICATION } @@ -173,7 +171,7 @@ internal class NetworkingLinkVerificationViewModel @Inject constructor( internal data class NetworkingLinkVerificationState( val payload: Async = Uninitialized, val confirmVerification: Async = Uninitialized -) : MavericksState { +) { data class Payload( val email: String, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationPreviewParameterProvider.kt index e7e9e059b06..1f1512d6d53 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationPreviewParameterProvider.kt @@ -1,10 +1,10 @@ package com.stripe.android.financialconnections.features.networkingsavetolinkverification import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.domain.ConfirmVerification import com.stripe.android.uicore.elements.IdentifierSpec import com.stripe.android.uicore.elements.OTPController diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationScreen.kt index 756fa62a4e5..ed0820704f7 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationScreen.kt @@ -13,6 +13,7 @@ import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.collectAsState import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -23,14 +24,13 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel import com.stripe.android.financialconnections.R +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.domain.ConfirmVerification import com.stripe.android.financialconnections.features.common.FullScreenGenericLoading import com.stripe.android.financialconnections.features.common.LoadingSpinner @@ -49,9 +49,11 @@ import com.stripe.android.financialconnections.ui.theme.LazyLayout @Composable internal fun NetworkingSaveToLinkVerificationScreen() { - val viewModel: NetworkingSaveToLinkVerificationViewModel = mavericksViewModel() + val viewModel: NetworkingSaveToLinkVerificationViewModel = paneViewModel { + NetworkingSaveToLinkVerificationViewModel.factory(it) + } val parentViewModel = parentViewModel() - val state = viewModel.collectAsState() + val state = viewModel.stateFlow.collectAsState() NetworkingSaveToLinkVerificationContent( state = state.value, onCloseClick = { parentViewModel.onCloseWithConfirmationClick(PANE) }, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationViewModel.kt index 930e2e807ff..c6cf2fab426 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationViewModel.kt @@ -1,11 +1,9 @@ package com.stripe.android.financialconnections.features.networkingsavetolinkverification -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewModelScope +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.core.Logger import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.PaneLoaded import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.VerificationError @@ -14,6 +12,10 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.VerificationSuccess import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.ConfirmVerification import com.stripe.android.financialconnections.domain.ConfirmVerification.OTPError import com.stripe.android.financialconnections.domain.GetCachedAccounts @@ -23,9 +25,7 @@ import com.stripe.android.financialconnections.domain.MarkLinkVerified import com.stripe.android.financialconnections.domain.SaveAccountToLink import com.stripe.android.financialconnections.domain.StartVerification import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane -import com.stripe.android.financialconnections.navigation.Destination.Success import com.stripe.android.financialconnections.navigation.NavigationManager -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.uicore.elements.IdentifierSpec import com.stripe.android.uicore.elements.OTPController import com.stripe.android.uicore.elements.OTPElement @@ -33,6 +33,7 @@ import getRedactedPhoneNumber import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.launch import javax.inject.Inject +import com.stripe.android.financialconnections.navigation.Destination.Success as SuccessDestination internal class NetworkingSaveToLinkVerificationViewModel @Inject constructor( initialState: NetworkingSaveToLinkVerificationState, @@ -46,7 +47,7 @@ internal class NetworkingSaveToLinkVerificationViewModel @Inject constructor( private val saveAccountToLink: SaveAccountToLink, private val navigationManager: NavigationManager, private val logger: Logger -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { init { logErrors() @@ -93,7 +94,7 @@ internal class NetworkingSaveToLinkVerificationViewModel @Inject constructor( onAsync( NetworkingSaveToLinkVerificationState::confirmVerification, onSuccess = { - navigationManager.tryNavigateTo(Success(referrer = PANE)) + navigationManager.tryNavigateTo(SuccessDestination(referrer = PANE)) }, onFail = { error -> eventTracker.logError( @@ -103,14 +104,14 @@ internal class NetworkingSaveToLinkVerificationViewModel @Inject constructor( pane = PANE ) if (error !is OTPError) { - navigationManager.tryNavigateTo(Success(referrer = PANE)) + navigationManager.tryNavigateTo(SuccessDestination(referrer = PANE)) } }, ) } private fun onOTPEntered(otp: String) = suspend { - val payload = requireNotNull(awaitState().payload()) + val payload = requireNotNull(stateFlow.value.payload()) runCatching { confirmVerification.sms( @@ -133,33 +134,30 @@ internal class NetworkingSaveToLinkVerificationViewModel @Inject constructor( }.execute { copy(confirmVerification = it) } fun onSkipClick() { - navigationManager.tryNavigateTo(Success(referrer = PANE)) + navigationManager.tryNavigateTo(SuccessDestination(referrer = PANE)) } - companion object : - MavericksViewModelFactory { + companion object { internal val PANE = Pane.NETWORKING_SAVE_TO_LINK_VERIFICATION - override fun create( - viewModelContext: ViewModelContext, - state: NetworkingSaveToLinkVerificationState - ): NetworkingSaveToLinkVerificationViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .networkingSaveToLinkVerificationSubcomponent - .initialState(state) - .build() - .viewModel - } + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = + viewModelFactory { + initializer { + parentComponent + .networkingSaveToLinkVerificationSubcomponent + .initialState(NetworkingSaveToLinkVerificationState()) + .build() + .viewModel + } + } } } internal data class NetworkingSaveToLinkVerificationState( val payload: Async = Uninitialized, val confirmVerification: Async = Uninitialized -) : MavericksState { +) { data class Payload( val showNotNowButton: Boolean, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/reset/ResetScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/reset/ResetScreen.kt index aa47165a687..f3ab3a47c96 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/reset/ResetScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/reset/ResetScreen.kt @@ -2,14 +2,15 @@ package com.stripe.android.financialconnections.features.reset import androidx.activity.compose.BackHandler import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue import androidx.compose.ui.tooling.preview.Preview -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.compose.collectAsState -import com.airbnb.mvrx.compose.mavericksViewModel +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Fail +import com.stripe.android.financialconnections.core.Async.Loading +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.FullScreenGenericLoading import com.stripe.android.financialconnections.features.common.UnclassifiedErrorContent import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane @@ -20,12 +21,14 @@ import com.stripe.android.financialconnections.ui.components.FinancialConnection @Composable internal fun ResetScreen() { - val viewModel: ResetViewModel = mavericksViewModel() + val viewModel: ResetViewModel = paneViewModel { + ResetViewModel.factory(it) + } val parentViewModel = parentViewModel() - val payload = viewModel.collectAsState { it.payload } + val state by viewModel.stateFlow.collectAsState() BackHandler(enabled = true) {} ResetContent( - payload = payload.value, + payload = state.payload, onCloseClick = { parentViewModel.onCloseWithConfirmationClick(Pane.RESET) }, onCloseFromErrorClick = parentViewModel::onCloseFromErrorClick ) diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/reset/ResetViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/reset/ResetViewModel.kt index 6fda1929291..1a4bf7bdbb8 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/reset/ResetViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/reset/ResetViewModel.kt @@ -1,15 +1,16 @@ package com.stripe.android.financialconnections.features.reset -import com.airbnb.mvrx.Async -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.Uninitialized -import com.airbnb.mvrx.ViewModelContext +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.core.Logger import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.PaneLoaded import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError +import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel +import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.LinkMoreAccounts import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator.Message.ClearPartnerWebAuth @@ -17,7 +18,6 @@ import com.stripe.android.financialconnections.model.FinancialConnectionsSession import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.PopUpToBehavior import com.stripe.android.financialconnections.navigation.destination -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import javax.inject.Inject internal class ResetViewModel @Inject constructor( @@ -27,7 +27,7 @@ internal class ResetViewModel @Inject constructor( private val eventTracker: FinancialConnectionsAnalyticsTracker, private val navigationManager: NavigationManager, private val logger: Logger -) : MavericksViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState) { init { logErrors() @@ -56,20 +56,18 @@ internal class ResetViewModel @Inject constructor( ) } - companion object : MavericksViewModelFactory { + companion object { - override fun create( - viewModelContext: ViewModelContext, - state: ResetState - ): ResetViewModel { - return viewModelContext.activity() - .viewModel - .activityRetainedComponent - .resetSubcomponent - .initialState(state) - .build() - .viewModel - } + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = + viewModelFactory { + initializer { + parentComponent + .resetSubcomponent + .initialState(ResetState()) + .build() + .viewModel + } + } internal val PANE = Pane.RESET } @@ -77,4 +75,4 @@ internal class ResetViewModel @Inject constructor( internal data class ResetState( val payload: Async = Uninitialized -) : MavericksState +) diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/CoreAuthorizationPendingNetworkingRepairRepository.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/CoreAuthorizationPendingNetworkingRepairRepository.kt index 0cb2693fdf4..c406c40e527 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/CoreAuthorizationPendingNetworkingRepairRepository.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/CoreAuthorizationPendingNetworkingRepairRepository.kt @@ -1,49 +1,24 @@ package com.stripe.android.financialconnections.repository -import com.airbnb.mvrx.MavericksRepository import com.airbnb.mvrx.MavericksState -import com.stripe.android.core.BuildConfig import com.stripe.android.core.Logger -import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker -import com.stripe.android.financialconnections.analytics.logError -import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane -import com.stripe.android.financialconnections.repository.CoreAuthorizationPendingNetworkingRepairRepository.State -import kotlinx.coroutines.CoroutineScope /** * Repository for storing the core authorization pending repair. * */ internal class CoreAuthorizationPendingNetworkingRepairRepository( - coroutineScope: CoroutineScope, - private val logger: Logger, - private val analyticsTracker: FinancialConnectionsAnalyticsTracker -) : MavericksRepository( - initialState = State(), - coroutineScope = coroutineScope, - performCorrectnessValidations = BuildConfig.DEBUG, + private val logger: Logger ) { - suspend fun get() = runCatching { - awaitState().coreAuthorization - }.onFailure { - analyticsTracker.logError( - "Failed to get core authorization", - logger = logger, - pane = Pane.UNEXPECTED_ERROR, - error = it - ) - }.getOrNull() + private var state: State = State() + + fun get() = state.coreAuthorization - fun set(coreAuthorization: String) = runCatching { + fun set(coreAuthorization: String) { logger.debug("core authorization set to $coreAuthorization") - setState { copy(coreAuthorization = coreAuthorization) } - }.onFailure { - analyticsTracker.logError( - "Failed to set core authorization", - logger = logger, - pane = Pane.UNEXPECTED_ERROR, - error = it + state = state.copy( + coreAuthorization = coreAuthorization ) } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/utils/MavericksExtensions.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/utils/MavericksExtensions.kt index ed0c55c723c..ebf20bbf907 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/utils/MavericksExtensions.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/utils/MavericksExtensions.kt @@ -1,45 +1,14 @@ package com.stripe.android.financialconnections.utils import androidx.activity.ComponentActivity -import com.airbnb.mvrx.ActivityViewModelContext import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.InternalMavericksApi import com.airbnb.mvrx.Loading import com.airbnb.mvrx.Mavericks -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel -import com.airbnb.mvrx.MavericksViewModelFactory -import com.airbnb.mvrx.MavericksViewModelProvider import com.stripe.android.core.exception.StripeException import com.stripe.android.financialconnections.core.Async import kotlinx.coroutines.CancellationException import kotlin.properties.ReadOnlyProperty -import kotlin.reflect.KClass import kotlin.reflect.KProperty -import com.airbnb.mvrx.Async as MvrxAsync - -/** - * Replicates [com.airbnb.mvrx.viewModel] delegate, but without using [com.airbnb.mvrx.lifecycleAwareLazy] - * to eagerly initialize the ViewModel in [ComponentActivity.onCreate]. - * - * Some [MavericksViewModelFactory] implementations assume args are correct to instantiate - * the viewModel, and the associated Dagger graph. - * - * This allows onCreate to check args and verify they're valid before accessing (and instantiating) - * the viewModel. - */ -@OptIn(InternalMavericksApi::class) -internal inline fun , reified S : MavericksState> T.viewModelLazy( - viewModelClass: KClass = VM::class, - crossinline keyFactory: () -> String = { viewModelClass.java.name } -): Lazy where T : ComponentActivity = lazy { - MavericksViewModelProvider.get( - viewModelClass = viewModelClass.java, - stateClass = S::class.java, - viewModelContext = ActivityViewModelContext(this, intent.extras?.get(Mavericks.KEY_ARG)), - key = keyFactory() - ) -} /** * Replicates [com.airbnb.mvrx.argsOrNull] for [ComponentActivity]. @@ -64,13 +33,6 @@ internal fun argsOrNull() = object : ReadOnlyProperty * Prevents [CancellationException] to map to [Fail] when coroutine being cancelled * due to search query changes. In these cases, re-map the [Async] instance to [Loading] */ -internal fun MvrxAsync<*>.isCancellationError(): Boolean = when { - this !is Fail -> false - error is CancellationException -> true - error is StripeException && error.cause is CancellationException -> true - else -> false -} - internal fun Async<*>.isCancellationError(): Boolean = when { this !is Async.Fail -> false error is CancellationException -> true diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/CoroutineTestRule.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/CoroutineTestRule.kt index fdf557caa3f..4b8e785143b 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/CoroutineTestRule.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/CoroutineTestRule.kt @@ -3,6 +3,7 @@ package com.stripe.android.financialconnections import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.TestDispatcher +import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.resetMain import kotlinx.coroutines.test.setMain import org.junit.rules.TestWatcher @@ -10,7 +11,7 @@ import org.junit.runner.Description @ExperimentalCoroutinesApi class CoroutineTestRule( - private val testDispatcher: TestDispatcher, + private val testDispatcher: TestDispatcher = UnconfinedTestDispatcher(), ) : TestWatcher() { override fun starting(description: Description) { diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModelTest.kt index ece09b1851f..49e8ece65e9 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModelTest.kt @@ -1,6 +1,5 @@ package com.stripe.android.financialconnections.features.accountpicker -import com.airbnb.mvrx.test.MavericksTestRule import com.google.common.truth.Truth.assertThat import com.stripe.android.core.Logger import com.stripe.android.financialconnections.ApiKeyFixtures.authorizationSession @@ -8,6 +7,7 @@ import com.stripe.android.financialconnections.ApiKeyFixtures.partnerAccount import com.stripe.android.financialconnections.ApiKeyFixtures.partnerAccountList import com.stripe.android.financialconnections.ApiKeyFixtures.sessionManifest import com.stripe.android.financialconnections.ApiKeyFixtures.syncResponse +import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.core.withState import com.stripe.android.financialconnections.domain.GetOrFetchSync @@ -29,7 +29,7 @@ import kotlin.test.assertEquals internal class AccountPickerViewModelTest { @get:Rule - val mavericksTestRule = MavericksTestRule() + val testRule = CoroutineTestRule() private val pollAuthorizationSessionAccounts = mock() private val getSync = mock() diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerViewModelTest.kt index cb28ed3c8a1..a54c1047b9a 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerViewModelTest.kt @@ -1,12 +1,12 @@ package com.stripe.android.financialconnections.features.linkaccountpicker -import com.airbnb.mvrx.test.MavericksTestRule import com.google.common.truth.Truth.assertThat import com.stripe.android.core.Logger import com.stripe.android.financialconnections.ApiKeyFixtures.consumerSession import com.stripe.android.financialconnections.ApiKeyFixtures.institution import com.stripe.android.financialconnections.ApiKeyFixtures.partnerAccount import com.stripe.android.financialconnections.ApiKeyFixtures.syncResponse +import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.domain.FetchNetworkedAccounts import com.stripe.android.financialconnections.domain.GetCachedConsumerSession @@ -42,7 +42,7 @@ import org.mockito.kotlin.whenever class LinkAccountPickerViewModelTest { @get:Rule - val mavericksTestRule = MavericksTestRule() + val testRule = CoroutineTestRule() private val getSync = mock() private val navigationManager = TestNavigationManager() @@ -93,7 +93,7 @@ class LinkAccountPickerViewModelTest { val viewModel = buildViewModel(LinkAccountPickerState()) - assertThat(viewModel.awaitState().payload()!!.accounts) + assertThat(viewModel.stateFlow.value.payload()!!.accounts) .isEqualTo( listOf( partnerAccount().copy(id = "id1", _allowSelection = null) to diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationViewModelTest.kt index e80a1039808..607c171af72 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationViewModelTest.kt @@ -1,13 +1,14 @@ package com.stripe.android.financialconnections.features.linkstepupverification -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.test.MavericksTestRule +import app.cash.turbine.test import com.google.common.truth.Truth.assertThat import com.stripe.android.core.Logger import com.stripe.android.financialconnections.ApiKeyFixtures import com.stripe.android.financialconnections.ApiKeyFixtures.partnerAccount import com.stripe.android.financialconnections.ApiKeyFixtures.sessionManifest +import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker +import com.stripe.android.financialconnections.core.Async.Loading import com.stripe.android.financialconnections.domain.ConfirmVerification import com.stripe.android.financialconnections.domain.GetCachedAccounts import com.stripe.android.financialconnections.domain.GetManifest @@ -37,7 +38,7 @@ import org.mockito.kotlin.whenever @ExperimentalCoroutinesApi class LinkStepUpVerificationViewModelTest { @get:Rule - val mavericksTestRule = MavericksTestRule() + val testRule = CoroutineTestRule() private val getManifest = mock() private val navigationManager = TestNavigationManager() @@ -92,7 +93,7 @@ class LinkStepUpVerificationViewModelTest { onStartVerificationCaptor.firstValue() onVerificationStartedCaptor.firstValue(consumerSession) - val state = viewModel.awaitState() + val state = viewModel.stateFlow.value assertThat(state.payload()!!.consumerSessionClientSecret) .isEqualTo(consumerSession.clientSecret) @@ -103,39 +104,41 @@ class LinkStepUpVerificationViewModelTest { val email = "test@test.com" val onConsumerNotFoundCaptor = argumentCaptor Unit>() - whenever(getManifest()).thenReturn( - sessionManifest().copy(accountholderCustomerEmailAddress = email) - ) + whenever(getManifest()) + .thenReturn(sessionManifest().copy(accountholderCustomerEmailAddress = email)) - val viewModel = buildViewModel() + buildViewModel().stateFlow.test { + assertThat(awaitItem().payload).isInstanceOf(Loading::class.java) - assertThat(viewModel.awaitState().payload).isInstanceOf(Loading::class.java) + verify(lookupConsumerAndStartVerification).invoke( + email = eq(email), + businessName = anyOrNull(), + verificationType = eq(VerificationType.EMAIL), + onConsumerNotFound = onConsumerNotFoundCaptor.capture(), + onLookupError = any(), + onStartVerification = any(), + onVerificationStarted = any(), + onStartVerificationError = any() + ) - verify(lookupConsumerAndStartVerification).invoke( - email = eq(email), - businessName = anyOrNull(), - verificationType = eq(VerificationType.EMAIL), - onConsumerNotFound = onConsumerNotFoundCaptor.capture(), - onLookupError = any(), - onStartVerification = any(), - onVerificationStarted = any(), - onStartVerificationError = any() - ) + onConsumerNotFoundCaptor.firstValue() - onConsumerNotFoundCaptor.firstValue() + // we don't expect any state updates if the consumer is not found + expectNoEvents() - assertThat(viewModel.awaitState().payload).isInstanceOf(Loading::class.java) - navigationManager.assertNavigatedTo( - destination = Destination.InstitutionPicker, - pane = Pane.LINK_STEP_UP_VERIFICATION - ) - eventTracker.assertContainsEvent( - "linked_accounts.networking.verification.step_up.error", - mapOf( - "pane" to "networking_link_step_up_verification", - "error" to "ConsumerNotFoundError" + navigationManager.assertNavigatedTo( + destination = Destination.InstitutionPicker, + pane = Pane.LINK_STEP_UP_VERIFICATION ) - ) + + eventTracker.assertContainsEvent( + "linked_accounts.networking.verification.step_up.error", + mapOf( + "pane" to "networking_link_step_up_verification", + "error" to "ConsumerNotFoundError" + ) + ) + } } @Test @@ -173,7 +176,7 @@ class LinkStepUpVerificationViewModelTest { onStartVerificationCaptor.firstValue() onVerificationStartedCaptor.firstValue(consumerSession) - val otpController = viewModel.awaitState().payload()!!.otpElement.controller + val otpController = viewModel.stateFlow.value.payload()!!.otpElement.controller // enters valid OTP for (i in 0 until otpController.otpLength) { diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryViewModelTest.kt index ae58c50283f..af3d08488ec 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryViewModelTest.kt @@ -1,14 +1,14 @@ package com.stripe.android.financialconnections.features.manualentry import app.cash.turbine.test -import com.airbnb.mvrx.Success -import com.airbnb.mvrx.test.MavericksTestRule -import com.airbnb.mvrx.withState import com.google.common.truth.Truth.assertThat import com.stripe.android.core.Logger import com.stripe.android.financialconnections.ApiKeyFixtures.sessionManifest import com.stripe.android.financialconnections.ApiKeyFixtures.syncResponse +import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker +import com.stripe.android.financialconnections.core.Async.Success +import com.stripe.android.financialconnections.core.withState import com.stripe.android.financialconnections.domain.GetOrFetchSync import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator.Message.Complete @@ -18,6 +18,7 @@ import com.stripe.android.financialconnections.features.manualentry.ManualEntryS import com.stripe.android.financialconnections.mock.TestSuccessContentRepository import com.stripe.android.financialconnections.model.ManualEntryMode import com.stripe.android.financialconnections.utils.TestNavigationManager +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.test.runTest import org.junit.Rule @@ -26,9 +27,10 @@ import org.mockito.kotlin.mock import org.mockito.kotlin.whenever import kotlin.test.assertEquals +@ExperimentalCoroutinesApi class ManualEntryViewModelTest { @get:Rule - val mavericksTestRule = MavericksTestRule() + val testRule = CoroutineTestRule() private val getSync = mock() private val navigationManager = TestNavigationManager() diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupViewModelTest.kt index cfa88956807..df07bf53c38 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupViewModelTest.kt @@ -1,7 +1,7 @@ package com.stripe.android.financialconnections.features.networkinglinkloginwarmup -import com.airbnb.mvrx.test.MavericksTestRule import com.stripe.android.financialconnections.ApiKeyFixtures +import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.domain.DisableNetworking import com.stripe.android.financialconnections.domain.GetManifest @@ -11,6 +11,7 @@ import com.stripe.android.financialconnections.navigation.PopUpToBehavior import com.stripe.android.financialconnections.navigation.destination import com.stripe.android.financialconnections.utils.TestHandleError import com.stripe.android.financialconnections.utils.TestNavigationManager +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Rule import org.junit.Test @@ -18,10 +19,11 @@ import org.mockito.kotlin.mock import org.mockito.kotlin.verify import org.mockito.kotlin.whenever +@ExperimentalCoroutinesApi class NetworkingLinkLoginWarmupViewModelTest { @get:Rule - val mavericksTestRule = MavericksTestRule() + val testRule = CoroutineTestRule() private val getManifest = mock() private val navigationManager = TestNavigationManager() diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupViewModelTest.kt index 26874861129..7137d1c547b 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupViewModelTest.kt @@ -1,11 +1,11 @@ package com.stripe.android.financialconnections.features.networkinglinksignup import app.cash.turbine.test -import com.airbnb.mvrx.test.MavericksTestRule import com.google.common.truth.Truth.assertThat import com.stripe.android.core.Logger import com.stripe.android.financialconnections.ApiKeyFixtures import com.stripe.android.financialconnections.ApiKeyFixtures.syncResponse +import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.domain.GetCachedAccounts import com.stripe.android.financialconnections.domain.GetManifest @@ -23,7 +23,6 @@ import com.stripe.android.financialconnections.utils.UriUtils import com.stripe.android.model.ConsumerSessionLookup import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.first -import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.Rule import org.junit.Test @@ -36,10 +35,8 @@ import org.mockito.kotlin.whenever @OptIn(ExperimentalCoroutinesApi::class) class NetworkingLinkSignupViewModelTest { - private val testDispatcher = UnconfinedTestDispatcher() - @get:Rule - val mavericksTestRule = MavericksTestRule(testDispatcher = testDispatcher) + val testRule = CoroutineTestRule() private val getManifest = mock() private val eventTracker = TestFinancialConnectionsAnalyticsTracker() @@ -83,7 +80,7 @@ class NetworkingLinkSignupViewModelTest { whenever(lookupAccount(any())).thenReturn(ConsumerSessionLookup(exists = false)) val viewModel = buildViewModel(NetworkingLinkSignupState()) - val state = viewModel.awaitState() + val state = viewModel.stateFlow.value val payload = requireNotNull(state.payload()) assertThat(payload.emailController.fieldValue.first()).isEqualTo("test@test.com") } @@ -106,7 +103,7 @@ class NetworkingLinkSignupViewModelTest { val viewModel = buildViewModel(NetworkingLinkSignupState()) navigationManager.navigationFlow.test { - val state = viewModel.awaitState() + val state = viewModel.stateFlow.value val payload = requireNotNull(state.payload()) payload.emailController.onValueChange("email@email.com") @@ -138,7 +135,7 @@ class NetworkingLinkSignupViewModelTest { val viewModel = buildViewModel(NetworkingLinkSignupState()) navigationManager.navigationFlow.test { - val state = viewModel.awaitState() + val state = viewModel.stateFlow.value val payload = requireNotNull(state.payload()) payload.emailController.onValueChange("email@email.com") diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationViewModelTest.kt index 7a5d35a0088..e25635dd70f 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationViewModelTest.kt @@ -1,13 +1,13 @@ package com.stripe.android.financialconnections.features.networkinglinkverification -import com.airbnb.mvrx.Loading -import com.airbnb.mvrx.test.MavericksTestRule import com.google.common.truth.Truth.assertThat import com.stripe.android.core.Logger import com.stripe.android.core.exception.LocalStripeException import com.stripe.android.financialconnections.ApiKeyFixtures.consumerSession import com.stripe.android.financialconnections.ApiKeyFixtures.sessionManifest +import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker +import com.stripe.android.financialconnections.core.Async.Loading import com.stripe.android.financialconnections.domain.ConfirmVerification import com.stripe.android.financialconnections.domain.GetManifest import com.stripe.android.financialconnections.domain.LookupConsumerAndStartVerification @@ -34,7 +34,7 @@ import org.mockito.kotlin.whenever class NetworkingLinkVerificationViewModelTest { @get:Rule - val mavericksTestRule = MavericksTestRule() + val testRule = CoroutineTestRule() private val getManifest = mock() private val navigationManager = TestNavigationManager() @@ -69,7 +69,7 @@ class NetworkingLinkVerificationViewModelTest { val viewModel = buildViewModel() - assertThat(viewModel.awaitState().payload).isInstanceOf(Loading::class.java) + assertThat(viewModel.stateFlow.value.payload).isInstanceOf(Loading::class.java) verify(lookupConsumerAndStartVerification).invoke( email = eq(email), @@ -85,7 +85,7 @@ class NetworkingLinkVerificationViewModelTest { onStartVerificationCaptor.firstValue() onVerificationStartedCaptor.firstValue(consumerSession) - val state = viewModel.awaitState() + val state = viewModel.stateFlow.value assertThat(state.payload()!!.consumerSessionClientSecret) .isEqualTo(consumerSession.clientSecret) } @@ -101,7 +101,7 @@ class NetworkingLinkVerificationViewModelTest { val viewModel = buildViewModel() - assertThat(viewModel.awaitState().payload).isInstanceOf(Loading::class.java) + assertThat(viewModel.stateFlow.value.payload).isInstanceOf(Loading::class.java) verify(lookupConsumerAndStartVerification).invoke( email = eq(email), @@ -116,7 +116,7 @@ class NetworkingLinkVerificationViewModelTest { onConsumerNotFoundCaptor.firstValue() - assertThat(viewModel.awaitState().payload).isInstanceOf(Loading::class.java) + assertThat(viewModel.stateFlow.value.payload).isInstanceOf(Loading::class.java) navigationManager.assertNavigatedTo( destination = Destination.InstitutionPicker, pane = NETWORKING_LINK_VERIFICATION @@ -162,7 +162,7 @@ class NetworkingLinkVerificationViewModelTest { onStartVerificationCaptor.firstValue() onVerificationStartedCaptor.firstValue(consumerSession) - val otpController = viewModel.awaitState().payload()!!.otpElement.controller + val otpController = viewModel.stateFlow.value.payload()!!.otpElement.controller // enters valid OTP for (i in 0 until otpController.otpLength) { @@ -214,7 +214,7 @@ class NetworkingLinkVerificationViewModelTest { onStartVerificationCaptor.firstValue() onVerificationStartedCaptor.firstValue(consumerSession) - val otpController = viewModel.awaitState().payload()!!.otpElement.controller + val otpController = viewModel.stateFlow.value.payload()!!.otpElement.controller // enters valid OTP for (i in 0 until otpController.otpLength) { diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationViewModelTest.kt index bedcfda26db..15854211ce9 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationViewModelTest.kt @@ -1,11 +1,11 @@ package com.stripe.android.financialconnections.features.networkingsavetolinkverification -import com.airbnb.mvrx.test.MavericksTestRule import com.google.common.truth.Truth.assertThat import com.stripe.android.core.Logger import com.stripe.android.financialconnections.ApiKeyFixtures.consumerSession import com.stripe.android.financialconnections.ApiKeyFixtures.partnerAccount import com.stripe.android.financialconnections.ApiKeyFixtures.sessionManifest +import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.domain.ConfirmVerification import com.stripe.android.financialconnections.domain.GetCachedAccounts @@ -33,7 +33,7 @@ import org.mockito.kotlin.whenever class NetworkingSaveToLinkVerificationViewModelTest { @get:Rule - val mavericksTestRule = MavericksTestRule() + val testRule = CoroutineTestRule() private val navigationManager = TestNavigationManager() private val confirmVerification = mock() @@ -69,7 +69,7 @@ class NetworkingSaveToLinkVerificationViewModelTest { val viewModel = buildViewModel() - val state = viewModel.awaitState() + val state = viewModel.stateFlow.value verify(startVerification).sms(consumerSession.clientSecret) assertThat(state.payload()!!.consumerSessionClientSecret) .isEqualTo(consumerSession.clientSecret) @@ -88,14 +88,14 @@ class NetworkingSaveToLinkVerificationViewModelTest { val viewModel = buildViewModel() - val otpController = viewModel.awaitState().payload()!!.otpElement.controller + val otpController = viewModel.stateFlow.value.payload()!!.otpElement.controller // enters valid OTP for (i in 0 until otpController.otpLength) { otpController.onValueChanged(i, "1") } - val state = viewModel.awaitState() + val state = viewModel.stateFlow.value verify(saveAccountToLink).existing( eq(state.payload()!!.consumerSessionClientSecret), eq(listOf(selectedAccount.id)) @@ -128,14 +128,14 @@ class NetworkingSaveToLinkVerificationViewModelTest { val viewModel = buildViewModel() - val otpController = viewModel.awaitState().payload()!!.otpElement.controller + val otpController = viewModel.stateFlow.value.payload()!!.otpElement.controller // enters valid OTP for (i in 0 until otpController.otpLength) { otpController.onValueChanged(i, "1") } - val state = viewModel.awaitState() + val state = viewModel.stateFlow.value verify(saveAccountToLink).existing( eq(state.payload()!!.consumerSessionClientSecret), eq(listOf(selectedAccount.id)) diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthViewModelTest.kt index ec4e31078ca..cfcdc987839 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthViewModelTest.kt @@ -1,6 +1,5 @@ package com.stripe.android.financialconnections.features.partnerauth -import com.airbnb.mvrx.test.MavericksTestRule import com.google.common.truth.Truth.assertThat import com.stripe.android.core.Logger import com.stripe.android.core.exception.APIException @@ -8,6 +7,7 @@ import com.stripe.android.financialconnections.ApiKeyFixtures.authorizationSessi import com.stripe.android.financialconnections.ApiKeyFixtures.institution import com.stripe.android.financialconnections.ApiKeyFixtures.sessionManifest import com.stripe.android.financialconnections.ApiKeyFixtures.syncResponse +import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.analytics.AuthSessionEvent import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.domain.CancelAuthorizationSession @@ -25,7 +25,6 @@ import com.stripe.android.financialconnections.utils.TestHandleError import com.stripe.android.financialconnections.utils.TestNavigationManager import com.stripe.android.financialconnections.utils.UriUtils import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.Rule import org.junit.Test @@ -36,12 +35,12 @@ import org.mockito.kotlin.verify import org.mockito.kotlin.verifyNoInteractions import org.mockito.kotlin.whenever -@OptIn(ExperimentalCoroutinesApi::class) @Suppress("MaxLineLength") +@ExperimentalCoroutinesApi internal class PartnerAuthViewModelTest { @get:Rule - val mavericksTestRule = MavericksTestRule(testDispatcher = UnconfinedTestDispatcher()) + val testRule = CoroutineTestRule() private val applicationId = "com.sample.applicationid" private val getSync = mock() diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/success/SuccessViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/success/SuccessViewModelTest.kt index 20f257b85e0..82f54805f7f 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/success/SuccessViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/success/SuccessViewModelTest.kt @@ -1,10 +1,10 @@ package com.stripe.android.financialconnections.features.success import app.cash.turbine.test -import com.airbnb.mvrx.test.MavericksTestRule import com.google.common.truth.Truth.assertThat import com.stripe.android.core.Logger import com.stripe.android.financialconnections.ApiKeyFixtures +import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.PaneLoaded import com.stripe.android.financialconnections.domain.GetCachedAccounts @@ -15,7 +15,6 @@ import com.stripe.android.financialconnections.mock.TestSuccessContentRepository import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.MutableSharedFlow -import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest import org.junit.Rule import org.junit.Test @@ -27,10 +26,8 @@ import kotlin.test.assertEquals @Suppress("MaxLineLength") internal class SuccessViewModelTest { - private val testDispatcher = UnconfinedTestDispatcher() - @get:Rule - val mavericksRule = MavericksTestRule(testDispatcher = testDispatcher) + val testRule = CoroutineTestRule() private val getManifest = mock() private val eventTracker = TestFinancialConnectionsAnalyticsTracker() diff --git a/paymentsheet-example/dependencies/dependencies.txt b/paymentsheet-example/dependencies/dependencies.txt index 32f683a3591..69cbcd62dd0 100644 --- a/paymentsheet-example/dependencies/dependencies.txt +++ b/paymentsheet-example/dependencies/dependencies.txt @@ -1123,15 +1123,6 @@ | | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 -> 1.9.10 (*) | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:{require 1.6.4; reject _} -> 1.7.3 (*) | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 -> 1.9.10 (*) -| +--- com.airbnb.android:mavericks-compose:3.0.9 -| | +--- androidx.lifecycle:lifecycle-common-java8:{require 2.6.1; reject _} -> 2.7.0 (*) -| | +--- androidx.fragment:fragment:{require 1.5.2; reject _} -> 1.6.2 (*) -| | +--- androidx.appcompat:appcompat:{require 1.5.0; reject _} -> 1.6.1 (*) -| | +--- androidx.compose.foundation:foundation:{require 1.2.1; reject _} -> 1.5.4 (*) -| | +--- androidx.compose.ui:ui:{require 1.2.1; reject _} -> 1.5.4 (*) -| | +--- androidx.lifecycle:lifecycle-viewmodel-compose:{require 2.6.1; reject _} -> 2.7.0 (*) -| | +--- com.airbnb.android:mavericks:3.0.9 (*) -| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 -> 1.9.10 (*) | \--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.22 (*) +--- androidx.activity:activity-ktx:1.8.2 (*) +--- androidx.appcompat:appcompat:1.6.1 (*) From e85e1d29413003d5c8f08bc413914ad059b268f1 Mon Sep 17 00:00:00 2001 From: "Carlos M." Date: Tue, 26 Mar 2024 18:29:20 -0700 Subject: [PATCH 4/7] Merge master. --- financial-connections/detekt-baseline.xml | 4 +- .../FinancialConnectionsSheetViewModel.kt | 11 ++- .../core/FinancialConnectionsViewModel.kt | 84 ------------------- .../AccountPickerPreviewParameterProvider.kt | 6 +- .../accountpicker/AccountPickerScreen.kt | 12 +-- .../accountpicker/AccountPickerViewModel.kt | 8 +- .../attachpayment/AttachPaymentScreen.kt | 12 +-- .../attachpayment/AttachPaymentViewModel.kt | 5 +- .../bankauthrepair/BankAuthRepairScreen.kt | 6 +- .../bankauthrepair/BankAuthRepairViewModel.kt | 9 +- .../features/common/SharedPartnerAuth.kt | 14 ++-- .../ConsentPreviewParameterProvider.kt | 2 +- .../features/consent/ConsentScreen.kt | 14 ++-- .../features/consent/ConsentState.kt | 2 +- .../features/consent/ConsentViewModel.kt | 2 - .../error/ErrorPreviewParameterProvider.kt | 4 +- .../features/error/ErrorScreen.kt | 12 +-- .../features/error/ErrorViewModel.kt | 5 +- .../features/exit/ExitModal.kt | 2 +- .../features/exit/ExitViewModel.kt | 6 +- ...stitutionPickerPreviewParameterProvider.kt | 8 +- .../InstitutionPickerScreen.kt | 12 +-- .../InstitutionPickerViewModel.kt | 8 +- ...nkAccountPickerPreviewParameterProvider.kt | 4 +- .../LinkAccountPickerScreen.kt | 12 +-- .../LinkAccountPickerViewModel.kt | 5 +- ...pUpVerificationPreviewParameterProvider.kt | 8 +- .../LinkStepUpVerificationScreen.kt | 10 +-- .../LinkStepUpVerificationViewModel.kt | 12 ++- .../ManualEntryPreviewParameterProvider.kt | 8 +- .../features/manualentry/ManualEntryScreen.kt | 12 +-- .../manualentry/ManualEntryViewModel.kt | 5 +- .../ManualEntrySuccessScreen.kt | 2 +- .../ManualEntrySuccessViewModel.kt | 7 +- ...LinkLoginWarmupPreviewParameterProvider.kt | 8 +- .../NetworkingLinkLoginWarmupScreen.kt | 4 +- .../NetworkingLinkLoginWarmupViewModel.kt | 7 +- ...rkingLinkSignupPreviewParameterProvider.kt | 4 +- .../NetworkingLinkSignupScreen.kt | 12 +-- .../NetworkingLinkSignupViewModel.kt | 6 +- ...inkVerificationPreviewParameterProvider.kt | 8 +- .../NetworkingLinkVerificationScreen.kt | 12 +-- .../NetworkingLinkVerificationViewModel.kt | 12 ++- ...inkVerificationPreviewParameterProvider.kt | 8 +- .../NetworkingSaveToLinkVerificationScreen.kt | 12 +-- ...tworkingSaveToLinkVerificationViewModel.kt | 6 +- .../PartnerAuthPreviewParameterProvider.kt | 6 +- .../features/partnerauth/PartnerAuthScreen.kt | 11 ++- .../partnerauth/PartnerAuthViewModel.kt | 12 ++- .../partnerauth/SharedPartnerAuthState.kt | 19 +++-- .../features/reset/ResetScreen.kt | 14 ++-- .../features/reset/ResetViewModel.kt | 6 +- .../features/success/SuccessContent.kt | 4 +- .../SuccessPreviewParameterProvider.kt | 4 +- .../features/success/SuccessScreen.kt | 3 +- .../features/success/SuccessViewModel.kt | 7 +- .../presentation/Async.kt | 22 +++++ .../ComposeExtensions.kt | 2 +- ...inancialConnectionsSheetNativeViewModel.kt | 27 ++++-- .../FinancialConnectionsViewModel.kt | 69 +++++++++++++-- .../utils/MavericksExtensions.kt | 2 +- .../FinancialConnectionsSheetViewModelTest.kt | 3 +- .../AccountPickerViewModelTest.kt | 2 +- .../InstitutionPickerViewModelTest.kt | 4 +- .../LinkStepUpVerificationViewModelTest.kt | 2 +- .../manualentry/ManualEntryViewModelTest.kt | 4 +- ...NetworkingLinkVerificationViewModelTest.kt | 2 +- ...cialConnectionsSheetNativeViewModelTest.kt | 1 - 68 files changed, 320 insertions(+), 338 deletions(-) delete mode 100644 financial-connections/src/main/java/com/stripe/android/financialconnections/core/FinancialConnectionsViewModel.kt create mode 100644 financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/Async.kt rename financial-connections/src/main/java/com/stripe/android/financialconnections/{core => presentation}/ComposeExtensions.kt (97%) diff --git a/financial-connections/detekt-baseline.xml b/financial-connections/detekt-baseline.xml index 1257a434854..051fcc7763c 100644 --- a/financial-connections/detekt-baseline.xml +++ b/financial-connections/detekt-baseline.xml @@ -22,6 +22,7 @@ MagicNumber:LinkAccountPickerScreen.kt$3 MagicNumber:ManualEntryViewModel.kt$ManualEntryViewModel$4 MagicNumber:SharedPartnerAuth.kt$.50f + MatchingDeclarationName:FinancialConnectionsViewModel.kt$Async<out T> MatchingDeclarationName:ServerDrivenUi.kt$BulletUI MatchingDeclarationName:Type.kt$FinancialConnectionsTypography MaxLineLength:FinancialConnectionsUrls.kt$FinancialConnectionsUrls.DataPolicy$const val merchant = "https://support.stripe.com/user/questions/what-data-does-stripe-access-from-my-linked-financial-account" @@ -30,13 +31,12 @@ MaximumLineLength:com.stripe.android.financialconnections.presentation.FinancialConnectionsUrls.kt:41 MaximumLineLength:com.stripe.android.financialconnections.presentation.FinancialConnectionsUrls.kt:46 MaximumLineLength:com.stripe.android.financialconnections.presentation.FinancialConnectionsUrls.kt:9 - NestedBlockDepth:AccountPickerViewModel.kt$AccountPickerViewModel$fun onAccountClicked(account: PartnerAccount) NestedBlockDepth:InstitutionPickerScreen.kt$private fun LazyListScope.searchResults( isInputEmpty: Boolean, payload: Payload, selectedInstitutionId: String?, onInstitutionSelected: (FinancialConnectionsInstitution, Boolean) -> Unit, institutions: Async<InstitutionResponse>, onManualEntryClick: () -> Unit, onSearchMoreClick: () -> Unit ) SwallowedException:PollAttachPaymentAccount.kt$PollAttachPaymentAccount$e: StripeException SwallowedException:PollAuthorizationSessionAccounts.kt$PollAuthorizationSessionAccounts$e: StripeException SwallowedException:PostAuthorizationSession.kt$PostAuthorizationSession$e: StripeException TooManyFunctions:FinancialConnectionsManifestRepository.kt$FinancialConnectionsManifestRepository TooManyFunctions:FinancialConnectionsManifestRepository.kt$FinancialConnectionsManifestRepositoryImpl : FinancialConnectionsManifestRepository - TooManyFunctions:FinancialConnectionsSheetNativeViewModel.kt$FinancialConnectionsSheetNativeViewModel : FinancialConnectionsViewModel + TooManyFunctions:FinancialConnectionsSheetNativeViewModel.kt$FinancialConnectionsSheetNativeViewModel : FinancialConnectionsViewModelTopAppBarHost diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModel.kt index 295f8df1de8..e2ad22545c3 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModel.kt @@ -26,11 +26,11 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsEve import com.stripe.android.financialconnections.analytics.FinancialConnectionsEventReporter import com.stripe.android.financialconnections.analytics.logError import com.stripe.android.financialconnections.browser.BrowserManager -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.APPLICATION_ID import com.stripe.android.financialconnections.di.DaggerFinancialConnectionsSheetComponent import com.stripe.android.financialconnections.domain.FetchFinancialConnectionsSession import com.stripe.android.financialconnections.domain.FetchFinancialConnectionsSessionForToken +import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator import com.stripe.android.financialconnections.domain.NativeAuthFlowRouter import com.stripe.android.financialconnections.domain.SynchronizeFinancialConnectionsSession import com.stripe.android.financialconnections.exception.AppInitializationError @@ -48,6 +48,8 @@ import com.stripe.android.financialconnections.model.FinancialConnectionsSession import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.model.SynchronizeSessionResponse +import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.utils.parcelable import kotlinx.coroutines.launch @@ -67,8 +69,9 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( private val eventReporter: FinancialConnectionsEventReporter, private val analyticsTracker: FinancialConnectionsAnalyticsTracker, private val nativeRouter: NativeAuthFlowRouter, + nativeAuthFlowCoordinator: NativeAuthFlowCoordinator, initialState: FinancialConnectionsSheetState -) : FinancialConnectionsViewModel(initialState) { +) : FinancialConnectionsViewModel(initialState, nativeAuthFlowCoordinator) { private val mutex = Mutex() @@ -500,4 +503,8 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( internal const val MAX_ACCOUNTS = 100 internal const val QUERY_PARAM_LINKED_ACCOUNT = "linked_account" } + + override fun updateTopAppBar(state: FinancialConnectionsSheetState): TopAppBarStateUpdate? { + return null + } } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/core/FinancialConnectionsViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/core/FinancialConnectionsViewModel.kt deleted file mode 100644 index 60bc999be06..00000000000 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/core/FinancialConnectionsViewModel.kt +++ /dev/null @@ -1,84 +0,0 @@ -package com.stripe.android.financialconnections.core - -import androidx.lifecycle.ViewModel -import androidx.lifecycle.viewModelScope -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized -import kotlinx.coroutines.Job -import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.StateFlow -import kotlinx.coroutines.flow.asStateFlow -import kotlinx.coroutines.flow.distinctUntilChanged -import kotlinx.coroutines.flow.map -import kotlinx.coroutines.flow.update -import kotlinx.coroutines.launch -import kotlin.reflect.KProperty1 - -internal abstract class FinancialConnectionsViewModel( - initialState: S -) : ViewModel() { - - private val _stateFlow: MutableStateFlow = MutableStateFlow(initialState) - val stateFlow: StateFlow = _stateFlow.asStateFlow() - - protected open fun (suspend () -> T).execute( - retainValue: KProperty1>? = null, - reducer: S.(Async) -> S, - ): Job { - return viewModelScope.launch { - setState { reducer(Loading(value = retainValue?.get(this)?.invoke())) } - val result = runCatching { this@execute() } - // update state. - result.fold( - onSuccess = { data -> - setState { reducer(Success(data)) } - }, - onFailure = { throwable -> - setState { reducer(Fail(throwable)) } - } - ) - } - } - - protected fun withState(action: (state: S) -> Unit) = stateFlow.value.let(action) - - protected open fun onAsync( - prop: KProperty1>, - onSuccess: suspend (T) -> Unit = {}, - onFail: suspend (Throwable) -> Unit = {} - ) { - viewModelScope.launch { - stateFlow.map { prop.get(it) } - .distinctUntilChanged() - .collect { async -> - when (async) { - is Success -> onSuccess(async()) - is Fail -> onFail(async.error) - is Loading -> Unit - Uninitialized -> Unit - } - } - } - } - - protected fun setState(reducer: S.() -> S) = _stateFlow.update(reducer) -} - -internal sealed class Async( - private val value: T? -) { - data object Uninitialized : Async(value = null) - data class Loading(val value: T? = null) : Async(value = value) - data class Success(private val value: T) : Async(value = value) { - override operator fun invoke(): T = value - } - - data class Fail(val error: Throwable) : Async(value = null) - - open operator fun invoke(): T? = value -} - -internal fun , B, C> withState(viewModel: A, block: (B) -> C) = - block(viewModel.stateFlow.value) diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerPreviewParameterProvider.kt index a953a90e9a9..0c7c7f0ae9c 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerPreviewParameterProvider.kt @@ -2,9 +2,6 @@ package com.stripe.android.financialconnections.features.accountpicker import androidx.compose.ui.tooling.preview.PreviewParameterProvider import com.stripe.android.core.exception.APIException -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success import com.stripe.android.financialconnections.exception.AccountNoneEligibleForPaymentMethodError import com.stripe.android.financialconnections.features.accountpicker.AccountPickerState.SelectionMode import com.stripe.android.financialconnections.features.common.MerchantDataAccessModel @@ -16,6 +13,9 @@ import com.stripe.android.financialconnections.model.FinancialConnectionsAccount import com.stripe.android.financialconnections.model.FinancialConnectionsInstitution import com.stripe.android.financialconnections.model.Image import com.stripe.android.financialconnections.model.PartnerAccount +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success internal class AccountPickerPreviewParameterProvider : PreviewParameterProvider { diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerScreen.kt index aabe1210f58..0160145bdb2 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerScreen.kt @@ -34,12 +34,6 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import com.stripe.android.financialconnections.R -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.exception.AccountLoadError import com.stripe.android.financialconnections.exception.AccountNoneEligibleForPaymentMethodError import com.stripe.android.financialconnections.features.accountpicker.AccountPickerClickableText.DATA @@ -57,6 +51,12 @@ import com.stripe.android.financialconnections.features.common.UnclassifiedError import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.model.PartnerAccount import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarState +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized +import com.stripe.android.financialconnections.presentation.paneViewModel import com.stripe.android.financialconnections.presentation.parentViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview import com.stripe.android.financialconnections.ui.components.FinancialConnectionsButton diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModel.kt index 1992ed2f843..8e7715c0489 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModel.kt @@ -16,10 +16,6 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Name import com.stripe.android.financialconnections.analytics.logError -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.GetOrFetchSync import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator @@ -39,8 +35,10 @@ import com.stripe.android.financialconnections.navigation.Destination.Reset import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.destination import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.ui.HandleClickableUrl import com.stripe.android.financialconnections.utils.measureTimeMillis import kotlinx.coroutines.launch diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/attachpayment/AttachPaymentScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/attachpayment/AttachPaymentScreen.kt index e9fe416fc55..e47ca0aab81 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/attachpayment/AttachPaymentScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/attachpayment/AttachPaymentScreen.kt @@ -5,12 +5,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.tooling.preview.Preview -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.exception.AccountNumberRetrievalError import com.stripe.android.financialconnections.features.common.AccountNumberRetrievalErrorContent import com.stripe.android.financialconnections.features.common.FullScreenGenericLoading @@ -18,6 +12,12 @@ import com.stripe.android.financialconnections.features.common.UnclassifiedError import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane.ATTACH_LINKED_PAYMENT_ACCOUNT import com.stripe.android.financialconnections.model.LinkAccountSessionPaymentAccount import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarState +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized +import com.stripe.android.financialconnections.presentation.paneViewModel import com.stripe.android.financialconnections.presentation.parentViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview import com.stripe.android.financialconnections.ui.components.FinancialConnectionsScaffold diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/attachpayment/AttachPaymentViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/attachpayment/AttachPaymentViewModel.kt index 26787d79296..314d9ddc461 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/attachpayment/AttachPaymentViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/attachpayment/AttachPaymentViewModel.kt @@ -8,9 +8,6 @@ import com.stripe.android.financialconnections.R import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.PollAttachPaymentsSucceeded import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.GetCachedAccounts import com.stripe.android.financialconnections.domain.GetCachedConsumerSession @@ -25,6 +22,8 @@ import com.stripe.android.financialconnections.navigation.Destination.Reset import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.destination import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel import com.stripe.android.financialconnections.repository.SuccessContentRepository import com.stripe.android.financialconnections.ui.TextResource.PluralId diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairScreen.kt index d038cfc265e..e980c7200f0 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairScreen.kt @@ -3,19 +3,15 @@ package com.stripe.android.financialconnections.features.bankauthrepair import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.runtime.collectAsState -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.SharedPartnerAuth import com.stripe.android.financialconnections.features.partnerauth.SharedPartnerAuthState -import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest -import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane +import com.stripe.android.financialconnections.presentation.paneViewModel @Composable internal fun BankAuthRepairScreen() { // step view model val viewModel: BankAuthRepairViewModel = paneViewModel { BankAuthRepairViewModel.factory(it) } val state: State = viewModel.stateFlow.collectAsState() - TODO manage PANE - argsFactory = { BankAuthRepairViewModel.Args(FinancialConnectionsSessionManifest.Pane.BANK_AUTH_REPAIR) } SharedPartnerAuth( state = state.value, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairViewModel.kt index 642dfe3ed5f..98b2da5de99 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairViewModel.kt @@ -1,15 +1,15 @@ package com.stripe.android.financialconnections.features.bankauthrepair +import android.os.Parcelable import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.viewmodel.initializer import androidx.lifecycle.viewmodel.viewModelFactory -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent +import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator import com.stripe.android.financialconnections.features.partnerauth.SharedPartnerAuthState import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import kotlinx.parcelize.Parcelize import javax.inject.Inject @@ -27,15 +27,14 @@ internal class BankAuthRepairViewModel @Inject constructor( @Parcelize data class Args(val pane: Pane) : Parcelable - TODO args - internal companion object { + internal companion object { fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = viewModelFactory { initializer { parentComponent .bankAuthRepairSubcomponent - .initialState(SharedPartnerAuthState(pane = PANE)) + .initialState(SharedPartnerAuthState(Args(PANE))) .build() .viewModel } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/common/SharedPartnerAuth.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/common/SharedPartnerAuth.kt index 0a233b82b72..43df4b885eb 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/common/SharedPartnerAuth.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/common/SharedPartnerAuth.kt @@ -44,12 +44,6 @@ import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import androidx.compose.ui.viewinterop.AndroidView import com.stripe.android.financialconnections.R -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.collectAsState import com.stripe.android.financialconnections.features.partnerauth.PartnerAuthPreviewParameterProvider import com.stripe.android.financialconnections.features.partnerauth.SharedPartnerAuthState import com.stripe.android.financialconnections.features.partnerauth.SharedPartnerAuthState.AuthenticationStatus @@ -57,9 +51,15 @@ import com.stripe.android.financialconnections.features.partnerauth.SharedPartne import com.stripe.android.financialconnections.features.partnerauth.SharedPartnerAuthState.ViewEffect import com.stripe.android.financialconnections.model.Entry import com.stripe.android.financialconnections.model.OauthPrepane -import com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeState import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarState +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized +import com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeState import com.stripe.android.financialconnections.presentation.WebAuthFlowState +import com.stripe.android.financialconnections.presentation.collectAsState import com.stripe.android.financialconnections.presentation.parentViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview import com.stripe.android.financialconnections.ui.LocalImageLoader diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentPreviewParameterProvider.kt index a95fa1ae314..05d059c9e96 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentPreviewParameterProvider.kt @@ -3,7 +3,6 @@ package com.stripe.android.financialconnections.features.consent import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.ModalBottomSheetValue import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.stripe.android.financialconnections.core.Async.Success import com.stripe.android.financialconnections.model.Bullet import com.stripe.android.financialconnections.model.ConnectedAccessNotice import com.stripe.android.financialconnections.model.ConsentPane @@ -14,6 +13,7 @@ import com.stripe.android.financialconnections.model.Image import com.stripe.android.financialconnections.model.LegalDetailsBody import com.stripe.android.financialconnections.model.LegalDetailsNotice import com.stripe.android.financialconnections.model.ServerLink +import com.stripe.android.financialconnections.presentation.Async.Success @OptIn(ExperimentalMaterialApi::class) internal class ConsentPreviewParameterProvider : diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentScreen.kt index 34f6bddafa7..dc7c4367773 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentScreen.kt @@ -32,12 +32,6 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.DataAccessBottomSheetContent import com.stripe.android.financialconnections.features.common.LegalDetailsBottomSheetContent import com.stripe.android.financialconnections.features.common.ListItem @@ -49,6 +43,12 @@ import com.stripe.android.financialconnections.model.ConsentPane import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarState +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized +import com.stripe.android.financialconnections.presentation.paneViewModel import com.stripe.android.financialconnections.presentation.parentViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview import com.stripe.android.financialconnections.ui.TextResource @@ -124,10 +124,8 @@ private fun ConsentContent( payload = result(), topAppBarState = topAppBarState, bottomSheetMode = state.currentBottomSheet, - acceptConsent = state.acceptConsent, bottomSheetState = bottomSheetState, acceptConsent = state.acceptConsent, - bottomSheetMode = state.currentBottomSheet, onClickableTextClick = onClickableTextClick, onContinueClick = onContinueClick, onCloseClick = onCloseClick, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentState.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentState.kt index b2eb24f1718..18466df6d05 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentState.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentState.kt @@ -1,8 +1,8 @@ package com.stripe.android.financialconnections.features.consent -import com.stripe.android.financialconnections.core.Async import com.stripe.android.financialconnections.model.ConsentPane import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest +import com.stripe.android.financialconnections.presentation.Async internal data class ConsentState( val consent: Async = Async.Uninitialized, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentViewModel.kt index 4a1a71e8181..2f0bdd3bd61 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/consent/ConsentViewModel.kt @@ -11,7 +11,6 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Name import com.stripe.android.financialconnections.analytics.logError -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.AcceptConsent import com.stripe.android.financialconnections.domain.GetOrFetchSync @@ -26,7 +25,6 @@ import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.destination import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.ui.HandleClickableUrl import com.stripe.android.financialconnections.utils.Experiment.CONNECTIONS_CONSENT_COMBINED_LOGO import com.stripe.android.financialconnections.utils.experimentAssignment diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorPreviewParameterProvider.kt index cae4a302420..eae93b97fd3 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorPreviewParameterProvider.kt @@ -2,11 +2,11 @@ package com.stripe.android.financialconnections.features.error import androidx.compose.ui.tooling.preview.PreviewParameterProvider import com.stripe.android.core.exception.APIException -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success import com.stripe.android.financialconnections.exception.InstitutionPlannedDowntimeError import com.stripe.android.financialconnections.exception.InstitutionUnplannedDowntimeError import com.stripe.android.financialconnections.model.FinancialConnectionsInstitution +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success internal class ErrorPreviewParameterProvider : PreviewParameterProvider { diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorScreen.kt index 6e35728788e..09cf24b9236 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorScreen.kt @@ -6,12 +6,6 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.exception.InstitutionPlannedDowntimeError import com.stripe.android.financialconnections.exception.InstitutionUnplannedDowntimeError import com.stripe.android.financialconnections.exception.PartnerAuthError @@ -21,6 +15,12 @@ import com.stripe.android.financialconnections.features.common.InstitutionUnknow import com.stripe.android.financialconnections.features.common.InstitutionUnplannedDowntimeErrorContent import com.stripe.android.financialconnections.features.common.UnclassifiedErrorContent import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarState +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized +import com.stripe.android.financialconnections.presentation.paneViewModel import com.stripe.android.financialconnections.presentation.parentViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview import com.stripe.android.financialconnections.ui.components.FinancialConnectionsScaffold diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorViewModel.kt index f1fafca0281..1e06fcc8ba6 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorViewModel.kt @@ -7,9 +7,6 @@ import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.core.Logger import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.GetManifest import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator @@ -19,6 +16,8 @@ import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.PopUpToBehavior import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel import com.stripe.android.financialconnections.repository.FinancialConnectionsErrorRepository import kotlinx.coroutines.launch diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/exit/ExitModal.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/exit/ExitModal.kt index 7017055f218..2a57914b0e0 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/exit/ExitModal.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/exit/ExitModal.kt @@ -16,8 +16,8 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.navigation.NavBackStackEntry import com.stripe.android.financialconnections.R -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.ShapedIcon +import com.stripe.android.financialconnections.presentation.paneViewModel import com.stripe.android.financialconnections.ui.TextResource import com.stripe.android.financialconnections.ui.components.FinancialConnectionsButton import com.stripe.android.financialconnections.ui.theme.FinancialConnectionsTheme diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/exit/ExitViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/exit/ExitViewModel.kt index 7c57614a95d..b3d93646f69 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/exit/ExitViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/exit/ExitViewModel.kt @@ -8,9 +8,6 @@ import com.stripe.android.core.Logger import com.stripe.android.financialconnections.R import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.GetManifest import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator @@ -20,8 +17,9 @@ import com.stripe.android.financialconnections.model.FinancialConnectionsSession import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.ui.TextResource import kotlinx.coroutines.launch import javax.inject.Inject diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerPreviewParameterProvider.kt index 2e5c1f894f4..0a525ec7dd4 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerPreviewParameterProvider.kt @@ -1,12 +1,12 @@ package com.stripe.android.financialconnections.features.institutionpicker import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.model.FinancialConnectionsInstitution import com.stripe.android.financialconnections.model.InstitutionResponse +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized internal class InstitutionPickerPreviewParameterProvider : PreviewParameterProvider { diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerScreen.kt index d8c2abe573e..a2fbb67e9bb 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerScreen.kt @@ -60,12 +60,6 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import com.stripe.android.financialconnections.R -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.FullScreenGenericLoading import com.stripe.android.financialconnections.features.common.InstitutionIcon import com.stripe.android.financialconnections.features.common.LoadingShimmerEffect @@ -76,6 +70,12 @@ import com.stripe.android.financialconnections.model.FinancialConnectionsInstitu import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.model.InstitutionResponse import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarState +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized +import com.stripe.android.financialconnections.presentation.paneViewModel import com.stripe.android.financialconnections.presentation.parentViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview import com.stripe.android.financialconnections.ui.TextResource diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModel.kt index 8a649afb41b..066736d015d 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModel.kt @@ -16,10 +16,6 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Metadata import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Name import com.stripe.android.financialconnections.analytics.logError -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.FeaturedInstitutions import com.stripe.android.financialconnections.domain.GetOrFetchSync @@ -38,8 +34,10 @@ import com.stripe.android.financialconnections.navigation.Destination.PartnerAut import com.stripe.android.financialconnections.navigation.Destination.PartnerAuthDrawer import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.utils.ConflatedJob import com.stripe.android.financialconnections.utils.isCancellationError import com.stripe.android.financialconnections.utils.measureTimeMillis diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerPreviewParameterProvider.kt index 4e54d9cb033..6638b65d3a2 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerPreviewParameterProvider.kt @@ -1,8 +1,6 @@ package com.stripe.android.financialconnections.features.linkaccountpicker import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success import com.stripe.android.financialconnections.features.common.MerchantDataAccessModel import com.stripe.android.financialconnections.model.AddNewAccount import com.stripe.android.financialconnections.model.Bullet @@ -17,6 +15,8 @@ import com.stripe.android.financialconnections.model.Image import com.stripe.android.financialconnections.model.NetworkedAccount import com.stripe.android.financialconnections.model.PartnerAccount import com.stripe.android.financialconnections.model.ReturningNetworkingUserAccountPicker +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success internal class LinkAccountPickerPreviewParameterProvider : PreviewParameterProvider { diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerScreen.kt index 47142348b78..bac03d3d41e 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerScreen.kt @@ -44,12 +44,6 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import com.stripe.android.financialconnections.R -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.AccountItem import com.stripe.android.financialconnections.features.common.DataAccessBottomSheetContent import com.stripe.android.financialconnections.features.common.LoadingShimmerEffect @@ -64,6 +58,12 @@ import com.stripe.android.financialconnections.model.FinancialConnectionsSession import com.stripe.android.financialconnections.model.NetworkedAccount import com.stripe.android.financialconnections.model.PartnerAccount import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarState +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized +import com.stripe.android.financialconnections.presentation.paneViewModel import com.stripe.android.financialconnections.presentation.parentViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview import com.stripe.android.financialconnections.ui.LocalImageLoader diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerViewModel.kt index d8c6616f6e2..859143c9de7 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkaccountpicker/LinkAccountPickerViewModel.kt @@ -13,9 +13,6 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Name import com.stripe.android.financialconnections.analytics.logError -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.FetchNetworkedAccounts import com.stripe.android.financialconnections.domain.GetCachedConsumerSession @@ -37,6 +34,8 @@ import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.destination import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel import com.stripe.android.financialconnections.repository.CoreAuthorizationPendingNetworkingRepairRepository import com.stripe.android.financialconnections.ui.HandleClickableUrl diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationPreviewParameterProvider.kt index 28b11c2f2f3..b992438746a 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationPreviewParameterProvider.kt @@ -1,11 +1,11 @@ package com.stripe.android.financialconnections.features.linkstepupverification import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.domain.ConfirmVerification +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.uicore.elements.IdentifierSpec import com.stripe.android.uicore.elements.OTPController import com.stripe.android.uicore.elements.OTPElement diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationScreen.kt index 361a2166a7c..2cc693cde8b 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationScreen.kt @@ -27,11 +27,6 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import com.stripe.android.financialconnections.R -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.domain.ConfirmVerification.OTPError import com.stripe.android.financialconnections.features.common.FullScreenGenericLoading import com.stripe.android.financialconnections.features.common.LoadingSpinner @@ -40,6 +35,11 @@ import com.stripe.android.financialconnections.features.common.VerificationSecti import com.stripe.android.financialconnections.features.linkstepupverification.LinkStepUpVerificationState.Payload import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarState +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized +import com.stripe.android.financialconnections.presentation.paneViewModel import com.stripe.android.financialconnections.presentation.parentViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview import com.stripe.android.financialconnections.ui.TextResource diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationViewModel.kt index 27594bb14f6..0fdd225e707 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationViewModel.kt @@ -13,12 +13,6 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.VerificationStepUpSuccess import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.ConfirmVerification import com.stripe.android.financialconnections.domain.GetCachedAccounts @@ -35,8 +29,12 @@ import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.navigation.Destination.InstitutionPicker import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.model.ConsumerSession import com.stripe.android.model.VerificationType import com.stripe.android.uicore.elements.IdentifierSpec diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryPreviewParameterProvider.kt index 245d7ea518e..fccc471c0c3 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryPreviewParameterProvider.kt @@ -3,11 +3,11 @@ package com.stripe.android.financialconnections.features.manualentry import androidx.compose.ui.tooling.preview.PreviewParameterProvider import com.stripe.android.core.exception.APIException import com.stripe.android.financialconnections.R -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.features.manualentry.ManualEntryPreviewParameterProvider.PreviewState +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized internal class ManualEntryPreviewParameterProvider : PreviewParameterProvider { override val values = sequenceOf( diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryScreen.kt index 35acc70fc95..3f8ce5258f9 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryScreen.kt @@ -25,12 +25,6 @@ import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import com.stripe.android.core.exception.StripeException import com.stripe.android.financialconnections.R -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.FullScreenGenericLoading import com.stripe.android.financialconnections.features.common.UnclassifiedErrorContent import com.stripe.android.financialconnections.features.manualentry.ManualEntryPreviewParameterProvider.PreviewState @@ -38,6 +32,12 @@ import com.stripe.android.financialconnections.features.manualentry.ManualEntryS import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.model.LinkAccountSessionPaymentAccount import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarState +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized +import com.stripe.android.financialconnections.presentation.paneViewModel import com.stripe.android.financialconnections.presentation.parentViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview import com.stripe.android.financialconnections.ui.components.FinancialConnectionsButton diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryViewModel.kt index bc8a188bac8..a364dedc0b0 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryViewModel.kt @@ -13,9 +13,6 @@ import com.stripe.android.financialconnections.R import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.PaneLoaded import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.GetOrFetchSync import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator @@ -29,6 +26,8 @@ import com.stripe.android.financialconnections.model.PaymentAccountParams import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel import com.stripe.android.financialconnections.repository.SuccessContentRepository import com.stripe.android.financialconnections.ui.TextResource diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentrysuccess/ManualEntrySuccessScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentrysuccess/ManualEntrySuccessScreen.kt index 79c6dc1e03d..c3c362442e5 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentrysuccess/ManualEntrySuccessScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentrysuccess/ManualEntrySuccessScreen.kt @@ -4,9 +4,9 @@ import androidx.activity.compose.BackHandler import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.success.SuccessContent import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest +import com.stripe.android.financialconnections.presentation.paneViewModel import com.stripe.android.financialconnections.presentation.parentViewModel @Composable diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentrysuccess/ManualEntrySuccessViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentrysuccess/ManualEntrySuccessViewModel.kt index a12304531fa..c1892a4dff2 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentrysuccess/ManualEntrySuccessViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/manualentrysuccess/ManualEntrySuccessViewModel.kt @@ -7,10 +7,6 @@ import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.ClickDone import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.PaneLoaded import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.GetManifest import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator @@ -18,6 +14,9 @@ import com.stripe.android.financialconnections.features.success.SuccessState import com.stripe.android.financialconnections.model.FinancialConnectionsSession import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel import com.stripe.android.financialconnections.repository.SuccessContentRepository import kotlinx.coroutines.launch diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupPreviewParameterProvider.kt index 35d195d4a16..e0429ecb4fe 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupPreviewParameterProvider.kt @@ -1,10 +1,10 @@ package com.stripe.android.financialconnections.features.networkinglinkloginwarmup import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized internal class NetworkingLinkLoginWarmupPreviewParameterProvider : PreviewParameterProvider { diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupScreen.kt index 012ead6045f..bf22d23754e 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupScreen.kt @@ -35,9 +35,9 @@ import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import androidx.navigation.NavBackStackEntry import com.stripe.android.financialconnections.R -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.ShapedIcon +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.paneViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview import com.stripe.android.financialconnections.ui.components.FinancialConnectionsButton import com.stripe.android.financialconnections.ui.components.FinancialConnectionsButton.Type diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupViewModel.kt index c91e9554ee4..7aea28fe243 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkloginwarmup/NetworkingLinkLoginWarmupViewModel.kt @@ -8,9 +8,6 @@ import androidx.lifecycle.viewmodel.viewModelFactory import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.Click import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.PaneLoaded import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.DisableNetworking import com.stripe.android.financialconnections.domain.GetManifest @@ -24,6 +21,10 @@ import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.PopUpToBehavior import com.stripe.android.financialconnections.navigation.destination +import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Uninitialized +import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel import kotlinx.coroutines.launch import javax.inject.Inject diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupPreviewParameterProvider.kt index 76f6b34895c..9cc71a7677b 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupPreviewParameterProvider.kt @@ -1,11 +1,11 @@ package com.stripe.android.financialconnections.features.networkinglinksignup import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.model.Bullet import com.stripe.android.financialconnections.model.NetworkingLinkSignupBody import com.stripe.android.financialconnections.model.NetworkingLinkSignupPane +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.model.ConsumerSessionLookup import com.stripe.android.uicore.elements.EmailConfig import com.stripe.android.uicore.elements.PhoneNumberController diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupScreen.kt index 168a8da711a..d80dbb2b54c 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupScreen.kt @@ -43,12 +43,6 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.FullScreenGenericLoading import com.stripe.android.financialconnections.features.common.LegalDetailsBottomSheetContent import com.stripe.android.financialconnections.features.common.ListItem @@ -59,6 +53,12 @@ import com.stripe.android.financialconnections.features.networkinglinksignup.Net import com.stripe.android.financialconnections.features.networkinglinksignup.NetworkingLinkSignupViewModel.Companion.PANE import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarState +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized +import com.stripe.android.financialconnections.presentation.paneViewModel import com.stripe.android.financialconnections.presentation.parentViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview import com.stripe.android.financialconnections.ui.TextResource diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupViewModel.kt index df79c4dd9c7..7e41731e2ec 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinksignup/NetworkingLinkSignupViewModel.kt @@ -13,9 +13,6 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.PaneLoaded import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.GetCachedAccounts import com.stripe.android.financialconnections.domain.GetManifest @@ -32,8 +29,9 @@ import com.stripe.android.financialconnections.model.NetworkingLinkSignupPane import com.stripe.android.financialconnections.navigation.Destination.NetworkingSaveToLinkVerification import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.financialconnections.utils.ConflatedJob import com.stripe.android.financialconnections.utils.UriUtils import com.stripe.android.financialconnections.utils.isCancellationError diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationPreviewParameterProvider.kt index 933048eef09..e5539f16ed1 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationPreviewParameterProvider.kt @@ -1,11 +1,11 @@ package com.stripe.android.financialconnections.features.networkinglinkverification import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.domain.ConfirmVerification +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.uicore.elements.IdentifierSpec import com.stripe.android.uicore.elements.OTPController import com.stripe.android.uicore.elements.OTPElement diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationScreen.kt index a874e6422d5..848be8f74f5 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationScreen.kt @@ -24,12 +24,6 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import com.stripe.android.financialconnections.R -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.domain.ConfirmVerification.OTPError import com.stripe.android.financialconnections.features.common.FullScreenGenericLoading import com.stripe.android.financialconnections.features.common.LoadingSpinner @@ -38,6 +32,12 @@ import com.stripe.android.financialconnections.features.common.VerificationSecti import com.stripe.android.financialconnections.features.networkinglinkverification.NetworkingLinkVerificationState.Payload import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarState +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized +import com.stripe.android.financialconnections.presentation.paneViewModel import com.stripe.android.financialconnections.presentation.parentViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview import com.stripe.android.financialconnections.ui.components.FinancialConnectionsScaffold diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationViewModel.kt index 573f765cde5..84c4b73002a 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationViewModel.kt @@ -13,12 +13,6 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.VerificationSuccess import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.ConfirmVerification import com.stripe.android.financialconnections.domain.GetManifest @@ -34,8 +28,12 @@ import com.stripe.android.financialconnections.navigation.Destination.Institutio import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.destination import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.model.ConsumerSession import com.stripe.android.model.VerificationType import com.stripe.android.uicore.elements.IdentifierSpec diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationPreviewParameterProvider.kt index 1f1512d6d53..9a36493d90e 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationPreviewParameterProvider.kt @@ -1,11 +1,11 @@ package com.stripe.android.financialconnections.features.networkingsavetolinkverification import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.domain.ConfirmVerification +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.uicore.elements.IdentifierSpec import com.stripe.android.uicore.elements.OTPController import com.stripe.android.uicore.elements.OTPElement diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationScreen.kt index ae8ce78ae18..6e9fcb6b815 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationScreen.kt @@ -26,12 +26,6 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import com.stripe.android.financialconnections.R -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.domain.ConfirmVerification import com.stripe.android.financialconnections.features.common.FullScreenGenericLoading import com.stripe.android.financialconnections.features.common.LoadingSpinner @@ -40,6 +34,12 @@ import com.stripe.android.financialconnections.features.common.VerificationSecti import com.stripe.android.financialconnections.features.networkingsavetolinkverification.NetworkingSaveToLinkVerificationState.Payload import com.stripe.android.financialconnections.features.networkingsavetolinkverification.NetworkingSaveToLinkVerificationViewModel.Companion.PANE import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarState +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized +import com.stripe.android.financialconnections.presentation.paneViewModel import com.stripe.android.financialconnections.presentation.parentViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview import com.stripe.android.financialconnections.ui.components.FinancialConnectionsButton diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationViewModel.kt index 0618e43ea22..c1b168015ab 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/networkingsavetolinkverification/NetworkingSaveToLinkVerificationViewModel.kt @@ -12,9 +12,6 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.VerificationSuccess import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.ConfirmVerification import com.stripe.android.financialconnections.domain.ConfirmVerification.OTPError @@ -28,8 +25,9 @@ import com.stripe.android.financialconnections.domain.StartVerification import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import com.stripe.android.uicore.elements.IdentifierSpec import com.stripe.android.uicore.elements.OTPController import com.stripe.android.uicore.elements.OTPElement diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthPreviewParameterProvider.kt index 064dc7e1bbc..da68ded90d9 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthPreviewParameterProvider.kt @@ -1,9 +1,6 @@ package com.stripe.android.financialconnections.features.partnerauth import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized import com.stripe.android.financialconnections.model.Body import com.stripe.android.financialconnections.model.Cta import com.stripe.android.financialconnections.model.Display @@ -15,6 +12,9 @@ import com.stripe.android.financialconnections.model.Image import com.stripe.android.financialconnections.model.OauthPrepane import com.stripe.android.financialconnections.model.PartnerNotice import com.stripe.android.financialconnections.model.TextUpdate +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized internal class PartnerAuthPreviewParameterProvider : PreviewParameterProvider { diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthScreen.kt index 80a3399e43d..ec5693a85ed 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthScreen.kt @@ -3,15 +3,18 @@ package com.stripe.android.financialconnections.features.partnerauth import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.runtime.collectAsState -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.SharedPartnerAuth -import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane +import com.stripe.android.financialconnections.presentation.paneViewModel @Composable internal fun PartnerAuthScreen(inModal: Boolean) { - argsFactory = { PartnerAuthViewModel.Args(inModal, FinancialConnectionsSessionManifest.Pane.PARTNER_AUTH) } - val viewModel: PartnerAuthViewModel = paneViewModel { PartnerAuthViewModel.factory(it) } + val viewModel: PartnerAuthViewModel = paneViewModel { + PartnerAuthViewModel.factory( + parentComponent = it, + args = PartnerAuthViewModel.Args(inModal, Pane.PARTNER_AUTH) + ) + } val state: State = viewModel.stateFlow.collectAsState() SharedPartnerAuth( diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthViewModel.kt index 098365654cf..2a14a4f35fe 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/PartnerAuthViewModel.kt @@ -22,10 +22,6 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Name import com.stripe.android.financialconnections.analytics.logError import com.stripe.android.financialconnections.browser.BrowserManager -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.APPLICATION_ID import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.CancelAuthorizationSession @@ -54,6 +50,9 @@ import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.PopUpToBehavior import com.stripe.android.financialconnections.navigation.destination import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel import com.stripe.android.financialconnections.presentation.WebAuthFlowState import com.stripe.android.financialconnections.utils.UriUtils @@ -459,13 +458,12 @@ internal class PartnerAuthViewModel @Inject constructor( data class Args(val inModal: Boolean, val pane: Pane) : Parcelable companion object { - TODO Args - fun factory(parentComponent: FinancialConnectionsSheetNativeComponent): ViewModelProvider.Factory = + fun factory(parentComponent: FinancialConnectionsSheetNativeComponent, args: Args): ViewModelProvider.Factory = viewModelFactory { initializer { parentComponent .partnerAuthSubcomponent - .initialState(SharedPartnerAuthState(pane = PANE)) + .initialState(SharedPartnerAuthState(args)) .build() .viewModel } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/SharedPartnerAuthState.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/SharedPartnerAuthState.kt index 645277a7367..8a65a7bd0ee 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/SharedPartnerAuthState.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/partnerauth/SharedPartnerAuthState.kt @@ -1,20 +1,21 @@ package com.stripe.android.financialconnections.features.partnerauth -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.features.bankauthrepair.BankAuthRepairViewModel import com.stripe.android.financialconnections.model.FinancialConnectionsAuthorizationSession import com.stripe.android.financialconnections.model.FinancialConnectionsInstitution import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized internal data class SharedPartnerAuthState( val pane: Pane, - val payload: Async, - val viewEffect: ViewEffect?, - val authenticationStatus: Async, - val inModal: Boolean + val payload: Async = Uninitialized, + val viewEffect: ViewEffect? = null, + val authenticationStatus: Async = Uninitialized, + val inModal: Boolean = false, ) { constructor(args: PartnerAuthViewModel.Args) : this( diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/reset/ResetScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/reset/ResetScreen.kt index 199c8a54ae5..3813a77ab56 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/reset/ResetScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/reset/ResetScreen.kt @@ -5,16 +5,16 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.tooling.preview.Preview -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Fail -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.features.common.FullScreenGenericLoading import com.stripe.android.financialconnections.features.common.UnclassifiedErrorContent import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarState +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Fail +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized +import com.stripe.android.financialconnections.presentation.paneViewModel import com.stripe.android.financialconnections.presentation.parentViewModel import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview import com.stripe.android.financialconnections.ui.components.FinancialConnectionsScaffold @@ -30,7 +30,7 @@ internal fun ResetScreen() { val topAppBarState by parentViewModel.topAppBarState.collectAsState() BackHandler(enabled = true) {} ResetContent( - payload = payload.value, + payload = state.payload, topAppBarState = topAppBarState, onCloseClick = { parentViewModel.onCloseWithConfirmationClick(Pane.RESET) }, onCloseFromErrorClick = parentViewModel::onCloseFromErrorClick diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/reset/ResetViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/reset/ResetViewModel.kt index a29405e334d..c2b9f164b93 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/reset/ResetViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/reset/ResetViewModel.kt @@ -7,9 +7,6 @@ import com.stripe.android.core.Logger import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.PaneLoaded import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.logError -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.LinkMoreAccounts import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator @@ -19,8 +16,9 @@ import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.PopUpToBehavior import com.stripe.android.financialconnections.navigation.destination import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel -import com.stripe.android.financialconnections.ui.FinancialConnectionsSheetNativeActivity import javax.inject.Inject internal class ResetViewModel @Inject constructor( diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessContent.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessContent.kt index bb8b5b2d8a1..ad2dc113861 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessContent.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessContent.kt @@ -41,12 +41,12 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import com.stripe.android.financialconnections.R -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Loading import com.stripe.android.financialconnections.features.common.LoadingSpinner import com.stripe.android.financialconnections.features.success.SuccessState.Payload import com.stripe.android.financialconnections.model.FinancialConnectionsSession import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarState +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Loading import com.stripe.android.financialconnections.ui.FinancialConnectionsPreview import com.stripe.android.financialconnections.ui.TextResource import com.stripe.android.financialconnections.ui.components.AnnotatedText diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessPreviewParameterProvider.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessPreviewParameterProvider.kt index 3a76e491b18..abaa397263b 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessPreviewParameterProvider.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessPreviewParameterProvider.kt @@ -1,8 +1,8 @@ package com.stripe.android.financialconnections.features.success import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.Async.Uninitialized +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.financialconnections.ui.TextResource internal class SuccessPreviewParameterProvider : diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessScreen.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessScreen.kt index 0f840681175..91994b61283 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessScreen.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessScreen.kt @@ -5,9 +5,8 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue -import androidx.compose.runtime.collectAsState -import com.stripe.android.financialconnections.core.paneViewModel import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane +import com.stripe.android.financialconnections.presentation.paneViewModel import com.stripe.android.financialconnections.presentation.parentViewModel @Composable diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessViewModel.kt index 8576381a781..203428ed1ea 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/features/success/SuccessViewModel.kt @@ -8,10 +8,6 @@ import com.stripe.android.core.Logger import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.ClickDone import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsEvent.PaneLoaded import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.Async.Loading -import com.stripe.android.financialconnections.core.Async.Uninitialized -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.domain.GetCachedAccounts import com.stripe.android.financialconnections.domain.GetManifest @@ -21,6 +17,9 @@ import com.stripe.android.financialconnections.features.common.useContinueWithMe import com.stripe.android.financialconnections.model.FinancialConnectionsSession import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.Async.Loading +import com.stripe.android.financialconnections.presentation.Async.Uninitialized import com.stripe.android.financialconnections.presentation.FinancialConnectionsViewModel import com.stripe.android.financialconnections.repository.SuccessContentRepository import com.stripe.android.financialconnections.ui.TextResource diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/Async.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/Async.kt new file mode 100644 index 00000000000..8e7addd6d3b --- /dev/null +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/Async.kt @@ -0,0 +1,22 @@ +package com.stripe.android.financialconnections.presentation + +/** + * Represents the state of an asynchronous operation. + * + * @param T The type of the value that the operation will produce. + */ +internal sealed class Async( + private val value: T? +) { + + data object Uninitialized : Async(value = null) + + data class Loading(val value: T? = null) : Async(value = value) + data class Success(private val value: T) : Async(value = value) { + override operator fun invoke(): T = value + } + + data class Fail(val error: Throwable) : Async(value = null) + + open operator fun invoke(): T? = value +} diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/core/ComposeExtensions.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/ComposeExtensions.kt similarity index 97% rename from financial-connections/src/main/java/com/stripe/android/financialconnections/core/ComposeExtensions.kt rename to financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/ComposeExtensions.kt index 9d158e31d0f..894931aabd2 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/core/ComposeExtensions.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/ComposeExtensions.kt @@ -1,4 +1,4 @@ -package com.stripe.android.financialconnections.core +package com.stripe.android.financialconnections.presentation import androidx.compose.runtime.Composable import androidx.compose.runtime.State diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModel.kt index 96559b405d8..e6ae7999dac 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModel.kt @@ -26,8 +26,6 @@ import com.stripe.android.financialconnections.analytics.FinancialConnectionsAna import com.stripe.android.financialconnections.analytics.FinancialConnectionsAnalyticsTracker import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Metadata import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Name -import com.stripe.android.financialconnections.core.FinancialConnectionsViewModel -import com.stripe.android.financialconnections.core.parentActivity import com.stripe.android.financialconnections.di.APPLICATION_ID import com.stripe.android.financialconnections.di.DaggerFinancialConnectionsSheetNativeComponent import com.stripe.android.financialconnections.di.FinancialConnectionsSheetNativeComponent @@ -51,12 +49,12 @@ import com.stripe.android.financialconnections.model.FinancialConnectionsSession import com.stripe.android.financialconnections.navigation.Destination import com.stripe.android.financialconnections.navigation.NavigationManager import com.stripe.android.financialconnections.navigation.pane -import com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeState.Companion.KEY_FIRST_INIT -import com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeState.Companion.KEY_SAVED_STATE -import com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeState.Companion.KEY_WEB_AUTH_FLOW import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarHost import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarState import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeState.Companion.KEY_FIRST_INIT +import com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeState.Companion.KEY_SAVED_STATE +import com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeState.Companion.KEY_WEB_AUTH_FLOW import com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeViewEffect.Finish import com.stripe.android.financialconnections.presentation.FinancialConnectionsSheetNativeViewEffect.OpenUrl import com.stripe.android.financialconnections.utils.UriUtils @@ -87,8 +85,12 @@ internal class FinancialConnectionsSheetNativeViewModel @Inject constructor( private val logger: Logger, private val navigationManager: NavigationManager, @Named(APPLICATION_ID) private val applicationId: String, - initialState: FinancialConnectionsSheetNativeState -) : FinancialConnectionsViewModel(initialState), TopAppBarHost { + initialState: FinancialConnectionsSheetNativeState, +) : FinancialConnectionsViewModel( + initialState, + nativeAuthFlowCoordinator +), + TopAppBarHost { private val mutex = Mutex() val navigationFlow = navigationManager.navigationFlow @@ -427,6 +429,11 @@ internal class FinancialConnectionsSheetNativeViewModel @Inject constructor( } } } + + // TODO avoid? + override fun updateTopAppBar(state: FinancialConnectionsSheetNativeState): TopAppBarStateUpdate? { + return null + } } internal data class FinancialConnectionsSheetNativeState( @@ -450,7 +457,8 @@ internal data class FinancialConnectionsSheetNativeState( args: FinancialConnectionsSheetNativeActivityArgs, savedState: Bundle? ) : this( - webAuthFlow = savedState?.getParcelable(KEY_WEB_AUTH_FLOW) ?: WebAuthFlowState.Uninitialized, + webAuthFlow = savedState?.getParcelable(KEY_WEB_AUTH_FLOW) + ?: WebAuthFlowState.Uninitialized, reducedBranding = args.initialSyncResponse.visual.reducedBranding, testMode = args.initialSyncResponse.manifest.livemode.not(), firstInit = savedState?.getBoolean(KEY_FIRST_INIT, true) ?: true, @@ -515,7 +523,8 @@ internal sealed class WebAuthFlowState : Parcelable { } @Composable -internal fun parentViewModel(): FinancialConnectionsSheetNativeViewModel = parentActivity().viewModel +internal fun parentViewModel(): FinancialConnectionsSheetNativeViewModel = + parentActivity().viewModel internal sealed interface FinancialConnectionsSheetNativeViewEffect { /** diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsViewModel.kt index 54c3c602631..53f2620550e 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsViewModel.kt @@ -1,20 +1,32 @@ package com.stripe.android.financialconnections.presentation -import com.airbnb.mvrx.MavericksState -import com.airbnb.mvrx.MavericksViewModel +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator import com.stripe.android.financialconnections.navigation.topappbar.TopAppBarStateUpdate +import kotlinx.coroutines.Job +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.distinctUntilChanged +import kotlinx.coroutines.flow.map +import kotlinx.coroutines.flow.onEach +import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch +import kotlin.reflect.KProperty1 -internal abstract class FinancialConnectionsViewModel( +internal abstract class FinancialConnectionsViewModel( initialState: S, private val nativeAuthFlowCoordinator: NativeAuthFlowCoordinator, -) : MavericksViewModel(initialState) { +) : ViewModel() { + + private val _stateFlow: MutableStateFlow = MutableStateFlow(initialState) + val stateFlow: StateFlow = _stateFlow.asStateFlow() init { updateHostWithTopAppBarState(initialState) - - onEach { state -> + // TODO + stateFlow.onEach { state -> updateHostWithTopAppBarState(state) } } @@ -27,4 +39,49 @@ internal abstract class FinancialConnectionsViewModel( nativeAuthFlowCoordinator().emit(NativeAuthFlowCoordinator.Message.UpdateTopAppBar(update)) } } + + protected open fun (suspend () -> T).execute( + retainValue: KProperty1>? = null, + reducer: S.(Async) -> S, + ): Job { + return viewModelScope.launch { + setState { reducer(Async.Loading(value = retainValue?.get(this)?.invoke())) } + val result = runCatching { this@execute() } + // update state. + result.fold( + onSuccess = { data -> + setState { reducer(Async.Success(data)) } + }, + onFailure = { throwable -> + setState { reducer(Async.Fail(throwable)) } + } + ) + } + } + + protected fun withState(action: (state: S) -> Unit) = stateFlow.value.let(action) + + protected open fun onAsync( + prop: KProperty1>, + onSuccess: suspend (T) -> Unit = {}, + onFail: suspend (Throwable) -> Unit = {} + ) { + viewModelScope.launch { + stateFlow.map { prop.get(it) } + .distinctUntilChanged() + .collect { async -> + when (async) { + is Async.Success -> onSuccess(async()) + is Async.Fail -> onFail(async.error) + is Async.Loading -> Unit + Async.Uninitialized -> Unit + } + } + } + } + + protected fun setState(reducer: S.() -> S) = _stateFlow.update(reducer) } + +internal fun , B, C> withState(viewModel: A, block: (B) -> C) = + block(viewModel.stateFlow.value) diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/utils/MavericksExtensions.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/utils/MavericksExtensions.kt index ebf20bbf907..058089adc68 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/utils/MavericksExtensions.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/utils/MavericksExtensions.kt @@ -5,7 +5,7 @@ import com.airbnb.mvrx.Fail import com.airbnb.mvrx.Loading import com.airbnb.mvrx.Mavericks import com.stripe.android.core.exception.StripeException -import com.stripe.android.financialconnections.core.Async +import com.stripe.android.financialconnections.presentation.Async import kotlinx.coroutines.CancellationException import kotlin.properties.ReadOnlyProperty import kotlin.reflect.KProperty diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModelTest.kt index fddc086c423..3dc273b9132 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModelTest.kt @@ -14,7 +14,6 @@ import com.stripe.android.financialconnections.FinancialConnectionsSheetViewEffe import com.stripe.android.financialconnections.FinancialConnectionsSheetViewEffect.OpenAuthFlowWithUrl import com.stripe.android.financialconnections.analytics.FinancialConnectionsEventReporter import com.stripe.android.financialconnections.browser.BrowserManager -import com.stripe.android.financialconnections.core.withState import com.stripe.android.financialconnections.domain.FetchFinancialConnectionsSession import com.stripe.android.financialconnections.domain.FetchFinancialConnectionsSessionForToken import com.stripe.android.financialconnections.domain.SynchronizeFinancialConnectionsSession @@ -29,6 +28,7 @@ import com.stripe.android.financialconnections.model.FinancialConnectionsAccount import com.stripe.android.financialconnections.model.FinancialConnectionsAccountList import com.stripe.android.financialconnections.model.FinancialConnectionsSession import com.stripe.android.financialconnections.model.FinancialConnectionsSession.StatusDetails +import com.stripe.android.financialconnections.presentation.withState import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.runTest @@ -516,6 +516,7 @@ class FinancialConnectionsSheetViewModelTest { analyticsTracker = analyticsTracker, browserManager = browserManager, savedStateHandle = SavedStateHandle(), + nativeAuthFlowCoordinator = mock(), logger = Logger.noop() ) } diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModelTest.kt index d64036643ed..3fb92923dd6 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/accountpicker/AccountPickerViewModelTest.kt @@ -9,7 +9,6 @@ import com.stripe.android.financialconnections.ApiKeyFixtures.sessionManifest import com.stripe.android.financialconnections.ApiKeyFixtures.syncResponse import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker -import com.stripe.android.financialconnections.core.withState import com.stripe.android.financialconnections.domain.GetOrFetchSync import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator import com.stripe.android.financialconnections.domain.PollAuthorizationSessionAccounts @@ -17,6 +16,7 @@ import com.stripe.android.financialconnections.domain.SelectAccounts import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest import com.stripe.android.financialconnections.model.PartnerAccountsList import com.stripe.android.financialconnections.navigation.NavigationManager +import com.stripe.android.financialconnections.presentation.withState import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Rule diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModelTest.kt index e8edbbc2d1b..d269b4b8ccd 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/institutionpicker/InstitutionPickerViewModelTest.kt @@ -5,8 +5,6 @@ import com.stripe.android.financialconnections.ApiKeyFixtures import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.FinancialConnectionsSheet import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker -import com.stripe.android.financialconnections.core.Async -import com.stripe.android.financialconnections.core.withState import com.stripe.android.financialconnections.domain.FeaturedInstitutions import com.stripe.android.financialconnections.domain.GetOrFetchSync import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator @@ -20,6 +18,8 @@ import com.stripe.android.financialconnections.model.FinancialConnectionsSession import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.model.InstitutionResponse import com.stripe.android.financialconnections.navigation.Destination +import com.stripe.android.financialconnections.presentation.Async +import com.stripe.android.financialconnections.presentation.withState import com.stripe.android.financialconnections.utils.TestHandleError import com.stripe.android.financialconnections.utils.TestNavigationManager import kotlinx.coroutines.ExperimentalCoroutinesApi diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationViewModelTest.kt index cbb40e5ab95..691a6fe3f1b 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/linkstepupverification/LinkStepUpVerificationViewModelTest.kt @@ -8,7 +8,6 @@ import com.stripe.android.financialconnections.ApiKeyFixtures.partnerAccount import com.stripe.android.financialconnections.ApiKeyFixtures.sessionManifest import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker -import com.stripe.android.financialconnections.core.Async.Loading import com.stripe.android.financialconnections.domain.ConfirmVerification import com.stripe.android.financialconnections.domain.GetCachedAccounts import com.stripe.android.financialconnections.domain.GetManifest @@ -21,6 +20,7 @@ import com.stripe.android.financialconnections.domain.UpdateLocalManifest import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane import com.stripe.android.financialconnections.navigation.Destination +import com.stripe.android.financialconnections.presentation.Async.Loading import com.stripe.android.financialconnections.utils.TestNavigationManager import com.stripe.android.model.ConsumerSession import com.stripe.android.model.VerificationType diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryViewModelTest.kt index 107a899695e..d77ec9da2eb 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/manualentry/ManualEntryViewModelTest.kt @@ -7,8 +7,6 @@ import com.stripe.android.financialconnections.ApiKeyFixtures.sessionManifest import com.stripe.android.financialconnections.ApiKeyFixtures.syncResponse import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker -import com.stripe.android.financialconnections.core.Async.Success -import com.stripe.android.financialconnections.core.withState import com.stripe.android.financialconnections.domain.GetOrFetchSync import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator.Message.Complete @@ -17,6 +15,8 @@ import com.stripe.android.financialconnections.domain.PollAttachPaymentAccount import com.stripe.android.financialconnections.features.manualentry.ManualEntryState.Payload import com.stripe.android.financialconnections.mock.TestSuccessContentRepository import com.stripe.android.financialconnections.model.ManualEntryMode +import com.stripe.android.financialconnections.presentation.Async.Success +import com.stripe.android.financialconnections.presentation.withState import com.stripe.android.financialconnections.utils.TestNavigationManager import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.filterIsInstance diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationViewModelTest.kt index 8f5d0229ce4..687c6f4488b 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/features/networkinglinkverification/NetworkingLinkVerificationViewModelTest.kt @@ -7,7 +7,6 @@ import com.stripe.android.financialconnections.ApiKeyFixtures.consumerSession import com.stripe.android.financialconnections.ApiKeyFixtures.sessionManifest import com.stripe.android.financialconnections.CoroutineTestRule import com.stripe.android.financialconnections.TestFinancialConnectionsAnalyticsTracker -import com.stripe.android.financialconnections.core.Async.Loading import com.stripe.android.financialconnections.domain.ConfirmVerification import com.stripe.android.financialconnections.domain.GetManifest import com.stripe.android.financialconnections.domain.LookupConsumerAndStartVerification @@ -16,6 +15,7 @@ import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane.INSTITUTION_PICKER import com.stripe.android.financialconnections.model.FinancialConnectionsSessionManifest.Pane.NETWORKING_LINK_VERIFICATION import com.stripe.android.financialconnections.navigation.Destination +import com.stripe.android.financialconnections.presentation.Async.Loading import com.stripe.android.financialconnections.utils.TestNavigationManager import com.stripe.android.model.ConsumerSession import com.stripe.android.model.VerificationType diff --git a/financial-connections/src/test/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModelTest.kt b/financial-connections/src/test/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModelTest.kt index c45801aa860..457dfe13888 100644 --- a/financial-connections/src/test/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModelTest.kt +++ b/financial-connections/src/test/java/com/stripe/android/financialconnections/presentation/FinancialConnectionsSheetNativeViewModelTest.kt @@ -14,7 +14,6 @@ import com.stripe.android.financialconnections.FinancialConnectionsSheet import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Metadata import com.stripe.android.financialconnections.analytics.FinancialConnectionsEvent.Name -import com.stripe.android.financialconnections.core.withState import com.stripe.android.financialconnections.domain.CompleteFinancialConnectionsSession import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator import com.stripe.android.financialconnections.domain.NativeAuthFlowCoordinator.Message.Complete From d079d6e03152102daab7cd518f211a92f9fd3aae Mon Sep 17 00:00:00 2001 From: Carlos M <99293320+carlosmuvi-stripe@users.noreply.github.com> Date: Wed, 27 Mar 2024 10:18:36 -0700 Subject: [PATCH 5/7] [FC] Removes mavericks dependency (#8160) * Migrates more screens out of mavs. * Migrates partner auth. * Removes active auth session field. * Updates tests. * Updates attach payment viewmodel. * PR feedback. * Api dump. * Migrates missing viewmodels. * Updates dependencies. * Removes mavericks dependency. * Merge with integration. * Uses collect. * Updates dependencies --- dependencies.gradle | 4 - example/dependencies/dependencies.txt | 36 +++----- .../dependencies/dependencies.txt | 36 +++----- .../api/financial-connections.api | 3 - financial-connections/build.gradle | 1 - financial-connections/consumer-rules.txt | 24 ----- .../dependencies/dependencies.txt | 91 ++++++++----------- .../src/main/AndroidManifest.xml | 6 -- .../FinancialConnectionsSheetActivity.kt | 45 +++++---- .../FinancialConnectionsSheetViewModel.kt | 4 +- .../FinancialConnectionsInitializer.kt | 41 --------- .../features/exit/ExitViewModel.kt | 1 - .../FinancialConnectionsSheetActivityArgs.kt | 8 -- ...inancialConnectionsSheetForDataContract.kt | 7 +- ...inancialConnectionsSheetForLinkContract.kt | 9 +- ...nancialConnectionsSheetForTokenContract.kt | 9 +- ...inancialConnectionsSheetNativeViewModel.kt | 4 +- .../FinancialConnectionsViewModel.kt | 12 ++- ...zationPendingNetworkingRepairRepository.kt | 3 +- .../FinancialConnectionsErrorRepository.kt | 4 +- ...FinancialConnectionsSheetNativeActivity.kt | 21 ++++- .../utils/MavericksExtensions.kt | 25 ----- .../dependencies/dependencies.txt | 14 --- 23 files changed, 130 insertions(+), 278 deletions(-) delete mode 100644 financial-connections/src/main/java/com/stripe/android/financialconnections/appinitializer/FinancialConnectionsInitializer.kt diff --git a/dependencies.gradle b/dependencies.gradle index f53d7289053..c8d717d9540 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -45,7 +45,6 @@ ext.versions = [ kotlinSerializationConverter: '1.0.0', ktlint : '0.48.2', leakCanary : '2.13', - mavericks : '3.0.9', material : '1.11.0', mockito : '5.10.0', mockitoInline : '5.2.0', @@ -162,8 +161,6 @@ ext.libs = [ leakCanary : "com.squareup.leakcanary:leakcanary-android:${versions.leakCanary}", loggingInterceptor : "com.squareup.okhttp3:logging-interceptor:${versions.okhttp}", material : "com.google.android.material:material:${versions.material}", - mavericks : "com.airbnb.android:mavericks:${versions.mavericks}", - mavericksCompose : "com.airbnb.android:mavericks-compose:${versions.mavericks}", microblinkCapture : "com.microblink:capture-core:${versions.microblinkCapture}", okio : "com.squareup.okio:okio:${versions.okio}", payButtonCompose : "com.google.pay.button:compose-pay-button:${versions.payButtonCompose}", @@ -218,7 +215,6 @@ ext.testLibs = [ junit : "org.jetbrains.kotlin:kotlin-test-junit:${versions.kotlin}", test : "org.jetbrains.kotlin:kotlin-test:${versions.kotlin}", ], - mavericks : "com.airbnb.android:mavericks-testing:${versions.mavericks}", mockito : [ android: "org.mockito:mockito-android:${versions.mockito}", core : "org.mockito:mockito-core:${versions.mockito}", diff --git a/example/dependencies/dependencies.txt b/example/dependencies/dependencies.txt index 23e34e58c8f..9d05562a775 100644 --- a/example/dependencies/dependencies.txt +++ b/example/dependencies/dependencies.txt @@ -76,7 +76,6 @@ | | | | | | | \--- com.google.guava:listenablefuture:1.0 | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) @@ -86,6 +85,7 @@ | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | | +--- androidx.versionedparcelable:versionedparcelable:1.1.1 | | | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) @@ -117,7 +117,6 @@ | | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) @@ -127,6 +126,7 @@ | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) @@ -139,8 +139,8 @@ | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | \--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.22 | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) @@ -169,7 +169,6 @@ | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (*) | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) @@ -179,6 +178,7 @@ | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (*) | | | | | | +--- androidx.savedstate:savedstate:1.2.1 @@ -198,8 +198,8 @@ | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | | +--- androidx.profileinstaller:profileinstaller:1.3.0 (*) | | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) @@ -281,7 +281,6 @@ | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (*) | | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) @@ -292,11 +291,11 @@ | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) | | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1 -> 1.7.3 (*) | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) @@ -306,6 +305,7 @@ | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | | | \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 -> 2.7.0 (*) | | | | | +--- androidx.profileinstaller:profileinstaller:1.3.0 (*) @@ -353,8 +353,8 @@ | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) | | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 @@ -743,8 +743,8 @@ | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | +--- androidx.core:core-ktx:1.12.0 (*) | | | +--- androidx.activity:activity-ktx:1.8.2 (*) @@ -828,13 +828,13 @@ | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | | | | \--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (*) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (*) | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) @@ -980,20 +980,6 @@ | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3 (*) | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3 (*) | +--- org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2 (*) -| +--- com.airbnb.android:mavericks:3.0.9 -| | +--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.8.22 -> 1.9.22 (*) -| | +--- androidx.activity:activity:{require 1.5.1; reject _} -> 1.8.2 (*) -| | +--- androidx.appcompat:appcompat:{require 1.5.0; reject _} -> 1.6.1 (*) -| | +--- androidx.fragment:fragment:{require 1.5.2; reject _} -> 1.6.2 (*) -| | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:{require 2.6.1; reject _} -> 2.7.0 (*) -| | +--- androidx.lifecycle:lifecycle-common-java8:{require 2.6.1; reject _} -> 2.7.0 (*) -| | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:{require 2.6.1; reject _} -> 2.7.0 (*) -| | +--- androidx.lifecycle:lifecycle-runtime-ktx:{require 2.6.1; reject _} -> 2.7.0 (*) -| | +--- com.airbnb.android:mavericks-common:3.0.9 -| | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:{require 1.6.4; reject _} -> 1.7.3 (*) -| | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 -> 1.9.10 (*) -| | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:{require 1.6.4; reject _} -> 1.7.3 (*) -| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 -> 1.9.10 (*) | \--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.22 (*) +--- com.google.accompanist:accompanist-themeadapter-material:0.32.0 (*) +--- com.alipay.sdk:alipaysdk-android:15.8.12 diff --git a/financial-connections-example/dependencies/dependencies.txt b/financial-connections-example/dependencies/dependencies.txt index 0b489707e46..572d1ab023c 100644 --- a/financial-connections-example/dependencies/dependencies.txt +++ b/financial-connections-example/dependencies/dependencies.txt @@ -72,7 +72,6 @@ | | | | | | \--- com.google.guava:listenablefuture:1.0 | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) @@ -82,6 +81,7 @@ | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | +--- androidx.versionedparcelable:versionedparcelable:1.1.1 | | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) @@ -113,7 +113,6 @@ | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) @@ -123,6 +122,7 @@ | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) @@ -135,8 +135,8 @@ | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | \--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.22 | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) @@ -165,7 +165,6 @@ | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (*) | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) @@ -175,6 +174,7 @@ | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (*) | | | | | +--- androidx.savedstate:savedstate:1.2.1 @@ -194,8 +194,8 @@ | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | +--- androidx.profileinstaller:profileinstaller:1.3.0 (*) | | | | +--- androidx.savedstate:savedstate:1.2.1 (*) @@ -218,8 +218,8 @@ | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) | | | +--- androidx.savedstate:savedstate-ktx:1.2.1 @@ -515,7 +515,6 @@ | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (*) | | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) @@ -525,11 +524,11 @@ | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1 -> 1.7.3 (*) | | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) @@ -539,6 +538,7 @@ | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) +| | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | | \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 -> 2.7.0 (*) | | | | +--- androidx.profileinstaller:profileinstaller:1.3.0 (*) @@ -597,13 +597,13 @@ | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-livedata-ktx:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | | \--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (*) | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (*) | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) @@ -671,20 +671,6 @@ | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3 (*) | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3 (*) | +--- org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2 (*) -| +--- com.airbnb.android:mavericks:3.0.9 -| | +--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.8.22 -> 1.9.22 (*) -| | +--- androidx.activity:activity:{require 1.5.1; reject _} -> 1.8.2 (*) -| | +--- androidx.appcompat:appcompat:{require 1.5.0; reject _} -> 1.6.1 (*) -| | +--- androidx.fragment:fragment:{require 1.5.2; reject _} -> 1.6.2 (*) -| | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:{require 2.6.1; reject _} -> 2.7.0 (*) -| | +--- androidx.lifecycle:lifecycle-common-java8:{require 2.6.1; reject _} -> 2.7.0 (*) -| | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:{require 2.6.1; reject _} -> 2.7.0 (*) -| | +--- androidx.lifecycle:lifecycle-runtime-ktx:{require 2.6.1; reject _} -> 2.7.0 (*) -| | +--- com.airbnb.android:mavericks-common:3.0.9 -| | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:{require 1.6.4; reject _} -> 1.7.3 (*) -| | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 -> 1.9.10 (*) -| | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:{require 1.6.4; reject _} -> 1.7.3 (*) -| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 -> 1.9.10 (*) | \--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.22 (*) +--- project :payments-core | +--- project :stripe-core (*) @@ -854,8 +840,8 @@ | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | \--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | +--- androidx.core:core-ktx:1.12.0 (*) | | +--- androidx.activity:activity-ktx:1.8.2 (*) diff --git a/financial-connections/api/financial-connections.api b/financial-connections/api/financial-connections.api index 34975e86e2b..8f489a18189 100644 --- a/financial-connections/api/financial-connections.api +++ b/financial-connections/api/financial-connections.api @@ -504,9 +504,6 @@ public final class com/stripe/android/financialconnections/features/success/Comp public final fun getLambda-1$financial_connections_release ()Lkotlin/jvm/functions/Function3; } -public final class com/stripe/android/financialconnections/launcher/FinancialConnectionsSheetActivityArgs$Companion { -} - public final class com/stripe/android/financialconnections/launcher/FinancialConnectionsSheetActivityArgs$ForData$Creator : android/os/Parcelable$Creator { public fun ()V public final fun createFromParcel (Landroid/os/Parcel;)Lcom/stripe/android/financialconnections/launcher/FinancialConnectionsSheetActivityArgs$ForData; diff --git a/financial-connections/build.gradle b/financial-connections/build.gradle index 35da6c4834a..124ed7b35f0 100644 --- a/financial-connections/build.gradle +++ b/financial-connections/build.gradle @@ -41,7 +41,6 @@ dependencies { implementation libs.kotlin.coroutines implementation libs.kotlin.coroutinesAndroid implementation libs.kotlin.serialization - implementation libs.mavericks debugImplementation libs.compose.uiTestManifest debugImplementation libs.compose.uiTooling diff --git a/financial-connections/consumer-rules.txt b/financial-connections/consumer-rules.txt index 53ca4fa0fc7..d5d3de36db4 100644 --- a/financial-connections/consumer-rules.txt +++ b/financial-connections/consumer-rules.txt @@ -3,27 +3,3 @@ *; } -# ------------------------ -# MvRx Config -# ----------------------- - -# MavericksViewModel loads the Companion class via reflection and thus we need to make sure we keep -# the name of the Companion object. --keepclassmembers class ** extends com.airbnb.mvrx.MavericksViewModel { - ** Companion; -} - -# Members of the Kotlin data classes used as the state in Mavericks are read via Kotlin reflection which cause trouble -# with Proguard if they are not kept. -# During reflection cache warming also the types are accessed via reflection. Need to keep them too. --keepclassmembers,includedescriptorclasses,allowobfuscation class ** implements com.airbnb.mvrx.MavericksState { - *; -} - -# The MavericksState object and the names classes that implement the MavericksState interface need to be -# kept as they are accessed via reflection. --keepnames class com.airbnb.mvrx.MavericksState --keepnames class * implements com.airbnb.mvrx.MavericksState - -# MavericksViewModelFactory is referenced via reflection using the Companion class name. --keepnames class * implements com.airbnb.mvrx.MavericksViewModelFactory diff --git a/financial-connections/dependencies/dependencies.txt b/financial-connections/dependencies/dependencies.txt index 01b29065162..86dd7cdda0c 100644 --- a/financial-connections/dependencies/dependencies.txt +++ b/financial-connections/dependencies/dependencies.txt @@ -1,9 +1,9 @@ +--- project :stripe-core | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 | | +--- org.jetbrains:annotations:13.0 -> 23.0.0 -| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0 -> 1.8.22 (c) +| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0 -> 1.8.20 (c) | | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.9.22 (c) -| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0 -> 1.8.22 (c) +| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0 -> 1.8.20 (c) | +--- androidx.browser:browser:1.7.0 | | +--- androidx.annotation:annotation:1.2.0 -> 1.7.1 | | | \--- androidx.annotation:annotation-jvm:1.7.1 @@ -39,14 +39,15 @@ | | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3 (c) | | | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.7.3 (c) | | | | | | | | \--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3 (c) -| | | | | | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20 -> 1.8.22 -| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) -| | | | | | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.22 -| | | | | | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) +| | | | | | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20 +| | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.20 -> 1.9.22 (*) +| | | | | | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.20 +| | | | | | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.8.20 -> 1.9.22 (*) | | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.7.3 (*) -| | | | | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20 -> 1.8.22 (*) +| | | | | | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.20 (*) | | | | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1 -> 1.7.3 (*) | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) @@ -55,7 +56,6 @@ | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) | | | | | \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | | | | +--- androidx.profileinstaller:profileinstaller:1.3.0 | | | | | +--- androidx.annotation:annotation:1.2.0 -> 1.7.1 (*) @@ -67,15 +67,15 @@ | | | | | \--- com.google.guava:listenablefuture:1.0 | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | | | +--- androidx.versionedparcelable:versionedparcelable:1.1.1 | | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) @@ -108,15 +108,15 @@ | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1 -> 1.7.3 (*) @@ -126,10 +126,10 @@ | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | \--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.22 | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22 (*) @@ -158,15 +158,15 @@ | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (*) | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.22 -> 1.9.22 (*) | | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | | \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (*) | | | | +--- androidx.savedstate:savedstate:1.2.1 @@ -183,10 +183,10 @@ | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | | \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | | | +--- androidx.profileinstaller:profileinstaller:1.3.0 (*) | | | +--- androidx.savedstate:savedstate:1.2.1 (*) @@ -206,10 +206,10 @@ | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) -| | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) -| | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1 -> 2.7.0 (*) | | +--- androidx.savedstate:savedstate-ktx:1.2.1 @@ -320,13 +320,13 @@ | | | | | | | | +--- androidx.lifecycle:lifecycle-common-java8:2.7.0 (c) | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) | | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | | | | | | +--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | | | | | | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) | | | | | | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) | | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) -| | | | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | | | | | | \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) +| | | | | | | | \--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) | | | | | | | +--- androidx.startup:startup-runtime:1.0.0 -> 1.1.1 (*) | | | | | | | \--- androidx.emoji2:emoji2-views-helper:1.4.0 (c) | | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.8.21 -> 1.9.22 (*) @@ -474,15 +474,14 @@ | | | +--- androidx.core:core:1.3.0 -> 1.12.0 (*) | | | +--- androidx.emoji2:emoji2:1.4.0 (*) | | | \--- androidx.emoji2:emoji2:1.4.0 (c) -| | +--- androidx.fragment:fragment:1.3.6 -> 1.5.2 -| | | +--- androidx.activity:activity:1.5.1 -> 1.8.2 (*) +| | +--- androidx.fragment:fragment:1.3.6 | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) -| | | +--- androidx.annotation:annotation-experimental:1.0.0 -> 1.3.0 (*) +| | | +--- androidx.core:core:1.2.0 -> 1.12.0 (*) | | | +--- androidx.collection:collection:1.1.0 (*) -| | | +--- androidx.core:core-ktx:1.2.0 -> 1.12.0 (*) -| | | +--- androidx.lifecycle:lifecycle-livedata-core:2.5.1 -> 2.7.0 (*) -| | | +--- androidx.lifecycle:lifecycle-viewmodel:2.5.1 -> 2.7.0 (*) -| | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1 -> 2.7.0 (*) +| | | +--- androidx.viewpager:viewpager:1.0.0 +| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) +| | | | +--- androidx.core:core:1.0.0 -> 1.12.0 (*) +| | | | \--- androidx.customview:customview:1.0.0 (*) | | | +--- androidx.loader:loader:1.0.0 | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) | | | | +--- androidx.core:core:1.0.0 -> 1.12.0 (*) @@ -518,12 +517,12 @@ | | | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | | | \--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) | | | | \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 -> 2.7.0 (*) -| | | +--- androidx.savedstate:savedstate:1.2.0 -> 1.2.1 (*) -| | | +--- androidx.viewpager:viewpager:1.0.0 -| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.7.1 (*) -| | | | +--- androidx.core:core:1.0.0 -> 1.12.0 (*) -| | | | \--- androidx.customview:customview:1.0.0 (*) -| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 -> 1.9.22 (*) +| | | +--- androidx.activity:activity:1.2.4 -> 1.8.2 (*) +| | | +--- androidx.lifecycle:lifecycle-livedata-core:2.3.1 -> 2.7.0 (*) +| | | +--- androidx.lifecycle:lifecycle-viewmodel:2.3.1 -> 2.7.0 (*) +| | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.1 -> 2.7.0 (*) +| | | +--- androidx.savedstate:savedstate:1.1.0 -> 1.2.1 (*) +| | | \--- androidx.annotation:annotation-experimental:1.0.0 -> 1.3.0 (*) | | +--- androidx.lifecycle:lifecycle-runtime:2.5.1 -> 2.7.0 (*) | | +--- androidx.lifecycle:lifecycle-viewmodel:2.5.1 -> 2.7.0 (*) | | +--- androidx.resourceinspection:resourceinspection-annotation:1.0.1 @@ -568,15 +567,15 @@ | | | +--- androidx.annotation:annotation:1.1.0 -> 1.7.1 (*) | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (*) | | | +--- androidx.lifecycle:lifecycle-common:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.7.0 (c) +| | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-runtime:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-runtime-ktx:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) -| | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) | | | \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (*) | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (*) @@ -589,8 +588,8 @@ | | +--- androidx.lifecycle:lifecycle-viewmodel:2.7.0 (c) | | +--- androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 (c) | | +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 (c) -| | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | +--- androidx.lifecycle:lifecycle-livedata:2.7.0 (c) +| | +--- androidx.lifecycle:lifecycle-process:2.7.0 (c) | | \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0 (c) | +--- androidx.navigation:navigation-runtime-ktx:2.7.6 | | +--- androidx.navigation:navigation-common-ktx:2.7.6 @@ -639,23 +638,9 @@ +--- androidx.compose.ui:ui:1.5.4 (*) +--- androidx.compose.ui:ui-tooling-preview:1.5.4 (*) +--- com.airbnb.android:showkase-annotation:1.0.0-beta18 -| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10 -> 1.8.22 (*) +| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10 -> 1.8.20 (*) +--- com.google.dagger:dagger:2.50 (*) +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3 (*) +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3 (*) +--- org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2 (*) -+--- com.airbnb.android:mavericks:3.0.9 -| +--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.8.22 -> 1.9.22 (*) -| +--- androidx.activity:activity:{require 1.5.1; reject _} -> 1.8.2 (*) -| +--- androidx.appcompat:appcompat:{require 1.5.0; reject _} -> 1.6.1 (*) -| +--- androidx.fragment:fragment:{require 1.5.2; reject _} -> 1.5.2 (*) -| +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:{require 2.6.1; reject _} -> 2.7.0 (*) -| +--- androidx.lifecycle:lifecycle-common-java8:{require 2.6.1; reject _} -> 2.7.0 (*) -| +--- androidx.lifecycle:lifecycle-viewmodel-ktx:{require 2.6.1; reject _} -> 2.7.0 (*) -| +--- androidx.lifecycle:lifecycle-runtime-ktx:{require 2.6.1; reject _} -> 2.7.0 (*) -| +--- com.airbnb.android:mavericks-common:3.0.9 -| | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:{require 1.6.4; reject _} -> 1.7.3 (*) -| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 (*) -| +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:{require 1.6.4; reject _} -> 1.7.3 (*) -| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 (*) \--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.9.22 (*) \ No newline at end of file diff --git a/financial-connections/src/main/AndroidManifest.xml b/financial-connections/src/main/AndroidManifest.xml index 81a1d2313ab..06e3813de89 100644 --- a/financial-connections/src/main/AndroidManifest.xml +++ b/financial-connections/src/main/AndroidManifest.xml @@ -59,12 +59,6 @@ android:exported="false" android:windowSoftInputMode="adjustResize" android:theme="@style/StripeDefaultTheme" /> - -