1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-25 22:39:22 +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/helpers/conversations_helper.dart';
import 'package:comunic/models/conversation.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/routes/update_conversation_route.dart';
import 'package:comunic/ui/screens/conversation_screen.dart'; import 'package:comunic/ui/screens/conversation_screen.dart';
import 'package:comunic/ui/widgets/comunic_back_button_widget.dart'; import 'package:comunic/ui/widgets/comunic_back_button_widget.dart';
@ -59,7 +59,7 @@ class _ConversationRouteState extends State<ConversationRoute> {
} }
void _openSettings() { void _openSettings() {
HomeController.of(context).push( MainController.of(context).push(
UpdateConversationRoute( UpdateConversationRoute(
conversationID: widget.conversationID, conversationID: widget.conversationID,
), ),

View File

@ -24,9 +24,9 @@ import 'login_route.dart';
/// ///
/// @author Pierre HUBERT /// @author Pierre HUBERT
class HomeRoute extends StatefulWidget { class MainRoute extends StatefulWidget {
@override @override
State<StatefulWidget> createState() => _HomeRouteState(); State<StatefulWidget> createState() => _MainRouteState();
} }
class CurrPage { class CurrPage {
@ -51,10 +51,10 @@ class CurrPage {
} }
/// Public interface of home controller /// Public interface of home controller
abstract class HomeController extends State<HomeRoute> { abstract class MainController extends State<MainRoute> {
/// Get current instance of Home controller /// Get current instance of Home controller
static HomeController of(BuildContext context) => static MainController of(BuildContext context) =>
context.findAncestorStateOfType<HomeController>(); context.findAncestorStateOfType<MainController>();
/// Open user page /// Open user page
void openUserPage(int userID); void openUserPage(int userID);
@ -78,7 +78,7 @@ abstract class HomeController extends State<HomeRoute> {
} }
/// Private implementation of HomeController /// Private implementation of HomeController
class _HomeRouteState extends HomeController { class _MainRouteState extends MainController {
CurrPage get _currTab => history.last; CurrPage get _currTab => history.last;
List<CurrPage> history = List(); 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/helpers/users_helper.dart';
import 'package:comunic/lists/conversations_list.dart'; import 'package:comunic/lists/conversations_list.dart';
import 'package:comunic/models/conversation.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/routes/update_conversation_route.dart';
import 'package:comunic/ui/screens/create_conversation_screen.dart'; import 'package:comunic/ui/screens/create_conversation_screen.dart';
import 'package:comunic/ui/tiles/conversation_tile.dart'; import 'package:comunic/ui/tiles/conversation_tile.dart';
@ -95,17 +95,17 @@ class _ConversationScreenState extends State<ConversationsListScreen> {
/// Open a conversation /// Open a conversation
void _openConversation(int conversationId) { void _openConversation(int conversationId) {
HomeController.of(context).openConversation(conversationId); MainController.of(context).openConversation(conversationId);
} }
/// Create a new conversation /// Create a new conversation
void _createConversation() { void _createConversation() {
HomeController.of(context).push(CreateConversationScreen()); MainController.of(context).push(CreateConversationScreen());
} }
/// Handle conversations updated requests /// Handle conversations updated requests
void _updateConversation(Conversation conversation) { void _updateConversation(Conversation conversation) {
HomeController.of(context).push( MainController.of(context).push(
UpdateConversationRoute( UpdateConversationRoute(
conversationID: conversation.id, conversationID: conversation.id,
), ),

View File

@ -1,7 +1,7 @@
import 'package:comunic/helpers/groups_helper.dart'; import 'package:comunic/helpers/groups_helper.dart';
import 'package:comunic/lists/groups_list.dart'; import 'package:comunic/lists/groups_list.dart';
import 'package:comunic/models/group.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_icon_widget.dart';
import 'package:comunic/ui/widgets/group_membership_widget.dart'; import 'package:comunic/ui/widgets/group_membership_widget.dart';
import 'package:comunic/ui/widgets/safe_state.dart'; import 'package:comunic/ui/widgets/safe_state.dart';
@ -67,7 +67,7 @@ class _GroupsListScreenState extends SafeState<GroupsListScreen> {
trailing: IconButton( trailing: IconButton(
icon: Icon(Icons.delete), icon: Icon(Icons.delete),
onPressed: () => _deleteGroup(g)), onPressed: () => _deleteGroup(g)),
onTap: () => HomeController.of(context).openGroup(g.id), onTap: () => MainController.of(context).openGroup(g.id),
)) ))
.toList(), .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/notifications_list.dart';
import 'package:comunic/lists/users_list.dart'; import 'package:comunic/lists/users_list.dart';
import 'package:comunic/models/notification.dart' as n; 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/ui/widgets/account_image_widget.dart';
import 'package:comunic/utils/date_utils.dart'; import 'package:comunic/utils/date_utils.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
@ -309,7 +309,7 @@ class _NotificationTile extends StatelessWidget {
openUserPage(userID: notification.fromUser, context: context); openUserPage(userID: notification.fromUser, context: context);
} else if (notification.onElemType == } else if (notification.onElemType ==
n.NotificationElementType.GROUP_MEMBERSHIP) { n.NotificationElementType.GROUP_MEMBERSHIP) {
HomeController.of(context).openGroup(notification.onElemId); MainController.of(context).openGroup(notification.onElemId);
} else { } else {
showSimpleSnack(context, showSimpleSnack(context,
tr("This kind of notification is not supported yet by this application.")); 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/group.dart';
import 'package:comunic/models/search_result.dart'; import 'package:comunic/models/search_result.dart';
import 'package:comunic/models/user.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/account_image_widget.dart';
import 'package:comunic/ui/widgets/group_icon_widget.dart'; import 'package:comunic/ui/widgets/group_icon_widget.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
@ -97,7 +97,7 @@ class _SearchResultUser extends StatelessWidget {
user: user, user: user,
), ),
title: Text(user.displayName), 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), leading: GroupIcon(group: group),
title: Text(group.displayName), title: Text(group.displayName),
subtitle: Text(tr("Group")), 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/helpers/conversations_helper.dart';
import 'package:comunic/lists/users_list.dart'; import 'package:comunic/lists/users_list.dart';
import 'package:comunic/models/conversation.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/tiles/simple_user_tile.dart';
import 'package:comunic/ui/widgets/pick_user_widget.dart'; import 'package:comunic/ui/widgets/pick_user_widget.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
@ -174,8 +174,8 @@ class _UpdateConversationScreen extends State<UpdateConversationScreen> {
// Open the conversation // Open the conversation
HomeController.of(context).popPage(); MainController.of(context).popPage();
if (!isUpdating) 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/helpers/users_helper.dart';
import 'package:comunic/models/friend_status.dart'; import 'package:comunic/models/friend_status.dart';
import 'package:comunic/models/user.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/FrienshipStatusWidget.dart';
import 'package:comunic/ui/widgets/account_image_widget.dart'; import 'package:comunic/ui/widgets/account_image_widget.dart';
import 'package:comunic/utils/intl_utils.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 // Check if the two users are friend now
if (status.areFriend) { if (status.areFriend) {
final controller = HomeController.of(context); final controller = MainController.of(context);
controller.popPage(); controller.popPage();
controller.openUserPage(widget.userID); 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/posts_helper.dart';
import 'package:comunic/helpers/users_helper.dart'; import 'package:comunic/helpers/users_helper.dart';
import 'package:comunic/models/advanced_user_info.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/account_image_widget.dart';
import 'package:comunic/ui/widgets/post_create_form_widget.dart'; import 'package:comunic/ui/widgets/post_create_form_widget.dart';
import 'package:comunic/ui/widgets/posts_list_widget.dart'; import 'package:comunic/ui/widgets/posts_list_widget.dart';
@ -76,7 +76,7 @@ class _UserPageScreenState extends State<UserPageScreen> {
_setStatus(_PageStatus.ERROR); _setStatus(_PageStatus.ERROR);
if (e.cause == GetUserAdvancedInformationErrorCause.NOT_AUTHORIZED) { if (e.cause == GetUserAdvancedInformationErrorCause.NOT_AUTHORIZED) {
final controller = HomeController.of(context); final controller = MainController.of(context);
controller.popPage(); controller.popPage();
controller.openUserAccessDeniedPage(widget.userID); controller.openUserAccessDeniedPage(widget.userID);
} }
@ -184,7 +184,7 @@ class _UserPageScreenState extends State<UserPageScreen> {
void _selectedMenuOption(_MenuOptions value) { void _selectedMenuOption(_MenuOptions value) {
switch (value) { switch (value) {
case _MenuOptions.FRIENDS_LIST: case _MenuOptions.FRIENDS_LIST:
HomeController.of(context).openUserFriendsList(_userInfo.id); MainController.of(context).openUserFriendsList(_userInfo.id);
break; break;
} }
} }

View File

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

View File

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

View File

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