mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-1158 App | Tech | Renamed field icon & added some doc for space gradient
This commit is contained in:
parent
16e5a16989
commit
bb379b7d28
12 changed files with 21 additions and 21 deletions
|
@ -21,7 +21,7 @@ class AuthCacheDataStore(private val cache: AuthCache) : AuthDataStore {
|
|||
name: String,
|
||||
avatarPath: String?,
|
||||
invitationCode: String,
|
||||
icon: Int
|
||||
iconGradientValue: Int
|
||||
): AccountSetup {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
)
|
||||
}
|
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue