From d07d714641548499dc3cb368469fba7b833af858 Mon Sep 17 00:00:00 2001 From: LucasGGamerM Date: Thu, 16 Feb 2023 13:33:53 -0300 Subject: [PATCH] Rolling back to the megalodon push notification style --- .../android/PushNotificationReceiver.java | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java b/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java index 3e60a320b..44e01fd02 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java +++ b/mastodon/src/main/java/org/joinmastodon/android/PushNotificationReceiver.java @@ -99,7 +99,6 @@ public class PushNotificationReceiver extends BroadcastReceiver{ Account self=AccountSessionManager.getInstance().getAccount(accountID).self; String accountName="@"+self.username+"@"+AccountSessionManager.getInstance().getAccount(accountID).domain; Notification.Builder builder; - Notification.Builder summaryNotification; if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.O){ boolean hasGroup=false; List channelGroups=nm.getNotificationChannelGroups(); @@ -122,28 +121,21 @@ public class PushNotificationReceiver extends BroadcastReceiver{ nm.createNotificationChannels(channels); } builder=new Notification.Builder(context, accountID+"_"+pn.notificationType); -// summaryNotification=new Notification.Builder(context, accountID); }else{ builder=new Notification.Builder(context) .setPriority(Notification.PRIORITY_DEFAULT) .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE); - summaryNotification=new Notification.Builder(context) - .setPriority(Notification.PRIORITY_DEFAULT) - .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE); } Drawable avatar=ImageCache.getInstance(context).get(new UrlImageLoaderRequest(pn.icon, V.dp(50), V.dp(50))); Intent contentIntent=new Intent(context, MainActivity.class); contentIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); contentIntent.putExtra("fromNotification", true); contentIntent.putExtra("accountID", accountID); - contentIntent.putExtra("notificationID", notificationId); if(notification!=null){ contentIntent.putExtra("notification", Parcels.wrap(notification)); } - builder.setContentTitle(pn.title) .setContentText(pn.body) - .setContentTitle(pn.title) .setStyle(new Notification.BigTextStyle().bigText(pn.body)) .setSmallIcon(R.drawable.ic_ntf_logo) .setContentIntent(PendingIntent.getActivity(context, notificationId, contentIntent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT)) @@ -151,8 +143,7 @@ public class PushNotificationReceiver extends BroadcastReceiver{ .setShowWhen(true) .setCategory(Notification.CATEGORY_SOCIAL) .setAutoCancel(true) - .setColor(context.getColor(R.color.shortcut_icon_background)) - .setGroup(accountID); + .setColor(context.getColor(R.color.shortcut_icon_background)); if (!GlobalUserPreferences.uniformNotificationIcon) { builder.setSmallIcon(switch (pn.notificationType) { @@ -174,9 +165,6 @@ public class PushNotificationReceiver extends BroadcastReceiver{ if(AccountSessionManager.getInstance().getLoggedInAccounts().size()>1){ builder.setSubText(accountName); } - - notificationId++; - nm.notify(accountID, GlobalUserPreferences.keepOnlyLatestNotification ? NOTIFICATION_ID : notificationId, builder.build()); - + nm.notify(accountID, GlobalUserPreferences.keepOnlyLatestNotification ? NOTIFICATION_ID : notificationId++, builder.build()); } }