From 60e5479318698d8e6294cf4d058153c772b3ab4d Mon Sep 17 00:00:00 2001 From: Doug Date: Mon, 30 Oct 2023 18:09:15 +0000 Subject: [PATCH 1/2] Remove App Lock feature flag. --- ElementX/Sources/Application/AppCoordinator.swift | 4 +--- ElementX/Sources/Application/AppSettings.swift | 4 ---- .../Sources/Mocks/Generated/GeneratedMocks.swift | 2 +- .../DeveloperOptionsScreenModels.swift | 1 - .../View/DeveloperOptionsScreen.swift | 5 ----- .../SettingsScreen/SettingsScreenModels.swift | 1 - .../SettingsScreen/SettingsScreenViewModel.swift | 5 ----- .../SettingsScreen/View/SettingsScreen.swift | 14 ++++++-------- .../Sources/Services/AppLock/AppLockService.swift | 1 - .../en-GB-iPad-9th-generation.settings.png | 4 ++-- .../Application/en-GB-iPhone-14.settings.png | 4 ++-- .../pseudo-iPad-9th-generation.settings.png | 4 ++-- .../Application/pseudo-iPhone-14.settings.png | 4 ++-- .../Sources/AppLock/AppLockServiceTests.swift | 1 - .../AppLockSettingsScreenViewModelTests.swift | 10 +--------- .../PreviewTests/test_settingsScreen.1.png | 4 ++-- 16 files changed, 19 insertions(+), 49 deletions(-) diff --git a/ElementX/Sources/Application/AppCoordinator.swift b/ElementX/Sources/Application/AppCoordinator.swift index ba8e39a7bc..002a034a3f 100644 --- a/ElementX/Sources/Application/AppCoordinator.swift +++ b/ElementX/Sources/Application/AppCoordinator.swift @@ -149,9 +149,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationCoordinatorDelegate, return } - if appSettings.appLockFlowEnabled, - appSettings.appLockIsMandatory, - !appLockFlowCoordinator.appLockService.isEnabled { + if appSettings.appLockIsMandatory, !appLockFlowCoordinator.appLockService.isEnabled { stateMachine.processEvent(.startWithAppLockSetup) } else { stateMachine.processEvent(.startWithExistingSession) diff --git a/ElementX/Sources/Application/AppSettings.swift b/ElementX/Sources/Application/AppSettings.swift index adf2248222..32632aab17 100644 --- a/ElementX/Sources/Application/AppSettings.swift +++ b/ElementX/Sources/Application/AppSettings.swift @@ -42,7 +42,6 @@ final class AppSettings { case userSuggestionsEnabled case readReceiptsEnabled case swiftUITimelineEnabled - case appLockFlowEnabled case elementCallEnabled case chatBackupEnabled } @@ -268,9 +267,6 @@ final class AppSettings { @UserPreference(key: UserDefaultsKeys.swiftUITimelineEnabled, defaultValue: false, storageType: .volatile) var swiftUITimelineEnabled - @UserPreference(key: UserDefaultsKeys.appLockFlowEnabled, defaultValue: false, storageType: .volatile) - var appLockFlowEnabled - @UserPreference(key: UserDefaultsKeys.elementCallEnabled, defaultValue: true, storageType: .userDefaults(store)) var elementCallEnabled diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index 91166478f6..ab618e842a 100644 --- a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift @@ -1,4 +1,4 @@ -// Generated using Sourcery 2.1.1 — https://github.com/krzysztofzablocki/Sourcery +// Generated using Sourcery 2.1.2 — https://github.com/krzysztofzablocki/Sourcery // DO NOT EDIT // swiftlint:disable all diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift index fb4180f494..d63694e275 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift @@ -49,7 +49,6 @@ protocol DeveloperOptionsProtocol: AnyObject { var userSuggestionsEnabled: Bool { get set } var readReceiptsEnabled: Bool { get set } var swiftUITimelineEnabled: Bool { get set } - var appLockFlowEnabled: Bool { get set } var elementCallEnabled: Bool { get set } var chatBackupEnabled: Bool { get set } } diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift index 667daecfbb..a877ccfd0e 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift @@ -36,11 +36,6 @@ struct DeveloperOptionsScreen: View { Text("Chat backup") Text("Requires app reboot") } - - Toggle(isOn: $context.appLockFlowEnabled) { - Text("PIN/Biometric lock") - Text("Resets on reboot") - } } Section("Timeline") { diff --git a/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenModels.swift b/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenModels.swift index da7053e042..da7bdeea3d 100644 --- a/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenModels.swift @@ -44,7 +44,6 @@ struct SettingsScreenViewState: BindableState { var isSessionVerified = false var chatBackupEnabled = false var showSecureBackupBadge = false - var showAppLockSettings: Bool var showDeveloperOptions: Bool /// The presentation anchor used to display the OIDC account URL. diff --git a/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenViewModel.swift b/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenViewModel.swift index 3081b59f44..c8b98af719 100644 --- a/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenViewModel.swift +++ b/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenViewModel.swift @@ -37,7 +37,6 @@ class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewMo userID: userSession.userID, accountProfileURL: userSession.clientProxy.accountURL(action: .profile), accountSessionsListURL: userSession.clientProxy.accountURL(action: .sessionsList), - showAppLockSettings: appSettings.appLockFlowEnabled, showDeveloperOptions: appSettings.canShowDeveloperOptions), imageProvider: userSession.mediaProvider) @@ -50,10 +49,6 @@ class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewMo .receive(on: DispatchQueue.main) .weakAssign(to: \.state.userDisplayName, on: self) .store(in: &cancellables) - - appSettings.$appLockFlowEnabled - .weakAssign(to: \.state.showAppLockSettings, on: self) - .store(in: &cancellables) appSettings.$chatBackupEnabled .weakAssign(to: \.state.chatBackupEnabled, on: self) diff --git a/ElementX/Sources/Screens/Settings/SettingsScreen/View/SettingsScreen.swift b/ElementX/Sources/Screens/Settings/SettingsScreen/View/SettingsScreen.swift index 7bdc4b43f1..e0342af24c 100644 --- a/ElementX/Sources/Screens/Settings/SettingsScreen/View/SettingsScreen.swift +++ b/ElementX/Sources/Screens/Settings/SettingsScreen/View/SettingsScreen.swift @@ -125,14 +125,12 @@ struct SettingsScreen: View { }) .accessibilityIdentifier(A11yIdentifiers.settingsScreen.analytics) - if context.viewState.showAppLockSettings { - ListRow(label: .default(title: L10n.commonScreenLock, - systemIcon: .lock), - kind: .navigationLink { - context.send(viewAction: .appLock) - }) - .accessibilityIdentifier(A11yIdentifiers.settingsScreen.screenLock) - } + ListRow(label: .default(title: L10n.commonScreenLock, + systemIcon: .lock), + kind: .navigationLink { + context.send(viewAction: .appLock) + }) + .accessibilityIdentifier(A11yIdentifiers.settingsScreen.screenLock) ListRow(label: .default(title: L10n.commonReportABug, systemIcon: .ladybug), diff --git a/ElementX/Sources/Services/AppLock/AppLockService.swift b/ElementX/Sources/Services/AppLock/AppLockService.swift index 0c186c5105..754345e52a 100644 --- a/ElementX/Sources/Services/AppLock/AppLockService.swift +++ b/ElementX/Sources/Services/AppLock/AppLockService.swift @@ -30,7 +30,6 @@ class AppLockService: AppLockServiceProtocol { var isEnabled: Bool { do { - guard appSettings.appLockFlowEnabled else { return false } return try keychainController.containsPINCode() } catch { MXLog.error("Keychain access error: \(error)") diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.settings.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.settings.png index d251428e92..b014d81aaf 100644 --- a/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.settings.png +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.settings.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2d52589f1520f6a7136c75b0b3ef6eedf6a74091781b8ebaaae95994bdd1c9f4 -size 130543 +oid sha256:6e6f92b34f1fc44ab715f811927c5540411e57e146fec22ef8289401bfddb088 +size 142521 diff --git a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.settings.png b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.settings.png index 041da6f9d9..03506d0ba0 100644 --- a/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.settings.png +++ b/UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.settings.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:17352f14ec5ddd7e5e80ee3eee9a03bbb62c8abfcf462bd20d2f1dbfaca2c4ef -size 165470 +oid sha256:c69370f221a490d0e8303b8f1849c30218cec9ced7f41c4e511da3a1e04fb71f +size 170945 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.settings.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.settings.png index bedf0783ff..e308928e48 100644 --- a/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.settings.png +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.settings.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:532c9ad4d08ceb768ee9315b77b4f87d4cb880d47b106b7fdc0f49004b6e0030 -size 139055 +oid sha256:80774cf7193943271488b87e8e4eabc92553b73f2947f59f8de7aaefdacdbec0 +size 152559 diff --git a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.settings.png b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.settings.png index b3de308e5b..f5c492d890 100644 --- a/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.settings.png +++ b/UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.settings.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3eb31a65d4f20db1a9cd5d7c5632d0e22d9e1e01bebb611a276127df248bd8b3 -size 180425 +oid sha256:70a375a63ca02a6bfbdf45cf5d15224fce9d2432eb5b70942f43a5284329e6d0 +size 191661 diff --git a/UnitTests/Sources/AppLock/AppLockServiceTests.swift b/UnitTests/Sources/AppLock/AppLockServiceTests.swift index 7613b55ef4..63a21c377d 100644 --- a/UnitTests/Sources/AppLock/AppLockServiceTests.swift +++ b/UnitTests/Sources/AppLock/AppLockServiceTests.swift @@ -28,7 +28,6 @@ class AppLockServiceTests: XCTestCase { override func setUp() { AppSettings.reset() appSettings = AppSettings() - appSettings.appLockFlowEnabled = true keychainController = KeychainController(service: .tests, accessGroup: InfoPlistReader.main.keychainAccessGroupIdentifier) keychainController.resetSecrets() diff --git a/UnitTests/Sources/AppLock/AppLockSettingsScreenViewModelTests.swift b/UnitTests/Sources/AppLock/AppLockSettingsScreenViewModelTests.swift index e77ff8bb90..31a09f126f 100644 --- a/UnitTests/Sources/AppLock/AppLockSettingsScreenViewModelTests.swift +++ b/UnitTests/Sources/AppLock/AppLockSettingsScreenViewModelTests.swift @@ -29,19 +29,11 @@ class AppLockSetupSettingsScreenViewModelTests: XCTestCase { } override func setUpWithError() throws { - AppSettings.reset() - let appSettings = AppSettings() - appSettings.appLockFlowEnabled = true - keychainController = KeychainControllerMock() - appLockService = AppLockService(keychainController: keychainController, appSettings: appSettings) + appLockService = AppLockService(keychainController: keychainController, appSettings: AppSettings()) viewModel = AppLockSetupSettingsScreenViewModel(appLockService: AppLockServiceMock.mock()) } - - override func tearDown() { - AppSettings.reset() - } func testDisablingShowsAlert() { // Given a fresh screen with the PIN code enabled. diff --git a/UnitTests/__Snapshots__/PreviewTests/test_settingsScreen.1.png b/UnitTests/__Snapshots__/PreviewTests/test_settingsScreen.1.png index bc8867a7b2..ba0004d300 100644 --- a/UnitTests/__Snapshots__/PreviewTests/test_settingsScreen.1.png +++ b/UnitTests/__Snapshots__/PreviewTests/test_settingsScreen.1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3c35b52beaa7f44389704efcd1ede447185767e3d1b03cde6aa54688bb7cc988 -size 171137 +oid sha256:49f8dcc11df3c4a0df9119efdfc6ef3f23271125723dcbed1c5f78ab8695421c +size 178128 From 1920099a83effc5b6f75b2416c5b6270d72ecb35 Mon Sep 17 00:00:00 2001 From: Doug Date: Mon, 30 Oct 2023 18:11:09 +0000 Subject: [PATCH 2/2] Changelog. --- changelog.d/pr-1990.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/pr-1990.feature diff --git a/changelog.d/pr-1990.feature b/changelog.d/pr-1990.feature new file mode 100644 index 0000000000..fd452c93ea --- /dev/null +++ b/changelog.d/pr-1990.feature @@ -0,0 +1 @@ +Allow the app to be locked with a PIN code or Touch/Face ID. \ No newline at end of file