Skip to content

Commit cc2f238

Browse files
committed
MOBILE-4329 user: Rename user profile handler types
1 parent dddc95b commit cc2f238

File tree

19 files changed

+181
-118
lines changed

19 files changed

+181
-118
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import { Injectable } from '@angular/core';
1616
import { CoreCourseUserAdminOrNavOptionIndexed } from '@features/courses/services/courses';
1717
import {
1818
CoreUserDelegateContext,
19-
CoreUserDelegateService,
2019
CoreUserProfileHandler,
2120
CoreUserProfileHandlerData,
21+
CoreUserProfileHandlerType,
2222
} from '@features/user/services/user-delegate';
2323
import { CoreNavigator } from '@services/navigator';
2424
import { CoreSites } from '@services/sites';
@@ -33,7 +33,7 @@ export class AddonBadgesUserHandlerService implements CoreUserProfileHandler {
3333

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

3838
/**
3939
* @inheritdoc

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Injectable } from '@angular/core';
1616
import {
1717
CoreUserProfileHandler,
1818
CoreUserProfileHandlerData,
19-
CoreUserDelegateService,
19+
CoreUserProfileHandlerType,
2020
CoreUserDelegateContext,
2121
} from '@features/user/services/user-delegate';
2222
import { CoreNavigator } from '@services/navigator';
@@ -32,7 +32,7 @@ export class AddonBlogUserHandlerService implements CoreUserProfileHandler {
3232

3333
name = 'AddonBlog'; // This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
3434
priority = 200;
35-
type = CoreUserDelegateService.TYPE_NEW_PAGE;
35+
type = CoreUserProfileHandlerType.LIST_ITEM;
3636

3737
/**
3838
* @inheritdoc

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { COURSE_PAGE_NAME } from '@features/course/course.module';
1818
import { CoreUserProfile } from '@features/user/services/user';
1919
import {
2020
CoreUserProfileHandler,
21-
CoreUserDelegateService,
21+
CoreUserProfileHandlerType,
2222
CoreUserProfileHandlerData,
2323
CoreUserDelegateContext,
2424
} from '@features/user/services/user-delegate';
@@ -36,7 +36,7 @@ export class AddonCompetencyUserHandlerService implements CoreUserProfileHandler
3636

3737
name = 'AddonCompetency'; // This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
3838
priority = 100;
39-
type = CoreUserDelegateService.TYPE_NEW_PAGE;
39+
type = CoreUserProfileHandlerType.LIST_ITEM;
4040
cacheEnabled = true;
4141

4242
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Injectable } from '@angular/core';
1616
import { CoreUserProfile } from '@features/user/services/user';
1717
import {
1818
CoreUserProfileHandler,
19-
CoreUserDelegateService,
19+
CoreUserProfileHandlerType,
2020
CoreUserProfileHandlerData,
2121
CoreUserDelegateContext,
2222
} from '@features/user/services/user-delegate';
@@ -31,7 +31,7 @@ import { AddonCourseCompletion } from '../coursecompletion';
3131
export class AddonCourseCompletionUserHandlerService implements CoreUserProfileHandler {
3232

3333
name = 'AddonCourseCompletion:viewCompletion';
34-
type = CoreUserDelegateService.TYPE_NEW_PAGE;
34+
type = CoreUserProfileHandlerType.LIST_ITEM;
3535
priority = 350;
3636
cacheEnabled = true;
3737

src/addons/messages/services/handlers/user-send-message.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
import { Injectable } from '@angular/core';
1616
import { Params } from '@angular/router';
1717
import { CoreUserProfile } from '@features/user/services/user';
18-
import { CoreUserDelegateService, CoreUserProfileHandler, CoreUserProfileHandlerData } from '@features/user/services/user-delegate';
18+
import {
19+
CoreUserProfileHandlerType,
20+
CoreUserProfileHandler,
21+
CoreUserProfileHandlerData,
22+
} from '@features/user/services/user-delegate';
1923
import { CoreNavigator } from '@services/navigator';
2024
import { CoreSites } from '@services/sites';
2125
import { makeSingleton } from '@singletons';
@@ -29,7 +33,7 @@ export class AddonMessagesSendMessageUserHandlerService implements CoreUserProfi
2933

3034
name = 'AddonMessages:sendMessage';
3135
priority = 1000;
32-
type = CoreUserDelegateService.TYPE_COMMUNICATION;
36+
type = CoreUserProfileHandlerType.BUTTON;
3337

3438
/**
3539
* @inheritdoc

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Injectable } from '@angular/core';
1616
import { CoreUserProfile } from '@features/user/services/user';
1717
import {
1818
CoreUserProfileHandler,
19-
CoreUserDelegateService,
19+
CoreUserProfileHandlerType,
2020
CoreUserProfileHandlerData,
2121
CoreUserDelegateContext,
2222
} from '@features/user/services/user-delegate';
@@ -33,7 +33,7 @@ export class AddonNotesUserHandlerService implements CoreUserProfileHandler {
3333

3434
name = 'AddonNotes:notes';
3535
priority = 250;
36-
type = CoreUserDelegateService.TYPE_NEW_PAGE;
36+
type = CoreUserProfileHandlerType.LIST_ITEM;
3737
cacheEnabled = true;
3838

3939
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { AddonPrivateFiles } from '@addons/privatefiles/services/privatefiles';
1818
import { makeSingleton } from '@singletons';
1919
import {
2020
CoreUserDelegateContext,
21-
CoreUserDelegateService,
21+
CoreUserProfileHandlerType,
2222
CoreUserProfileHandler,
2323
CoreUserProfileHandlerData,
2424
} from '@features/user/services/user-delegate';
@@ -36,7 +36,7 @@ export class AddonPrivateFilesUserHandlerService implements CoreUserProfileHandl
3636

3737
name = 'AddonPrivateFiles';
3838
priority = 400;
39-
type = CoreUserDelegateService.TYPE_NEW_PAGE;
39+
type = CoreUserProfileHandlerType.LIST_ITEM;
4040
cacheEnabled = true;
4141

4242
/**

src/core/features/dataprivacy/services/handlers/user.ts

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

1515
import { Injectable } from '@angular/core';
16-
import { CoreUserDelegateService, CoreUserProfileHandler, CoreUserProfileHandlerData } from '@features/user/services/user-delegate';
16+
import {
17+
CoreUserProfileHandlerType,
18+
CoreUserProfileHandler,
19+
CoreUserProfileHandlerData,
20+
} from '@features/user/services/user-delegate';
1721
import { CoreNavigator } from '@services/navigator';
1822
import { makeSingleton } from '@singletons';
1923
import { CoreDataPrivacy } from '../dataprivacy';
@@ -27,7 +31,7 @@ export class CoreDataPrivacyUserHandlerService implements CoreUserProfileHandler
2731

2832
protected pageName = CORE_DATAPRIVACY_PAGE_NAME;
2933

30-
type = CoreUserDelegateService.TYPE_NEW_PAGE;
34+
type = CoreUserProfileHandlerType.LIST_ACCOUNT_ITEM;
3135
name = 'CoreDataPrivacyDelegate';
3236
priority = 100;
3337

src/core/features/grades/services/handlers/user.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { CoreGrades } from '@features/grades/services/grades';
1919
import { CoreUserProfile } from '@features/user/services/user';
2020
import {
2121
CoreUserDelegateContext,
22-
CoreUserDelegateService ,
22+
CoreUserProfileHandlerType ,
2323
CoreUserProfileHandler,
2424
CoreUserProfileHandlerData,
2525
} from '@features/user/services/user-delegate';
@@ -38,7 +38,7 @@ export class CoreGradesUserHandlerService implements CoreUserProfileHandler {
3838

3939
name = 'CoreGrades'; // This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
4040
priority = 500;
41-
type = CoreUserDelegateService.TYPE_NEW_PAGE;
41+
type = CoreUserProfileHandlerType.LIST_ITEM;
4242
cacheEnabled = true;
4343

4444
/**

src/core/features/mainmenu/components/user-menu/user-menu.html

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,35 @@ <h1>
4040
</ion-label>
4141
</ion-item>
4242

43-
<ion-item button class="core-usermenu-handler ion-text-wrap" *ngIf="siteInfo" lines="full" (click)="openUserProfile($event)"
43+
<ion-item button class="core-usermenu-profile ion-text-wrap" *ngIf="siteInfo" lines="full" (click)="openUserProfile($event)"
4444
[detail]="true" [attr.aria-label]="'core.user.profile' | translate">
4545
<core-user-avatar [site]="siteInfo" [userId]="siteInfo.userid" [linkProfile]="false" slot="start" />
4646
<ion-label>
4747
<p class="item-heading">{{ siteInfo.fullname }}</p>
4848
</ion-label>
4949
</ion-item>
5050

51-
<ion-item class="ion-text-center" *ngIf="(!handlers || !handlers.length) && !handlersLoaded">
51+
@if (handlers.length + accountHandlers.length > 0) {
52+
<ion-item button *ngFor="let handler of handlers" class="ion-text-wrap" (click)="handlerClicked($event, handler)"
53+
[ngClass]="['core-user-menu-handler', handler.class || '']" [hidden]="handler.hidden"
54+
[attr.aria-label]="handler.title | translate" [detail]="true">
55+
<ion-icon *ngIf="handler.icon" [name]="handler.icon" slot="start" aria-hidden="true" />
5256
<ion-label>
53-
<ion-spinner [attr.aria-label]="'core.loading' | translate" />
57+
<p class="item-heading">{{ handler.title | translate }}</p>
5458
</ion-label>
59+
<ion-badge slot="end" *ngIf="handler.showBadge" [hidden]="handler.loading || !handler.badge" aria-hidden="true">
60+
{{handler.badge}}
61+
</ion-badge>
62+
<span *ngIf="handler.showBadge && handler.badge && handler.badgeA11yText" class="sr-only">
63+
{{ handler.badgeA11yText | translate: {$a : handler.badge } }}
64+
</span>
65+
<ion-spinner slot="end" *ngIf="handler.showBadge && handler.loading" [attr.aria-label]="'core.loading' | translate" />
5566
</ion-item>
5667

57-
<ion-item button *ngFor="let handler of handlers" class="ion-text-wrap" (click)="handlerClicked($event, handler)"
58-
[ngClass]="['core-user-menu-handler', handler.class || '']" [hidden]="handler.hidden"
59-
[attr.aria-label]="handler.title | translate" [detail]="true">
68+
<ion-item button *ngFor="let handler of accountHandlers; let first = first" class="ion-text-wrap"
69+
(click)="handlerClicked($event, handler)"
70+
[ngClass]="['core-user-account-menu-handler', handler.class || '', first ? 'core-user-menu-separator' : '']"
71+
[hidden]="handler.hidden" [attr.aria-label]="handler.title | translate" [detail]="true">
6072
<ion-icon *ngIf="handler.icon" [name]="handler.icon" slot="start" aria-hidden="true" />
6173
<ion-label>
6274
<p class="item-heading">{{ handler.title | translate }}</p>
@@ -69,9 +81,19 @@ <h1>
6981
</span>
7082
<ion-spinner slot="end" *ngIf="handler.showBadge && handler.loading" [attr.aria-label]="'core.loading' | translate" />
7183
</ion-item>
84+
} @else {
85+
<ion-item class="ion-text-center">
86+
<ion-label>
87+
<ion-spinner [attr.aria-label]="'core.loading' | translate" />
88+
</ion-label>
89+
</ion-item>
90+
}
91+
92+
93+
7294

7395
<ion-item button (click)="openPreferences($event)" [attr.aria-label]="'core.settings.preferences' | translate" [detail]="true"
74-
class="core-user-menu-preferences">
96+
class="core-user-menu-preferences core-user-menu-separator">
7597
<ion-icon name="fas-wrench" slot="start" aria-hidden="true" />
7698
<ion-label>
7799
<p class="item-heading">{{ 'core.settings.preferences' | translate }}</p>

0 commit comments

Comments
 (0)