diff --git a/src/addons/messages/pages/contacts-35/contacts.page.ts b/src/addons/messages/pages/contacts-35/contacts.page.ts index b552e49c0..a5dd98e8a 100644 --- a/src/addons/messages/pages/contacts-35/contacts.page.ts +++ b/src/addons/messages/pages/contacts-35/contacts.page.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component, OnDestroy, OnInit } from '@angular/core'; +import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { IonRefresher } from '@ionic/angular'; import { CoreSites } from '@services/sites'; import { @@ -29,6 +29,7 @@ import { ActivatedRoute } from '@angular/router'; import { Translate } from '@singletons'; import { CoreScreen } from '@services/screen'; import { CoreNavigator } from '@services/navigator'; +import { CoreSplitViewComponent } from '@components/split-view/split-view'; /** * Page that displays the list of contacts. @@ -40,6 +41,8 @@ import { CoreNavigator } from '@services/navigator'; }) export class AddonMessagesContacts35Page implements OnInit, OnDestroy { + @ViewChild(CoreSplitViewComponent) splitView!: CoreSplitViewComponent; + protected searchingMessages: string; protected loadingMessages: string; protected siteId: string; @@ -244,7 +247,9 @@ export class AddonMessagesContacts35Page implements OnInit, OnDestroy { const path = CoreNavigator.getRelativePathToParent('/messages/contacts-35') + `discussion/user/${discussionUserId}`; // @todo Check why this is failing on ngInit. - CoreNavigator.navigate(path); + CoreNavigator.navigate(path, { + reset: CoreScreen.isTablet && !!this.splitView && !this.splitView.isNested, + }); } /** diff --git a/src/addons/messages/pages/contacts/contacts.page.ts b/src/addons/messages/pages/contacts/contacts.page.ts index 97535862e..187a39293 100644 --- a/src/addons/messages/pages/contacts/contacts.page.ts +++ b/src/addons/messages/pages/contacts/contacts.page.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component, OnDestroy, OnInit } from '@angular/core'; +import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreSites } from '@services/sites'; import { @@ -24,6 +24,7 @@ import { CoreNavigator } from '@services/navigator'; import { CoreScreen } from '@services/screen'; import { CoreDomUtils } from '@services/utils/dom'; import { IonRefresher } from '@ionic/angular'; +import { CoreSplitViewComponent } from '@components/split-view/split-view'; /** * Page that displays contacts and contact requests. @@ -37,6 +38,8 @@ import { IonRefresher } from '@ionic/angular'; }) export class AddonMessagesContactsPage implements OnInit, OnDestroy { + @ViewChild(CoreSplitViewComponent) splitView!: CoreSplitViewComponent; + selected: 'confirmed' | 'requests' = 'confirmed'; requestsBadge = ''; selectedUserId?: number; // User id of the conversation opened in the split view. @@ -292,7 +295,9 @@ export class AddonMessagesContactsPage implements OnInit, OnDestroy { this.selectedUserId = userId; const path = CoreNavigator.getRelativePathToParent('/messages/contacts') + `discussion/user/${userId}`; - CoreNavigator.navigate(path); + CoreNavigator.navigate(path, { + reset: CoreScreen.isTablet && !!this.splitView && !this.splitView.isNested, + }); } /** diff --git a/src/addons/messages/pages/discussions-35/discussions.page.ts b/src/addons/messages/pages/discussions-35/discussions.page.ts index ef4df1701..0706b9b9d 100644 --- a/src/addons/messages/pages/discussions-35/discussions.page.ts +++ b/src/addons/messages/pages/discussions-35/discussions.page.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component, OnDestroy, OnInit } from '@angular/core'; +import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreSites } from '@services/sites'; import { @@ -34,6 +34,7 @@ import { CoreNavigator } from '@services/navigator'; import { CoreScreen } from '@services/screen'; import { CoreMainMenuDeepLinkManager } from '@features/mainmenu/classes/deep-link-manager'; import { CorePlatform } from '@services/platform'; +import { CoreSplitViewComponent } from '@components/split-view/split-view'; /** * Page that displays the list of discussions. @@ -45,6 +46,8 @@ import { CorePlatform } from '@services/platform'; }) export class AddonMessagesDiscussions35Page implements OnInit, OnDestroy { + @ViewChild(CoreSplitViewComponent) splitView!: CoreSplitViewComponent; + protected newMessagesObserver: CoreEventObserver; protected readChangedObserver: CoreEventObserver; protected appResumeSubscription: Subscription; @@ -264,7 +267,10 @@ export class AddonMessagesDiscussions35Page implements OnInit, OnDestroy { const path = CoreNavigator.getRelativePathToParent('/messages/index') + `discussion/user/${discussionUserId}`; - await CoreNavigator.navigate(path, { params }); + await CoreNavigator.navigate(path, { + params, + reset: CoreScreen.isTablet && !!this.splitView && !this.splitView.isNested, + }); } /** diff --git a/src/addons/messages/pages/group-conversations/group-conversations.page.ts b/src/addons/messages/pages/group-conversations/group-conversations.page.ts index d54e0b793..d250f26ad 100644 --- a/src/addons/messages/pages/group-conversations/group-conversations.page.ts +++ b/src/addons/messages/pages/group-conversations/group-conversations.page.ts @@ -38,6 +38,7 @@ import { CoreNavigator } from '@services/navigator'; import { CoreScreen } from '@services/screen'; import { CoreMainMenuDeepLinkManager } from '@features/mainmenu/classes/deep-link-manager'; import { CorePlatform } from '@services/platform'; +import { CoreSplitViewComponent } from '@components/split-view/split-view'; /** * Page that displays the list of conversations, including group conversations. @@ -49,6 +50,8 @@ import { CorePlatform } from '@services/platform'; }) export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { + @ViewChild(CoreSplitViewComponent) splitView!: CoreSplitViewComponent; + @ViewChild(IonContent) content?: IonContent; @ViewChild('favlist') favListEl?: ElementRef; @ViewChild('grouplist') groupListEl?: ElementRef; @@ -526,7 +529,10 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { const path = CoreNavigator.getRelativePathToParent('/messages/group-conversations') + 'discussion/' + (conversationId ? conversationId : `user/${userId}`); - await CoreNavigator.navigate(path, { params }); + await CoreNavigator.navigate(path, { + params, + reset: CoreScreen.isTablet && !!this.splitView && !this.splitView.isNested, + }); } /** diff --git a/src/addons/messages/pages/search/search.page.ts b/src/addons/messages/pages/search/search.page.ts index 160b34f7e..8d309a17a 100644 --- a/src/addons/messages/pages/search/search.page.ts +++ b/src/addons/messages/pages/search/search.page.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component, OnDestroy } from '@angular/core'; +import { Component, OnDestroy, ViewChild } from '@angular/core'; import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreSites } from '@services/sites'; import { @@ -25,6 +25,7 @@ import { CoreDomUtils } from '@services/utils/dom'; import { CoreApp } from '@services/app'; import { CoreNavigator } from '@services/navigator'; import { CoreScreen } from '@services/screen'; +import { CoreSplitViewComponent } from '@components/split-view/split-view'; /** * Page for searching users. @@ -35,6 +36,8 @@ import { CoreScreen } from '@services/screen'; }) export class AddonMessagesSearchPage implements OnDestroy { + @ViewChild(CoreSplitViewComponent) splitView!: CoreSplitViewComponent; + disableSearch = false; displaySearching = false; displayResults = false; @@ -260,7 +263,9 @@ export class AddonMessagesSearchPage implements OnDestroy { const path = CoreNavigator.getRelativePathToParent('/messages/search') + 'discussion/' + (conversationId ? conversationId : `user/${userId}`); - CoreNavigator.navigate(path); + CoreNavigator.navigate(path, { + reset: CoreScreen.isTablet && !!this.splitView && !this.splitView.isNested, + }); } }