Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1aa062557 | ||
|
|
7ca3552224 | ||
|
|
bf7869cec7 | ||
|
|
8a3f9edb9d | ||
|
|
47f245462d | ||
|
|
241577c3c8 |
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
#If ignorance is bliss, then somebody knock the smile off my face
|
||||
|
||||
*.csproj.user
|
||||
*.suo
|
||||
*.cache
|
||||
Thumbs.db
|
||||
*.DS_Store
|
||||
|
||||
*.bak
|
||||
*.cache
|
||||
*.log
|
||||
*.swp
|
||||
*.user
|
||||
|
||||
node_modules
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
16
.jshintrc
Normal file
16
.jshintrc
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"browser": true
|
||||
, "devel": true
|
||||
, "bitwise": true
|
||||
, "undef": true
|
||||
, "trailing": true
|
||||
, "quotmark": false
|
||||
, "indent": 4
|
||||
, "unused": "vars"
|
||||
, "latedef": "nofunc"
|
||||
, "globals": {
|
||||
"module": false,
|
||||
"exports": false,
|
||||
"require": false
|
||||
}
|
||||
}
|
||||
4
.travis.yml
Normal file
4
.travis.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
sudo: false
|
||||
node_js:
|
||||
- "4.2"
|
||||
@@ -17,6 +17,8 @@
|
||||
# under the License.
|
||||
-->
|
||||
|
||||
[](https://travis-ci.org/apache/cordova-plugin-statusbar)
|
||||
|
||||
# cordova-plugin-statusbar
|
||||
|
||||
StatusBar
|
||||
|
||||
@@ -20,6 +20,12 @@
|
||||
-->
|
||||
# Release Notes
|
||||
|
||||
### 2.1.2 (Mar 09, 2016)
|
||||
* [CB-10752](https://issues.apache.org/jira/browse/CB-10752) for for status bar overlays the webview on ** iOS ** 6 in some cases
|
||||
* [CB-10683](https://issues.apache.org/jira/browse/CB-10683) Fix wrong StatusBar.isVisible initial value on ** Windows **
|
||||
* [CB-10636](https://issues.apache.org/jira/browse/CB-10636) Add JSHint for plugins
|
||||
* [CB-10047](https://issues.apache.org/jira/browse/CB-10047) fix ** iOS ** 8 deprecated warnings
|
||||
|
||||
### 2.1.1 (Feb 09, 2016)
|
||||
* [CB-10102](https://issues.apache.org/jira/browse/CB-10102) The removeObserver code was wrong and it might crash on plugin deallocation
|
||||
|
||||
|
||||
11
package.json
11
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cordova-plugin-statusbar",
|
||||
"version": "2.1.1",
|
||||
"version": "2.1.2",
|
||||
"description": "Cordova StatusBar Plugin",
|
||||
"cordova": {
|
||||
"id": "cordova-plugin-statusbar",
|
||||
@@ -26,6 +26,10 @@
|
||||
"cordova-wp8",
|
||||
"cordova-windows"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "npm run jshint",
|
||||
"jshint": "node node_modules/jshint/bin/jshint www && node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint tests"
|
||||
},
|
||||
"engines": [
|
||||
{
|
||||
"name": "cordova",
|
||||
@@ -33,5 +37,8 @@
|
||||
}
|
||||
],
|
||||
"author": "Apache Software Foundation",
|
||||
"license": "Apache 2.0"
|
||||
"license": "Apache 2.0",
|
||||
"devDependencies": {
|
||||
"jshint": "^2.6.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
xmlns:rim="http://www.blackberry.com/ns/widgets"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
id="cordova-plugin-statusbar"
|
||||
version="2.1.1">
|
||||
version="2.1.2">
|
||||
<name>StatusBar</name>
|
||||
<description>Cordova StatusBar Plugin</description>
|
||||
<license>Apache 2.0</license>
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
var cordova = require('cordova');
|
||||
|
||||
function notSupported() {
|
||||
console.log('StatusBar is not supported');
|
||||
return false;
|
||||
|
||||
@@ -190,7 +190,7 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
||||
statusBarFrame.origin.y = 0;
|
||||
}
|
||||
|
||||
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame orientation:self.viewController.interfaceOrientation];
|
||||
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame];
|
||||
|
||||
_statusBarBackgroundView = [[UIView alloc] initWithFrame:statusBarFrame];
|
||||
_statusBarBackgroundView.backgroundColor = _statusBarBackgroundColor;
|
||||
@@ -198,7 +198,7 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
||||
_statusBarBackgroundView.autoresizesSubviews = YES;
|
||||
}
|
||||
|
||||
- (CGRect) invertFrameIfNeeded:(CGRect)rect orientation:(UIInterfaceOrientation)orientation {
|
||||
- (CGRect) invertFrameIfNeeded:(CGRect)rect {
|
||||
// landscape is where (width > height). On iOS < 8, we need to invert since frames are
|
||||
// always in Portrait context
|
||||
if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]) && (rect.size.width < rect.size.height)) {
|
||||
@@ -411,18 +411,17 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
||||
BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0"));
|
||||
|
||||
[self showStatusBar];
|
||||
[self resizeWebView];
|
||||
|
||||
if (isIOS7) {
|
||||
|
||||
[self resizeWebView];
|
||||
|
||||
if (!self.statusBarOverlaysWebView) {
|
||||
|
||||
// there is a possibility that when the statusbar was hidden, it was in a different orientation
|
||||
// from the current one. Therefore we need to expand the statusBarBackgroundView as well to the
|
||||
// statusBar's current size
|
||||
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
|
||||
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame orientation:self.viewController.interfaceOrientation];
|
||||
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame];
|
||||
CGRect sbBgFrame = _statusBarBackgroundView.frame;
|
||||
sbBgFrame.size = statusBarFrame.size;
|
||||
_statusBarBackgroundView.frame = sbBgFrame;
|
||||
@@ -430,39 +429,37 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
CGRect bounds = [[UIScreen mainScreen] applicationFrame];
|
||||
self.viewController.view.frame = bounds;
|
||||
}
|
||||
|
||||
_statusBarBackgroundView.hidden = NO;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)resizeWebView {
|
||||
|
||||
CGRect bounds = [[UIScreen mainScreen] bounds];
|
||||
|
||||
bounds = [self invertFrameIfNeeded:bounds orientation:self.viewController.interfaceOrientation];
|
||||
|
||||
if (UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])) {
|
||||
-(void)resizeWebView
|
||||
{
|
||||
BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0"));
|
||||
|
||||
if (isIOS7) {
|
||||
CGRect bounds = [[UIScreen mainScreen] bounds];
|
||||
bounds = [self invertFrameIfNeeded:bounds];
|
||||
|
||||
if (UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])) {
|
||||
self.viewController.view.frame = bounds;
|
||||
}
|
||||
self.webView.frame = bounds;
|
||||
|
||||
if (!self.statusBarOverlaysWebView) {
|
||||
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
|
||||
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame];
|
||||
CGRect frame = self.webView.frame;
|
||||
frame.origin.y = statusBarFrame.size.height;
|
||||
frame.size.height -= statusBarFrame.size.height;
|
||||
self.webView.frame = frame;
|
||||
}
|
||||
} else {
|
||||
CGRect bounds = [[UIScreen mainScreen] applicationFrame];
|
||||
self.viewController.view.frame = bounds;
|
||||
}
|
||||
|
||||
self.webView.frame = bounds;
|
||||
|
||||
if (!self.statusBarOverlaysWebView) {
|
||||
|
||||
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
|
||||
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame orientation:self.viewController.interfaceOrientation];
|
||||
|
||||
CGRect frame = self.webView.frame;
|
||||
frame.origin.y = statusBarFrame.size.height;
|
||||
frame.size.height -= statusBarFrame.size.height;
|
||||
self.webView.frame = frame;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
|
||||
@@ -18,16 +18,18 @@
|
||||
*
|
||||
*/
|
||||
|
||||
var _supported = null; // set to null so we can check first time
|
||||
/* global Windows */
|
||||
|
||||
function isSupported() {
|
||||
// if not checked before, run check
|
||||
if (_supported == null) {
|
||||
var _supported = null; // set to null so we can check first time
|
||||
|
||||
function isSupported() {
|
||||
// if not checked before, run check
|
||||
if (_supported === null) {
|
||||
var viewMan = Windows.UI.ViewManagement;
|
||||
_supported = (viewMan.StatusBar && viewMan.StatusBar.getForCurrentView);
|
||||
}
|
||||
return _supported;
|
||||
}
|
||||
}
|
||||
|
||||
function getViewStatusBar() {
|
||||
if (!isSupported()) {
|
||||
@@ -53,9 +55,11 @@ function hexToRgb(hex) {
|
||||
|
||||
module.exports = {
|
||||
_ready: function(win, fail) {
|
||||
win(statusBar.occludedRect.height !== 0);
|
||||
if(isSupported()) {
|
||||
var statusBar = getViewStatusBar();
|
||||
win(statusBar.occludedRect.height !== 0);
|
||||
}
|
||||
},
|
||||
|
||||
overlaysWebView: function () {
|
||||
// not supported
|
||||
},
|
||||
@@ -94,14 +98,14 @@ module.exports = {
|
||||
},
|
||||
|
||||
show: function (win, fail) {
|
||||
// added support check so no error thrown, when calling this method
|
||||
// added support check so no error thrown, when calling this method
|
||||
if (isSupported()) {
|
||||
getViewStatusBar().showAsync().done(win, fail);
|
||||
}
|
||||
},
|
||||
|
||||
hide: function (win, fail) {
|
||||
// added support check so no error thrown, when calling this method
|
||||
// added support check so no error thrown, when calling this method
|
||||
if (isSupported()) {
|
||||
getViewStatusBar().hideAsync().done(win, fail);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
xmlns:rim="http://www.blackberry.com/ns/widgets"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
id="cordova-plugin-statusbar-tests"
|
||||
version="2.1.1">
|
||||
version="2.1.2">
|
||||
<name>Cordova StatusBar Plugin Tests</name>
|
||||
<license>Apache 2.0</license>
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* jshint jasmine: true */
|
||||
/* global StatusBar */
|
||||
|
||||
exports.defineAutoTests = function () {
|
||||
describe("StatusBar", function () {
|
||||
it("statusbar.spec.1 should exist", function() {
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* global cordova */
|
||||
|
||||
var exec = require('cordova/exec');
|
||||
|
||||
var namedColors = {
|
||||
@@ -95,15 +97,17 @@ var StatusBar = {
|
||||
|
||||
};
|
||||
|
||||
// prime it
|
||||
exec(function (res) {
|
||||
if (typeof res == 'object') {
|
||||
if (res.type == 'tap') {
|
||||
cordova.fireWindowEvent('statusTap');
|
||||
// prime it. setTimeout so that proxy gets time to init
|
||||
window.setTimeout(function () {
|
||||
exec(function (res) {
|
||||
if (typeof res == 'object') {
|
||||
if (res.type == 'tap') {
|
||||
cordova.fireWindowEvent('statusTap');
|
||||
}
|
||||
} else {
|
||||
StatusBar.isVisible = res;
|
||||
}
|
||||
} else {
|
||||
StatusBar.isVisible = res;
|
||||
}
|
||||
}, null, "StatusBar", "_ready", []);
|
||||
}, null, "StatusBar", "_ready", []);
|
||||
}, 0);
|
||||
|
||||
module.exports = StatusBar;
|
||||
|
||||
Reference in New Issue
Block a user