diff --git a/BitwardenShared/Core/Platform/Models/Enum/FeatureFlag.swift b/BitwardenShared/Core/Platform/Models/Enum/FeatureFlag.swift index 027e7d5ae..7ad9b3af8 100644 --- a/BitwardenShared/Core/Platform/Models/Enum/FeatureFlag.swift +++ b/BitwardenShared/Core/Platform/Models/Enum/FeatureFlag.swift @@ -19,6 +19,9 @@ extension FeatureFlag: @retroactive CaseIterable { /// Flag to enable/disable forced KDF updates. static let forceUpdateKdfSettings = FeatureFlag(rawValue: "pm-18021-force-update-kdf-settings") + + /// Flag to enable/disable not logging out when a user's KDF settings are changed. + static let noLogoutOnKdfChange = FeatureFlag(rawValue: "pm-23995-no-logout-on-kdf-change") public static var allCases: [FeatureFlag] { [ @@ -27,6 +30,7 @@ extension FeatureFlag: @retroactive CaseIterable { .cipherKeyEncryption, .enableCipherKeyEncryption, .forceUpdateKdfSettings, + .noLogoutOnKdfChange, ] } } diff --git a/BitwardenShared/Core/Platform/Services/NotificationService.swift b/BitwardenShared/Core/Platform/Services/NotificationService.swift index 6d2fc255a..f92db6ea7 100644 --- a/BitwardenShared/Core/Platform/Services/NotificationService.swift +++ b/BitwardenShared/Core/Platform/Services/NotificationService.swift @@ -226,9 +226,9 @@ class DefaultNotificationService: NotificationService { guard let data: LogoutNotification = notificationData.data() else { return } if data.reason == .kdfChange, - // TODO: PM-26960 Remove user ID check with forceUpdateKdfSettings feature flag. + // TODO: PM-26960 Remove user ID check with noLogoutOnKdfChange feature flag. data.userId == userId, - await configService.getFeatureFlag(.forceUpdateKdfSettings) { + await configService.getFeatureFlag(.noLogoutOnKdfChange) { // Don't log the user out for KDF changes. break } diff --git a/BitwardenShared/Core/Platform/Services/NotificationServiceTests.swift b/BitwardenShared/Core/Platform/Services/NotificationServiceTests.swift index 18a182c85..63fced67b 100644 --- a/BitwardenShared/Core/Platform/Services/NotificationServiceTests.swift +++ b/BitwardenShared/Core/Platform/Services/NotificationServiceTests.swift @@ -502,12 +502,12 @@ class NotificationServiceTests: BitwardenTestCase { // swiftlint:disable:this ty XCTAssertTrue(delegate.routeToLandingCalled) } - /// `messageReceived(_:notificationDismissed:notificationTapped:)` handles logout requests and will route - /// to the landing screen if the logged-out account was the currently active account. + /// `messageReceived(_:notificationDismissed:notificationTapped:)` handles logout requests and + /// doesn't route to the landing screen if the logout reason was because of a KDF change. @MainActor func test_messageReceived_logout_activeUser_kdfChange() async throws { let activeAccount = Account.fixture() - configService.featureFlagsBool[.forceUpdateKdfSettings] = true + configService.featureFlagsBool[.noLogoutOnKdfChange] = true stateService.setIsAuthenticated() stateService.accounts = [activeAccount] @@ -532,9 +532,9 @@ class NotificationServiceTests: BitwardenTestCase { // swiftlint:disable:this ty /// `messageReceived(_:notificationDismissed:notificationTapped:)` handles logout requests and will route /// to the landing screen if the logged-out account was the currently active account. @MainActor - func test_messageReceived_logout_activeUser_kdfChange_forceUpdateKdfSettingsOff() async throws { + func test_messageReceived_logout_activeUser_kdfChange_noLogoutOnKdfChangeOff() async throws { let activeAccount = Account.fixture() - configService.featureFlagsBool[.forceUpdateKdfSettings] = false + configService.featureFlagsBool[.noLogoutOnKdfChange] = false stateService.setIsAuthenticated() stateService.accounts = [activeAccount]