chore: flag for others user cards
Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
parent
666b75dc1d
commit
fd923434f0
|
|
@ -30,6 +30,19 @@ sealed class MediaConversationsVariates {
|
|||
data class Restricted(val predicate: () -> Boolean) : MediaConversationsVariates()
|
||||
}
|
||||
|
||||
@FeatureFlag("UserCards")
|
||||
sealed class UserCardsVariates {
|
||||
@Treatment(
|
||||
"Enable user cards for all users"
|
||||
)
|
||||
object Enabled : UserCardsVariates()
|
||||
|
||||
@Treatment(
|
||||
"Enable user cards for users that meet certain or all criteria (implementation-specific)"
|
||||
)
|
||||
data class Restricted(val predicate: () -> Boolean) : UserCardsVariates()
|
||||
}
|
||||
|
||||
object FeatureFlags {
|
||||
@FeatureFlag("LabsAccessControl")
|
||||
var labsAccessControl by mutableStateOf<LabsAccessControlVariates>(
|
||||
|
|
@ -55,4 +68,17 @@ object FeatureFlags {
|
|||
is MediaConversationsVariates.Enabled -> true
|
||||
is MediaConversationsVariates.Restricted -> (mediaConversations as MediaConversationsVariates.Restricted).predicate()
|
||||
}
|
||||
|
||||
@FeatureFlag("UserCards")
|
||||
var userCards by mutableStateOf<UserCardsVariates>(
|
||||
UserCardsVariates.Restricted {
|
||||
RevoltAPI.selfId?.endsWith("Z") == true
|
||||
}
|
||||
)
|
||||
|
||||
val userCardsGranted: Boolean
|
||||
get() = when (userCards) {
|
||||
is UserCardsVariates.Enabled -> true
|
||||
is UserCardsVariates.Restricted -> (userCards as UserCardsVariates.Restricted).predicate()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ import chat.revolt.api.internals.ULID
|
|||
import chat.revolt.api.internals.solidColor
|
||||
import chat.revolt.api.routes.user.fetchUserProfile
|
||||
import chat.revolt.api.schemas.Profile
|
||||
import chat.revolt.api.settings.FeatureFlags
|
||||
import chat.revolt.components.chat.RoleListEntry
|
||||
import chat.revolt.components.chat.UserBadgeList
|
||||
import chat.revolt.components.chat.UserBadgeRow
|
||||
|
|
@ -128,16 +129,18 @@ fun UserInfoSheet(
|
|||
item(key = "overview", span = StaggeredGridItemSpan.FullLine) {
|
||||
Box {
|
||||
RawUserOverview(user, profile, internalPadding = false)
|
||||
SmallFloatingActionButton(
|
||||
onClick = { showUserCard = true },
|
||||
modifier = Modifier
|
||||
.align(Alignment.TopEnd)
|
||||
.padding(top = 8.dp, end = 8.dp)
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(R.drawable.ic_badge_account_horizontal_24dp),
|
||||
contentDescription = null
|
||||
)
|
||||
if (FeatureFlags.userCardsGranted) {
|
||||
SmallFloatingActionButton(
|
||||
onClick = { showUserCard = true },
|
||||
modifier = Modifier
|
||||
.align(Alignment.TopEnd)
|
||||
.padding(top = 8.dp, end = 8.dp)
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(R.drawable.ic_badge_account_horizontal_24dp),
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue