diff --git a/packages/flutter_local_notifications_watchos/CHANGELOG.md b/packages/flutter_local_notifications_watchos/CHANGELOG.md index e1ab242..7fcfbb0 100644 --- a/packages/flutter_local_notifications_watchos/CHANGELOG.md +++ b/packages/flutter_local_notifications_watchos/CHANGELOG.md @@ -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. diff --git a/packages/flutter_local_notifications_watchos/PORTING_REPORT.md b/packages/flutter_local_notifications_watchos/PORTING_REPORT.md index e6df65a..6883746 100644 --- a/packages/flutter_local_notifications_watchos/PORTING_REPORT.md +++ b/packages/flutter_local_notifications_watchos/PORTING_REPORT.md @@ -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 @@ -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` | ✅ | diff --git a/packages/flutter_local_notifications_watchos/README.md b/packages/flutter_local_notifications_watchos/README.md index 600f415..c33ece0 100644 --- a/packages/flutter_local_notifications_watchos/README.md +++ b/packages/flutter_local_notifications_watchos/README.md @@ -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 ``` @@ -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 diff --git a/packages/flutter_local_notifications_watchos/example/integration_test/watchos_notifications_test.dart b/packages/flutter_local_notifications_watchos/example/integration_test/watchos_notifications_test.dart index 0a0e89d..4368bc9 100644 --- a/packages/flutter_local_notifications_watchos/example/integration_test/watchos_notifications_test.dart +++ b/packages/flutter_local_notifications_watchos/example/integration_test/watchos_notifications_test.dart @@ -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< @@ -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); } diff --git a/packages/flutter_local_notifications_watchos/example/pubspec.yaml b/packages/flutter_local_notifications_watchos/example/pubspec.yaml index 3f2a268..4ad80bf 100644 --- a/packages/flutter_local_notifications_watchos/example/pubspec.yaml +++ b/packages/flutter_local_notifications_watchos/example/pubspec.yaml @@ -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 diff --git a/packages/flutter_local_notifications_watchos/lib/flutter_local_notifications_watchos.dart b/packages/flutter_local_notifications_watchos/lib/flutter_local_notifications_watchos.dart index 04b59a0..31e4f1f 100644 --- a/packages/flutter_local_notifications_watchos/lib/flutter_local_notifications_watchos.dart +++ b/packages/flutter_local_notifications_watchos/lib/flutter_local_notifications_watchos.dart @@ -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 initialize({ required DarwinInitializationSettings settings, diff --git a/packages/flutter_local_notifications_watchos/pubspec.yaml b/packages/flutter_local_notifications_watchos/pubspec.yaml index bd7ff27..234e706 100644 --- a/packages/flutter_local_notifications_watchos/pubspec.yaml +++ b/packages/flutter_local_notifications_watchos/pubspec.yaml @@ -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: diff --git a/packages/flutter_local_notifications_watchos/watchos/Classes/flutter_local_notifications_watchos_ffi.h b/packages/flutter_local_notifications_watchos/watchos/Classes/flutter_local_notifications_watchos_ffi.h index f9ec7d4..05733fb 100644 --- a/packages/flutter_local_notifications_watchos/watchos/Classes/flutter_local_notifications_watchos_ffi.h +++ b/packages/flutter_local_notifications_watchos/watchos/Classes/flutter_local_notifications_watchos_ffi.h @@ -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": }; 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); diff --git a/packages/flutter_local_notifications_watchos/watchos/Classes/flutter_local_notifications_watchos_ffi.m b/packages/flutter_local_notifications_watchos/watchos/Classes/flutter_local_notifications_watchos_ffi.m index b5c367a..d5531d4 100644 --- a/packages/flutter_local_notifications_watchos/watchos/Classes/flutter_local_notifications_watchos_ffi.m +++ b/packages/flutter_local_notifications_watchos/watchos/Classes/flutter_local_notifications_watchos_ffi.m @@ -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) { @@ -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]) { diff --git a/tool/upstream_versions.yaml b/tool/upstream_versions.yaml index dba9191..1c793c6 100644 --- a/tool/upstream_versions.yaml +++ b/tool/upstream_versions.yaml @@ -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