diff --git a/buildConfig/data/staging/form/form-config_webview_version_get.json b/buildConfig/data/staging/form/form-config_webview_version_get.json
new file mode 100644
index 0000000000..7d27f91257
--- /dev/null
+++ b/buildConfig/data/staging/form/form-config_webview_version_get.json
@@ -0,0 +1,32 @@
+{
+ "id": "api.form.read",
+ "params": {
+ "resmsgid": "cc557f06-5fcf-4feb-919d-627944163857",
+ "msgid": "f0dcdf53-4949-431c-b804-2dbf21886153",
+ "status": "successful"
+ },
+ "responseCode": "OK",
+ "result": {
+ "form": {
+ "type": "config",
+ "subtype": "webview_version",
+ "action": "get",
+ "component": "*",
+ "framework": "*",
+ "data": {
+ "templateName": "webview_version",
+ "action": "get",
+ "fields": [
+ {
+ "version": "54"
+ }
+ ]
+ },
+ "created_on": "2020-01-07T10:51:43.203Z",
+ "last_modified_on": null,
+ "rootOrgId": "*"
+ }
+ },
+ "ts": "2020-01-07T10:52:04.924Z",
+ "ver": "1.0"
+}
\ No newline at end of file
diff --git a/build_config b/build_config
index 555a7d78ba..18b08dc95d 100644
--- a/build_config
+++ b/build_config
@@ -12,6 +12,7 @@ cordova-plugin=cordova-plugin-inappbrowser
cordova-plugin=cordova-plugin-console
cordova-plugin=cordova-plugin-network-information
cordova-plugin=cordova-plugin-statusbar
+cordova-plugin=cordova-plugin-webview-checker
cordova-plugin=https://github.com/adriano-di-giovanni/cordova-plugin-shared-preferences.git
cordova-plugin=https://github.com/katzer/cordova-plugin-local-notifications.git
cordova-plugin=https://github.com/swayangjit/cordova-plugin-fcm-with-dependecy-updated.git
diff --git a/config.xml b/config.xml
index 34e6543444..c64ecfee90 100644
--- a/config.xml
+++ b/config.xml
@@ -143,5 +143,6 @@
+
diff --git a/package.json b/package.json
index 149a040881..190bad3649 100644
--- a/package.json
+++ b/package.json
@@ -79,6 +79,7 @@
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-sunbirdsplash": "git+https://github.com/project-sunbird/cordova-plugin-sunbirdsplash.git#release-2.3.0",
"cordova-plugin-uniquedeviceid": "^1.3.2",
+ "cordova-plugin-webview-checker": "^1.0.1",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-plugin-x-socialsharing": "^5.6.2",
"cordova-plugin-zip": "^3.1.0",
@@ -184,10 +185,11 @@
"ANDROID_SUPPORT_VERSION": "28.0.0"
},
"cordova-plugin-openrap": {},
- "cordova-plugin-networkspeed": {}
+ "cordova-plugin-networkspeed": {},
+ "cordova-plugin-webview-checker": {}
},
"platforms": [
"android"
]
}
-}
+}
\ No newline at end of file
diff --git a/src/app/app.component.html b/src/app/app.component.html
index 0c59c0d787..a7d213667e 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -38,4 +38,26 @@
+
+
+
+
+
+
+ {{'UPDATE_REQUIRED' | translate}}
+
+
+
+
{{'WEBVIEW_UPDATE_TEXT' | translate}}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 0f6f296dc1..778b9c9844 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -132,9 +132,33 @@ export class AppComponent implements OnInit, AfterViewInit {
this.appRatingService.checkInitialDate();
this.getUtmParameter();
this.checkForCodeUpdates();
+ this.checkAndroidWebViewVersion();
});
}
+ checkAndroidWebViewVersion() {
+ var that = this;
+ plugins['webViewChecker'].getAndroidWebViewPackageInfo()
+ .then(function(packageInfo) {
+ that.formAndFrameworkUtilService.getWebviewConfig().then(function(webviewVersion) {
+ if (parseInt(packageInfo.versionName.split('.')[0], 10) <= webviewVersion) {
+ document.getElementById('update-webview-container').style.display = 'block';
+ }
+ }).catch(function(err) {
+ if (parseInt(packageInfo.versionName.split('.')[0], 10) <= 54) {
+ document.getElementById('update-webview-container').style.display = 'block';
+ }
+ });
+ })
+ .catch(function(error) { });
+ }
+
+ openPlaystore() {
+ plugins['webViewChecker'].openGooglePlayPage()
+ .then(function() { })
+ .catch(function(error) { });
+ }
+
getSystemConfig() {
const getSystemSettingsRequest: GetSystemSettingsRequest = {
id: SystemSettingsIds.COURSE_FRAMEWORK_ID
diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json
index 8d91cb87cd..b95e658a59 100644
--- a/src/assets/i18n/en.json
+++ b/src/assets/i18n/en.json
@@ -624,5 +624,8 @@
"TRAINING_ENDED_START_ASSESSMENT": "The training has ended. You may take the assessment but, your progress will not be recorded.",
"REDO_ASSESSMENT": "Redo Assessment",
"TRAINING_ENDED_REDO_ASSESSMENT": "The training has ended. You may redo the assessment but, your progress will not be recorded.",
- "REDO": "Redo"
+ "REDO": "Redo",
+ "UPDATE_REQUIRED": "Update Required",
+ "DOWNLOAD_NOW": "Download Now",
+ "WEBVIEW_UPDATE_TEXT": "For an effective experience, download the latest version of webview from Google Play store."
}
\ No newline at end of file
diff --git a/src/services/formandframeworkutil.service.ts b/src/services/formandframeworkutil.service.ts
index e91240c26e..d13559b9c6 100644
--- a/src/services/formandframeworkutil.service.ts
+++ b/src/services/formandframeworkutil.service.ts
@@ -545,4 +545,26 @@ export class FormAndFrameworkUtilService {
});
});
}
+
+ // get the required webview version
+ getWebviewConfig() {
+ return new Promise((resolve, reject) => {
+ const req: FormRequest = {
+ type: 'config',
+ subType: 'webview_version',
+ action: 'get',
+ };
+ // form api call
+ this.formService.getForm(req).toPromise()
+ .then((res: any) => {
+ if (res.form && res.form.data && res.form.data.fields[0].version) {
+ resolve(parseInt(res.form.data.fields[0].version, 10));
+ } else {
+ resolve(54);
+ }
+ }).catch((error: any) => {
+ reject(error);
+ });
+ });
+ }
}