From 6851d34d35e7e82cd9785bbe8cfc8ae7576dbaa5 Mon Sep 17 00:00:00 2001 From: Krille Date: Sat, 25 Feb 2023 15:26:17 +0100 Subject: [PATCH] chore: Lookup l10n in pushhelper if null --- lib/utils/push_helper.dart | 8 +++++--- pubspec.lock | 4 ++-- pubspec.yaml | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/utils/push_helper.dart b/lib/utils/push_helper.dart index 8620e5ca..fb1fbe63 100644 --- a/lib/utils/push_helper.dart +++ b/lib/utils/push_helper.dart @@ -43,10 +43,12 @@ Future pushHelper( onDidReceiveNotificationResponse: onSelectNotification, onDidReceiveBackgroundNotificationResponse: onSelectNotification, ); + + l10n ??= lookupL10n(const Locale('en')); flutterLocalNotificationsPlugin.show( 0, - l10n?.newMessageInFluffyChat ?? 'New message in FluffyChat', // default to hardcoded value if l10n is null - l10n?.openAppToReadMessages ?? 'Open app to read messages', // default to hardcoded value if l10n is null + l10n.newMessageInFluffyChat, + l10n.openAppToReadMessages, NotificationDetails( iOS: const DarwinNotificationDetails(), android: AndroidNotificationDetails( @@ -54,7 +56,7 @@ Future pushHelper( AppConfig.pushNotificationsChannelName, channelDescription: AppConfig.pushNotificationsChannelDescription, number: notification.counts?.unread, - ticker: l10n?.unreadChats(notification.counts?.unread ?? 1) ?? '1 unread chat', // default to hardcoded value if l10n is null + ticker: l10n.unreadChats(notification.counts?.unread ?? 1), importance: Importance.max, priority: Priority.high, ), diff --git a/pubspec.lock b/pubspec.lock index d247e933..59766fda 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1139,10 +1139,10 @@ packages: dependency: "direct main" description: name: matrix - sha256: cc9cf87682d36c814a7c7fba4dfcb13caf33a0f3ef81f9a824a667415c009a60 + sha256: "9e661004d56e176bf5e6ea30cc517e41392d36eccd8af4b0a9bc5a982def2552" url: "https://pub.dev" source: hosted - version: "0.17.0" + version: "0.17.1" matrix_api_lite: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 4ab38c39..0739c970 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -59,7 +59,7 @@ dependencies: just_audio_mpv: ^0.1.6 keyboard_shortcuts: ^0.1.4 latlong2: ^0.8.1 - matrix: ^0.17.0 + matrix: ^0.17.1 matrix_homeserver_recommendations: ^0.3.0 matrix_link_text: ^1.0.2 native_imaging: ^0.1.0