ui: only show subsription summary indicator after any chat is created; ios: fix servers summary sheet dismissal, screen protection (#4590)

This commit is contained in:
spaced4ndy
2024-08-06 12:03:25 +04:00
committed by GitHub
parent a0763b3a43
commit f893ad15de
2 changed files with 21 additions and 10 deletions
@@ -266,13 +266,19 @@ struct SubsStatusIndicator: View {
@AppStorage(DEFAULT_SHOW_SUBSCRIPTION_PERCENTAGE) private var showSubscriptionPercentage = false
var body: some View {
Button {
showServersSummary = true
} label: {
HStack(spacing: 4) {
SubscriptionStatusIndicatorView(subs: subs, hasSess: hasSess)
if showSubscriptionPercentage {
SubscriptionStatusPercentageView(subs: subs, hasSess: hasSess)
ZStack {
if subs.total == 0 && !hasSess {
EmptyView()
} else {
Button {
showServersSummary = true
} label: {
HStack(spacing: 4) {
SubscriptionStatusIndicatorView(subs: subs, hasSess: hasSess)
if showSubscriptionPercentage {
SubscriptionStatusPercentageView(subs: subs, hasSess: hasSess)
}
}
}
}
}
@@ -282,8 +288,9 @@ struct SubsStatusIndicator: View {
.onDisappear {
stopTimer()
}
.sheet(isPresented: $showServersSummary) {
.appSheet(isPresented: $showServersSummary) {
ServersSummaryView()
.environment(\EnvironmentValues.refresh as! WritableKeyPath<EnvironmentValues, RefreshAction?>, nil)
}
}
@@ -359,8 +359,12 @@ fun SubscriptionStatusIndicator(click: (() -> Unit)) {
}
}
SimpleButtonFrame(click = click) {
SubscriptionStatusIndicatorView(subs = subs, hasSess = hasSess)
if (subs.total == 0 && !hasSess) {
Box {}
} else {
SimpleButtonFrame(click = click) {
SubscriptionStatusIndicatorView(subs = subs, hasSess = hasSess)
}
}
}