-
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
Async notifications: Post error / success notifications (part II): #6763
Async notifications: Post error / success notifications (part II): #6763
Conversation
…-success-notifications
… having a check of which Posts have been already counted as having ended their transfer, either successfully or with error
…try notification color
… to avoid letting the user RETRY on a Post that is currently being edited
… file so it cannot be retried
…ailed media/posts
This PR is now ready for review @nbradbury - please note Media-only success and error (i.e. final) notification and |
…-error-success-notifications
public void onEventMainThread(UploadService.UploadErrorEvent event) { | ||
SiteModel site = getSelectedSite(); | ||
if (site != null) { | ||
if (event.post.getLocalSiteId() == site.getId()) { |
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.
Do we need to null check event.post
here?
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.
uh, nice! addressed in 0ad299b
@@ -515,7 +530,8 @@ public void onPostUploaded(PostStore.OnPostUploaded event) { | |||
if (site != null) { | |||
if (event.post.getLocalSiteId() == site.getId()) { | |||
UploadUtils.onPostUploadedSnackbarHandler(getActivity(), | |||
getActivity().findViewById(R.id.coordinator), event, site, mDispatcher); | |||
getActivity().findViewById(R.id.coordinator), |
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 can drop final PostModel post = event.post;
at the top of this method.
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.
addressed in fcfa5c2
@@ -326,4 +326,9 @@ static boolean updatePostContentIfDifferent(PostModel post, String newContent) { | |||
} | |||
return false; | |||
} | |||
|
|||
public static boolean isFirstTimePublish(PostModel post) { | |||
return PostStatus.fromPost(post) == PostStatus.DRAFT |
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.
EditPostActivity
has a similar method here whose logic is different than 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.
That's correct - EditPostActivity
can determine things differently given it holds an mOriginalPost
and can eventually tell if there are any differences. It is different for the UploadService
or, fwiw, anywhere else other than the Editor where changes might happen anytime.
} | ||
|
||
void incrementUploadedPostCountFromForegroundNotification(@NonNull PostModel post) { | ||
void incrementUploadedPostCountFromForegroundNotificationOrFinish(@NonNull PostModel post) { |
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.
I'm confused by orFinish
being part of this method name. Any chance we can get rid of it, especially since the method name is so 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.
Sure thing! got it back in 6aa5620 and also renamed the Media method counterpart to keep it the same way
Nice catch Nick! , addressed in a different PR #6782 |
It's defined in the network layer (a.k.a FluxC) - we've seen that before, and IIRC we decided to let it all the way up to the user to make it easier for us to understand what's going on when people reaching out to us through Helpshift. That said, we can come up with something nicer that still is "unique", but I'd need some way to reproduce. Do you remember what you did to make it fail this way? |
…romForegroundNotification
#6763 (comment) |
I simply enabled airplane mode during upload, but other times I did that I received a different error. |
Continues #6756 (this one should be merged into that other one first!)
Also adds the functionality requested for in #6407 (adding the button to the Posts list should come in another PR)
This one implements Post error notifications (and snackbars) on top of the Post success notifications work done in #6756
Notes:
To test:
CASE A:
CASE B:
CASE C: AFTER THIS LAST CASE ABOVE:
8. turn airplane mode OFF
9. tap on the notification’s RERTY quick action
10. verify the post and media items are re-uploaded and finish successfully
CASE D:
cc @nbradbury