android, desktop: profile names (remove full name) (#3177)
* desktop, android: profile names (remove full name) * rename back * disallow spaces only in names * ios: disallow spaces only in names * changes
This commit is contained in:
committed by
GitHub
parent
0d8558a6d0
commit
34e1e44338
@@ -80,7 +80,7 @@ struct GroupProfileView: View {
|
||||
HStack(spacing: 20) {
|
||||
Button("Cancel") { dismiss() }
|
||||
Button("Save group profile") { saveProfile() }
|
||||
.disabled(groupProfile.displayName == "" || !validNewProfileName())
|
||||
.disabled(!canUpdateProfile())
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity, minHeight: 120, alignment: .leading)
|
||||
@@ -134,6 +134,10 @@ struct GroupProfileView: View {
|
||||
.onTapGesture { hideKeyboard() }
|
||||
}
|
||||
|
||||
private func canUpdateProfile() -> Bool {
|
||||
groupProfile.displayName.trimmingCharacters(in: .whitespaces) != "" && validNewProfileName()
|
||||
}
|
||||
|
||||
private func validNewProfileName() -> Bool {
|
||||
groupProfile.displayName == groupInfo.groupProfile.displayName
|
||||
|| validDisplayName(groupProfile.displayName.trimmingCharacters(in: .whitespaces))
|
||||
|
||||
@@ -179,7 +179,8 @@ struct AddGroupView: View {
|
||||
}
|
||||
|
||||
func canCreateProfile() -> Bool {
|
||||
profile.displayName != "" && validDisplayName(profile.displayName.trimmingCharacters(in: .whitespaces))
|
||||
let name = profile.displayName.trimmingCharacters(in: .whitespaces)
|
||||
return name != "" && validDisplayName(name)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ struct UserProfile: View {
|
||||
}
|
||||
|
||||
private func canSaveProfile(_ user: User) -> Bool {
|
||||
profile.displayName != "" && validNewProfileName(user)
|
||||
profile.displayName.trimmingCharacters(in: .whitespaces) != "" && validNewProfileName(user)
|
||||
}
|
||||
|
||||
func saveProfile() {
|
||||
|
||||
Reference in New Issue
Block a user