Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1E358100A2 for ; Mon, 4 Nov 2013 22:05:17 +0000 (UTC) Received: (qmail 33895 invoked by uid 500); 4 Nov 2013 22:05:15 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 33823 invoked by uid 500); 4 Nov 2013 22:05:15 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 33579 invoked by uid 99); 4 Nov 2013 22:05:15 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Nov 2013 22:05:15 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 5462F3D431; Mon, 4 Nov 2013 22:05:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: shazron@apache.org To: commits@cordova.apache.org Date: Mon, 04 Nov 2013 22:05:24 -0000 Message-Id: <12001403449340ebb28da2408b894531@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [10/40] git commit: CB-4935 iOS Keyboard preferences code into its own plugin CB-4935 iOS Keyboard preferences code into its own plugin Project: http://git-wip-us.apache.org/repos/asf/cordova-plugins/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugins/commit/c88ad0cd Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugins/tree/c88ad0cd Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugins/diff/c88ad0cd Branch: refs/heads/master Commit: c88ad0cdda013d948faa979912e0650e03924dab Parents: 7e828d9 Author: Shazron Abdullah Authored: Wed Oct 2 15:07:44 2013 -0700 Committer: Shazron Abdullah Committed: Wed Oct 2 15:07:44 2013 -0700 ---------------------------------------------------------------------- keyboard/plugin.xml | 6 +++++- keyboard/src/ios/CDVKeyboard.h | 6 ++++++ keyboard/src/ios/CDVKeyboard.m | 39 +++++++++++++++++++++++++++++++++++-- keyboard/www/keyboard.js | 10 +++++----- 4 files changed, 53 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/c88ad0cd/keyboard/plugin.xml ---------------------------------------------------------------------- diff --git a/keyboard/plugin.xml b/keyboard/plugin.xml index b2ce765..ed0138d 100644 --- a/keyboard/plugin.xml +++ b/keyboard/plugin.xml @@ -10,6 +10,10 @@ Apache 2.0 cordova,keyboard + + + + @@ -18,7 +22,7 @@ - + http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/c88ad0cd/keyboard/src/ios/CDVKeyboard.h ---------------------------------------------------------------------- diff --git a/keyboard/src/ios/CDVKeyboard.h b/keyboard/src/ios/CDVKeyboard.h index eeea0bb..816fc92 100644 --- a/keyboard/src/ios/CDVKeyboard.h +++ b/keyboard/src/ios/CDVKeyboard.h @@ -37,4 +37,10 @@ @property (readonly, assign) BOOL hideFormAccessoryBar; @property (readonly, assign) BOOL keyboardIsVisible; + +- (void) shrinkView:(CDVInvokedUrlCommand*)command; +- (void) disableScrollingInShrinkView:(CDVInvokedUrlCommand*)command; +- (void) hideFormAccessoryBar:(CDVInvokedUrlCommand*)command; + + @end http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/c88ad0cd/keyboard/src/ios/CDVKeyboard.m ---------------------------------------------------------------------- diff --git a/keyboard/src/ios/CDVKeyboard.m b/keyboard/src/ios/CDVKeyboard.m index 2906e4e..773952c 100644 --- a/keyboard/src/ios/CDVKeyboard.m +++ b/keyboard/src/ios/CDVKeyboard.m @@ -65,14 +65,14 @@ object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification* notification) { - // TODO: set Keyboard.isVisible in JavaScript + [weakSelf.commandDelegate evalJs:@"Keyboard.isVisible = true;"]; weakSelf.keyboardIsVisible = YES; }]; _keyboardHideObserver = [nc addObserverForName:UIKeyboardDidHideNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification* notification) { - // TODO: set Keyboard.isVisible in JavaScript + [weakSelf.commandDelegate evalJs:@"Keyboard.isVisible = false;"]; weakSelf.keyboardIsVisible = NO; }]; } @@ -286,4 +286,39 @@ CGFloat gAccessoryBarHeight = 0.0; [nc removeObserver:self name:UIKeyboardWillHideNotification object:nil]; } +// ////////////////////////////////////////////////// + +#pragma Plugin interface + +- (void) shrinkView:(CDVInvokedUrlCommand*)command +{ + id value = [command.arguments objectAtIndex:0]; + if (!([value isKindOfClass:[NSNumber class]])) { + value = [NSNumber numberWithBool:NO]; + } + + self.shrinkView = [value boolValue]; +} + +- (void) disableScrollingInShrinkView:(CDVInvokedUrlCommand*)command +{ + id value = [command.arguments objectAtIndex:0]; + if (!([value isKindOfClass:[NSNumber class]])) { + value = [NSNumber numberWithBool:NO]; + } + + self.disableScrollingInShrinkView = [value boolValue]; +} + +- (void) hideFormAccessoryBar:(CDVInvokedUrlCommand*)command +{ + id value = [command.arguments objectAtIndex:0]; + if (!([value isKindOfClass:[NSNumber class]])) { + value = [NSNumber numberWithBool:NO]; + } + + self.hideFormAccessoryBar = [value boolValue]; +} + + @end http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/c88ad0cd/keyboard/www/keyboard.js ---------------------------------------------------------------------- diff --git a/keyboard/www/keyboard.js b/keyboard/www/keyboard.js index 940752d..c810dce 100644 --- a/keyboard/www/keyboard.js +++ b/keyboard/www/keyboard.js @@ -26,18 +26,18 @@ var argscheck = require('cordova/argscheck'), var Keyboard = function() { }; -Keyboard.prototype.keyboardShrinksView = function(shrink) { - exec(null, null, "Keyboard", "keyboardShrinksView", [shrink]); +Keyboard.shrinkView = function(shrink) { + exec(null, null, "Keyboard", "shrinkView", [shrink]); }; -Keyboard.prototype.hideFormAccessoryBar = function(hide) { +Keyboard.hideFormAccessoryBar = function(hide) { exec(null, null, "Keyboard", "hideFormAccessoryBar", [hide]); }; -Keyboard.prototype.disableScrollingInShrinkView = function(disable) { +Keyboard.disableScrollingInShrinkView = function(disable) { exec(null, null, "Keyboard", "disableScrollingInShrinkView", [disable]); }; Keyboard.isVisible = false; -module.exports = Keyboard; \ No newline at end of file +module.exports = Keyboard;