You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2013/10/03 00:12:13 UTC

ios commit: CB-4935 iOS Remove Keyboard preferences code into its own plugin

Updated Branches:
  refs/heads/master bc095657d -> c66fc82bd


CB-4935 iOS Remove Keyboard preferences code into its own plugin


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/c66fc82b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/c66fc82b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/c66fc82b

Branch: refs/heads/master
Commit: c66fc82bd0a49b940e0a5beb1563ecdb48cc7120
Parents: bc09565
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed Oct 2 15:12:23 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Wed Oct 2 15:12:23 2013 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVViewController.m | 126 ----------------------------
 1 file changed, 126 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/c66fc82b/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index e81f5f1..ee11c4b 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -116,94 +116,6 @@
 - (void)viewWillDisappear:(BOOL)animated
 {
     [super viewWillDisappear:animated];
-
-    NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
-    [nc removeObserver:self name:UIKeyboardWillShowNotification object:nil];
-    [nc removeObserver:self name:UIKeyboardWillHideNotification object:nil];
-}
-
-CGFloat gAccessoryBarHeight = 0.0;
-- (void)hideKeyboardFormAccessoryBarStart:(NSNotification*)notif
-{
-    NSArray* windows = [[UIApplication sharedApplication] windows];
-
-    for (UIWindow* window in windows) {
-        for (UIView* view in window.subviews) {
-            if ([[view description] hasPrefix:@"<UIPeripheralHostView"]) {
-                for (UIView* peripheralView in view.subviews) {
-                    // hides the backdrop (iOS 7)
-                    if ([[peripheralView description] hasPrefix:@"<UIKBInputBackdropView"]) {
-                        [[peripheralView layer] setOpacity:0.0];
-                    }
-
-                    // hides the accessory bar
-                    if ([[peripheralView description] hasPrefix:@"<UIWebFormAccessory"]) {
-                        // remove the extra scroll space for the form accessory bar
-                        CGRect newFrame = self.webView.scrollView.frame;
-                        newFrame.size.height += peripheralView.frame.size.height;
-                        self.webView.scrollView.frame = newFrame;
-
-                        gAccessoryBarHeight = peripheralView.frame.size.height;
-
-                        // remove the form accessory bar
-                        [peripheralView removeFromSuperview];
-                    }
-                    // hides the thin grey line used to adorn the bar (iOS 6)
-                    if ([[peripheralView description] hasPrefix:@"<UIImageView"]) {
-                        [[peripheralView layer] setOpacity:0.0];
-                    }
-                }
-            }
-        }
-    }
-}
-
-- (void)hideKeyboardFormAccessoryBarEnd:(NSNotification*)notif
-{
-    // restore the scrollview frame
-    self.webView.scrollView.frame = self.webView.frame;
-}
-
-- (void)keyboardWillShow:(NSNotification*)notif
-{
-    if (![@"true" isEqualToString :[self settingForKey:@"KeyboardShrinksView"]]) {
-        return;
-    }
-
-    CGRect keyboardFrame = [notif.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
-    keyboardFrame = [self.view convertRect:keyboardFrame fromView:nil];
-
-    CGRect newFrame = self.view.bounds;
-    CGFloat accessoryHeight = gAccessoryBarHeight;
-    CGFloat actualKeyboardHeight = (keyboardFrame.size.height - accessoryHeight);
-    newFrame.size.height -= actualKeyboardHeight;
-
-    self.webView.frame = newFrame;
-    self.webView.scrollView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
-
-    BOOL disableScrollingWhenKeyboardShrinksView = [@"true" isEqualToString :[self settingForKey:@"DisableScrollingWhenKeyboardShrinksView"]];
-    if (disableScrollingWhenKeyboardShrinksView) {
-        self.webView.scrollView.scrollEnabled = NO;
-    }
-}
-
-- (void)keyboardWillHide:(NSNotification*)notif
-{
-    if (![@"true" isEqualToString :[self settingForKey:@"KeyboardShrinksView"]]) {
-        return;
-    }
-
-    BOOL disableScrollingWhenKeyboardShrinksView = [@"true" isEqualToString :[self settingForKey:@"DisableScrollingWhenKeyboardShrinksView"]];
-    if (disableScrollingWhenKeyboardShrinksView) {
-        self.webView.scrollView.scrollEnabled = YES;
-    }
-
-    CGRect keyboardFrame = [notif.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
-    keyboardFrame = [self.view convertRect:keyboardFrame fromView:nil];
-
-    CGRect newFrame = self.view.bounds;
-    self.webView.scrollView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
-    self.webView.frame = newFrame;
 }
 
 - (void)printDeprecationNotice
@@ -336,48 +248,10 @@ CGFloat gAccessoryBarHeight = 0.0;
     if ([self settingForKey:@"MediaPlaybackRequiresUserAction"]) {
         mediaPlaybackRequiresUserAction = [(NSNumber*)[self settingForKey:@"MediaPlaybackRequiresUserAction"] boolValue];
     }
-    BOOL hideKeyboardFormAccessoryBar = NO;  // default value
-    if ([self settingForKey:@"HideKeyboardFormAccessoryBar"]) {
-        hideKeyboardFormAccessoryBar = [(NSNumber*)[self settingForKey:@"HideKeyboardFormAccessoryBar"] boolValue];
-    }
 
     self.webView.scalesPageToFit = [enableViewportScale boolValue];
 
     /*
-     * Fire up the GPS Service right away as it takes a moment for data to come back.
-     */
-    __weak CDVViewController* weakSelf = self;
-
-    if (hideKeyboardFormAccessoryBar) {
-        [[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardWillShowNotification
-                                                          object:nil
-                                                           queue:[NSOperationQueue mainQueue]
-                                                      usingBlock:^(NSNotification* notification) {
-            // we can't hide it here because the accessory bar hasn't been created yet, so we delay on the queue
-            [weakSelf performSelector:@selector(hideKeyboardFormAccessoryBarStart:) withObject:notification afterDelay:0];
-        }];
-        [[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardWillHideNotification
-                                                          object:nil
-                                                           queue:[NSOperationQueue mainQueue]
-                                                      usingBlock:^(NSNotification* notification) {
-                                                          [weakSelf hideKeyboardFormAccessoryBarEnd:notification];
-        }];
-    }
-
-    [[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardWillShowNotification
-                                                      object:nil
-                                                       queue:[NSOperationQueue mainQueue]
-                                                  usingBlock:^(NSNotification* notification) {
-        [weakSelf performSelector:@selector(keyboardWillShow:) withObject:notification afterDelay:0];
-    }];
-    [[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardWillHideNotification
-                                                      object:nil
-                                                       queue:[NSOperationQueue mainQueue]
-                                                  usingBlock:^(NSNotification* notification) {
-        [weakSelf performSelector:@selector(keyboardWillHide:) withObject:notification afterDelay:0];
-    }];
-
-    /*
      * Fire up CDVLocalStorage to work-around WebKit storage limitations: on all iOS 5.1+ versions for local-only backups, but only needed on iOS 5.1 for cloud backup.
      */
     if (IsAtLeastiOSVersion(@"5.1") && (([backupWebStorageType isEqualToString:@"local"]) ||