mirror of
https://github.com/apache/cordova-plugin-statusbar.git
synced 2025-01-19 01:12:49 +08:00
added checks for running on windows when StatusBar is NOT available
This commit is contained in:
parent
251e904492
commit
c89fdd4617
@ -19,16 +19,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
var isSupported = true; // we assume
|
||||
|
||||
function getViewStatusBar() {
|
||||
return Windows.UI.ViewManagement.StatusBar.getForCurrentView();
|
||||
if(isSupported) {
|
||||
var ViewMan = Windows.UI.ViewManagement; // quick alias to save char
|
||||
if( ViewMan.StatusBar &&
|
||||
ViewMan.StatusBar.getForCurrentView ) {
|
||||
return ViewMan.StatusBar.getForCurrentView();
|
||||
}
|
||||
|
||||
function darkForeground () {
|
||||
|
||||
else {
|
||||
isSupported = false; // so we won't check again
|
||||
}
|
||||
|
||||
function lightForeground() {
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function hexToRgb(hex) {
|
||||
@ -78,8 +82,10 @@ module.exports = {
|
||||
backgroundColorByHexString: function (win, fail, args) {
|
||||
var rgb = hexToRgb(args[0]);
|
||||
var statusBar = getViewStatusBar();
|
||||
if(statusBar) {
|
||||
statusBar.backgroundColor = { a: 0, r: rgb.r, g: rgb.g, b: rgb.b };
|
||||
statusBar.backgroundOpacity = 1;
|
||||
}
|
||||
},
|
||||
|
||||
show: function (win, fail) {
|
||||
|
Loading…
Reference in New Issue
Block a user