-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FC] Removes mavericks from repositories and more panes. #8154
Merged
carlosmuvi-stripe
merged 7 commits into
carlosmuvi/i/remove-mavericks
from
carlosmuvi/remove-mavericks-part-2
Mar 26, 2024
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b97ad29
Migrates more screens out of mavs.
carlosmuvi-stripe ef76f4a
Migrates partner auth.
carlosmuvi-stripe dc361cf
Removes active auth session field.
carlosmuvi-stripe 641dd20
Updates tests.
carlosmuvi-stripe ef70ff1
Updates attach payment viewmodel.
carlosmuvi-stripe 38c29bc
PR feedback.
carlosmuvi-stripe c982448
Api dump.
carlosmuvi-stripe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...roid/financialconnections/features/accountpicker/AccountPickerPreviewParameterProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<AccountPickerState>(initialState) { | ||
) : FinancialConnectionsViewModel<AccountPickerState>(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 | ||
|
@@ -180,7 +181,7 @@ internal class AccountPickerViewModel @Inject constructor( | |
) | ||
} | ||
|
||
fun onAccountClicked(account: PartnerAccount) = withState { state -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you think about adding a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
fun onAccountClicked(account: PartnerAccount) = stateFlow.value.let { state -> | ||
state.payload()?.let { payload -> | ||
val selectedIds = state.selectedIds | ||
val newSelectedIds = when (payload.selectionMode) { | ||
|
@@ -236,7 +237,7 @@ internal class AccountPickerViewModel @Inject constructor( | |
eventTracker.track(ClickLinkAccounts(PANE)) | ||
} | ||
FinancialConnections.emitEvent(name = Name.ACCOUNTS_SELECTED) | ||
withState { state -> | ||
stateFlow.value.let { state -> | ||
state.payload()?.let { | ||
submitAccounts( | ||
selectedIds = state.selectedIds, | ||
|
@@ -308,21 +309,18 @@ internal class AccountPickerViewModel @Inject constructor( | |
setState { copy(viewEffect = null) } | ||
} | ||
|
||
companion object : | ||
MavericksViewModelFactory<AccountPickerViewModel, AccountPickerState> { | ||
|
||
override fun create( | ||
viewModelContext: ViewModelContext, | ||
state: AccountPickerState | ||
): AccountPickerViewModel { | ||
return viewModelContext.activity<FinancialConnectionsSheetNativeActivity>() | ||
.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<PartnerAccountsList> = Uninitialized, | ||
val selectedIds: Set<String> = emptySet(), | ||
val viewEffect: ViewEffect? = null | ||
) : MavericksState { | ||
) { | ||
|
||
val submitLoading: Boolean | ||
get() = payload is Loading || selectAccounts is Loading | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 17 additions & 22 deletions
39
...om/stripe/android/financialconnections/features/bankauthrepair/BankAuthRepairViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took this from mavericks: This allows us to optionally keep the current Async value if moving to a Loading state from Success (so that we can keep the screen content while loading)