Skip to content

Commit

Permalink
Distinguish new-note pending intents by category
Browse files Browse the repository at this point in the history
Fixes #1006.
  • Loading branch information
nevenz committed Nov 20, 2022
1 parent a32d152 commit 0783e64
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static void showOngoingNotification(Context context) {
if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG);

PendingIntent newNotePendingIntent =
ShareActivity.createNewNotePendingIntent(context, null);
ShareActivity.createNewNotePendingIntent(context, "ongoing notification", null);

NotificationCompat.Builder builder = new NotificationCompat.Builder(context, NotificationChannels.ONGOING)
.setOngoing(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,12 @@ protected void onResume() {
}
}

public static PendingIntent createNewNotePendingIntent(Context context, SavedSearch savedSearch) {
public static PendingIntent createNewNotePendingIntent(Context context, String category, SavedSearch savedSearch) {
Intent resultIntent = createNewNoteIntent(context);

// For distinguishing pending events
resultIntent.addCategory(category);

if (savedSearch != null) {
resultIntent.putExtra(AppIntent.EXTRA_QUERY_STRING, savedSearch.getQuery());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private void updateAppWidgetLayout(Context context, AppWidgetManager appWidgetMa
// Plus icon - new note
remoteViews.setOnClickPendingIntent(
R.id.list_widget_header_add,
ShareActivity.createNewNotePendingIntent(context, savedSearch));
ShareActivity.createNewNotePendingIntent(context, "widget-" + appWidgetId, savedSearch));

// Logo - open query
Intent openIntent = Intent.makeRestartActivityTask(new ComponentName(context, MainActivity.class));
Expand Down

0 comments on commit 0783e64

Please sign in to comment.