mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-01 13:46:57 +02:00
Release 2.0.0
This commit is contained in:
+29
-3
@@ -24,16 +24,18 @@ struct UserSessionOverview: View {
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
UserSessionCardView(viewData: viewModel.viewState.cardViewData, onVerifyAction: { _ in
|
||||
viewModel.send(viewAction: .verifyCurrentSession)
|
||||
viewModel.send(viewAction: .verifySession)
|
||||
},
|
||||
onViewDetailsAction: { _ in
|
||||
viewModel.send(viewAction: .viewSessionDetails)
|
||||
})
|
||||
.padding(16)
|
||||
SwiftUI.Section {
|
||||
UserSessionOverviewDisclosureCell(title: VectorL10n.userSessionOverviewSessionDetailsButtonTitle, onBackgroundTap: {
|
||||
UserSessionOverviewItem(title: VectorL10n.userSessionOverviewSessionDetailsButtonTitle,
|
||||
showsChevron: true) {
|
||||
viewModel.send(viewAction: .viewSessionDetails)
|
||||
})
|
||||
}
|
||||
|
||||
if let enabled = viewModel.viewState.isPusherEnabled {
|
||||
UserSessionOverviewToggleCell(title: VectorL10n.userSessionPushNotifications,
|
||||
message: VectorL10n.userSessionPushNotificationsMessage,
|
||||
@@ -42,6 +44,14 @@ struct UserSessionOverview: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SwiftUI.Section {
|
||||
UserSessionOverviewItem(title: VectorL10n.manageSessionSignOut,
|
||||
alignment: .center,
|
||||
isDestructive: true) {
|
||||
viewModel.send(viewAction: .logoutOfSession)
|
||||
}
|
||||
}
|
||||
}
|
||||
.background(theme.colors.system.ignoresSafeArea())
|
||||
.frame(maxHeight: .infinity)
|
||||
@@ -49,6 +59,22 @@ struct UserSessionOverview: View {
|
||||
.navigationTitle(viewModel.viewState.isCurrentSession ?
|
||||
VectorL10n.userSessionOverviewCurrentSessionTitle :
|
||||
VectorL10n.userSessionOverviewSessionTitle)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Menu {
|
||||
Button { viewModel.send(viewAction: .renameSession) } label: {
|
||||
Label(VectorL10n.manageSessionRename, systemImage: "pencil")
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: "ellipsis")
|
||||
.padding(.horizontal, 4)
|
||||
.padding(.vertical, 12)
|
||||
}
|
||||
.offset(x: 4) // Re-align the symbol after applying padding.
|
||||
}
|
||||
}
|
||||
.accentColor(theme.colors.accent)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+27
-11
@@ -16,10 +16,13 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct UserSessionOverviewDisclosureCell: View {
|
||||
struct UserSessionOverviewItem: View {
|
||||
@Environment(\.theme) private var theme: ThemeSwiftUI
|
||||
|
||||
let title: String
|
||||
var alignment: Alignment = .leading
|
||||
var showsChevron = false
|
||||
var isDestructive = false
|
||||
var onBackgroundTap: (() -> Void)?
|
||||
|
||||
var body: some View {
|
||||
@@ -29,9 +32,12 @@ struct UserSessionOverviewDisclosureCell: View {
|
||||
HStack {
|
||||
Text(title)
|
||||
.font(theme.fonts.body)
|
||||
.foregroundColor(theme.colors.primaryContent)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
Image(Asset.Images.chevron.name)
|
||||
.foregroundColor(textColor)
|
||||
.frame(maxWidth: .infinity, alignment: alignment)
|
||||
|
||||
if showsChevron {
|
||||
Image(Asset.Images.chevron.name)
|
||||
}
|
||||
}
|
||||
.padding(.vertical, 15)
|
||||
.padding(.horizontal, 16)
|
||||
@@ -40,17 +46,27 @@ struct UserSessionOverviewDisclosureCell: View {
|
||||
.background(theme.colors.background)
|
||||
}
|
||||
}
|
||||
|
||||
var textColor: Color {
|
||||
isDestructive ? theme.colors.alert : theme.colors.primaryContent
|
||||
}
|
||||
}
|
||||
|
||||
struct UserSessionOverviewDisclosureCell_Previews: PreviewProvider {
|
||||
struct UserSessionOverviewItem_Previews: PreviewProvider {
|
||||
static var buttons: some View {
|
||||
NavigationView {
|
||||
ScrollView {
|
||||
UserSessionOverviewItem(title: "Nav item", showsChevron: true)
|
||||
UserSessionOverviewItem(title: "Button")
|
||||
UserSessionOverviewItem(title: "Button", isDestructive: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static var previews: some View {
|
||||
Group {
|
||||
UserSessionOverviewDisclosureCell(title: "Title")
|
||||
.theme(.light)
|
||||
.preferredColorScheme(.light)
|
||||
UserSessionOverviewDisclosureCell(title: "Title")
|
||||
.theme(.dark)
|
||||
.preferredColorScheme(.dark)
|
||||
buttons.theme(.light).preferredColorScheme(.light)
|
||||
buttons.theme(.dark).preferredColorScheme(.dark)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user