Skip to content

[flutter_local_notifications] Add support to pass bubble activity + intent to notification #2484

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

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

Airyzz
Copy link

@Airyzz Airyzz commented Dec 6, 2024

This allows for use of Android conversation bubbles api

@Levi-Lesches
Copy link
Contributor

Levi-Lesches commented Dec 6, 2024

Interesting! Perhaps you can make another Dart class for the bubble details? That way they stay bundled together and you can just use ?. to check its members instead of checking each one independently (eg, what happens if bubbleActivity == null && bubbleExtra != null? This way you can just make AndroidBubble.activity be required and AndroidBubble.extra be nullable).

Then be sure to properly handle the error case in your Java code.

And of course, please be sure to document the Dart parts, any extra Android-specific setup, and add a test case if possible, and let us know when you're finished. I'd be happy to test on my end as well.

Copy link
Owner

@MaikuB MaikuB left a comment

Choose a reason for hiding this comment

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

In case you weren't waiting for my review, I also left comments some of which echo what @Levi-Lesches mentioned. Are you also able to update example app to add a scenario that demonstrates it usage?

builder.setBubbleMetadata(bubbleData);
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
Copy link
Owner

Choose a reason for hiding this comment

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

is there a reason for swallowing the exception? can this be surfaced as an exception on the Flutter with appropriate details for users of the plugin to handle?

Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure the best way to do this, I would appreciate some guidance here

Copy link
Owner

Choose a reason for hiding this comment

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

When catching theClassNotFoundException, you can throw a RuntimeException that wraps around the ClassNotFoundException. My understanding is Flutter will handle catching this and on the Dart side, a PlatformException will be thrown so that developers can handle accordingly. Are you able to reproduce the scenarios where the ClassNotFoundException will occur? If so, then once you make the changes then you'll be able to confirm this

@MaikuB
Copy link
Owner

MaikuB commented Jun 20, 2025

@Airyzz I received notifications that you've been updating your fork and wanted to ping to see if there were comments left on the PR to see if you look into. If not then I'll unfortunately may have to close this as it's been a while since this has been opened. I'm also conscious of making attempts to update this directly as you hadn't created a separate branch on your fork

@Airyzz
Copy link
Author

Airyzz commented Jun 20, 2025

hey, I'll work on implementing your feedback soon, i sort of forgot about this PR 😅

@MaikuB
Copy link
Owner

MaikuB commented Jun 22, 2025

I saw you pushed some changes now but I'm not sure if you're done so let know when it's ready for a review. I spotted some things I could comment on already but thought better to hold off until I know you're done

For future reference, if you intend to submit a PR to another repo like this one, one thing I was taught was to create branch on the fork and use that branch to hold the changes that you intend to contribute. This way the default branch (e.g. main/master) on your fork is solely reserved for keeping it up to date with the original repo you forked from. It makes it easier to maintain a fork as well.

@Airyzz
Copy link
Author

Airyzz commented Jun 22, 2025

Sorry, it's not ready yet, i'll convert this to a draft for now until its ready

@Airyzz Airyzz marked this pull request as draft June 22, 2025 04:52
@MaikuB
Copy link
Owner

MaikuB commented Jun 22, 2025

No worries. A general note I can mention is that I've put some information in the contribution guide. One of the main things, I wanted to shout out on is around API docs that can be applied to the PR

@Airyzz
Copy link
Author

Airyzz commented Jun 22, 2025

No problem, i'll go in and document everything once I'm finished with the rest

@Airyzz Airyzz marked this pull request as ready for review June 22, 2025 06:10
@Airyzz
Copy link
Author

Airyzz commented Jun 22, 2025

Apart from your previous comment about handling exceptions, I think this is ready to look at

@MaikuB
Copy link
Owner

MaikuB commented Jun 25, 2025

Ok I'll use the PR comments to explain further around that. Note I've not gotten to test the changes in the PR yet

@@ -432,6 +432,50 @@ protected static Notification createNotification(
setProgress(notificationDetails, builder);
setCategory(notificationDetails, builder);
setTimeoutAfter(notificationDetails, builder);

if (notificationDetails.bubbleActivity != null) {
Copy link
Owner

Choose a reason for hiding this comment

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

Sorry I missed this before but can you refactor out all the changes to a separate method

@@ -0,0 +1,29 @@
/// Defines metadata to be set for the notification's chat bubble
Copy link
Owner

Choose a reason for hiding this comment

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

This is a general comment on all the API docs

  • There are casing issues with the API docs and lack of punctuation marks
  • Look to follow these guidelines around documentation that were mentioned in the contribution guide. You can reference the existing API docs to see examples. A couple of issues that stick to me are violations of this and I also try to have the docs follow this where possible.

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.

3 participants