Skip to content

Commit

Permalink
Fixed: New plugin error or crash notifications overriding content of …
Browse files Browse the repository at this point in the history
…old ones
  • Loading branch information
agnostic-apollo committed Aug 20, 2021
1 parent baacabd commit e7fc60a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/src/main/java/com/termux/app/utils/CrashUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ public static void sendCrashReportNotification(final Context context, String log
}

Intent notificationIntent = ReportActivity.newInstance(context, new ReportInfo(UserAction.CRASH_REPORT.getName(), logTag, title, null, reportString.toString(), "\n\n" + TermuxUtils.getReportIssueMarkdownString(context), true));
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

// Must ensure result code for PendingIntents and id for notification are unique otherwise will override previous
int nextNotificationId = TermuxNotificationUtils.getNextNotificationId(context);
PendingIntent contentIntent = PendingIntent.getActivity(context, nextNotificationId, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent deleteIntent = null;

// Setup the notification channel if not already set up
Expand All @@ -144,7 +147,6 @@ public static void sendCrashReportNotification(final Context context, String log
if (builder == null) return;

// Send the notification
int nextNotificationId = TermuxNotificationUtils.getNextNotificationId(context);
NotificationManager notificationManager = NotificationUtils.getNotificationManager(context);
if (notificationManager != null)
notificationManager.notify(nextNotificationId, builder.build());
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/com/termux/app/utils/PluginUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ public static void sendPluginCommandErrorNotification(Context context, String lo
reportString.append("\n\n").append(AndroidUtils.getDeviceInfoMarkdownString(context));

Intent notificationIntent = ReportActivity.newInstance(context, new ReportInfo(UserAction.PLUGIN_EXECUTION_COMMAND.getName(), logTag, title, null, reportString.toString(), null,true));
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

// Must ensure result code for PendingIntents and id for notification are unique otherwise will override previous
int nextNotificationId = TermuxNotificationUtils.getNextNotificationId(context);
PendingIntent contentIntent = PendingIntent.getActivity(context, nextNotificationId, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent deleteIntent = null;

// Setup the notification channel if not already set up
Expand All @@ -236,7 +239,6 @@ public static void sendPluginCommandErrorNotification(Context context, String lo
if (builder == null) return;

// Send the notification
int nextNotificationId = TermuxNotificationUtils.getNextNotificationId(context);
NotificationManager notificationManager = NotificationUtils.getNotificationManager(context);
if (notificationManager != null)
notificationManager.notify(nextNotificationId, builder.build());
Expand Down

0 comments on commit e7fc60a

Please sign in to comment.