Skip to content

Commit 579372b

Browse files
committed
Bug Fix: Show notification for note after full note is downloaded
This fixes a bug where inline actions were not added to notification because the notification was sometimes shown before full note with actions info was downloaded.
1 parent 2d9bbcd commit 579372b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

WordPress/src/main/java/org/wordpress/android/push/GCMMessageHandler.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,6 @@ private void buildAndShowNotificationFromNoteData(Context context, Bundle data)
351351
// Try to build the note object from the PN payload, and save it to the DB.
352352
NotificationsUtils.buildNoteObjectFromBundleAndSaveIt(data);
353353
EventBus.getDefault().post(new NotificationEvents.NotificationsChanged(true));
354-
// Always do this, since a note can be updated on the server after a PN is sent
355-
NotificationsActions.downloadNoteAndUpdateDB(wpcomNoteID, null, null);
356354

357355
String noteType = StringUtils.notNullStr(data.getString(PUSH_ARG_TYPE));
358356

@@ -415,7 +413,12 @@ private void buildAndShowNotificationFromNoteData(Context context, Bundle data)
415413
builder.setLargeIcon(largeIconBitmap);
416414
}
417415

418-
showNotificationForNoteData(context, data, builder);
416+
// Always do this, since a note can be updated on the server after a PN is sent
417+
NotificationsActions.downloadNoteAndUpdateDB(
418+
wpcomNoteID,
419+
success -> showNotificationForNoteData(context, data, builder),
420+
error -> showNotificationForNoteData(context, data, builder)
421+
);
419422
}
420423

421424
private void showNotificationForNoteData(Context context, Bundle noteData, NotificationCompat.Builder builder) {

0 commit comments

Comments
 (0)