mirror of
https://github.com/apache/cordova-plugin-statusbar.git
synced 2026-05-16 00:03:40 +08:00
refactor!: remove deprecated methods (#229)
This commit is contained in:
@@ -70,9 +70,6 @@ public class StatusBar extends CordovaPlugin {
|
||||
|
||||
// Read 'StatusBarStyle' from config.xml, default is 'lightcontent'.
|
||||
String styleSetting = preferences.getString("StatusBarStyle", "lightcontent");
|
||||
if (styleSetting.equalsIgnoreCase("blacktranslucent") || styleSetting.equalsIgnoreCase("blackopaque")) {
|
||||
LOG.w(TAG, styleSetting +" is deprecated and will be removed in next major release, use lightcontent");
|
||||
}
|
||||
setStatusBarStyle(styleSetting);
|
||||
}
|
||||
});
|
||||
@@ -193,26 +190,6 @@ public class StatusBar extends CordovaPlugin {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ("styleBlackTranslucent".equals(action)) {
|
||||
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setStatusBarStyle("blacktranslucent");
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
if ("styleBlackOpaque".equals(action)) {
|
||||
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setStatusBarStyle("blackopaque");
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -266,8 +243,6 @@ public class StatusBar extends CordovaPlugin {
|
||||
|
||||
String[] lightContentStyles = {
|
||||
"lightcontent",
|
||||
"blacktranslucent",
|
||||
"blackopaque",
|
||||
};
|
||||
|
||||
if (Arrays.asList(darkContentStyles).contains(style.toLowerCase())) {
|
||||
@@ -280,7 +255,7 @@ public class StatusBar extends CordovaPlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG.e(TAG, "Invalid style, must be either 'default', 'lightcontent' or the deprecated 'blacktranslucent' and 'blackopaque'");
|
||||
LOG.e(TAG, "Invalid style, must be either 'default' or 'lightcontent'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,10 +33,8 @@ function notSupported (win, fail) {
|
||||
|
||||
module.exports = {
|
||||
isVisible: false,
|
||||
styleBlackTranslucent: notSupported,
|
||||
styleDefault: notSupported,
|
||||
styleLightContent: notSupported,
|
||||
styleBlackOpaque: notSupported,
|
||||
overlaysWebView: notSupported,
|
||||
backgroundColorByName: notSupported,
|
||||
backgroundColorByHexString: notSupported,
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
|
||||
- (void) styleDefault:(CDVInvokedUrlCommand*)command;
|
||||
- (void) styleLightContent:(CDVInvokedUrlCommand*)command;
|
||||
- (void) styleBlackTranslucent:(CDVInvokedUrlCommand*)command;
|
||||
- (void) styleBlackOpaque:(CDVInvokedUrlCommand*)command;
|
||||
|
||||
- (void) backgroundColorByName:(CDVInvokedUrlCommand*)command;
|
||||
- (void) backgroundColorByHexString:(CDVInvokedUrlCommand*)command;
|
||||
|
||||
+1
-18
@@ -138,9 +138,6 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
||||
setting = @"StatusBarStyle";
|
||||
if ([self settingForKey:setting]) {
|
||||
NSString * styleSetting = [self settingForKey:setting];
|
||||
if ([styleSetting isEqualToString:@"blacktranslucent"] || [styleSetting isEqualToString:@"blackopaque"]) {
|
||||
NSLog(@"%@ is deprecated and will be removed in next major release, use lightcontent", styleSetting);
|
||||
}
|
||||
[self setStatusBarStyle:styleSetting];
|
||||
}
|
||||
|
||||
@@ -282,17 +279,13 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
||||
|
||||
- (void) setStatusBarStyle:(NSString*)statusBarStyle
|
||||
{
|
||||
// default, lightContent, blackTranslucent, blackOpaque
|
||||
// default, lightContent
|
||||
NSString* lcStatusBarStyle = [statusBarStyle lowercaseString];
|
||||
|
||||
if ([lcStatusBarStyle isEqualToString:@"default"]) {
|
||||
[self styleDefault:nil];
|
||||
} else if ([lcStatusBarStyle isEqualToString:@"lightcontent"]) {
|
||||
[self styleLightContent:nil];
|
||||
} else if ([lcStatusBarStyle isEqualToString:@"blacktranslucent"]) {
|
||||
[self styleBlackTranslucent:nil];
|
||||
} else if ([lcStatusBarStyle isEqualToString:@"blackopaque"]) {
|
||||
[self styleBlackOpaque:nil];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,16 +304,6 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
||||
[self setStyleForStatusBar:UIStatusBarStyleLightContent];
|
||||
}
|
||||
|
||||
- (void) styleBlackTranslucent:(CDVInvokedUrlCommand*)command
|
||||
{
|
||||
[self setStyleForStatusBar:UIStatusBarStyleLightContent];
|
||||
}
|
||||
|
||||
- (void) styleBlackOpaque:(CDVInvokedUrlCommand*)command
|
||||
{
|
||||
[self setStyleForStatusBar:UIStatusBarStyleLightContent];
|
||||
}
|
||||
|
||||
- (void) backgroundColorByName:(CDVInvokedUrlCommand*)command
|
||||
{
|
||||
id value = [command argumentAtIndex:0];
|
||||
|
||||
@@ -80,16 +80,6 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
styleBlackTranslucent: function () {
|
||||
// #88000000 ? Apple says to use lightContent instead
|
||||
return module.exports.styleLightContent();
|
||||
},
|
||||
|
||||
styleBlackOpaque: function () {
|
||||
// #FF000000 ? Apple says to use lightContent instead
|
||||
return module.exports.styleLightContent();
|
||||
},
|
||||
|
||||
backgroundColorByHexString: function (win, fail, args) {
|
||||
var rgb = hexToRgb(args[0]);
|
||||
if (isSupported()) {
|
||||
|
||||
Reference in New Issue
Block a user