diff --git a/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings b/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings index c5cce6d8..bfb77b4c 100644 --- a/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings +++ b/ui/BankingiOSApp/BankingiOSApp/Base.lproj/Localizable.strings @@ -166,11 +166,14 @@ Unfortunately, Bankmeister cannot know whether a bank charges for instant paymen /* ProtectAppSettingsDialog */ -"Protect App Settings Dialog title" = "Security settings"; +"Protect App Settings Dialog title" = "Select app protection"; "FaceID" = "FaceID"; "TouchID" = "TouchID"; "Password" = "Password"; +"None" = "Unprotected"; "Authenticate with TouchID" = "Authenticate with TouchID"; "Enter new password" = "Enter new password"; "Confirm password" = "Confirm password"; "Confirm new password" = "Confirm new password"; +"Do you really want to remove app protection?" = "Do you really want to remove app protection?"; +"Remove app protection" = "Remove app protection"; diff --git a/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings b/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings index e1348315..76a243a9 100644 --- a/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings +++ b/ui/BankingiOSApp/BankingiOSApp/de.lproj/Localizable.strings @@ -166,11 +166,14 @@ Ob eine Bank Gebühren für Echtzeitüberweisungen erhebt, kann Bankmeister leid /* ProtectAppSettingsDialog */ -"Protect App Settings Dialog title" = "Sicherheitseinstellungen"; // TODO: find a better title +"Protect App Settings Dialog title" = "Appzugangsschutz festlegen"; "FaceID" = "FaceID"; "TouchID" = "TouchID"; "Password" = "Passwort"; +"None" = "Ungeschützt"; "Authenticate with TouchID" = "Mit TouchID authentifizieren"; "Enter new password" = "Neues Passwort eingeben"; "Confirm password" = "Bestätigen"; "Confirm new password" = "Neues Passwort bestätigen"; +"Do you really want to remove app protection?" = "Möchten Sie den Appzugangsschutz wirklich entfernen?"; +"Remove app protection" = "Appzugangsschutz entfernen"; diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/ViewExtensions.swift b/ui/BankingiOSApp/BankingiOSApp/ui/ViewExtensions.swift index fc2cf225..5133ad66 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/ViewExtensions.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/ViewExtensions.swift @@ -110,6 +110,18 @@ extension Color { static let systemBackground = Color(UIColor.systemBackground) static let secondarySystemBackground = Color(UIColor.secondarySystemBackground) static let tertiarySystemBackground = Color(UIColor.tertiarySystemBackground) + + static let systemGroupedBackground = Color(UIColor.systemGroupedBackground) + + static var destructive: Color { + if UIColor.responds(to: Selector(("_systemDestructiveTintColor"))) { + if let red = UIColor.perform(Selector(("_systemDestructiveTintColor")))?.takeUnretainedValue() as? UIColor { + return Color(red) + } + } + + return Color.red + } // There are more.. } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/BankSettingsDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/BankSettingsDialog.swift index 0e460e0d..034eb7a8 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/BankSettingsDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/BankSettingsDialog.swift @@ -87,7 +87,7 @@ struct BankSettingsDialog: View { Spacer() Button("Delete account", action: askUserToDeleteAccount) - .foregroundColor(Color.red) + .foregroundColor(Color.destructive) Spacer() } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/ProtectAppSettingsDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/ProtectAppSettingsDialog.swift index 0d49e59d..32612fd9 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/ProtectAppSettingsDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/ProtectAppSettingsDialog.swift @@ -16,6 +16,8 @@ struct ProtectAppSettingsDialog: View { @State private var isPasswordSelected: Bool = false + @State private var isNoAppProtectionSelected: Bool = false + @State private var selectedAuthenticationTypeIndex = 0 private var selectedAuthenticationTypeIndexBinding: Binding { @@ -40,6 +42,8 @@ struct ProtectAppSettingsDialog: View { init() { + let currentAuthenticationType = authenticationService.authenticationType + var authenticationTypes = [AuthenticationType]() if authenticationService.deviceSupportsFaceID { @@ -51,10 +55,13 @@ struct ProtectAppSettingsDialog: View { authenticationTypes.append(.password) + if currentAuthenticationType != .none { + authenticationTypes.append(.none) + } + self.supportedAuthenticationTypes = authenticationTypes - let currentAuthenticationType = authenticationService.authenticationType if currentAuthenticationType == .faceID || (currentAuthenticationType != .password && authenticationService.deviceSupportsFaceID) { _isFaceIDSelected = State(initialValue: true) _selectedAuthenticationTypeIndex = State(initialValue: 0) @@ -109,12 +116,20 @@ struct ProtectAppSettingsDialog: View { } } + if isNoAppProtectionSelected { + Section { + Text("Do you really want to remove app protection?") + .multilineTextAlignment(.center) + } + } + Section { HStack { Spacer() - Button("OK") { self.setAuthenticationType() } + Button(isNoAppProtectionSelected ? "Remove app protection" : "OK") { self.setAuthenticationType() } .alignVertically(.center) + .foregroundColor(isNoAppProtectionSelected ? Color.destructive : nil) .disabled( !self.authenticatedWithNewAuthenticationType) Spacer() @@ -131,6 +146,7 @@ struct ProtectAppSettingsDialog: View { isFaceIDSelected = false isTouchIDSelected = false isPasswordSelected = false + isNoAppProtectionSelected = false if type == .faceID { isFaceIDSelected = true @@ -138,9 +154,12 @@ struct ProtectAppSettingsDialog: View { else if type == .touchID { isTouchIDSelected = true } - else { + else if type == .password { isPasswordSelected = true } + else if type == .none { + isNoAppProtectionSelected = true + } if isPasswordSelected == false { UIApplication.hideKeyboard() @@ -159,7 +178,8 @@ struct ProtectAppSettingsDialog: View { private var authenticatedWithNewAuthenticationType: Bool { ((isFaceIDSelected || isTouchIDSelected) && successfullyAuthenticatedWithBiometricAuthentication) || - (isPasswordSelected && successfullyAuthenticatedWithPassword) + (isPasswordSelected && successfullyAuthenticatedWithPassword) || + isNoAppProtectionSelected } func handleReturnKeyPress() -> Bool { @@ -179,9 +199,12 @@ struct ProtectAppSettingsDialog: View { else if isTouchIDSelected { authenticationService.setAuthenticationType(.touchID) } - else { + else if isPasswordSelected { authenticationService.setAuthenticationTypeToPassword(newPassword) } + else if isNoAppProtectionSelected { + authenticationService.setAuthenticationType(.none) + } presentation.wrappedValue.dismiss() }