diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 258f4ad1cd..429eed8aac 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -17,7 +17,7 @@ Please describe the tests that you ran to verify your changes in the below check - [ ] Ran Test B **Test Configuration**: -* Node - 12.22.10 +* Node - 16.20.0 * Java - 11.0.15.1 * Ionic - 5.7.0 * Cordova - 12.0.0 diff --git a/README.md b/README.md index ff13a417d6..b57f74296d 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ Ongoing release- [release-6.0.0](https://github.com/Sunbird-Ed/SunbirdEd-mobile- **Prerequisites:** |Package| Version | Recommended Version | |--|--|--| -[Node](https://nodejs.org/en/) | 12+ | 12.22.10 -[NPM](https://nodejs.org/en/) | 6+ | 6.14.16 +[Node](https://nodejs.org/en/) | 16+ | 16.20.0 +[NPM](https://nodejs.org/en/) | 9+ | 9.5.1 [Cordova](https://cordova.apache.org/) | 10+ | 10.1.2 [Ionic](https://ionicframework.com/docs/intro/cli) | 5 | 5.7.0 [Java(For Android)](https://www.oracle.com/in/java/technologies/downloads/) | 11+ | 11.0.15.1 @@ -178,8 +178,8 @@ Configure the tabs page according to the requirement. Fllowing are the configura --------------------------------------- ## IOS Development setup ## Prerequisites - 1. Node js version 14.20.1 - 2. Ionic 5.4.16 using `npm i ionic@5.4.16 -g` + 1. Node js version 16.20.0 + 2. Ionic 7.1.5 using `npm i ionic@5.7.0 -g` 3. Cordova 11.0.0 using `npm i cordova@9.0.0 -g` 4. cordova-res 0.15.3 - using `npm install -g cordova-res` 5. ios-deploy 1.11.4 - using `brew install ios-deploy` diff --git a/angular.json b/angular.json index cd2cf9c7cb..59a13fe7b4 100644 --- a/angular.json +++ b/angular.json @@ -79,9 +79,9 @@ "node_modules/@project-sunbird/discussions-ui/assets/styles/global.scss", "node_modules/@project-sunbird/sunbird-video-player-web-component/styles.css", "node_modules/videojs-http-source-selector/dist/videojs-http-source-selector.css", - "node_modules/datatables.net-dt/css/jquery.dataTables.css", "node_modules/@project-sunbird/sb-themes/themes/themes-df.scss", "node_modules/@project-sunbird/sunbird-epub-player-web-component/styles.css", + "node_modules/datatables.net-dt/css/dataTables.dataTables.css", "node_modules/@project-sunbird/sunbird-quml-player-web-component/styles.css", "node_modules/@project-sunbird/sunbird-pdf-player-web-component/styles.css", "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", @@ -94,7 +94,7 @@ "node_modules/epubjs/dist/epub.js", "node_modules/katex/dist/katex.min.js", "node_modules/jquery/dist/jquery.min.js", - "node_modules/datatables.net/js/jquery.dataTables.js", + "node_modules/datatables.net/js/dataTables.js", "node_modules/video.js/dist/video.js", "node_modules/@project-sunbird/sunbird-video-player-web-component/sunbird-video-player.js", "node_modules/videojs-contrib-quality-levels/dist/videojs-contrib-quality-levels.min.js", diff --git a/package-lock.json b/package-lock.json index 52eeca1810..99a31f25f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -61,13 +61,12 @@ "@project-sunbird/common-form-elements": "8.0.4", "@project-sunbird/content-player": "5.1.0", "@project-sunbird/discussions-ui": "8.0.3", - "@project-sunbird/sb-dashlet": "8.0.1", - "@project-sunbird/sb-notification": "8.0.0", + "@project-sunbird/sb-dashlet": "^8.0.2", + "@project-sunbird/sb-notification": "^8.0.0", "@project-sunbird/sb-styles": "0.0.16", - "@project-sunbird/sb-svg2pdf": "8.0.3", - "@project-sunbird/sunbird-epub-player-web-component": "1.2.0", - "@project-sunbird/sunbird-pdf-player-v9": "5.6.0", - "@project-sunbird/sunbird-pdf-player-web-component": "1.1.0", + "@project-sunbird/sb-svg2pdf": "^8.0.3", + "@project-sunbird/sunbird-epub-player-web-component": "^1.2.0", + "@project-sunbird/sunbird-pdf-player-web-component": "^1.1.0", "@project-sunbird/sunbird-quml-player-web-component": "3.0.3", "@project-sunbird/sunbird-sdk": "7.0.21", "@project-sunbird/sunbird-video-player-web-component": "^1.0.1", @@ -75,12 +74,10 @@ "chartjs-plugin-datalabels": "2.2.0", "chartjs-plugin-stacked100": "1.5.0", "colors": "1.4.0", - "cordova-plugin-android-permissions": "1.1.2", - "cordova-plugin-qr-scanner": "github:project-sunbird/cordova-plugin-qr-scanner#release-7.0.0", - "core-js": "3.23.3", - "crypto-js": "4.2.0", - "datatables.net-dt": "1.13.4", - "datatables.net-fixedcolumns": "3.3.3", + "com.jjdltc.cordova.plugin.zip": "git+https://github.com/Sunbird-Ed/jjdltc-cordova-plugin-zip.git", + "cordova-plugin-badge": "^0.8.8", + "core-js": "^3.23.3", + "datatables.net-fixedcolumns": "^5.0.0", "dayjs": "1.9.8", "dom-to-image": "2.6.0", "epubjs": "0.3.93", @@ -6688,15 +6685,21 @@ "rxjs": ">=6" } }, - "node_modules/@project-sunbird/client-services/node_modules/@project-sunbird/telemetry-sdk": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@project-sunbird/telemetry-sdk/-/telemetry-sdk-1.3.0.tgz", - "integrity": "sha512-9vocPJpB08/8pAXDUKQmhCiBxJ9qHxORF1+ot3kJczSnRh/K+POpAWDCR4iJ2+gWXPDE03WIWezshKpyf0RdYQ==" + "node_modules/@project-sunbird/client-services/node_modules/qs": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.7.tgz", + "integrity": "sha512-IhMFgUmuNpyRfxA90umL7ByLlgRXu6tIfKPpF5TmcfRLlLCckfP/g3IQmju6jjpu+Hh8rA+2p6A27ZSPOOHdKw==", + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "node_modules/@project-sunbird/client-services/node_modules/reflect-metadata": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", - "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==" + "node_modules/@project-sunbird/client-services/node_modules/whatwg-fetch": { + "version": "3.6.19", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.19.tgz", + "integrity": "sha512-d67JP4dHSbm2TrpFj8AbO8DnL1JXL5J9u0Kq2xW6d0TFDbCA3Muhdt8orXC22utleTVj7Prqt82baN6RBvnEgw==" }, "node_modules/@project-sunbird/common-consumption": { "version": "8.0.2", @@ -7602,15 +7605,26 @@ "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.4.0.tgz", "integrity": "sha512-mJsRm2apQm5mwz2OgYqGNG4erZh/qljcRZkWSa0kLkFr3UC3e1wKRMgnIh6WdhUrNu0w/JT9PkjLyylqEqHXEQ==" }, - "node_modules/@project-sunbird/sb-dashlet/node_modules/datatables.net-dt": { - "version": "1.10.20", - "resolved": "https://registry.npmjs.org/datatables.net-dt/-/datatables.net-dt-1.10.20.tgz", - "integrity": "sha512-D+65buDke96a3WlJo2re+SbcAVfjPh2nsFZG198Vbkz3i1wKPdB+wkV2K07qYIiIpypcXWOnD2pz3MvnUqM9Tw==", + "node_modules/@project-sunbird/sb-dashlet/node_modules/datatables.net": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-2.0.3.tgz", + "integrity": "sha512-phq7jhkjIlVdahZYa2nd/yeiDgFrvT++Sily3GgztG3T7qqdAWkjtLuGA2Pv5p7XBwkJ0zwf+0KDRU54uR7WAg==", "dependencies": { - "datatables.net": "1.10.20", "jquery": ">=1.7" } }, + "node_modules/@project-sunbird/sb-dashlet/node_modules/joi": { + "version": "17.4.0", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.4.0.tgz", + "integrity": "sha512-F4WiW2xaV6wc1jxete70Rw4V/VuMd6IN+a5ilZsxG4uYtUXWu2kq9W5P2dz30e7Gmw8RCbY/u/uk+dMPma9tAg==", + "dependencies": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.0", + "@sideway/formula": "^3.0.0", + "@sideway/pinpoint": "^2.0.0" + } + }, "node_modules/@project-sunbird/sb-dashlet/node_modules/ng2-charts": { "version": "3.0.8", "resolved": "https://registry.npmjs.org/ng2-charts/-/ng2-charts-3.0.8.tgz", @@ -7664,18 +7678,9 @@ "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/@project-sunbird/sb-themes": { - "version": "0.0.88", - "resolved": "https://registry.npmjs.org/@project-sunbird/sb-themes/-/sb-themes-0.0.88.tgz", - "integrity": "sha512-12eKzpToyjJAKTLLFWq9Zo3+Y6tzi2GE0YBNbErfMxs9iAubliqApkwGMH/ry2qYhV8S/uiEcE4JPwtX2HZcYA==", - "dev": true, - "dependencies": { - "@project-sunbird/sb-styles": "0.0.14" - } - }, - "node_modules/@project-sunbird/sb-themes/node_modules/@project-sunbird/sb-styles": { - "version": "0.0.14", - "resolved": "https://registry.npmjs.org/@project-sunbird/sb-styles/-/sb-styles-0.0.14.tgz", - "integrity": "sha512-pq4RqXPoqcTyncLz64gHu0AFVgl4KoL3yr+ocgdO4n26BkQZBgQG0xtuYqscUPPWVBg/BS4TCsjzMO+ifunRaA==", + "version": "0.0.86", + "resolved": "https://registry.npmjs.org/@project-sunbird/sb-themes/-/sb-themes-0.0.86.tgz", + "integrity": "sha512-+vlnoIbrgzAA+xicdebGDfyczRHpdJ3Zch7krm5ebaXkNOFiBimoRjxi2pkYe8NxoXNloMwICMJxi9pdFjJjsg==", "dev": true }, "node_modules/@project-sunbird/sunbird-epub-player-web-component": { @@ -7683,39 +7688,11 @@ "resolved": "https://registry.npmjs.org/@project-sunbird/sunbird-epub-player-web-component/-/sunbird-epub-player-web-component-1.2.0.tgz", "integrity": "sha512-YeunsOyPIRkWkHqr6rGbYcjOKwTkNhrUzcSNMDh8oZ+E/LfyZ54eKtUzSR/+0wjvvOk4W8GFyG7SorSh93pAkw==" }, - "node_modules/@project-sunbird/sunbird-pdf-player-v9": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@project-sunbird/sunbird-pdf-player-v9/-/sunbird-pdf-player-v9-5.6.0.tgz", - "integrity": "sha512-pYYwCG8IRalTfxc1XpYPresB+HqmwgF6O3nORxeNfiNQTdW++/s1qvnXkk3cew4+Q4yN/hHkzXO7p3c5YNhm0g==", - "dependencies": { - "@project-sunbird/sunbird-player-sdk-v9": "5.1.0", - "tslib": "^2.0.0" - }, - "peerDependencies": { - "@angular/common": ">= 14.2.5", - "@angular/core": ">= 14.2.5", - "@project-sunbird/client-services": ">= 3.4.8", - "@project-sunbird/sb-styles": ">= 0.0.7" - } - }, "node_modules/@project-sunbird/sunbird-pdf-player-web-component": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@project-sunbird/sunbird-pdf-player-web-component/-/sunbird-pdf-player-web-component-1.1.0.tgz", "integrity": "sha512-upzGIRzRh8iOrkCFnmey/1DI9h9iyw110sXj6DluoobyonN0uXhrBwxk+oOiROGVAgm7hpTtrobGVzhGpEf40A==" }, - "node_modules/@project-sunbird/sunbird-player-sdk-v9": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@project-sunbird/sunbird-player-sdk-v9/-/sunbird-player-sdk-v9-5.1.0.tgz", - "integrity": "sha512-Vg3MXOkBC7c1px9pTX58T0wqkseLAw0kWLflA8CpttIUQYFJBxxu5wEB8z8Y5zb6zDFrykxWRbPEcbdYdfOKRw==", - "dependencies": { - "ally.js": "1.4.1" - }, - "peerDependencies": { - "@angular/common": ">= 9.1.12", - "@angular/core": ">= 9.1.12", - "@project-sunbird/sb-styles": ">= 0.0.7" - } - }, "node_modules/@project-sunbird/sunbird-quml-player-web-component": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@project-sunbird/sunbird-quml-player-web-component/-/sunbird-quml-player-web-component-3.0.3.tgz", @@ -7825,14 +7802,9 @@ "integrity": "sha512-3uGLXShAtzZW2gZfD4GHcBHBmmP2CAI63X9re4vLdE7oLXZxBa2tKMdYJzaxRwNKutuIvGu+YY8ryNEBMxagkg==" }, "node_modules/@project-sunbird/telemetry-sdk": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/@project-sunbird/telemetry-sdk/-/telemetry-sdk-0.0.29.tgz", - "integrity": "sha512-aFCBEikBdfAfA1bSwwlFmQvzbjd2BaK9JjJ01nGN5KnwkCGwduCngkAs0ns6S1X+o0/f3qyTUkL0NB/tKZ6Pjg==", - "dev": true, - "dependencies": { - "grunt-karma": "^0.12.2", - "karma": "^3.0.0" - } + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@project-sunbird/telemetry-sdk/-/telemetry-sdk-1.3.0.tgz", + "integrity": "sha512-9vocPJpB08/8pAXDUKQmhCiBxJ9qHxORF1+ot3kJczSnRh/K+POpAWDCR4iJ2+gWXPDE03WIWezshKpyf0RdYQ==" }, "node_modules/@project-sunbird/telemetry-sdk/node_modules/accepts": { "version": "1.3.8", @@ -10041,15 +10013,6 @@ "ajv": "^8.8.2" } }, - "node_modules/ally.js": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/ally.js/-/ally.js-1.4.1.tgz", - "integrity": "sha512-ZewdfuwP6VewtMN36QY0gmiyvBfMnmEaNwbVu2nTS6zRt069viTgkYgaDiqu6vRJ1VJCriNqV0jGMu44R8zNbA==", - "dependencies": { - "css.escape": "^1.5.0", - "platform": "1.3.3" - } - }, "node_modules/android-versions": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/android-versions/-/android-versions-1.9.0.tgz", @@ -12641,6 +12604,7 @@ "node_modules/cordova-plugin-android-downloadmanager": { "version": "0.5.0", "resolved": "git+ssh://git@github.com/Sunbird-Ed/sb-cordova-plugin-downloadmanager.git#c8c5c1fbbde02eb854e3e31263b22da19c270adb", + "dev": true, "license": "ISC", "dependencies": { "nanoassert": "^1.1.0" @@ -12659,9 +12623,120 @@ }, "node_modules/cordova-plugin-awesome-shared-preferences": { "version": "0.1.0", - "resolved": "https://registry.npmjs.org/cordova-plugin-awesome-shared-preferences/-/cordova-plugin-awesome-shared-preferences-0.1.0.tgz", - "integrity": "sha512-jD+8z1z/z07WsJHFxV982YjwRPXOVWJWfKRvfcwaZi6n7as4NzRMGWiWYisYGFe4XOVk3jxs3SdRQR0684wKJA==", - "peer": true + "resolved": "git+ssh://git@github.com/adriano-di-giovanni/cordova-plugin-shared-preferences.git#18b00aabc61b04b16f0f4ad309e352c5c26abbcb", + "dev": true, + "license": "MIT" + }, + "node_modules/cordova-plugin-badge": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/cordova-plugin-badge/-/cordova-plugin-badge-0.8.8.tgz", + "integrity": "sha512-RhIBtd5xhD/iLnxjt35jvOae28oNW/wtMZBOmQR3Rf0y4wirvA1bpAZEhBoFqL+rZGhsd6ddOdQXdex1T0DRyQ==", + "engines": [ + { + "name": "cordova", + "version": ">=6.0.0" + }, + { + "name": "apple-ios", + "version": ">=10.0.0" + }, + { + "name": "cordova-android", + "version": ">=4" + }, + { + "name": "cordova-plugman", + "version": ">=4.2.0" + } + ] + }, + "node_modules/cordova-plugin-badge-fix": { + "version": "0.8.10", + "resolved": "https://registry.npmjs.org/cordova-plugin-badge-fix/-/cordova-plugin-badge-fix-0.8.10.tgz", + "integrity": "sha512-4yvfe5Qil9Bz7OTSnVNVkQV5Mru0wSAgfAhBE/myo9aPLT7yjs3sn963Shg4MCDPlVCganS0spJ384fsyYB6lA==", + "dev": true, + "engines": [ + { + "name": "cordova", + "version": ">=6.0.0" + }, + { + "name": "apple-ios", + "version": ">=10.0.0" + }, + { + "name": "cordova-android", + "version": ">=4" + }, + { + "name": "cordova-plugman", + "version": ">=4.2.0" + } + ] + }, + "node_modules/cordova-plugin-camera": { + "version": "6.0.1-dev", + "resolved": "git+ssh://git@github.com/shikshalokam/cordova-plugin-camera.git#4a48d1a5d13de17ac7f522a848526fe9c4024e42", + "integrity": "sha512-RmdO3QCjxtKh5uHxrQPNayjzzmNKR1K+S2UJqev1Zl4htdO223wQ8Nexst+rpKnhI+gcT2aS0qsaw9T5yTfg6A==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "cordovaDependencies": { + "3.0.0": { + "cordova-android": ">=6.3.0" + }, + "4.1.0": { + "cordova": ">=7.1.0", + "cordova-android": ">=6.3.0" + }, + "5.0.0": { + "cordova": ">=9.0.0", + "cordova-android": ">=9.0.0", + "cordova-ios": ">=5.1.0" + }, + "5.0.4-dev": { + "cordova": ">=9.0.0", + "cordova-android": "<10.0.0", + "cordova-ios": ">=5.1.0" + }, + "6.0.0": { + "cordova": ">=9.0.0", + "cordova-android": ">=10.0.0", + "cordova-ios": ">=5.1.0" + }, + "7.0.0": { + "cordova": ">100" + } + } + } + }, + "node_modules/cordova-plugin-chooser": { + "version": "1.3.2", + "resolved": "git+ssh://git@github.com/shikshalokam/cordova-plugin-chooser.git#8127e42dcae1bd355ae6bcdcb1685bbd25e9972b", + "integrity": "sha512-edxwFNvJWNhDr8x3Z5oqLD5Xk8d294ft5/EiRKodUg/X3j5PGhW6KdJdQ21lQdqS61ZLq0HOtYiDNcTqCfgDsA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/cordova-plugin-code-push": { + "version": "2.0.0", + "resolved": "git+ssh://git@github.com/swayangjit/cordova-plugin-code-push.git#b1837910714cc9fbfffda1a7b537b93eabb5ed59", + "dev": true, + "license": "MIT" + }, + "node_modules/cordova-plugin-console": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/cordova-plugin-console/-/cordova-plugin-console-1.1.0.tgz", + "integrity": "sha512-aWJzLaGoyu+FsFBzysjpEyeJrZ6f09BZyDgM3dbTrUOLwLLPBVMlzDeCxyZ9ck0YoVsVfEoWJzstshuNNfyrHQ==", + "deprecated": "This plugin has been deprecated since it is now included in the latest versions of cordova-ios", + "dev": true, + "engines": { + "cordovaDependencies": { + ">=2.0.0": { + "cordova-ios": "<4.5.0", + "cordova-windows": "<=5.0.0" + } + } + } }, "node_modules/cordova-plugin-device": { "version": "2.1.0", @@ -12838,7 +12913,43 @@ }, "node_modules/cordova-plugin-qr-scanner": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/project-sunbird/cordova-plugin-qr-scanner.git#d928ad426a47c13c62df138c14cfc05ec1dcafce" + "resolved": "git+ssh://git@github.com/project-sunbird/cordova-plugin-qr-scanner.git#daafe1d91b216d977bfe1c2b5dea28f382247eb6", + "dev": true + }, + "node_modules/cordova-plugin-screen-orientation": { + "version": "3.0.4", + "resolved": "git+ssh://git@github.com/521dimensions/cordova-plugin-screen-orientation.git#4fb9af0b6913378d02d02f5d3a999ce0a87a3580", + "dev": true, + "license": "Apache-2.0", + "engines": { + "cordovaDependencies": { + "4.0.0": { + "cordova": ">100" + } + } + } + }, + "node_modules/cordova-plugin-secure-storage-echo": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/cordova-plugin-secure-storage-echo/-/cordova-plugin-secure-storage-echo-5.1.1.tgz", + "integrity": "sha512-8TLY9ilM/K597vLKCEKwboJ0yjJqdlZAdc4GK67nqjaSbGOBso94uVNXQ6iAvrcXt+rnK1ZOFG3DI/n8S8aj/w==", + "dev": true + }, + "node_modules/cordova-plugin-statusbar": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/cordova-plugin-statusbar/-/cordova-plugin-statusbar-2.4.3.tgz", + "integrity": "sha512-ThmXzl6QIKWFXf4wWw7Q/zpB+VKkz3VM958+5A0sXD4jmR++u7KnGttLksXshVwWr6lvGwUebLYtIyXwS4Ovcg==", + "dev": true, + "engines": { + "cordovaDependencies": { + "0.1.0": { + "cordova": ">=3.0.0" + }, + "3.0.0": { + "cordova": ">100" + } + } + } }, "node_modules/cordova-plugin-streaming-media": { "version": "2.3.0", @@ -12915,6 +13026,24 @@ } } }, + "node_modules/cordova.plugins.diagnostic": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/cordova.plugins.diagnostic/-/cordova.plugins.diagnostic-7.1.4.tgz", + "integrity": "sha512-TMtxbe331ZyHJIYtvTmbFg5XEObuOHeoLYifhSAEcK4+RaBLzc4GhB6EkLq3I4Gb7khtB3km/5J6TsaVlAk3vQ==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "colors": "1.4.0", + "elementtree": "^0.1.6", + "minimist": "1.2.6" + } + }, + "node_modules/cordova.plugins.diagnostic/node_modules/minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true + }, "node_modules/core-js": { "version": "3.23.3", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.23.3.tgz", @@ -13317,11 +13446,6 @@ "url": "https://github.com/sponsors/fb55" } }, - "node_modules/css.escape": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", - "integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==" - }, "node_modules/cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", @@ -13484,19 +13608,19 @@ } }, "node_modules/datatables.net": { - "version": "1.10.20", - "resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-1.10.20.tgz", - "integrity": "sha512-4E4S7tTU607N3h0fZPkGmAtr9mwy462u+VJ6gxYZ8MxcRIjZqHy3Dv1GNry7i3zQCktTdWbULVKBbkAJkuHEnQ==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-2.0.5.tgz", + "integrity": "sha512-Eu7z0ErFyr44hopfLQ7kyIWRdfqH2zFG93aHcnGKGrt/ICWXUsLrjUwghuN5b1pktnKzXCFYsl6Ad9WypiSNeA==", "dependencies": { "jquery": ">=1.7" } }, "node_modules/datatables.net-dt": { - "version": "1.13.4", - "resolved": "https://registry.npmjs.org/datatables.net-dt/-/datatables.net-dt-1.13.4.tgz", - "integrity": "sha512-QAvuEej/qKSiaSmSeDQ36wWO72XzFGKkd0jdiqbp+2FHAAzIk+ffsqQAwylystMoBSiO0zlcdaqHoAPa5Dy7Pg==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/datatables.net-dt/-/datatables.net-dt-2.0.3.tgz", + "integrity": "sha512-1vz0QD+FoC/45J5MSuw2STzt0w6TShtT4QFFp9nLbx7LU1afds6bfVjLXTz12pg6i+2G0JFWKiErcYUSrHXvWQ==", "dependencies": { - "datatables.net": ">=1.12.1", + "datatables.net": "2.0.3", "jquery": ">=1.7" } }, @@ -13509,11 +13633,11 @@ } }, "node_modules/datatables.net-fixedcolumns": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/datatables.net-fixedcolumns/-/datatables.net-fixedcolumns-3.3.3.tgz", - "integrity": "sha512-xo6MeI2xc/Ufk4ffrpao+OiPo8/GPB8cO80gA6NFgYBVw6eP9pPa2NsV+gSWRVr7d3A8iZC7mUZT5WdtliNHEA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/datatables.net-fixedcolumns/-/datatables.net-fixedcolumns-5.0.0.tgz", + "integrity": "sha512-7dTJrVDkZCicx9g//N3ufuEjvwrZpcmpjbkwrtC5LiQFCnuL/hMOiOb4CBcvTg5OiTU7VmtbBuQkeAJGs3QM5g==", "dependencies": { - "datatables.net": "^1.10.15", + "datatables.net": ">=2.0.0", "jquery": ">=1.7" } }, @@ -21335,20 +21459,27 @@ } }, "node_modules/katex": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/katex/-/katex-0.11.1.tgz", - "integrity": "sha512-5oANDICCTX0NqYIyAiFCCwjQ7ERu3DQG2JFHLbYOf+fXaMoH8eg/zOq5WSYJsKMi/QebW+Eh3gSM+oss1H/bww==", + "version": "0.16.10", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.10.tgz", + "integrity": "sha512-ZiqaC04tp2O5utMsl2TEZTXxa6WSC4yo0fv5ML++D3QZv/vx2Mct0mTlRx3O+uUkjfuAgOkzsCmq5MiUEsDDdA==", + "funding": [ + "https://opencollective.com/katex", + "https://github.com/sponsors/katex" + ], "dependencies": { - "commander": "^2.19.0" + "commander": "^8.3.0" }, "bin": { "katex": "cli.js" } }, "node_modules/katex/node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "engines": { + "node": ">= 12" + } }, "node_modules/keycode": { "version": "2.2.1", @@ -25375,11 +25506,6 @@ "node": ">= 0.4.0" } }, - "node_modules/platform": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.3.tgz", - "integrity": "sha512-VJK1SRmXBpjwsB4YOHYSturx48rLKMzHgCqDH2ZDa6ZbMS/N5huoNqyQdK5Fj/xayu3fqbXckn5SeCS1EbMDZg==" - }, "node_modules/plist": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.2.tgz", @@ -27805,11 +27931,13 @@ }, "node_modules/sb-cordova-plugin-customtabs": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/Sunbird-Ed/sb-cordova-plugin-customtabs.git#d5a42f84ad0259b0d21b624c8dfc4e1811f3c132" + "resolved": "git+ssh://git@github.com/Sunbird-Ed/sb-cordova-plugin-customtabs.git#d5a42f84ad0259b0d21b624c8dfc4e1811f3c132", + "dev": true }, "node_modules/sb-cordova-plugin-db": { "version": "0.0.1", - "resolved": "git+ssh://git@github.com/Sunbird-Ed/sb-cordova-plugin-db.git#d606aa7bc11eccaf003974f619f95d2218b9f108" + "resolved": "git+ssh://git@github.com/Sunbird-Ed/sb-cordova-plugin-db.git#a86ab12796a30ff003d6abb121d592b7800137f4", + "dev": true }, "node_modules/sb-cordova-plugin-sync": { "version": "0.0.1", diff --git a/package.json b/package.json index 932489220f..8f66010df8 100644 --- a/package.json +++ b/package.json @@ -86,13 +86,12 @@ "@project-sunbird/common-form-elements": "8.0.4", "@project-sunbird/content-player": "5.1.0", "@project-sunbird/discussions-ui": "8.0.3", - "@project-sunbird/sb-dashlet": "8.0.1", + "@project-sunbird/sb-dashlet": "8.0.2", "@project-sunbird/sb-notification": "8.0.0", "@project-sunbird/sb-styles": "0.0.16", "@project-sunbird/sb-svg2pdf": "8.0.3", - "@project-sunbird/sunbird-epub-player-web-component": "1.2.0", - "@project-sunbird/sunbird-pdf-player-v9": "5.6.0", - "@project-sunbird/sunbird-pdf-player-web-component": "1.1.0", + "@project-sunbird/sunbird-epub-player-web-component": "^1.2.0", + "@project-sunbird/sunbird-pdf-player-web-component": "^1.1.0", "@project-sunbird/sunbird-quml-player-web-component": "3.0.3", "@project-sunbird/sunbird-sdk": "7.0.21", "@project-sunbird/sunbird-video-player-web-component": "^1.0.1", @@ -105,7 +104,9 @@ "core-js": "3.23.3", "crypto-js": "4.2.0", "datatables.net-dt": "1.13.4", - "datatables.net-fixedcolumns": "3.3.3", + "com.jjdltc.cordova.plugin.zip": "git+https://github.com/Sunbird-Ed/jjdltc-cordova-plugin-zip.git", + "cordova-plugin-badge": "0.8.8", + "datatables.net-fixedcolumns": "5.0.0", "dayjs": "1.9.8", "dom-to-image": "2.6.0", "epubjs": "0.3.93", @@ -115,7 +116,7 @@ "jest-preset-angular": "13.1.4", "jspdf": "2.5.1", "jwt-decode": "2.2.0", - "katex": "0.11.1", + "katex": "0.16.10", "lodash": "4.17.21", "lodash-es": "4.17.21", "material-design-icons": "3.0.1", @@ -266,8 +267,14 @@ "cordova-plugin-openrap": {}, "cordova-plugin-webview-checker": {}, "sb-cordova-plugin-utility": {}, - "cordova-plugin-printer": { - "ANDROID_SUPPORT_V4_VERSION": "28.+" + "cordova-plugin-printer": {}, + "cordova-plugin-fcm-with-dependecy-updated": { + "ANDROID_FIREBASE_BOM_VERSION": "26.5.0", + "GRADLE_TOOLS_VERSION": "3.5.0", + "GOOGLE_SERVICES_VERSION": "4.3.8", + "ANDROID_DEFAULT_NOTIFICATION_ICON": "@mipmap/ic_launcher", + "FCM_CORE_VERSION": "16.0.9", + "FCM_VERSION": "18.0.0" }, "com.telerik.plugins.nativepagetransitions": {}, "sb-cordova-plugin-sync": {}, diff --git a/src/app/player/player.module.ts b/src/app/player/player.module.ts index 5e54a56cc9..e021221e47 100644 --- a/src/app/player/player.module.ts +++ b/src/app/player/player.module.ts @@ -8,6 +8,9 @@ import { IonicModule } from '@ionic/angular'; import { PlayerPage } from './player.page'; import { CanvasPlayerService } from '../../services/canvas-player.service'; + + + const routes: Routes = [ { path: '', diff --git a/src/app/player/player.page.html b/src/app/player/player.page.html index 9ed3f78df6..d7909a271d 100644 --- a/src/app/player/player.page.html +++ b/src/app/player/player.page.html @@ -3,27 +3,36 @@ -
-
+ + + +
+
back
-
+
-
+ diff --git a/src/app/player/player.page.ts b/src/app/player/player.page.ts index 89a7743296..7a3d2c68f1 100644 --- a/src/app/player/player.page.ts +++ b/src/app/player/player.page.ts @@ -67,11 +67,8 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat cardData: any; @ViewChild('preview', { static: false }) previewElement: ElementRef; - @ViewChild('video') video: ElementRef | undefined; - @ViewChild('epub') epub: ElementRef; - @ViewChild('pdf') pdf!: ElementRef; - @ViewChild('qumlPlayer') qumlPlayer: ElementRef; - + @ViewChild('player') player: ElementRef; + constructor( @Inject('COURSE_SERVICE') private courseService: CourseService, @Inject('PROFILE_SERVICE') private profileService: ProfileService, @@ -116,35 +113,35 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat async ngOnInit() { console.log('ngoninit '); this.playerConfig = await this.formAndFrameworkUtilService.getPdfPlayerConfiguration(); - if(this.config['metadata'].hierarchyInfo) { - await this.getNextContent(this.config['metadata'].hierarchyInfo , this.config['metadata'].identifier) + if (this.config['metadata'].hierarchyInfo) { + await this.getNextContent(this.config['metadata'].hierarchyInfo, this.config['metadata'].identifier) } - if (this.config['metadata']['mimeType'] === 'application/pdf' && this.checkIsPlayerEnabled(this.playerConfig , 'pdfPlayer').name === "pdfPlayer") { - await ScreenOrientation.lock({orientation: 'landscape'}); + if (this.config['metadata']['mimeType'] === 'application/pdf' && this.checkIsPlayerEnabled(this.playerConfig, 'pdfPlayer').name === "pdfPlayer") { + await ScreenOrientation.lock({ orientation: 'landscape' }); this.config = await this.getNewPlayerConfiguration(); this.playerType = 'sunbird-pdf-player'; console.log('.........................', 128) this.playPdfContent(); - } else if (this.config['metadata']['mimeType'] === "application/epub" && this.checkIsPlayerEnabled(this.playerConfig , 'epubPlayer').name === "epubPlayer"){ - await ScreenOrientation.lock({orientation: 'landscape'}); + } else if (this.config['metadata']['mimeType'] === "application/epub" && this.checkIsPlayerEnabled(this.playerConfig, 'epubPlayer').name === "epubPlayer") { + await ScreenOrientation.lock({ orientation: 'landscape' }); this.config = await this.getNewPlayerConfiguration(); this.config['config'].sideMenu.showPrint = false; this.playerType = 'sunbird-epub-player' this.playepubContent(); - } else if(this.config['metadata']['mimeType'] === "application/vnd.sunbird.questionset" && this.checkIsPlayerEnabled(this.playerConfig , 'qumlPlayer').name === "qumlPlayer"){ - await ScreenOrientation.lock({orientation: 'landscape'}); + } else if (this.config['metadata']['mimeType'] === "application/vnd.sunbird.questionset" && this.checkIsPlayerEnabled(this.playerConfig, 'qumlPlayer').name === "qumlPlayer") { + await ScreenOrientation.lock({ orientation: 'landscape' }); this.cardData = this.content || this.router.getCurrentNavigation().extras?.state?.content; this.config = await this.getNewPlayerConfiguration(); this.config['config'].sideMenu.showDownload = false; this.config['config'].sideMenu.showPrint = false; this.config['config'].showDeviceOrientation = true - if( (this.config['metadata'].isAvailableLocally) ) { + if ((this.config['metadata'].isAvailableLocally)) { this.config['metadata'].children = await this.contentService.getQuestionSetChildren(this.config['metadata']['identifier']); this.playerType = 'sunbird-quml-player'; this.playQumlContent(); } else { - const questionSetData = await this.contentService.getQuestionSetChildren(this.config['metadata']['identifier']); - let questionId: string[] = []; + const questionSetData = await this.contentService.getQuestionSetChildren(this.config['metadata']['identifier']); + let questionId: string[] = []; questionSetData.forEach(item => { if (item.children) { item.children.forEach(child => { @@ -158,20 +155,20 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat } } }); - this.contentService.getQuestionList(questionId).subscribe((response) => { - this.config['metadata']['children'] = response.questions; - this.playerType = 'sunbird-quml-player'; - this.playQumlContent(); - }); - } - } else if(["video/mp4", "video/webm"].includes(this.config['metadata']['mimeType']) && this.checkIsPlayerEnabled(this.playerConfig , 'videoPlayer').name === "videoPlayer"){ - if(!this.platform.is('ios')){ - await ScreenOrientation.lock({orientation: 'landscape'}); + this.contentService.getQuestionList(questionId).subscribe((response) => { + this.config['metadata']['children'] = response.questions; + this.playerType = 'sunbird-quml-player'; + this.playQumlContent(); + }); + } + } else if (["video/mp4", "video/webm"].includes(this.config['metadata']['mimeType']) && this.checkIsPlayerEnabled(this.playerConfig, 'videoPlayer').name === "videoPlayer") { + if (!this.platform.is('ios')) { + await ScreenOrientation.lock({ orientation: 'landscape' }); } this.config = await this.getNewPlayerConfiguration(); this.config['config'].sideMenu.showPrint = false; - this.playerType = 'sunbird-video-player'; - await this.playWebVideoContent(); + this.playerType = 'sunbird-video-player'; + await this.playWebVideoContent(); } else { this.playerType = 'sunbird-old-player'; } @@ -182,7 +179,7 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat (res) => console.log('response after telemetry', res), ); } - }; + }; } this.pauseSubscription = this.platform.pause.subscribe(() => { @@ -197,7 +194,7 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat async ionViewWillEnter() { const playerInterval = setInterval(async () => { if (this.playerType === 'sunbird-old-player') { - await ScreenOrientation.lock({orientation: 'landscape'}); + await ScreenOrientation.lock({ orientation: 'landscape' }); StatusBar.hide(); this.config['uid'] = this.config['context'].actor.id; this.config['metadata'].basePath = '/_app_file_' + this.config['metadata'].basePath; @@ -291,11 +288,11 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat async toggleDeviceOrientation() { if ((await ScreenOrientation.orientation()).type.includes(AppOrientation.LANDSCAPE.toLocaleLowerCase())) { - await ScreenOrientation.unlock(); - await ScreenOrientation.lock({orientation: 'portrait'}); - } else { - await ScreenOrientation.unlock(); - await ScreenOrientation.lock({orientation: 'landscape'}); + await ScreenOrientation.unlock(); + await ScreenOrientation.lock({ orientation: 'portrait' }); + } else { + await ScreenOrientation.unlock(); + await ScreenOrientation.lock({ orientation: 'landscape' }); } } @@ -303,10 +300,10 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat await StatusBar.show(); const currentOrientation = await this.preferences.getString(PreferenceKey.ORIENTATION).toPromise(); if (currentOrientation === AppOrientation.LANDSCAPE) { - await ScreenOrientation.lock({orientation: 'landscape'}); + await ScreenOrientation.lock({ orientation: 'landscape' }); } else { await ScreenOrientation.unlock(); - await ScreenOrientation.lock({orientation: 'portrait'}); + await ScreenOrientation.lock({ orientation: 'portrait' }); } if (this.events) { @@ -367,12 +364,12 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat this.handleDownload(); } else if (event.edata['type'] === 'PRINT') { await this.printPdfService.printPdf(this.config['metadata'].streamingUrl); - } else if(event.edata.type === 'NEXT_CONTENT_PLAY') { - this.playNextContent(); + } else if (event.edata.type === 'NEXT_CONTENT_PLAY') { + this.playNextContent(); } else if (event.edata.type === 'compatibility-error') { cordova.plugins.InAppUpdateManager.checkForImmediateUpdate( - () => {}, - () => {} + () => { }, + () => { } ); } else if (event.edata.type === 'exdata') { if (event.edata.currentattempt) { @@ -390,7 +387,7 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat 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') { + if (event.detail.edata['type'] === 'EXIT') { this.playerService.deletePlayerSaveState(userId, parentId, contentId); if (this.config['metadata']['mimeType'] === "application/vnd.sunbird.questionset") { if (!this.isExitPopupShown) { @@ -407,22 +404,22 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat if (this.content.contentData.downloadUrl) { if (this.platform.is('ios')) { this.file.checkDir(this.file.documentsDirectory, 'downloads') - .then(() => { - this.file.checkFile(this.file.documentsDirectory, 'downloads/' + this.content.name + '.pdf') - .then(_ => {this.commonUtilService.showToast("A file with the same name already exists!")}) - .catch(() => { - this.downloadFileIos(this.content); - }) - }) - .catch(() => { - this.file.createDir(this.file.documentsDirectory, 'downloads', false) - .then(response => { - this.downloadFileIos(this.content); + .then(() => { + this.file.checkFile(this.file.documentsDirectory, 'downloads/' + this.content.name + '.pdf') + .then(_ => { this.commonUtilService.showToast("A file with the same name already exists!") }) + .catch(() => { + this.downloadFileIos(this.content); + }) }) - .catch((err) => { - this.commonUtilService.showToast('Error saving file: ' + err.message, false, 'redErrorToast'); + .catch(() => { + this.file.createDir(this.file.documentsDirectory, 'downloads', false) + .then(response => { + this.downloadFileIos(this.content); + }) + .catch((err) => { + this.commonUtilService.showToast('Error saving file: ' + err.message, false, 'redErrorToast'); + }) }) - }) } else { // android await this.downloadPdfService.downloadPdf(this.content).then((res) => { this.commonUtilService.showToast('CONTENT_DOWNLOADED'); @@ -452,75 +449,75 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat }).catch(err => { this.commonUtilService.showToast('SOMETHING_WENT_WRONG'); }); - },500) + }, 500) } async getNewPlayerConfiguration() { - const nextContent = this.config['metadata'].hierarchyInfo && this.nextContentToBePlayed ? { name: this.nextContentToBePlayed.contentData.name, identifier: this.nextContentToBePlayed.contentData.identifier } : undefined; - this.config['context']['pdata']['pid'] = 'sunbird.app.contentplayer'; - if (this.config['metadata'].isAvailableLocally) { - this.config['metadata'].contentData.streamingUrl = '/_app_file_' + this.config['metadata'].contentData.streamingUrl; + const nextContent = this.config['metadata'].hierarchyInfo && this.nextContentToBePlayed ? { name: this.nextContentToBePlayed.contentData.name, identifier: this.nextContentToBePlayed.contentData.identifier } : undefined; + this.config['context']['pdata']['pid'] = 'sunbird.app.contentplayer'; + if (this.config['metadata'].isAvailableLocally) { + this.config['metadata'].contentData.streamingUrl = '/_app_file_' + this.config['metadata'].contentData.streamingUrl; + } + this.config['metadata']['contentData']['basePath'] = '/_app_file_' + this.config['metadata'].basePath; + this.config['metadata']['contentData']['isAvailableLocally'] = this.config['metadata'].isAvailableLocally; + this.config['metadata'] = this.config['metadata'].contentData; + this.config['data'] = {}; + this.config['config'] = { + ...this.config['config'], + nextContent, + sideMenu: { + showShare: true, + showDownload: true, + showReplay: false, + showExit: true, + showPrint: true } - this.config['metadata']['contentData']['basePath'] = '/_app_file_' + this.config['metadata'].basePath; - this.config['metadata']['contentData']['isAvailableLocally'] = this.config['metadata'].isAvailableLocally; - this.config['metadata'] = this.config['metadata'].contentData; - this.config['data'] = {}; - this.config['config'] = { - ...this.config['config'], - nextContent, - sideMenu: { - showShare: true, - showDownload: true, - showReplay: false, - showExit: true, - showPrint: true - } - }; - - - if(this.config['metadata']['mimeType'] === "application/vnd.sunbird.questionset"){ - let questionSet; - try{ - questionSet = await this.contentService.getQuestionSetRead(this.content.identifier, {fields:'instructions,outcomeDeclaration'}).toPromise(); - this.config['metadata']['instructions'] = questionSet && questionSet.questionset.instructions ? questionSet.questionset.instructions : undefined; - this.config['metadata']['outcomeDeclaration'] = questionSet && questionSet.questionset.outcomeDeclaration ? questionSet.questionset.outcomeDeclaration : undefined; - } catch(e){ - console.log(e); - questionSet = await this.setContentDetails(this.content.identifier, true); - this.config['metadata']['instructions'] = questionSet && questionSet.contentData.instructions ? questionSet.contentData.instructions : undefined; - this.config['metadata']['outcomeDeclaration'] = questionSet && questionSet.contentData.outcomeDeclaration ? questionSet.contentData.outcomeDeclaration : undefined; - } + }; + + + if (this.config['metadata']['mimeType'] === "application/vnd.sunbird.questionset") { + let questionSet; + try { + questionSet = await this.contentService.getQuestionSetRead(this.content.identifier, { fields: 'instructions,outcomeDeclaration' }).toPromise(); + this.config['metadata']['instructions'] = questionSet && questionSet.questionset.instructions ? questionSet.questionset.instructions : undefined; + this.config['metadata']['outcomeDeclaration'] = questionSet && questionSet.questionset.outcomeDeclaration ? questionSet.questionset.outcomeDeclaration : undefined; + } catch (e) { + console.log(e); + questionSet = await this.setContentDetails(this.content.identifier, true); + this.config['metadata']['instructions'] = questionSet && questionSet.contentData.instructions ? questionSet.contentData.instructions : undefined; + this.config['metadata']['outcomeDeclaration'] = questionSet && questionSet.contentData.outcomeDeclaration ? questionSet.contentData.outcomeDeclaration : undefined; } - const profile = await this.profileService.getActiveSessionProfile({ requiredFields: ProfileConstants.REQUIRED_FIELDS }).toPromise(); - this.config['context'].userData = { - firstName: profile && profile.serverProfile && profile.serverProfile.firstName ? profile.serverProfile.firstName : profile.handle, - lastName: '' - }; - return this.config; + } + const profile = await this.profileService.getActiveSessionProfile({ requiredFields: ProfileConstants.REQUIRED_FIELDS }).toPromise(); + this.config['context'].userData = { + firstName: profile && profile.serverProfile && profile.serverProfile.firstName ? profile.serverProfile.firstName : profile.handle, + lastName: '' + }; + return this.config; } async setContentDetails(identifier, refreshContentDetails: boolean) { try { - const option: ContentDetailRequest = { - contentId: identifier, - objectType: this.cardData.objectType, - attachFeedback: true, - attachContentAccess: true, - emitUpdateIfAny: refreshContentDetails - }; - - const data: Content | any = await this.contentService.getContentDetails(option).toPromise(); - - if (data) { - console.log(data, 'data'); - return data; - } + const option: ContentDetailRequest = { + contentId: identifier, + objectType: this.cardData.objectType, + attachFeedback: true, + attachContentAccess: true, + emitUpdateIfAny: refreshContentDetails + }; + + const data: Content | any = await this.contentService.getContentDetails(option).toPromise(); + + if (data) { + console.log(data, 'data'); + return data; + } } catch (error) { - console.log('error while loading content details', error); - this.commonUtilService.showToast('ERROR_CONTENT_NOT_AVAILABLE'); - this.location.back(); + console.log('error while loading content details', error); + this.commonUtilService.showToast('ERROR_CONTENT_NOT_AVAILABLE'); + this.location.back(); } -} + } getNextContent(hierarchyInfo, identifier) { return new Promise((resolve) => { this.contentService.nextContent(hierarchyInfo, identifier).subscribe((res) => { @@ -530,7 +527,7 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat }) } - playNextContent(){ + playNextContent() { const content = this.nextContentToBePlayed; this.events.publish(EventTopics.NEXT_CONTENT, { content, @@ -590,7 +587,7 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat }, replaceUrl: true }); - } else if (this.navigateBackToTrackableCollection) { + } else if (this.navigateBackToTrackableCollection) { await this.router.navigate([RouterLinks.ENROLLED_COURSE_DETAILS], { state: { content @@ -628,8 +625,8 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat role: 'cancel', handler: () => { this.isExitPopupShown = false; - this.telemetryGeneratorService.generateInteractTelemetry(InteractType.TOUCH, - InteractSubtype.CANCEL_CLICKED, + this.telemetryGeneratorService.generateInteractTelemetry(InteractType.TOUCH, + InteractSubtype.CANCEL_CLICKED, Environment.PLAYER, PageId.PLAYER_PAGE); this.previewElement.nativeElement.contentWindow['TelemetryService'].interact( @@ -638,9 +635,9 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat }, { text: this.commonUtilService.translateMessage('OKAY'), - handler: async() => { - this.telemetryGeneratorService.generateInteractTelemetry(InteractType.TOUCH, - InteractSubtype.OK_CLICKED, + handler: async () => { + this.telemetryGeneratorService.generateInteractTelemetry(InteractType.TOUCH, + InteractSubtype.OK_CLICKED, Environment.PLAYER, PageId.PLAYER_PAGE); if (this.playerType === 'sunbird-old-player') { @@ -650,7 +647,7 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat this.previewElement.nativeElement.contentWindow['EkstepRendererAPI'].dispatchEvent('renderer:telemetry:end'); this.closeIframe(); } - else{ + else { this.location.back(); } } @@ -721,7 +718,7 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat if (event) { SunbirdSdk.instance.telemetryService.saveTelemetry(JSON.stringify(event)).subscribe( (res) => console.log('response after telemetry', res), - ); + ); } } @@ -734,8 +731,8 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat } } - checkIsPlayerEnabled(config , playerType) { - return config.fields.find(ele => ele.name === playerType && ele.values[0].isEnabled); + checkIsPlayerEnabled(config, playerType) { + return config.fields.find(ele => ele.name === playerType && ele.values[0].isEnabled); } playWebVideoContent() { @@ -744,7 +741,7 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat context: this.config.context, config: this.config.config, metadata: this.config.metadata - }; + }; setTimeout(() => { const videoElement = document.createElement('sunbird-video-player'); @@ -757,8 +754,8 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat videoElement.addEventListener('telemetryEvent', (event: any) => { this.playerTelemetryEvents(event.detail); }); - - this.video?.nativeElement.append(videoElement); + + this.player?.nativeElement.append(videoElement); }, 100); } } @@ -769,7 +766,7 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat context: this.config.context, config: this.config.config, metadata: this.config.metadata - }; + }; setTimeout(() => { const epubElement = document.createElement('sunbird-epub-player'); epubElement.setAttribute('player-config', JSON.stringify(playerConfig)); @@ -778,19 +775,16 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat console.log("On playerEvent", event); this.playerEvents(event) }); - + + epubElement.addEventListener('playerEvent', (event) => { + console.log("On playerEvent", event); + }); + epubElement.addEventListener('telemetryEvent', (event) => { console.log("On telemetryEvent", event); - this.playerTelemetryEvents(event); }); - if(this.epub?.nativeElement) { - this.epub.nativeElement.append(epubElement); - } else { - console.error("epub player or its native element is not available."); - } - }, 500); - } else { - console.error("Invalid player type or missing config."); + this.player.nativeElement.append(epubElement); + }, 100); } } @@ -799,29 +793,29 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat context: this.config.context, config: this.config.config, metadata: this.config.metadata - }; + }; setTimeout(() => { const pdfElement = document.createElement('sunbird-pdf-player'); - pdfElement.setAttribute('player-config', JSON.stringify(playerConfig)); - pdfElement.addEventListener('playerEvent', (event: any) => { - if (event && event.detail) { - this.playerEvents(event.detail); - } - }); - pdfElement.addEventListener('telemetryEvent', (event: any) => { - this.playerTelemetryEvents(event.detail); - }); - this.pdf.nativeElement.append(pdfElement); + pdfElement.setAttribute('player-config', JSON.stringify(playerConfig)); + pdfElement.addEventListener('playerEvent', (event: any) => { + if (event && event.detail) { + this.playerEvents(event.detail); + } + }); + pdfElement.addEventListener('telemetryEvent', (event: any) => { + this.playerTelemetryEvents(event.detail); + }); + this.player.nativeElement.append(pdfElement); }, 100); } - async playQumlContent() { - if (this.playerType === 'sunbird-quml-player' && this.config) { + async playQumlContent() { + if (this.playerType === 'sunbird-quml-player' && this.config && this.player) { const playerConfig: any = { context: this.config.context, config: this.config.config, metadata: this.config.metadata - }; + }; setTimeout(() => { const qumlElement = document.createElement('sunbird-quml-player'); qumlElement.setAttribute('player-config', JSON.stringify(playerConfig)); @@ -833,8 +827,9 @@ export class PlayerPage implements OnInit, OnDestroy, PlayerActionHandlerDelegat console.log("On telemetryEvent", event); this.playerTelemetryEvents(event); }); - if (this.qumlPlayer && this.qumlPlayer.nativeElement) { - this.qumlPlayer.nativeElement.append(qumlElement); + + if (this.player && this.player.nativeElement) { + this.player.nativeElement.append(qumlElement); } else { console.error("qumlPlayer or its native element is not available."); } diff --git a/tsconfig.json b/tsconfig.json index d2a352fa61..d75e26b033 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,7 @@ "compileOnSave": false, "angularCompilerOptions": { "strictTemplates": true, + "enableIvy": true, "fullTemplateTypeCheck": true, "strictInjectionParameters": true },