Skip to content

Commit 3227b5a

Browse files
authored
Merge pull request #419 from loopandlearn/hidden-secrets
Implement Secure Inputs for Dexcom and Nightscout Credentials
2 parents d971ee8 + bf43688 commit 3227b5a

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

LoopFollow/Nightscout/NightscoutSettingsView.swift

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,33 @@ struct NightscoutSettingsView: View {
2525
// MARK: - Subviews / Computed Properties
2626

2727
private var urlSection: some View {
28-
Section {
29-
TextField("URL", text: $viewModel.nightscoutURL)
28+
Section(header: Text("URL")) {
29+
TextField("Enter URL", text: $viewModel.nightscoutURL)
3030
.textContentType(.URL)
3131
.autocapitalization(.none)
3232
.disableAutocorrection(true)
3333
.onChange(of: viewModel.nightscoutURL) { newValue in
3434
viewModel.processURL(newValue)
3535
}
36-
} header: {
37-
Text("URL")
3836
}
3937
}
4038

4139
private var tokenSection: some View {
42-
Section {
43-
TextField("Token", text: $viewModel.nightscoutToken)
44-
.textContentType(.password)
45-
.autocapitalization(.none)
46-
.disableAutocorrection(true)
47-
} header: {
48-
Text("Token")
40+
Section(header: Text("Token")) {
41+
HStack {
42+
Text("Access Token")
43+
TogglableSecureInput(
44+
placeholder: "Enter Token",
45+
text: $viewModel.nightscoutToken,
46+
style: .singleLine
47+
)
48+
}
4949
}
5050
}
5151

5252
private var statusSection: some View {
53-
Section {
53+
Section(header: Text("Status")) {
5454
Text(viewModel.nightscoutStatus)
55-
} header: {
56-
Text("Status")
5755
}
5856
}
5957
}

LoopFollow/Settings/DexcomSettingsView.swift

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,22 @@ struct DexcomSettingsView: View {
1111
NavigationView {
1212
Form {
1313
Section(header: Text("Dexcom Settings")) {
14-
TextField("User Name", text: $viewModel.userName)
15-
.autocapitalization(.none)
16-
.disableAutocorrection(true)
14+
HStack {
15+
Text("User Name")
16+
TextField("Enter User Name", text: $viewModel.userName)
17+
.autocapitalization(.none)
18+
.disableAutocorrection(true)
19+
.multilineTextAlignment(.trailing)
20+
}
1721

18-
TextField("Password", text: $viewModel.password)
19-
.autocapitalization(.none)
20-
.disableAutocorrection(true)
22+
HStack {
23+
Text("Password")
24+
TogglableSecureInput(
25+
placeholder: "Enter Password",
26+
text: $viewModel.password,
27+
style: .singleLine
28+
)
29+
}
2130

2231
Picker("Server", selection: $viewModel.server) {
2332
Text("US").tag("US")

0 commit comments

Comments
 (0)