@@ -33,19 +33,19 @@ module.exports = {
3333 cordova . exec ( success , error , 'System' , 'getNativeLibraryPath' , [ ] ) ;
3434 } ,
3535
36- getFilesDir : function ( success , error ) {
37- cordova . exec ( success , error , 'System' , 'getFilesDir' , [ ] ) ;
38- } ,
39- getRewardStatus : function ( success , error ) {
40- cordova . exec ( success , error , 'System' , 'getRewardStatus' , [ ] ) ;
41- } ,
42- redeemReward : function ( offerId , success , error ) {
43- cordova . exec ( success , error , 'System' , 'redeemReward' , [ offerId ] ) ;
44- } ,
45-
46- getParentPath : function ( path , success , error ) {
47- cordova . exec ( success , error , 'System' , 'getParentPath' , [ path ] ) ;
48- } ,
36+ getFilesDir : function ( success , error ) {
37+ cordova . exec ( success , error , 'System' , 'getFilesDir' , [ ] ) ;
38+ } ,
39+ getRewardStatus : function ( success , error ) {
40+ cordova . exec ( success , error , 'System' , 'getRewardStatus' , [ ] ) ;
41+ } ,
42+ redeemReward : function ( offerId , success , error ) {
43+ cordova . exec ( success , error , 'System' , 'redeemReward' , [ offerId ] ) ;
44+ } ,
45+
46+ getParentPath : function ( path , success , error ) {
47+ cordova . exec ( success , error , 'System' , 'getParentPath' , [ path ] ) ;
48+ } ,
4949
5050 listChildren : function ( path , success , error ) {
5151 cordova . exec ( success , error , 'System' , 'listChildren' , [ path ] ) ;
@@ -135,36 +135,49 @@ module.exports = {
135135 onError : null ,
136136 } ;
137137
138- cordova . exec ( function ( data ) {
139- if ( typeof data !== 'string' ) {
140- console . warn ( 'System.inAppBrowser: invalid callback payload' , data ) ;
141- return ;
142- }
143- var separatorIndex = data . indexOf ( ':' ) ;
144- if ( separatorIndex < 0 ) {
145- console . warn ( 'System.inAppBrowser: malformed callback payload' , data ) ;
146- return ;
147- }
148- var dataTag = data . slice ( 0 , separatorIndex ) ;
149- var dataUrl = data . slice ( separatorIndex + 1 ) ;
150- if ( dataTag === 'onOpenExternalBrowser' ) {
151- if ( typeof myInAppBrowser . onOpenExternalBrowser === 'function' ) {
152- myInAppBrowser . onOpenExternalBrowser ( dataUrl ) ;
153- } else {
154- console . warn ( 'System.inAppBrowser: onOpenExternalBrowser handler is not set' ) ;
155- }
156- }
157- } , function ( err ) {
158- if ( typeof myInAppBrowser . onError === 'function' ) {
159- myInAppBrowser . onError ( err ) ;
160- return ;
161- }
162- console . warn ( 'System.inAppBrowser error callback not handled' , err ) ;
163- } , 'System' , 'in-app-browser' , [ url , title , ! ! showButtons , disableCache ] ) ;
138+ cordova . exec ( function ( data ) {
139+ if ( typeof data !== 'string' ) {
140+ console . warn ( 'System.inAppBrowser: invalid callback payload' , data ) ;
141+ return ;
142+ }
143+ var separatorIndex = data . indexOf ( ':' ) ;
144+ if ( separatorIndex < 0 ) {
145+ console . warn ( 'System.inAppBrowser: malformed callback payload' , data ) ;
146+ return ;
147+ }
148+ var dataTag = data . slice ( 0 , separatorIndex ) ;
149+ var dataUrl = data . slice ( separatorIndex + 1 ) ;
150+ if ( dataTag === 'onOpenExternalBrowser' ) {
151+ if ( typeof myInAppBrowser . onOpenExternalBrowser === 'function' ) {
152+ myInAppBrowser . onOpenExternalBrowser ( dataUrl ) ;
153+ } else {
154+ console . warn ( 'System.inAppBrowser: onOpenExternalBrowser handler is not set' ) ;
155+ }
156+ }
157+ } , function ( err ) {
158+ if ( typeof myInAppBrowser . onError === 'function' ) {
159+ myInAppBrowser . onError ( err ) ;
160+ return ;
161+ }
162+ console . warn ( 'System.inAppBrowser error callback not handled' , err ) ;
163+ } , 'System' , 'in-app-browser' , [ url , title , ! ! showButtons , disableCache ] ) ;
164164 return myInAppBrowser ;
165165 } ,
166166 setUiTheme : function ( systemBarColor , theme , onSuccess , onFail ) {
167- cordova . exec ( onSuccess , onFail , 'System' , 'set-ui-theme' , [ systemBarColor , theme ] ) ;
167+ const color = systemBarColor . toLowerCase ( ) ;
168+
169+ if ( color === '#ffffff' || color === '#ffffffff' ) {
170+ systemBarColor = '#fffffe' ;
171+ }
172+
173+ cordova . exec ( ( out ) => {
174+ window . statusbar . setBackgroundColor ( systemBarColor ) ;
175+
176+ if ( typeof onSuccess === "function" ) {
177+ onSuccess ( out ) ;
178+ }
179+
180+ } , onFail , 'System' , 'set-ui-theme' , [ systemBarColor , theme ] ) ;
168181 } ,
169182 setIntentHandler : function ( handler , onerror ) {
170183 cordova . exec ( handler , onerror , 'System' , 'set-intent-handler' , [ ] ) ;
0 commit comments