Skip to content
This repository was archived by the owner on Apr 2, 2018. It is now read-only.

Commit fc3483e

Browse files
committed
feat(): remove hideKeyboardAccessoryBar
BREAKING CHANGE: hideKeyboardAccessoryBar has started causing apps to be rejected from the app store, so is removed until there is a valid alternative.
1 parent 2d01d5f commit fc3483e

File tree

7 files changed

+160
-155
lines changed

7 files changed

+160
-155
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The `cordova.plugins.Keyboard` object provides functions to make interacting wit
88
Methods
99
-------
1010

11-
- cordova.plugins.Keyboard.hideKeyboardAccessoryBar
11+
- ~~cordova.plugins.Keyboard.hideKeyboardAccessoryBar~~ (**removed in 2.0, see below**)
1212
- cordova.plugins.Keyboard.close
1313
- cordova.plugins.Keyboard.disableScroll
1414
- cordova.plugins.Keyboard.show
@@ -30,9 +30,11 @@ These events are fired on the window.
3030

3131
# API reference
3232

33-
Keyboard.hideKeyboardAccessoryBar
33+
~~Keyboard.hideKeyboardAccessoryBar~~
3434
=================
3535

36+
**NOTE: This method started causing apps to be rejected from the App Store, so has been removed until a workaround is found.**
37+
3638
Hide the keyboard accessory bar with the next, previous and done buttons.
3739

3840
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
@@ -54,7 +56,7 @@ Close the keyboard if it is open.
5456
Supported Platforms
5557
-------------------
5658

57-
- iOS, Android, Blackberry 10, Windows
59+
- iOS, Android, Blackberry 10, Windows
5860

5961

6062
Keyboard.disableScroll
@@ -79,7 +81,7 @@ Force keyboard to be shown. This typically helps if autofocus on a text element
7981

8082
Supported Platforms
8183

82-
- Android, Blackberry 10, Windows
84+
- Android, Blackberry 10, Windows
8385

8486
native.keyboardshow
8587
=================

plugin.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@
4141

4242
<header-file src="src/ios/IonicKeyboard.h" />
4343
<source-file src="src/ios/IonicKeyboard.m" />
44+
<!--
4445
<header-file src="src/ios/UIWebViewExtension.h" />
4546
<source-file src="src/ios/UIWebViewExtension.m" />
47+
-->
4648
</platform>
4749

4850
<!-- blackberry10 -->

src/ios/IonicKeyboard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
id _keyboardShowObserver, _keyboardHideObserver;
66
}
77

8-
@property (readwrite, assign) BOOL hideKeyboardAccessoryBar;
8+
// @property (readwrite, assign) BOOL hideKeyboardAccessoryBar;
99
@property (readwrite, assign) BOOL disableScroll;
1010
//@property (readwrite, assign) BOOL styleDark;
1111

src/ios/IonicKeyboard.m

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
#import "IonicKeyboard.h"
2-
#import "UIWebViewExtension.h"
2+
// #import "UIWebViewExtension.h"
33
#import <Cordova/CDVAvailability.h>
44

55
@implementation IonicKeyboard
66

7-
@synthesize hideKeyboardAccessoryBar = _hideKeyboardAccessoryBar;
7+
// @synthesize hideKeyboardAccessoryBar = _hideKeyboardAccessoryBar;
88
@synthesize disableScroll = _disableScroll;
99
//@synthesize styleDark = _styleDark;
1010

1111
- (void)pluginInitialize {
12-
12+
1313
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
1414
__weak IonicKeyboard* weakSelf = self;
1515

1616
//set defaults
17-
self.hideKeyboardAccessoryBar = YES;
17+
// self.hideKeyboardAccessoryBar = YES;
1818
self.disableScroll = NO;
1919
//self.styleDark = NO;
20-
20+
2121
_keyboardShowObserver = [nc addObserverForName:UIKeyboardWillShowNotification
2222
object:nil
2323
queue:[NSOperationQueue mainQueue]
2424
usingBlock:^(NSNotification* notification) {
25-
25+
2626
CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
2727
keyboardFrame = [self.viewController.view convertRect:keyboardFrame fromView:nil];
28-
28+
2929
[weakSelf.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.plugins.Keyboard.isVisible = true; cordova.fireWindowEvent('native.keyboardshow', { 'keyboardHeight': %@ }); ", [@(keyboardFrame.size.height) stringValue]]];
3030

3131
//deprecated
3232
[weakSelf.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireWindowEvent('native.showkeyboard', { 'keyboardHeight': %@ }); ", [@(keyboardFrame.size.height) stringValue]]];
3333
}];
34-
34+
3535
_keyboardHideObserver = [nc addObserverForName:UIKeyboardWillHideNotification
3636
object:nil
3737
queue:[NSOperationQueue mainQueue]
@@ -63,23 +63,23 @@ - (void)setDisableScroll:(BOOL)disableScroll {
6363
}
6464

6565

66-
- (BOOL)hideKeyboardAccessoryBar {
67-
return _hideKeyboardAccessoryBar;
68-
}
69-
70-
- (void)setHideKeyboardAccessoryBar:(BOOL)hideKeyboardAccessoryBar {
71-
if (hideKeyboardAccessoryBar == _hideKeyboardAccessoryBar || ![self.webView isKindOfClass:[UIWebView class]]) {
72-
return;
73-
}
74-
if (hideKeyboardAccessoryBar) {
75-
((UIWebView*)self.webView).hackishlyHidesInputAccessoryView = YES;
76-
}
77-
else {
78-
((UIWebView*)self.webView).hackishlyHidesInputAccessoryView = NO;
79-
}
80-
81-
_hideKeyboardAccessoryBar = hideKeyboardAccessoryBar;
82-
}
66+
// - (BOOL)hideKeyboardAccessoryBar {
67+
// return _hideKeyboardAccessoryBar;
68+
// }
69+
//
70+
// - (void)setHideKeyboardAccessoryBar:(BOOL)hideKeyboardAccessoryBar {
71+
// if (hideKeyboardAccessoryBar == _hideKeyboardAccessoryBar || ![self.webView isKindOfClass:[UIWebView class]]) {
72+
// return;
73+
// }
74+
// if (hideKeyboardAccessoryBar) {
75+
// ((UIWebView*)self.webView).hackishlyHidesInputAccessoryView = YES;
76+
// }
77+
// else {
78+
// ((UIWebView*)self.webView).hackishlyHidesInputAccessoryView = NO;
79+
// }
80+
//
81+
// _hideKeyboardAccessoryBar = hideKeyboardAccessoryBar;
82+
// }
8383

8484
/*
8585
- (BOOL)styleDark {
@@ -129,15 +129,15 @@ - (void) disableScroll:(CDVInvokedUrlCommand*)command {
129129
}
130130
}
131131

132-
- (void) hideKeyboardAccessoryBar:(CDVInvokedUrlCommand*)command {
133-
if (!command.arguments || ![command.arguments count]){
134-
return;
135-
}
136-
id value = [command.arguments objectAtIndex:0];
137-
if (value != [NSNull null]) {
138-
self.hideKeyboardAccessoryBar = [value boolValue];
139-
}
140-
}
132+
// - (void) hideKeyboardAccessoryBar:(CDVInvokedUrlCommand*)command {
133+
// if (!command.arguments || ![command.arguments count]){
134+
// return;
135+
// }
136+
// id value = [command.arguments objectAtIndex:0];
137+
// if (value != [NSNull null]) {
138+
// self.hideKeyboardAccessoryBar = [value boolValue];
139+
// }
140+
// }
141141

142142
- (void) close:(CDVInvokedUrlCommand*)command {
143143
[self.webView endEditing:YES];
@@ -153,7 +153,7 @@ - (void) styleDark:(CDVInvokedUrlCommand*)command {
153153
return;
154154
}
155155
id value = [command.arguments objectAtIndex:0];
156-
156+
157157
self.styleDark = [value boolValue];
158158
}
159159
*/

src/ios/UIWebViewExtension.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@interface UIWebView (HackishAccessoryHiding)
2-
@property (nonatomic, assign) BOOL hackishlyHidesInputAccessoryView;
3-
//@property (nonatomic, assign) BOOL styleDark;
4-
@end
1+
// @interface UIWebView (HackishAccessoryHiding)
2+
// @property (nonatomic, assign) BOOL hackishlyHidesInputAccessoryView;
3+
// //@property (nonatomic, assign) BOOL styleDark;
4+
// @end

0 commit comments

Comments
 (0)