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

[Draft]: Rewrite the Account Settings view in SwiftUI #1283

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

lissine0
Copy link
Member

@lissine0 lissine0 commented Nov 2, 2024

Most Notable changes:

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:
  • 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:

@lissine0 lissine0 marked this pull request as draft November 2, 2024 19:51
@tmolitor-stud-tu
Copy link
Member

I'm not sure if you already did this (I've not checked the code): the ui for the display and change of the avatar image should be the same as the code used for the avatar image in groupchats you own. --> that code should be refactored into a new view to not be duplicated between these two.

@tmolitor-stud-tu
Copy link
Member

I'd move the change password button to the login credentials view

@tmolitor-stud-tu
Copy link
Member

The status message should be multiline, just like editing the group/channel description for mucs (the code should be refactured to use the same view for both).

@lissine0
Copy link
Member Author

lissine0 commented Nov 6, 2024

the ui for the display and change of the avatar image should be the same as the code used for the avatar image in groupchats you own. --> that code should be refactored into a new view to not be duplicated between these two.

That is already mentioned in the todo list above:

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

@tmolitor-stud-tu
Copy link
Member

when clicking the Display Name or Status Message fields, open an alert with a TextField, a cancel button and a save button.

I like that extra alert most :)

We should write a generic view/view modifier etc. for this text input alert and use that everywhere such an alert is displayed

Find a SwiftUI-alternative for MBProgressHUD: Something to indicate success when the account is removed or deleted or its chat history cleared. Some possibilities:

We already have that: LoadingOverlay, see the reconnect button in our debug menu on how to use a timer to display it...but for account removal I'd prefer using proper promises to truly indicate that the server processed the request...

@tmolitor-stud-tu
Copy link
Member

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.

Should be fixed by using xmpp.m as model class, too (e.g. use ObservableKVOWrapper and the accountState property or a new property reflecting the enabled state as bound value of that toggle (it might be necessary to write a wrapping binding to translate states or trigger some MLXMPPManager method on enable/disable...or implement these actions/translations as writable computed property in xmpp.m)

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.

[Bug]: Settings / Account menu - Make clear to confirm changes before leaving
2 participants