mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 08:15:24 +00:00
Enable the App Lock feature. (#1990)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
-1
@@ -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 }
|
||||
}
|
||||
|
||||
-5
@@ -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") {
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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)")
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2d52589f1520f6a7136c75b0b3ef6eedf6a74091781b8ebaaae95994bdd1c9f4
|
||||
size 130543
|
||||
oid sha256:6e6f92b34f1fc44ab715f811927c5540411e57e146fec22ef8289401bfddb088
|
||||
size 142521
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:17352f14ec5ddd7e5e80ee3eee9a03bbb62c8abfcf462bd20d2f1dbfaca2c4ef
|
||||
size 165470
|
||||
oid sha256:c69370f221a490d0e8303b8f1849c30218cec9ced7f41c4e511da3a1e04fb71f
|
||||
size 170945
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:532c9ad4d08ceb768ee9315b77b4f87d4cb880d47b106b7fdc0f49004b6e0030
|
||||
size 139055
|
||||
oid sha256:80774cf7193943271488b87e8e4eabc92553b73f2947f59f8de7aaefdacdbec0
|
||||
size 152559
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3eb31a65d4f20db1a9cd5d7c5632d0e22d9e1e01bebb611a276127df248bd8b3
|
||||
size 180425
|
||||
oid sha256:70a375a63ca02a6bfbdf45cf5d15224fce9d2432eb5b70942f43a5284329e6d0
|
||||
size 191661
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3c35b52beaa7f44389704efcd1ede447185767e3d1b03cde6aa54688bb7cc988
|
||||
size 171137
|
||||
oid sha256:49f8dcc11df3c4a0df9119efdfc6ef3f23271125723dcbed1c5f78ab8695421c
|
||||
size 178128
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Allow the app to be locked with a PIN code or Touch/Face ID.
|
||||
Reference in New Issue
Block a user