Merge branch 'krille/update-local-notifications' into 'main'

chore: Update local notifications package

See merge request famedly/fluffychat!1018
This commit is contained in:
Krille Fear 2022-11-03 12:57:58 +00:00
commit cd744a31e7
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(() {
waitForFirstSync = true;
});
}
return;
}
void cancelAction() {
if (selectMode == SelectMode.share) {

View File

@ -250,7 +250,7 @@ class BackgroundPush {
return;
}
_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 {
final roomId = response?.payload;
Logs().v('[Push] Attempting to go to room $roomId...');
if (router == null || roomId == null) {
return;

View File

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

View File

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

View File

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

View File

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