2017-03-20 16:38:14 -04:00
import { Injectable } from '@angular/core' ;
import { Cordova , CordovaProperty , Plugin } from '@ionic-native/core' ;
2016-07-17 20:21:38 +02:00
2015-11-28 16:17:04 -06:00
2016-02-16 17:42:41 -06:00
declare var window ;
2016-01-25 16:20:36 -06:00
/**
2016-03-24 13:00:18 -04:00
* @name Status Bar
2016-03-12 18:30:16 -05:00
* @description
2016-01-25 16:20:36 -06:00
* Manage the appearance of the native status bar.
*
2016-02-16 17:42:41 -06:00
* Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar).
2016-03-12 18:30:16 -05:00
*
* @usage
2016-07-20 17:17:09 +02:00
* ```typescript
2017-03-20 16:38:14 -04:00
* import { StatusBar } from '@ionic-native/status-bar';
2016-03-24 13:00:18 -04:00
*
2017-03-20 16:38:14 -04:00
* constructor(private statusBar: StatusBar) { }
2016-03-24 13:00:18 -04:00
*
2017-03-20 16:38:14 -04:00
* ...
2016-03-24 13:00:18 -04:00
*
2017-03-20 16:38:14 -04:00
*
* this.statusBar.overlaysWebView(true); // let status bar overlay webview
*
* this.statusBar.backgroundColorByHexString('#ffffff'); // set status bar to white
2016-03-12 18:30:16 -05:00
* ```
*
2016-01-25 16:20:36 -06:00
*/
2015-11-28 18:26:55 -06:00
@Plugin ( {
2016-10-27 12:48:50 -05:00
pluginName : 'StatusBar' ,
2015-11-28 16:17:04 -06:00
plugin : 'cordova-plugin-statusbar' ,
2016-02-22 16:20:00 -05:00
pluginRef : 'StatusBar' ,
2016-06-11 10:44:11 -04:00
repo : 'https://github.com/apache/cordova-plugin-statusbar' ,
platforms : [ 'iOS' , 'Android' , 'Windows Phone 8' , 'Windows 8' , 'Windows 10' ]
2015-11-28 18:26:55 -06:00
} )
2017-03-20 16:38:14 -04:00
@Injectable ( )
2015-11-28 18:26:55 -06:00
export class StatusBar {
2016-01-25 16:20:36 -06:00
/**
* Set whether the status bar overlays the main app view. The default
* is true.
*
2016-02-16 17:42:41 -06:00
* @param {boolean} doesOverlay Whether the status bar overlays the main app view.
2016-01-25 16:20:36 -06:00
*/
2016-02-16 17:42:41 -06:00
@Cordova ( {
sync : true
} )
2017-03-20 16:38:14 -04:00
overlaysWebView ( doesOverlay : boolean ) { } ;
2016-01-25 16:20:36 -06:00
2016-02-16 17:42:41 -06:00
/**
* Use the default statusbar (dark text, for light backgrounds).
*/
@Cordova ( {
sync : true
} )
2017-03-20 16:38:14 -04:00
styleDefault() { } ;
2016-01-25 16:20:36 -06:00
2016-02-16 17:42:41 -06:00
/**
* Use the lightContent statusbar (light text, for dark backgrounds).
*/
@Cordova ( {
sync : true
} )
2017-03-20 16:38:14 -04:00
styleLightContent() { } ;
2016-01-25 16:20:36 -06:00
2016-02-16 17:42:41 -06:00
/**
* Use the blackTranslucent statusbar (light text, for dark backgrounds).
*/
@Cordova ( {
sync : true
} )
2017-03-20 16:38:14 -04:00
styleBlackTranslucent() { } ;
2016-02-16 17:42:41 -06:00
/**
* Use the blackOpaque statusbar (light text, for dark backgrounds).
*/
@Cordova ( {
sync : true
} )
2017-03-20 16:38:14 -04:00
styleBlackOpaque() { } ;
2016-01-25 16:20:36 -06:00
/**
* Set the status bar to a specific named color. Valid options:
* black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown.
*
2016-04-15 18:20:41 +08:00
* iOS note: you must call StatusBar.overlaysWebView(false) to enable color changing.
2016-01-25 16:20:36 -06:00
*
2016-02-16 17:42:41 -06:00
* @param {string} colorName The name of the color (from above)
2016-01-25 16:20:36 -06:00
*/
2016-02-16 17:42:41 -06:00
@Cordova ( {
sync : true
} )
2017-03-20 16:38:14 -04:00
backgroundColorByName ( colorName : string ) { } ;
2016-01-25 16:20:36 -06:00
/**
* Set the status bar to a specific hex color (CSS shorthand supported!).
*
2016-04-15 18:20:41 +08:00
* iOS note: you must call StatusBar.overlaysWebView(false) to enable color changing.
2016-01-25 16:20:36 -06:00
*
2016-02-16 17:42:41 -06:00
* @param {string} hexString The hex value of the color.
2016-01-25 16:20:36 -06:00
*/
2016-02-16 17:42:41 -06:00
@Cordova ( {
sync : true
} )
2017-03-20 16:38:14 -04:00
backgroundColorByHexString ( hexString : string ) { } ;
2016-01-25 16:20:36 -06:00
/**
* Hide the StatusBar
*/
2016-02-16 17:42:41 -06:00
@Cordova ( {
sync : true
} )
2017-03-20 16:38:14 -04:00
hide() { } ;
2016-01-25 16:20:36 -06:00
/**
* Show the StatusBar
*/
2016-02-16 17:42:41 -06:00
@Cordova ( {
sync : true
} )
2017-03-20 16:38:14 -04:00
show() { } ;
2016-02-16 17:42:41 -06:00
/**
* Whether the StatusBar is currently visible or not.
*/
2016-03-04 13:56:22 -06:00
@CordovaProperty
2017-03-20 16:38:14 -04:00
isVisible : boolean ;
2016-07-17 20:21:38 +02:00
2015-11-28 16:17:04 -06:00
}