-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Issue/5681 discard changes action #8005
Conversation
Thanks for taking care of this ❤️ - code looks good @theck13 ! As with each time one comes back to These are my findings so far: SITUATION A: inconsistencies between undo/discard changes in AztecShould we maybe only show the
This is because we're relying on the I tried something in this branch (try/check-undo-to-show-discard): checking the In any case, this is probably an edge case and I don't think it's a blocker for this PR; we may continue to tackle this on a separate PR. SITUATION B: "Discarding local changes" progress dialog sitting there forever on rotationThis one is known and happens in many other cases in the app, as it's based on how FluxC works (EventBus based). The expected end event is missed and so the progress dialog never gets dismissed. SITUATION C: "The post has local changes that haven't been published"I couldn't find the situation depicted in the last 3 screenshots up here within the code, is that correct? (tried the string search trick and then read the code diff in the PR but couldn't find the behavior there either). |
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.
Left more verbose comments in the PR itself, but generally approving this PR 👍 Feel free to merge provided a follow up to case A and an answer on case C is given
I didn't think about history/undo/redo and the steps you provided is a scenario I didn't consider. Thanks for pointing it out! @SylvesterWilmott, what's your opinion on limiting the ability to discard local changes only when there is something to undo?
Ahh, I should have mentioned that's the post preview. The string changes are minimal in
|
The primary use case here is when a user is editing a post, presses back and local changes are saved with no clear way to discard the changes. Therefore the "Discard Changes" menu item in the editor is present when the "Local Changes" label is present on the post list. So currently:
and
Alternatively, If you want to touch on the logic of the "Local Changes" post status. Then we will need conditions IF Design-wise this looks great. Are we able to add more space between the text string and the buttons in the 2 button Snackbar as shown here Thanks @theck13 ! |
Thanks for providing the detailed steps to test the Preview section @theck13 ! was able to test following that. Thanks for your input @SylvesterWilmott, several things in there!, I'll separate on points to make a distinction for each case, so it's easier to handle and take action: 1. Discard Changes main case
That is one thing - this PR works well in that case, agreed on that and I'd give this PR the go just for this alone 👍 (actually, already approved it). 2. When does the
|
Having tracked the issues detected while testing this, |
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.
Thank you @theck13 for this awesome improvement;)! Adding something into the EditPostActivity is always a challenge, but you did a great job!
I know this PR has recently been merged, but I'd like to share couple comments I didn't post in time:). I'll leave it up to you, whether you want to fix them or leave it as it is. Thanks!
} | ||
|
||
private void showDialogError() { | ||
new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.Calypso_Dialog_Alert)) |
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.
We might consider using BasicFragmentDialog, which automatically handles configuration changes. Wdyt?
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.
That sounds good to me. I'll update that in a subsequent pull request since this one has been merged.
refreshEditorContent(); | ||
|
||
if (mViewPager != null) { | ||
Snackbar.make(mViewPager, getString(R.string.local_changes_discarded), Snackbar.LENGTH_LONG) |
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.
Users using TalkBack or SwitchControl might have troubles to locate the SnackBar (undo button) before it's dismissed -> we should probably use AccessibilityUtils.getSnackbarDuration(...)
method. Wdyt?
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.
Ahh, I always forget about AccessibilityUtils
. Thanks for the reminder. I'll update that in a subsequent pull request since this one has been merged.
mPost = mPostStore.getPostByLocalPostId(mPost.getId()); | ||
refreshPreview(); | ||
|
||
if (mMessageView != null) { | ||
Snackbar.make(mMessageView, getString(R.string.local_changes_discarded), Snackbar.LENGTH_LONG) |
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.
Same comment as in EditPostActivity.java
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.
Same comment as in EditPostActivity.java
. I'll update that in a subsequent pull request since this one has been merged.
@@ -326,20 +359,69 @@ private void hideProgress() { | |||
} | |||
} | |||
|
|||
private void showDialogError() { | |||
new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.Calypso_Dialog_Alert)) |
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.
Same comment as in EditPostActivity.java
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.
Same comment as in EditPostActivity.java
. I'll update that in a subsequent pull request since this one has been merged.
@SylvesterWilmott, are you referring to the @mzorz, thanks for the review and filing the issues! @malinajirka, thanks for the tips for improvements! I'll make those updates in a subsequent pull request. |
@theck13 Yes, it's the 18dp space. Thanks 🙂 |
Fix
Add action to overflow menu to discard local changes and snackbar with undo action to revert discarded changes to post editor and preview to address #5681. See the screenshots and animation below for illustration.
Test