chore: Update local notifications package

This commit is contained in:
Christian Pauly 2022-10-17 17:48:38 +02:00
parent 6c102df445
commit 93954d434a
6 changed files with 23 additions and 22 deletions

View File

@ -553,13 +553,11 @@ class ChatListController extends State<ChatList>
} }
} }
} }
if (mounted) { if (!mounted) return;
setState(() { setState(() {
waitForFirstSync = true; waitForFirstSync = true;
}); });
} }
return;
}
void cancelAction() { void cancelAction() {
if (selectMode == SelectMode.share) { if (selectMode == SelectMode.share) {

View File

@ -250,7 +250,7 @@ class BackgroundPush {
return; return;
} }
_wentToRoomOnStartup = true; _wentToRoomOnStartup = true;
goToRoom(details.payload); goToRoom(details.notificationResponse);
}); });
} }
@ -294,8 +294,9 @@ class BackgroundPush {
); );
} }
Future<void> goToRoom(String? roomId) async { Future<void> goToRoom(NotificationResponse? response) async {
try { try {
final roomId = response?.payload;
Logs().v('[Push] Attempting to go to room $roomId...'); Logs().v('[Push] Attempting to go to room $roomId...');
if (router == null || roomId == null) { if (router == null || roomId == null) {
return; return;

View File

@ -20,7 +20,7 @@ Future<void> pushHelper(
Client? client, Client? client,
L10n? l10n, L10n? l10n,
String? activeRoomId, String? activeRoomId,
Future<dynamic> Function(String?)? onSelectNotification, void Function(NotificationResponse?)? onSelectNotification,
}) async { }) async {
try { try {
await _tryPushHelper( await _tryPushHelper(
@ -38,16 +38,17 @@ Future<void> pushHelper(
await flutterLocalNotificationsPlugin.initialize( await flutterLocalNotificationsPlugin.initialize(
const InitializationSettings( const InitializationSettings(
android: AndroidInitializationSettings('notifications_icon'), android: AndroidInitializationSettings('notifications_icon'),
iOS: IOSInitializationSettings(), iOS: DarwinInitializationSettings(),
), ),
onSelectNotification: onSelectNotification, onDidReceiveNotificationResponse: onSelectNotification,
onDidReceiveBackgroundNotificationResponse: onSelectNotification,
); );
flutterLocalNotificationsPlugin.show( flutterLocalNotificationsPlugin.show(
0, 0,
l10n?.newMessageInFluffyChat, l10n?.newMessageInFluffyChat,
l10n?.openAppToReadMessages, l10n?.openAppToReadMessages,
NotificationDetails( NotificationDetails(
iOS: const IOSNotificationDetails(), iOS: const DarwinNotificationDetails(),
android: AndroidNotificationDetails( android: AndroidNotificationDetails(
AppConfig.pushNotificationsChannelId, AppConfig.pushNotificationsChannelId,
AppConfig.pushNotificationsChannelName, AppConfig.pushNotificationsChannelName,
@ -67,7 +68,7 @@ Future<void> _tryPushHelper(
Client? client, Client? client,
L10n? l10n, L10n? l10n,
String? activeRoomId, String? activeRoomId,
Future<dynamic> Function(String?)? onSelectNotification, void Function(NotificationResponse?)? onSelectNotification,
}) async { }) async {
final isBackgroundMessage = client == null; final isBackgroundMessage = client == null;
Logs().v( Logs().v(
@ -88,9 +89,10 @@ Future<void> _tryPushHelper(
await flutterLocalNotificationsPlugin.initialize( await flutterLocalNotificationsPlugin.initialize(
const InitializationSettings( const InitializationSettings(
android: AndroidInitializationSettings('notifications_icon'), android: AndroidInitializationSettings('notifications_icon'),
iOS: IOSInitializationSettings(), iOS: DarwinInitializationSettings(),
), ),
onSelectNotification: onSelectNotification, onDidReceiveNotificationResponse: onSelectNotification,
//onDidReceiveBackgroundNotificationResponse: onSelectNotification,
); );
client ??= (await ClientManager.getClients(initialize: false)).first; client ??= (await ClientManager.getClients(initialize: false)).first;
@ -206,7 +208,7 @@ Future<void> _tryPushHelper(
priority: Priority.high, priority: Priority.high,
groupKey: event.room.id, groupKey: event.room.id,
); );
const iOSPlatformChannelSpecifics = IOSNotificationDetails(); const iOSPlatformChannelSpecifics = DarwinNotificationDetails();
final platformChannelSpecifics = NotificationDetails( final platformChannelSpecifics = NotificationDetails(
android: androidPlatformChannelSpecifics, android: androidPlatformChannelSpecifics,
iOS: iOSPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics,

View File

@ -409,7 +409,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
action: link == null action: link == null
? null ? null
: SnackBarAction( : SnackBarAction(
label: L10n.of(context)!.link, label: L10n.of(navigatorContext)!.link,
onPressed: () => launch(link.toString()), onPressed: () => launch(link.toString()),
), ),
); );

View File

@ -584,21 +584,21 @@ packages:
name: flutter_local_notifications name: flutter_local_notifications
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "9.7.0" version: "12.0.2"
flutter_local_notifications_linux: flutter_local_notifications_linux:
dependency: transitive dependency: transitive
description: description:
name: flutter_local_notifications_linux name: flutter_local_notifications_linux
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.5.0+1" version: "1.0.0"
flutter_local_notifications_platform_interface: flutter_local_notifications_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: flutter_local_notifications_platform_interface name: flutter_local_notifications_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.0.0" version: "6.0.0"
flutter_localizations: flutter_localizations:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -1682,7 +1682,7 @@ packages:
name: timezone name: timezone
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.8.0" version: "0.9.0"
tint: tint:
dependency: transitive dependency: transitive
description: description:

View File

@ -37,7 +37,7 @@ dependencies:
flutter_blurhash: ^0.7.0 flutter_blurhash: ^0.7.0
flutter_cache_manager: ^3.3.0 flutter_cache_manager: ^3.3.0
flutter_foreground_task: ^3.10.0 flutter_foreground_task: ^3.10.0
flutter_local_notifications: ^9.7.0 flutter_local_notifications: ^12.0.2
flutter_localizations: flutter_localizations:
sdk: flutter sdk: flutter
flutter_map: ^2.2.0 flutter_map: ^2.2.0