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/01/10 00:37:39 UTC

ios commit: [CB-1849] Remove iOS 4/5 conditional code block, put in main block

Updated Branches:
  refs/heads/master 10d1e646e -> aeecb2615


[CB-1849] Remove iOS 4/5 conditional code block, put in main block


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

Branch: refs/heads/master
Commit: aeecb2615da5a9c7eb32a8259f2c74189c329008
Parents: 10d1e64
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed Jan 9 15:37:31 2013 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Wed Jan 9 15:37:31 2013 -0800

----------------------------------------------------------------------
 CordovaLib/Classes/CDVFileTransfer.m   |   13 +++----------
 CordovaLib/Classes/CDVViewController.m |   25 ++++---------------------
 2 files changed, 7 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aeecb261/CordovaLib/Classes/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVFileTransfer.m b/CordovaLib/Classes/CDVFileTransfer.m
index b25177a..6a81245 100644
--- a/CordovaLib/Classes/CDVFileTransfer.m
+++ b/CordovaLib/Classes/CDVFileTransfer.m
@@ -134,13 +134,6 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
     BOOL chunkedMode = [[arguments objectAtIndex:7 withDefault:[NSNumber numberWithBool:YES]] boolValue];
     NSDictionary* headers = [arguments objectAtIndex:8 withDefault:nil];
 
-    // CFStreamCreateBoundPair crashes on iOS < 5.
-    if (!IsAtLeastiOSVersion(@"5")) {
-        // TODO(agrieve): See if it's okay license-wise to include the work-around code from:
-        // http://developer.apple.com/library/ios/#samplecode/SimpleURLConnections/Listings/PostController_m.html
-        chunkedMode = NO;
-    }
-
     CDVPluginResult* result = nil;
     CDVFileTransferError errorCode = 0;
 
@@ -302,9 +295,9 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
     if (delegate != nil) {
         [delegate.connection cancel];
         [activeTransfers removeObjectForKey:objectId];
-        
-        //delete uncomplete file    
-        NSFileManager *fileMgr = [NSFileManager defaultManager];
+
+        // delete uncomplete file
+        NSFileManager* fileMgr = [NSFileManager defaultManager];
         [fileMgr removeItemAtPath:delegate.target error:nil];
 
         CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:[self createFileTransferError:CONNECTION_ABORTED AndSource:delegate.source AndTarget:delegate.target]];

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/aeecb261/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index f1b36df..7491111 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -72,12 +72,10 @@ static NSString* gOriginalUserAgent = nil;
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppLocaleDidChange:)
                                                      name:NSCurrentLocaleDidChangeNotification object:nil];
 
-        if (IsAtLeastiOSVersion(@"4.0")) {
-            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppWillEnterForeground:)
-                                                         name:UIApplicationWillEnterForegroundNotification object:nil];
-            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppDidEnterBackground:)
-                                                         name:UIApplicationDidEnterBackgroundNotification object:nil];
-        }
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppWillEnterForeground:)
+                                                     name:UIApplicationWillEnterForegroundNotification object:nil];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppDidEnterBackground:)
+                                                     name:UIApplicationDidEnterBackgroundNotification object:nil];
 
         // read from UISupportedInterfaceOrientations (or UISupportedInterfaceOrientations~iPad, if its iPad) from -Info.plist
         self.supportedOrientations = [self parseInterfaceOrientations:
@@ -411,21 +409,6 @@ static NSString* gOriginalUserAgent = nil;
     return [self.supportedOrientations containsObject:[NSNumber numberWithInt:orientation]];
 }
 
-/**
- Called by UIKit when the device starts to rotate to a new orientation.  This fires the \c setOrientation
- method on the Orientation object in JavaScript.  Look at the JavaScript documentation for more information.
- */
-- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
-{
-    if (!IsAtLeastiOSVersion(@"5.0")) {
-        NSString* jsCallback = [NSString stringWithFormat:
-            @"window.__defineGetter__('orientation',function(){ return %d; }); \
-                                  cordova.fireWindowEvent('orientationchange');"
-            , [self mapIosOrientationToJsOrientation:fromInterfaceOrientation]];
-        [self.commandDelegate evalJs:jsCallback];
-    }
-}
-
 - (CDVCordovaView*)newCordovaViewWithFrame:(CGRect)bounds
 {
     return [[CDVCordovaView alloc] initWithFrame:bounds];