-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update FileSharePasswordView #40
base: main
Are you sure you want to change the base?
Conversation
HStack { | ||
Spacer() | ||
Button("Cancel") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cancel button was removed and it's still necessary.
} | ||
.onAppear() { | ||
saveInKeychain = UserSettings.shared.saveDistributionPointPwInKeychain | ||
password = fileShareDp?.readWritePassword ?? "" | ||
rwUsername = "\(fileShareDp?.readWriteUsername ?? "")" | ||
if rwUsername == "'''" { rwUsername = ""} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for this? Also, nitpicky, but I would prefer that the rwUsername = "" is on its own line, and at the very least, the spacing after the = and before the } should be consistent.
} | ||
.onAppear() { | ||
saveInKeychain = UserSettings.shared.saveDistributionPointPwInKeychain | ||
password = fileShareDp?.readWritePassword ?? "" | ||
rwUsername = "\(fileShareDp?.readWriteUsername ?? "")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be replaced by rwUsername = fileShareDp?.readWriteUsername ?? ""
} | ||
.padding([.bottom], 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's best to just use the default padding if possible. And since it's only one padding item, I don't think you need to put it in an array. So try just .padding(.bottom).
@@ -54,13 +58,15 @@ struct FileSharePasswordView: View { | |||
dismiss() | |||
} | |||
.keyboardShortcut(.defaultAction) | |||
.padding(.top) | |||
Spacer() | |||
.padding(.trailing, 80) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to just use default padding here. So .padding(.trailing).
) { | ||
TextField("", text: $rwUsername, prompt: Text("")) | ||
.disabled(true) | ||
.frame(width: 420, height: 30, alignment: .leading) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's best to avoid frames altogether if you can, but if not, then just specify the parts of the frame that you really need (like height maybe).
.padding(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)) | ||
) { | ||
SecureField("", text: $password, prompt: Text("")) | ||
.frame(width: 420, height: 30, alignment: .leading) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's best to avoid frames altogether if you can, but if not, then just specify the parts of the frame that you really need (like height maybe).
SecureField("", text: $password, prompt: Text("")) | ||
.frame(width: 420, height: 30, alignment: .leading) | ||
} | ||
.textCase(nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nil is the default, so this can be removed.
|
||
Section(header: Text("Password:") // Label | ||
.font(.headline) | ||
.padding(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary? I would think removing this padding call would have the same results.
} | ||
.textCase(nil) | ||
|
||
Section(header: Text("Password:") // Label |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The horizontal spacing is messed up around this.
Display the read/write account when prompting for the password of a file share.