Skip to content

Commit

Permalink
Merge pull request #3556 from sujithsojan/release-7.0.0_g
Browse files Browse the repository at this point in the history
Issue #ED-3554 fix: Questionset exit button issue
  • Loading branch information
swayangjit authored Feb 26, 2024
2 parents 9353fad + af8dc9d commit 24c6d2f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 0 additions & 2 deletions src/app/player/player.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { CanvasPlayerService } from '../../services/canvas-player.service';
import { ScreenOrientation } from '@awesome-cordova-plugins/screen-orientation/ngx';
import { SunbirdPdfPlayerModule } from '@project-sunbird/sunbird-pdf-player-v9';
import { SunbirdEpubPlayerModule } from '@project-sunbird/sunbird-epub-player-v9';
import { QumlLibraryModule } from '@project-sunbird/sunbird-quml-player-v9';



Expand All @@ -29,7 +28,6 @@ const routes: Routes = [
FormsModule,
SunbirdPdfPlayerModule,
SunbirdEpubPlayerModule,
QumlLibraryModule,
IonicModule,
RouterModule.forChild(routes)
],
Expand Down
23 changes: 16 additions & 7 deletions src/app/player/player.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,21 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat
await this.toggleDeviceOrientation();
}
}
else if (event.detail) {
const userId: string = this.appGlobalService.getCurrentUser().uid;
const parentId: string = (this.content.rollup && this.content.rollup.l1) ? this.content.rollup.l1 : this.content.identifier;
const contentId: string = this.content.identifier;
if(event.detail.edata['type'] === 'EXIT') {
this.playerService.deletePlayerSaveState(userId, parentId, contentId);
if (this.config['metadata']['mimeType'] === "application/vnd.sunbird.questionset") {
if (!this.isExitPopupShown) {
await this.showConfirm();
}
} else {
this.location.back();
}
}
}
}

handleDownload() {
Expand Down Expand Up @@ -698,20 +713,14 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat
config: this.config.config,
metadata: this.config.metadata
};
playerConfig.metadata['outcomeDeclaration'] = {
"maxScore": {
"cardinality": "single",
"type": "integer",
"defaultValue": 1
}
}

setTimeout(() => {
const qumlElement = document.createElement('sunbird-quml-player');
qumlElement.setAttribute('player-config', JSON.stringify(playerConfig));

qumlElement.addEventListener('playerEvent', (event) => {
console.log("On playerEvent", event);
this.playerEvents(event);
});

qumlElement.addEventListener('telemetryEvent', (event) => {
Expand Down
3 changes: 1 addition & 2 deletions src/services/quml-player/quml-player.service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Inject, Injectable } from '@angular/core';
import { QuestionCursor } from '@project-sunbird/sunbird-quml-player-v9';
import { ContentService } from '@project-sunbird/sunbird-sdk';
import { Observable, of } from 'rxjs';

@Injectable({
providedIn: 'root'
})
export class QumlPlayerService implements QuestionCursor {
export class QumlPlayerService {

constructor(
@Inject('CONTENT_SERVICE') private contentService: ContentService,
Expand Down

0 comments on commit 24c6d2f

Please sign in to comment.