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

[flutter_local_notifications] add AndroidNotificationCategory to make Android categories more accessible #1609

Merged
merged 4 commits into from
Jun 16, 2022

Conversation

lucasribolli
Copy link
Contributor

Add all the Android categories values with documentation in AndroidNotificationCategory class from https://developer.android.com/reference/androidx/core/app/NotificationCompat.html#constants_2.

The goal is make this property more accessible for the users. It results in a little breaking change since the current category property is of String type. However, I believe it’s worth using it.

Also, I tried to make it just like LinuxNotificationCategory of Linux package to keep a pattern.

@lucasribolli lucasribolli force-pushed the android_notification_category branch from 55e81a3 to 9efb5e7 Compare June 4, 2022 14:04
@MaikuB
Copy link
Owner

MaikuB commented Jun 7, 2022

Thanks for the PR. I agree with the intent behind the PR but are you able to elaborate more on what you mean by making it more accessible?

As for the changes within the PR itself, comments I have are

  • as this is a breaking change and there is a 10.0 prerelease at the moment with branch on it too, could this PR target the 10.0.0 branch?
  • the semantics are slightly awkward in that it's calling constructor methods even though they're constant constructors. Can this be changed so it looks like a field/property is referenced rather than a method? An example of what I mean is a change in the implement so that rather than having consumers have AndroidNotificationCategory.alarm() in their code, they would reference AndroidNotificationCategory.alarm instead

@lucasribolli
Copy link
Contributor Author

are you able to elaborate more on what you mean by making it more accessible?

Sure! Make it more accessible means make it easier to use. Nowadays, the consumer who wants to add category to his Android notification needs to open the API docs, search for the category and then copy the specific String value and paste it in his code. It would be easier to have all values inside Dart plugin code.

I am sorry if the accessible word does not mean that, my English is still WIP :/

as this is a breaking change and there is a 10.0 prerelease at the moment with branch on it too, could this PR target the 10.0.0 branch?

Make sense, I change it.

the semantics are slightly awkward in that it's calling constructor methods even though they're constant constructors. Can this be changed so it looks like a field/property is referenced rather than a method? An example of what I mean is a change in the implement so that rather than having consumers have AndroidNotificationCategory.alarm() in their code, they would reference AndroidNotificationCategory.alarm instead

Of course, it sounds better to access the properties in that way

I am going to update the PR with the proposed changes.
Thanks for reviewing!

@lucasribolli lucasribolli force-pushed the android_notification_category branch from 9efb5e7 to ed67955 Compare June 7, 2022 16:16
@lucasribolli lucasribolli changed the base branch from master to 10.0.0 June 7, 2022 16:16
@MaikuB
Copy link
Owner

MaikuB commented Jun 13, 2022

Thanks for making the changes. Given what you said, do you think you could add links to to the Android API docs for each category? For example, https://developer.android.com/reference/androidx/core/app/NotificationCompat#CATEGORY_CALL() is the one for the call category

Edit: will update the semantics for Linux version after this is merged in for consistency

@lucasribolli
Copy link
Contributor Author

I add it, of course. It will be similar to AndroidServiceForegroundType.
The links need a () at the end so I will replace it by %28%29 in encoded link. It works the same and does not add one more ) in documentation from consumers vision

@MaikuB MaikuB merged commit 3562340 into MaikuB:10.0.0 Jun 16, 2022
@lucasribolli lucasribolli deleted the android_notification_category branch June 16, 2022 12:11
MaikuB added a commit that referenced this pull request Sep 17, 2022
…ations on iOS and macOS, iOS and macOS refactoring and renamed Android error codes (#1406)

* Added support for active notifications on iOS (#1391)

* Added support for active notifications on iOS

* bump platform interface to 6.0.0-dev.1 for prerelease

Co-authored-by: Michael Bui <[email protected]>

* Google Java Format

* fix version of platform interface

* Swift Format

* update error codes for unsupported os version and existing error codes to lower case

* Swift Format

* update groupKey changelog details

* Clang Format

* bump platform interface dependency used by linux plugin

* bump linux plugin for prerelease

* use dependency overrides for example app

* update text in example app for getActiveNotifications example around unsupported iOS version

* bump main plugin for prerelease

* bump cross-platform facing plugin's dependency on linux plugin

* call apply method for shared preferences editor instead of committing in background via a thread

* fix linux plugin pubspec

* update example to use device_info_plus instead of device_info

* Clang Format

* address linter issues

* refactored iOS and macOS classes

* update readme based on iOS/macOS refactoring and tweaks to docs around actions

* fix section around handling notifications when app is in the foreground for iOS

* updates for pre-release

* add changelog entry on breaking change for refactoring iOS and macOS classes

* bump platform interface dependency

* rename callback for selecting notification action

* rename method invoked from macos when action is selected

* bump linux dependency

* [flutter_local_notifications_linux] Add actions support in Linux (#1442)

* Add actions support in Linux

* Update README

* bump versions and changelog for another pre-release

* add git clean script

* add exported flag to ActionBroadcastReceiver

* add keep annotation to NotificationAction

* lookup callback handler after flutter engine is initialised

* fix error where plugin was lookup to the notification action callback and failed to find it as it was doing before the Flutter engine was initialised

* Google Java Format

* remove ActionBroadcastReceiverTest as implementation logic depends on starting Flutter engine

* apply appropriate mutability flag to intents for notification actions to

* Google Java Format

* bump to 10.0.0-dev.8

* bump linux plugin

* avoid trying to process iOS notification responses for notifications not created by the plugin (#1509)

* fix completionHandler being called for notifications created outside of the plugin

* Clang Format

* bump to 10.0.0-dev.9

Co-authored-by: runner <[email protected]>

* update requestPermissions on macOS to have non-nullable parameters

* fix default param values on macOS for requestPermissions

* update 10.0.0-dev.9 changelog entry for macOS requestPermissions change

* [flutter_local_notifications] adding ios/macos time sensitive interruption level (#1501)

* adding ios/macos time sensitive interruption level

* adding ios/macos time sensitive interruption level

* adding ios/macos time sensitive interruption level

* darwin time sensitive notifications requested changes

* darwin time sensitive notifications requested changes

* fixing accidental revert of requrestPermission bool parameter defaults

* fixing doc comment default value for `requestCriticalPermission`

* Clang Format

* change import used to get access to immutable annotation

* update InterruptionLevel to use a class and be explicit on numeric values

* bump to 10.0.0-dev.10

* fix api docs for InterruptionLevel

* update example app to display groupKey of ActiveNotification

* changelog and version bumps to prep for 10.0.0-dev.11 release

* Reworked callbacks have separate callbacks to deal with foreground and background interactions (#1548)

* updated notification callbacks

* update ios plugin code to deal with foreground notification actions

* update notification app launch to process notification responses on ios

* refactor code for extracting notification response dictionary on ios

* update launch notification to be saved as a dictionary

* update app launch notification logic on macos

* rename and refactor notification logic on macos and ios

* revert making didNotificationLaunchApp parameter named

* update android plugin to send foreground event for notification actions

* bump plugin and update changelog

* Google Java Format

* Swift Format

* formatted objective c with clang format

Co-authored-by: github-actions <>
Co-authored-by: runner <[email protected]>

* update logic on iOS and macOS to set notification categories without querying for existing categories (#1549)

* update logic to set notification categories without querying for existing categories

* Swift Format

Co-authored-by: runner <[email protected]>

* add changelog entry on changes to setting notification categories

* clarify notification actions support on Apple's platforms

* updated readme to be more explicit around how to handle when is launched by a notification

* remove reference to the word foreground from notification callback to avoid confusion (#1555)

* remove reference to the word foreground from notification callback to avoid confusion

* Clang Format

* add changelog entry for platform interface

* update changelog entries and bump linux plugin

Co-authored-by: runner <[email protected]>

* fix linter issues in linux test class

* bump linux plugin's dependency on platform interface

* bump flutter_local_notifications dependencies on linux plugin and platform interface

* suppress unchecked cast warnings in plugin

* Google Java Format

* bump to 10.0.0-dev.13

* bump to 10.0.0-dev.14

* fix merge issue

* bump to 10.0.0-dev.15

* fix version which should be 10.0.0-dev.14

* fix progress in example app (#1600)

* [flutter_local_notifications] removed dependency on ThreeTenBP and use desugaring (#1601)

* remove ThreeTenBP and use Java desugaring

* update example to app to use launchUrl instead of deprecated launch method

* bump plugin and update changelog and readme on Gradle setup

* add changelog entry for example app fix

* add gradle setup to toc

* fix version to 10.0.0-dev.14

* update changelog entry on version that it includes from stable release

* remove extra bullet point in 10.0.0-dev.14 changelog entry

* change linux plugin to now be a 1.0.0 pre-release instead

* release 10.0.0-dev.15

* [flutter_local_notifications] add AndroidNotificationCategory to make Android categories more accessible (#1609)

* replace Android notification category String to AndroidNotificationCategory class type

* change AndroidNotificationCategory to make use of const properties instead of factory constructors

* add API docs for each Android category

* format categories file

* changed linux notification categories to static const fields instead of factory constructors

* release 10.0.0-dev.16

* fix example app with using the email arrived linux notification category

* release flutter_local_notifications 10.0.0-dev.17

* fix show with actions unit test

* [flutter_local_notifications] Fix #1654 (#1655)

* fix #1654

* Google Java Format

Co-authored-by: github-actions <>

* add comment on why actionInputs has the nullable annotation

* Google Java Format

* release 10.0.0-dev.18

* release flutter_local_notification_linux 1.0.0-dev.3

* fix merge issue

* bump for 10.0.0-dev.19 release

* 10.0.0-dev.20 release

* Google Java Format

* fix unit test for notification actions to check for audioAttributesUsage

* release flutter_local_notifications 10.0.0-dev.21

* bump minimum flutter sdk to 2.8 and minimum dart sdk to 2.15

* update changelog entry when mentioning dbus

* [flutter_local_notification] update document #1684 (#1692)

update IOS general setup document in flutter_local_notification/README.md

* add annotation to solve tree-shaking issues when dealing with functions using background isolates

* add more details on entry point annotation and wording tweaks to cavaets to using background isolates

* update API docs for onDidReceiveBackgroundNotificationResponse to mention entry point annotation

* remove references to IsolateNameServer APIs

* update docs around callbacks

* fix documentation on getActiveNotifications related code

* update min flutter sdk version of flutter app to 2.8

* clean up example app

* fix issues picked up by linter

* add details on caveat on null notification payload

* update versions for stable release

* update changelog for stable release

* add missing changelog entry for iOS and macOS on request critical notification permissions and specifying interruption level

* add changelog entry on changes done to example app around notification IDs

* remove url_launcher dependency as it's not longer used

* add steps on setting up compile SDK version

* remove excess blank line from changelog

Co-authored-by: morvagergely <[email protected]>
Co-authored-by: github-actions <>
Co-authored-by: runner <[email protected]>
Co-authored-by: runner <[email protected]>
Co-authored-by: runner <[email protected]>
Co-authored-by: runner <[email protected]>
Co-authored-by: Yaroslav Pronin <[email protected]>
Co-authored-by: runner <[email protected]>
Co-authored-by: maprohu <[email protected]>
Co-authored-by: runner <[email protected]>
Co-authored-by: runner <[email protected]>
Co-authored-by: runner <[email protected]>
Co-authored-by: runner <[email protected]>
Co-authored-by: Lucas Ribolli <[email protected]>
Co-authored-by: SungHyun <[email protected]>
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.

2 participants