|
@@ -95,9 +95,7 @@ public class NotificationJob extends Job {
|
|
|
private static final String KEY_NOTIFICATION_ACTION_TYPE = "KEY_NOTIFICATION_ACTION_TYPE";
|
|
|
private static final String PUSH_NOTIFICATION_ID = "PUSH_NOTIFICATION_ID";
|
|
|
private static final String NUMERIC_NOTIFICATION_ID = "NUMERIC_NOTIFICATION_ID";
|
|
|
- private static final String APP_SPREED = "spreed";
|
|
|
|
|
|
- private SecureRandom randomId = new SecureRandom();
|
|
|
private Context context;
|
|
|
private UserAccountManager accountManager;
|
|
|
|
|
@@ -110,6 +108,7 @@ public class NotificationJob extends Job {
|
|
|
@Override
|
|
|
protected Result onRunJob(@NonNull Params params) {
|
|
|
context = getContext();
|
|
|
+ NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
|
|
PersistableBundleCompat persistableBundleCompat = getParams().getExtras();
|
|
|
String subject = persistableBundleCompat.getString(KEY_NOTIFICATION_SUBJECT, "");
|
|
|
String signature = persistableBundleCompat.getString(KEY_NOTIFICATION_SIGNATURE, "");
|
|
@@ -135,8 +134,11 @@ public class NotificationJob extends Job {
|
|
|
DecryptedPushMessage decryptedPushMessage = gson.fromJson(new String(decryptedSubject),
|
|
|
DecryptedPushMessage.class);
|
|
|
|
|
|
- // We ignore Spreed messages for now
|
|
|
- if (!APP_SPREED.equals(decryptedPushMessage.getApp())) {
|
|
|
+ if (decryptedPushMessage.delete) {
|
|
|
+ notificationManager.cancel(decryptedPushMessage.nid);
|
|
|
+ } else if (decryptedPushMessage.deleteAll) {
|
|
|
+ notificationManager.cancelAll();
|
|
|
+ } else {
|
|
|
fetchCompleteNotification(signatureVerification.getAccount(), decryptedPushMessage);
|
|
|
}
|
|
|
}
|
|
@@ -152,6 +154,7 @@ public class NotificationJob extends Job {
|
|
|
}
|
|
|
|
|
|
private void sendNotification(Notification notification, Account account) {
|
|
|
+ SecureRandom randomId = new SecureRandom();
|
|
|
RichObject file = notification.subjectRichParameters.get("file");
|
|
|
|
|
|
Intent intent;
|
|
@@ -234,7 +237,7 @@ public class NotificationJob extends Job {
|
|
|
.setContentIntent(pendingIntent).build());
|
|
|
|
|
|
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
|
|
- notificationManager.notify(pushNotificationId, notificationBuilder.build());
|
|
|
+ notificationManager.notify(notification.getNotificationId(), notificationBuilder.build());
|
|
|
}
|
|
|
|
|
|
private void fetchCompleteNotification(Account account, DecryptedPushMessage decryptedPushMessage) {
|