Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class GCMMessageService extends GcmListenerService {
private static final String PUSH_TYPE_FOLLOW = "follow";
private static final String PUSH_TYPE_REBLOG = "reblog";
private static final String PUSH_TYPE_PUSH_AUTH = "push_auth";
private static final String PUSH_TYPE_BADGE_RESET = "badge-reset";

// Add to the analytics properties map a subset of the push notification payload.
private static String[] propertiesToCopyIntoAnalytics = {PUSH_ARG_NOTE_ID, PUSH_ARG_TYPE, "blog_id", "post_id",
Expand Down Expand Up @@ -99,6 +100,10 @@ private void handleDefaultPush(String from, @NonNull Bundle data) {
return;
}

if (noteType.equals(PUSH_TYPE_BADGE_RESET)) {
handleBadgeResetPN();
return;
}

String title = StringEscapeUtils.unescapeHtml(data.getString(PUSH_ARG_TITLE));
if (title == null) {
Expand Down Expand Up @@ -329,6 +334,12 @@ private void showNotificationForBuilder(NotificationCompat.Builder builder, Cont
notificationManager.notify(notificationId, builder.build());
}

// Clear all notifications
private void handleBadgeResetPN() {
removeAllNotifications(this);
EventBus.getDefault().post(new NotificationEvents.NotificationsChanged());
}

// Show a notification for two-step auth users who sign in from a web browser
private void handlePushAuth(String from, Bundle data) {
if (data == null) {
Expand Down