From d4fe957f242d276618d5b64ac8977da41b2aa292 Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Thu, 18 Apr 2024 10:18:26 +0800 Subject: [PATCH] fix: unable to open mentioned page on mobile (#5151) --- .../mention/mention_page_block.dart | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart index fc32143ff9..34d392883f 100644 --- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart +++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart @@ -1,4 +1,5 @@ import 'package:appflowy/generated/flowy_svgs.g.dart'; +import 'package:appflowy/mobile/application/mobile_router.dart'; import 'package:appflowy/plugins/base/emoji/emoji_text.dart'; import 'package:appflowy/plugins/trash/application/trash_service.dart'; import 'package:appflowy/startup/startup.dart'; @@ -7,7 +8,8 @@ import 'package:appflowy/workspace/application/view/prelude.dart'; import 'package:appflowy/workspace/application/view/view_ext.dart'; import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart'; -import 'package:appflowy_editor/appflowy_editor.dart' show EditorState; +import 'package:appflowy_editor/appflowy_editor.dart' + show EditorState, PlatformExtension; import 'package:collection/collection.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/style_widget/hover.dart'; @@ -116,12 +118,18 @@ class _MentionPageBlockState extends State { Log.error('Page($pageId) not found'); return; } - getIt().add( - TabsEvent.openPlugin( - plugin: view.plugin(), - view: view, - ), - ); + if (PlatformExtension.isDesktopOrWeb) { + getIt().add( + TabsEvent.openPlugin( + plugin: view.plugin(), + view: view, + ), + ); + } else { + if (mounted) { + await context.pushView(view); + } + } } Future fetchView(String pageId) async {