mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-18 23:48:29 +02:00
Code review fixes, created DestructiveButton
This commit is contained in:
@@ -138,7 +138,11 @@ struct UserSessionsOverview: View {
|
||||
}
|
||||
}
|
||||
if viewModel.viewState.otherSessionsViewData.count > 0 {
|
||||
signOutOtherSessionsButton
|
||||
DestructiveButton {
|
||||
viewModel.send(viewAction: .logoutOtherSessions)
|
||||
} label: {
|
||||
Label(VectorL10n.manageSessionSignOutOtherSessions, systemImage: "rectangle.portrait.and.arrow.forward.fill")
|
||||
}
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: "ellipsis")
|
||||
@@ -209,7 +213,11 @@ struct UserSessionsOverview: View {
|
||||
private var optionsMenu: some View {
|
||||
Button { } label: {
|
||||
Menu {
|
||||
signOutButton
|
||||
DestructiveButton {
|
||||
viewModel.send(viewAction: .logoutOtherSessions)
|
||||
} label: {
|
||||
Label(VectorL10n.userOtherSessionMenuSignOutSessions(String(viewModel.viewState.otherSessionsViewData.count)), systemImage: "rectangle.portrait.and.arrow.forward.fill")
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: "ellipsis")
|
||||
.foregroundColor(theme.colors.secondaryContent)
|
||||
@@ -218,38 +226,6 @@ struct UserSessionsOverview: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var signOutButton: some View {
|
||||
let label = Label(VectorL10n.userOtherSessionMenuSignOutSessions(String(viewModel.viewState.otherSessionsViewData.count)), systemImage: "rectangle.portrait.and.arrow.forward.fill")
|
||||
if #available(iOS 15, *) {
|
||||
Button(role: .destructive) {
|
||||
viewModel.send(viewAction: .logoutOtherSessions)
|
||||
} label: {
|
||||
label
|
||||
}
|
||||
} else {
|
||||
Button {
|
||||
viewModel.send(viewAction: .logoutOtherSessions)
|
||||
} label: {
|
||||
label
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var signOutOtherSessionsButton: some View {
|
||||
let label = Label(VectorL10n.manageSessionSignOutOtherSessions, systemImage: "rectangle.portrait.and.arrow.forward.fill")
|
||||
if #available(iOS 15, *) {
|
||||
Button(role: .destructive) { viewModel.send(viewAction: .logoutOtherSessions) } label: {
|
||||
label
|
||||
}
|
||||
} else {
|
||||
Button { viewModel.send(viewAction: .logoutOtherSessions) } label: {
|
||||
label
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Previews
|
||||
|
||||
Reference in New Issue
Block a user