diff --git a/src/app/home/user-home/user-home.page.ts b/src/app/home/user-home/user-home.page.ts index aaf07f8f63..8be18b66ae 100644 --- a/src/app/home/user-home/user-home.page.ts +++ b/src/app/home/user-home/user-home.page.ts @@ -316,8 +316,8 @@ export class UserHomePage implements OnInit, OnDestroy, OnTabViewWillEnter { return contentSearchCriteria; }, from: refresher ? CachedItemRequestSourceFrom.SERVER : CachedItemRequestSourceFrom.CACHE }; - const rootOrgId = this.onboardingConfigurationService.getAppConfig().overriddenDefaultChannelId - let displayItems = await this.contentAggregatorHandler.newAggregate(request, AggregatorPageType.HOME, rootOrgId); + const rootOrgId = this.onboardingConfigurationService.getAppConfig().overriddenDefaultChannelId; + let displayItems = await this.contentAggregatorHandler.newAggregate(request, AggregatorPageType.HOME, rootOrgId, this.profile.syllabus[0]); await this.getOtherMLCategories(); displayItems = this.mapContentFacteTheme(displayItems); this.checkHomeData(displayItems); diff --git a/src/services/content/content-aggregator-handler.service.ts b/src/services/content/content-aggregator-handler.service.ts index 8351c90f51..ffb3c101cb 100644 --- a/src/services/content/content-aggregator-handler.service.ts +++ b/src/services/content/content-aggregator-handler.service.ts @@ -2,7 +2,7 @@ import { Inject, Injectable } from '@angular/core'; import { FormConstants } from '../../app/form.constants'; import { ContentAggregatorResponse, ContentService, CourseService, - FormService, ProfileService + FormService, ProfileService, SharedPreferences } from '@project-sunbird/sunbird-sdk'; import { DataSourceType } from '@project-sunbird/sunbird-sdk/content/handlers/content-aggregator'; import { AppGlobalService } from '../app-global-service.service'; @@ -26,6 +26,7 @@ export class ContentAggregatorHandler { @Inject('FORM_SERVICE') private formService: FormService, @Inject('PROFILE_SERVICE') private profileService: ProfileService, @Inject('CONTENT_SERVICE') private contentService: ContentService, + @Inject('SHARED_PREFERENCES') private preferences: SharedPreferences, public commonUtilService: CommonUtilService, private appGlobalService: AppGlobalService, ) { } @@ -68,16 +69,19 @@ export class ContentAggregatorHandler { } - async newAggregate(request, pageName: AggregatorPageType, rootOrgId?: string): Promise { + async newAggregate(request, pageName: AggregatorPageType, rootOrgId?: string, frameworkId?: string): Promise { let dataSrc: DataSourceType[] = ['TRACKABLE_COLLECTIONS']; if (this.appGlobalService.isUserLoggedIn()) { dataSrc = []; } + if (!rootOrgId) { + rootOrgId = await this.preferences.getString('defaultRootOrgId').toPromise(); + } try { this.aggregatorResponse = await this.aggregateContent(request, dataSrc, - {...FormConstants.CONTENT_AGGREGATOR, subType: pageName, rootOrgId: rootOrgId || '*'}); + {...FormConstants.CONTENT_AGGREGATOR, subType: pageName, framework: frameworkId || '*', rootOrgId: rootOrgId || '*'}); return this.aggregatorResponse.result; } catch (e) { console.error(e);