Skip to content

Commit

Permalink
Merge pull request #9956 from wordpress-mobile/issue/9951-upload-noti…
Browse files Browse the repository at this point in the history
…f-on-retry

Fix upload notification not shown on retry
  • Loading branch information
malinajirka committed Jun 7, 2019
2 parents 1dac305 + f19cb43 commit 05e19d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions RELEASE-NOTES.txt
@@ -1,10 +1,12 @@
12.7
-----
* Show upload in progress notification when retrying

12.6
-----
* Add Insights management introductory card
* Local draft pages will be automatically uploaded to the server as soon as an internet connection is available.

* Block Editor: A new block is available: video block.
* Block Editor: Added UI to display a warning when a block has invalid content.
* Block Editor: Fixed issue with link settings where “Open in New Tab” was always OFF on open.
Expand Down
Expand Up @@ -574,6 +574,8 @@ public void onPostUploaded(OnPostUploaded event) {
String errorMessage = mUiHelpers.getTextOfUiString(context,
UploadUtils.getErrorMessageResIdFromPostError(event.post.isPage(), event.error));
String notificationMessage = UploadUtils.getErrorMessage(context, event.post, errorMessage, false);
mPostUploadNotifier.removePostInfoFromForegroundNotification(event.post,
mMediaStore.getMediaForPost(event.post));
mPostUploadNotifier.incrementUploadedPostCountFromForegroundNotification(event.post);
mPostUploadNotifier.updateNotificationErrorForPost(event.post, site, notificationMessage, 0);
sFirstPublishPosts.remove(event.post.getId());
Expand Down
Expand Up @@ -249,10 +249,7 @@ private void unpackPostIntent(@NonNull Intent intent) {
return;
}
boolean postHasGutenbergBlocks = PostUtils.contentContainsGutenbergBlocks(post.getContent());
boolean processWithAztec =
AppPrefs.isAztecEditorEnabled() && !AppPrefs.isGutenbergEditorEnabled()
&& !postHasGutenbergBlocks;
retryUpload(post, processWithAztec);
retryUpload(post, !postHasGutenbergBlocks);
} else {
ToastUtils.showToast(this, R.string.retry_needs_aztec);
}
Expand Down Expand Up @@ -755,7 +752,6 @@ private void retryUpload(PostModel post, boolean processWithAztec) {

Set<MediaModel> failedMedia = mUploadStore.getFailedMediaForPost(post);
ArrayList<MediaModel> mediaToRetry = new ArrayList<>(failedMedia);
mPostUploadNotifier.removePostInfoFromForegroundNotificationData(post, mediaToRetry);
if (!failedMedia.isEmpty()) {
// reset these media items to QUEUED
for (MediaModel media : failedMedia) {
Expand Down Expand Up @@ -784,6 +780,7 @@ private void retryUpload(PostModel post, boolean processWithAztec) {
// send event so Editors can handle clearing Failed statuses properly if Post is being edited right now
EventBus.getDefault().post(new UploadService.UploadMediaRetryEvent(mediaToRetry));
} else {
mPostUploadNotifier.addPostInfoToForegroundNotification(post, null);
// retry uploading the Post
mPostUploadHandler.upload(post);
}
Expand Down

0 comments on commit 05e19d9

Please sign in to comment.