Compare commits

...

6 Commits

Author SHA1 Message Date
Carlos Santana
f1aa062557 CB-10820 Updated version and RELEASENOTES.md for release 2.1.2 2016-03-09 22:12:41 -05:00
Julio César
7ca3552224 Fix for CB-10752 status bar overlays the webview on iOS 6 in some cases
We don’t allow the statusbar to overlay the webview on iOS 6, but in
some cases it happens. This changes avoid it.
2016-03-06 11:55:49 +01:00
daserge
bf7869cec7 CB-10683 Fix wrong StatusBar.isVisible initial value on Windows 2016-02-24 10:32:46 +03:00
daserge
8a3f9edb9d CB-10636 Add JSHint for plugins 2016-02-24 10:28:04 +03:00
Julio César
47f245462d CB-10047 fix iOS 8 deprecated warnings
Removed all references to self.viewController.interfaceOrientation,
they weren’t really used on invertFrameIfNeeded and are deprecated on
iOS 8
Removed orientation param on invertFrameIfNeeded as it wasn’t being
used.

closes #26
2016-02-22 19:49:18 +01:00
Vladimir Kotikov
241577c3c8 CB-10557 Incremented plugin version. 2016-02-09 13:09:55 +03:00
13 changed files with 119 additions and 54 deletions

24
.gitignore vendored Normal file
View 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
View 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
View File

@@ -0,0 +1,4 @@
language: node_js
sudo: false
node_js:
- "4.2"

View File

@@ -17,6 +17,8 @@
# under the License.
-->
[![Build Status](https://travis-ci.org/apache/cordova-plugin-statusbar.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-statusbar)
# cordova-plugin-statusbar
StatusBar

View File

@@ -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

View File

@@ -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"
}
}

View File

@@ -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>

View File

@@ -18,8 +18,6 @@
*
*/
var cordova = require('cordova');
function notSupported() {
console.log('StatusBar is not supported');
return false;

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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>

View File

@@ -19,6 +19,9 @@
*
*/
/* jshint jasmine: true */
/* global StatusBar */
exports.defineAutoTests = function () {
describe("StatusBar", function () {
it("statusbar.spec.1 should exist", function() {

View File

@@ -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;