Add 'isPremium' boolean to account info (#278)

This commit is contained in:
David Perez
2023-11-27 12:20:30 -06:00
committed by Álison Fernandes
parent 636600114b
commit acfc39ae3c
7 changed files with 22 additions and 4 deletions

View File

@@ -31,6 +31,7 @@ data class UserState(
* @property email The user's email address.
* @property name The user's name (if applicable).
* @property avatarColorHex Hex color value for a user's avatar in the "#AARRGGBB" format.
* @property isPremium `true` if the account has a premium membership.
* @property isVaultUnlocked Whether or not the user's vault is currently unlocked.
*/
data class Account(
@@ -38,6 +39,7 @@ data class UserState(
val name: String?,
val email: String,
val avatarColorHex: String,
val isPremium: Boolean,
val isVaultUnlocked: Boolean,
)
}

View File

@@ -53,6 +53,7 @@ fun UserStateJson.toUserState(
email = accountJson.profile.email,
// TODO Calculate default color (BIT-1191)
avatarColorHex = accountJson.profile.avatarColorHex ?: "#00aaaa",
isPremium = accountJson.profile.hasPremium == true,
isVaultUnlocked = userId in vaultState.unlockedVaultUserIds,
)
},