-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Editing profile: No change warning on leave. (#3972)
### Objective * Prevent data loss when the user inadvertently hits back or wants to leave the profile edition with unsaved changes. ### Description * To limit the number of changes to the existing codebase, I merely re-used the same method used by `save()` in the ViewModel to decide whether to make a network request or simply return the profile as-is. * ~A bit of code juggling around in the ViewModel and I was able to use the logic for all the encoding of each profile field (Which is what the ViewModel caches in memory).~ Thanks @Lakoja for improving this in the VM. * A couple of internal data classes used as helpers to move all the fields around (now that they are no longer used in one single place) were introduced. ### Potential Optimizations * ~The profile encoding is done twice (once for checking, and then again if the user has to actually save it). I'd say this is a negligible price to pay, since the alternative would be to create a different set of comparisons and/or keeping another profile in memory for the purpose of comparison.~ ### Visual Improvement * I believe the Dialog is difficult to see, but it's being displayed with Tusky's theme. Perhaps there's a better style to apply in this case? (or maybe the edit profile activity shouldn't have the same background color as dialogs?!) ### Issue * #3486
- Loading branch information
Showing
3 changed files
with
153 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters