Compare commits

..

37 Commits

Author SHA1 Message Date
Shazron Abdullah
a50208bda2 CB-12224 Updated version and RELEASENOTES.md for release 2.2.1 2016-12-07 16:39:46 -08:00
Jonathan Li
6bfc749f84 CB-10288 statusbar plugin interaction with iOS multitasking
This closes #62
2016-11-13 23:14:11 +01:00
Julio Cesar Sanchez Hernandez
b7dc5ef7cb CB-10158 (ios) fix StatusBar issue when recovering from fullscreen video
This closes #70
2016-10-30 17:48:37 +01:00
Julio Cesar Sanchez Hernandez
086234b881 CB-10341 ios, document statusTap event
This closes #69
2016-10-30 17:46:36 +01:00
Julio César
2c036c9c91 CB-11191: Statusbar plugin causing issues with webview size
This closes #65
2016-10-29 00:10:20 +02:00
Shazron Abdullah
940a8ee920 CB-11917 - Remove pull request template checklist item: "iCLA has been submitted…"
This closes #66
2016-10-04 21:34:54 -07:00
Steve Gill
53d0b04ed6 CB-11832 Incremented plugin version. 2016-09-09 16:08:04 -07:00
Steve Gill
ad5f7d912c CB-11832 Updated version and RELEASENOTES.md for release 2.2.0 2016-09-08 23:38:55 -07:00
Vladimir Kotikov
dbc7b29680 CB-11795 Add 'protective' entry to cordovaDependencies
The entry is required to protect end-users from fetching edge versions of the plugin by incompatible version of cordova. This also assumes that we will not introduce any regressions in compatibility w/ cordova in minor and patch releases. On every major release we will need to add similar entry with _next_ major version.

 This closes #63
2016-09-08 12:03:01 +03:00
Julio César
1d1ac928a8 Removed duplicate code 2016-09-01 20:12:20 +02:00
Gosha Arinich
554e65e60f Handle extended status bar on iOS
This closes #55
2016-09-01 20:01:42 +02:00
Simon MacDonald
f2c49454da Plugin uses Android Log class and not Cordova LOG class 2016-08-22 16:52:13 -04:00
Julio César
aca5eceaf9 Closing stale pull request: close #19 2016-07-31 00:27:54 +02:00
Julio César
86cfafeaf9 CB-11287: (ios) - fix webview resize after modal on iPhones 2016-07-05 00:12:20 +02:00
Julio César
8159e1b307 CB-11485 fix resize on rotation with popover 2016-07-04 21:20:33 +02:00
Vladimir Kotikov
f8873fd481 Add badges for paramedic builds on Jenkins 2016-06-10 12:13:59 +03:00
Vladimir Kotikov
cfce729912 CB-11197 Keep status bar hidden when keyboard pops up
This closes #59
2016-05-24 10:44:00 +03:00
Nikhil Khandelwal
c34e3a02c2 Add pull request template. 2016-05-23 13:54:00 -07:00
Richard Knoll
16c653747e CB-10866: Adding engine info to package.json
This closes #52
2016-05-18 10:50:47 -07:00
Jesse MacFadyen
b448166624 patched missing _ready method, and changed the way the proxy is installed 2016-05-16 18:01:34 -07:00
t1st3
fc56eb211f chore: edit package.json license to match SPDX id. This closes #46.
See [NPM package.json spec for licenses](https://docs.npmjs.com/files/package.json#license) and [SPDX license IDs](https://spdx.org/licenses/)

X-ref: https://github.com/apache/cordova-plugin-device/pull/48
2016-04-25 11:54:47 -07:00
Dmitry Blotsky
259cdb65ef CB-10996 Adding front matter to README.md 2016-04-22 19:35:51 -07:00
Steve Gill
c3705fe46e CB-11091 Incremented plugin version. 2016-04-15 13:45:28 -07:00
Steve Gill
ef7266874a Updated version and RELEASENOTES.md for release 2.1.3 2016-04-15 13:08:27 -07:00
daserge
16ff9b449f CB-11018 Fix statusbar with inappbrowser causing incorrect orientation on iOS8 2016-04-05 17:39:36 +03:00
daserge
244eb717fd CB-10884 Inappbrowser breaks UI while Screen orientation changes from landscape to portrait on iOS 2016-03-29 16:49:29 +03:00
Carlos Santana
15043c1db2 clean releasenotes bold font 2016-03-10 13:51:47 -05:00
Carlos Santana
1011b2a162 CB-10820 Incremented plugin version. 2016-03-09 22:34:18 -05:00
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
Vladimir Kotikov
573176e3a7 CB-10557 Updated version and RELEASENOTES.md for release 2.1.1 2016-02-09 13:09:54 +03:00
Julio César
a464526477 Fix for CB-10102
The removeObserver code was wrong and it might crash on plugin
deallocation

github: close #45
2016-01-17 13:56:20 +01:00
Steve Gill
97f87d36c1 CB-10368 Incremented plugin version. 2016-01-15 16:58:32 -08:00
15 changed files with 265 additions and 80 deletions

22
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,22 @@
<!--
Please make sure the checklist boxes are all checked before submitting the PR. The checklist
is intended as a quick reference, for complete details please see our Contributor Guidelines:
http://cordova.apache.org/contribute/contribute_guidelines.html
Thanks!
-->
### Platforms affected
### What does this PR do?
### What testing has been done on this change?
### Checklist
- [ ] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
- [ ] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
- [ ] Added automated test coverage as appropriate for this change.

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

@@ -1,3 +1,7 @@
---
title: Statusbar
description: Control the device status bar.
---
<!---
# license: Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@ -17,6 +21,10 @@
# under the License.
-->
|Android|iOS| Windows 8.1 Store | Windows 8.1 Phone | Windows 10 Store | Travis CI |
|:-:|:-:|:-:|:-:|:-:|:-:|
|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=android,PLUGIN=cordova-plugin-statusbar)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=android,PLUGIN=cordova-plugin-statusbar/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=ios,PLUGIN=cordova-plugin-statusbar)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=ios,PLUGIN=cordova-plugin-statusbar/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=windows-8.1-store,PLUGIN=cordova-plugin-statusbar)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-8.1-store,PLUGIN=cordova-plugin-statusbar/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=windows-8.1-phone,PLUGIN=cordova-plugin-statusbar)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-8.1-phone,PLUGIN=cordova-plugin-statusbar/)|[![Build Status](http://cordova-ci.cloudapp.net:8080/buildStatus/icon?job=cordova-periodic-build/PLATFORM=windows-10-store,PLUGIN=cordova-plugin-statusbar)](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-10-store,PLUGIN=cordova-plugin-statusbar/)|[![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
@@ -105,6 +113,11 @@ Properties
- StatusBar.isVisible
Events
------
- statusTap
Permissions
-----------
@@ -302,3 +315,19 @@ Supported Platforms
- Windows Phone 7
- Windows Phone 8
- Windows Phone 8.1
statusTap
=========
Listen for this event to know if the statusbar was tapped.
window.addEventListener('statusTap', function() {
// scroll-up with document.body.scrollTop = 0; or do whatever you want
});
Supported Platforms
-------------------
- iOS

View File

@@ -20,17 +20,51 @@
-->
# Release Notes
### 2.2.1 (Dec 07, 2016)
* [CB-10288](https://issues.apache.org/jira/browse/CB-10288) statusbar plugin interaction with iOS multitasking
* [CB-10158](https://issues.apache.org/jira/browse/CB-10158) (ios) fix StatusBar issue when recovering from fullscreen video
* [CB-10341](https://issues.apache.org/jira/browse/CB-10341) ios, document statusTap event
* [CB-11191](https://issues.apache.org/jira/browse/CB-11191) Statusbar plugin causing issues with webview size
* [CB-11917](https://issues.apache.org/jira/browse/CB-11917) - Remove pull request template checklist item: "iCLA has been submitted…"
* [CB-11832](https://issues.apache.org/jira/browse/CB-11832) Incremented plugin version.
### 2.2.0 (Sep 08, 2016)
* [CB-11795](https://issues.apache.org/jira/browse/CB-11795) Add 'protective' entry to cordovaDependencies
* Handle extended status bar on **iOS**
* Plugin uses `Android Log class` and not `Cordova LOG class`
* [CB-11287](https://issues.apache.org/jira/browse/CB-11287) (**ios**) - fix webview resize after modal on **iPhones**
* [CB-11485](https://issues.apache.org/jira/browse/CB-11485) fix resize on rotation with popover
* Add badges for paramedic builds on Jenkins
* [CB-11197](https://issues.apache.org/jira/browse/CB-11197) Keep status bar hidden when keyboard pops up
* Add pull request template.
* [CB-10866](https://issues.apache.org/jira/browse/CB-10866) Adding engine info to `package.json`
* patched missing `_ready` method, and changed the way the proxy is installed
* [CB-10996](https://issues.apache.org/jira/browse/CB-10996) Adding front matter to `README.md`
### 2.1.3 (Apr 15, 2016)
* [CB-11018](https://issues.apache.org/jira/browse/CB-11018) Fix statusbar with `inappbrowser` causing incorrect orientation on **iOS8**
* [CB-10884](https://issues.apache.org/jira/browse/CB-10884) `Inappbrowser` breaks UI while Screen orientation changes from landscape to portrait on **iOS**
### 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
### 2.1.0 (Jan 15, 2016)
* CB-9513 Allow to show/hide status bar in fullscreen mode.
* CB-8720 Fix status bar position when app started upside down on **iOS 7**.
* CB-10118 Fixes plugin loading error for **Browser** platform
* [CB-9513](https://issues.apache.org/jira/browse/CB-9513) Allow to show/hide status bar in fullscreen mode.
* [CB-8720](https://issues.apache.org/jira/browse/CB-8720) Fix status bar position when app started upside down on **iOS 7**.
* [CB-10118](https://issues.apache.org/jira/browse/CB-10118) Fixes plugin loading error for **Browser** platform
### 2.0.0 (Nov 18, 2015)
* [CB-10035](https://issues.apache.org/jira/browse/CB-10035) Updated `RELEASENOTES` to be newest to oldest
* Added `weakSelf` reference for block use
* Fixes [CB-4712](https://issues.apache.org/jira/browse/CB-4712), [CB-5439](https://issues.apache.org/jira/browse/CB-5439) statusbar issues
* Fixing contribute link.
* [CB-7965](https://issues.apache.org/jira/browse/CB-7965) Add cordova-plugin-statusbar support for **browser** platform
* [CB-7965](https://issues.apache.org/jira/browse/CB-7965) Add cordova-plugin-statusbar support for **Browser** platform
* Don't use `IsAtLeastiOSVersion` macro to determine height
* Use correct statusbar height for landscape orientation in iOS >= 8
* remove travis-ci

View File

@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-statusbar",
"version": "2.1.0",
"version": "2.2.1",
"description": "Cordova StatusBar Plugin",
"cordova": {
"id": "cordova-plugin-statusbar",
@@ -26,12 +26,23 @@
"cordova-wp8",
"cordova-windows"
],
"engines": [
{
"name": "cordova",
"version": ">=3.0.0"
"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": {
"cordovaDependencies": {
"0.1.0": {
"cordova": ">=3.0.0"
},
"3.0.0": {
"cordova": ">100"
}
}
],
},
"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.0">
version="2.2.1">
<name>StatusBar</name>
<description>Cordova StatusBar Plugin</description>
<license>Apache 2.0</license>
@@ -48,8 +48,8 @@
</platform>
<platform name="browser">
<js-module src="src/browser/statusbar.js" name="statusbar.Browser">
<merges target="window.StatusBar" />
<js-module src="src/browser/StatusBarProxy.js" name="StatusBarProxy">
<runs />
</js-module>
</platform>

View File

@@ -22,7 +22,6 @@ package org.apache.cordova.statusbar;
import android.app.Activity;
import android.graphics.Color;
import android.os.Build;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
@@ -32,6 +31,7 @@ import org.apache.cordova.CordovaArgs;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView;
import org.apache.cordova.LOG;
import org.apache.cordova.PluginResult;
import org.json.JSONException;
@@ -47,7 +47,7 @@ public class StatusBar extends CordovaPlugin {
*/
@Override
public void initialize(final CordovaInterface cordova, CordovaWebView webView) {
Log.v(TAG, "StatusBar: initialization");
LOG.v(TAG, "StatusBar: initialization");
super.initialize(cordova, webView);
this.cordova.getActivity().runOnUiThread(new Runnable() {
@@ -74,7 +74,7 @@ public class StatusBar extends CordovaPlugin {
*/
@Override
public boolean execute(final String action, final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
Log.v(TAG, "Executing action: " + action);
LOG.v(TAG, "Executing action: " + action);
final Activity activity = this.cordova.getActivity();
final Window window = activity.getWindow();
@@ -96,9 +96,10 @@ public class StatusBar extends CordovaPlugin {
uiOptions &= ~View.SYSTEM_UI_FLAG_FULLSCREEN;
window.getDecorView().setSystemUiVisibility(uiOptions);
return;
}
// CB-11197 We still need to update LayoutParams to force status bar
// to be hidden when entering e.g. text fields
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
});
@@ -117,9 +118,10 @@ public class StatusBar extends CordovaPlugin {
| View.SYSTEM_UI_FLAG_FULLSCREEN;
window.getDecorView().setSystemUiVisibility(uiOptions);
return;
}
// CB-11197 We still need to update LayoutParams to force status bar
// to be hidden when entering e.g. text fields
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
});
@@ -133,7 +135,7 @@ public class StatusBar extends CordovaPlugin {
try {
setStatusBarBackgroundColor(args.getString(0));
} catch (JSONException ignore) {
Log.e(TAG, "Invalid hexString argument, use f.i. '#777777'");
LOG.e(TAG, "Invalid hexString argument, use f.i. '#777777'");
}
}
});
@@ -154,10 +156,10 @@ public class StatusBar extends CordovaPlugin {
// Using reflection makes sure any 5.0+ device will work without having to compile with SDK level 21
window.getClass().getDeclaredMethod("setStatusBarColor", int.class).invoke(window, Color.parseColor(colorPref));
} catch (IllegalArgumentException ignore) {
Log.e(TAG, "Invalid hexString argument, use f.i. '#999999'");
LOG.e(TAG, "Invalid hexString argument, use f.i. '#999999'");
} catch (Exception ignore) {
// this should not happen, only in case Android removes this method in a version > 21
Log.w(TAG, "Method window.setStatusBarColor not found for SDK level " + Build.VERSION.SDK_INT);
LOG.w(TAG, "Method window.setStatusBarColor not found for SDK level " + Build.VERSION.SDK_INT);
}
}
}

View File

@@ -18,11 +18,15 @@
*
*/
var cordova = require('cordova');
function notSupported() {
function notSupported(win,fail) {
//
console.log('StatusBar is not supported');
return false;
setTimeout(function(){
win();
// note that while it is not explicitly supported, it does not fail
// this is really just here to allow developers to test their code in the browser
// and if we fail, then their app might as well. -jm
},0);
}
module.exports = {
@@ -36,6 +40,9 @@ module.exports = {
backgroundColorByName: notSupported,
backgroundColorByHexString: notSupported,
hide: notSupported,
show: notSupported
show: notSupported,
_ready:notSupported
};
require("cordova/exec/proxy").add("StatusBar", module.exports);

View File

@@ -90,6 +90,11 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
}
}
-(void)cordovaViewWillAppear:(NSNotification*)notification
{
[self resizeWebView];
}
-(void)statusBarDidChangeFrame:(NSNotification*)notification
{
//add a small delay for iOS 7 ( 0.1 seconds )
@@ -112,6 +117,8 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarDidChangeFrame:) name: UIApplicationDidChangeStatusBarFrameNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(cordovaViewWillAppear:) name: @"CDVViewWillAppearNotification" object:nil];
_statusBarOverlaysWebView = YES; // default
[self initializeStatusBarBackgroundView];
@@ -182,7 +189,7 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
if ([[UIApplication sharedApplication]statusBarOrientation] == UIInterfaceOrientationPortraitUpsideDown &&
statusBarFrame.size.height + statusBarFrame.origin.y == [[UIScreen mainScreen] bounds].size.height) {
statusBarFrame.size.height + statusBarFrame.origin.y == [self.viewController.view.window bounds].size.height) {
// When started in upside-down orientation on iOS 7, status bar will be bound to lower edge of the
// screen (statusBarFrame.origin.y will be somewhere around screen height). In this case we need to
@@ -190,7 +197,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,10 +205,10 @@ 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)) {
// always in Portrait context. Do not run this on ios 8 or above to avoid breaking ipad pro multitask layout
if (!IsAtLeastiOSVersion(@"8.0") && UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) {
CGFloat temp = rect.size.width;
rect.size.width = rect.size.height;
rect.size.height = temp;
@@ -411,18 +418,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,45 +436,64 @@ 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 = [self.viewController.view.window bounds];
bounds = [self invertFrameIfNeeded:bounds];
if (UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])) {
self.viewController.view.frame = bounds;
} else if (self.viewController.presentedViewController != nil) {
// https://issues.apache.org/jira/browse/CB-11018
BOOL isIOS8 = (IsAtLeastiOSVersion(@"8.0"));
BOOL isIOS9 = (IsAtLeastiOSVersion(@"9.0"));
if (isIOS8 && !isIOS9) {
// iOS 8
bounds = CGRectMake(0, 0, bounds.size.width, bounds.size.height);
} else {
// iOS7, iOS9+
if ([self.viewController.presentedViewController.presentationController isKindOfClass:[UIPopoverPresentationController class]] || UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) {
bounds = CGRectMake(0, 0, bounds.size.width, bounds.size.height);
} else {
bounds = CGRectMake(0, 0, bounds.size.height, bounds.size.width);
}
}
}
self.webView.frame = bounds;
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame];
CGRect frame = self.webView.frame;
CGFloat height = statusBarFrame.size.height;
if (!self.statusBarOverlaysWebView) {
// CB-10158 If a full screen video is playing the status bar height will be 0, set it to 20
frame.origin.y = height > 0 ? height: 20;
} else {
// Even if overlay is used, we want to handle in-call/recording/hotspot larger status bar
frame.origin.y = height >= 20 ? height - 20 : 0;
}
frame.size.height -= frame.origin.y;
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
{
[[UIApplication sharedApplication] removeObserver:self forKeyPath:@"statusBarHidden"];
[[NSNotificationCenter defaultCenter] removeObserver:self forKeyPath:UIApplicationDidChangeStatusBarFrameNotification];
[[NSNotificationCenter defaultCenter]removeObserver:self name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
}

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.0">
version="2.2.1">
<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;