diff --git a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthCacheDataStore.kt b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthCacheDataStore.kt index 56d72a9bb9..701d38cbc5 100644 --- a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthCacheDataStore.kt +++ b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthCacheDataStore.kt @@ -21,7 +21,7 @@ class AuthCacheDataStore(private val cache: AuthCache) : AuthDataStore { name: String, avatarPath: String?, invitationCode: String, - icon: Int + iconGradientValue: Int ): AccountSetup { throw UnsupportedOperationException() } diff --git a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthDataRepository.kt b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthDataRepository.kt index f1b18eb2d3..1becf1745c 100644 --- a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthDataRepository.kt +++ b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthDataRepository.kt @@ -3,7 +3,6 @@ package com.anytypeio.anytype.data.auth.repo 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.FeaturesConfig import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.data.auth.mapper.toDomain import com.anytypeio.anytype.data.auth.mapper.toEntity @@ -28,7 +27,7 @@ class AuthDataRepository( name = name, avatarPath = avatarPath, invitationCode = invitationCode, - icon = icon + iconGradientValue = icon ) override suspend fun deleteAccount(): AccountStatus = factory.remote.deleteAccount() diff --git a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthDataStore.kt b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthDataStore.kt index 7489f00d3e..52fa5f6532 100644 --- a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthDataStore.kt +++ b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthDataStore.kt @@ -4,7 +4,6 @@ import com.anytypeio.anytype.core_models.AccountSetup import com.anytypeio.anytype.core_models.AccountStatus import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.data.auth.model.AccountEntity -import com.anytypeio.anytype.data.auth.model.FeaturesConfigEntity import com.anytypeio.anytype.data.auth.model.WalletEntity import kotlinx.coroutines.flow.Flow @@ -16,7 +15,7 @@ interface AuthDataStore { name: String, avatarPath: String?, invitationCode: String, - icon: Int + iconGradientValue: Int ): AccountSetup suspend fun deleteAccount() : AccountStatus diff --git a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthRemote.kt b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthRemote.kt index 69b920444c..09fe18d695 100644 --- a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthRemote.kt +++ b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthRemote.kt @@ -12,7 +12,7 @@ interface AuthRemote { name: String, avatarPath: String?, invitationCode: String, - icon: Int + iconGradientValue: Int ): AccountSetup suspend fun deleteAccount() : AccountStatus suspend fun restoreAccount() : AccountStatus diff --git a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthRemoteDataStore.kt b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthRemoteDataStore.kt index 42be8efae6..5b248e6626 100644 --- a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthRemoteDataStore.kt +++ b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/AuthRemoteDataStore.kt @@ -18,12 +18,12 @@ class AuthRemoteDataStore( name: String, avatarPath: String?, invitationCode: String, - icon: Int + iconGradientValue: Int ) : AccountSetup = authRemote.createAccount( name = name, avatarPath = avatarPath, invitationCode = invitationCode, - icon = icon + iconGradientValue = iconGradientValue ) override suspend fun deleteAccount(): AccountStatus = authRemote.deleteAccount() diff --git a/data/src/test/java/com/anytypeio/anytype/data/AuthDataRepositoryTest.kt b/data/src/test/java/com/anytypeio/anytype/data/AuthDataRepositoryTest.kt index 3e8bd3cf36..64ef954b90 100644 --- a/data/src/test/java/com/anytypeio/anytype/data/AuthDataRepositoryTest.kt +++ b/data/src/test/java/com/anytypeio/anytype/data/AuthDataRepositoryTest.kt @@ -101,7 +101,7 @@ class AuthDataRepositoryTest { name = name, avatarPath = path, invitationCode = "code", - icon = icon + iconGradientValue = icon ) } doReturn setup } @@ -119,7 +119,7 @@ class AuthDataRepositoryTest { name = name, avatarPath = path, invitationCode = "code", - icon = icon + iconGradientValue = icon ) verifyNoMoreInteractions(authRemote) diff --git a/domain/src/main/java/com/anytypeio/anytype/domain/auth/interactor/CreateAccount.kt b/domain/src/main/java/com/anytypeio/anytype/domain/auth/interactor/CreateAccount.kt index f210ba470d..97abaa90aa 100644 --- a/domain/src/main/java/com/anytypeio/anytype/domain/auth/interactor/CreateAccount.kt +++ b/domain/src/main/java/com/anytypeio/anytype/domain/auth/interactor/CreateAccount.kt @@ -20,7 +20,7 @@ open class CreateAccount( name = params.name, avatarPath = params.avatarPath, invitationCode = params.invitationCode, - icon = params.icon + icon = params.iconGradientValue ) with(repository) { saveAccount(setup.account) @@ -34,11 +34,12 @@ open class CreateAccount( /** * @property avatarPath optional avatar image file path * @property name username + * @property iconGradientValue random icon gradient value for new account/space background */ class Params( val name: String, val avatarPath: String? = null, val invitationCode: String, - val icon: Int + val iconGradientValue: Int ) } \ No newline at end of file diff --git a/domain/src/test/java/com/anytypeio/anytype/domain/auth/CreateAccountTest.kt b/domain/src/test/java/com/anytypeio/anytype/domain/auth/CreateAccountTest.kt index 9604a83633..6e0eec1b70 100644 --- a/domain/src/test/java/com/anytypeio/anytype/domain/auth/CreateAccountTest.kt +++ b/domain/src/test/java/com/anytypeio/anytype/domain/auth/CreateAccountTest.kt @@ -58,7 +58,7 @@ class CreateAccountTest { name = name, avatarPath = path, invitationCode = code, - icon = icon + iconGradientValue = icon ) repo.stub { @@ -87,7 +87,7 @@ class CreateAccountTest { name = name, avatarPath = path, invitationCode = code, - icon = icon + iconGradientValue = icon ) repo.stub { diff --git a/middleware/src/main/java/com/anytypeio/anytype/middleware/auth/AuthMiddleware.kt b/middleware/src/main/java/com/anytypeio/anytype/middleware/auth/AuthMiddleware.kt index 5be944c0f1..b026069bcc 100644 --- a/middleware/src/main/java/com/anytypeio/anytype/middleware/auth/AuthMiddleware.kt +++ b/middleware/src/main/java/com/anytypeio/anytype/middleware/auth/AuthMiddleware.kt @@ -2,8 +2,6 @@ package com.anytypeio.anytype.middleware.auth import com.anytypeio.anytype.core_models.AccountSetup import com.anytypeio.anytype.core_models.AccountStatus -import com.anytypeio.anytype.data.auth.model.AccountEntity -import com.anytypeio.anytype.data.auth.model.FeaturesConfigEntity import com.anytypeio.anytype.data.auth.model.WalletEntity import com.anytypeio.anytype.data.auth.repo.AuthRemote import com.anytypeio.anytype.middleware.EventProxy @@ -29,12 +27,12 @@ class AuthMiddleware( name: String, avatarPath: String?, invitationCode: String, - icon: Int, + iconGradientValue: Int, ) : AccountSetup = middleware.accountCreate( name = name, path = avatarPath, invitationCode = invitationCode, - icon = icon + iconGradientValue = iconGradientValue ) override suspend fun deleteAccount(): AccountStatus = middleware.accountDelete() diff --git a/middleware/src/main/java/com/anytypeio/anytype/middleware/interactor/Middleware.kt b/middleware/src/main/java/com/anytypeio/anytype/middleware/interactor/Middleware.kt index a819b61de9..4fe85a3edb 100644 --- a/middleware/src/main/java/com/anytypeio/anytype/middleware/interactor/Middleware.kt +++ b/middleware/src/main/java/com/anytypeio/anytype/middleware/interactor/Middleware.kt @@ -56,13 +56,13 @@ class Middleware( name: String, path: String?, invitationCode: String, - icon: Int + iconGradientValue: Int ): AccountSetup { val request = Rpc.Account.Create.Request( name = name, alphaInviteCode = invitationCode, avatarLocalPath = path, - icon = icon.toLong() + icon = iconGradientValue.toLong() ) if (BuildConfig.DEBUG) logRequest(request) val response = service.accountCreate(request) diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/auth/account/SetupNewAccountViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/auth/account/SetupNewAccountViewModel.kt index 026c78b10c..befec8b6e0 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/auth/account/SetupNewAccountViewModel.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/auth/account/SetupNewAccountViewModel.kt @@ -65,7 +65,7 @@ class SetupNewAccountViewModel( name = session.name ?: throw IllegalStateException("Name not set"), avatarPath = session.avatarPath, invitationCode = session.invitationCode, - icon = spaceGradientProvider.randomId() + iconGradientValue = spaceGradientProvider.randomId() ) ) { result -> result.either( diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/spaces/SpaceGradientProvider.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/spaces/SpaceGradientProvider.kt index 7b0a0bd0d0..fe4dbfd174 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/spaces/SpaceGradientProvider.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/spaces/SpaceGradientProvider.kt @@ -6,6 +6,9 @@ interface SpaceGradientProvider { fun get(id: Double): Gradient + /** + * @return random id of gradient for space and account background + */ fun randomId(): Int class Impl @Inject constructor(): SpaceGradientProvider {