From 29283396113ab1c46d36b61f397f5cdde32686f7 Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Sat, 21 Mar 2020 13:59:48 +0100 Subject: [PATCH] deprecate blacktranslucent, blackopaque, styleBlackTranslucent and styleBlackOpaque (#173) --- README.md | 8 +++++--- src/android/StatusBar.java | 6 +++++- src/ios/CDVStatusBar.m | 6 +++++- www/statusbar.js | 4 ++-- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 4b6fc31..1d0ce9c 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,7 @@ description: Control the device status bar. This installation method requires cordova 5.0+ cordova plugin add cordova-plugin-statusbar -Older versions of cordova can still install via the __deprecated__ id - cordova plugin add org.apache.cordova.statusbar It is also possible to install via repo url directly ( unstable ) cordova plugin add https://github.com/apache/cordova-plugin-statusbar.git @@ -59,7 +57,7 @@ Preferences -- __StatusBarStyle__ (status bar style, defaults to lightcontent). Set the status bar style (e.g. text color). Available options: default, lightcontent, blacktranslucent, blackopaque. +- __StatusBarStyle__ (status bar style, defaults to lightcontent). Set the status bar style (e.g. text color). Available options: `default`, `lightcontent`. `blacktranslucent` and `blackopaque` are also available, but __deprecated__, will be removed in next major release, use `lightcontent` instead. @@ -197,6 +195,8 @@ Supported Platforms StatusBar.styleBlackTranslucent ================= +Note: `styleBlackTranslucent` is __deprecated__ and will be removed in next major release, use `styleLightContent` instead. + Use the blackTranslucent statusbar (light text, for dark backgrounds). StatusBar.styleBlackTranslucent(); @@ -212,6 +212,8 @@ Supported Platforms StatusBar.styleBlackOpaque ================= +Note: `styleBlackOpaque` is __deprecated__ and will be removed in next major release, use `styleLightContent` instead. + Use the blackOpaque statusbar (light text, for dark backgrounds). StatusBar.styleBlackOpaque(); diff --git a/src/android/StatusBar.java b/src/android/StatusBar.java index 714c30e..5159ada 100644 --- a/src/android/StatusBar.java +++ b/src/android/StatusBar.java @@ -63,7 +63,11 @@ public class StatusBar extends CordovaPlugin { setStatusBarBackgroundColor(preferences.getString("StatusBarBackgroundColor", "#000000")); // Read 'StatusBarStyle' from config.xml, default is 'lightcontent'. - setStatusBarStyle(preferences.getString("StatusBarStyle", "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); } }); } diff --git a/src/ios/CDVStatusBar.m b/src/ios/CDVStatusBar.m index 1a42639..058bbef 100644 --- a/src/ios/CDVStatusBar.m +++ b/src/ios/CDVStatusBar.m @@ -137,7 +137,11 @@ static const void *kStatusBarStyle = &kStatusBarStyle; setting = @"StatusBarStyle"; if ([self settingForKey:setting]) { - [self setStatusBarStyle:[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]; } setting = @"StatusBarDefaultScrollToTop"; diff --git a/www/statusbar.js b/www/statusbar.js index d9d0ea5..d6ab16b 100644 --- a/www/statusbar.js +++ b/www/statusbar.js @@ -59,12 +59,12 @@ var StatusBar = { }, styleBlackTranslucent: function () { - // #88000000 ? Apple says to use lightContent instead + console.warn('styleBlackTranslucent is deprecated and will be removed in next major release, use styleLightContent'); exec(null, null, "StatusBar", "styleBlackTranslucent", []); }, styleBlackOpaque: function () { - // #FF000000 ? Apple says to use lightContent instead + console.warn('styleBlackOpaque is deprecated and will be removed in next major release, use styleLightContent'); exec(null, null, "StatusBar", "styleBlackOpaque", []); },