Merge branch 'krille/open-chat-linux-notifications' into 'main'

feat: Open chat button from Linux notification

See merge request famedly/fluffychat!709
This commit is contained in:
Krille Fear 2022-02-03 07:57:17 +00:00
commit 8ad6b52902
2 changed files with 7 additions and 5 deletions

View File

@ -2707,7 +2707,7 @@
"@storyPrivacyWarning": {}, "@storyPrivacyWarning": {},
"iUnderstand": "I understand", "iUnderstand": "I understand",
"@iUnderstand": {}, "@iUnderstand": {},
"dismiss": "Dismiss", "openChat": "Open Chat",
"markAsRead": "Mark as read", "markAsRead": "Mark as read",
"reportUser": "Report user" "reportUser": "Report user"
} }

View File

@ -8,6 +8,7 @@ import 'package:http/http.dart' as http;
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:universal_html/html.dart' as html; import 'package:universal_html/html.dart' as html;
import 'package:vrouter/vrouter.dart';
import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions.dart/matrix_locals.dart';
@ -75,8 +76,8 @@ extension LocalNotificationsExtension on MatrixState {
appIcon: appIconFile?.path ?? '', appIcon: appIconFile?.path ?? '',
actions: [ actions: [
NotificationAction( NotificationAction(
DesktopNotificationActions.dismiss.name, DesktopNotificationActions.openChat.name,
L10n.of(widget.context)!.dismiss, L10n.of(widget.context)!.openChat,
), ),
NotificationAction( NotificationAction(
DesktopNotificationActions.seen.name, DesktopNotificationActions.seen.name,
@ -94,7 +95,8 @@ extension LocalNotificationsExtension on MatrixState {
case DesktopNotificationActions.seen: case DesktopNotificationActions.seen:
room.setReadMarker(event.eventId, mRead: event.eventId); room.setReadMarker(event.eventId, mRead: event.eventId);
break; break;
case DesktopNotificationActions.dismiss: case DesktopNotificationActions.openChat:
VRouter.of(navigatorContext).toSegments(['rooms', room.id]);
break; break;
} }
}); });
@ -103,4 +105,4 @@ extension LocalNotificationsExtension on MatrixState {
} }
} }
enum DesktopNotificationActions { seen, dismiss } enum DesktopNotificationActions { seen, openChat }