From 2c835966a4744d7c90a59cf6e50ef804dfcac3d4 Mon Sep 17 00:00:00 2001 From: fabienli Date: Sat, 25 Feb 2023 08:13:50 +0100 Subject: [PATCH] Default hardcoded message when l10n is not available --- lib/utils/push_helper.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/utils/push_helper.dart b/lib/utils/push_helper.dart index 242576f4..8620e5ca 100644 --- a/lib/utils/push_helper.dart +++ b/lib/utils/push_helper.dart @@ -45,8 +45,8 @@ Future pushHelper( ); flutterLocalNotificationsPlugin.show( 0, - l10n?.newMessageInFluffyChat, - l10n?.openAppToReadMessages, + 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 NotificationDetails( iOS: const DarwinNotificationDetails(), android: AndroidNotificationDetails( @@ -54,7 +54,7 @@ Future pushHelper( AppConfig.pushNotificationsChannelName, channelDescription: AppConfig.pushNotificationsChannelDescription, number: notification.counts?.unread, - ticker: l10n!.unreadChats(notification.counts?.unread ?? 1), + ticker: l10n?.unreadChats(notification.counts?.unread ?? 1) ?? '1 unread chat', // default to hardcoded value if l10n is null importance: Importance.max, priority: Priority.high, ),