From 6b669c6592482f3a9e8eb1d0c7d53bca6f95e381 Mon Sep 17 00:00:00 2001 From: Ajoymaity Date: Wed, 16 Nov 2022 18:17:36 +0530 Subject: [PATCH 1/2] Issue #SB-0000 feat: Integrated BMG formconfig --- src/app/form.constants.ts | 7 ++ .../profile-settings.page.html | 84 ++++++++++--------- .../profile-settings.page.spec.ts | 1 + .../profile-settings/profile-settings.page.ts | 7 +- .../categories-edit/categories-edit.page.html | 18 ++-- .../categories-edit.page.spec.ts | 10 ++- .../categories-edit/categories-edit.page.ts | 12 ++- .../profile/guest-edit/guest-edit.page.html | 28 ++++--- .../guest-edit/guest-edit.page.spec.ts | 8 +- src/app/profile/guest-edit/guest-edit.page.ts | 10 ++- .../guest-profile/guest-profile.page.html | 16 ++-- .../guest-profile/guest-profile.page.ts | 12 ++- src/app/profile/profile.page.html | 22 ++--- src/app/profile/profile.page.spec.ts | 8 +- src/app/profile/profile.page.ts | 5 ++ src/services/formandframeworkutil.service.ts | 4 + 16 files changed, 151 insertions(+), 101 deletions(-) diff --git a/src/app/form.constants.ts b/src/app/form.constants.ts index 8093e18c4..fafb4b62f 100644 --- a/src/app/form.constants.ts +++ b/src/app/form.constants.ts @@ -222,4 +222,11 @@ export class FormConstants { action: 'get', component: 'app', }; + + public static FRAMEWORK_CONFIG: FormRequest = { + type: 'config', + subType: 'frameworkCategory', + action: 'get', + component: 'app', + }; } diff --git a/src/app/profile-settings/profile-settings.page.html b/src/app/profile-settings/profile-settings.page.html index cec14473d..3db2dc050 100644 --- a/src/app/profile-settings/profile-settings.page.html +++ b/src/app/profile-settings/profile-settings.page.html @@ -30,22 +30,22 @@
{{'PROVIDE_BELOW_INFO' | translate}}
-
+
- {{'' | category: 'category1'}} + {{categories[0].label | translateJson}} + placeholder="{{categories[0].placeHolder | translateJson}}"> {{eachSyllabus.name}}‎
-
{{'' | category: 'category1'}}
+
{{categories[0].label | translateJson}}
@@ -53,43 +53,45 @@
- - {{'' | category: 'category1'}} - - - - {{eachSyllabus.name | aliased}}‎ - - +
+ + {{category.label | translateJson}} + + + + {{eachSyllabus.name | aliased}}‎ + + - - {{'' | category: 'category2'}} - - - - {{medium.name}} - - - - - {{'' | category: 'category3'}} - - - - {{grade.name}} - - + + {{category.label | translateJson}} + + + + {{medium.name}} + + + + + {{category.label | translateJson}} + + + + {{grade.name}} + + +
diff --git a/src/app/profile-settings/profile-settings.page.spec.ts b/src/app/profile-settings/profile-settings.page.spec.ts index ab434c09a..ecd0dfd1c 100644 --- a/src/app/profile-settings/profile-settings.page.spec.ts +++ b/src/app/profile-settings/profile-settings.page.spec.ts @@ -159,6 +159,7 @@ describe('ProfileSettingsPage', () => { it('should fetch active profile by invoked ngOnInit()', (done) => { // arrange + mockFormAndFrameworkUtilService.getFrameworkCategories = jest.fn(() => Promise.resolve()); mockOnboardingConfigurationService.getOnboardingConfig = jest.fn(() => mockOnboardingConfigData.onboarding[0] as any) mockTelemetryGeneratorService.generateImpressionTelemetry = jest.fn(); jest.spyOn(profileSettingsPage, 'handleActiveScanner').mockImplementation(() => { diff --git a/src/app/profile-settings/profile-settings.page.ts b/src/app/profile-settings/profile-settings.page.ts index f72e070c6..9c7399c49 100644 --- a/src/app/profile-settings/profile-settings.page.ts +++ b/src/app/profile-settings/profile-settings.page.ts @@ -69,6 +69,7 @@ export class ProfileSettingsPage implements OnInit, OnDestroy, AfterViewInit { btnColor = '#8FC4FF'; appName: string; showQRScanner = true; + categories = []; public profileSettingsForm: FormGroup; public hideBackButton = true; @@ -143,8 +144,8 @@ export class ProfileSettingsPage implements OnInit, OnDestroy, AfterViewInit { } async ngOnInit() { + this.fetchCategories(); this.handleActiveScanner(); - this.appVersion.getAppName().then((appName) => { this.appName = (appName).toUpperCase(); }); @@ -827,4 +828,8 @@ export class ProfileSettingsPage implements OnInit, OnDestroy, AfterViewInit { }); } + private async fetchCategories() { + this.categories = await this.formAndFrameworkUtilService.getFrameworkCategories(); + } + } diff --git a/src/app/profile/categories-edit/categories-edit.page.html b/src/app/profile/categories-edit/categories-edit.page.html index 1a52c53b7..5510541ec 100644 --- a/src/app/profile/categories-edit/categories-edit.page.html +++ b/src/app/profile/categories-edit/categories-edit.page.html @@ -9,15 +9,15 @@ - +
- {{'BOARD' | translate}} ‎ + {{frameworkData[0].label | translateJson}} ‎  * @@ -26,12 +26,12 @@ - {{'MEDIUM' | translate}} + {{frameworkData[1].label | translateJson}}  * {{medium?.name}} @@ -39,12 +39,12 @@ - {{'CLASS' | translate}} + {{frameworkData[2].label | translateJson}}  * @@ -54,9 +54,9 @@ - {{'SUBJECTS' | translate}} + {{frameworkData[3].label | translateJson}} diff --git a/src/app/profile/categories-edit/categories-edit.page.spec.ts b/src/app/profile/categories-edit/categories-edit.page.spec.ts index 97c79be4e..ce09e1c50 100644 --- a/src/app/profile/categories-edit/categories-edit.page.spec.ts +++ b/src/app/profile/categories-edit/categories-edit.page.spec.ts @@ -14,7 +14,8 @@ import { ContainerService, AppHeaderService, ActivePageService, - FormAndFrameworkUtilService + FormAndFrameworkUtilService, + TelemetryGeneratorService } from '../../../services'; import { Location } from '@angular/common'; import { FormBuilder } from '@angular/forms'; @@ -109,6 +110,7 @@ describe('CategoryEditPage', () => { } }; const mockCategoriesEditService: Partial = {}; + const mockTelemetryGeneratorService: Partial = {}; beforeAll(() => { @@ -129,7 +131,9 @@ describe('CategoryEditPage', () => { mockProgressLoader as SbProgressLoader, mockProfileHandler as ProfileHandler, mockSegmentationTagService as SegmentationTagService, - mockCategoriesEditService as CategoriesEditService + mockCategoriesEditService as CategoriesEditService, + mockTelemetryGeneratorService as TelemetryGeneratorService, + mockFormAndFrameworkUtilService as FormAndFrameworkUtilService ); }); @@ -291,9 +295,11 @@ describe('CategoryEditPage', () => { }, } as any)); mockSharedPreferences.getString = jest.fn(() => of('userType')); + mockFormAndFrameworkUtilService.getFrameworkCategories = jest.fn(() => Promise.resolve()); // act categoryEditPage.ngOnInit().then(() => { // assert + expect(mockFormAndFrameworkUtilService.getFrameworkCategories).toHaveBeenCalled(); expect(mockSharedPreferences.getString).toHaveBeenCalledWith(PreferenceKey.SELECTED_USER_TYPE); expect(categoryEditPage.supportedProfileAttributes).toEqual({ board: 'board', diff --git a/src/app/profile/categories-edit/categories-edit.page.ts b/src/app/profile/categories-edit/categories-edit.page.ts index a012343f9..c1b994a82 100644 --- a/src/app/profile/categories-edit/categories-edit.page.ts +++ b/src/app/profile/categories-edit/categories-edit.page.ts @@ -27,7 +27,8 @@ import { AppHeaderService } from '@app/services/app-header.service'; import { PreferenceKey, ProfileConstants } from '@app/app/app.constant'; import { Router } from '@angular/router'; import { Location } from '@angular/common'; -import { Environment, ActivePageService, InteractSubtype, PageId, TelemetryGeneratorService } from '@app/services'; +import { Environment, ActivePageService, TelemetryGeneratorService, + FormAndFrameworkUtilService, InteractSubtype, PageId, } from '@app/services'; import { SbProgressLoader } from '@app/services/sb-progress-loader.service'; import { ProfileHandler } from '@app/services/profile-handler'; import { SegmentationTagService, TagPrefixConstants } from '@app/services/segmentation-tag/segmentation-tag.service'; @@ -78,6 +79,7 @@ export class CategoriesEditPage implements OnInit, OnDestroy { shouldUpdatePreference: boolean; noOfStepsToCourseToc = 0; guestUserProfile: any; + frameworkData = []; /* Custom styles for the select box popup */ boardOptions = { @@ -137,7 +139,8 @@ export class CategoriesEditPage implements OnInit, OnDestroy { private profileHandler: ProfileHandler, private segmentationTagService: SegmentationTagService, private categoriesEditService: CategoriesEditService, - private telemetryGeneratorService: TelemetryGeneratorService + private telemetryGeneratorService: TelemetryGeneratorService, + private formAndFrameworkUtilService: FormAndFrameworkUtilService ) { this.appGlobalService.closeSigninOnboardingLoader(); @@ -159,6 +162,7 @@ export class CategoriesEditPage implements OnInit, OnDestroy { } async ngOnInit() { + await this.getCategories(); this.supportedProfileAttributes = await this.profileHandler.getSupportedProfileAttributes(false); const subscriptionArray: Array = this.updateAttributeStreamsnSetValidators(this.supportedProfileAttributes); this.formControlSubscriptions = combineLatest(subscriptionArray).subscribe(); @@ -580,4 +584,8 @@ export class CategoriesEditPage implements OnInit, OnDestroy { this.guestUserProfile = profile; }); } + + private async getCategories() { + this.frameworkData = await this.formAndFrameworkUtilService.getFrameworkCategories(); + } } diff --git a/src/app/profile/guest-edit/guest-edit.page.html b/src/app/profile/guest-edit/guest-edit.page.html index 8b7f51132..f3c305b12 100644 --- a/src/app/profile/guest-edit/guest-edit.page.html +++ b/src/app/profile/guest-edit/guest-edit.page.html @@ -27,16 +27,17 @@ placeholder="{{'NAME_HINT' | translate }}"> - - - {{'' | category: 'category1'}} ‎ +
+ + + {{categories[0].label | translateJson}} ‎  * {{eachSyllabus.name | aliased}}‎ @@ -45,9 +46,9 @@ - + - {{'' | category: 'category2'}} + {{categories[1].label | translateJson}}  * @@ -55,7 +56,7 @@ {{medium?.name}} @@ -64,15 +65,15 @@ - - {{'' | category: 'category3'}} + + {{categories[2].label | translateJson}}  * {{grade?.name}} @@ -81,19 +82,20 @@ - - {{'' | category: 'category4'}} + + {{categories[3].label | translateJson}} {{subject?.name}} +
diff --git a/src/app/profile/guest-edit/guest-edit.page.spec.ts b/src/app/profile/guest-edit/guest-edit.page.spec.ts index da0fc0267..031b60440 100644 --- a/src/app/profile/guest-edit/guest-edit.page.spec.ts +++ b/src/app/profile/guest-edit/guest-edit.page.spec.ts @@ -24,7 +24,8 @@ import { ImpressionType, ObjectType, LoginHandlerService, - OnboardingConfigurationService + OnboardingConfigurationService, + FormAndFrameworkUtilService } from '../../../services'; import { Location } from '@angular/common'; import { of, Subscription, throwError } from 'rxjs'; @@ -101,6 +102,8 @@ describe('GuestEditPage', () => { getAppConfig: jest.fn(() => mockOnboardingConfigData) }; + const mockFormAndFrameworkUtilService: Partial = {}; + beforeAll(() => { guestEditPage = new GuestEditPage( mockProfileService as ProfileService, @@ -118,7 +121,8 @@ describe('GuestEditPage', () => { mockLocation as Location, mockProfileHandler as ProfileHandler, mockSegmentationTagService as SegmentationTagService, - mockOnBoardingConfigService as OnboardingConfigurationService + mockOnBoardingConfigService as OnboardingConfigurationService, + mockFormAndFrameworkUtilService as FormAndFrameworkUtilService ); }); diff --git a/src/app/profile/guest-edit/guest-edit.page.ts b/src/app/profile/guest-edit/guest-edit.page.ts index 79e67e16e..165aa9161 100644 --- a/src/app/profile/guest-edit/guest-edit.page.ts +++ b/src/app/profile/guest-edit/guest-edit.page.ts @@ -36,7 +36,7 @@ import { Location } from '@angular/common'; import { Observable, Subscription, combineLatest } from 'rxjs'; import { delay, tap } from 'rxjs/operators'; import { ProfileHandler } from '@app/services/profile-handler'; -import { OnboardingConfigurationService } from '@app/services'; +import { FormAndFrameworkUtilService, OnboardingConfigurationService } from '@app/services'; import { SegmentationTagService, TagPrefixConstants } from '@app/services/segmentation-tag/segmentation-tag.service'; @Component({ @@ -140,7 +140,8 @@ export class GuestEditPage implements OnInit, OnDestroy { private location: Location, private profileHandler: ProfileHandler, private segmentationTagService: SegmentationTagService, - private onboardingConfigurationService: OnboardingConfigurationService + private onboardingConfigurationService: OnboardingConfigurationService, + private formAndFrameworkUtilService: FormAndFrameworkUtilService ) { if (this.router.getCurrentNavigation().extras.state) { this.isNewUser = Boolean(this.router.getCurrentNavigation().extras.state.isNewUser); @@ -169,6 +170,7 @@ export class GuestEditPage implements OnInit, OnDestroy { } async ngOnInit() { + await this.getCategories(); this.telemetryGeneratorService.generateImpressionTelemetry( ImpressionType.VIEW, '', PageId.CREATE_USER, @@ -637,4 +639,8 @@ export class GuestEditPage implements OnInit, OnDestroy { return subscriptionArray; } + private async getCategories() { + this.categories = await this.formAndFrameworkUtilService.getFrameworkCategories(); + } + } diff --git a/src/app/profile/guest-profile/guest-profile.page.html b/src/app/profile/guest-profile/guest-profile.page.html index 7f372eec1..c76d23814 100644 --- a/src/app/profile/guest-profile/guest-profile.page.html +++ b/src/app/profile/guest-profile/guest-profile.page.html @@ -56,8 +56,8 @@ -
{{'' | category: 'category1'}}
+
{{frameworkData[0].label | translateJson}}
@@ -75,8 +75,8 @@
-
{{'' | category: 'category2'}}
+
{{frameworkData[1].label | translateJson}}
-
{{'' | category: 'category3'}}
+
{{frameworkData[2].label | translateJson}}
-
{{'' | category: 'category4'}}
+
{{frameworkData[3].label | translateJson}}
{ if (upgrade && !this.isUpgradePopoverShown) { @@ -290,4 +292,8 @@ export class GuestProfilePage implements OnInit { } signin() { this.router.navigate([RouterLinks.SIGN_IN]); } + + private async getCategories() { + this.frameworkData = await this.formAndFrameworkUtilService.getFrameworkCategories(); + } } diff --git a/src/app/profile/profile.page.html b/src/app/profile/profile.page.html index fac7be1b9..502c71219 100644 --- a/src/app/profile/profile.page.html +++ b/src/app/profile/profile.page.html @@ -101,22 +101,12 @@
-
-
- {{'BOARD' | translate }}: - {{profile?.framework?.board.join(', ') | aliased}} ‎ -
-
- {{'MEDIUM' | translate }}: - {{profile?.framework?.medium.join(', ')}} -
-
- {{'CLASSES' | translate }}: - {{profile?.framework?.gradeLevel.join(', ')}} -
-
- {{'SUBJECTS' | translate }}: - {{profile?.framework?.subject.join(', ')}} +
+
+
+ {{category.label | translateJson}}: + {{profile?.framework[category.value].join(', ') | aliased}} ‎ +
diff --git a/src/app/profile/profile.page.spec.ts b/src/app/profile/profile.page.spec.ts index 3dd89cfcc..553925595 100644 --- a/src/app/profile/profile.page.spec.ts +++ b/src/app/profile/profile.page.spec.ts @@ -33,6 +33,7 @@ import { NavigationService } from '../../services/navigation-handler.service'; import { ProfileHandler } from '../../services/profile-handler'; import { SegmentationTagService } from '../../services/segmentation-tag/segmentation-tag.service'; import { CertificateService } from '@project-sunbird/sunbird-sdk'; +import { LocationHandler } from '../../services/location-handler'; describe('Profile.page', () => { let profilePage: ProfilePage; @@ -144,6 +145,7 @@ describe('Profile.page', () => { const mockSegmentationTagService: Partial = { evalCriteria: jest.fn() }; + const mockLocationHandler: Partial = {}; beforeAll(() => { profilePage = new ProfilePage( @@ -174,7 +176,8 @@ describe('Profile.page', () => { mockCertificateDownloadPdfService as CertificateDownloadAsPdfService, mockProfileHandler as ProfileHandler, mockSegmentationTagService as SegmentationTagService, - mockPlatform as Platform + mockPlatform as Platform, + mockLocationHandler as LocationHandler ); }); @@ -521,9 +524,10 @@ describe('Profile.page', () => { // arrange jest.spyOn(profilePage, 'doRefresh').mockImplementation(); mockAppVersion.getAppName = jest.fn(() => Promise.resolve('sample_app_name')); + mockFormAndFrameworkUtilService.getFrameworkCategories = jest.fn(() => Promise.resolve()); // act profilePage.ngOnInit().then(() => { - + expect(mockFormAndFrameworkUtilService.getFrameworkCategories).toHaveBeenCalled(); expect(mockAppVersion.getAppName).toHaveBeenCalled(); // assert done(); diff --git a/src/app/profile/profile.page.ts b/src/app/profile/profile.page.ts index bd073c529..bdcf0f50e 100644 --- a/src/app/profile/profile.page.ts +++ b/src/app/profile/profile.page.ts @@ -152,6 +152,7 @@ export class ProfilePage implements OnInit { learnerPassbook: any[] = []; learnerPassbookCount: any; enrolledCourseList = []; + categories: any; constructor( @Inject('PROFILE_SERVICE') private profileService: ProfileService, @Inject('AUTH_SERVICE') private authService: AuthService, @@ -217,6 +218,7 @@ export class ProfilePage implements OnInit { } async ngOnInit() { + await this.getCategories(); this.doRefresh(); this.appName = await this.appVersion.getAppName(); } @@ -1234,4 +1236,7 @@ export class ProfilePage implements OnInit { return displayValues; } + private async getCategories() { + this.categories = await this.formAndFrameworkUtilService.getFrameworkCategories(); + } } \ No newline at end of file diff --git a/src/services/formandframeworkutil.service.ts b/src/services/formandframeworkutil.service.ts index 2eb3d0970..eab5a5dae 100644 --- a/src/services/formandframeworkutil.service.ts +++ b/src/services/formandframeworkutil.service.ts @@ -727,4 +727,8 @@ export class FormAndFrameworkUtilService { return filterCriteria; } + async getFrameworkCategories() { + return (await this.getFormFields(FormConstants.FRAMEWORK_CONFIG).then() as any); + } + } From 462cf008b58f14b43770ee214c22f7642eefa931 Mon Sep 17 00:00:00 2001 From: Ajoymaity Date: Wed, 16 Nov 2022 20:09:14 +0530 Subject: [PATCH 2/2] Issue #SB-0000 feat: Implemented BMG form config --- src/app/profile-settings/profile-settings.page.ts | 6 ++++-- .../profile/categories-edit/categories-edit.page.ts | 8 +++++--- src/app/profile/guest-edit/guest-edit.page.spec.ts | 4 ++++ src/app/profile/guest-edit/guest-edit.page.ts | 8 +++++--- src/app/profile/guest-profile/guest-profile.page.ts | 10 ++++++---- src/app/profile/profile.page.ts | 8 +++++--- 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/app/profile-settings/profile-settings.page.ts b/src/app/profile-settings/profile-settings.page.ts index 9c7399c49..a3ef1c2df 100644 --- a/src/app/profile-settings/profile-settings.page.ts +++ b/src/app/profile-settings/profile-settings.page.ts @@ -828,8 +828,10 @@ export class ProfileSettingsPage implements OnInit, OnDestroy, AfterViewInit { }); } - private async fetchCategories() { - this.categories = await this.formAndFrameworkUtilService.getFrameworkCategories(); + private fetchCategories() { + this.formAndFrameworkUtilService.getFrameworkCategories().then((categories) => { + this.categories = categories; + }); } } diff --git a/src/app/profile/categories-edit/categories-edit.page.ts b/src/app/profile/categories-edit/categories-edit.page.ts index c1b994a82..51946341b 100644 --- a/src/app/profile/categories-edit/categories-edit.page.ts +++ b/src/app/profile/categories-edit/categories-edit.page.ts @@ -162,7 +162,7 @@ export class CategoriesEditPage implements OnInit, OnDestroy { } async ngOnInit() { - await this.getCategories(); + this.getCategories(); this.supportedProfileAttributes = await this.profileHandler.getSupportedProfileAttributes(false); const subscriptionArray: Array = this.updateAttributeStreamsnSetValidators(this.supportedProfileAttributes); this.formControlSubscriptions = combineLatest(subscriptionArray).subscribe(); @@ -585,7 +585,9 @@ export class CategoriesEditPage implements OnInit, OnDestroy { }); } - private async getCategories() { - this.frameworkData = await this.formAndFrameworkUtilService.getFrameworkCategories(); + private getCategories() { + this.formAndFrameworkUtilService.getFrameworkCategories().then((categories) => { + this.frameworkData = categories; + }); } } diff --git a/src/app/profile/guest-edit/guest-edit.page.spec.ts b/src/app/profile/guest-edit/guest-edit.page.spec.ts index 031b60440..3ac6ccfaa 100644 --- a/src/app/profile/guest-edit/guest-edit.page.spec.ts +++ b/src/app/profile/guest-edit/guest-edit.page.spec.ts @@ -616,6 +616,7 @@ describe('GuestEditPage', () => { describe('ngOnInit', () => { it('should generate INTERACT and IMPRESSION telemetry for existing User', (done) => { // arrange + mockFormAndFrameworkUtilService.getFrameworkCategories = jest.fn(() => Promise.resolve()); const dismissFn = jest.fn(() => Promise.resolve()); const presentFn = jest.fn(() => Promise.resolve()); mockCommonUtilService.getLoader = jest.fn(() => Promise.resolve({ @@ -651,6 +652,7 @@ describe('GuestEditPage', () => { // act guestEditPage.ngOnInit(); setTimeout(() => { + expect(mockFormAndFrameworkUtilService.getFrameworkCategories).toHaveBeenCalled(); expect(mockTelemetryGeneratorService.generateInteractTelemetry).toHaveBeenCalledWith( InteractType.TOUCH, InteractSubtype.EDIT_USER_INITIATED, @@ -670,6 +672,7 @@ describe('GuestEditPage', () => { it('should populate the supported attributes', (done) => { // arrange + mockFormAndFrameworkUtilService.getFrameworkCategories = jest.fn(() => Promise.resolve()); mockOnBoardingConfigService.getAppConfig = jest.fn(() => mockOnboardingConfigData); mockProfileHandler.getSupportedProfileAttributes = jest.fn(() => Promise.resolve( { @@ -692,6 +695,7 @@ describe('GuestEditPage', () => { guestEditPage.ngOnInit(); setTimeout(() => { // assert + expect(mockFormAndFrameworkUtilService.getFrameworkCategories).toHaveBeenCalled(); expect(guestEditPage.supportedProfileAttributes).toEqual({ board: 'board', medium: 'medium', diff --git a/src/app/profile/guest-edit/guest-edit.page.ts b/src/app/profile/guest-edit/guest-edit.page.ts index 165aa9161..0c3606c3e 100644 --- a/src/app/profile/guest-edit/guest-edit.page.ts +++ b/src/app/profile/guest-edit/guest-edit.page.ts @@ -170,7 +170,7 @@ export class GuestEditPage implements OnInit, OnDestroy { } async ngOnInit() { - await this.getCategories(); + this.getCategories(); this.telemetryGeneratorService.generateImpressionTelemetry( ImpressionType.VIEW, '', PageId.CREATE_USER, @@ -639,8 +639,10 @@ export class GuestEditPage implements OnInit, OnDestroy { return subscriptionArray; } - private async getCategories() { - this.categories = await this.formAndFrameworkUtilService.getFrameworkCategories(); + private getCategories() { + this.formAndFrameworkUtilService.getFrameworkCategories().then((categories) => { + this.categories = categories; + }); } } diff --git a/src/app/profile/guest-profile/guest-profile.page.ts b/src/app/profile/guest-profile/guest-profile.page.ts index 0c8de977b..0559d6a39 100644 --- a/src/app/profile/guest-profile/guest-profile.page.ts +++ b/src/app/profile/guest-profile/guest-profile.page.ts @@ -73,7 +73,7 @@ export class GuestProfilePage implements OnInit { async ngOnInit() { this.selectedLanguage = this.translate.currentLang; - await this.getCategories(); + this.getCategories(); // Event for optional and forceful upgrade this.events.subscribe('force_optional_upgrade', async (upgrade) => { if (upgrade && !this.isUpgradePopoverShown) { @@ -94,7 +94,7 @@ export class GuestProfilePage implements OnInit { this.refreshSignInCard(); this.appGlobalService.generateConfigInteractEvent(PageId.GUEST_PROFILE); - const rootOrgId = this.onboardingConfigurationService.getAppConfig().overriddenDefaultChannelId + const rootOrgId = this.onboardingConfigurationService.getAppConfig().overriddenDefaultChannelId; this.supportedProfileAttributes = await this.profileHandler.getSupportedProfileAttributes(undefined, undefined, rootOrgId); } @@ -293,7 +293,9 @@ export class GuestProfilePage implements OnInit { signin() { this.router.navigate([RouterLinks.SIGN_IN]); } - private async getCategories() { - this.frameworkData = await this.formAndFrameworkUtilService.getFrameworkCategories(); + private getCategories() { + this.formAndFrameworkUtilService.getFrameworkCategories().then((categories) => { + this.frameworkData = categories; + }); } } diff --git a/src/app/profile/profile.page.ts b/src/app/profile/profile.page.ts index bdcf0f50e..4a9edcd2f 100644 --- a/src/app/profile/profile.page.ts +++ b/src/app/profile/profile.page.ts @@ -218,7 +218,7 @@ export class ProfilePage implements OnInit { } async ngOnInit() { - await this.getCategories(); + this.getCategories(); this.doRefresh(); this.appName = await this.appVersion.getAppName(); } @@ -1236,7 +1236,9 @@ export class ProfilePage implements OnInit { return displayValues; } - private async getCategories() { - this.categories = await this.formAndFrameworkUtilService.getFrameworkCategories(); + private getCategories() { + this.formAndFrameworkUtilService.getFrameworkCategories().then((categories) => { + this.categories = categories; + }); } } \ No newline at end of file