Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/flutter_local_notifications_watchos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ physical watch.
background actions and those dismissals reach
`onDidReceiveNotificationResponse`, since the watch has no background
isolate.
* As upstream 22.3.2, an error in `UNErrorDomain` from adding a request is
ignored: watchOS 27, like iOS 27, reports a missing permission that way.
* As upstream since 22.3.2, an error in `UNErrorDomain` from adding a
request is ignored: watchOS 27, like iOS 27, reports a missing permission
that way.
* As upstream on iOS 14 and later, `presentAlert` is not read: the banner
and the list have flags of their own. `checkPermissions` reports
provisional authorization apart from `isEnabled`, and `initialize` answers
false when it asks for nothing.
* On flutter_local_notifications 23 (`^23.0.2`), whose iOS-facing API is
22.3.2's. As upstream 23.0.2, a provisional request alone is asked for,
and granted without a prompt, instead of answering false.
* `providesAppNotificationSettings` is asked for and reported;
`criticalSoundVolume` plays the default critical sound at that volume.
* LICENSE carries Michael Bui's notice, as upstream's does.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ host's `willPresent` and the presentation flags) is not yet checked.
Generated by `flutter-watchos plugin port` on 2026-10-21, then finished by
hand.

Source: `flutter_local_notifications` 22.3.2
Source: `flutter_local_notifications` 22.3.2, then followed to 23.0.2 (its
iOS change: a provisional request alone is asked for)
Base platform: ios (Objective-C)

## How this differs from the iOS implementation
Expand Down Expand Up @@ -93,9 +94,9 @@ Every member of `IOSFlutterLocalNotificationsPlugin` and the
| Member | watchOS |
|---|---|
| `initialize` | ◐ `onDidReceiveBackgroundNotificationResponse` is not called: background actions, and dismissals of notifications with `dismissIsolate` set, reach `onDidReceiveNotificationResponse` |
| `requestPermissions` | ✅ `providesAppNotificationSettings` (watchOS 5+) is asked for; `carPlay` has nothing to ask for. False when none of alert, sound, badge, critical and app settings is asked, as on iOS |
| `requestPermissions` | ✅ `providesAppNotificationSettings` (watchOS 5+) is asked for; `carPlay` has nothing to ask for. False when none of alert, sound, badge, provisional, critical and app settings is asked, as on iOS; provisional alone is asked for, as from upstream 23.0.2 on |
| `checkPermissions` | ◐ `isBadgeEnabled` is always false; `isEnabled` is for full authorization only, provisional is `isProvisionalEnabled`, as on iOS |
| `show` / `zonedSchedule` / `periodicallyShow` / `periodicallyShowWithDuration` | ◐ the default sound only; `criticalSoundVolume` plays the default critical sound at that volume, since watchOS has no named critical sound. A missing permission is ignored, as upstream 22.3.2 ignores `UNErrorDomain` errors |
| `show` / `zonedSchedule` / `periodicallyShow` / `periodicallyShowWithDuration` | ◐ the default sound only; `criticalSoundVolume` plays the default critical sound at that volume, since watchOS has no named critical sound. A missing permission is ignored, as upstream ignores `UNErrorDomain` errors since 22.3.2 |
| `cancel` / `cancelAll` / `cancelAllPendingNotifications` | ✅ |
| `pendingNotificationRequests` / `getActiveNotifications` | ✅ |
| `getNotificationAppLaunchDetails` | ✅ |
Expand Down
5 changes: 3 additions & 2 deletions packages/flutter_local_notifications_watchos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package alongside it:

```yaml
dependencies:
flutter_local_notifications: ^22.3.2
flutter_local_notifications: ^23.0.2
flutter_local_notifications_watchos: ^0.0.1
```

Expand Down Expand Up @@ -85,7 +85,8 @@ This class extends upstream's concrete `IOSFlutterLocalNotificationsPlugin`,
as flutter_local_notifications requires on iOS-reporting platforms. A method
an upstream release adds to that class, a minor release included, reaches
its method channel here and throws `MissingPluginException` until this
package overrides it too. 23.0.0 is in development.
package overrides it too. This version follows 23.0.2, whose
`IOSFlutterLocalNotificationsPlugin` has the same members as 22.3.2's.

## License

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void main() {

testWidgets('show completes without permission', (WidgetTester _) async {
// watchOS 27 reports a missing permission as a UNErrorDomain error from
// adding the request, which upstream 22.3.2 ignores; so does this
// adding the request, which upstream ignores since 22.3.2; so does this
// package. Runs on an unattended run, where nothing was allowed.
final NotificationsEnabledOptions? options = await plugin
.resolvePlatformSpecificImplementation<
Expand Down Expand Up @@ -129,4 +129,25 @@ void main() {
expect(active.singleWhere((ActiveNotification n) => n.id == 1002).title,
'Lap 1');
}, skip: !_prompt);

// Last: once granted, the provisional authorization stays for the rest of
// the run.
testWidgets('a provisional request alone is granted without a prompt',
(WidgetTester _) async {
final IOSFlutterLocalNotificationsPlugin ios =
plugin.resolvePlatformSpecificImplementation<
IOSFlutterLocalNotificationsPlugin>()!;
final NotificationsEnabledOptions? before = await ios.checkPermissions();
if (before!.isEnabled || before.isProvisionalEnabled) {
// Decided on an earlier run that kept the install: nothing to ask.
markTestSkipped('notifications are already allowed, so none is asked');
return;
}
// As upstream 23.0.2: asked for alone, provisional authorization is
// requested, and the system grants it without a prompt. Before, the
// answer was false and nothing was asked. A run where notifications were
// refused earlier answers false too: uninstall the app first.
expect(await ios.requestPermissions(provisional: true), isTrue);
expect((await ios.checkPermissions())!.isProvisionalEnabled, isTrue);
}, skip: _prompt);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environment:
dependencies:
flutter:
sdk: flutter
flutter_local_notifications: ^22.3.2
flutter_local_notifications: ^23.0.2
flutter_local_notifications_watchos:
path: ../
timezone: ^0.11.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ class FlutterLocalNotificationsWatchos
/// whichever isolate it names.
///
/// As on iOS, the result is false when [settings] ask for none of the
/// alert, sound, badge, critical and app-settings permissions.
/// alert, sound, badge, provisional, critical and app-settings
/// permissions.
@override
Future<bool?> initialize({
required DarwinInitializationSettings settings,
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_local_notifications_watchos/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies:
# IOSFlutterLocalNotificationsPlugin, which this package extends because
# flutter_local_notifications checks for that type on iOS-reporting
# platforms, and the Darwin settings and details.
flutter_local_notifications: ^22.3.2
flutter_local_notifications: ^23.0.2
timezone: ^0.11.0

dev_dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ void flutter_local_notifications_watchos_set_callback(flnw_signal_callback callb
// "presentBanner", "presentList"}, "request": {"alert", "sound", "badge",
// "provisional", "critical", "providesAppNotificationSettings"}}.
// Result: {"granted": <bool>}; false, without asking, when none of alert,
// sound, badge, critical and providesAppNotificationSettings is asked for.
// sound, badge, provisional, critical and providesAppNotificationSettings is
// asked for.
FLNW_EXPORT
int64_t flutter_local_notifications_watchos_initialize(const char* json);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,13 @@ static UNAuthorizationOptions _authorizationOptions(NSDictionary* request) {
}

static void _requestAuthorization(int64_t request, UNAuthorizationOptions options) {
// As upstream: with none of alert, sound, badge, critical and app
// notification settings asked for, nothing is asked and the answer is no.
// As upstream: with none of alert, sound, badge, provisional, critical
// and app notification settings asked for, nothing is asked and the
// answer is no. Provisional counts from upstream 23.0.2 on: asked for
// alone, it is granted without a prompt.
UNAuthorizationOptions asked = UNAuthorizationOptionAlert | UNAuthorizationOptionSound |
UNAuthorizationOptionBadge |
UNAuthorizationOptionProvisional |
UNAuthorizationOptionCriticalAlert |
UNAuthorizationOptionProvidesAppNotificationSettings;
if ((options & asked) == 0) {
Expand Down Expand Up @@ -560,7 +563,7 @@ int64_t flutter_local_notifications_watchos_add(const char* json) {
[[UNUserNotificationCenter currentNotificationCenter]
addNotificationRequest:unRequest
withCompletionHandler:^(NSError* addError) {
// As upstream 22.3.2: watchOS 27, like iOS 27, reports in
// As upstream since 22.3.2: watchOS 27, like iOS 27, reports in
// UNErrorDomain what earlier versions let pass silently, such as
// notifications not being allowed, so those errors are ignored.
if (addError != nil && ![addError.domain isEqualToString:UNErrorDomain]) {
Expand Down
2 changes: 1 addition & 1 deletion tool/upstream_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ upstreams:
firebase_core: 5.1.0
firebase_messaging: 17.0.1
firebase_storage: 14.0.1
flutter_local_notifications: 22.3.2
flutter_local_notifications: 23.0.2
flutter_secure_storage: 11.2.0
games_services: 5.3.0
geolocator: 14.1.1
Expand Down
Loading