Skip to content
Permalink
Browse files
CB-11487 (browser) The "standard" AutoHideSplashScreen config.xml pro…
…perty is now supported by the browser platform.
  • Loading branch information
petermetz authored and alsorokin committed Jul 11, 2017
1 parent 2db7bac commit 87d29ad6d3d5ddeaf2986b8c7b54d9e34bd46efc
Showing 1 changed file with 11 additions and 3 deletions.
@@ -31,6 +31,7 @@ var splashScreenDelay = 3000; // in milliseconds
var showSplashScreen = true; // show splashcreen by default
var cordova = require('cordova');
var configHelper = cordova.require('cordova/confighelper');
var autoHideSplashScreen = true;

function updateImageLocation() {
position.width = Math.min(splashImageWidth, window.innerWidth);
@@ -103,8 +104,10 @@ function readPreferencesFromCfg(cfg) {
bgColor = cfg.getPreferenceValue('SplashScreenBackgroundColor') || bgColor;
splashImageWidth = cfg.getPreferenceValue('SplashScreenWidth') || splashImageWidth;
splashImageHeight = cfg.getPreferenceValue('SplashScreenHeight') || splashImageHeight;
autoHideSplashScreen = cfg.getPreferenceValue('AutoHideSplashScreen') || autoHideSplashScreen;
autoHideSplashScreen = (autoHideSplashScreen === true || autoHideSplashScreen.toLowerCase() === 'true');
} catch(e) {
var msg = '[Browser][SplashScreen] Error occured on loading preferences from config.xml: ' + JSON.stringify(e);
var msg = '[Browser][SplashScreen] Error occurred on loading preferences from config.xml: ' + JSON.stringify(e);
console.error(msg);
}
}
@@ -123,12 +126,17 @@ function showAndHide() {
}

/**
* Tries to read config.xml and override default properties and then shows and hides splashcreen if it is enabled.
* Tries to read config.xml and override default properties and then shows and hides splashscreen if it is enabled.
*/
(function initAndShow() {
configHelper.readConfig(function(config) {
readPreferencesFromCfg(config);
showAndHide();
if (autoHideSplashScreen) {
showAndHide();
} else {
SplashScreen.show();
}

}, function(err) {
console.error(err);
});

0 comments on commit 87d29ad

Please sign in to comment.