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] adding ios/macos time sensitive interruption level #1501

Merged
merged 8 commits into from
Mar 1, 2022

Conversation

maprohu
Copy link
Contributor

@maprohu maprohu commented Feb 22, 2022

Fixes #1495

Contains changes both for iOS and macOS, based on branch 10.0.0

Please note my comment in the previous PR, I could not test the notifications on macOS yet. I did not really look into why no notifications show up on my Mac when running the example app. Do you happen to have a suggestion where to look?

@maprohu
Copy link
Contributor Author

maprohu commented Feb 23, 2022

I finally managed to test the notifications when running the example app as a macOS desktop application. As you suggested, I needed to enable the notifications in System Preferences.

Note that in order for the time sensitive notifications to work, I had to add the "Time Sensitive Notifications" capability to the macOS project. And that required some change in the signing preferences of the xcode project, and I even ended up registering a new bundle ID for the example app in my Apple developer account. I did not commit these changes, as they are tied to my Apple account. Without making these changes in the xcode project the "time sensitive" setting on notifications is ignored and they behave like normal notifications.

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.

Thanks for taking another stab at this. Noticed a couple of minor issues. Rest looks good to me :)

/// The interruption level that indicates the priority and
/// delivery timing of a notification.
///
/// This property is only applicable to iOS 15.0 or newer.
Copy link
Owner

Choose a reason for hiding this comment

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

As this class is for both iOS and macOS, could you add the macOS version too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, adding comment.

@@ -9,6 +9,7 @@ class DarwinInitializationSettings {
this.requestAlertPermission = true,
this.requestSoundPermission = true,
this.requestBadgePermission = true,
this.requestCriticalPermission = true,
Copy link
Owner

Choose a reason for hiding this comment

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

Shouldn't this have been made to default to false? Looks like it was done with the additions made to the requestPermissions() method so I'm guessing this was an accident since this permission requires special approval and most apps wouldn't need it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I will change the default accordingly.

@MaikuB
Copy link
Owner

MaikuB commented Mar 1, 2022

@maprohu in case it got missed, note that there are conflicts that would need to be resolved as there were changes done. You'll need to update your branch with the latest changes from 10.0.0 to try to resolve them

@maprohu
Copy link
Contributor Author

maprohu commented Mar 1, 2022

Hello Michael,
I just fixed the issues that you mentioned above.

Note that I see that there seem to be some conflicts in the branch. Let me know if that something that I should try to fix or you can handle it. Ok, i see your comment above. Working on it.. :)

Cheers,
Marton

@MaikuB
Copy link
Owner

MaikuB commented Mar 1, 2022

As this is your first PR, I would suggest you can try to see how to fix them as this will probably not be the only time that you'll be submitting PRs in the future :)

From what I could see, they should be relative straightforward to resolve. Main change to note is that recently I made the boolean parameters of the requestPermissions method non-nullable and with default values of false. That should help you determine what the resolution would be. If you get stuck though then give me a shout and I can help resolve them

@maprohu
Copy link
Contributor Author

maprohu commented Mar 1, 2022

@MaikuB
I think I made a mistake and by accident reverted your changes regarding the requestPermission "false by default" parameters. Give me a second...

@maprohu
Copy link
Contributor Author

maprohu commented Mar 1, 2022

@MaikuB
Ok, I think I made it. I do need to step up my merge game... :)

Let me know how it looks!

@MaikuB MaikuB merged commit 5620854 into MaikuB:10.0.0 Mar 1, 2022
@MaikuB
Copy link
Owner

MaikuB commented Mar 1, 2022

Looks good to me. I noticed a comment around the ordering of the enum values that I may had missed, good call though made me think that another option is to assign specific values. Something that could be updated later though

@MaikuB
Copy link
Owner

MaikuB commented Mar 1, 2022

Hmm on further thought, I'll update how the enum is defined before releasing this. For reference, the approach will be similar to how the Importance class is defined. Thinking behind this is to make it less prone to errors if the ordering changes even though it's not likely and can help make it more explicit what the value is.

@maprohu
Copy link
Contributor Author

maprohu commented Mar 1, 2022

Ok, great, thanks! :)
About the enums, I was also in doubt. Unfortunately (or by design?) Dart enums are rather simple. It would be nice to have instance fields defined for each enum item.
I agree, the way Importance is defined seems to be the next best thing.

@tripany
Copy link

tripany commented Apr 29, 2022

I think breaks building for iOS < 15.

Property 'interruptionLevel' not found on object of type 'UNMutableNotificationContent *'

@tripany
Copy link

tripany commented May 2, 2022

I think breaks building for iOS < 15.

Property 'interruptionLevel' not found on object of type 'UNMutableNotificationContent *'

Scratch that, upgrading from xCode 12 to xCode 13 solved it.

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.

4 participants