Add .textContentType to enable autofill

This commit is contained in:
Stuart Breckenridge
2022-12-18 19:20:52 +08:00
parent 28e7a2324e
commit cfb26c909b
3 changed files with 14 additions and 9 deletions

View File

@@ -65,7 +65,9 @@ struct FeedbinAddAccountView: View {
TextField("Email", text: $accountEmail, prompt: Text("ACCOUNT_EMAIL_ADDRESS_PROMPT", tableName: "Account"))
.autocorrectionDisabled()
.autocapitalization(.none)
.textContentType(.username)
SecureField("Password", text: $accountPassword, prompt: Text("ACCOUNT_PASSWORD_PROMPT", tableName: "Account"))
.textContentType(.password)
}
}

View File

@@ -82,7 +82,9 @@ struct NewsBlurAddAccountView: View, Logging {
TextField("Email", text: $accountUserName, prompt: Text("ACCOUNT_USERNAME_OR_EMAIL_PROMPT", tableName: "Account"))
.autocorrectionDisabled()
.autocapitalization(.none)
.textContentType(.username)
SecureField("Password", text: $accountPassword, prompt: Text("ACCOUNT_PASSWORD_PROMPT", tableName: "Account"))
.textContentType(.password)
}
}

View File

@@ -33,6 +33,7 @@ struct ReaderAPIAddAccountView: View {
AccountSectionHeader(accountType: accountType!)
}
accountDetails
accountButton
Section(footer: readerAccountExplainer) {}
}
.navigationTitle(Text(accountType?.localizedAccountName() ?? ""))
@@ -83,17 +84,17 @@ struct ReaderAPIAddAccountView: View {
var accountDetails: some View {
Group {
Section {
TextField("Username", text: $accountUserName)
Section {
TextField("Username", text: $accountUserName)
.autocorrectionDisabled()
.autocapitalization(.none)
.textContentType(.username)
SecureField("Password", text: $accountSecret)
.textContentType(.password)
if accountType == .freshRSS && accountCredentials == nil {
TextField("FreshRSS URL", text: $accountAPIUrl, prompt: Text("fresh.rss.net/api/greader.php"))
.autocorrectionDisabled()
.autocapitalization(.none)
SecureField("Password", text: $accountSecret)
if accountType == .freshRSS && accountCredentials == nil {
TextField("FreshRSS URL", text: $accountAPIUrl, prompt: Text("fresh.rss.net/api/greader.php"))
.autocorrectionDisabled()
.autocapitalization(.none)
}
}
}
}