mirror of
https://github.com/krille-chan/fluffychat
synced 2024-09-10 08:25:12 +00:00
feat: Open chat on shortcut click on android
This commit is contained in:
parent
ffeb8bb08e
commit
477a8b858b
2 changed files with 12 additions and 1 deletions
|
@ -7,6 +7,7 @@ import 'package:flutter/services.dart';
|
|||
|
||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:flutter_shortcuts/flutter_shortcuts.dart';
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
@ -399,6 +400,16 @@ class ChatListController extends State<ChatList>
|
|||
FluffyChatApp.gotInitialLink = true;
|
||||
getInitialLink().then(_processIncomingUris);
|
||||
}
|
||||
|
||||
if (PlatformInfos.isAndroid) {
|
||||
final shortcuts = FlutterShortcuts();
|
||||
shortcuts.initialize().then(
|
||||
(_) => shortcuts.listenAction((action) {
|
||||
if (!mounted) return;
|
||||
UrlLauncher(context, action).launchUrl();
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -313,7 +313,7 @@ Future<void> _setShortcut(
|
|||
await flutterShortcuts.pushShortcutItem(
|
||||
shortcut: ShortcutItem(
|
||||
id: event.room.id,
|
||||
action: l10n.openChat,
|
||||
action: AppConfig.inviteLinkPrefix + event.room.id,
|
||||
shortLabel: title,
|
||||
conversationShortcut: true,
|
||||
icon: avatarFile == null
|
||||
|
|
Loading…
Reference in a new issue