-
Notifications
You must be signed in to change notification settings - Fork 43
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
profile settings #322
base: matrixcore
Are you sure you want to change the base?
profile settings #322
Conversation
9f087fa
to
dd89f70
Compare
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.
Looks good to me. There's a quite a few self.xyz
where the self.
isn't needed. Would be nice to drop them where possible. Other general comments inline 🙂
|
||
var body: some View { | ||
List { | ||
Section(header: Text("USER SETTINGS")) { |
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 heading should upper case this by itself I believe. Also if you're targeting iOS 15 (not sure) you can simply pass the string. Same comment for all the headers :)
Section(header: Text("USER SETTINGS")) { | |
Section("User Settings") { |
} | ||
|
||
// Password | ||
Button("Change password", role: .destructive) { |
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.
I wouldn't mark this as destructive myself, if something bad is going to happen it should show an alert explaining this instead, otherwise changing password should probably feel like a safe operation to the user.
let nioAccount = store.accounts[account.userID!]! | ||
|
||
if let displayName = changes["displayName"] as? String { | ||
NioAccountStore.logger.debug("Changing displayName to \(displayName)") |
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 it necessary to actually log the new displayname? Always seems like a good habit to me to avoid logging personal data where possible. (Unless Logger
redacts this string interpolation by default, in which case ignore me as I haven't used it in a while).
.navigationBarTitleDisplayMode(.inline) | ||
.toolbar { | ||
ToolbarItem { | ||
Button(action: { |
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.
As the label is simply text label, it's probably neater to
Button("Save") {
// do stuff
}
|
||
// TODO: verified/unverified devices sections? | ||
Section(header: Text("Devices")) { | ||
ForEach(devices, id: \.deviceID) { device in |
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.
Side note: We should probably conform MatrixDevice
to Identifiable
.
.refreshable { | ||
await self.updateDevices() | ||
} | ||
.toolbar { |
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.
Personally I'd consolidate the 2 toolbar modifiers into 1, but I can see why you might prefer 2 :)
NioUIKit/ProfileSettings/Security/Devices/ProfileSettingsSecurityDevicesContainerView.swift
Show resolved
Hide resolved
private func delete(at offsets: IndexSet) { | ||
let idsToDelete = offsets.map { self.devices[$0].deviceID } | ||
|
||
_ = idsToDelete.compactMap { id in |
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.
_ = idsToDelete.compactMap { id in | |
idsToDelete.forEach { id in |
struct ProfileSettingsSecurityDeviceView: View { | ||
let device: MatrixDevice | ||
|
||
let subText: String |
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.
let subText: String | |
let subtext: String |
Button(action: { | ||
self.setDisplayName() | ||
}) { | ||
Text("Save") | ||
} |
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.
Button(action: { | |
self.setDisplayName() | |
}) { | |
Text("Save") | |
} | |
Button("Save") { | |
self.setDisplayName() | |
} |
if editMode == .active { | ||
Button("Cancel") { | ||
self.selection.removeAll() | ||
withAnimation { | ||
self.editMode = .inactive | ||
} | ||
} | ||
} else { | ||
Button("Edit") { | ||
withAnimation { | ||
self.editMode = .active | ||
} | ||
} | ||
} |
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.
Where possible, it's useful to update the parameters on a view rather than switching out the view for a new one:
if editMode == .active { | |
Button("Cancel") { | |
self.selection.removeAll() | |
withAnimation { | |
self.editMode = .inactive | |
} | |
} | |
} else { | |
Button("Edit") { | |
withAnimation { | |
self.editMode = .active | |
} | |
} | |
} | |
Button(editMode.isEditing ? "Cancel" : "Edit") { | |
if editMode.isEditing { | |
self.selection.removeAll() | |
withAnimation { | |
self.editMode = .inactive | |
} | |
} else { | |
withAnimation { | |
self.editMode = .active | |
} | |
} | |
} |
No description provided.