From bf7869cec7a46e0a538c2e4d61ffa28ddba135cf Mon Sep 17 00:00:00 2001 From: daserge Date: Wed, 24 Feb 2016 10:32:46 +0300 Subject: [PATCH] CB-10683 Fix wrong StatusBar.isVisible initial value on Windows --- src/windows/StatusBarProxy.js | 6 ++++-- www/statusbar.js | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/windows/StatusBarProxy.js b/src/windows/StatusBarProxy.js index 1755fb7..3929ff0 100644 --- a/src/windows/StatusBarProxy.js +++ b/src/windows/StatusBarProxy.js @@ -55,9 +55,11 @@ function hexToRgb(hex) { module.exports = { _ready: function(win, fail) { - win(statusBar.occludedRect.height !== 0); + if(isSupported()) { + var statusBar = getViewStatusBar(); + win(statusBar.occludedRect.height !== 0); + } }, - overlaysWebView: function () { // not supported }, diff --git a/www/statusbar.js b/www/statusbar.js index afef7dd..d9d0ea5 100644 --- a/www/statusbar.js +++ b/www/statusbar.js @@ -97,15 +97,17 @@ var StatusBar = { }; -// prime it -exec(function (res) { - if (typeof res == 'object') { - if (res.type == 'tap') { - cordova.fireWindowEvent('statusTap'); +// prime it. setTimeout so that proxy gets time to init +window.setTimeout(function () { + exec(function (res) { + if (typeof res == 'object') { + if (res.type == 'tap') { + cordova.fireWindowEvent('statusTap'); + } + } else { + StatusBar.isVisible = res; } - } else { - StatusBar.isVisible = res; - } -}, null, "StatusBar", "_ready", []); + }, null, "StatusBar", "_ready", []); +}, 0); module.exports = StatusBar;