Monal
Monal copied to clipboard
[Draft]: Rewrite the Account Settings view in SwiftUI
trafficstars
Most Notable changes:
- Get rid of the Save button, and dynamically update the AccountSettings view after enabling / disabling the account. Fixes #745
- Move the Login credentials / settings to a separate view
Todo:
- [ ] Show the current account status (connected / connecting... / disabled).
This is necessary because we currently don't show anything to the user when they enable disable the account. Some ideas on how to display it:
- An entry from the settings' accountList
- A colored circle in the corner of the avatar. Though this alone is insufficient, because it would be inacessible for the visually impaired (e.g. colorblind users). It would need to be in addition to something else in text.
- Show the status in the form
- in a separate list entry
- in the list entry containing the toggle
- in the form section header
- [ ] Currently, changes to the Display Name and to the Status Message only get sent to the server on submit (i.e. on clicking return on the iOS keyboard / pressing enter on a physical keyboard)
Improve this situation, by:
- Sending changes to the server when the Textfield isn't in focus anymore, instead of on submit. Or
- Showing a "save" icon. (inspired by Conversations, when you edit a group's name / topic). This can be placed like the "clear" button on Textfields Or
- when clicking the Display Name or Status Message fields, open an alert with a TextField, a cancel button and a save button.
- [ ] Find a SwiftUI-alternative for MBProgressHUD: Something to indicate success when the account is removed or deleted or its chat history cleared. Some possibilities:
- Use a success alert and dismiss it programmatically after a short time
- Use a normal success alert that the user dismisses manually
- Use a SwiftUI library that's similar to MBProgressHUD e.g. https://github.com/JonasGessner/JGProgressHUD-SwiftUI
- [ ] Improve the presentation of the avatar (shadows etc.) and move the whole thing to a separate file, AvatarPicker.swift, that would also be used by ContactDetails.swift
- [ ] Send notifications using MLNotificationQueue instead of NotificationCenter. Thilo also recommends that we post notifications from the model class.
- [ ] Thilo recommends that we use MLContact with ObservableKVOWrapper to dynamically get avatar updates, instead of observing for notifications
- [ ] Fix the following bugs:
- [ ] If you put a wrong password in Login Credentials and save, the state of the enabled toggle will be out of sync with the account state.
- [ ] Test the PR thoroughly
- [ ] Ask for the account password before doing an in-band account deletion. (new feature)
- [ ] Add a Link to AccountSettings in ContactDetails for note to self chats
Some screenshots from the initial version of this PR: