Sing out filtering

This commit is contained in:
Aleksandrs Proskurins
2022-10-27 17:35:39 +03:00
parent 66fa9fb37f
commit c19cb59604
10 changed files with 62 additions and 10 deletions
@@ -164,11 +164,15 @@ struct UserSessionsOverview: View {
.background(theme.colors.background)
} header: {
VStack(alignment: .leading) {
Text(VectorL10n.userSessionsOverviewOtherSessionsSectionTitle)
.textCase(.uppercase)
.font(theme.fonts.footnote)
.foregroundColor(theme.colors.secondaryContent)
.padding(.bottom, 8.0)
HStack {
Text(VectorL10n.userSessionsOverviewOtherSessionsSectionTitle)
.textCase(.uppercase)
.font(theme.fonts.footnote)
.foregroundColor(theme.colors.secondaryContent)
.padding(.bottom, 8.0)
Spacer()
optionsMenu
}
Text(VectorL10n.userSessionsOverviewOtherSessionsSectionInfo)
.font(theme.fonts.footnote)
@@ -198,6 +202,37 @@ struct UserSessionsOverview: View {
}
.background(theme.colors.system.ignoresSafeArea())
}
private var optionsMenu: some View {
Button { } label: {
Menu {
signOutButton
} label: {
Image(systemName: "ellipsis")
.foregroundColor(theme.colors.secondaryContent)
.padding(.horizontal, 4)
.padding(.vertical, 12)
}
}
}
@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: .signOutOtherSessions)
} label: {
label
}
} else {
Button {
viewModel.send(viewAction: .signOutOtherSessions)
} label: {
label
}
}
}
}
// MARK: - Previews