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/03/29 01:17:08 UTC

[2/2] ios commit: Style fixups (uncrustify 0.6.0)

Style fixups (uncrustify 0.6.0)


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

Branch: refs/heads/master
Commit: bd48a6b4fa907a976234f7da0e34dc8c65c92c08
Parents: 5addd3d
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu Mar 28 17:17:02 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Mar 28 17:17:02 2013 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVTimer.h          |    9 ++---
 CordovaLib/Classes/CDVTimer.m          |   40 +++++++++++-------------
 CordovaLib/Classes/CDVViewController.m |   44 ++++++++++++++-------------
 3 files changed, 45 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/bd48a6b4/CordovaLib/Classes/CDVTimer.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVTimer.h b/CordovaLib/Classes/CDVTimer.h
index 628d423..6d31593 100644
--- a/CordovaLib/Classes/CDVTimer.h
+++ b/CordovaLib/Classes/CDVTimer.h
@@ -6,9 +6,9 @@
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
- 
+
  http://www.apache.org/licenses/LICENSE-2.0
- 
+
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -21,8 +21,7 @@
 
 @interface CDVTimer : NSObject
 
-+ (void) start:(NSString*)name;
-+ (void) stop:(NSString*)name;
-
++ (void)start:(NSString*)name;
++ (void)stop:(NSString*)name;
 
 @end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/bd48a6b4/CordovaLib/Classes/CDVTimer.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVTimer.m b/CordovaLib/Classes/CDVTimer.m
index e42c1c6..784e94d 100644
--- a/CordovaLib/Classes/CDVTimer.m
+++ b/CordovaLib/Classes/CDVTimer.m
@@ -6,9 +6,9 @@
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
- 
+
  http://www.apache.org/licenses/LICENSE-2.0
- 
+
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,7 +19,6 @@
 
 #import "CDVTimer.h"
 
-
 #pragma mark CDVTimerItem
 
 @interface CDVTimerItem : NSObject
@@ -28,20 +27,19 @@
 @property (nonatomic, strong) NSDate* started;
 @property (nonatomic, strong) NSDate* ended;
 
-- (void) log;
+- (void)log;
 
 @end
 
 @implementation CDVTimerItem
 
-- (void) log
+- (void)log
 {
     NSLog(@"[CDVTimer][%@] %fms", self.name, [self.ended timeIntervalSinceDate:self.started] * 1000.0);
 }
 
 @end
 
-
 #pragma mark CDVTimer
 
 @interface CDVTimer ()
@@ -54,16 +52,16 @@
 
 #pragma mark object methods
 
-- (id) init
+- (id)init
 {
     if (self = [super init]) {
         self.items = [NSMutableDictionary dictionaryWithCapacity:6];
     }
-    
+
     return self;
 }
 
-- (void) add:(NSString*)name
+- (void)add:(NSString*)name
 {
     if ([self.items objectForKey:[name lowercaseString]] == nil) {
         CDVTimerItem* item = [CDVTimerItem new];
@@ -75,10 +73,10 @@
     }
 }
 
-- (void) remove:(NSString*)name
+- (void)remove:(NSString*)name
 {
     CDVTimerItem* item = [self.items objectForKey:[name lowercaseString]];
-    
+
     if (item != nil) {
         item.ended = [NSDate new];
         [item log];
@@ -88,40 +86,38 @@
     }
 }
 
-- (void) removeAll
+- (void)removeAll
 {
     [self.items removeAllObjects];
 }
 
-
 #pragma mark class methods
 
-+ (void) start:(NSString*)name
++ (void)start:(NSString*)name
 {
     [[CDVTimer sharedInstance] add:name];
 }
 
-+ (void) stop:(NSString*)name
++ (void)stop:(NSString*)name
 {
     [[CDVTimer sharedInstance] remove:name];
 }
 
-+ (void) clearAll
++ (void)clearAll
 {
     [[CDVTimer sharedInstance] removeAll];
 }
 
-+ (CDVTimer*) sharedInstance
++ (CDVTimer*)sharedInstance
 {
     static dispatch_once_t pred = 0;
     __strong static CDVTimer* _sharedObject = nil;
-    
+
     dispatch_once(&pred, ^{
-        _sharedObject = [[self alloc] init];
-    });
-    
+            _sharedObject = [[self alloc] init];
+        });
+
     return _sharedObject;
 }
 
-
 @end

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/bd48a6b4/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 1eab52a..459ef87 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -128,7 +128,7 @@
 
 - (void)keyboardWillShowOrHide:(NSNotification*)notif
 {
-    if (![@"true" isEqualToString:self.settings[@"KeyboardShrinksView"]]) {
+    if (![@"true" isEqualToString : self.settings[@"KeyboardShrinksView"]]) {
         return;
     }
     BOOL showEvent = [notif.name isEqualToString:UIKeyboardWillShowNotification];
@@ -290,18 +290,18 @@
         [[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(hideKeyboardFormAccessoryBar) withObject:nil afterDelay:0];
-            }];
+                                                      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(hideKeyboardFormAccessoryBar) withObject:nil 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"]) ||
-            ([backupWebStorageType isEqualToString:@"cloud"] && !IsAtLeastiOSVersion (@"6.0")))) {
-        [self registerPlugin:[[CDVLocalStorage alloc] initWithWebView:self.webView] withClassName:NSStringFromClass ([CDVLocalStorage class])];
+    if (IsAtLeastiOSVersion(@"5.1") && (([backupWebStorageType isEqualToString:@"local"]) ||
+        ([backupWebStorageType isEqualToString:@"cloud"] && !IsAtLeastiOSVersion(@"6.0")))) {
+        [self registerPlugin:[[CDVLocalStorage alloc] initWithWebView:self.webView] withClassName:NSStringFromClass([CDVLocalStorage class])];
     }
 
     /*
@@ -342,7 +342,7 @@
     /*
      * iOS 6.0 UIWebView properties
      */
-    if (IsAtLeastiOSVersion (@"6.0")) {
+    if (IsAtLeastiOSVersion(@"6.0")) {
         BOOL keyboardDisplayRequiresUserAction = YES; // KeyboardDisplayRequiresUserAction - defaults to YES
         if ([self.settings objectForKey:@"KeyboardDisplayRequiresUserAction"] != nil) {
             if ([self.settings objectForKey:@"KeyboardDisplayRequiresUserAction"]) {
@@ -367,14 +367,16 @@
             [self.webView setValue:[NSNumber numberWithBool:suppressesIncrementalRendering] forKey:@"suppressesIncrementalRendering"];
         }
     }
-    
+
     if ([self.startupPluginNames count] > 0) {
         [CDVTimer start:@"TotalPluginStartup"];
+
         for (NSString* pluginName in self.startupPluginNames) {
             [CDVTimer start:pluginName];
             [self getCommandInstance:pluginName];
             [CDVTimer stop:pluginName];
         }
+
         [CDVTimer stop:@"TotalPluginStartup"];
     }
 
@@ -385,16 +387,16 @@
 
     // /////////////////
     [CDVUserAgentUtil acquireLock:^(NSInteger lockToken) {
-            _userAgentLockToken = lockToken;
-            [CDVUserAgentUtil setUserAgent:self.userAgent lockToken:lockToken];
-            if (!loadErr) {
-                NSURLRequest* appReq = [NSURLRequest requestWithURL:appURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0];
-                [self.webView loadRequest:appReq];
-            } else {
-                NSString* html = [NSString stringWithFormat:@"<html><body> %@ </body></html>", loadErr];
-                [self.webView loadHTMLString:html baseURL:nil];
-            }
-        }];
+        _userAgentLockToken = lockToken;
+        [CDVUserAgentUtil setUserAgent:self.userAgent lockToken:lockToken];
+        if (!loadErr) {
+            NSURLRequest* appReq = [NSURLRequest requestWithURL:appURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0];
+            [self.webView loadRequest:appReq];
+        } else {
+            NSString* html = [NSString stringWithFormat:@"<html><body> %@ </body></html>", loadErr];
+            [self.webView loadHTMLString:html baseURL:nil];
+        }
+    }];
 }
 
 - (void)hideKeyboardFormAccessoryBar
@@ -789,7 +791,7 @@
 
     id obj = [self.pluginObjects objectForKey:className];
     if (!obj) {
-        obj = [[NSClassFromString (className)alloc] initWithWebView:webView];
+        obj = [[NSClassFromString(className)alloc] initWithWebView:webView];
 
         if (obj != nil) {
             [self registerPlugin:obj withClassName:className];