mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-03 06:36:58 +02:00
Hide sign out x/all buttons in the Device Manager when using OIDC. (#7674)
This commit is contained in:
+2
@@ -21,6 +21,7 @@ struct UserOtherSessionsCoordinatorParameters {
|
||||
let sessionInfos: [UserSessionInfo]
|
||||
let filter: UserOtherSessionsFilter
|
||||
let title: String
|
||||
let showDeviceLogout: Bool
|
||||
}
|
||||
|
||||
final class UserOtherSessionsCoordinator: Coordinator, Presentable {
|
||||
@@ -40,6 +41,7 @@ final class UserOtherSessionsCoordinator: Coordinator, Presentable {
|
||||
let viewModel = UserOtherSessionsViewModel(sessionInfos: parameters.sessionInfos,
|
||||
filter: parameters.filter,
|
||||
title: parameters.title,
|
||||
showDeviceLogout: parameters.showDeviceLogout,
|
||||
settingsService: RiotSettings.shared)
|
||||
let view = UserOtherSessions(viewModel: viewModel.context)
|
||||
userOtherSessionsViewModel = viewModel
|
||||
|
||||
+5
@@ -49,26 +49,31 @@ enum MockUserOtherSessionsScreenState: MockScreenState, CaseIterable {
|
||||
viewModel = UserOtherSessionsViewModel(sessionInfos: allSessions(),
|
||||
filter: .all,
|
||||
title: VectorL10n.userSessionsOverviewOtherSessionsSectionTitle,
|
||||
showDeviceLogout: true,
|
||||
settingsService: MockUserSessionSettings())
|
||||
case .none:
|
||||
viewModel = UserOtherSessionsViewModel(sessionInfos: [],
|
||||
filter: .all,
|
||||
title: VectorL10n.userSessionsOverviewOtherSessionsSectionTitle,
|
||||
showDeviceLogout: true,
|
||||
settingsService: MockUserSessionSettings())
|
||||
case .inactiveSessions:
|
||||
viewModel = UserOtherSessionsViewModel(sessionInfos: inactiveSessions(),
|
||||
filter: .inactive,
|
||||
title: VectorL10n.userOtherSessionSecurityRecommendationTitle,
|
||||
showDeviceLogout: true,
|
||||
settingsService: MockUserSessionSettings())
|
||||
case .unverifiedSessions:
|
||||
viewModel = UserOtherSessionsViewModel(sessionInfos: unverifiedSessions(),
|
||||
filter: .unverified,
|
||||
title: VectorL10n.userOtherSessionSecurityRecommendationTitle,
|
||||
showDeviceLogout: true,
|
||||
settingsService: MockUserSessionSettings())
|
||||
case .verifiedSessions:
|
||||
viewModel = UserOtherSessionsViewModel(sessionInfos: verifiedSessions(),
|
||||
filter: .verified,
|
||||
title: VectorL10n.userOtherSessionSecurityRecommendationTitle,
|
||||
showDeviceLogout: true,
|
||||
settingsService: MockUserSessionSettings())
|
||||
}
|
||||
|
||||
|
||||
+27
-13
@@ -63,7 +63,8 @@ class UserOtherSessionsViewModelTests: XCTestCase {
|
||||
emptyItemsTitle: VectorL10n.userOtherSessionNoInactiveSessions,
|
||||
allItemsSelected: false,
|
||||
enableSignOutButton: false,
|
||||
showLocationInfo: false)
|
||||
showLocationInfo: false,
|
||||
showDeviceLogout: true)
|
||||
XCTAssertEqual(sut.state, expectedState)
|
||||
}
|
||||
|
||||
@@ -81,7 +82,8 @@ class UserOtherSessionsViewModelTests: XCTestCase {
|
||||
emptyItemsTitle: "",
|
||||
allItemsSelected: false,
|
||||
enableSignOutButton: false,
|
||||
showLocationInfo: false)
|
||||
showLocationInfo: false,
|
||||
showDeviceLogout: true)
|
||||
XCTAssertEqual(sut.state, expectedState)
|
||||
}
|
||||
|
||||
@@ -104,7 +106,8 @@ class UserOtherSessionsViewModelTests: XCTestCase {
|
||||
emptyItemsTitle: VectorL10n.userOtherSessionNoUnverifiedSessions,
|
||||
allItemsSelected: false,
|
||||
enableSignOutButton: false,
|
||||
showLocationInfo: false)
|
||||
showLocationInfo: false,
|
||||
showDeviceLogout: true)
|
||||
XCTAssertEqual(expectedItems.count, 2)
|
||||
XCTAssertEqual(sut.state, expectedState)
|
||||
}
|
||||
@@ -123,7 +126,8 @@ class UserOtherSessionsViewModelTests: XCTestCase {
|
||||
emptyItemsTitle: VectorL10n.userOtherSessionNoVerifiedSessions,
|
||||
allItemsSelected: false,
|
||||
enableSignOutButton: false,
|
||||
showLocationInfo: false)
|
||||
showLocationInfo: false,
|
||||
showDeviceLogout: true)
|
||||
XCTAssertEqual(sut.state, expectedState)
|
||||
}
|
||||
|
||||
@@ -139,7 +143,8 @@ class UserOtherSessionsViewModelTests: XCTestCase {
|
||||
emptyItemsTitle: VectorL10n.userOtherSessionNoVerifiedSessions,
|
||||
allItemsSelected: false,
|
||||
enableSignOutButton: false,
|
||||
showLocationInfo: false)
|
||||
showLocationInfo: false,
|
||||
showDeviceLogout: true)
|
||||
XCTAssertEqual(sut.state, expectedState)
|
||||
}
|
||||
|
||||
@@ -155,7 +160,8 @@ class UserOtherSessionsViewModelTests: XCTestCase {
|
||||
emptyItemsTitle: VectorL10n.userOtherSessionNoUnverifiedSessions,
|
||||
allItemsSelected: false,
|
||||
enableSignOutButton: false,
|
||||
showLocationInfo: false)
|
||||
showLocationInfo: false,
|
||||
showDeviceLogout: true)
|
||||
XCTAssertEqual(sut.state, expectedState)
|
||||
}
|
||||
|
||||
@@ -171,7 +177,8 @@ class UserOtherSessionsViewModelTests: XCTestCase {
|
||||
emptyItemsTitle: VectorL10n.userOtherSessionNoInactiveSessions,
|
||||
allItemsSelected: false,
|
||||
enableSignOutButton: false,
|
||||
showLocationInfo: false)
|
||||
showLocationInfo: false,
|
||||
showDeviceLogout: true)
|
||||
XCTAssertEqual(sut.state, expectedState)
|
||||
}
|
||||
|
||||
@@ -192,7 +199,8 @@ class UserOtherSessionsViewModelTests: XCTestCase {
|
||||
emptyItemsTitle: "",
|
||||
allItemsSelected: true,
|
||||
enableSignOutButton: true,
|
||||
showLocationInfo: false)
|
||||
showLocationInfo: false,
|
||||
showDeviceLogout: true)
|
||||
XCTAssertEqual(sut.state, expectedState)
|
||||
}
|
||||
|
||||
@@ -213,7 +221,8 @@ class UserOtherSessionsViewModelTests: XCTestCase {
|
||||
emptyItemsTitle: "",
|
||||
allItemsSelected: false,
|
||||
enableSignOutButton: false,
|
||||
showLocationInfo: false)
|
||||
showLocationInfo: false,
|
||||
showDeviceLogout: true)
|
||||
XCTAssertEqual(sut.state, expectedState)
|
||||
}
|
||||
|
||||
@@ -233,7 +242,8 @@ class UserOtherSessionsViewModelTests: XCTestCase {
|
||||
emptyItemsTitle: "",
|
||||
allItemsSelected: false,
|
||||
enableSignOutButton: true,
|
||||
showLocationInfo: false)
|
||||
showLocationInfo: false,
|
||||
showDeviceLogout: true)
|
||||
XCTAssertEqual(sut.state, expectedState)
|
||||
}
|
||||
|
||||
@@ -253,7 +263,8 @@ class UserOtherSessionsViewModelTests: XCTestCase {
|
||||
emptyItemsTitle: "",
|
||||
allItemsSelected: true,
|
||||
enableSignOutButton: true,
|
||||
showLocationInfo: false)
|
||||
showLocationInfo: false,
|
||||
showDeviceLogout: true)
|
||||
XCTAssertEqual(sut.state, expectedState)
|
||||
}
|
||||
|
||||
@@ -273,7 +284,8 @@ class UserOtherSessionsViewModelTests: XCTestCase {
|
||||
emptyItemsTitle: "",
|
||||
allItemsSelected: false,
|
||||
enableSignOutButton: false,
|
||||
showLocationInfo: false)
|
||||
showLocationInfo: false,
|
||||
showDeviceLogout: true)
|
||||
XCTAssertEqual(sut.state, expectedState)
|
||||
}
|
||||
|
||||
@@ -296,7 +308,8 @@ class UserOtherSessionsViewModelTests: XCTestCase {
|
||||
emptyItemsTitle: "",
|
||||
allItemsSelected: false,
|
||||
enableSignOutButton: false,
|
||||
showLocationInfo: false)
|
||||
showLocationInfo: false,
|
||||
showDeviceLogout: true)
|
||||
XCTAssertEqual(sut.state, expectedState)
|
||||
}
|
||||
|
||||
@@ -352,6 +365,7 @@ class UserOtherSessionsViewModelTests: XCTestCase {
|
||||
UserOtherSessionsViewModel(sessionInfos: sessionInfos,
|
||||
filter: filter,
|
||||
title: title,
|
||||
showDeviceLogout: true,
|
||||
settingsService: MockUserSessionSettings())
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ struct UserOtherSessionsViewState: BindableState, Equatable {
|
||||
var allItemsSelected: Bool
|
||||
var enableSignOutButton: Bool
|
||||
var showLocationInfo: Bool
|
||||
var showDeviceLogout: Bool
|
||||
}
|
||||
|
||||
struct UserOtherSessionsBindings: Equatable {
|
||||
|
||||
@@ -28,6 +28,7 @@ class UserOtherSessionsViewModel: UserOtherSessionsViewModelType, UserOtherSessi
|
||||
init(sessionInfos: [UserSessionInfo],
|
||||
filter: UserOtherSessionsFilter,
|
||||
title: String,
|
||||
showDeviceLogout: Bool,
|
||||
settingsService: UserSessionSettingsProtocol) {
|
||||
self.sessionInfos = sessionInfos
|
||||
defaultTitle = title
|
||||
@@ -41,7 +42,8 @@ class UserOtherSessionsViewModel: UserOtherSessionsViewModelType, UserOtherSessi
|
||||
emptyItemsTitle: filter.userOtherSessionsViewEmptyResultsTitle,
|
||||
allItemsSelected: false,
|
||||
enableSignOutButton: false,
|
||||
showLocationInfo: settingsService.showIPAddressesInSessionsManager))
|
||||
showLocationInfo: settingsService.showIPAddressesInSessionsManager,
|
||||
showDeviceLogout: showDeviceLogout))
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
@@ -60,6 +60,7 @@ struct UserOtherSessions: View {
|
||||
set: { _ in withAnimation { viewModel.send(viewAction: .showLocationInfo) } }),
|
||||
allItemsSelected: viewModel.viewState.allItemsSelected,
|
||||
sessionCount: viewModel.viewState.sessionItems.count,
|
||||
showDeviceLogout: viewModel.viewState.showDeviceLogout,
|
||||
onToggleSelection: { viewModel.send(viewAction: .toggleAllSelection) },
|
||||
onSignOut: { viewModel.send(viewAction: .logoutAllUserSessions) })
|
||||
}
|
||||
|
||||
+2
-1
@@ -24,6 +24,7 @@ struct UserOtherSessionsToolbar: ToolbarContent {
|
||||
@Binding var isShowLocationEnabled: Bool
|
||||
let allItemsSelected: Bool
|
||||
let sessionCount: Int
|
||||
let showDeviceLogout: Bool
|
||||
let onToggleSelection: () -> Void
|
||||
let onSignOut: () -> Void
|
||||
|
||||
@@ -94,7 +95,7 @@ struct UserOtherSessionsToolbar: ToolbarContent {
|
||||
Label(showLocationInfo: isShowLocationEnabled)
|
||||
}
|
||||
|
||||
if sessionCount > 0 {
|
||||
if sessionCount > 0, showDeviceLogout {
|
||||
DestructiveButton {
|
||||
onSignOut()
|
||||
} label: {
|
||||
|
||||
Reference in New Issue
Block a user