chore: Lookup l10n in pushhelper if null

This commit is contained in:
Krille 2023-02-25 15:26:17 +01:00
parent 006f2f527f
commit 6851d34d35
3 changed files with 8 additions and 6 deletions

View File

@ -43,10 +43,12 @@ Future<void> pushHelper(
onDidReceiveNotificationResponse: onSelectNotification, onDidReceiveNotificationResponse: onSelectNotification,
onDidReceiveBackgroundNotificationResponse: onSelectNotification, onDidReceiveBackgroundNotificationResponse: onSelectNotification,
); );
l10n ??= lookupL10n(const Locale('en'));
flutterLocalNotificationsPlugin.show( flutterLocalNotificationsPlugin.show(
0, 0,
l10n?.newMessageInFluffyChat ?? 'New message in FluffyChat', // default to hardcoded value if l10n is null l10n.newMessageInFluffyChat,
l10n?.openAppToReadMessages ?? 'Open app to read messages', // default to hardcoded value if l10n is null l10n.openAppToReadMessages,
NotificationDetails( NotificationDetails(
iOS: const DarwinNotificationDetails(), iOS: const DarwinNotificationDetails(),
android: AndroidNotificationDetails( android: AndroidNotificationDetails(
@ -54,7 +56,7 @@ Future<void> pushHelper(
AppConfig.pushNotificationsChannelName, AppConfig.pushNotificationsChannelName,
channelDescription: AppConfig.pushNotificationsChannelDescription, channelDescription: AppConfig.pushNotificationsChannelDescription,
number: notification.counts?.unread, 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, importance: Importance.max,
priority: Priority.high, priority: Priority.high,
), ),

View File

@ -1139,10 +1139,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: matrix name: matrix
sha256: cc9cf87682d36c814a7c7fba4dfcb13caf33a0f3ef81f9a824a667415c009a60 sha256: "9e661004d56e176bf5e6ea30cc517e41392d36eccd8af4b0a9bc5a982def2552"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.17.0" version: "0.17.1"
matrix_api_lite: matrix_api_lite:
dependency: transitive dependency: transitive
description: description:

View File

@ -59,7 +59,7 @@ dependencies:
just_audio_mpv: ^0.1.6 just_audio_mpv: ^0.1.6
keyboard_shortcuts: ^0.1.4 keyboard_shortcuts: ^0.1.4
latlong2: ^0.8.1 latlong2: ^0.8.1
matrix: ^0.17.0 matrix: ^0.17.1
matrix_homeserver_recommendations: ^0.3.0 matrix_homeserver_recommendations: ^0.3.0
matrix_link_text: ^1.0.2 matrix_link_text: ^1.0.2
native_imaging: ^0.1.0 native_imaging: ^0.1.0