Session Manager: Single session logout

This commit is contained in:
Doug
2022-10-05 12:35:32 +01:00
committed by Doug
parent 2ef07ac75b
commit 50d974884b
13 changed files with 251 additions and 20 deletions
@@ -36,7 +36,9 @@ struct UserSessionsOverview: View {
.background(theme.colors.system.ignoresSafeArea())
.frame(maxHeight: .infinity)
.navigationTitle(VectorL10n.userSessionsOverviewTitle)
.navigationBarTitleDisplayMode(.inline)
.activityIndicator(show: viewModel.viewState.showLoadingIndicator)
.accentColor(theme.colors.accent)
.onAppear {
viewModel.send(viewAction: .viewAppeared)
}
@@ -91,18 +93,42 @@ struct UserSessionsOverview: View {
viewModel.send(viewAction: .viewCurrentSessionDetails)
})
} header: {
Text(VectorL10n.userSessionsOverviewCurrentSessionSectionTitle)
.textCase(.uppercase)
.font(theme.fonts.footnote)
.foregroundColor(theme.colors.secondaryContent)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.bottom, 12.0)
.padding(.top, 24.0)
HStack(alignment: .firstTextBaseline) {
Text(VectorL10n.userSessionsOverviewCurrentSessionSectionTitle)
.textCase(.uppercase)
.font(theme.fonts.footnote)
.foregroundColor(theme.colors.secondaryContent)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.bottom, 12.0)
.padding(.top, 24.0)
currentSessionMenu
}
}
.padding(.horizontal, 16)
}
}
private var currentSessionMenu: some View {
Menu {
Button { viewModel.send(viewAction: .renameCurrentSession) } label: {
Label(VectorL10n.manageSessionRename, systemImage: "pencil")
}
if #available(iOS 15, *) {
Button(role: .destructive) { viewModel.send(viewAction: .logoutOfCurrentSession) } label: {
Label(VectorL10n.signOut, systemImage: "rectangle.portrait.and.arrow.right.fill")
}
} else {
Button { viewModel.send(viewAction: .logoutOfCurrentSession) } label: {
Label(VectorL10n.signOut, systemImage: "rectangle.righthalf.inset.fill.arrow.right")
}
}
} label: {
Image(systemName: "ellipsis.circle")
}
}
private var otherSessionsSection: some View {
SwiftUI.Section {
LazyVStack(spacing: 0) {