1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

DROID-3317 Account | Tech | Space store migration + UI (#2074)

This commit is contained in:
Evgenii Kozlov 2025-02-14 11:17:02 +01:00 committed by GitHub
parent 20a95fbaea
commit 73cd7aba94
Signed by: github
GPG key ID: B5690EEEBB952194
38 changed files with 643 additions and 572 deletions

View file

@ -3,6 +3,7 @@ package com.anytypeio.anytype.data.auth.repo
import com.anytypeio.anytype.core_models.AccountSetup
import com.anytypeio.anytype.core_models.AccountStatus
import com.anytypeio.anytype.core_models.Command
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.NetworkModeConfig
import com.anytypeio.anytype.data.auth.model.AccountEntity
import com.anytypeio.anytype.data.auth.model.WalletEntity
@ -93,4 +94,15 @@ class AuthCacheDataStore(private val cache: AuthCache) : AuthDataStore {
override suspend fun debugExportLogs(dir: String): String {
throw UnsupportedOperationException()
}
override suspend fun migrateAccount(
account: Id,
path: String
) {
throw UnsupportedOperationException()
}
override suspend fun cancelAccountMigration(account: Id) {
throw UnsupportedOperationException()
}
}

View file

@ -4,6 +4,7 @@ import com.anytypeio.anytype.core_models.Account
import com.anytypeio.anytype.core_models.AccountSetup
import com.anytypeio.anytype.core_models.AccountStatus
import com.anytypeio.anytype.core_models.Command
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.NetworkModeConfig
import com.anytypeio.anytype.data.auth.mapper.toDomain
import com.anytypeio.anytype.data.auth.mapper.toEntity
@ -93,6 +94,22 @@ class AuthDataRepository(
override suspend fun getVersion(): String = factory.remote.getVersion()
override suspend fun migrateAccount(
account: Id,
path: String
) {
factory.remote.migrateAccount(
account = account,
path = path
)
}
override suspend fun cancelAccountMigration(account: Id) {
factory.remote.cancelAccountMigration(
account = account
)
}
override suspend fun getNetworkMode(): NetworkModeConfig {
return factory.cache.getNetworkMode()
}

View file

@ -3,6 +3,7 @@ package com.anytypeio.anytype.data.auth.repo
import com.anytypeio.anytype.core_models.AccountSetup
import com.anytypeio.anytype.core_models.AccountStatus
import com.anytypeio.anytype.core_models.Command
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.NetworkModeConfig
import com.anytypeio.anytype.data.auth.model.AccountEntity
import com.anytypeio.anytype.data.auth.model.WalletEntity
@ -16,6 +17,9 @@ interface AuthDataStore {
suspend fun deleteAccount() : AccountStatus
suspend fun restoreAccount() : AccountStatus
suspend fun migrateAccount(account: Id, path: String)
suspend fun cancelAccountMigration(account: Id)
suspend fun recoverAccount()
suspend fun saveAccount(account: AccountEntity)

View file

@ -3,6 +3,7 @@ package com.anytypeio.anytype.data.auth.repo
import com.anytypeio.anytype.core_models.AccountSetup
import com.anytypeio.anytype.core_models.AccountStatus
import com.anytypeio.anytype.core_models.Command
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.data.auth.model.AccountEntity
import com.anytypeio.anytype.data.auth.model.WalletEntity
import kotlinx.coroutines.flow.Flow
@ -10,6 +11,10 @@ import kotlinx.coroutines.flow.Flow
interface AuthRemote {
suspend fun selectAccount(command: Command.AccountSelect): AccountSetup
suspend fun createAccount(command: Command.AccountCreate): AccountSetup
suspend fun migrateAccount(account: Id, path: String)
suspend fun cancelAccountMigration(account: Id)
suspend fun deleteAccount() : AccountStatus
suspend fun restoreAccount() : AccountStatus
suspend fun recoverAccount()

View file

@ -3,6 +3,7 @@ package com.anytypeio.anytype.data.auth.repo
import com.anytypeio.anytype.core_models.AccountSetup
import com.anytypeio.anytype.core_models.AccountStatus
import com.anytypeio.anytype.core_models.Command
import com.anytypeio.anytype.core_models.Id
import com.anytypeio.anytype.core_models.NetworkModeConfig
import com.anytypeio.anytype.data.auth.model.AccountEntity
import com.anytypeio.anytype.data.auth.model.WalletEntity
@ -23,6 +24,22 @@ class AuthRemoteDataStore(
override suspend fun restoreAccount(): AccountStatus = authRemote.restoreAccount()
override suspend fun migrateAccount(
account: Id,
path: String
) {
authRemote.migrateAccount(
account = account,
path = path
)
}
override suspend fun cancelAccountMigration(account: Id) {
authRemote.cancelAccountMigration(
account = account
)
}
override suspend fun recoverAccount() {
authRemote.recoverAccount()
}