2022-11-09 02:28:48 +00:00
|
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
|
2023-01-31 03:22:08 +00:00
|
|
|
import 'models/interaction_type_enum.dart';
|
2023-05-03 20:16:50 +00:00
|
|
|
import 'screens/blocks_screen.dart';
|
2023-11-15 21:05:45 +00:00
|
|
|
import 'screens/circle_add_users_screen.dart';
|
|
|
|
import 'screens/circle_create_screen.dart';
|
|
|
|
import 'screens/circle_editor_screen.dart';
|
|
|
|
import 'screens/circle_management_screen.dart';
|
2022-12-15 03:27:30 +00:00
|
|
|
import 'screens/contacts_screen.dart';
|
2024-07-24 17:08:13 +00:00
|
|
|
import 'screens/disable_focus_mode_screen.dart';
|
2022-11-17 16:04:14 +00:00
|
|
|
import 'screens/editor.dart';
|
2023-05-08 00:10:43 +00:00
|
|
|
import 'screens/filter_editor_screen.dart';
|
2023-05-07 23:07:32 +00:00
|
|
|
import 'screens/filters_screen.dart';
|
2022-12-29 14:33:22 +00:00
|
|
|
import 'screens/follow_request_adjudication_screen.dart';
|
2022-12-14 02:06:10 +00:00
|
|
|
import 'screens/gallery_browsers_screen.dart';
|
|
|
|
import 'screens/gallery_screen.dart';
|
2022-11-09 02:28:48 +00:00
|
|
|
import 'screens/home.dart';
|
2023-05-02 23:27:36 +00:00
|
|
|
import 'screens/image_editor_screen.dart';
|
2023-01-31 03:22:08 +00:00
|
|
|
import 'screens/interactions_viewer_screen.dart';
|
2023-11-27 17:34:21 +00:00
|
|
|
import 'screens/logviewer_screen.dart';
|
2023-01-25 01:53:55 +00:00
|
|
|
import 'screens/message_thread_screen.dart';
|
|
|
|
import 'screens/message_threads_browser_screen.dart';
|
2023-01-25 18:51:53 +00:00
|
|
|
import 'screens/messages_new_thread.dart';
|
2022-11-19 03:49:11 +00:00
|
|
|
import 'screens/notifications_screen.dart';
|
2022-11-23 20:48:09 +00:00
|
|
|
import 'screens/post_screen.dart';
|
2023-03-22 04:16:23 +00:00
|
|
|
import 'screens/search_screen.dart';
|
2023-01-19 18:18:15 +00:00
|
|
|
import 'screens/settings_screen.dart';
|
2022-11-09 02:28:48 +00:00
|
|
|
import 'screens/sign_in.dart';
|
2022-11-10 02:02:26 +00:00
|
|
|
import 'screens/splash.dart';
|
2022-11-29 15:33:16 +00:00
|
|
|
import 'screens/user_posts_screen.dart';
|
|
|
|
import 'screens/user_profile_screen.dart';
|
2022-11-09 02:28:48 +00:00
|
|
|
|
|
|
|
class ScreenPaths {
|
2023-05-03 20:16:50 +00:00
|
|
|
static String blocks = '/blocks';
|
2023-05-07 23:07:32 +00:00
|
|
|
static String filters = '/filters';
|
2023-01-25 01:53:55 +00:00
|
|
|
static String thread = '/thread';
|
2022-12-19 18:59:33 +00:00
|
|
|
static String connectHandle = '/connect';
|
2022-12-15 03:27:30 +00:00
|
|
|
static String contacts = '/contacts';
|
2024-07-24 17:08:13 +00:00
|
|
|
static String focusModeDisable = '/focus_mode_disable';
|
2022-11-09 02:28:48 +00:00
|
|
|
static String splash = '/splash';
|
2023-01-19 18:18:15 +00:00
|
|
|
static String settings = '/settings';
|
2023-01-25 01:53:55 +00:00
|
|
|
static String messages = '/messages';
|
2022-12-08 19:23:11 +00:00
|
|
|
static String timelines = '/';
|
2022-12-14 02:06:10 +00:00
|
|
|
static String gallery = '/gallery';
|
2022-11-19 03:49:11 +00:00
|
|
|
static String notifications = '/notifications';
|
2022-11-09 02:28:48 +00:00
|
|
|
static String signin = '/signin';
|
2023-03-11 04:23:44 +00:00
|
|
|
static String manageProfiles = '/switchProfiles';
|
2023-11-15 21:05:45 +00:00
|
|
|
static String circleManagement = '/circle_management';
|
2022-11-09 02:28:48 +00:00
|
|
|
static String signup = '/signup';
|
2022-11-29 15:33:16 +00:00
|
|
|
static String userProfile = '/user_profile';
|
|
|
|
static String userPosts = '/user_posts';
|
2023-01-31 03:22:08 +00:00
|
|
|
static String likes = '/likes';
|
|
|
|
static String reshares = '/reshares';
|
2023-03-22 04:16:23 +00:00
|
|
|
static String search = '/search';
|
2023-11-27 17:34:21 +00:00
|
|
|
static String logViewer = '/logViewer';
|
2022-11-09 02:28:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool needAuthChangeInitialized = true;
|
2022-11-10 02:02:26 +00:00
|
|
|
final allowedLoggedOut = [
|
|
|
|
ScreenPaths.splash,
|
|
|
|
ScreenPaths.signin,
|
|
|
|
ScreenPaths.signup
|
|
|
|
];
|
|
|
|
|
2024-07-24 15:42:24 +00:00
|
|
|
final routes = [
|
|
|
|
GoRoute(
|
|
|
|
path: ScreenPaths.blocks,
|
|
|
|
name: ScreenPaths.blocks,
|
|
|
|
builder: (context, state) => const BlocksScreen(),
|
|
|
|
),
|
2024-07-24 17:08:13 +00:00
|
|
|
GoRoute(
|
|
|
|
path: ScreenPaths.focusModeDisable,
|
|
|
|
name: ScreenPaths.focusModeDisable,
|
|
|
|
builder: (context, state) => const DisableFocusModeScreen(),
|
|
|
|
),
|
2024-07-24 15:42:24 +00:00
|
|
|
GoRoute(
|
|
|
|
path: ScreenPaths.filters,
|
|
|
|
name: ScreenPaths.filters,
|
|
|
|
builder: (context, state) => const FiltersScreen(),
|
2022-11-09 02:28:48 +00:00
|
|
|
routes: [
|
2023-05-03 01:13:53 +00:00
|
|
|
GoRoute(
|
2024-07-24 15:42:24 +00:00
|
|
|
path: 'new',
|
|
|
|
pageBuilder: (context, state) => const NoTransitionPage(
|
|
|
|
child: FilterEditorScreen(id: ''),
|
2022-12-15 03:27:30 +00:00
|
|
|
),
|
|
|
|
),
|
2022-12-19 18:59:33 +00:00
|
|
|
GoRoute(
|
2024-07-24 15:42:24 +00:00
|
|
|
path: 'edit/:id',
|
|
|
|
pageBuilder: (context, state) => NoTransitionPage(
|
|
|
|
child: FilterEditorScreen(id: state.pathParameters['id']!)),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: ScreenPaths.signin,
|
|
|
|
name: ScreenPaths.signin,
|
|
|
|
builder: (context, state) => const SignInScreen(),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: ScreenPaths.manageProfiles,
|
|
|
|
name: ScreenPaths.manageProfiles,
|
|
|
|
builder: (context, state) => const SignInScreen(),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: ScreenPaths.contacts,
|
|
|
|
name: ScreenPaths.contacts,
|
|
|
|
pageBuilder: (context, state) => NoTransitionPage(
|
|
|
|
name: ScreenPaths.contacts,
|
|
|
|
child: const ContactsScreen(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: '/connect/:id',
|
|
|
|
name: ScreenPaths.connectHandle,
|
|
|
|
builder: (context, state) =>
|
|
|
|
FollowRequestAdjudicationScreen(userId: state.pathParameters['id']!),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: ScreenPaths.timelines,
|
|
|
|
name: ScreenPaths.timelines,
|
|
|
|
pageBuilder: (context, state) => NoTransitionPage(
|
|
|
|
name: ScreenPaths.timelines,
|
|
|
|
child: const HomeScreen(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: ScreenPaths.messages,
|
|
|
|
name: ScreenPaths.messages,
|
|
|
|
pageBuilder: (context, state) => const NoTransitionPage(
|
|
|
|
child: MessagesScreen(),
|
|
|
|
),
|
|
|
|
routes: [
|
2022-11-09 02:28:48 +00:00
|
|
|
GoRoute(
|
2024-07-24 15:42:24 +00:00
|
|
|
path: 'new_thread',
|
2022-11-19 03:49:11 +00:00
|
|
|
pageBuilder: (context, state) => NoTransitionPage(
|
2024-07-24 15:42:24 +00:00
|
|
|
child: MessagesNewThread(),
|
2022-11-19 03:49:11 +00:00
|
|
|
),
|
|
|
|
),
|
2024-07-24 15:42:24 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
name: ScreenPaths.thread,
|
|
|
|
path: ScreenPaths.thread,
|
|
|
|
builder: (context, state) =>
|
|
|
|
MessageThreadScreen(parentThreadId: state.uri.queryParameters['uri']!),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
name: ScreenPaths.circleManagement,
|
|
|
|
path: ScreenPaths.circleManagement,
|
|
|
|
builder: (context, state) => const CircleManagementScreen(),
|
|
|
|
routes: [
|
2023-01-25 01:53:55 +00:00
|
|
|
GoRoute(
|
2024-07-24 15:42:24 +00:00
|
|
|
path: 'show/:id',
|
|
|
|
builder: (context, state) => CircleEditorScreen(
|
|
|
|
circleId: state.pathParameters['id']!,
|
2023-01-25 01:53:55 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
GoRoute(
|
2024-07-24 15:42:24 +00:00
|
|
|
path: 'new',
|
|
|
|
builder: (context, state) => const CircleCreateScreen(),
|
2023-01-25 01:53:55 +00:00
|
|
|
),
|
2023-04-18 23:39:52 +00:00
|
|
|
GoRoute(
|
2024-07-24 15:42:24 +00:00
|
|
|
path: 'add_users/:id',
|
|
|
|
builder: (context, state) =>
|
|
|
|
CircleAddUsersScreen(circleId: state.pathParameters['id']!),
|
2023-04-18 23:39:52 +00:00
|
|
|
),
|
2024-07-24 15:42:24 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: ScreenPaths.settings,
|
|
|
|
name: ScreenPaths.settings,
|
|
|
|
pageBuilder: (context, state) => const NoTransitionPage(
|
|
|
|
child: SettingsScreen(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: ScreenPaths.gallery,
|
|
|
|
name: ScreenPaths.gallery,
|
|
|
|
pageBuilder: (context, state) => const NoTransitionPage(
|
|
|
|
child: GalleryBrowsersScreen(),
|
|
|
|
),
|
|
|
|
routes: [
|
2023-01-19 18:18:15 +00:00
|
|
|
GoRoute(
|
2024-07-24 15:42:24 +00:00
|
|
|
path: 'show',
|
|
|
|
builder: (context, state) => GalleryScreen(
|
|
|
|
galleryName: state.extra!.toString(),
|
2023-01-19 18:18:15 +00:00
|
|
|
),
|
|
|
|
),
|
2022-12-14 02:06:10 +00:00
|
|
|
GoRoute(
|
2024-07-24 15:42:24 +00:00
|
|
|
path: 'edit/:name/image/:id',
|
|
|
|
builder: (context, state) => ImageEditorScreen(
|
|
|
|
galleryName: state.pathParameters['name']!,
|
|
|
|
imageId: state.pathParameters['id']!,
|
2022-12-14 02:06:10 +00:00
|
|
|
),
|
|
|
|
),
|
2024-07-24 15:42:24 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: ScreenPaths.notifications,
|
|
|
|
name: ScreenPaths.notifications,
|
|
|
|
pageBuilder: (context, state) => const NoTransitionPage(
|
|
|
|
child: NotificationsScreen(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: ScreenPaths.splash,
|
|
|
|
name: ScreenPaths.splash,
|
|
|
|
builder: (context, state) => const SplashScreen(),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: '/post',
|
|
|
|
redirect: (context, state) {
|
|
|
|
if (state.uri.toString() == '/post') {
|
|
|
|
return '/post/new';
|
|
|
|
}
|
2022-11-23 02:59:08 +00:00
|
|
|
|
2024-07-24 15:42:24 +00:00
|
|
|
return null;
|
|
|
|
},
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
path: 'new',
|
|
|
|
builder: (context, state) => const EditorScreen(
|
|
|
|
forEditing: false,
|
|
|
|
),
|
2023-01-31 03:22:08 +00:00
|
|
|
),
|
2024-07-24 15:42:24 +00:00
|
|
|
GoRoute(
|
|
|
|
path: 'edit/:id',
|
|
|
|
builder: (context, state) => EditorScreen(
|
|
|
|
id: state.pathParameters['id'] ?? 'Not Found',
|
|
|
|
forEditing: true,
|
|
|
|
),
|
2023-01-31 03:22:08 +00:00
|
|
|
),
|
2024-07-24 15:42:24 +00:00
|
|
|
GoRoute(
|
|
|
|
path: 'view/:id/:goto_id',
|
|
|
|
builder: (context, state) => PostScreen(
|
|
|
|
id: state.pathParameters['id'] ?? 'Not Found',
|
|
|
|
goToId: state.pathParameters['goto_id'] ?? 'Not Found',
|
|
|
|
),
|
2023-03-22 04:16:23 +00:00
|
|
|
),
|
2024-07-24 15:42:24 +00:00
|
|
|
]),
|
|
|
|
GoRoute(
|
|
|
|
path: '/comment',
|
|
|
|
redirect: (context, state) {
|
|
|
|
if (state.uri.toString() == '/comment') {
|
|
|
|
return '/comment/new';
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
},
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
path: 'new',
|
|
|
|
builder: (context, state) => EditorScreen(
|
|
|
|
parentId: state.uri.queryParameters['parent_id'] ?? '',
|
|
|
|
forEditing: false,
|
|
|
|
),
|
2023-11-27 17:34:21 +00:00
|
|
|
),
|
2024-07-24 15:42:24 +00:00
|
|
|
GoRoute(
|
|
|
|
path: 'edit/:id',
|
|
|
|
builder: (context, state) => EditorScreen(
|
|
|
|
id: state.pathParameters['id'] ?? 'Not Found',
|
|
|
|
forEditing: true,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
GoRoute(
|
|
|
|
path: '/user_posts/:id',
|
|
|
|
name: ScreenPaths.userPosts,
|
|
|
|
builder: (context, state) =>
|
|
|
|
UserPostsScreen(userId: state.pathParameters['id']!),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: '/likes/:id',
|
|
|
|
name: ScreenPaths.likes,
|
|
|
|
builder: (context, state) => InteractionsViewerScreen(
|
|
|
|
statusId: state.pathParameters['id']!,
|
|
|
|
type: InteractionType.like,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: '/reshares/:id',
|
|
|
|
name: ScreenPaths.reshares,
|
|
|
|
builder: (context, state) => InteractionsViewerScreen(
|
|
|
|
statusId: state.pathParameters['id']!,
|
|
|
|
type: InteractionType.reshare,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: '/user_profile/:id',
|
|
|
|
name: ScreenPaths.userProfile,
|
|
|
|
builder: (context, state) =>
|
|
|
|
UserProfileScreen(userId: state.pathParameters['id']!),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: ScreenPaths.search,
|
|
|
|
name: ScreenPaths.search,
|
|
|
|
pageBuilder: (context, state) => NoTransitionPage(
|
|
|
|
name: ScreenPaths.search,
|
|
|
|
child: const SearchScreen(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: ScreenPaths.logViewer,
|
|
|
|
name: ScreenPaths.logViewer,
|
|
|
|
pageBuilder: (context, state) => const NoTransitionPage(
|
|
|
|
child: LogViewerScreen(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
];
|