[PM-28184] Update feature flag used for no logout on KDF change (#2135)

This commit is contained in:
Matt Czech 2025-11-13 12:35:33 -06:00 committed by GitHub
parent bb67af1452
commit 6dadf79bf8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 7 deletions

View File

@ -19,6 +19,9 @@ extension FeatureFlag: @retroactive CaseIterable {
/// Flag to enable/disable forced KDF updates. /// Flag to enable/disable forced KDF updates.
static let forceUpdateKdfSettings = FeatureFlag(rawValue: "pm-18021-force-update-kdf-settings") 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] { public static var allCases: [FeatureFlag] {
[ [
@ -27,6 +30,7 @@ extension FeatureFlag: @retroactive CaseIterable {
.cipherKeyEncryption, .cipherKeyEncryption,
.enableCipherKeyEncryption, .enableCipherKeyEncryption,
.forceUpdateKdfSettings, .forceUpdateKdfSettings,
.noLogoutOnKdfChange,
] ]
} }
} }

View File

@ -226,9 +226,9 @@ class DefaultNotificationService: NotificationService {
guard let data: LogoutNotification = notificationData.data() else { return } guard let data: LogoutNotification = notificationData.data() else { return }
if data.reason == .kdfChange, 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, data.userId == userId,
await configService.getFeatureFlag(.forceUpdateKdfSettings) { await configService.getFeatureFlag(.noLogoutOnKdfChange) {
// Don't log the user out for KDF changes. // Don't log the user out for KDF changes.
break break
} }

View File

@ -502,12 +502,12 @@ class NotificationServiceTests: BitwardenTestCase { // swiftlint:disable:this ty
XCTAssertTrue(delegate.routeToLandingCalled) XCTAssertTrue(delegate.routeToLandingCalled)
} }
/// `messageReceived(_:notificationDismissed:notificationTapped:)` handles logout requests and will route /// `messageReceived(_:notificationDismissed:notificationTapped:)` handles logout requests and
/// to the landing screen if the logged-out account was the currently active account. /// doesn't route to the landing screen if the logout reason was because of a KDF change.
@MainActor @MainActor
func test_messageReceived_logout_activeUser_kdfChange() async throws { func test_messageReceived_logout_activeUser_kdfChange() async throws {
let activeAccount = Account.fixture() let activeAccount = Account.fixture()
configService.featureFlagsBool[.forceUpdateKdfSettings] = true configService.featureFlagsBool[.noLogoutOnKdfChange] = true
stateService.setIsAuthenticated() stateService.setIsAuthenticated()
stateService.accounts = [activeAccount] stateService.accounts = [activeAccount]
@ -532,9 +532,9 @@ class NotificationServiceTests: BitwardenTestCase { // swiftlint:disable:this ty
/// `messageReceived(_:notificationDismissed:notificationTapped:)` handles logout requests and will route /// `messageReceived(_:notificationDismissed:notificationTapped:)` handles logout requests and will route
/// to the landing screen if the logged-out account was the currently active account. /// to the landing screen if the logged-out account was the currently active account.
@MainActor @MainActor
func test_messageReceived_logout_activeUser_kdfChange_forceUpdateKdfSettingsOff() async throws { func test_messageReceived_logout_activeUser_kdfChange_noLogoutOnKdfChangeOff() async throws {
let activeAccount = Account.fixture() let activeAccount = Account.fixture()
configService.featureFlagsBool[.forceUpdateKdfSettings] = false configService.featureFlagsBool[.noLogoutOnKdfChange] = false
stateService.setIsAuthenticated() stateService.setIsAuthenticated()
stateService.accounts = [activeAccount] stateService.accounts = [activeAccount]