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,
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<void> 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,
),

View File

@ -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:

View File

@ -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