From 4bcd9edbf31a5319f66058eaa1bab1ed9ef258b7 Mon Sep 17 00:00:00 2001 From: "K. Shankari" Date: Sun, 19 Apr 2020 15:46:04 -0700 Subject: [PATCH] Add the sensor explanation as a page after the consent To clarify which button people should press, specific to the version. This fixes https://github.com/e-mission/e-mission-docs/issues/483 --- www/js/intro.js | 17 ++++++++++------- www/templates/intro/consent.html | 2 +- www/templates/intro/intro.html | 3 +++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/www/js/intro.js b/www/js/intro.js index c4adf1de5..afa2d993a 100644 --- a/www/js/intro.js +++ b/www/js/intro.js @@ -39,25 +39,28 @@ angular.module('emission.intro', ['emission.splash.startprefs', } } console.log("Explanation = "+$scope.locationPermExplanation); - - $scope.getConsentFile = function () { + + // The language comes in between the first and second part + $scope.geti18nFile = function (fpFirstPart, fpSecondPart) { var lang = $translate.use(); - $scope.consentFile = "templates/intro/sensor_explanation.html"; + var defaultVal = fpFirstPart + fpSecondPart; if (lang != 'en') { - var url = "www/i18n/intro/consent-" + lang + ".html"; + var url = fpFirstPart + lang + fpSecondPart; $cordovaFile.checkFile(cordova.file.applicationDirectory, url).then( function(result){ window.Logger.log(window.Logger.LEVEL_DEBUG, "Successfully found the consent file, result is " + JSON.stringify(result)); - $scope.consentFile = url.replace("www/", ""); + return url.replace("www/", ""); }, function (err) { window.Logger.log(window.Logger.LEVEL_DEBUG, "Consent file not found, loading english version, error is " + JSON.stringify(err)); - $scope.consentFile = "templates/intro/sensor_explanation.html"; + return defaultVal; }); } + return defaultVal; } - $scope.getConsentFile(); + $scope.consentFile = $scope.geti18nFile("templates/intro/consent", ".html"); + $scope.explainFile = $scope.geti18nFile("templates/intro/sensor_explanation", ".html"); $scope.getIntroBox = function() { return $ionicSlideBoxDelegate.$getByHandle('intro-box'); diff --git a/www/templates/intro/consent.html b/www/templates/intro/consent.html index 3f8654bf0..c39b710b2 100644 --- a/www/templates/intro/consent.html +++ b/www/templates/intro/consent.html @@ -107,7 +107,7 @@

Questions

- +
diff --git a/www/templates/intro/intro.html b/www/templates/intro/intro.html index 671f660af..f4fdc0e31 100644 --- a/www/templates/intro/intro.html +++ b/www/templates/intro/intro.html @@ -6,6 +6,9 @@ + + +