Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

BIG-RAT
Copy link
Contributor

@BIG-RAT BIG-RAT commented Oct 29, 2024

Display the read/write account when prompting for the password of a file share.

@BIG-RAT BIG-RAT requested a review from a team as a code owner October 29, 2024 15:29
HStack {
Spacer()
Button("Cancel") {
Copy link
Contributor

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 = ""}
Copy link
Contributor

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 ?? "")"
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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))
Copy link
Contributor

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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants