mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-24 09:26:49 +00:00

* fix: support filtering results by workspace * feat: add search button to sidebar * fix: reduce view/recent view fetching across application * feat: add channel to search listener * feat: clean + localization * chore: remove redundant code * fix: disable search * chore: trigger ci * chore: disable search in backend * test: disable search tests for now * feat: temp disable reliance on folder search * fix: add debounce to inline actions * chore: complete future if disposed * fix: clean code * chore: disable unused bloc with feature flag * fix: recent views lazy read * chore: revert podilfe change * chore: update logs * chore: update client api and collab * chore: fix tst * chore: fix test & update collab commit * chore: update collab commit * test: fix unit tests * chore: update rust toolchain 1.77 * chore: use opt-level 1 * fix: code review * chore: clippy --------- Co-authored-by: nathan <nathan@appflowy.io> Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io>
73 lines
2.3 KiB
Dart
73 lines
2.3 KiB
Dart
import 'dart:convert';
|
|
|
|
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 {
|
|
await push(
|
|
Uri(
|
|
path: view.routeName,
|
|
queryParameters: view.queryParameters(arguments),
|
|
).toString(),
|
|
).then((value) {
|
|
getIt<CachedRecentService>().updateRecentViews([view.id], true);
|
|
});
|
|
}
|
|
}
|
|
|
|
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;
|
|
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,
|
|
};
|
|
default:
|
|
throw UnimplementedError(
|
|
'queryParameters for $this is not implemented',
|
|
);
|
|
}
|
|
}
|
|
}
|