mirror of
				https://github.com/AppFlowy-IO/AppFlowy.git
				synced 2025-10-31 01:54:37 +00:00 
			
		
		
		
	 aec7bc847e
			
		
	
	
		aec7bc847e
		
			
		
	
	
	
	
		
			
			* chore: ai type * chore: use patch to fix version issue * chore: update * chore: update * chore: integrate client api * chore: add schema * chore: setup event * chore: add event test * chore: add test * chore: update test * chore: load chat message * chore: load chat message * chore: chat ui * chore: disable create chat * chore: update client api * chore: disable chat * chore: ui theme * chore: ui theme * chore: copy message * chore: fix test * chore: show error * chore: update bloc * chore: update test * chore: lint * chore: icon * chore: hover * chore: show unsupported page * chore: adjust mobile ui * chore: adjust view title bar * chore: return related question * chore: error page * chore: error page * chore: code format * chore: prompt * chore: fix test * chore: ui adjust * chore: disable create chat * chore: add loading page * chore: fix test * chore: disable chat action * chore: add maximum text limit
		
			
				
	
	
		
			85 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			85 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'dart:async';
 | |
| import 'dart:convert';
 | |
| 
 | |
| import 'package:appflowy/mobile/presentation/chat/mobile_chat_screen.dart';
 | |
| import 'package:appflowy/workspace/presentation/home/menu/menu_shared_state.dart';
 | |
| import 'package:flutter/material.dart';
 | |
| 
 | |
| import 'package:appflowy/mobile/presentation/database/board/mobile_board_screen.dart';
 | |
| import 'package:appflowy/mobile/presentation/database/mobile_calendar_screen.dart';
 | |
| import 'package:appflowy/mobile/presentation/database/mobile_grid_screen.dart';
 | |
| import 'package:appflowy/mobile/presentation/presentation.dart';
 | |
| import 'package:appflowy/startup/startup.dart';
 | |
| import 'package:appflowy/workspace/application/recent/cached_recent_service.dart';
 | |
| import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
 | |
| import 'package:go_router/go_router.dart';
 | |
| 
 | |
| extension MobileRouter on BuildContext {
 | |
|   Future<void> pushView(ViewPB view, [Map<String, dynamic>? arguments]) async {
 | |
|     // set the current view before pushing the new view
 | |
|     getIt<MenuSharedState>().latestOpenView = view;
 | |
|     unawaited(getIt<CachedRecentService>().updateRecentViews([view.id], true));
 | |
| 
 | |
|     final uri = Uri(
 | |
|       path: view.routeName,
 | |
|       queryParameters: view.queryParameters(arguments),
 | |
|     ).toString();
 | |
|     await push(uri);
 | |
|   }
 | |
| }
 | |
| 
 | |
| extension on ViewPB {
 | |
|   String get routeName {
 | |
|     switch (layout) {
 | |
|       case ViewLayoutPB.Document:
 | |
|         return MobileDocumentScreen.routeName;
 | |
|       case ViewLayoutPB.Grid:
 | |
|         return MobileGridScreen.routeName;
 | |
|       case ViewLayoutPB.Calendar:
 | |
|         return MobileCalendarScreen.routeName;
 | |
|       case ViewLayoutPB.Board:
 | |
|         return MobileBoardScreen.routeName;
 | |
|       case ViewLayoutPB.Chat:
 | |
|         return MobileChatScreen.routeName;
 | |
| 
 | |
|       default:
 | |
|         throw UnimplementedError('routeName for $this is not implemented');
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   Map<String, dynamic> queryParameters([Map<String, dynamic>? arguments]) {
 | |
|     switch (layout) {
 | |
|       case ViewLayoutPB.Document:
 | |
|         return {
 | |
|           MobileDocumentScreen.viewId: id,
 | |
|           MobileDocumentScreen.viewTitle: name,
 | |
|         };
 | |
|       case ViewLayoutPB.Grid:
 | |
|         return {
 | |
|           MobileGridScreen.viewId: id,
 | |
|           MobileGridScreen.viewTitle: name,
 | |
|           MobileGridScreen.viewArgs: jsonEncode(arguments),
 | |
|         };
 | |
|       case ViewLayoutPB.Calendar:
 | |
|         return {
 | |
|           MobileCalendarScreen.viewId: id,
 | |
|           MobileCalendarScreen.viewTitle: name,
 | |
|         };
 | |
|       case ViewLayoutPB.Board:
 | |
|         return {
 | |
|           MobileBoardScreen.viewId: id,
 | |
|           MobileBoardScreen.viewTitle: name,
 | |
|         };
 | |
|       case ViewLayoutPB.Chat:
 | |
|         return {
 | |
|           MobileChatScreen.viewId: id,
 | |
|           MobileChatScreen.viewTitle: name,
 | |
|         };
 | |
|       default:
 | |
|         throw UnimplementedError(
 | |
|           'queryParameters for $this is not implemented',
 | |
|         );
 | |
|     }
 | |
|   }
 | |
| }
 |