mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 00:52:43 +02:00
Merge branch 'develop' into aleksandrs/6801_unverified_sessions_screen
This commit is contained in:
+8
@@ -40,7 +40,11 @@ final class UserSessionsOverviewCoordinator: Coordinator, Presentable {
|
||||
let dataProvider = UserSessionsDataProvider(session: parameters.session)
|
||||
service = UserSessionsOverviewService(dataProvider: dataProvider)
|
||||
viewModel = UserSessionsOverviewViewModel(userSessionsOverviewService: service)
|
||||
|
||||
hostingViewController = VectorHostingController(rootView: UserSessionsOverview(viewModel: viewModel.context))
|
||||
hostingViewController.vc_setLargeTitleDisplayMode(.never)
|
||||
hostingViewController.vc_removeBackTitle()
|
||||
|
||||
indicatorPresenter = UserIndicatorTypePresenter(presentingViewController: hostingViewController)
|
||||
}
|
||||
|
||||
@@ -57,6 +61,10 @@ final class UserSessionsOverviewCoordinator: Coordinator, Presentable {
|
||||
self.showOtherSessions(sessionInfos: sessionInfos, filterBy: filter)
|
||||
case .verifyCurrentSession:
|
||||
self.startVerifyCurrentSession()
|
||||
case .renameSession(let sessionInfo):
|
||||
self.completion?(.renameSession(sessionInfo))
|
||||
case .logoutOfSession(let sessionInfo):
|
||||
self.completion?(.logoutOfSession(sessionInfo))
|
||||
case let .showCurrentSessionOverview(sessionInfo):
|
||||
self.showCurrentSessionOverview(sessionInfo: sessionInfo)
|
||||
case let .showUserSessionOverview(sessionInfo):
|
||||
|
||||
@@ -19,6 +19,8 @@ import Foundation
|
||||
// MARK: - Coordinator
|
||||
|
||||
enum UserSessionsOverviewCoordinatorResult {
|
||||
case renameSession(UserSessionInfo)
|
||||
case logoutOfSession(UserSessionInfo)
|
||||
case openSessionOverview(sessionInfo: UserSessionInfo)
|
||||
case openOtherSessions(sessionInfos: [UserSessionInfo], filter: OtherUserSessionsFilter)
|
||||
}
|
||||
@@ -28,6 +30,8 @@ enum UserSessionsOverviewCoordinatorResult {
|
||||
enum UserSessionsOverviewViewModelResult: Equatable {
|
||||
case showOtherSessions(sessionInfos: [UserSessionInfo], filter: OtherUserSessionsFilter)
|
||||
case verifyCurrentSession
|
||||
case renameSession(UserSessionInfo)
|
||||
case logoutOfSession(UserSessionInfo)
|
||||
case showCurrentSessionOverview(sessionInfo: UserSessionInfo)
|
||||
case showUserSessionOverview(sessionInfo: UserSessionInfo)
|
||||
}
|
||||
@@ -49,6 +53,8 @@ struct UserSessionsOverviewViewState: BindableState {
|
||||
enum UserSessionsOverviewViewAction {
|
||||
case viewAppeared
|
||||
case verifyCurrentSession
|
||||
case renameCurrentSession
|
||||
case logoutOfCurrentSession
|
||||
case viewCurrentSessionDetails
|
||||
case viewAllUnverifiedSessions
|
||||
case viewAllInactiveSessions
|
||||
|
||||
+12
@@ -39,6 +39,18 @@ class UserSessionsOverviewViewModel: UserSessionsOverviewViewModelType, UserSess
|
||||
loadData()
|
||||
case .verifyCurrentSession:
|
||||
completion?(.verifyCurrentSession)
|
||||
case .renameCurrentSession:
|
||||
guard let currentSessionInfo = userSessionsOverviewService.overviewData.currentSession else {
|
||||
assertionFailure("Missing current session")
|
||||
return
|
||||
}
|
||||
completion?(.renameSession(currentSessionInfo))
|
||||
case .logoutOfCurrentSession:
|
||||
guard let currentSessionInfo = userSessionsOverviewService.overviewData.currentSession else {
|
||||
assertionFailure("Missing current session")
|
||||
return
|
||||
}
|
||||
completion?(.logoutOfSession(currentSessionInfo))
|
||||
case .viewCurrentSessionDetails:
|
||||
guard let currentSessionInfo = userSessionsOverviewService.overviewData.currentSession else {
|
||||
assertionFailure("Missing current session")
|
||||
|
||||
+33
-7
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user