Skip to content

Commit aa0ce88

Browse files
authored
[flutter_local_notifications_windows] bumped ffigen and regenerated bindings (#2731)
* bumped ffigen and regenerated bindings * added credit to Levi Lesches
1 parent f9f6ee5 commit aa0ce88

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

flutter_local_notifications_windows/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [2.0.0-dev.2]
2+
3+
* Bumped `ffigen` and regenerated bindings. Credits to [Levi Lesches](https://github.com/Levi-Lesches) who originally looked at this before the plugin had its minimum Flutter version bumped
4+
15
## [2.0.0-dev.1]
26

37
* **Breaking change** removed the `details` parameter from the `zonedScheduleRawXml()` method as it was not actually used. Thanks to the PR from [Levi Lesches](https://github.com/Levi-Lesches)

flutter_local_notifications_windows/lib/src/ffi/bindings.dart

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// AUTO GENERATED FILE, DO NOT EDIT.
66
//
77
// Generated by `package:ffigen`.
8-
// ignore_for_file: type=lint
8+
// ignore_for_file: type=lint, unused_import
99
import 'dart:ffi' as ffi;
1010
import 'package:ffi/ffi.dart' as pkg_ffi;
1111

@@ -348,7 +348,7 @@ enum NativeLaunchType {
348348
static NativeLaunchType fromValue(int value) => switch (value) {
349349
0 => notification,
350350
1 => action,
351-
_ => throw ArgumentError("Unknown value for NativeLaunchType: $value"),
351+
_ => throw ArgumentError('Unknown value for NativeLaunchType: $value'),
352352
};
353353
}
354354

@@ -360,7 +360,10 @@ final class NativeLaunchDetails extends ffi.Struct {
360360

361361
/// What part of the notification launched the app.
362362
@ffi.UnsignedInt()
363-
external int launchType;
363+
external int launchTypeAsInt;
364+
365+
NativeLaunchType get launchType =>
366+
NativeLaunchType.fromValue(launchTypeAsInt);
364367

365368
/// The payload sent to the app by the notification. Usually the action that was pressed.
366369
external ffi.Pointer<pkg_ffi.Utf8> payload;
@@ -369,6 +372,17 @@ final class NativeLaunchDetails extends ffi.Struct {
369372
external NativeStringMap data;
370373
}
371374

375+
typedef NativeNotificationCallbackFunction =
376+
ffi.Void Function(NativeLaunchDetails details);
377+
typedef DartNativeNotificationCallbackFunction =
378+
void Function(NativeLaunchDetails details);
379+
380+
/// A callback that is run with [NativeLaunchDetails] when a notification is pressed.
381+
///
382+
/// This may be called at app launch or even while the app is running.
383+
typedef NativeNotificationCallback =
384+
ffi.Pointer<ffi.NativeFunction<NativeNotificationCallbackFunction>>;
385+
372386
/// See: https://learn.microsoft.com/en-us/uwp/api/windows.ui.notifications.notificationupdateresult
373387
enum NativeUpdateResult {
374388
success(0),
@@ -382,16 +396,6 @@ enum NativeUpdateResult {
382396
0 => success,
383397
1 => failed,
384398
2 => notFound,
385-
_ => throw ArgumentError("Unknown value for NativeUpdateResult: $value"),
399+
_ => throw ArgumentError('Unknown value for NativeUpdateResult: $value'),
386400
};
387401
}
388-
389-
/// A callback that is run with [NativeLaunchDetails] when a notification is pressed.
390-
///
391-
/// This may be called at app launch or even while the app is running.
392-
typedef NativeNotificationCallback =
393-
ffi.Pointer<ffi.NativeFunction<NativeNotificationCallbackFunction>>;
394-
typedef NativeNotificationCallbackFunction =
395-
ffi.Void Function(NativeLaunchDetails details);
396-
typedef DartNativeNotificationCallbackFunction =
397-
void Function(NativeLaunchDetails details);

flutter_local_notifications_windows/lib/src/ffi/utils.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ extension NativeStringMapUtils on NativeStringMap {
1717
}
1818

1919
/// Gets the [NotificationResponseType] from a [NativeLaunchType].
20-
NotificationResponseType getResponseType(int launchType) {
21-
switch (NativeLaunchType.fromValue(launchType)) {
20+
NotificationResponseType getResponseType(NativeLaunchType launchType) {
21+
switch (launchType) {
2222
case NativeLaunchType.notification:
2323
return NotificationResponseType.selectedNotification;
2424
case NativeLaunchType.action:

flutter_local_notifications_windows/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_local_notifications_windows
22
description: Windows implementation of the flutter_local_notifications plugin
3-
version: 2.0.0-dev.1
3+
version: 2.0.0-dev.2
44
homepage: https://github.com/MaikuB/flutter_local_notifications/tree/master/flutter_local_notifications_windows
55
issue_tracker: https://github.com/MaikuB/flutter_local_notifications/issues
66

@@ -18,7 +18,7 @@ dependencies:
1818
xml: ^6.5.0
1919

2020
dev_dependencies:
21-
ffigen: ^13.0.0
21+
ffigen: ^20.1.1
2222
flutter_lints: ^6.0.0
2323
test: ^1.25.2
2424

0 commit comments

Comments
 (0)