Merge pull request #3552 from dpalou/MOBILE-4249

Mobile 4249
main
Pau Ferrer Ocaña 2023-02-21 11:25:22 +01:00 committed by GitHub
commit 4a7fec5e18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 52 additions and 9 deletions

View File

@ -7,6 +7,8 @@
<h1>{{ 'addon.messages.contacts' | translate }}</h1>
</ion-title>
<ion-buttons slot="end">
<!-- Add an empty context menu so split view pages can add items, otherwise the menu disappears in some cases. -->
<core-context-menu></core-context-menu>
</ion-buttons>
</ion-toolbar>
</ion-header>

View File

@ -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,
});
}
/**

View File

@ -10,6 +10,8 @@
<ion-button fill="clear" (click)="gotoSearch()" [attr.aria-label]="'addon.messages.searchcombined' | translate">
<ion-icon name="fas-search" slot="icon-only" aria-hidden="true"></ion-icon>
</ion-button>
<!-- Add an empty context menu so split view pages can add items, otherwise the menu disappears in some cases. -->
<core-context-menu></core-context-menu>
</ion-buttons>
</ion-toolbar>
</ion-header>

View File

@ -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,
});
}
/**

View File

@ -7,6 +7,8 @@
<h1>{{ 'addon.messages.messages' | translate }}</h1>
</ion-title>
<ion-buttons slot="end">
<!-- Add an empty context menu so split view pages can add items, otherwise the menu disappears in some cases. -->
<core-context-menu></core-context-menu>
<core-user-menu-button></core-user-menu-button>
</ion-buttons>
</ion-toolbar>

View File

@ -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,
});
}
/**

View File

@ -13,6 +13,8 @@
<ion-button (click)="gotoSettings()" [attr.aria-label]="'addon.messages.messagepreferences' | translate">
<ion-icon name="fas-cog" slot="icon-only" aria-hidden="true"></ion-icon>
</ion-button>
<!-- Add an empty context menu so split view pages can add items, otherwise the menu disappears in some cases. -->
<core-context-menu></core-context-menu>
<core-user-menu-button></core-user-menu-button>
</ion-buttons>
</ion-toolbar>

View File

@ -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,
});
}
/**

View File

@ -7,6 +7,8 @@
<h1>{{ 'addon.messages.searchcombined' | translate }}</h1>
</ion-title>
<ion-buttons slot="end">
<!-- Add an empty context menu so split view pages can add items, otherwise the menu disappears in some cases. -->
<core-context-menu></core-context-menu>
</ion-buttons>
</ion-toolbar>
</ion-header>

View File

@ -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,
});
}
}

View File

@ -3,6 +3,8 @@
<ion-button fill="clear" (click)="openModuleSummary()" aria-haspopup="true" [attr.aria-label]="'core.info' | translate">
<ion-icon name="fas-info-circle" slot="icon-only" aria-hidden="true"></ion-icon>
</ion-button>
<!-- Add an empty context menu so split view pages can add items, otherwise the menu disappears in some cases. -->
<core-context-menu></core-context-menu>
</core-navbar-buttons>
<!-- Content. -->

View File

@ -164,6 +164,8 @@ export class CoreNavBarButtonsComponent implements OnInit, OnDestroy {
} else {
// There is a context-menu in these buttons, but there is no main context menu in the header.
// Create one main context menu dynamically.
// @todo: Find a better way to handle header buttons. This isn't working as expected in some cases because the menu
// is destroyed when the page is destroyed, so click listeners stop working.
mainContextMenuInstance = this.createMainContextMenu();
}

View File

@ -13,6 +13,8 @@
<ion-button fill="clear" (click)="openCourseSummary()" [attr.aria-label]="'core.course.coursesummary' | translate">
<ion-icon name="fas-info-circle" slot="icon-only" aria-hidden="true"></ion-icon>
</ion-button>
<!-- Add an empty context menu so tab pages can add items, otherwise the menu disappears in some cases. -->
<core-context-menu></core-context-menu>
</ion-buttons>
</ion-toolbar>
</ion-header>