mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-06-04 03:51:48 +00:00
ui: revert to always show subscriptions indicator, but make it light blue instead of gray for new users (fresh installation with no chats) (#4604)
This commit is contained in:
+2
-6
@@ -370,12 +370,8 @@ fun SubscriptionStatusIndicator(click: (() -> Unit)) {
|
||||
}
|
||||
}
|
||||
|
||||
if (subs.total == 0 && !hasSess) {
|
||||
Box {}
|
||||
} else {
|
||||
SimpleButtonFrame(click = click) {
|
||||
SubscriptionStatusIndicatorView(subs = subs, hasSess = hasSess)
|
||||
}
|
||||
SimpleButtonFrame(click = click) {
|
||||
SubscriptionStatusIndicatorView(subs = subs, hasSess = hasSess)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+18
-17
@@ -68,7 +68,6 @@ enum class SubscriptionColorType {
|
||||
data class SubscriptionStatus(
|
||||
val color: SubscriptionColorType,
|
||||
val variableValue: Float,
|
||||
val opacity: Float,
|
||||
val statusPercent: Float
|
||||
)
|
||||
|
||||
@@ -78,7 +77,6 @@ fun subscriptionStatusColorAndPercentage(
|
||||
subs: SMPServerSubs,
|
||||
hasSess: Boolean
|
||||
): SubscriptionStatus {
|
||||
|
||||
fun roundedToQuarter(n: Float): Float = when {
|
||||
n >= 1 -> 1f
|
||||
n <= 0 -> 0f
|
||||
@@ -86,23 +84,26 @@ fun subscriptionStatusColorAndPercentage(
|
||||
}
|
||||
|
||||
val activeColor: SubscriptionColorType = if (socksProxy != null) SubscriptionColorType.ACTIVE_SOCKS_PROXY else SubscriptionColorType.ACTIVE
|
||||
val noConnColorAndPercent = SubscriptionStatus(SubscriptionColorType.DISCONNECTED, 1f, 1f, 0f)
|
||||
val noConnColorAndPercent = SubscriptionStatus(SubscriptionColorType.DISCONNECTED, 1f, 0f)
|
||||
val activeSubsRounded = roundedToQuarter(subs.shareOfActive)
|
||||
|
||||
return if (online && subs.total > 0) {
|
||||
if (subs.ssActive == 0) {
|
||||
if (hasSess)
|
||||
SubscriptionStatus(activeColor, activeSubsRounded, subs.shareOfActive, subs.shareOfActive)
|
||||
else
|
||||
noConnColorAndPercent
|
||||
} else { // ssActive > 0
|
||||
if (hasSess)
|
||||
SubscriptionStatus(activeColor, activeSubsRounded, subs.shareOfActive, subs.shareOfActive)
|
||||
else
|
||||
// This would mean implementation error
|
||||
SubscriptionStatus(SubscriptionColorType.ACTIVE_DISCONNECTED, activeSubsRounded, subs.shareOfActive, subs.shareOfActive)
|
||||
}
|
||||
} else noConnColorAndPercent
|
||||
return if (!online)
|
||||
noConnColorAndPercent
|
||||
else if (subs.total == 0 && !hasSess)
|
||||
// On freshly installed app (without chats) and on app start
|
||||
SubscriptionStatus(activeColor, 0f, 0f)
|
||||
else if (subs.ssActive == 0) {
|
||||
if (hasSess)
|
||||
SubscriptionStatus(activeColor, activeSubsRounded, subs.shareOfActive)
|
||||
else
|
||||
noConnColorAndPercent
|
||||
} else { // ssActive > 0
|
||||
if (hasSess)
|
||||
SubscriptionStatus(activeColor, activeSubsRounded, subs.shareOfActive)
|
||||
else
|
||||
// This would mean implementation error
|
||||
SubscriptionStatus(SubscriptionColorType.ACTIVE_DISCONNECTED, activeSubsRounded, subs.shareOfActive)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
Reference in New Issue
Block a user