Skip to content

Commit 5c31959

Browse files
authored
Merge pull request #4675 from dpalou/MOBILE-4911
Mobile 4911 Allow site plugins to not only add menu items (in the more menu, user menu, user profile) but also HTML content
2 parents 98d8185 + e5ee376 commit 5c31959

File tree

95 files changed

+956
-418
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+956
-418
lines changed

src/addons/badges/services/handlers/user.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { CoreCourseUserAdminOrNavOptionIndexed } from '@features/courses/service
1717
import {
1818
CoreUserDelegateContext,
1919
CoreUserProfileHandler,
20-
CoreUserProfileHandlerData,
20+
CoreUserProfileListHandlerData,
2121
CoreUserProfileHandlerType,
2222
} from '@features/user/services/user-delegate';
2323
import { CoreNavigator } from '@services/navigator';
@@ -31,9 +31,9 @@ import { AddonBadges } from '../badges';
3131
@Injectable({ providedIn: 'root' })
3232
export class AddonBadgesUserHandlerService implements CoreUserProfileHandler {
3333

34+
readonly type = CoreUserProfileHandlerType.LIST_ITEM;
3435
name = 'AddonBadges:fakename'; // This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
3536
priority = 300;
36-
type = CoreUserProfileHandlerType.LIST_ITEM;
3737

3838
/**
3939
* @inheritdoc
@@ -74,7 +74,7 @@ export class AddonBadgesUserHandlerService implements CoreUserProfileHandler {
7474
/**
7575
* @inheritdoc
7676
*/
77-
getDisplayData(): CoreUserProfileHandlerData {
77+
getDisplayData(): CoreUserProfileListHandlerData {
7878
return {
7979
icon: 'fas-trophy',
8080
title: 'addon.badges.badges',

src/addons/block/timeline/components/timeline/timeline.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ export const enum AddonBlockTimelineFilter {
346346
/**
347347
* Select option.
348348
*/
349-
export interface AddonBlockTimelineOption<Value> {
349+
export type AddonBlockTimelineOption<Value> = {
350350
value: Value;
351351
name: string;
352-
}
352+
};

src/addons/blog/services/blog.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ export type CoreBlogGetEntriesWSResponse = {
444444
/**
445445
* Data returned by blog's post_exporter.
446446
*/
447-
export interface AddonBlogPost {
447+
export type AddonBlogPost = {
448448
id: number; // Post/entry id.
449449
module: string; // Where it was published the post (blog, blog_external...).
450450
userid: number; // Post author.
@@ -467,7 +467,7 @@ export interface AddonBlogPost {
467467
summaryfiles: CoreWSExternalFile[]; // Summaryfiles.
468468
attachmentfiles?: CoreWSExternalFile[]; // Attachmentfiles.
469469
tags?: CoreTagItem[]; // @since 3.7. Tags.
470-
}
470+
};
471471

472472
/**
473473
* Params of core_blog_view_entries WS.

src/addons/blog/services/handlers/mainmenu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
import { Injectable } from '@angular/core';
16-
import { CoreMainMenuHandler, CoreMainMenuHandlerData } from '@features/mainmenu/services/mainmenu-delegate';
16+
import { CoreMainMenuHandler, CoreMainMenuPageNavHandlerData } from '@features/mainmenu/services/mainmenu-delegate';
1717
import { makeSingleton } from '@singletons';
1818
import { AddonBlog } from '../blog';
1919
import { ADDON_BLOG_MAINMENU_PAGE_NAME } from '@addons/blog/constants';
@@ -37,7 +37,7 @@ export class AddonBlogMainMenuHandlerService implements CoreMainMenuHandler {
3737
/**
3838
* @inheritdoc
3939
*/
40-
getDisplayData(): CoreMainMenuHandlerData {
40+
getDisplayData(): CoreMainMenuPageNavHandlerData {
4141
return {
4242
icon: 'far-newspaper',
4343
title: 'addon.blog.siteblogheading',

src/addons/blog/services/handlers/user.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import { Injectable } from '@angular/core';
1616
import {
1717
CoreUserProfileHandler,
18-
CoreUserProfileHandlerData,
18+
CoreUserProfileListHandlerData,
1919
CoreUserProfileHandlerType,
2020
CoreUserDelegateContext,
2121
} from '@features/user/services/user-delegate';
@@ -30,9 +30,9 @@ import { AddonBlog } from '../blog';
3030
@Injectable({ providedIn: 'root' })
3131
export class AddonBlogUserHandlerService implements CoreUserProfileHandler {
3232

33+
readonly type = CoreUserProfileHandlerType.LIST_ITEM;
3334
name = 'AddonBlog'; // This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
3435
priority = 200;
35-
type = CoreUserProfileHandlerType.LIST_ITEM;
3636

3737
/**
3838
* @inheritdoc
@@ -65,7 +65,7 @@ export class AddonBlogUserHandlerService implements CoreUserProfileHandler {
6565
/**
6666
* @inheritdoc
6767
*/
68-
getDisplayData(): CoreUserProfileHandlerData {
68+
getDisplayData(): CoreUserProfileListHandlerData {
6969
return {
7070
icon: 'far-newspaper',
7171
title: 'addon.blog.blogentries',

src/addons/calendar/services/handlers/mainmenu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import { Injectable } from '@angular/core';
1616
import { AddonCalendar } from '../calendar';
1717
import { makeSingleton } from '@singletons';
18-
import { CoreMainMenuHandler, CoreMainMenuHandlerData } from '@features/mainmenu/services/mainmenu-delegate';
18+
import { CoreMainMenuHandler, CoreMainMenuPageNavHandlerData } from '@features/mainmenu/services/mainmenu-delegate';
1919
import { ADDON_CALENDAR_PAGE_NAME } from '@addons/calendar/constants';
2020

2121
/**
@@ -41,7 +41,7 @@ export class AddonCalendarMainMenuHandlerService implements CoreMainMenuHandler
4141
*
4242
* @returns Data needed to render the handler.
4343
*/
44-
getDisplayData(): CoreMainMenuHandlerData {
44+
getDisplayData(): CoreMainMenuPageNavHandlerData {
4545
return {
4646
icon: 'far-calendar',
4747
title: 'addon.calendar.calendar',

src/addons/competency/services/handlers/user.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { CoreUserProfile } from '@features/user/services/user';
1919
import {
2020
CoreUserProfileHandler,
2121
CoreUserProfileHandlerType,
22-
CoreUserProfileHandlerData,
22+
CoreUserProfileListHandlerData,
2323
CoreUserDelegateContext,
2424
} from '@features/user/services/user-delegate';
2525
import { PARTICIPANTS_PAGE_NAME } from '@features/user/constants';
@@ -34,10 +34,9 @@ import { AddonCompetency } from '../competency';
3434
@Injectable( { providedIn: 'root' })
3535
export class AddonCompetencyUserHandlerService implements CoreUserProfileHandler {
3636

37-
// This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
38-
name = 'AddonCompetency:fakename';
37+
readonly type = CoreUserProfileHandlerType.LIST_ITEM;
38+
name = 'AddonCompetency:fakename'; // This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
3939
priority = 100;
40-
type = CoreUserProfileHandlerType.LIST_ITEM;
4140
cacheEnabled = true;
4241

4342
/**
@@ -89,7 +88,7 @@ export class AddonCompetencyUserHandlerService implements CoreUserProfileHandler
8988
/**
9089
* @inheritdoc
9190
*/
92-
getDisplayData(user: CoreUserProfile, context: CoreUserDelegateContext): CoreUserProfileHandlerData {
91+
getDisplayData(user: CoreUserProfile, context: CoreUserDelegateContext): CoreUserProfileListHandlerData {
9392
if (context !== CoreUserDelegateContext.COURSE) {
9493
return {
9594
icon: 'fas-route',

src/addons/coursecompletion/services/handlers/user.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { CoreUserProfile } from '@features/user/services/user';
1717
import {
1818
CoreUserProfileHandler,
1919
CoreUserProfileHandlerType,
20-
CoreUserProfileHandlerData,
20+
CoreUserProfileListHandlerData,
2121
CoreUserDelegateContext,
2222
} from '@features/user/services/user-delegate';
2323
import { CoreNavigator } from '@services/navigator';
@@ -30,8 +30,8 @@ import { AddonCourseCompletion } from '../coursecompletion';
3030
@Injectable({ providedIn: 'root' })
3131
export class AddonCourseCompletionUserHandlerService implements CoreUserProfileHandler {
3232

33+
readonly type = CoreUserProfileHandlerType.LIST_ITEM;
3334
name = 'AddonCourseCompletion:viewCompletion';
34-
type = CoreUserProfileHandlerType.LIST_ITEM;
3535
priority = 350;
3636
cacheEnabled = true;
3737

@@ -63,7 +63,7 @@ export class AddonCourseCompletionUserHandlerService implements CoreUserProfileH
6363
/**
6464
* @inheritdoc
6565
*/
66-
getDisplayData(): CoreUserProfileHandlerData {
66+
getDisplayData(): CoreUserProfileListHandlerData {
6767
return {
6868
icon: 'fas-list-check',
6969
title: 'addon.coursecompletion.coursecompletion',

src/addons/messageoutput/services/messageoutput-delegate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export interface AddonMessageOutputHandler extends CoreDelegateHandler {
3939
/**
4040
* Data needed to render a message output handler. It's returned by the handler.
4141
*/
42-
export interface AddonMessageOutputHandlerData {
42+
export type AddonMessageOutputHandlerData = {
4343
/**
4444
* Handler's priority.
4545
*/
@@ -64,7 +64,7 @@ export interface AddonMessageOutputHandlerData {
6464
* Params to pass to the page.
6565
*/
6666
pageParams?: Params;
67-
}
67+
};
6868

6969
/**
7070
* Delegate to register processors (message/output) to be used in places like notification preferences.

src/addons/messages/services/handlers/mainmenu.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Injectable } from '@angular/core';
1616
import {
1717
AddonMessages,
1818
} from '../messages';
19-
import { CoreMainMenuHandler, CoreMainMenuHandlerToDisplay } from '@features/mainmenu/services/mainmenu-delegate';
19+
import { CoreMainMenuHandler, CoreMainMenuPageNavHandlerData } from '@features/mainmenu/services/mainmenu-delegate';
2020
import { CoreCronHandler } from '@services/cron';
2121
import { CoreSites } from '@services/sites';
2222
import { CoreEvents } from '@singletons/events';
@@ -42,7 +42,7 @@ export class AddonMessagesMainMenuHandlerService implements CoreMainMenuHandler,
4242
name = 'AddonMessages';
4343
priority = 700;
4444

45-
protected handler: CoreMainMenuHandlerToDisplay = {
45+
protected handler: CoreMainMenuPageNavHandlerData = {
4646
icon: 'fas-comments',
4747
title: 'addon.messages.messages',
4848
page: ADDON_MESSAGES_PAGE_NAME,
@@ -112,7 +112,7 @@ export class AddonMessagesMainMenuHandlerService implements CoreMainMenuHandler,
112112
*
113113
* @returns Data needed to render the handler.
114114
*/
115-
getDisplayData(): CoreMainMenuHandlerToDisplay {
115+
getDisplayData(): CoreMainMenuPageNavHandlerData {
116116
if (this.handler.loading) {
117117
this.refreshBadge();
118118
}

0 commit comments

Comments
 (0)