Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into humming-bird-school
Browse files Browse the repository at this point in the history
  • Loading branch information
nidhikachhawa24 committed May 31, 2024
2 parents 7fc496a + 223d56c commit 960ae01
Show file tree
Hide file tree
Showing 36 changed files with 246 additions and 68 deletions.
6 changes: 6 additions & 0 deletions package-lock.json

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

2 changes: 0 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ export class AppComponent implements OnInit {
case 'VERSION_DETECTED':
console.log(`Downloading new app version: ${evt.version.hash}`);
this.presentUpdateAlert();
// if (confirm('A new version is available. Load it?'))
// window.location.reload();
break;
case 'VERSION_READY':
console.log(`Current app version: ${evt.currentVersion.hash}`);
Expand Down
15 changes: 12 additions & 3 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,20 @@ export function initializeFactory(init: DbService) {
})

export class AppModule {
constructor(private translate: TranslateService) {
this.setDefaultLanguage();
}
constructor(private translate: TranslateService, private storage: StorageService) {
this.storage.getData('lang').then(lang =>{
console.log(lang);
if(!lang)
{
this.setDefaultLanguage();
}
});

}


private setDefaultLanguage() {
this.storage.setData('lang', 'hi');
this.translate.setDefaultLang('hi');
this.translate.use("hi");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
</ion-button>
</ion-buttons>
<ion-title role="heading" [ngClass]="{'title_bb': headerConfig?.showbackButton, 'animate_title': headerConfig?.pageTitle == appName}" aria-level="1"
*ngIf="!(headerConfig?.showbackButton && headerConfig?.actionButtons?.indexOf('search') >=0)">{{ configVariables.siteName }}</ion-title>
*ngIf="!(headerConfig?.showbackButton && (headerConfig?.actionButtons?.indexOf('search') >=0 || headerConfig?.actionButtons?.indexOf('edit') >=0))">{{ configVariables.siteName }}</ion-title>
<ion-title role="heading" aria-level="1" *ngIf="headerConfig?.actionButtons?.indexOf('edit') >=0">{{ headerConfig.pageTitle }}</ion-title>
<ion-input type="search" *ngIf="headerConfig?.showbackButton && headerConfig?.actionButtons?.indexOf('search') >=0" #searchInput [placeholder]="'SEARCH_HINT' | translate"></ion-input>
<ion-buttons slot="end" [hidden]="headerConfig?.showbackButton">
<ion-button (click)="emitEvent($event, 'search')">
<ion-icon aria-hidden="true" src="assets/icon/search.svg"></ion-icon>
</ion-button>
<ion-button (click)="navigateToQRScreen()">
<!-- <ion-button (click)="navigateToQRScreen()">
<ion-icon aria-hidden="true" src="assets/icon/qr-scan.svg"></ion-icon>
</ion-button>
</ion-button> -->
<ion-button (click)="emitEvent($event, 'profile')">
<ion-icon aria-hidden="true" src="assets/icon/language-icon.svg"></ion-icon>
</ion-button>
Expand Down
25 changes: 13 additions & 12 deletions src/app/components/bot-messages/bot-messages.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,20 @@
</div>
</div>
<div class="bot-input" [ngClass]="keyboardOpen ? 'keyboard-open' : ''">
<ion-input
<ion-textarea
*ngIf="!startRecording"
[disabled]="disabled"
aria-label=""
value=""
[placeholder]="'Type here' | translate"
(keyup.enter)="handleMessage()"
fill="outline"
shape="round"
[(ngModel)]="textMessage"
(focus)="onInputFocus()"
(blur)="onInputBlur()">
</ion-input>
[disabled]="disabled"
aria-label=""
value=""
[placeholder]="'Type here' | translate"
(keyup.enter)="handleMessage()"
fill="outline"
shape="round"
[(ngModel)]="textMessage"
#textareaField
(ionFocus)="onInputFocus()"
(ionBlur)="onInputBlur()">
</ion-textarea>
<div class="input_record" *ngIf="startRecording">
<ion-icon aria-hidden="true" class="audio-record-mic on-record" name="mic"></ion-icon>
<ion-label >{{durationDisplay}}</ion-label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ion-content{
box-shadow: 0px -0.33px 0px 0px #A6A6AA;
display: flex;
align-items: center;
ion-input {
ion-textarea {
width: 90%;
}
ion-button {
Expand Down
22 changes: 17 additions & 5 deletions src/app/components/qrcode-popup/qrcode-popup.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ export class QrcodePopupComponent implements OnInit {
this.scanResult = null;
}

stopScan() {
this.scanActive = false;
}

async startScan() {
// Not working on iOS standalone mode!
const stream = await navigator.mediaDevices.getUserMedia({
Expand All @@ -109,6 +105,21 @@ export class QrcodePopupComponent implements OnInit {
this.videoElement.play();
requestAnimationFrame(this.scan.bind(this));
}

stopScan() {
this.scanActive = false;

const stream = this.videoElement.srcObject;
if (stream) {
const tracks = stream.getTracks();
tracks.forEach(function(track: MediaStreamTrack) {
track.stop();
console.log('Track stopped:', track.readyState);

});
this.videoElement.srcObject = null;
}
}

async scan() {
try {
Expand Down Expand Up @@ -140,9 +151,10 @@ export class QrcodePopupComponent implements OnInit {
inversionAttempts: 'dontInvert'
});

if (code) {
if (code?.data) {
this.scanActive = false;
this.scanResult = code.data;
this.stopScan();
this.showQrToast();
} else {
if (this.scanActive) {
Expand Down
3 changes: 2 additions & 1 deletion src/app/pages/create-playlist/create-playlist.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ export class CreatePlaylistPage implements OnInit {
this.selectedContents.forEach((ele) => {
if (!ele.metaData['thumbnail']) {
if (ele.metaData.mimetype === PlayerType.YOUTUBE) {
ele.metaData['thumbnail'] = this.loadYoutubeImg(ele.metaData);
// ele.metaData['thumbnail'] = this.loadYoutubeImg(ele.metaData);
ele.metaData['thumbnail'] = ele.metaData.thumbnail;
} else {
ele.metaData['thumbnail'] = (ele.metaData.thumbnail && !ele.metaData.identifier.startsWith('do_')) ? ele.metaData.thumbnail : ContentUtil.getImagePath(ele.metaData.mimetype || ele.metaData.mimeType)
}
Expand Down
13 changes: 9 additions & 4 deletions src/app/pages/home/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class HomePage implements OnInit, OnTabViewWillEnter, OnDestroy {
selectedLang: any = "";
appName: string = "";
configVariables = ConfigVariables;
responseList: Array<any> = [];
constructor(
private headerService: AppHeaderService,
private router: Router,
Expand Down Expand Up @@ -115,6 +116,7 @@ export class HomePage implements OnInit, OnTabViewWillEnter, OnDestroy {
if(val == 'language') {
let lang = await this.storage.getData('lang');
console.log('lang ', lang, this.selectedLang);
this.responseList = await this.searchService.postContentSearch(req, await this.storage.getData('lang'));
if (this.selectedLang !== lang) {
this.selectedLang = lang;
this.showSheenAnimation = true;
Expand Down Expand Up @@ -143,7 +145,7 @@ export class HomePage implements OnInit, OnTabViewWillEnter, OnDestroy {
this.serverError = false;
this.showSheenAnimation = true;
// try {
let lang = 'en';//await this.storage.getData('lang')
let lang = await this.storage.getData('lang')
let content = await this.configService.getAllContent(req, lang);
this.mappUIContentList(content);
// }
Expand All @@ -163,16 +165,19 @@ export class HomePage implements OnInit, OnTabViewWillEnter, OnDestroy {
console.log(val);
this.showSheenAnimation = true;
try {
let res: any = await this.searchService.postContentSearch(req, await this.storage.getData('lang'));
console.log('Response', res);
this.mappUIContentList(res);
this.responseList = [];
this.responseList = await this.searchService.postContentSearch(req, await this.storage.getData('lang'));
// let res: any = await this.searchService.postContentSearch(req, await this.storage.getData('lang'));
console.log('Response', this.responseList);
this.mappUIContentList(this.responseList);
}
catch (e) {
console.log('error', e);
}
})
this.networkConnected = await this.networkService.getNetworkStatus()
let forceRefresh = await this.cacheService.getCacheTimeout();
let lang = await this.storage.getData('lang');
if (forceRefresh) {
this.getServerMetaConfig();
} else if (!this.networkConnected) {
Expand Down
24 changes: 16 additions & 8 deletions src/app/pages/mypitara/mypitara.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,23 @@ export class MyPitaraPage implements OnTabViewWillEnter{

async getRecentlyviewedContent() {
await this.contentService.getRecentlyViewedContent('guest').then((result) => {
this.contentList = result;
this.contentList.forEach((ele: any) => {
if (ele.metaData.mimetype === PlayerType.YOUTUBE) {
ele.metaData['thumbnail'] = this.loadYoutubeImg(ele.metaData)
} else {
ele.metaData['thumbnail'] = (ele.metaData.thumbnail && !ele?.metaData.identifier?.startsWith('do_')) ? ele.metaData.thumbnail : ContentUtil.getImagePath(ele.metaData.mimeType || ele.metaData.mimetype)
this.contentList = [];
let uniqueIds: any = {};
result.filter((item : any) => {
if (!uniqueIds[item.contentIdentifier]) {
uniqueIds[item.contentIdentifier] = true;
this.contentList.push(item);
if (item.metaData.mimetype === PlayerType.YOUTUBE) {
// item.metaData['thumbnail'] = this.loadYoutubeImg(item.metaData)
item.metaData['thumbnail'] = item.metaData.thumbnail;

} else {
item.metaData['thumbnail'] = (item.metaData.thumbnail && !item?.metaData.identifier?.startsWith('do_')) ? item.metaData.thumbnail : ContentUtil.getImagePath(item.metaData.mimeType || item.metaData.mimetype)
}
return true;
}
})
console.log('contentList', this.contentList);
return false;
});
}).catch((err) => {
console.log('error', err)
})
Expand Down
14 changes: 12 additions & 2 deletions src/app/pages/playlist-details/playlist-details.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@
<div class="cards-container" *ngFor="let content of playlists; let i = index">
<div class="card" *ngIf="content?.metaData">
<div class="card__img" (click)="playContent(content)">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? content?.metaData?.thumbnail : 'assets/images/Audio.png'" alt="" *ngIf="content?.metaData?.mimetype === mimeType.AUDIO">
<!-- <img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? content?.metaData?.thumbnail : 'assets/images/Audio.png'" alt="" *ngIf="content?.metaData?.mimetype === mimeType.AUDIO">
<img appThumbnail [appThumbnail]="content?.metaData" alt="" *ngIf="content?.metaData?.mimetype === mimeType.YOUTUBE && !content.play">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? content?.metaData?.thumbnail : 'assets/images/Video.png'" alt="" *ngIf="content?.metaData?.mimetype === mimeType.MP4">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? content?.metaData?.thumbnail : 'assets/images/PDF.png'" alt="" *ngIf="content?.metaData?.mimetype === mimeType.PDF">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? content?.metaData?.thumbnail : 'assets/images/LINK.png'" alt="" *ngIf="content?.metaData?.mimetype === 'text/html'">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? content?.metaData?.thumbnail : 'assets/images/LINK.png'" alt="" *ngIf="content?.metaData?.mimetype === 'text/html'"> -->

<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? (content?.metaData?.thumbnail) : 'assets/images/Audio.png'" alt="" *ngIf="content.metaData.mimetype === mimeType.AUDIO">
<!-- <img appThumbnail [appThumbnail]="'assets/images/yt.jpeg'" alt="" *ngIf="content.metaData.mimetype === mimeType.YOUTUBE"> -->
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? (content?.metaData?.thumbnail) : 'assets/images/youtube-video.png'" alt="" *ngIf="content.metaData.mimetype === mimeType.YOUTUBE">
<!-- <img [src]="loadYoutubeImg(content.metaData.identifier)" alt="" *ngIf="content.metaData.mimetype === mimeType.YOUTUBE && !content.play"> -->
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? (content?.metaData?.thumbnail) : 'assets/images/Video.png'" alt="" *ngIf="content.metaData.mimetype === mimeType.MP4">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? (content?.metaData?.thumbnail) : 'assets/images/PDF.png'" alt="" *ngIf="content.metaData.mimetype === mimeType.PDF">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? (content?.metaData?.thumbnail) : 'assets/images/LINK.png'" alt="" *ngIf="content.metaData.mimetype === mimeType.LINK">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? content?.metaData?.thumbnail : 'assets/images/LINK.png'" alt="" *ngIf="content?.metaData?.mimetype === 'text/html'">
<img [src]="(content?.metaData?.thumbnail =='' && !content.metaData.identifier.startsWith('do_')) ? 'https://ejaaduipitara.ncert.gov.in/assets/img/cards.jpg' : ''" alt="">

<!-- <ion-img *ngIf="content.metaData.thumbnail && !content.play" [src]="content.metaData.thumbnail" alt=""/>
<ion-img *ngIf="!content.metaData.thumbnail && !content.play" [src]="loadYoutubeImg(content.metaData.identifier)" alt=""/> -->
<!-- <div *ngIf="content.metaData.mimetype === 'video/x-youtube' && content.play">
Expand Down
9 changes: 7 additions & 2 deletions src/app/pages/search/search.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,17 @@
<ion-list *ngIf="!showSheenAnimation && searchContentResult.length > 0">
<ion-item lines="none" *ngFor="let content of searchContentResult; let i = index" class="card">
<div class="card__img" (click)="playContent($event, content)">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? content?.metaData?.thumbnail :'assets/images/Audio.png'" alt="" *ngIf="content.metaData.mimetype === mimeType.AUDIO">
<!-- <img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? content?.metaData?.thumbnail :'assets/images/Audio.png'" alt="" *ngIf="content.metaData.mimetype === mimeType.AUDIO">
<img appThumbnail [appThumbnail]="content?.metaData" alt="" *ngIf="content.metaData.mimetype === mimeType.YOUTUBE">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? content?.metaData?.thumbnail :'assets/images/Video.png'" alt="" *ngIf="content.metaData.mimetype === mimeType.MP4">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? content?.metaData?.thumbnail :'assets/images/PDF.png'" alt="" *ngIf="content.metaData.mimetype === mimeType.PDF">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? content?.metaData?.thumbnail : 'assets/images/LINK.png'" alt="" *ngIf="content?.metaData?.mimetype === 'text/html'"> -->
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? (content?.metaData?.thumbnail) : 'assets/images/Audio.png'" alt="" *ngIf="content.metaData.mimetype === mimeType.AUDIO">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? (content?.metaData?.thumbnail) : 'assets/images/youtube-video.png'" alt="" *ngIf="content.metaData.mimetype === mimeType.YOUTUBE">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? (content?.metaData?.thumbnail) : 'assets/images/Video.png'" alt="" *ngIf="content.metaData.mimetype === mimeType.MP4">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? (content?.metaData?.thumbnail) : 'assets/images/PDF.png'" alt="" *ngIf="content.metaData.mimetype === mimeType.PDF">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? (content?.metaData?.thumbnail) : 'assets/images/LINK.png'" alt="" *ngIf="content.metaData.mimetype === mimeType.LINK">
<img [src]="(content?.metaData?.thumbnail && !content.metaData.identifier.startsWith('do_')) ? content?.metaData?.thumbnail : 'assets/images/LINK.png'" alt="" *ngIf="content?.metaData?.mimetype === 'text/html'">

</div>
<div class="card__metadata">
<div class="card__title">{{content.metaData?.name}}</div>
Expand Down
16 changes: 13 additions & 3 deletions src/app/pages/view-all/view-all.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,16 @@ export class ViewAllPage implements OnInit {

async getRecentlyviewedContent() {
await this.contentService.getRecentlyViewedContent('guest').then((result) => {
this.contentList = result;
let uniqueIds: any = {};
result.filter(item => {
if (!uniqueIds[item.contentIdentifier]) {
uniqueIds[item.contentIdentifier] = true;
this.contentList.push(item);
return true;
}
return false;
});

this.contentList.map((e) => e.metaData = (typeof e.metaData === 'string') ? JSON.parse(e.metaData) : e.metaData)
this.contentList = this.getContentImgPath(this.contentList);
}).catch((err) => {
Expand Down Expand Up @@ -231,7 +240,8 @@ export class ViewAllPage implements OnInit {
getContentImgPath(contents: Array<any>, isSelected?: boolean) : Array<any>{
contents.forEach((ele) => {
if (ele.metaData.mimetype === PlayerType.YOUTUBE) {
ele.metaData['thumbnail'] = this.loadYoutubeImg(ele.metaData);
// ele.metaData['thumbnail'] = this.loadYoutubeImg(ele.metaData.thumbnail)
ele.metaData['thumbnail'] = ele.metaData.thumbnail;
} else {
ele.metaData['thumbnail'] = (ele.metaData.thumbnail && !ele?.metaData.identifier?.startsWith('do_')) ? ele.mediaData.thumbnail : ContentUtil.getImagePath(ele.metaData.mimetype || ele.metaData.mimeType)
}
Expand Down Expand Up @@ -341,7 +351,7 @@ export class ViewAllPage implements OnInit {
metaData: {
identifier: content?.identifier,
name: content?.name,
thumbnail: content?.posterImage,
thumbnail: content?.thumbnail,
description: content?.name,
mimetype: content?.mimetype || content?.mimeType,
url: content?.streamingUrl,
Expand Down
8 changes: 5 additions & 3 deletions src/app/services/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ export class ConfigService {
}

async getAllContent(req: any, lang: any): Promise<any> {
console.log('req ', req);
let request = {
language: lang
}
const apiRequest = new ApiRequest.Builder()
.withHost(config.api.BASE_URL)
.withPath(config.api.PAGE_SEARCH_API)
.withType(ApiHttpRequestType.POST)
.withBearerToken(true)
// .withBody(req)
// .withLanguge(lang)
.withBody(request)
.withLanguge(lang)
.build()
return lastValueFrom(this.apiService.fetch(apiRequest).pipe(
map((apiResponse) => apiResponse.body.result),
Expand Down
Loading

0 comments on commit 960ae01

Please sign in to comment.