Skip to content

Commit

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

Issue #SH-21 feat: Added the updated CC version.
  • Loading branch information
AmiableAnil authored Jun 30, 2020
2 parents 8e3f0cf + 3947e61 commit 98d3bed
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 48 deletions.
5 changes: 5 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ var formRequestArray = [{
'type': 'user',
'subType': 'manageduser',
'action': 'create'
},
{
'type': 'group',
'subType': 'activities',
'action': 'list'
}
];

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"@project-sunbird/client-services": "^3.1.3",
"@project-sunbird/common-consumption": "^3.0.26",
"@project-sunbird/common-consumption": "^3.1.0",
"@project-sunbird/content-player": "3.1.0",
"@project-sunbird/sunbird-sdk": "~3.1.3",
"code-push": "^3.0.1",
Expand Down Expand Up @@ -97,7 +97,7 @@
"ionic4-rating": "^1.0.9",
"rxjs": "^6.5.3",
"sb-cordova-plugin-customtabs": "git+https://github.com/Sunbird-Ed/sb-cordova-plugin-customtabs.git",
"sb-cordova-plugin-db": "git+https://github.com/Sunbird-Ed/sb-cordova-plugin-db.git",
"sb-cordova-plugin-db": "git+https://github.com/Sunbird-Ed/sb-cordova-plugin-db.git#release-3.1.0",
"sb-cordova-plugin-sync": "git+https://github.com/swayangjit/sb-cordova-plugin-sync.git",
"sb-cordova-plugin-utility": "git+https://github.com/Sunbird-Ed/sb-cordova-plugin-utility.git#release-3.0.0",
"tslib": "^1.10.0",
Expand Down
20 changes: 10 additions & 10 deletions src/app/components/profile-avatar/profile-avatar.component.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
import { Component, Input, OnInit, OnChanges } from '@angular/core';
import GraphemeSplitter from 'grapheme-splitter';
import { CommonUtilService } from '@app/services';

@Component({
selector: 'app-profile-avatar',
templateUrl: './profile-avatar.component.html',
styleUrls: ['./profile-avatar.component.scss'],
})
export class ProfileAvatarComponent implements OnInit , OnChanges {
export class ProfileAvatarComponent implements OnInit, OnChanges {
@Input() username: string;
@Input() isStateUser: boolean;
bgColor: string;
color: string;
initial: string;
// GraphemeSplitter = require('grapheme-splitter');
constructor() { }

constructor(
private commonUtilService: CommonUtilService,
) { }

ngOnInit() {
this.extractInitial();
}

/**
* It will detect the changes of username and call the extractInitial() method
* @param changes
*/
ngOnChanges(changes: any) {
this.username = changes.username.currentValue;
Expand Down Expand Up @@ -58,12 +60,10 @@ export class ProfileAvatarComponent implements OnInit , OnChanges {
}

/**
* It will extract the first character of the user name and return with different BG color
*/
* It will extract the first character of the user name and return with different BG color
*/
extractInitial() {
const splitter = new GraphemeSplitter();
const split: string[] = splitter.splitGraphemes(this.username.trim());
this.initial = split[0];
this.initial = this.commonUtilService.extractInitial(this.username);
if (this.initial) {
this.getBgColor(this.username);
}
Expand Down
11 changes: 6 additions & 5 deletions src/app/my-groups/activity-details/activity-details.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
<sb-course-card [section]="null"></sb-course-card>
<div class="gd-member-search">
<ion-icon class="gd-member-search-icon" md="md-search"></ion-icon>
<input type="text" [(ngModel)]="searchMember" (ngModelChange)="onSearch(searchMember)" placeholder="{{'SEARCH_FOR_GROUP_MEMBER' | translate}}">
<input type="text" [(ngModel)]="searchMember" (ngModelChange)="onSearch(searchMember)"
placeholder="{{'SEARCH_FOR_GROUP_MEMBER' | translate}}">
</div>
<div class="ad-timestamp" [innerHTML]="'LAST_UPDATED' | translate: {'%s': timeStamp || 'time' }">
</div>
<div class="ad-mebers-container">
<div *ngFor="let member of memberList">
<div *ngFor="let member of memberList; let i = index">
<sb-member-card [config]="{size:'medium', isBold:false, isSelectable:false, view:'horizontal'}"
[identifier]="member.identifier" [initial]="member.initial" [title]="member.title" [isMenu]="member.isMenu"
[isAdmin]="member.isAdmin" (menuClick)="memberMenuClick($event)">
[identifier]="member.identifier" [indexOfMember]="i"
[initial]="commonUtilService.extractInitial(member.title)" [title]="member.title" [isAdmin]="member.isAdmin">
</sb-member-card>
</div>
</div>
</div>

</ion-content>
11 changes: 10 additions & 1 deletion src/app/my-groups/activity-details/activity-details.page.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { CommonUtilService } from '@app/services';

@Component({
selector: 'app-activity-details',
templateUrl: './activity-details.page.html',
styleUrls: ['./activity-details.page.scss'],
})
export class ActivityDetailsPage implements OnInit {

timeStamp = '';
memberList: any;

constructor(
private router: Router
private router: Router,
private commonUtilService: CommonUtilService,
) {
const extras = this.router.getCurrentNavigation().extras.state;
this.memberList = extras.memberList;
Expand All @@ -19,4 +24,8 @@ export class ActivityDetailsPage implements OnInit {
ngOnInit() {
}

onSearch(text) {
console.log('onsearch', text);
}

}
9 changes: 5 additions & 4 deletions src/app/my-groups/group-details/group-details.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@
{{'ADD_MEMBER' | translate}}
</span>
</div>
<div *ngFor="let member of memberList">
<div *ngFor="let member of memberList; let i = index">
<sb-member-card [config]="{size:'medium', isBold:false, isSelectable:false, view:'horizontal'}"
[identifier]="member.identifier" [initial]="member.initial" [title]="member.title" [isMenu]="member.isMenu"
[identifier]="member.identifier" [indexOfMember]="i"
[initial]="commonUtilService.extractInitial(member.title)" [title]="member.title" [isMenu]="member.isMenu"
[isAdmin]="member.isAdmin" (menuClick)="memberMenuClick($event)">
</sb-member-card>
</div>
Expand All @@ -52,8 +53,8 @@
<ion-icon class="gd-member-search-icon" md="md-search"></ion-icon>
<input type="text" [(ngModel)]="searchMember" (ngModelChange)="onSearch(searchMember)">
</div>
<sb-course-card [section]="null" (click)="navigateToActivityDetails()"></sb-course-card>

<sb-course-card [section]="null" (click)="navigateToActivityDetails($event)" [isMenu]="true"
(menuClick)="activityMenuClick($event)"></sb-course-card>

<!-- <sb-course-card *ngIf="!course.isEnrolledCourse" [course]="course" [section]="null" [cardImg]="course.appIcon"
(click)="openCourseDetails(course)"></sb-course-card> -->
Expand Down
4 changes: 2 additions & 2 deletions src/app/my-groups/group-details/group-details.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export class GroupDetailsPage {
}
}

async activityMenuClick() {
async activityMenuClick(event) {
// this.telemetryGeneratorService.generateInteractTelemetry(
// InteractType.TOUCH,
// InteractSubtype.SORT_OPTION_CLICKED,
Expand Down Expand Up @@ -405,7 +405,7 @@ export class GroupDetailsPage {
return split[0];
}

navigateToActivityDetails() {
navigateToActivityDetails(event) {
const navigationExtras: NavigationExtras = {
state: {
groupId: this.groupId,
Expand Down
9 changes: 5 additions & 4 deletions src/app/my-groups/my-groups.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
{{'MY_GROUPS' | translate}}
<img *ngIf="!isGuestUser" src="assets/imgs/ic_group_add_blue.svg" (click)="createClassroom()">
</p>


<div *ngIf="isGuestUser" class="my-cr-card">
<div class="my-cr-card-img">
<img src="assets/imgs/ic_my_groups.svg">
Expand Down Expand Up @@ -33,9 +33,10 @@
</div>

<div *ngFor="let group of groupList">
<sb-group-card [group]="group" [title]="group.name" [subTitle]="group.subTitle" [cardImg]="'https://cdn1.iconfinder.com/data/icons/back-to-school-37/24/school-512.png'" [isLoading]="groupListLoader" (cardClick)="navigateToGroupdetailsPage($event)"></sb-group-card>
<sb-group-card [isMobile]="true" [group]="group" [isLoading]="groupListLoader"
(cardClick)="navigateToGroupdetailsPage($event)"></sb-group-card>
</div>

</div>

</ion-content>
51 changes: 31 additions & 20 deletions src/services/common-util.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { SbPopoverComponent } from '@app/app/components/popups';
import { AndroidPermissionsStatus } from './android-permissions/android-permission';
import { Router } from '@angular/router';
import { AndroidPermissionsService } from './android-permissions/android-permissions.service';
import GraphemeSplitter from 'grapheme-splitter';

declare const FCMPlugin;
export interface NetworkInfo {
Expand Down Expand Up @@ -186,7 +187,7 @@ export class CommonUtilService {
* Show popup with Try Again and Skip button.
* @param source Page from alert got called
*/
async showContentComingSoonAlert(source, dialCode?) {
async showContentComingSoonAlert(source, dialCode?) {
this.telemetryGeneratorService.generateInteractTelemetry(
InteractType.OTHER,
InteractSubtype.QR_CODE_COMINGSOON,
Expand Down Expand Up @@ -245,10 +246,10 @@ export class CommonUtilService {
await qrAlert.present();
const corRelationList: CorrelationData[] = [{
id: this.translateMessage(heading) === this.translateMessage('INVALID_QR') ?
InteractSubtype.QR_CODE_INVALID : InteractSubtype.QR_NOT_LINKED,
InteractSubtype.QR_CODE_INVALID : InteractSubtype.QR_NOT_LINKED,
type: CorReleationDataType.CHILD_UI
}];
corRelationList.push({id: dialCode, type: ObjectType.QR});
corRelationList.push({ id: dialCode, type: ObjectType.QR });
// generate impression telemetry
this.telemetryGeneratorService.generateImpressionTelemetry(
InteractType.POPUP_LOADED, '',
Expand All @@ -263,15 +264,15 @@ export class CommonUtilService {
const { data } = await qrAlert.onDidDismiss();
// generate interact telemetry for close popup
this.telemetryGeneratorService.generateInteractTelemetry(
InteractType.SELECT_CLOSE,
data ? (data.isLeftButtonClicked ? InteractSubtype.CTA : InteractSubtype.CLOSE_ICON) : InteractSubtype.OUTSIDE,
source === PageId.ONBOARDING_PROFILE_PREFERENCES ? Environment.ONBOARDING : Environment.HOME,
source === PageId.ONBOARDING_PROFILE_PREFERENCES ? PageId.SCAN_OR_MANUAL : PageId.HOME,
undefined,
undefined,
undefined,
corRelationList
);
InteractType.SELECT_CLOSE,
data ? (data.isLeftButtonClicked ? InteractSubtype.CTA : InteractSubtype.CLOSE_ICON) : InteractSubtype.OUTSIDE,
source === PageId.ONBOARDING_PROFILE_PREFERENCES ? Environment.ONBOARDING : Environment.HOME,
source === PageId.ONBOARDING_PROFILE_PREFERENCES ? PageId.SCAN_OR_MANUAL : PageId.HOME,
undefined,
undefined,
undefined,
corRelationList
);
}

/**
Expand Down Expand Up @@ -576,16 +577,26 @@ export class CommonUtilService {

async presentToastForOffline(msg: string) {
this.toast = await this.toastController.create({
duration: 3000,
message: this.translateMessage(msg),
showCloseButton: true,
position: 'top',
closeButtonText: 'X',
cssClass: ['toastHeader', 'offline']
duration: 3000,
message: this.translateMessage(msg),
showCloseButton: true,
position: 'top',
closeButtonText: 'X',
cssClass: ['toastHeader', 'offline']
});
await this.toast.present();
this.toast.onDidDismiss(() => {
this.toast = undefined;
this.toast = undefined;
});
}
}

extractInitial(name) {
let initial = '';
if (name) {
const splitter = new GraphemeSplitter();
const split: string[] = splitter.splitGraphemes(name.trim());
initial = split[0];
}
return initial;
}
}

0 comments on commit 98d3bed

Please sign in to comment.