Implemented remove app protection
This commit is contained in:
parent
5e07a900a9
commit
d197346cfc
|
@ -166,11 +166,14 @@ Unfortunately, Bankmeister cannot know whether a bank charges for instant paymen
|
||||||
|
|
||||||
/* ProtectAppSettingsDialog */
|
/* ProtectAppSettingsDialog */
|
||||||
|
|
||||||
"Protect App Settings Dialog title" = "Security settings";
|
"Protect App Settings Dialog title" = "Select app protection";
|
||||||
"FaceID" = "FaceID";
|
"FaceID" = "FaceID";
|
||||||
"TouchID" = "TouchID";
|
"TouchID" = "TouchID";
|
||||||
"Password" = "Password";
|
"Password" = "Password";
|
||||||
|
"None" = "Unprotected";
|
||||||
"Authenticate with TouchID" = "Authenticate with TouchID";
|
"Authenticate with TouchID" = "Authenticate with TouchID";
|
||||||
"Enter new password" = "Enter new password";
|
"Enter new password" = "Enter new password";
|
||||||
"Confirm password" = "Confirm password";
|
"Confirm password" = "Confirm password";
|
||||||
"Confirm new password" = "Confirm new 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";
|
||||||
|
|
|
@ -166,11 +166,14 @@ Ob eine Bank Gebühren für Echtzeitüberweisungen erhebt, kann Bankmeister leid
|
||||||
|
|
||||||
/* ProtectAppSettingsDialog */
|
/* ProtectAppSettingsDialog */
|
||||||
|
|
||||||
"Protect App Settings Dialog title" = "Sicherheitseinstellungen"; // TODO: find a better title
|
"Protect App Settings Dialog title" = "Appzugangsschutz festlegen";
|
||||||
"FaceID" = "FaceID";
|
"FaceID" = "FaceID";
|
||||||
"TouchID" = "TouchID";
|
"TouchID" = "TouchID";
|
||||||
"Password" = "Passwort";
|
"Password" = "Passwort";
|
||||||
|
"None" = "Ungeschützt";
|
||||||
"Authenticate with TouchID" = "Mit TouchID authentifizieren";
|
"Authenticate with TouchID" = "Mit TouchID authentifizieren";
|
||||||
"Enter new password" = "Neues Passwort eingeben";
|
"Enter new password" = "Neues Passwort eingeben";
|
||||||
"Confirm password" = "Bestätigen";
|
"Confirm password" = "Bestätigen";
|
||||||
"Confirm new password" = "Neues Passwort 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";
|
||||||
|
|
|
@ -111,6 +111,18 @@ extension Color {
|
||||||
static let secondarySystemBackground = Color(UIColor.secondarySystemBackground)
|
static let secondarySystemBackground = Color(UIColor.secondarySystemBackground)
|
||||||
static let tertiarySystemBackground = Color(UIColor.tertiarySystemBackground)
|
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..
|
// There are more..
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ struct BankSettingsDialog: View {
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
Button("Delete account", action: askUserToDeleteAccount)
|
Button("Delete account", action: askUserToDeleteAccount)
|
||||||
.foregroundColor(Color.red)
|
.foregroundColor(Color.destructive)
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@ struct ProtectAppSettingsDialog: View {
|
||||||
|
|
||||||
@State private var isPasswordSelected: Bool = false
|
@State private var isPasswordSelected: Bool = false
|
||||||
|
|
||||||
|
@State private var isNoAppProtectionSelected: Bool = false
|
||||||
|
|
||||||
@State private var selectedAuthenticationTypeIndex = 0
|
@State private var selectedAuthenticationTypeIndex = 0
|
||||||
|
|
||||||
private var selectedAuthenticationTypeIndexBinding: Binding<Int> {
|
private var selectedAuthenticationTypeIndexBinding: Binding<Int> {
|
||||||
|
@ -40,6 +42,8 @@ struct ProtectAppSettingsDialog: View {
|
||||||
|
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
let currentAuthenticationType = authenticationService.authenticationType
|
||||||
|
|
||||||
var authenticationTypes = [AuthenticationType]()
|
var authenticationTypes = [AuthenticationType]()
|
||||||
|
|
||||||
if authenticationService.deviceSupportsFaceID {
|
if authenticationService.deviceSupportsFaceID {
|
||||||
|
@ -51,10 +55,13 @@ struct ProtectAppSettingsDialog: View {
|
||||||
|
|
||||||
authenticationTypes.append(.password)
|
authenticationTypes.append(.password)
|
||||||
|
|
||||||
|
if currentAuthenticationType != .none {
|
||||||
|
authenticationTypes.append(.none)
|
||||||
|
}
|
||||||
|
|
||||||
self.supportedAuthenticationTypes = authenticationTypes
|
self.supportedAuthenticationTypes = authenticationTypes
|
||||||
|
|
||||||
|
|
||||||
let currentAuthenticationType = authenticationService.authenticationType
|
|
||||||
if currentAuthenticationType == .faceID || (currentAuthenticationType != .password && authenticationService.deviceSupportsFaceID) {
|
if currentAuthenticationType == .faceID || (currentAuthenticationType != .password && authenticationService.deviceSupportsFaceID) {
|
||||||
_isFaceIDSelected = State(initialValue: true)
|
_isFaceIDSelected = State(initialValue: true)
|
||||||
_selectedAuthenticationTypeIndex = State(initialValue: 0)
|
_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 {
|
Section {
|
||||||
HStack {
|
HStack {
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
Button("OK") { self.setAuthenticationType() }
|
Button(isNoAppProtectionSelected ? "Remove app protection" : "OK") { self.setAuthenticationType() }
|
||||||
.alignVertically(.center)
|
.alignVertically(.center)
|
||||||
|
.foregroundColor(isNoAppProtectionSelected ? Color.destructive : nil)
|
||||||
.disabled( !self.authenticatedWithNewAuthenticationType)
|
.disabled( !self.authenticatedWithNewAuthenticationType)
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
@ -131,6 +146,7 @@ struct ProtectAppSettingsDialog: View {
|
||||||
isFaceIDSelected = false
|
isFaceIDSelected = false
|
||||||
isTouchIDSelected = false
|
isTouchIDSelected = false
|
||||||
isPasswordSelected = false
|
isPasswordSelected = false
|
||||||
|
isNoAppProtectionSelected = false
|
||||||
|
|
||||||
if type == .faceID {
|
if type == .faceID {
|
||||||
isFaceIDSelected = true
|
isFaceIDSelected = true
|
||||||
|
@ -138,9 +154,12 @@ struct ProtectAppSettingsDialog: View {
|
||||||
else if type == .touchID {
|
else if type == .touchID {
|
||||||
isTouchIDSelected = true
|
isTouchIDSelected = true
|
||||||
}
|
}
|
||||||
else {
|
else if type == .password {
|
||||||
isPasswordSelected = true
|
isPasswordSelected = true
|
||||||
}
|
}
|
||||||
|
else if type == .none {
|
||||||
|
isNoAppProtectionSelected = true
|
||||||
|
}
|
||||||
|
|
||||||
if isPasswordSelected == false {
|
if isPasswordSelected == false {
|
||||||
UIApplication.hideKeyboard()
|
UIApplication.hideKeyboard()
|
||||||
|
@ -159,7 +178,8 @@ struct ProtectAppSettingsDialog: View {
|
||||||
|
|
||||||
private var authenticatedWithNewAuthenticationType: Bool {
|
private var authenticatedWithNewAuthenticationType: Bool {
|
||||||
((isFaceIDSelected || isTouchIDSelected) && successfullyAuthenticatedWithBiometricAuthentication) ||
|
((isFaceIDSelected || isTouchIDSelected) && successfullyAuthenticatedWithBiometricAuthentication) ||
|
||||||
(isPasswordSelected && successfullyAuthenticatedWithPassword)
|
(isPasswordSelected && successfullyAuthenticatedWithPassword) ||
|
||||||
|
isNoAppProtectionSelected
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleReturnKeyPress() -> Bool {
|
func handleReturnKeyPress() -> Bool {
|
||||||
|
@ -179,9 +199,12 @@ struct ProtectAppSettingsDialog: View {
|
||||||
else if isTouchIDSelected {
|
else if isTouchIDSelected {
|
||||||
authenticationService.setAuthenticationType(.touchID)
|
authenticationService.setAuthenticationType(.touchID)
|
||||||
}
|
}
|
||||||
else {
|
else if isPasswordSelected {
|
||||||
authenticationService.setAuthenticationTypeToPassword(newPassword)
|
authenticationService.setAuthenticationTypeToPassword(newPassword)
|
||||||
}
|
}
|
||||||
|
else if isNoAppProtectionSelected {
|
||||||
|
authenticationService.setAuthenticationType(.none)
|
||||||
|
}
|
||||||
|
|
||||||
presentation.wrappedValue.dismiss()
|
presentation.wrappedValue.dismiss()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue