|
|
@ -1,7 +1,8 @@
|
|
|
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import 'package:matrix/matrix.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:fluffychat/config/themes.dart';
|
|
|
|
import 'package:fluffychat/config/themes.dart';
|
|
|
|
import 'package:fluffychat/pages/add_story/add_story.dart';
|
|
|
|
import 'package:fluffychat/pages/add_story/add_story.dart';
|
|
|
@ -33,235 +34,236 @@ import 'package:fluffychat/widgets/layouts/empty_page.dart';
|
|
|
|
import 'package:fluffychat/widgets/layouts/side_view_layout.dart';
|
|
|
|
import 'package:fluffychat/widgets/layouts/side_view_layout.dart';
|
|
|
|
import 'package:fluffychat/widgets/layouts/two_column_layout.dart';
|
|
|
|
import 'package:fluffychat/widgets/layouts/two_column_layout.dart';
|
|
|
|
import 'package:fluffychat/widgets/log_view.dart';
|
|
|
|
import 'package:fluffychat/widgets/log_view.dart';
|
|
|
|
|
|
|
|
import 'package:fluffychat/widgets/matrix.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class AppRoutes {
|
|
|
|
abstract class AppRoutes {
|
|
|
|
final List<Client> clients;
|
|
|
|
static FutureOr<String?> loggedInRedirect(
|
|
|
|
|
|
|
|
BuildContext context,
|
|
|
|
|
|
|
|
GoRouterState state,
|
|
|
|
|
|
|
|
) =>
|
|
|
|
|
|
|
|
Matrix.of(context).client.isLogged() ? '/rooms' : null;
|
|
|
|
|
|
|
|
|
|
|
|
bool get isLoggedIn => clients.any((client) => client.isLogged());
|
|
|
|
static FutureOr<String?> loggedOutRedirect(
|
|
|
|
|
|
|
|
BuildContext context,
|
|
|
|
|
|
|
|
GoRouterState state,
|
|
|
|
|
|
|
|
) =>
|
|
|
|
|
|
|
|
Matrix.of(context).client.isLogged() ? null : '/home';
|
|
|
|
|
|
|
|
|
|
|
|
AppRoutes(this.clients);
|
|
|
|
AppRoutes();
|
|
|
|
|
|
|
|
|
|
|
|
List<RouteBase> get routes => [
|
|
|
|
static final List<RouteBase> routes = [
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: '/',
|
|
|
|
|
|
|
|
redirect: (context, state) =>
|
|
|
|
|
|
|
|
Matrix.of(context).client.isLogged() ? '/rooms' : '/home',
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: '/home',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const HomeserverPicker(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: loggedInRedirect,
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: '/',
|
|
|
|
path: 'login',
|
|
|
|
redirect: (context, state) => isLoggedIn ? '/rooms' : '/home',
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const Login(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: loggedInRedirect,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: '/logs',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const LogViewer(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
ShellRoute(
|
|
|
|
|
|
|
|
pageBuilder: (context, state, child) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
FluffyThemes.isColumnMode(context) &&
|
|
|
|
|
|
|
|
state.fullPath?.startsWith('/rooms/settings') == false
|
|
|
|
|
|
|
|
? TwoColumnLayout(
|
|
|
|
|
|
|
|
displayNavigationRail:
|
|
|
|
|
|
|
|
state.path?.startsWith('/rooms/settings') != true,
|
|
|
|
|
|
|
|
mainView: ChatList(
|
|
|
|
|
|
|
|
activeChat: state.pathParameters['roomid'],
|
|
|
|
|
|
|
|
displayNavigationRail:
|
|
|
|
|
|
|
|
state.path?.startsWith('/rooms/settings') != true,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
sideView: child,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
: child,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: '/home',
|
|
|
|
path: '/rooms',
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
const HomeserverPicker(),
|
|
|
|
FluffyThemes.isColumnMode(context)
|
|
|
|
|
|
|
|
? const EmptyPage()
|
|
|
|
|
|
|
|
: ChatList(
|
|
|
|
|
|
|
|
activeChat: state.pathParameters['roomid'],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
redirect: (context, state) => isLoggedIn ? '/rooms' : null,
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: 'login',
|
|
|
|
path: 'stories/create',
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
const Login(),
|
|
|
|
const AddStoryPage(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
redirect: (context, state) => isLoggedIn ? '/rooms' : null,
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: '/logs',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const LogViewer(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
ShellRoute(
|
|
|
|
|
|
|
|
pageBuilder: (context, state, child) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
FluffyThemes.isColumnMode(context) &&
|
|
|
|
|
|
|
|
state.fullPath?.startsWith('/rooms/settings') == false
|
|
|
|
|
|
|
|
? TwoColumnLayout(
|
|
|
|
|
|
|
|
displayNavigationRail:
|
|
|
|
|
|
|
|
state.path?.startsWith('/rooms/settings') != true,
|
|
|
|
|
|
|
|
mainView: ChatList(
|
|
|
|
|
|
|
|
activeChat: state.pathParameters['roomid'],
|
|
|
|
|
|
|
|
displayNavigationRail:
|
|
|
|
|
|
|
|
state.path?.startsWith('/rooms/settings') != true,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
sideView: child,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
: child,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: '/rooms',
|
|
|
|
path: 'stories/:roomid',
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
FluffyThemes.isColumnMode(context)
|
|
|
|
const StoryPage(),
|
|
|
|
? const EmptyPage()
|
|
|
|
|
|
|
|
: ChatList(
|
|
|
|
|
|
|
|
activeChat: state.pathParameters['roomid'],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
routes: [
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: 'stories/create',
|
|
|
|
path: 'share',
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
const AddStoryPage(),
|
|
|
|
const AddStoryPage(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
],
|
|
|
|
path: 'stories/:roomid',
|
|
|
|
),
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
GoRoute(
|
|
|
|
context,
|
|
|
|
path: 'spaces/:roomid',
|
|
|
|
const StoryPage(),
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
),
|
|
|
|
context,
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
ChatDetails(
|
|
|
|
routes: [
|
|
|
|
roomId: state.pathParameters['roomid']!,
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'share',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const AddStoryPage(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: (context, state) =>
|
|
|
|
|
|
|
|
!isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
routes: _chatDetailsRoutes,
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'archive',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const Archive(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: 'spaces/:roomid',
|
|
|
|
path: ':roomid',
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
ChatDetails(
|
|
|
|
ChatPage(
|
|
|
|
roomId: state.pathParameters['roomid']!,
|
|
|
|
roomId: state.pathParameters['roomid']!,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
routes: _chatDetailsRoutes,
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'archive',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const Archive(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: ':roomid',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
ChatPage(
|
|
|
|
|
|
|
|
roomId: state.pathParameters['roomid']!,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: (context, state) =>
|
|
|
|
|
|
|
|
!isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'newprivatechat',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const NewPrivateChat(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'newgroup',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const NewGroup(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'newspace',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const NewSpace(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
ShellRoute(
|
|
|
|
|
|
|
|
pageBuilder: (context, state, child) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
FluffyThemes.isColumnMode(context)
|
|
|
|
|
|
|
|
? TwoColumnLayout(
|
|
|
|
|
|
|
|
mainView: const Settings(),
|
|
|
|
|
|
|
|
sideView: child,
|
|
|
|
|
|
|
|
displayNavigationRail: false,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
: child,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: 'newprivatechat',
|
|
|
|
path: 'settings',
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
const NewPrivateChat(),
|
|
|
|
FluffyThemes.isColumnMode(context)
|
|
|
|
|
|
|
|
? const EmptyPage()
|
|
|
|
|
|
|
|
: const Settings(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
routes: _settingsRoutes,
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
],
|
|
|
|
path: 'newgroup',
|
|
|
|
),
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
ShellRoute(
|
|
|
|
context,
|
|
|
|
pageBuilder: (context, state, child) => defaultPageBuilder(
|
|
|
|
const NewGroup(),
|
|
|
|
context,
|
|
|
|
|
|
|
|
SideViewLayout(
|
|
|
|
|
|
|
|
mainView: ChatPage(
|
|
|
|
|
|
|
|
roomId: state.pathParameters['roomid']!,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
sideView: child,
|
|
|
|
|
|
|
|
hideSideView: state.fullPath == '/rooms/:roomid',
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: 'newspace',
|
|
|
|
path: ':roomid',
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
const NewSpace(),
|
|
|
|
const SizedBox.shrink(),
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
ShellRoute(
|
|
|
|
|
|
|
|
pageBuilder: (context, state, child) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
FluffyThemes.isColumnMode(context)
|
|
|
|
|
|
|
|
? TwoColumnLayout(
|
|
|
|
|
|
|
|
mainView: const Settings(),
|
|
|
|
|
|
|
|
sideView: child,
|
|
|
|
|
|
|
|
displayNavigationRail: false,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
: child,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
routes: [
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: 'settings',
|
|
|
|
path: 'encryption',
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
FluffyThemes.isColumnMode(context)
|
|
|
|
const ChatEncryptionSettings(),
|
|
|
|
? const EmptyPage()
|
|
|
|
|
|
|
|
: const Settings(),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
routes: _settingsRoutes,
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
redirect: (context, state) =>
|
|
|
|
|
|
|
|
!isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
GoRoute(
|
|
|
|
),
|
|
|
|
path: 'invite',
|
|
|
|
ShellRoute(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state, child) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
const InvitationSelection(),
|
|
|
|
SideViewLayout(
|
|
|
|
|
|
|
|
mainView: ChatPage(
|
|
|
|
|
|
|
|
roomId: state.pathParameters['roomid']!,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
sideView:
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
state.fullPath == '/rooms/:roomid' ? null : child,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: ':roomid',
|
|
|
|
path: 'details',
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
const EmptyPage(),
|
|
|
|
ChatDetails(
|
|
|
|
),
|
|
|
|
roomId: state.pathParameters['roomid']!,
|
|
|
|
redirect: (context, state) =>
|
|
|
|
|
|
|
|
!isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'encryption',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const ChatEncryptionSettings(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: (context, state) =>
|
|
|
|
|
|
|
|
!isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'invite',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const InvitationSelection(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: (context, state) =>
|
|
|
|
|
|
|
|
!isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'details',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
ChatDetails(
|
|
|
|
|
|
|
|
roomId: state.pathParameters['roomid']!,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
routes: _chatDetailsRoutes,
|
|
|
|
|
|
|
|
redirect: (context, state) =>
|
|
|
|
|
|
|
|
!isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
|
|
|
|
routes: _chatDetailsRoutes,
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -269,148 +271,150 @@ class AppRoutes {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
];
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
List<RouteBase> get _chatDetailsRoutes => [
|
|
|
|
static final List<RouteBase> _chatDetailsRoutes = [
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: 'permissions',
|
|
|
|
path: 'permissions',
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
const ChatPermissionsSettings(),
|
|
|
|
const ChatPermissionsSettings(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: 'invite',
|
|
|
|
path: 'invite',
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
const InvitationSelection(),
|
|
|
|
const InvitationSelection(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: 'multiple_emotes',
|
|
|
|
path: 'multiple_emotes',
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
const MultipleEmotesSettings(),
|
|
|
|
const MultipleEmotesSettings(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'emotes',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const EmotesSettings(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'emotes/:state_key',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const EmotesSettings(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static final List<RouteBase> _settingsRoutes = [
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'notifications',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const SettingsNotifications(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'style',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const SettingsStyle(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'devices',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const DevicesSettings(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'chat',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const SettingsChat(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: 'emotes',
|
|
|
|
path: 'emotes',
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
const EmotesSettings(),
|
|
|
|
const EmotesSettings(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'emotes/:state_key',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const EmotesSettings(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<RouteBase> get _settingsRoutes => [
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'notifications',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const SettingsNotifications(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'addaccount',
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const HomeserverPicker(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: 'style',
|
|
|
|
path: 'login',
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
const SettingsStyle(),
|
|
|
|
const Login(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'security',
|
|
|
|
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const SettingsSecurity(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: 'devices',
|
|
|
|
path: 'stories',
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
const DevicesSettings(),
|
|
|
|
const SettingsStories(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: 'chat',
|
|
|
|
path: 'ignorelist',
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
const SettingsChat(),
|
|
|
|
const SettingsIgnoreList(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
routes: [
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'emotes',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const EmotesSettings(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'addaccount',
|
|
|
|
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const HomeserverPicker(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
routes: [
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'login',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const Login(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
GoRoute(
|
|
|
|
path: 'security',
|
|
|
|
path: '3pid',
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
const SettingsSecurity(),
|
|
|
|
const Settings3Pid(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
routes: [
|
|
|
|
redirect: loggedOutRedirect,
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'stories',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const SettingsStories(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: 'ignorelist',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const SettingsIgnoreList(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
GoRoute(
|
|
|
|
|
|
|
|
path: '3pid',
|
|
|
|
|
|
|
|
pageBuilder: (context, state) => defaultPageBuilder(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
const Settings3Pid(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
redirect: (context, state) => !isLoggedIn ? '/home' : null,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
];
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
Page defaultPageBuilder(BuildContext context, Widget child) =>
|
|
|
|
static Page defaultPageBuilder(BuildContext context, Widget child) =>
|
|
|
|
CustomTransitionPage(
|
|
|
|
CustomTransitionPage(
|
|
|
|
child: child,
|
|
|
|
child: child,
|
|
|
|
transitionsBuilder: (context, animation, secondaryAnimation, child) =>
|
|
|
|
transitionsBuilder: (context, animation, secondaryAnimation, child) =>
|
|
|
|