mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-3478 App | Tech | Fix migration delegate params (#2320)
This commit is contained in:
parent
8669676e89
commit
983b7d8d23
3 changed files with 9 additions and 5 deletions
|
@ -20,7 +20,7 @@ import kotlinx.coroutines.flow.scan
|
|||
|
||||
interface MigrationHelperDelegate {
|
||||
|
||||
suspend fun proceedWithMigration() : Flow<State>
|
||||
suspend fun proceedWithMigration(params: MigrateAccount.Params) : Flow<State>
|
||||
|
||||
class Impl @Inject constructor(
|
||||
private val migrateAccount: MigrateAccount,
|
||||
|
@ -28,9 +28,9 @@ interface MigrationHelperDelegate {
|
|||
private val processProgressObserver: MigrationProgressObserver
|
||||
) : MigrationHelperDelegate {
|
||||
|
||||
override suspend fun proceedWithMigration(): Flow<State> {
|
||||
override suspend fun proceedWithMigration(params: MigrateAccount.Params): Flow<State> {
|
||||
return migrateAccount
|
||||
.stream(MigrateAccount.Params.Current)
|
||||
.stream(params)
|
||||
.flatMapLatest { result ->
|
||||
flow {
|
||||
when(result) {
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.anytypeio.anytype.core_models.exceptions.NeedToUpdateApplicationExcep
|
|||
import com.anytypeio.anytype.core_utils.ext.cancel
|
||||
import com.anytypeio.anytype.domain.auth.interactor.ConvertWallet
|
||||
import com.anytypeio.anytype.domain.auth.interactor.Logout
|
||||
import com.anytypeio.anytype.domain.auth.interactor.MigrateAccount
|
||||
import com.anytypeio.anytype.domain.auth.interactor.ObserveAccounts
|
||||
import com.anytypeio.anytype.domain.auth.interactor.RecoverWallet
|
||||
import com.anytypeio.anytype.domain.auth.interactor.SaveMnemonic
|
||||
|
@ -310,7 +311,9 @@ class OnboardingMnemonicLoginViewModel @Inject constructor(
|
|||
}
|
||||
|
||||
private suspend fun proceedWithAccountMigration(id: String) {
|
||||
proceedWithMigration().collect { migrationState ->
|
||||
proceedWithMigration(
|
||||
params = MigrateAccount.Params.Other(acc = id)
|
||||
).collect { migrationState ->
|
||||
when (migrationState) {
|
||||
is MigrationHelperDelegate.State.Failed -> {
|
||||
state.value = SetupState.Migration.Failed(
|
||||
|
|
|
@ -24,6 +24,7 @@ import com.anytypeio.anytype.domain.auth.interactor.CheckAuthorizationStatus
|
|||
import com.anytypeio.anytype.domain.auth.interactor.GetLastOpenedObject
|
||||
import com.anytypeio.anytype.domain.auth.interactor.LaunchAccount
|
||||
import com.anytypeio.anytype.domain.auth.interactor.LaunchWallet
|
||||
import com.anytypeio.anytype.domain.auth.interactor.MigrateAccount
|
||||
import com.anytypeio.anytype.domain.auth.model.AuthStatus
|
||||
import com.anytypeio.anytype.domain.base.BaseUseCase
|
||||
import com.anytypeio.anytype.domain.base.fold
|
||||
|
@ -103,7 +104,7 @@ class SplashViewModel(
|
|||
|
||||
private suspend fun proceedWithAccountMigration() {
|
||||
if (migrationRetryCount <= 1) {
|
||||
proceedWithMigration().collect { migrationState ->
|
||||
proceedWithMigration(MigrateAccount.Params.Current).collect { migrationState ->
|
||||
when (migrationState) {
|
||||
is MigrationHelperDelegate.State.Failed -> {
|
||||
state.value = State.Migration.Failed(migrationState)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue