Skip to content
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.

Upgrade to Phonegap 3.6.3 #40

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ hive-ios

Phonegapped version of [hive-js](https://github.com/hivewallet/hive-js/)

Phonegap v3.6.3

## Development

### Requirement
Expand Down
6 changes: 6 additions & 0 deletions cordova/platforms/ios/CordovaLib/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build/*
*.pbxuser
*.perspectivev3
*.mode1v3
javascripts/cordova-*.js

5 changes: 4 additions & 1 deletion cordova/platforms/ios/CordovaLib/Classes/CDVAvailability.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
#define __CORDOVA_3_4_0 30400
#define __CORDOVA_3_4_1 30401
#define __CORDOVA_3_5_0 30500
#define __CORDOVA_3_6_0 30600
#define __CORDOVA_3_6_1 30601
#define __CORDOVA_3_6_3 30603
#define __CORDOVA_NA 99999 /* not available */

/*
Expand All @@ -60,7 +63,7 @@
#endif
*/
#ifndef CORDOVA_VERSION_MIN_REQUIRED
#define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_3_5_0
#define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_3_6_3
#endif

/*
Expand Down
4 changes: 0 additions & 4 deletions cordova/platforms/ios/CordovaLib/Classes/CDVCommandDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
- (NSString*)pathForResource:(NSString*)resourcepath;
- (id)getCommandInstance:(NSString*)pluginName;

// Plugins should not be using this interface to call other plugins since it
// will result in bogus callbacks being made.
- (BOOL)execute:(CDVInvokedUrlCommand*)command CDV_DEPRECATED(2.2, "Use direct method calls instead.");

// Sends a plugin result to the JS. This is thread-safe.
- (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId;
// Evaluates the given JS. This is thread-safe.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
@interface CDVCommandDelegateImpl : NSObject <CDVCommandDelegate>{
@private
__weak CDVViewController* _viewController;
NSRegularExpression *_callbackIdPattern;
NSRegularExpression* _callbackIdPattern;
@protected
__weak CDVCommandQueue* _commandQueue;
BOOL _delayResponses;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,14 @@ - (void)evalJsHelper:(NSString*)js
}
}

- (BOOL)isValidCallbackId:(NSString *)callbackId
- (BOOL)isValidCallbackId:(NSString*)callbackId
{
NSError *err = nil;
NSError* err = nil;

if (callbackId == nil) {
return NO;
}

// Initialize on first use
if (_callbackIdPattern == nil) {
// Catch any invalid characters in the callback id.
Expand Down Expand Up @@ -150,11 +155,6 @@ - (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop
}
}

- (BOOL)execute:(CDVInvokedUrlCommand*)command
{
return [_commandQueue execute:command];
}

- (id)getCommandInstance:(NSString*)pluginName
{
return [_viewController getCommandInstance:pluginName];
Expand Down
8 changes: 4 additions & 4 deletions cordova/platforms/ios/CordovaLib/Classes/CDVLocalStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,10 @@ + (void)__restoreLegacyDatabaseLocationsWithBackupType:(NSString*)backupType

if ([backupType isEqualToString:@"cloud"]) {
#ifdef DEBUG
NSLog(@"\n\nStarted backup to iCloud! Please be careful."
"\nYour application might rejected by Apple if you store too much data."
"\nFor more information please read \"iOS Data Storage Guidelines\""
"\nYou could find it at the following address https://developer.apple.com/icloud/documentation/data-storage/ .\n\n");
NSLog(@"\n\nStarted backup to iCloud! Please be careful."
"\nYour application might be rejected by Apple if you store too much data."
"\nFor more information please read \"iOS Data Storage Guidelines\" at:"
"\nhttps://developer.apple.com/icloud/documentation/data-storage/\n\n");
#endif
// We would like to restore old backups/caches databases to the new destination (nested in lib folder)
[backupInfo addObjectsFromArray:[self createBackupInfoWithTargetDir:appLibraryFolder backupDir:[appDocumentsFolder stringByAppendingPathComponent:@"Backups"] targetDirNests:YES backupDirNests:NO rename:YES]];
Expand Down
9 changes: 5 additions & 4 deletions cordova/platforms/ios/CordovaLib/Classes/CDVPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ extern NSString* const CDVRemoteNotificationError;

- (id)appDelegate;

// TODO(agrieve): Deprecate these in favour of using CDVCommandDelegate directly.
- (NSString*)writeJavascript:(NSString*)javascript;
- (NSString*)success:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId;
- (NSString*)error:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId;
- (NSString*)writeJavascript:(NSString*)javascript CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate equivalent of evalJs:. This will be removed in 4.0.0");

- (NSString*)success:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate equivalent of sendPluginResult:callbackId. This will be removed in 4.0.0");

- (NSString*)error:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate equivalent of sendPluginResult:callbackId. This will be removed in 4.0.0");

@end
9 changes: 6 additions & 3 deletions cordova/platforms/ios/CordovaLib/Classes/CDVPluginResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#import <Foundation/Foundation.h>
#import "CDVAvailability.h"

typedef enum {
CDVCommandStatus_NO_RESULT = 0,
Expand Down Expand Up @@ -61,8 +62,10 @@ typedef enum {
- (NSString*)argumentsAsJSON;

// These methods are used by the legacy plugin return result method
- (NSString*)toJSONString;
- (NSString*)toSuccessCallbackString:(NSString*)callbackId;
- (NSString*)toErrorCallbackString:(NSString*)callbackId;
- (NSString*)toJSONString CDV_DEPRECATED(3.6, "Only used by toSuccessCallbackString and toErrorCallbackString which are deprecated. This will be removed in 4.0.0");

- (NSString*)toSuccessCallbackString:(NSString*)callbackId CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate method sendPluginResult:callbackId instead. This will be removed in 4.0.0");

- (NSString*)toErrorCallbackString:(NSString*)callbackId CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate method sendPluginResult:callbackId instead. This will be removed in 4.0.0");

@end
2 changes: 1 addition & 1 deletion cordova/platforms/ios/CordovaLib/Classes/CDVPluginResult.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ - (CDVPluginResult*)initWithStatus:(CDVCommandStatus)statusOrdinal message:(id)t

+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal
{
return [[self alloc] initWithStatus:statusOrdinal message:[org_apache_cordova_CommandStatusMsgs objectAtIndex:statusOrdinal]];
return [[self alloc] initWithStatus:statusOrdinal message:nil];
}

+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsString:(NSString*)theMessage
Expand Down
15 changes: 2 additions & 13 deletions cordova/platforms/ios/CordovaLib/Classes/CDVShared.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@
under the License.
*/

#import <Foundation/Foundation.h>
// This file was emptied out in 3.6.0 release (July 2014).
// It will be deleted in a future release.
#import <CoreLocation/CoreLocation.h>

@interface NSError (JSONMethods)

- (NSString*)JSONRepresentation;

@end

@interface CLLocation (JSONMethods)

- (NSString*)JSONRepresentation;

@end
59 changes: 0 additions & 59 deletions cordova/platforms/ios/CordovaLib/Classes/CDVShared.m

This file was deleted.

29 changes: 20 additions & 9 deletions cordova/platforms/ios/CordovaLib/Classes/CDVURLProtocol.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ Licensed to the Apache Software Foundation (ASF) under one
#import "CDVViewController.h"

@interface CDVHTTPURLResponse : NSHTTPURLResponse
@property (nonatomic) NSInteger statusCode;
#ifndef __IPHONE_8_0
@property (nonatomic) NSInteger statusCode;
#endif
@end

static CDVWhitelist* gWhitelist = nil;
Expand Down Expand Up @@ -166,8 +168,8 @@ - (void)startLoading
// We have the asset! Get the data and send it along.
ALAssetRepresentation* assetRepresentation = [asset defaultRepresentation];
NSString* MIMEType = (__bridge_transfer NSString*)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)[assetRepresentation UTI], kUTTagClassMIMEType);
Byte* buffer = (Byte*)malloc([assetRepresentation size]);
NSUInteger bufferSize = [assetRepresentation getBytes:buffer fromOffset:0.0 length:[assetRepresentation size] error:nil];
Byte* buffer = (Byte*)malloc((unsigned long)[assetRepresentation size]);
NSUInteger bufferSize = [assetRepresentation getBytes:buffer fromOffset:0.0 length:(NSUInteger)[assetRepresentation size] error:nil];
NSData* data = [NSData dataWithBytesNoCopy:buffer length:bufferSize freeWhenDone:YES];
[self sendResponseWithResponseCode:200 data:data mimeType:MIMEType];
} else {
Expand Down Expand Up @@ -205,12 +207,21 @@ - (void)sendResponseWithResponseCode:(NSInteger)statusCode data:(NSData*)data mi
mimeType = @"text/plain";
}
NSString* encodingName = [@"text/plain" isEqualToString : mimeType] ? @"UTF-8" : nil;
CDVHTTPURLResponse* response =
[[CDVHTTPURLResponse alloc] initWithURL:[[self request] URL]
MIMEType:mimeType
expectedContentLength:[data length]
textEncodingName:encodingName];
response.statusCode = statusCode;

#ifdef __IPHONE_8_0
NSHTTPURLResponse* response = [NSHTTPURLResponse alloc];
#else
CDVHTTPURLResponse* response = [CDVHTTPURLResponse alloc];
#endif

response = [response initWithURL:[[self request] URL]
MIMEType:mimeType
expectedContentLength:[data length]
textEncodingName:encodingName];

#ifndef __IPHONE_8_0
response.statusCode = statusCode;
#endif

[[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
if (data != nil) {
Expand Down
14 changes: 10 additions & 4 deletions cordova/platforms/ios/CordovaLib/Classes/CDVViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ - (void)__init
self.supportedOrientations = [self parseInterfaceOrientations:
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"UISupportedInterfaceOrientations"]];

[self printVersion];
[self printMultitaskingInfo];
[self printDeprecationNotice];
[self printPlatformVersionWarning];
self.initialized = YES;

// load config.xml settings
Expand Down Expand Up @@ -118,10 +119,15 @@ - (void)viewWillDisappear:(BOOL)animated
[super viewWillDisappear:animated];
}

- (void)printDeprecationNotice
- (void)printVersion
{
if (!IsAtLeastiOSVersion(@"5.0")) {
NSLog(@"CRITICAL: For Cordova 2.0, you will need to upgrade to at least iOS 5.0 or greater. Your current version of iOS is %@.",
NSLog(@"Apache Cordova native platform version %@ is starting.", CDV_VERSION);
}

- (void)printPlatformVersionWarning
{
if (!IsAtLeastiOSVersion(@"6.0")) {
NSLog(@"CRITICAL: For Cordova 3.5.0 and above, you will need to upgrade to at least iOS 6.0 or greater. Your current version of iOS is %@.",
[[UIDevice currentDevice] systemVersion]
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#import <UIKit/UIKit.h>
#import "CDVAvailability.h"

/**
* Distinguishes top-level navigations from sub-frame navigations.
Expand All @@ -34,7 +35,8 @@
}

- (id)initWithDelegate:(NSObject <UIWebViewDelegate>*)delegate;
- (BOOL)request:(NSURLRequest*)newRequest isFragmentIdentifierToRequest:(NSURLRequest*)originalRequest __attribute__((deprecated("Deprecated Since 3.5.0 -Use request:isEqualToRequestAfterStrippingFragments: instead.")));
- (BOOL)request:(NSURLRequest*)newRequest isFragmentIdentifierToRequest:(NSURLRequest*)originalRequest CDV_DEPRECATED(3.5, "Use request:isEqualToRequestAfterStrippingFragments: instead.");

- (BOOL)request:(NSURLRequest*)newRequest isEqualToRequestAfterStrippingFragments:(NSURLRequest*)originalRequest;

@end
3 changes: 2 additions & 1 deletion cordova/platforms/ios/CordovaLib/Classes/CDVWhitelist.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ + (NSString*)regexFromPattern:(NSString*)pattern allowWildcards:(bool)allowWildc

if (allowWildcards) {
regex = [regex stringByReplacingOccurrencesOfString:@"\\*" withString:@".*"];

/* [NSURL path] has the peculiarity that a trailing slash at the end of a path
* will be omitted. This regex tweak compensates for that.
*/
if ([regex hasSuffix:@"\\/.*"]) {
regex = [NSString stringWithFormat:@"%@(\\/.*)?", [regex substringToIndex:([regex length]-4)]];
regex = [NSString stringWithFormat:@"%@(\\/.*)?", [regex substringToIndex:([regex length] - 4)]];
}
}
return [NSString stringWithFormat:@"%@$", regex];
Expand Down
19 changes: 14 additions & 5 deletions cordova/platforms/ios/CordovaLib/Classes/NSData+Base64.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,20 @@
// Created by Matt Gallagher on 2009/06/03.
// Copyright 2009 Matt Gallagher. All rights reserved.
//
// Permission is given to use this source code file, free of charge, in any
// project, commercial or otherwise, entirely at your risk, with the condition
// that any redistribution (in part or whole) of source code must retain
// this copyright and permission notice. Attribution in compiled projects is
// appreciated but not required.
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software. Permission is granted to anyone to
// use this software for any purpose, including commercial applications, and to
// alter it and redistribute it freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source
// distribution.
//

#import <Foundation/Foundation.h>
Expand Down
Loading