1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 04:49:21 +00:00

Rename HomeRoute => MainRoute

This commit is contained in:
Pierre HUBERT 2020-04-17 15:26:37 +02:00
parent 7549a9ff22
commit 9021ca7168
12 changed files with 36 additions and 36 deletions

View File

@ -1,6 +1,6 @@
import 'package:comunic/helpers/conversations_helper.dart';
import 'package:comunic/models/conversation.dart';
import 'package:comunic/ui/routes/home_route.dart';
import 'package:comunic/ui/routes/main_route.dart';
import 'package:comunic/ui/routes/update_conversation_route.dart';
import 'package:comunic/ui/screens/conversation_screen.dart';
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
@ -59,7 +59,7 @@ class _ConversationRouteState extends State<ConversationRoute> {
}
void _openSettings() {
HomeController.of(context).push(
MainController.of(context).push(
UpdateConversationRoute(
conversationID: widget.conversationID,
),

View File

@ -24,9 +24,9 @@ import 'login_route.dart';
///
/// @author Pierre HUBERT
class HomeRoute extends StatefulWidget {
class MainRoute extends StatefulWidget {
@override
State<StatefulWidget> createState() => _HomeRouteState();
State<StatefulWidget> createState() => _MainRouteState();
}
class CurrPage {
@ -51,10 +51,10 @@ class CurrPage {
}
/// Public interface of home controller
abstract class HomeController extends State<HomeRoute> {
abstract class MainController extends State<MainRoute> {
/// Get current instance of Home controller
static HomeController of(BuildContext context) =>
context.findAncestorStateOfType<HomeController>();
static MainController of(BuildContext context) =>
context.findAncestorStateOfType<MainController>();
/// Open user page
void openUserPage(int userID);
@ -78,7 +78,7 @@ abstract class HomeController extends State<HomeRoute> {
}
/// Private implementation of HomeController
class _HomeRouteState extends HomeController {
class _MainRouteState extends MainController {
CurrPage get _currTab => history.last;
List<CurrPage> history = List();

View File

@ -3,7 +3,7 @@ import 'package:comunic/helpers/conversations_helper.dart';
import 'package:comunic/helpers/users_helper.dart';
import 'package:comunic/lists/conversations_list.dart';
import 'package:comunic/models/conversation.dart';
import 'package:comunic/ui/routes/home_route.dart';
import 'package:comunic/ui/routes/main_route.dart';
import 'package:comunic/ui/routes/update_conversation_route.dart';
import 'package:comunic/ui/screens/create_conversation_screen.dart';
import 'package:comunic/ui/tiles/conversation_tile.dart';
@ -95,17 +95,17 @@ class _ConversationScreenState extends State<ConversationsListScreen> {
/// Open a conversation
void _openConversation(int conversationId) {
HomeController.of(context).openConversation(conversationId);
MainController.of(context).openConversation(conversationId);
}
/// Create a new conversation
void _createConversation() {
HomeController.of(context).push(CreateConversationScreen());
MainController.of(context).push(CreateConversationScreen());
}
/// Handle conversations updated requests
void _updateConversation(Conversation conversation) {
HomeController.of(context).push(
MainController.of(context).push(
UpdateConversationRoute(
conversationID: conversation.id,
),

View File

@ -1,7 +1,7 @@
import 'package:comunic/helpers/groups_helper.dart';
import 'package:comunic/lists/groups_list.dart';
import 'package:comunic/models/group.dart';
import 'package:comunic/ui/routes/home_route.dart';
import 'package:comunic/ui/routes/main_route.dart';
import 'package:comunic/ui/widgets/group_icon_widget.dart';
import 'package:comunic/ui/widgets/group_membership_widget.dart';
import 'package:comunic/ui/widgets/safe_state.dart';
@ -67,7 +67,7 @@ class _GroupsListScreenState extends SafeState<GroupsListScreen> {
trailing: IconButton(
icon: Icon(Icons.delete),
onPressed: () => _deleteGroup(g)),
onTap: () => HomeController.of(context).openGroup(g.id),
onTap: () => MainController.of(context).openGroup(g.id),
))
.toList(),
),

View File

@ -5,7 +5,7 @@ import 'package:comunic/lists/groups_list.dart';
import 'package:comunic/lists/notifications_list.dart';
import 'package:comunic/lists/users_list.dart';
import 'package:comunic/models/notification.dart' as n;
import 'package:comunic/ui/routes/home_route.dart';
import 'package:comunic/ui/routes/main_route.dart';
import 'package:comunic/ui/widgets/account_image_widget.dart';
import 'package:comunic/utils/date_utils.dart';
import 'package:comunic/utils/intl_utils.dart';
@ -309,7 +309,7 @@ class _NotificationTile extends StatelessWidget {
openUserPage(userID: notification.fromUser, context: context);
} else if (notification.onElemType ==
n.NotificationElementType.GROUP_MEMBERSHIP) {
HomeController.of(context).openGroup(notification.onElemId);
MainController.of(context).openGroup(notification.onElemId);
} else {
showSimpleSnack(context,
tr("This kind of notification is not supported yet by this application."));

View File

@ -7,7 +7,7 @@ import 'package:comunic/lists/users_list.dart';
import 'package:comunic/models/group.dart';
import 'package:comunic/models/search_result.dart';
import 'package:comunic/models/user.dart';
import 'package:comunic/ui/routes/home_route.dart';
import 'package:comunic/ui/routes/main_route.dart';
import 'package:comunic/ui/widgets/account_image_widget.dart';
import 'package:comunic/ui/widgets/group_icon_widget.dart';
import 'package:comunic/utils/intl_utils.dart';
@ -97,7 +97,7 @@ class _SearchResultUser extends StatelessWidget {
user: user,
),
title: Text(user.displayName),
onTap: () => HomeController.of(context).openUserPage(user.id),
onTap: () => MainController.of(context).openUserPage(user.id),
);
}
}
@ -115,7 +115,7 @@ class _SearchResultGroup extends StatelessWidget {
leading: GroupIcon(group: group),
title: Text(group.displayName),
subtitle: Text(tr("Group")),
onTap: () => HomeController.of(context).openGroup(group.id),
onTap: () => MainController.of(context).openGroup(group.id),
);
}
}

View File

@ -1,7 +1,7 @@
import 'package:comunic/helpers/conversations_helper.dart';
import 'package:comunic/lists/users_list.dart';
import 'package:comunic/models/conversation.dart';
import 'package:comunic/ui/routes/home_route.dart';
import 'package:comunic/ui/routes/main_route.dart';
import 'package:comunic/ui/tiles/simple_user_tile.dart';
import 'package:comunic/ui/widgets/pick_user_widget.dart';
import 'package:comunic/utils/intl_utils.dart';
@ -174,8 +174,8 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
// Open the conversation
HomeController.of(context).popPage();
MainController.of(context).popPage();
if (!isUpdating)
HomeController.of(context).openConversation(conversationID);
MainController.of(context).openConversation(conversationID);
}
}

View File

@ -2,7 +2,7 @@ import 'package:comunic/helpers/friends_helper.dart';
import 'package:comunic/helpers/users_helper.dart';
import 'package:comunic/models/friend_status.dart';
import 'package:comunic/models/user.dart';
import 'package:comunic/ui/routes/home_route.dart';
import 'package:comunic/ui/routes/main_route.dart';
import 'package:comunic/ui/widgets/FrienshipStatusWidget.dart';
import 'package:comunic/ui/widgets/account_image_widget.dart';
import 'package:comunic/utils/intl_utils.dart';
@ -50,7 +50,7 @@ class _UserAccessDeniedScreenState extends State<UserAccessDeniedScreen> {
// Check if the two users are friend now
if (status.areFriend) {
final controller = HomeController.of(context);
final controller = MainController.of(context);
controller.popPage();
controller.openUserPage(widget.userID);
}

View File

@ -2,7 +2,7 @@ import 'package:comunic/enums/post_target.dart';
import 'package:comunic/helpers/posts_helper.dart';
import 'package:comunic/helpers/users_helper.dart';
import 'package:comunic/models/advanced_user_info.dart';
import 'package:comunic/ui/routes/home_route.dart';
import 'package:comunic/ui/routes/main_route.dart';
import 'package:comunic/ui/widgets/account_image_widget.dart';
import 'package:comunic/ui/widgets/post_create_form_widget.dart';
import 'package:comunic/ui/widgets/posts_list_widget.dart';
@ -76,7 +76,7 @@ class _UserPageScreenState extends State<UserPageScreen> {
_setStatus(_PageStatus.ERROR);
if (e.cause == GetUserAdvancedInformationErrorCause.NOT_AUTHORIZED) {
final controller = HomeController.of(context);
final controller = MainController.of(context);
controller.popPage();
controller.openUserAccessDeniedPage(widget.userID);
}
@ -184,7 +184,7 @@ class _UserPageScreenState extends State<UserPageScreen> {
void _selectedMenuOption(_MenuOptions value) {
switch (value) {
case _MenuOptions.FRIENDS_LIST:
HomeController.of(context).openUserFriendsList(_userInfo.id);
MainController.of(context).openUserFriendsList(_userInfo.id);
break;
}
}

View File

@ -1,5 +1,5 @@
import 'package:comunic/helpers/websocket_helper.dart';
import 'package:comunic/ui/routes/home_route.dart';
import 'package:comunic/ui/routes/main_route.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:flutter/material.dart';
@ -49,7 +49,7 @@ class _InitializeWidgetState extends State<InitializeWidget> {
@override
Widget build(BuildContext context) {
return WebSocketHelper.isConnected() ? HomeRoute() : _buildNonReadyWidget();
return WebSocketHelper.isConnected() ? MainRoute() : _buildNonReadyWidget();
}
/// Build loading widget

View File

@ -1,5 +1,5 @@
import 'package:comunic/helpers/conversations_helper.dart';
import 'package:comunic/ui/routes/home_route.dart';
import 'package:comunic/ui/routes/main_route.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart';
@ -18,7 +18,7 @@ Future<bool> openPrivateConversation(BuildContext context, int userID) async {
}
// Open the conversation
HomeController.of(context).openConversation(convID);
MainController.of(context).openConversation(convID);
// Success
return true;

View File

@ -1,5 +1,5 @@
import 'package:comunic/helpers/virtual_directory_helper.dart';
import 'package:comunic/ui/routes/home_route.dart';
import 'package:comunic/ui/routes/main_route.dart';
import 'package:comunic/ui/routes/single_post_route.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart';
@ -12,7 +12,7 @@ import 'package:meta/meta.dart';
/// Pop a page
void popPage(BuildContext context) {
HomeController.of(context).popPage();
MainController.of(context).popPage();
}
/// Open the page of a user
@ -20,12 +20,12 @@ void openUserPage({@required int userID, @required BuildContext context}) {
assert(userID != null);
assert(context != null);
HomeController.of(context).openUserPage(userID);
MainController.of(context).openUserPage(userID);
}
/// Open a post in full screen
void openPostFullScreen(int postID, BuildContext context) {
HomeController.of(context).push(SinglePostRoute(postID: postID));
MainController.of(context).push(SinglePostRoute(postID: postID));
}
/// Open a virtual directory
@ -41,7 +41,7 @@ void openVirtualDirectory(BuildContext context, String directory) async {
break;
case VirtualDirectoryType.GROUP:
HomeController.of(context).openGroup(result.id);
MainController.of(context).openGroup(result.id);
break;
case VirtualDirectoryType.NONE: