Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compose notification action not recreating MainActivity #4249

Merged
merged 3 commits into from
Feb 23, 2024

Conversation

connyduck
Copy link
Collaborator

closes #4247

@@ -456,7 +456,7 @@ private static PendingIntent getStatusComposeIntent(Context context, Notificatio

Intent composeIntent = MainActivity.composeIntent(context, composeOptions, account.getId(), body.getId(), (int)account.getId());

composeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
composeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd leave a comment in code why we do this

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -456,7 +456,7 @@ private static PendingIntent getStatusComposeIntent(Context context, Notificatio

Intent composeIntent = MainActivity.composeIntent(context, composeOptions, account.getId(), body.getId(), (int)account.getId());

composeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
composeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connyduck added a commit that referenced this pull request Feb 23, 2024
While working on #4249 I noticed that quick replies also don't work as
expected. The notification just stays in the sending state forever.
There are actually 2 problems:
- Notifications are sent in `NotificationFetcher` with the id of the
Mastodon notification as tag and the current account id as id. The wrong
notification id was forwarded to `SendStatusBroadcastReceiver` so it
never had a chance of updating the notification.
- Notifications containing an active remote input can't be cancelled
(they just stop their animation when doing so). So instead I update the
notification with info that the reply is being sent and have it dismiss
automatically.

I also tried replacing the original notification with the "sending"
notification of `SendStatusService`, but that doesn't work because
`Service.startForeground` doesn't have a tag parameter, only an id.

---------

Co-authored-by: Willow <[email protected]>
@connyduck connyduck merged commit fa8bede into develop Feb 23, 2024
3 checks passed
@connyduck connyduck deleted the fix_notification_compose_action branch February 23, 2024 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Opening Compose from Notification for Different Account Corrupts Timeline
3 participants