From 6ca15696dbdea843ff37a77ac0d99d6208398098 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Feb 2026 16:43:51 +0000 Subject: [PATCH] Fix flutter_local_notifications 20.0.0 breaking changes - convert to named parameters Co-authored-by: krille-chan <24619905+krille-chan@users.noreply.github.com> --- lib/utils/background_push.dart | 2 +- lib/utils/client_manager.dart | 10 +++++----- lib/utils/notification_background_handler.dart | 12 +++++++----- lib/utils/push_helper.dart | 18 +++++++++--------- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart index 4e0f91f10..0e5c3e80a 100644 --- a/lib/utils/background_push.dart +++ b/lib/utils/background_push.dart @@ -112,7 +112,7 @@ class BackgroundPush { }); } await _flutterLocalNotificationsPlugin.initialize( - const InitializationSettings( + initializationSettings: const InitializationSettings( android: AndroidInitializationSettings('notifications_icon'), iOS: DarwinInitializationSettings(), ), diff --git a/lib/utils/client_manager.dart b/lib/utils/client_manager.dart index c318ceb11..179411ed1 100644 --- a/lib/utils/client_manager.dart +++ b/lib/utils/client_manager.dart @@ -161,17 +161,17 @@ abstract class ClientManager { final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); await flutterLocalNotificationsPlugin.initialize( - const InitializationSettings( + initializationSettings: const InitializationSettings( android: AndroidInitializationSettings('notifications_icon'), iOS: DarwinInitializationSettings(), ), ); flutterLocalNotificationsPlugin.show( - 0, - title, - body, - const NotificationDetails( + id: 0, + title: title, + body: body, + notificationDetails: const NotificationDetails( android: AndroidNotificationDetails( 'error_message', 'Error Messages', diff --git a/lib/utils/notification_background_handler.dart b/lib/utils/notification_background_handler.dart index eaaeb7c67..5433c52b7 100644 --- a/lib/utils/notification_background_handler.dart +++ b/lib/utils/notification_background_handler.dart @@ -196,7 +196,9 @@ Future notificationTap( .timeout(const Duration(seconds: 3)); final messagingStyleInformation = await AndroidFlutterLocalNotificationsPlugin() - .getActiveNotificationMessagingStyle(room.id.hashCode); + .getActiveNotificationMessagingStyle( + notificationId: room.id.hashCode, + ); if (messagingStyleInformation == null) return; l10n ??= await lookupL10n(PlatformDispatcher.instance.locale); messagingStyleInformation.messages?.add( @@ -214,10 +216,10 @@ Future notificationTap( ); await FlutterLocalNotificationsPlugin().show( - room.id.hashCode, - room.getLocalizedDisplayname(MatrixLocals(l10n)), - input, - NotificationDetails( + id: room.id.hashCode, + title: room.getLocalizedDisplayname(MatrixLocals(l10n)), + body: input, + notificationDetails: NotificationDetails( android: AndroidNotificationDetails( AppConfig.pushNotificationsChannelId, l10n.incomingMessages, diff --git a/lib/utils/push_helper.dart b/lib/utils/push_helper.dart index 6c9f9338f..5f7e07c41 100644 --- a/lib/utils/push_helper.dart +++ b/lib/utils/push_helper.dart @@ -42,10 +42,10 @@ Future pushHelper( l10n ??= await lookupL10n(PlatformDispatcher.instance.locale); flutterLocalNotificationsPlugin.show( - notification.roomId?.hashCode ?? 0, - l10n.newMessageInFluffyChat, - l10n.openAppToReadMessages, - NotificationDetails( + id: notification.roomId?.hashCode ?? 0, + title: l10n.newMessageInFluffyChat, + body: l10n.openAppToReadMessages, + notificationDetails: NotificationDetails( iOS: const DarwinNotificationDetails(), android: AndroidNotificationDetails( AppConfig.pushNotificationsChannelId, @@ -220,7 +220,7 @@ Future _tryPushHelper( final messagingStyleInformation = PlatformInfos.isAndroid ? await AndroidFlutterLocalNotificationsPlugin() - .getActiveNotificationMessagingStyle(id) + .getActiveNotificationMessagingStyle(notificationId: id) : null; messagingStyleInformation?.messages?.add(newMessage); @@ -317,10 +317,10 @@ Future _tryPushHelper( } await flutterLocalNotificationsPlugin.show( - id, - title, - body, - platformChannelSpecifics, + id: id, + title: title, + body: body, + notificationDetails: platformChannelSpecifics, payload: FluffyChatPushPayload( client.clientName, event.room.id,