Skip to content

Commit

Permalink
Issue #SH-21 merge: Merge pull request #1049 from AmiableAnil/Release…
Browse files Browse the repository at this point in the history
…-3.1.0-router

Issue #SH-21 feat: Enabled the lazy loading.
  • Loading branch information
swayangjit authored Jul 9, 2020
2 parents 91273f8 + 6e6bc4f commit f532417
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 51 deletions.
2 changes: 1 addition & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"vendor": true
},
"styles": [
"node_modules/common-consumption-styles/assets/_styles.scss",
"node_modules/@project-sunbird/sb-styles/assets/_styles.scss",
{
"input": "src/global.scss"
}
Expand Down
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@
"@ionic/angular": "^4.11.2",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"@project-sunbird/client-services": "^3.1.10",
"@project-sunbird/common-consumption": "^3.1.6",
"@project-sunbird/client-services": "^3.1.13",
"@project-sunbird/common-consumption": "^3.1.8",
"@project-sunbird/content-player": "3.1.0",
"@project-sunbird/sunbird-sdk": "~3.1.9",
"@project-sunbird/sunbird-sdk": "~3.1.10",
"@project-sunbird/sb-styles": "0.0.1",
"code-push": "^3.0.1",
"com.jjdltc.cordova.plugin.zip": "https://github.com/swayangjit/jjdltc-cordova-plugin-zip.git",
"com.telerik.plugins.nativepagetransitions": "^0.6.5",
"common-consumption-styles": "0.0.14",
"cordova-android": "^8.1.0",
"cordova-android-support-gradle-release": "^3.0.1",
"cordova-plugin-advanced-http": "^2.4.1",
Expand Down
10 changes: 7 additions & 3 deletions src/app/my-groups/my-groups.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div>
</div>

<div *ngIf="!isGuestUser && !groupList.length" class="my-cr-card">
<div *ngIf="!isGuestUser && !groupList.length && !groupListLoader" class="my-cr-card">
<div class="my-cr-card-img">
<img src="assets/imgs/ic_my_groups.svg" alt="my-group">
</div>
Expand All @@ -33,8 +33,12 @@
</div>

<div *ngFor="let group of groupList">
<sb-group-card [isMobile]="true" [group]="group" [isLoading]="groupListLoader"
(cardClick)="navigateToGroupdetailsPage($event)"></sb-group-card>
<sb-group-card [isMobile]="true" [group]="group" (cardClick)="navigateToGroupdetailsPage($event)"></sb-group-card>
</div>
<div *ngIf="!isGuestUser && groupListLoader">
<div *ngFor="let item of [0,1,2,3,4,5,6,7,8,9,10]">
<sb-group-card [isMobile]="true" [isLoading]="true"></sb-group-card>
</div>
</div>

</div>
Expand Down
58 changes: 32 additions & 26 deletions src/app/my-groups/my-groups.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import {
PageId,
Environment, InteractType, InteractSubtype
} from '@app/services';
import {Platform, PopoverController} from '@ionic/angular';
import { Platform, PopoverController } from '@ionic/angular';
import { MyGroupsPopoverComponent } from '../components/popups/sb-my-groups-popover/sb-my-groups-popover.component';
import { animationGrowInTopRight } from '../animations/animation-grow-in-top-right';
import { animationShrinkOutTopRight } from '../animations/animation-shrink-out-top-right';
import {SbProgressLoader} from '@app/services/sb-progress-loader.service';
import {Subscription} from 'rxjs';
import {Location} from '@angular/common';
import { SbProgressLoader } from '@app/services/sb-progress-loader.service';
import { Subscription } from 'rxjs';
import { Location } from '@angular/common';

interface GroupData extends Group {
initial: string;
Expand Down Expand Up @@ -57,6 +57,9 @@ export class MyGroupsPage implements OnInit, OnDestroy {

ngOnInit() {
this.checkUserLoggedIn();
if (!this.isGuestUser) {
this.groupListLoader = true;
}
this.appGlobalService.getActiveProfileUid()
.then(async (uid) => {
this.userId = uid;
Expand All @@ -81,13 +84,15 @@ export class MyGroupsPage implements OnInit, OnDestroy {
}

async ionViewDidEnter() {
this.sbProgressLoader.hide({id: 'login'});
this.fetchGroupList();
this.sbProgressLoader.hide({ id: 'login' });
if (!this.isGuestUser) {
this.fetchGroupList();
}
this.telemetryGeneratorService.generateImpressionTelemetry(
ImpressionType.VIEW,
'',
PageId.MY_GROUP,
Environment.GROUP
ImpressionType.VIEW,
'',
PageId.MY_GROUP,
Environment.GROUP
);
}

Expand All @@ -106,29 +111,29 @@ export class MyGroupsPage implements OnInit, OnDestroy {
case 'groupInfo':
this.openinfopopup();
break;
case 'back':
this.telemetryGeneratorService.generateBackClickedTelemetry(PageId.MY_GROUP, Environment.GROUP, true);
this.location.back();
break;
case 'back':
this.telemetryGeneratorService.generateBackClickedTelemetry(PageId.MY_GROUP, Environment.GROUP, true);
this.location.back();
break;
}
}

createClassroom() {
this.telemetryGeneratorService.generateInteractTelemetry(
InteractType.TOUCH,
InteractSubtype.CREATE_GROUP_CLICKED,
Environment.GROUP,
PageId.MY_GROUP
InteractType.TOUCH,
InteractSubtype.CREATE_GROUP_CLICKED,
Environment.GROUP,
PageId.MY_GROUP
);
this.router.navigate([`/${RouterLinks.MY_GROUPS}/${RouterLinks.CREATE_EDIT_GROUP}`]);
}

login() {
this.telemetryGeneratorService.generateInteractTelemetry(
InteractType.TOUCH,
InteractSubtype.LOGIN_CLICKED,
Environment.GROUP,
PageId.MY_GROUP
InteractType.TOUCH,
InteractSubtype.LOGIN_CLICKED,
Environment.GROUP,
PageId.MY_GROUP
);
this.loginHandlerService.signIn({ skipRootNavigation: true });
}
Expand All @@ -154,7 +159,8 @@ export class MyGroupsPage implements OnInit, OnDestroy {
});
this.groupListLoader = false;
console.log('this.groupList', this.groupList);
} catch {
} catch (e) {
console.error(e);
this.groupListLoader = false;
}
}
Expand Down Expand Up @@ -193,9 +199,9 @@ export class MyGroupsPage implements OnInit, OnDestroy {
private handleBackButton() {
this.unregisterBackButton = this.platform.backButton.subscribeWithPriority(10, () => {
this.telemetryGeneratorService.generateBackClickedTelemetry(
PageId.MY_GROUP,
Environment.GROUP,
false);
PageId.MY_GROUP,
Environment.GROUP,
false);
this.location.back();
});
}
Expand Down

0 comments on commit f532417

Please sign in to comment.