Commit 402b9166 by Sebastián Katzer

Upgrade ios platform to version 3.8.0

parent 13a60d52
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#define __CORDOVA_3_5_0 30500 #define __CORDOVA_3_5_0 30500
#define __CORDOVA_3_6_0 30600 #define __CORDOVA_3_6_0 30600
#define __CORDOVA_3_7_0 30700 #define __CORDOVA_3_7_0 30700
#define __CORDOVA_3_8_0 30800
#define __CORDOVA_NA 99999 /* not available */ #define __CORDOVA_NA 99999 /* not available */
/* /*
...@@ -64,7 +65,7 @@ ...@@ -64,7 +65,7 @@
#endif #endif
*/ */
#ifndef CORDOVA_VERSION_MIN_REQUIRED #ifndef CORDOVA_VERSION_MIN_REQUIRED
#define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_3_7_0 #define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_3_8_0
#endif #endif
/* /*
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
*/ */
#import "CDVCommandDelegateImpl.h" #import "CDVCommandDelegateImpl.h"
#import "CDVJSON.h" #import "CDVJSON_private.h"
#import "CDVCommandQueue.h" #import "CDVCommandQueue.h"
#import "CDVPluginResult.h" #import "CDVPluginResult.h"
#import "CDVViewController.h" #import "CDVViewController.h"
...@@ -104,8 +104,7 @@ ...@@ -104,8 +104,7 @@
- (BOOL)isValidCallbackId:(NSString*)callbackId - (BOOL)isValidCallbackId:(NSString*)callbackId
{ {
if ((callbackId == nil) || (_callbackIdPattern == nil)) {
if (callbackId == nil || _callbackIdPattern == nil) {
return NO; return NO;
} }
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#import "CDVCommandQueue.h" #import "CDVCommandQueue.h"
#import "CDVViewController.h" #import "CDVViewController.h"
#import "CDVCommandDelegateImpl.h" #import "CDVCommandDelegateImpl.h"
#import "CDVJSON_private.h"
// Parse JS on the main thread if it's shorter than this. // Parse JS on the main thread if it's shorter than this.
static const NSInteger JSON_SIZE_FOR_MAIN_THREAD = 4 * 1024; // Chosen arbitrarily. static const NSInteger JSON_SIZE_FOR_MAIN_THREAD = 4 * 1024; // Chosen arbitrarily.
...@@ -70,10 +71,10 @@ static const double MAX_EXECUTION_TIME = .008; // Half of a 60fps frame. ...@@ -70,10 +71,10 @@ static const double MAX_EXECUTION_TIME = .008; // Half of a 60fps frame.
NSMutableArray* commandBatchHolder = [[NSMutableArray alloc] init]; NSMutableArray* commandBatchHolder = [[NSMutableArray alloc] init];
[_queue addObject:commandBatchHolder]; [_queue addObject:commandBatchHolder];
if ([batchJSON length] < JSON_SIZE_FOR_MAIN_THREAD) { if ([batchJSON length] < JSON_SIZE_FOR_MAIN_THREAD) {
[commandBatchHolder addObject:[batchJSON JSONObject]]; [commandBatchHolder addObject:[batchJSON cdv_JSONObject]];
} else { } else {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^() { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^() {
NSMutableArray* result = [batchJSON JSONObject]; NSMutableArray* result = [batchJSON cdv_JSONObject];
@synchronized(commandBatchHolder) { @synchronized(commandBatchHolder) {
[commandBatchHolder addObject:result]; [commandBatchHolder addObject:result];
} }
...@@ -149,7 +150,7 @@ static const double MAX_EXECUTION_TIME = .008; // Half of a 60fps frame. ...@@ -149,7 +150,7 @@ static const double MAX_EXECUTION_TIME = .008; // Half of a 60fps frame.
if (![self execute:command]) { if (![self execute:command]) {
#ifdef DEBUG #ifdef DEBUG
NSString* commandJson = [jsonEntry JSONString]; NSString* commandJson = [jsonEntry cdv_JSONString];
static NSUInteger maxLogLength = 1024; static NSUInteger maxLogLength = 1024;
NSString* commandString = ([commandJson length] > maxLogLength) ? NSString* commandString = ([commandJson length] > maxLogLength) ?
[NSString stringWithFormat:@"%@[...]", [commandJson substringToIndex:maxLogLength]] : [NSString stringWithFormat:@"%@[...]", [commandJson substringToIndex:maxLogLength]] :
......
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
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
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
#import "CDVPlugin.h"
@interface CDVHandleOpenURL : CDVPlugin
@property (nonatomic, strong) NSURL* url;
@property (nonatomic, assign) BOOL pageLoaded;
@end
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
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
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
#import "CDVHandleOpenURL.h"
#import "CDV.h"
@implementation CDVHandleOpenURL
- (void)pluginInitialize
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationLaunchedWithUrl:) name:CDVPluginHandleOpenURLNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationPageDidLoad:) name:CDVPageDidLoadNotification object:nil];
}
- (void)applicationLaunchedWithUrl:(NSNotification*)notification
{
NSURL *url = [notification object];
self.url = url;
// warm-start handler
if (self.pageLoaded) {
[self processOpenUrl:self.url pageLoaded:YES];
self.url = nil;
}
}
- (void)applicationPageDidLoad:(NSNotification*)notification
{
// cold-start handler
self.pageLoaded = YES;
if (self.url) {
[self processOpenUrl:self.url pageLoaded:YES];
self.url = nil;
}
}
- (void)processOpenUrl:(NSURL*)url pageLoaded:(BOOL)pageLoaded
{
if (!pageLoaded) {
// query the webview for readystate
NSString* readyState = [self.webView stringByEvaluatingJavaScriptFromString:@"document.readyState"];
pageLoaded = [readyState isEqualToString:@"loaded"] || [readyState isEqualToString:@"complete"];
}
if (pageLoaded) {
// calls into javascript global function 'handleOpenURL'
NSString* jsString = [NSString stringWithFormat:@"document.addEventListener('deviceready',function(){if (typeof handleOpenURL === 'function') { handleOpenURL(\"%@\");}});", url];
[self.webView stringByEvaluatingJavaScriptFromString:jsString];
} else {
// save for when page has loaded
self.url = url;
}
}
@end
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
*/ */
#import "CDVInvokedUrlCommand.h" #import "CDVInvokedUrlCommand.h"
#import "CDVJSON.h" #import "CDVJSON_private.h"
#import "NSData+Base64.h" #import "NSData+Base64.h"
@implementation CDVInvokedUrlCommand @implementation CDVInvokedUrlCommand
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
newArgs = [NSMutableArray arrayWithArray:_arguments]; newArgs = [NSMutableArray arrayWithArray:_arguments];
_arguments = newArgs; _arguments = newArgs;
} }
[newArgs replaceObjectAtIndex:i withObject:[NSData dataFromBase64String:data]]; [newArgs replaceObjectAtIndex:i withObject:[NSData cdv_dataFromBase64String:data]];
} }
} }
......
...@@ -17,15 +17,21 @@ ...@@ -17,15 +17,21 @@
under the License. under the License.
*/ */
#import "CDVAvailabilityDeprecated.h"
@interface NSArray (CDVJSONSerializing) @interface NSArray (CDVJSONSerializing)
- (NSString*)JSONString; - (NSString*)JSONString CDV_DEPRECATED(3.8 .0, "Use NSJSONSerialization instead.");
@end @end
@interface NSDictionary (CDVJSONSerializing) @interface NSDictionary (CDVJSONSerializing)
- (NSString*)JSONString; - (NSString*)JSONString CDV_DEPRECATED(3.8 .0, "Use NSJSONSerialization instead.");
@end @end
@interface NSString (CDVJSONSerializing) @interface NSString (CDVJSONSerializing)
- (id)JSONObject; - (id)JSONObject CDV_DEPRECATED(3.8 .0, "Use NSJSONSerialization instead.");
- (id)JSONFragment;
- (id)JSONFragment CDV_DEPRECATED(3.8 .0, "Use NSJSONSerialization instead.");
@end @end
...@@ -17,24 +17,13 @@ ...@@ -17,24 +17,13 @@
under the License. under the License.
*/ */
#import "CDVJSON.h" #import "CDVJSON_private.h"
#import <Foundation/NSJSONSerialization.h>
@implementation NSArray (CDVJSONSerializing) @implementation NSArray (CDVJSONSerializing)
- (NSString*)JSONString - (NSString*)JSONString
{ {
NSError* error = nil; return [self cdv_JSONString];
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self
options:NSJSONWritingPrettyPrinted
error:&error];
if (error != nil) {
NSLog(@"NSArray JSONString error: %@", [error localizedDescription]);
return nil;
} else {
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
} }
@end @end
...@@ -43,17 +32,7 @@ ...@@ -43,17 +32,7 @@
- (NSString*)JSONString - (NSString*)JSONString
{ {
NSError* error = nil; return [self cdv_JSONString];
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self
options:NSJSONWritingPrettyPrinted
error:&error];
if (error != nil) {
NSLog(@"NSDictionary JSONString error: %@", [error localizedDescription]);
return nil;
} else {
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
} }
@end @end
...@@ -62,30 +41,12 @@ ...@@ -62,30 +41,12 @@
- (id)JSONObject - (id)JSONObject
{ {
NSError* error = nil; return [self cdv_JSONObject];
id object = [NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding]
options:NSJSONReadingMutableContainers
error:&error];
if (error != nil) {
NSLog(@"NSString JSONObject error: %@", [error localizedDescription]);
}
return object;
} }
- (id)JSONFragment - (id)JSONFragment
{ {
NSError* error = nil; return [self cdv_JSONFragment];
id object = [NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding]
options:NSJSONReadingAllowFragments
error:&error];
if (error != nil) {
NSLog(@"NSString JSONObject error: %@", [error localizedDescription]);
}
return object;
} }
@end @end
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
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
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
@interface NSArray (CDVJSONSerializingPrivate)
- (NSString*)cdv_JSONString;
@end
@interface NSDictionary (CDVJSONSerializingPrivate)
- (NSString*)cdv_JSONString;
@end
@interface NSString (CDVJSONSerializingPrivate)
- (id)cdv_JSONObject;
- (id)cdv_JSONFragment;
@end
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
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
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
#import "CDVJSON_private.h"
#import <Foundation/NSJSONSerialization.h>
@implementation NSArray (CDVJSONSerializingPrivate)
- (NSString*)cdv_JSONString
{
NSError* error = nil;
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self
options:0
error:&error];
if (error != nil) {
NSLog(@"NSArray JSONString error: %@", [error localizedDescription]);
return nil;
} else {
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
}
@end
@implementation NSDictionary (CDVJSONSerializingPrivate)
- (NSString*)cdv_JSONString
{
NSError* error = nil;
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self
options:NSJSONWritingPrettyPrinted
error:&error];
if (error != nil) {
NSLog(@"NSDictionary JSONString error: %@", [error localizedDescription]);
return nil;
} else {
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
}
@end
@implementation NSString (CDVJSONSerializingPrivate)
- (id)cdv_JSONObject
{
NSError* error = nil;
id object = [NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding]
options:NSJSONReadingMutableContainers
error:&error];
if (error != nil) {
NSLog(@"NSString JSONObject error: %@", [error localizedDescription]);
}
return object;
}
- (id)cdv_JSONFragment
{
NSError* error = nil;
id object = [NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding]
options:NSJSONReadingAllowFragments
error:&error];
if (error != nil) {
NSLog(@"NSString JSONObject error: %@", [error localizedDescription]);
}
return object;
}
@end
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
*/ */
#import "CDVPluginResult.h" #import "CDVPluginResult.h"
#import "CDVJSON.h" #import "CDVJSON_private.h"
#import "CDVDebug.h" #import "CDVDebug.h"
#import "NSData+Base64.h" #import "NSData+Base64.h"
...@@ -37,7 +37,7 @@ id messageFromArrayBuffer(NSData* data) ...@@ -37,7 +37,7 @@ id messageFromArrayBuffer(NSData* data)
{ {
return @{ return @{
@"CDVType" : @"ArrayBuffer", @"CDVType" : @"ArrayBuffer",
@"data" :[data base64EncodedString] @"data" :[data cdv_base64EncodedString]
}; };
} }
...@@ -156,7 +156,7 @@ id messageFromMultipart(NSArray* theMessages) ...@@ -156,7 +156,7 @@ id messageFromMultipart(NSArray* theMessages)
id arguments = (self.message == nil ? [NSNull null] : self.message); id arguments = (self.message == nil ? [NSNull null] : self.message);
NSArray* argumentsWrappedInArray = [NSArray arrayWithObject:arguments]; NSArray* argumentsWrappedInArray = [NSArray arrayWithObject:arguments];
NSString* argumentsJSON = [argumentsWrappedInArray JSONString]; NSString* argumentsJSON = [argumentsWrappedInArray cdv_JSONString];
argumentsJSON = [argumentsJSON substringWithRange:NSMakeRange(1, [argumentsJSON length] - 2)]; argumentsJSON = [argumentsJSON substringWithRange:NSMakeRange(1, [argumentsJSON length] - 2)];
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#import "CDVUserAgentUtil.h" #import "CDVUserAgentUtil.h"
#import "CDVWebViewDelegate.h" #import "CDVWebViewDelegate.h"
#import <AVFoundation/AVFoundation.h> #import <AVFoundation/AVFoundation.h>
#import "CDVHandleOpenURL.h"
#define degreesToRadian(x) (M_PI * (x) / 180.0) #define degreesToRadian(x) (M_PI * (x) / 180.0)
...@@ -460,6 +461,8 @@ ...@@ -460,6 +461,8 @@
[CDVTimer stop:@"TotalPluginStartup"]; [CDVTimer stop:@"TotalPluginStartup"];
} }
[self registerPlugin:[[CDVHandleOpenURL alloc] initWithWebView:self.webView] withClassName:NSStringFromClass([CDVHandleOpenURL class])];
// ///////////////// // /////////////////
NSURL* appURL = [self appUrl]; NSURL* appURL = [self appUrl];
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
} }
- (id)initWithDelegate:(NSObject <UIWebViewDelegate>*)delegate; - (id)initWithDelegate:(NSObject <UIWebViewDelegate>*)delegate;
- (BOOL)request:(NSURLRequest*)newRequest isFragmentIdentifierToRequest:(NSURLRequest*)originalRequest CDV_DEPRECATED(3.5, "Use request:isEqualToRequestAfterStrippingFragments: instead.");
- (BOOL)request:(NSURLRequest*)newRequest isEqualToRequestAfterStrippingFragments:(NSURLRequest*)originalRequest; - (BOOL)request:(NSURLRequest*)newRequest isEqualToRequestAfterStrippingFragments:(NSURLRequest*)originalRequest;
......
...@@ -114,11 +114,6 @@ static NSString *stripFragment(NSString* url) ...@@ -114,11 +114,6 @@ static NSString *stripFragment(NSString* url)
return self; return self;
} }
- (BOOL)request:(NSURLRequest*)newRequest isFragmentIdentifierToRequest:(NSURLRequest*)originalRequest
{
return [self request:newRequest isEqualToRequestAfterStrippingFragments:originalRequest];
}
- (BOOL)request:(NSURLRequest*)newRequest isEqualToRequestAfterStrippingFragments:(NSURLRequest*)originalRequest - (BOOL)request:(NSURLRequest*)newRequest isEqualToRequestAfterStrippingFragments:(NSURLRequest*)originalRequest
{ {
if (originalRequest.URL && newRequest.URL) { if (originalRequest.URL && newRequest.URL) {
......
...@@ -18,9 +18,10 @@ ...@@ -18,9 +18,10 @@
*/ */
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "CDVAvailabilityDeprecated.h"
@interface NSArray (Comparisons) @interface NSArray (Comparisons)
- (id)objectAtIndex:(NSUInteger)index withDefault:(id)aDefault; - (id)objectAtIndex:(NSUInteger)index withDefault:(id)aDefault CDV_DEPRECATED(3.8 .0, "Use [command argumentAtIndex] instead.");
@end @end
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
// //
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "CDVAvailabilityDeprecated.h"
void *CDVNewBase64Decode( void *CDVNewBase64Decode(
const char* inputBuffer, const char* inputBuffer,
...@@ -36,7 +37,11 @@ char *CDVNewBase64Encode( ...@@ -36,7 +37,11 @@ char *CDVNewBase64Encode(
@interface NSData (CDVBase64) @interface NSData (CDVBase64)
+ (NSData*)dataFromBase64String:(NSString*)aString; + (NSData*)dataFromBase64String:(NSString*)aString CDV_DEPRECATED(3.8 .0, "Use cdv_dataFromBase64String");
- (NSString*)base64EncodedString;
- (NSString*)base64EncodedString CDV_DEPRECATED(3.8 .0, "Use [NSData cdv_base64EncodedString]");
+ (NSData*)cdv_dataFromBase64String:(NSString*)aString;
- (NSString*)cdv_base64EncodedString;
@end @end
...@@ -264,7 +264,7 @@ char *CDVNewBase64Encode( ...@@ -264,7 +264,7 @@ char *CDVNewBase64Encode(
// //
// returns the autoreleased NSData representation of the base64 string // returns the autoreleased NSData representation of the base64 string
// //
+ (NSData*)dataFromBase64String:(NSString*)aString + (NSData*)cdv_dataFromBase64String:(NSString*)aString
{ {
size_t outputLength = 0; size_t outputLength = 0;
void* outputBuffer = CDVNewBase64Decode([aString UTF8String], [aString length], &outputLength); void* outputBuffer = CDVNewBase64Decode([aString UTF8String], [aString length], &outputLength);
...@@ -281,7 +281,7 @@ char *CDVNewBase64Encode( ...@@ -281,7 +281,7 @@ char *CDVNewBase64Encode(
// returns an autoreleased NSString being the base 64 representation of the // returns an autoreleased NSString being the base 64 representation of the
// receiver. // receiver.
// //
- (NSString*)base64EncodedString - (NSString*)cdv_base64EncodedString
{ {
size_t outputLength = 0; size_t outputLength = 0;
char* outputBuffer = char* outputBuffer =
...@@ -295,4 +295,14 @@ char *CDVNewBase64Encode( ...@@ -295,4 +295,14 @@ char *CDVNewBase64Encode(
return result; return result;
} }
+ (NSData*)dataFromBase64String:(NSString*)aString
{
return [self cdv_dataFromBase64String:aString];
}
- (NSString*)base64EncodedString
{
return [self cdv_base64EncodedString];
}
@end @end
...@@ -18,18 +18,26 @@ ...@@ -18,18 +18,26 @@
*/ */
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "CDVAvailabilityDeprecated.h"
@interface NSDictionary (org_apache_cordova_NSDictionary_Extension) @interface NSDictionary (org_apache_cordova_NSDictionary_Extension)
- (bool)existsValue:(NSString*)expectedValue forKey:(NSString*)key; - (bool)existsValue:(NSString*)expectedValue forKey:(NSString*)key CDV_DEPRECATED(3.8 .0, "API is slated for removal in 4.0.0");
- (NSInteger)integerValueForKey:(NSString*)key defaultValue:(NSInteger)defaultValue withRange:(NSRange)range;
- (NSInteger)integerValueForKey:(NSString*)key defaultValue:(NSInteger)defaultValue;
- (BOOL)typeValueForKey:(NSString*)key isArray:(BOOL*)bArray isNull:(BOOL*)bNull isNumber:(BOOL*)bNumber isString:(BOOL*)bString;
- (BOOL)valueForKeyIsArray:(NSString*)key;
- (BOOL)valueForKeyIsNull:(NSString*)key;
- (BOOL)valueForKeyIsString:(NSString*)key;
- (BOOL)valueForKeyIsNumber:(NSString*)key;
- (NSDictionary*)dictionaryWithLowercaseKeys; - (NSInteger)integerValueForKey:(NSString*)key defaultValue:(NSInteger)defaultValue withRange:(NSRange)range CDV_DEPRECATED(3.8 .0, "API is slated for removal in 4.0.0");
- (NSInteger)integerValueForKey:(NSString*)key defaultValue:(NSInteger)defaultValue CDV_DEPRECATED(3.8 .0, "API is slated for removal in 4.0.0");
- (BOOL)typeValueForKey:(NSString*)key isArray:(BOOL*)bArray isNull:(BOOL*)bNull isNumber:(BOOL*)bNumber isString:(BOOL*)bString CDV_DEPRECATED(3.8 .0, "API is slated for removal in 4.0.0");
- (BOOL)valueForKeyIsArray:(NSString*)key CDV_DEPRECATED(3.8 .0, "API is slated for removal in 4.0.0");
- (BOOL)valueForKeyIsNull:(NSString*)key CDV_DEPRECATED(3.8 .0, "API is slated for removal in 4.0.0");
- (BOOL)valueForKeyIsString:(NSString*)key CDV_DEPRECATED(3.8 .0, "API is slated for removal in 4.0.0");
- (BOOL)valueForKeyIsNumber:(NSString*)key CDV_DEPRECATED(3.8 .0, "API is slated for removal in 4.0.0");
- (NSDictionary*)dictionaryWithLowercaseKeys CDV_DEPRECATED(3.8 .0, "API is slated for removal in 4.0.0");
@end @end
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "CDVAvailabilityDeprecated.h"
@interface UIDevice (org_apache_cordova_UIDevice_Extension) @interface UIDevice (org_apache_cordova_UIDevice_Extension)
...@@ -26,6 +27,6 @@ ...@@ -26,6 +27,6 @@
Upgrading and/or deleting the app and re-installing will get you a new GUID, so Upgrading and/or deleting the app and re-installing will get you a new GUID, so
this is only unique per install per device. this is only unique per install per device.
*/ */
- (NSString*)uniqueAppInstanceIdentifier; - (NSString*)uniqueAppInstanceIdentifier CDV_DEPRECATED(3.8 .0, "API is slated for removal in 4.0.0");
@end @end
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
30E33AF313A7E24B00594D64 /* CDVPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 30E33AF113A7E24B00594D64 /* CDVPlugin.m */; }; 30E33AF313A7E24B00594D64 /* CDVPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 30E33AF113A7E24B00594D64 /* CDVPlugin.m */; };
30E563CF13E217EC00C949AA /* NSMutableArray+QueueAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E563CD13E217EC00C949AA /* NSMutableArray+QueueAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 30E563CF13E217EC00C949AA /* NSMutableArray+QueueAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E563CD13E217EC00C949AA /* NSMutableArray+QueueAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
30E563D013E217EC00C949AA /* NSMutableArray+QueueAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 30E563CE13E217EC00C949AA /* NSMutableArray+QueueAdditions.m */; }; 30E563D013E217EC00C949AA /* NSMutableArray+QueueAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 30E563CE13E217EC00C949AA /* NSMutableArray+QueueAdditions.m */; };
30E6B8CD1A8ADD900025B9EE /* CDVHandleOpenURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E6B8CB1A8ADD900025B9EE /* CDVHandleOpenURL.h */; };
30E6B8CE1A8ADD900025B9EE /* CDVHandleOpenURL.m in Sources */ = {isa = PBXBuildFile; fileRef = 30E6B8CC1A8ADD900025B9EE /* CDVHandleOpenURL.m */; };
30F3930B169F839700B22307 /* CDVJSON.h in Headers */ = {isa = PBXBuildFile; fileRef = 30F39309169F839700B22307 /* CDVJSON.h */; settings = {ATTRIBUTES = (Public, ); }; }; 30F3930B169F839700B22307 /* CDVJSON.h in Headers */ = {isa = PBXBuildFile; fileRef = 30F39309169F839700B22307 /* CDVJSON.h */; settings = {ATTRIBUTES = (Public, ); }; };
30F3930C169F839700B22307 /* CDVJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 30F3930A169F839700B22307 /* CDVJSON.m */; }; 30F3930C169F839700B22307 /* CDVJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 30F3930A169F839700B22307 /* CDVJSON.m */; };
30F5EBAB14CA26E700987760 /* CDVCommandDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 30F5EBA914CA26E700987760 /* CDVCommandDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 30F5EBAB14CA26E700987760 /* CDVCommandDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 30F5EBA914CA26E700987760 /* CDVCommandDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
...@@ -44,6 +46,7 @@ ...@@ -44,6 +46,7 @@
EB3B3548161CB44D003DBE7D /* CDVCommandQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = EB3B3546161CB44D003DBE7D /* CDVCommandQueue.m */; }; EB3B3548161CB44D003DBE7D /* CDVCommandQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = EB3B3546161CB44D003DBE7D /* CDVCommandQueue.m */; };
EB3B357C161F2A45003DBE7D /* CDVCommandDelegateImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = EB3B357A161F2A44003DBE7D /* CDVCommandDelegateImpl.h */; settings = {ATTRIBUTES = (Public, ); }; }; EB3B357C161F2A45003DBE7D /* CDVCommandDelegateImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = EB3B357A161F2A44003DBE7D /* CDVCommandDelegateImpl.h */; settings = {ATTRIBUTES = (Public, ); }; };
EB3B357D161F2A45003DBE7D /* CDVCommandDelegateImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = EB3B357B161F2A45003DBE7D /* CDVCommandDelegateImpl.m */; }; EB3B357D161F2A45003DBE7D /* CDVCommandDelegateImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = EB3B357B161F2A45003DBE7D /* CDVCommandDelegateImpl.m */; };
EB6A98541A77EE470013FCDB /* CDVJSON_private.m in Sources */ = {isa = PBXBuildFile; fileRef = EB6A98521A77EE470013FCDB /* CDVJSON_private.m */; };
EB96673B16A8970A00D86CDF /* CDVUserAgentUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = EB96673916A8970900D86CDF /* CDVUserAgentUtil.h */; settings = {ATTRIBUTES = (Public, ); }; }; EB96673B16A8970A00D86CDF /* CDVUserAgentUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = EB96673916A8970900D86CDF /* CDVUserAgentUtil.h */; settings = {ATTRIBUTES = (Public, ); }; };
EB96673C16A8970A00D86CDF /* CDVUserAgentUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = EB96673A16A8970900D86CDF /* CDVUserAgentUtil.m */; }; EB96673C16A8970A00D86CDF /* CDVUserAgentUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = EB96673A16A8970900D86CDF /* CDVUserAgentUtil.m */; };
EBA3557315ABD38C00F4DE24 /* NSArray+Comparisons.h in Headers */ = {isa = PBXBuildFile; fileRef = EBA3557115ABD38C00F4DE24 /* NSArray+Comparisons.h */; settings = {ATTRIBUTES = (Public, ); }; }; EBA3557315ABD38C00F4DE24 /* NSArray+Comparisons.h in Headers */ = {isa = PBXBuildFile; fileRef = EBA3557115ABD38C00F4DE24 /* NSArray+Comparisons.h */; settings = {ATTRIBUTES = (Public, ); }; };
...@@ -75,6 +78,8 @@ ...@@ -75,6 +78,8 @@
30E33AF113A7E24B00594D64 /* CDVPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVPlugin.m; path = Classes/CDVPlugin.m; sourceTree = "<group>"; }; 30E33AF113A7E24B00594D64 /* CDVPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVPlugin.m; path = Classes/CDVPlugin.m; sourceTree = "<group>"; };
30E563CD13E217EC00C949AA /* NSMutableArray+QueueAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSMutableArray+QueueAdditions.h"; path = "Classes/NSMutableArray+QueueAdditions.h"; sourceTree = "<group>"; }; 30E563CD13E217EC00C949AA /* NSMutableArray+QueueAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSMutableArray+QueueAdditions.h"; path = "Classes/NSMutableArray+QueueAdditions.h"; sourceTree = "<group>"; };
30E563CE13E217EC00C949AA /* NSMutableArray+QueueAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSMutableArray+QueueAdditions.m"; path = "Classes/NSMutableArray+QueueAdditions.m"; sourceTree = "<group>"; }; 30E563CE13E217EC00C949AA /* NSMutableArray+QueueAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSMutableArray+QueueAdditions.m"; path = "Classes/NSMutableArray+QueueAdditions.m"; sourceTree = "<group>"; };
30E6B8CB1A8ADD900025B9EE /* CDVHandleOpenURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVHandleOpenURL.h; path = Classes/CDVHandleOpenURL.h; sourceTree = "<group>"; };
30E6B8CC1A8ADD900025B9EE /* CDVHandleOpenURL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVHandleOpenURL.m; path = Classes/CDVHandleOpenURL.m; sourceTree = "<group>"; };
30F39309169F839700B22307 /* CDVJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVJSON.h; path = Classes/CDVJSON.h; sourceTree = "<group>"; }; 30F39309169F839700B22307 /* CDVJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVJSON.h; path = Classes/CDVJSON.h; sourceTree = "<group>"; };
30F3930A169F839700B22307 /* CDVJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVJSON.m; path = Classes/CDVJSON.m; sourceTree = "<group>"; }; 30F3930A169F839700B22307 /* CDVJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVJSON.m; path = Classes/CDVJSON.m; sourceTree = "<group>"; };
30F5EBA914CA26E700987760 /* CDVCommandDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVCommandDelegate.h; path = Classes/CDVCommandDelegate.h; sourceTree = "<group>"; }; 30F5EBA914CA26E700987760 /* CDVCommandDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVCommandDelegate.h; path = Classes/CDVCommandDelegate.h; sourceTree = "<group>"; };
...@@ -107,6 +112,8 @@ ...@@ -107,6 +112,8 @@
EB3B3546161CB44D003DBE7D /* CDVCommandQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVCommandQueue.m; path = Classes/CDVCommandQueue.m; sourceTree = "<group>"; }; EB3B3546161CB44D003DBE7D /* CDVCommandQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVCommandQueue.m; path = Classes/CDVCommandQueue.m; sourceTree = "<group>"; };
EB3B357A161F2A44003DBE7D /* CDVCommandDelegateImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVCommandDelegateImpl.h; path = Classes/CDVCommandDelegateImpl.h; sourceTree = "<group>"; }; EB3B357A161F2A44003DBE7D /* CDVCommandDelegateImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVCommandDelegateImpl.h; path = Classes/CDVCommandDelegateImpl.h; sourceTree = "<group>"; };
EB3B357B161F2A45003DBE7D /* CDVCommandDelegateImpl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVCommandDelegateImpl.m; path = Classes/CDVCommandDelegateImpl.m; sourceTree = "<group>"; }; EB3B357B161F2A45003DBE7D /* CDVCommandDelegateImpl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVCommandDelegateImpl.m; path = Classes/CDVCommandDelegateImpl.m; sourceTree = "<group>"; };
EB6A98521A77EE470013FCDB /* CDVJSON_private.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVJSON_private.m; path = Classes/CDVJSON_private.m; sourceTree = "<group>"; };
EB6A98531A77EE470013FCDB /* CDVJSON_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVJSON_private.h; path = Classes/CDVJSON_private.h; sourceTree = "<group>"; };
EB96673916A8970900D86CDF /* CDVUserAgentUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVUserAgentUtil.h; path = Classes/CDVUserAgentUtil.h; sourceTree = "<group>"; }; EB96673916A8970900D86CDF /* CDVUserAgentUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVUserAgentUtil.h; path = Classes/CDVUserAgentUtil.h; sourceTree = "<group>"; };
EB96673A16A8970900D86CDF /* CDVUserAgentUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVUserAgentUtil.m; path = Classes/CDVUserAgentUtil.m; sourceTree = "<group>"; }; EB96673A16A8970900D86CDF /* CDVUserAgentUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVUserAgentUtil.m; path = Classes/CDVUserAgentUtil.m; sourceTree = "<group>"; };
EBA3557115ABD38C00F4DE24 /* NSArray+Comparisons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSArray+Comparisons.h"; path = "Classes/NSArray+Comparisons.h"; sourceTree = "<group>"; }; EBA3557115ABD38C00F4DE24 /* NSArray+Comparisons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSArray+Comparisons.h"; path = "Classes/NSArray+Comparisons.h"; sourceTree = "<group>"; };
...@@ -191,6 +198,8 @@ ...@@ -191,6 +198,8 @@
888700D710922F56009987E8 /* Commands */ = { 888700D710922F56009987E8 /* Commands */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
30E6B8CB1A8ADD900025B9EE /* CDVHandleOpenURL.h */,
30E6B8CC1A8ADD900025B9EE /* CDVHandleOpenURL.m */,
7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */, 7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */,
EBFF4DBA16D3FE2E008F452B /* CDVWebViewDelegate.m */, EBFF4DBA16D3FE2E008F452B /* CDVWebViewDelegate.m */,
EBFF4DBB16D3FE2E008F452B /* CDVWebViewDelegate.h */, EBFF4DBB16D3FE2E008F452B /* CDVWebViewDelegate.h */,
...@@ -215,6 +224,8 @@ ...@@ -215,6 +224,8 @@
3073E9EC1656D51200957977 /* CDVScreenOrientationDelegate.h */, 3073E9EC1656D51200957977 /* CDVScreenOrientationDelegate.h */,
30F39309169F839700B22307 /* CDVJSON.h */, 30F39309169F839700B22307 /* CDVJSON.h */,
30F3930A169F839700B22307 /* CDVJSON.m */, 30F3930A169F839700B22307 /* CDVJSON.m */,
EB6A98521A77EE470013FCDB /* CDVJSON_private.m */,
EB6A98531A77EE470013FCDB /* CDVJSON_private.h */,
EB96673916A8970900D86CDF /* CDVUserAgentUtil.h */, EB96673916A8970900D86CDF /* CDVUserAgentUtil.h */,
EB96673A16A8970900D86CDF /* CDVUserAgentUtil.m */, EB96673A16A8970900D86CDF /* CDVUserAgentUtil.m */,
); );
...@@ -263,6 +274,7 @@ ...@@ -263,6 +274,7 @@
8887FD8F1090FBE7009987E8 /* NSData+Base64.h in Headers */, 8887FD8F1090FBE7009987E8 /* NSData+Base64.h in Headers */,
1F92F4A01314023E0046367C /* CDVPluginResult.h in Headers */, 1F92F4A01314023E0046367C /* CDVPluginResult.h in Headers */,
30E33AF213A7E24B00594D64 /* CDVPlugin.h in Headers */, 30E33AF213A7E24B00594D64 /* CDVPlugin.h in Headers */,
30E6B8CD1A8ADD900025B9EE /* CDVHandleOpenURL.h in Headers */,
302965BC13A94E9D007046C5 /* CDVDebug.h in Headers */, 302965BC13A94E9D007046C5 /* CDVDebug.h in Headers */,
30E563CF13E217EC00C949AA /* NSMutableArray+QueueAdditions.h in Headers */, 30E563CF13E217EC00C949AA /* NSMutableArray+QueueAdditions.h in Headers */,
30C684801406CB38004C1A8E /* CDVWhitelist.h in Headers */, 30C684801406CB38004C1A8E /* CDVWhitelist.h in Headers */,
...@@ -354,10 +366,12 @@ ...@@ -354,10 +366,12 @@
3062D122151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */, 3062D122151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */,
EBA3557515ABD38C00F4DE24 /* NSArray+Comparisons.m in Sources */, EBA3557515ABD38C00F4DE24 /* NSArray+Comparisons.m in Sources */,
EB3B3548161CB44D003DBE7D /* CDVCommandQueue.m in Sources */, EB3B3548161CB44D003DBE7D /* CDVCommandQueue.m in Sources */,
EB6A98541A77EE470013FCDB /* CDVJSON_private.m in Sources */,
EB3B357D161F2A45003DBE7D /* CDVCommandDelegateImpl.m in Sources */, EB3B357D161F2A45003DBE7D /* CDVCommandDelegateImpl.m in Sources */,
F858FBC7166009A8007DA594 /* CDVConfigParser.m in Sources */, F858FBC7166009A8007DA594 /* CDVConfigParser.m in Sources */,
30F3930C169F839700B22307 /* CDVJSON.m in Sources */, 30F3930C169F839700B22307 /* CDVJSON.m in Sources */,
EB96673C16A8970A00D86CDF /* CDVUserAgentUtil.m in Sources */, EB96673C16A8970A00D86CDF /* CDVUserAgentUtil.m in Sources */,
30E6B8CE1A8ADD900025B9EE /* CDVHandleOpenURL.m in Sources */,
EBFF4DBC16D3FE2E008F452B /* CDVWebViewDelegate.m in Sources */, EBFF4DBC16D3FE2E008F452B /* CDVWebViewDelegate.m in Sources */,
7E14B5A91705050A0032169E /* CDVTimer.m in Sources */, 7E14B5A91705050A0032169E /* CDVTimer.m in Sources */,
); );
......
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D2AAC07D0554694100DB518D"
BuildableName = "libCordova.a"
BlueprintName = "CordovaLib"
ReferencedContainer = "container:CordovaLib.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D2AAC07D0554694100DB518D"
BuildableName = "libCordova.a"
BlueprintName = "CordovaLib"
ReferencedContainer = "container:CordovaLib.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D2AAC07D0554694100DB518D"
BuildableName = "libCordova.a"
BlueprintName = "CordovaLib"
ReferencedContainer = "container:CordovaLib.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>CordovaLib.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>D2AAC07D0554694100DB518D</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
// Platform: ios // Platform: ios
// 91157c2e1bf3eb098c7e2ab31404e895ccb0df2a // fc4db9145934bd0053161cbf9ffc0caf83b770c6
/* /*
Licensed to the Apache Software Foundation (ASF) under one Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file or more contributor license agreements. See the NOTICE file
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
under the License. under the License.
*/ */
;(function() { ;(function() {
var PLATFORM_VERSION_BUILD_LABEL = '3.7.0'; var PLATFORM_VERSION_BUILD_LABEL = '3.8.0';
// file: src/scripts/require.js // file: src/scripts/require.js
/*jshint -W079 */ /*jshint -W079 */
...@@ -284,10 +284,16 @@ var cordova = { ...@@ -284,10 +284,16 @@ var cordova = {
if (callback) { if (callback) {
if (isSuccess && status == cordova.callbackStatus.OK) { if (isSuccess && status == cordova.callbackStatus.OK) {
callback.success && callback.success.apply(null, args); callback.success && callback.success.apply(null, args);
} else { } else if (!isSuccess) {
callback.fail && callback.fail.apply(null, args); callback.fail && callback.fail.apply(null, args);
} }
/*
else
Note, this case is intentionally not caught.
this can happen if isSuccess is true, but callbackStatus is NO_RESULT
which is used to remove a callback from the list without calling the callbacks
typically keepCallback is false in this case
*/
// Clear callback if not expecting any more results // Clear callback if not expecting any more results
if (!keepCallback) { if (!keepCallback) {
delete cordova.callbacks[callbackId]; delete cordova.callbacks[callbackId];
...@@ -464,9 +470,14 @@ function each(objects, func, context) { ...@@ -464,9 +470,14 @@ function each(objects, func, context) {
function clobber(obj, key, value) { function clobber(obj, key, value) {
exports.replaceHookForTesting(obj, key); exports.replaceHookForTesting(obj, key);
var needsProperty = false;
try {
obj[key] = value; obj[key] = value;
} catch (e) {
needsProperty = true;
}
// Getters can only be overridden by getters. // Getters can only be overridden by getters.
if (obj[key] !== value) { if (needsProperty || obj[key] !== value) {
utils.defineGetter(obj, key, function() { utils.defineGetter(obj, key, function() {
return value; return value;
}); });
...@@ -581,7 +592,6 @@ var utils = require('cordova/utils'), ...@@ -581,7 +592,6 @@ var utils = require('cordova/utils'),
* onDeviceReady* User event fired to indicate that Cordova is ready * onDeviceReady* User event fired to indicate that Cordova is ready
* onResume User event fired to indicate a start/resume lifecycle event * onResume User event fired to indicate a start/resume lifecycle event
* onPause User event fired to indicate a pause lifecycle event * onPause User event fired to indicate a pause lifecycle event
* onDestroy* Internal event fired when app is being destroyed (User should use window.onunload event, not this one).
* *
* The events marked with an * are sticky. Once they have fired, they will stay in the fired state. * The events marked with an * are sticky. Once they have fired, they will stay in the fired state.
* All listeners that subscribe after the event is fired will be executed right away. * All listeners that subscribe after the event is fired will be executed right away.
...@@ -793,9 +803,6 @@ channel.create('onResume'); ...@@ -793,9 +803,6 @@ channel.create('onResume');
// Event to indicate a pause lifecycle event // Event to indicate a pause lifecycle event
channel.create('onPause'); channel.create('onPause');
// Event to indicate a destroy lifecycle event
channel.createSticky('onDestroy');
// Channels that must fire before "deviceready" is fired. // Channels that must fire before "deviceready" is fired.
channel.waitForInitialization('onCordovaReady'); channel.waitForInitialization('onCordovaReady');
channel.waitForInitialization('onDOMContentLoaded'); channel.waitForInitialization('onDOMContentLoaded');
...@@ -821,14 +828,14 @@ var cordova = require('cordova'), ...@@ -821,14 +828,14 @@ var cordova = require('cordova'),
// IFRAME_NAV is the fastest. // IFRAME_NAV is the fastest.
// IFRAME_HASH could be made to enable synchronous bridge calls if we wanted this feature. // IFRAME_HASH could be made to enable synchronous bridge calls if we wanted this feature.
jsToNativeModes = { jsToNativeModes = {
IFRAME_NAV: 0, IFRAME_NAV: 0, // Default. Uses a new iframe for each poke.
XHR_NO_PAYLOAD: 1, // XHR bridge appears to be flaky sometimes: CB-3900, CB-3359, CB-5457, CB-4970, CB-4998, CB-5134
XHR_WITH_PAYLOAD: 2, XHR_NO_PAYLOAD: 1, // About the same speed as IFRAME_NAV. Performance not about the same as IFRAME_NAV, but more variable.
XHR_OPTIONAL_PAYLOAD: 3, XHR_WITH_PAYLOAD: 2, // Flakey, and not as performant
IFRAME_HASH_NO_PAYLOAD: 4, XHR_OPTIONAL_PAYLOAD: 3, // Flakey, and not as performant
// Bundling the payload turns out to be slower. Probably since it has to be URI encoded / decoded. IFRAME_HASH_NO_PAYLOAD: 4, // Not fully baked. A bit faster than IFRAME_NAV, but risks jank since poke happens synchronously.
IFRAME_HASH_WITH_PAYLOAD: 5, IFRAME_HASH_WITH_PAYLOAD: 5, // Slower than no payload. Maybe since it has to be URI encoded / decoded.
WK_WEBVIEW_BINDING: 6 WK_WEBVIEW_BINDING: 6 // Only way that works for WKWebView :)
}, },
bridgeMode, bridgeMode,
execIframe, execIframe,
...@@ -838,26 +845,8 @@ var cordova = require('cordova'), ...@@ -838,26 +845,8 @@ var cordova = require('cordova'),
requestCount = 0, requestCount = 0,
vcHeaderValue = null, vcHeaderValue = null,
commandQueue = [], // Contains pending JS->Native messages. commandQueue = [], // Contains pending JS->Native messages.
isInContextOfEvalJs = 0; isInContextOfEvalJs = 0,
failSafeTimerId = 0;
function createExecIframe(src, unloadListener) {
var iframe = document.createElement("iframe");
iframe.style.display = 'none';
// Both the unload listener and the src must be set before adding the iframe
// to the document in order to avoid race conditions. Callbacks from native
// can happen within the appendChild() call!
iframe.onunload = unloadListener;
iframe.src = src;
document.body.appendChild(iframe);
return iframe;
}
function createHashIframe() {
var ret = createExecIframe('about:blank');
// Hash changes don't work on about:blank, so switch it to file:///.
ret.contentWindow.history.replaceState(null, null, 'file:///#');
return ret;
}
function shouldBundleCommandJson() { function shouldBundleCommandJson() {
if (bridgeMode === jsToNativeModes.XHR_WITH_PAYLOAD) { if (bridgeMode === jsToNativeModes.XHR_WITH_PAYLOAD) {
...@@ -990,6 +979,12 @@ function iOSExec() { ...@@ -990,6 +979,12 @@ function iOSExec() {
// Also, if there is already a command in the queue, then we've already // Also, if there is already a command in the queue, then we've already
// poked the native side, so there is no reason to do so again. // poked the native side, so there is no reason to do so again.
if (!isInContextOfEvalJs && commandQueue.length == 1) { if (!isInContextOfEvalJs && commandQueue.length == 1) {
pokeNative();
}
}
}
function pokeNative() {
switch (bridgeMode) { switch (bridgeMode) {
case jsToNativeModes.XHR_NO_PAYLOAD: case jsToNativeModes.XHR_NO_PAYLOAD:
case jsToNativeModes.XHR_WITH_PAYLOAD: case jsToNativeModes.XHR_WITH_PAYLOAD:
...@@ -999,8 +994,6 @@ function iOSExec() { ...@@ -999,8 +994,6 @@ function iOSExec() {
default: // iframe-based. default: // iframe-based.
pokeNativeViaIframe(); pokeNativeViaIframe();
} }
}
}
} }
function pokeNativeViaXhr() { function pokeNativeViaXhr() {
...@@ -1026,11 +1019,6 @@ function pokeNativeViaXhr() { ...@@ -1026,11 +1019,6 @@ function pokeNativeViaXhr() {
execXhr.send(null); execXhr.send(null);
} }
function onIframeUnload() {
execIframe = null;
setTimeout(pokeNativeViaIframe, 0);
}
function pokeNativeViaIframe() { function pokeNativeViaIframe() {
// CB-5488 - Don't attempt to create iframe before document.body is available. // CB-5488 - Don't attempt to create iframe before document.body is available.
if (!document.body) { if (!document.body) {
...@@ -1039,10 +1027,12 @@ function pokeNativeViaIframe() { ...@@ -1039,10 +1027,12 @@ function pokeNativeViaIframe() {
} }
if (bridgeMode === jsToNativeModes.IFRAME_HASH_NO_PAYLOAD || bridgeMode === jsToNativeModes.IFRAME_HASH_WITH_PAYLOAD) { if (bridgeMode === jsToNativeModes.IFRAME_HASH_NO_PAYLOAD || bridgeMode === jsToNativeModes.IFRAME_HASH_WITH_PAYLOAD) {
// TODO: This bridge mode doesn't properly support being removed from the DOM (CB-7735) // TODO: This bridge mode doesn't properly support being removed from the DOM (CB-7735)
execHashIframe = execHashIframe || createHashIframe(); if (!execHashIframe) {
// Check if they've removed it from the DOM, and put it back if so. execHashIframe = document.createElement('iframe');
if (!execHashIframe.contentWindow) { execHashIframe.style.display = 'none';
execHashIframe = createHashIframe(); document.body.appendChild(execHashIframe);
// Hash changes don't work on about:blank, so switch it to file:///.
execHashIframe.contentWindow.history.replaceState(null, null, 'file:///#');
} }
// The delegate method is called only when the hash changes, so toggle it back and forth. // The delegate method is called only when the hash changes, so toggle it back and forth.
hashToggle = hashToggle ^ 3; hashToggle = hashToggle ^ 3;
...@@ -1054,13 +1044,25 @@ function pokeNativeViaIframe() { ...@@ -1054,13 +1044,25 @@ function pokeNativeViaIframe() {
} else { } else {
// Check if they've removed it from the DOM, and put it back if so. // Check if they've removed it from the DOM, and put it back if so.
if (execIframe && execIframe.contentWindow) { if (execIframe && execIframe.contentWindow) {
// Listen for unload, since it can happen (CB-7735) that the iframe gets execIframe.contentWindow.location = 'gap://ready';
// removed from the DOM before it gets a chance to poke the native side.
execIframe.contentWindow.onunload = onIframeUnload;
execIframe.src = 'gap://ready';
} else { } else {
execIframe = createExecIframe('gap://ready', onIframeUnload); execIframe = document.createElement('iframe');
execIframe.style.display = 'none';
execIframe.src = 'gap://ready';
document.body.appendChild(execIframe);
} }
// Use a timer to protect against iframe being unloaded during the poke (CB-7735).
// This makes the bridge ~ 7% slower, but works around the poke getting lost
// when the iframe is removed from the DOM.
// An onunload listener could be used in the case where the iframe has just been
// created, but since unload events fire only once, it doesn't work in the normal
// case of iframe reuse (where unload will have already fired due to the attempted
// navigation of the page).
failSafeTimerId = setTimeout(function() {
if (commandQueue.length) {
pokeNative();
}
}, 50); // Making this > 0 improves performance (marginally) in the normal case (where it doesn't fire).
} }
} }
...@@ -1071,7 +1073,9 @@ iOSExec.setJsToNativeBridgeMode = function(mode) { ...@@ -1071,7 +1073,9 @@ iOSExec.setJsToNativeBridgeMode = function(mode) {
// can trigger browser bugs. // can trigger browser bugs.
// https://issues.apache.org/jira/browse/CB-593 // https://issues.apache.org/jira/browse/CB-593
if (execIframe) { if (execIframe) {
if (execIframe.parentNode) {
execIframe.parentNode.removeChild(execIframe); execIframe.parentNode.removeChild(execIframe);
}
execIframe = null; execIframe = null;
} }
bridgeMode = mode; bridgeMode = mode;
...@@ -1079,8 +1083,9 @@ iOSExec.setJsToNativeBridgeMode = function(mode) { ...@@ -1079,8 +1083,9 @@ iOSExec.setJsToNativeBridgeMode = function(mode) {
iOSExec.nativeFetchMessages = function() { iOSExec.nativeFetchMessages = function() {
// Stop listing for window detatch once native side confirms poke. // Stop listing for window detatch once native side confirms poke.
if (execIframe && execIframe.contentWindow) { if (failSafeTimerId) {
execIframe.contentWindow.onunload = null; clearTimeout(failSafeTimerId);
failSafeTimerId = 0;
} }
// Each entry in commandQueue is a JSON string already. // Each entry in commandQueue is a JSON string already.
if (!commandQueue.length) { if (!commandQueue.length) {
......
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:NotificationExample.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>69CA5DA9-3DCE-4A93-B59C-3B51466D951A</string>
<key>IDESourceControlProjectName</key>
<string>NotificationExample</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>E6A4395732CC1C6C7441E85472223F9AAF3A67CD</key>
<string>github.com:katzer/cordova-plugin-local-notifications.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>platforms/ios/NotificationExample.xcodeproj</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>E6A4395732CC1C6C7441E85472223F9AAF3A67CD</key>
<string>../../../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>github.com:katzer/cordova-plugin-local-notifications.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>111</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>E6A4395732CC1C6C7441E85472223F9AAF3A67CD</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>E6A4395732CC1C6C7441E85472223F9AAF3A67CD</string>
<key>IDESourceControlWCCName</key>
<string>cordova-example-local-notifications</string>
</dict>
</array>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "NotificationExample.app"
BlueprintName = "NotificationExample"
ReferencedContainer = "container:NotificationExample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "NotificationExample.app"
BlueprintName = "NotificationExample"
ReferencedContainer = "container:NotificationExample.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "NotificationExample.app"
BlueprintName = "NotificationExample"
ReferencedContainer = "container:NotificationExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1D6058900D05DD3D006BFB54"
BuildableName = "NotificationExample.app"
BlueprintName = "NotificationExample"
ReferencedContainer = "container:NotificationExample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>NotificationExample.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>1D6058900D05DD3D006BFB54</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
...@@ -99,8 +99,6 @@ ...@@ -99,8 +99,6 @@
return NO; return NO;
} }
[self.viewController processOpenUrl:url];
// all plugins will get the notification, and their handlers will be called // all plugins will get the notification, and their handlers will be called
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]]; [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
...@@ -115,9 +113,11 @@ ...@@ -115,9 +113,11 @@
[[NSNotificationCenter defaultCenter] postNotificationName:CDVLocalNotification object:notification]; [[NSNotificationCenter defaultCenter] postNotificationName:CDVLocalNotification object:notification];
} }
- (void) application:(UIApplication*)application #ifndef DISABLE_PUSH_NOTIFICATIONS
- (void) application:(UIApplication*)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{ {
// re-post ( broadcast ) // re-post ( broadcast )
NSString* token = [[[[deviceToken description] NSString* token = [[[[deviceToken description]
stringByReplacingOccurrencesOfString:@"<" withString:@""] stringByReplacingOccurrencesOfString:@"<" withString:@""]
...@@ -125,14 +125,15 @@ ...@@ -125,14 +125,15 @@
stringByReplacingOccurrencesOfString:@" " withString:@""]; stringByReplacingOccurrencesOfString:@" " withString:@""];
[[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotification object:token]; [[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotification object:token];
} }
- (void) application:(UIApplication*)application - (void) application:(UIApplication*)application
didFailToRegisterForRemoteNotificationsWithError:(NSError*)error didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{ {
// re-post ( broadcast ) // re-post ( broadcast )
[[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotificationError object:error]; [[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotificationError object:error];
} }
#endif
- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window - (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
{ {
......
...@@ -56,18 +56,25 @@ ...@@ -56,18 +56,25 @@
<string>${PRODUCT_NAME}</string> <string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.1</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>0.0.1</string> <string>0.0.1</string>
<key>CFBundleShortVersionString</key>
<string>0.0.1</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSMainNibFile</key> <key>NSMainNibFile</key>
<string></string> <string></string>
<key>NSMainNibFile~ipad</key> <key>NSMainNibFile~ipad</key>
<string></string> <string></string>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UILaunchImages</key> <key>UILaunchImages</key>
<array> <array>
<dict> <dict>
...@@ -171,16 +178,5 @@ ...@@ -171,16 +178,5 @@
<string>{768, 1024}</string> <string>{768, 1024}</string>
</dict> </dict>
</array> </array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict> </dict>
</plist> </plist>
\ No newline at end of file
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<widget id="de.appplant.cordova.plugin.local-notification.example" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <widget id="de.appplant.cordova.plugin.local-notification.example" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<preference name="AllowInlineMediaPlayback" value="false" /> <preference name="AllowInlineMediaPlayback" value="false" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="BackupWebStorage" value="cloud" /> <preference name="BackupWebStorage" value="cloud" />
<preference name="DisallowOverscroll" value="false" /> <preference name="DisallowOverscroll" value="false" />
<preference name="EnableViewportScale" value="false" /> <preference name="EnableViewportScale" value="false" />
<preference name="FadeSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value=".25" />
<preference name="KeyboardDisplayRequiresUserAction" value="true" /> <preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="false" /> <preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="ShowSplashScreenSpinner" value="true" />
<preference name="SuppressesIncrementalRendering" value="false" /> <preference name="SuppressesIncrementalRendering" value="false" />
<preference name="TopActivityIndicator" value="gray" />
<preference name="GapBetweenPages" value="0" /> <preference name="GapBetweenPages" value="0" />
<preference name="PageLength" value="0" /> <preference name="PageLength" value="0" />
<preference name="PaginationBreakingMode" value="page" /> <preference name="PaginationBreakingMode" value="page" />
...@@ -31,11 +26,11 @@ ...@@ -31,11 +26,11 @@
<feature name="Device"> <feature name="Device">
<param name="ios-package" value="CDVDevice" /> <param name="ios-package" value="CDVDevice" />
</feature> </feature>
<feature name="Toast">
<param name="ios-package" value="Toast" />
</feature>
<feature name="LocalNotification"> <feature name="LocalNotification">
<param name="ios-package" onload="true" value="APPLocalNotification" /> <param name="ios-package" onload="true" value="APPLocalNotification" />
<param name="onload" value="true" /> <param name="onload" value="true" />
</feature> </feature>
<feature name="Toast">
<param name="ios-package" value="Toast" />
</feature>
</widget> </widget>
#! /bin/sh #!/usr/bin/env node
# /*
# Licensed to the Apache Software Foundation (ASF) under one Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at 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
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# outputs the highest level of iOS sdk installed http://www.apache.org/licenses/LICENSE-2.0
iOS_X_VERSIONS=$(xcodebuild -showsdks | sed -e '/./{H;$!d;}' -e 'x;/iOS SDKs/!d;' | grep -o '[0-9]*\.[0-9]* ');
echo $iOS_X_VERSIONS | tr " " "\n" | sort -g | tail -1; Unless required by applicable law or agreed to in writing,
\ No newline at end of file software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var versions = require('./lib/versions.js');
versions.get_apple_ios_version().done(null, function(err) {
console.log(err);
process.exit(2);
});
#! /bin/sh #!/usr/bin/env node
# /*
# Licensed to the Apache Software Foundation (ASF) under one Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at 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
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# outputs the highest level of OS X sdk installed http://www.apache.org/licenses/LICENSE-2.0
OS_X_VERSIONS=$(xcodebuild -showsdks | sed -e '/./{H;$!d;}' -e 'x;/OS X SDKs/!d;' | grep -o '[0-9]*\.[0-9]* ');
echo $OS_X_VERSIONS | tr " " "\n" | sort -g | tail -1; Unless required by applicable law or agreed to in writing,
\ No newline at end of file software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var versions = require('./lib/versions.js');
versions.get_apple_osx_version().done(null, function(err) {
console.log(err);
process.exit(2);
});
#! /bin/sh #!/usr/bin/env node
# /*
# Licensed to the Apache Software Foundation (ASF) under one Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at 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
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# outputs which version of XCODE is installed http://www.apache.org/licenses/LICENSE-2.0
XCODEBUILD_VERSION=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //')
echo $XCODEBUILD_VERSION Unless required by applicable law or agreed to in writing,
\ No newline at end of file software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var versions = require('./lib/versions.js');
versions.get_apple_xcode_version().done(function (version) {
console.log(version);
}, function(err) {
console.error(err);
process.exit(2);
});
#!/bin/bash #!/usr/bin/env node
# /*
# Licensed to the Apache Software Foundation (ASF) under one Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the KIND, either express or implied. See the License for the
# specific language governing permissions and limitations specific language governing permissions and limitations
# under the License. under the License.
# */
# var build = require('./lib/build'),
# compile and launch a Cordova/iOS project to the simulator args = process.argv;
#
// Handle help flag
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(args[2]) > -1) {
PROJECT_PATH="$(dirname "$CORDOVA_PATH")" build.help();
XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj ) } else {
PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj) build.run(args).done(function() {
console.log('** BUILD SUCCEEDED **');
source "$CORDOVA_PATH/check_reqs" }, function(err) {
var errorMessage = (err && err.stack) ? err.stack : err;
cd "$PROJECT_PATH" console.error(errorMessage);
process.exit(2);
APP=build/$PROJECT_NAME.app });
}
CONFIGURATION=Debug \ No newline at end of file
EMULATOR=1
DEVICE=0
while [[ $# -gt 0 ]]; do
case "$1" in
--debug) ;;
--release) CONFIGURATION=Release;;
--device) EMULATOR=0;;
--emulator) ;;
*) echo "Unrecognized flag: $1"; exit 2;;
esac
shift
done
if (( $EMULATOR )); then
exec xcodebuild -project "$PROJECT_NAME.xcodeproj" -arch i386 -target "$PROJECT_NAME" -configuration $CONFIGURATION -sdk iphonesimulator build VALID_ARCHS="i386" CONFIGURATION_BUILD_DIR="$PROJECT_PATH/build/emulator" SHARED_PRECOMPS_DIR="$PROJECT_PATH/build/sharedpch"
else
exec xcodebuild -xcconfig "$CORDOVA_PATH/build$(echo -$CONFIGURATION | tr '[:upper:]' '[:lower:]').xcconfig" -project "$PROJECT_NAME.xcodeproj" ARCHS="armv7 armv7s arm64" -target "$PROJECT_NAME" -configuration $CONFIGURATION -sdk iphoneos build VALID_ARCHS="armv7 armv7s arm64" CONFIGURATION_BUILD_DIR="$PROJECT_PATH/build/device" SHARED_PRECOMPS_DIR="$PROJECT_PATH/build/sharedpch"
fi
...@@ -29,4 +29,4 @@ CODE_SIGN_IDENTITY = iPhone Developer ...@@ -29,4 +29,4 @@ CODE_SIGN_IDENTITY = iPhone Developer
CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer
// (CB-7872) Solution for XCode 6.1 signing errors related to resource envelope format deprecation // (CB-7872) Solution for XCode 6.1 signing errors related to resource envelope format deprecation
CODE_SIGN_RESOURCE_RULES_PATH = "$(SDKROOT)/ResourceRules.plist" CODE_SIGN_RESOURCE_RULES_PATH = $(SDKROOT)/ResourceRules.plist
\ No newline at end of file \ No newline at end of file
#! /bin/sh #!/usr/bin/env node
# /*
# Licensed to the Apache Software Foundation (ASF) under one Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at 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
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
XCODEBUILD_LOCATION=$(which xcodebuild) http://www.apache.org/licenses/LICENSE-2.0
if [ $? != 0 ]; then
echo "Xcode is (probably) not installed, specifically the command 'xcodebuild' is unavailable."
exit 2
fi
XCODEBUILD_MIN_VERSION="4.6" Unless required by applicable law or agreed to in writing,
XCODEBUILD_VERSION=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //') software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
if [[ "$XCODEBUILD_VERSION" < "$XCODEBUILD_MIN_VERSION" ]]; then var check_reqs = require('./lib/check_reqs');
echo "Cordova can only run in Xcode version $XCODEBUILD_MIN_VERSION or greater."
exit 2 // check for help flag
fi if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) > -1) {
check_reqs.help();
} else {
check_reqs.run().done(null, function (err) {
console.error('Failed to check requirements due to ' + err);
process.exit(2);
});
}
\ No newline at end of file
#!/bin/bash #!/usr/bin/env node
# /*
# Licensed to the Apache Software Foundation (ASF) under one Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the KIND, either express or implied. See the License for the
# specific language governing permissions and limitations specific language governing permissions and limitations
# under the License. under the License.
# */
# var clean = require('./lib/clean');
# Clean a Cordova/iOS project
# clean.run(process.argv).done(function () {
console.log('** CLEAN SUCCEEDED **');
set -e }, function(err) {
console.error(err);
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) process.exit(2);
PROJECT_PATH="$(dirname "$CORDOVA_PATH")" });
XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj ) \ No newline at end of file
PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
source "$CORDOVA_PATH/check_reqs"
cd "$PROJECT_PATH"
xcodebuild -project "$PROJECT_NAME.xcodeproj" -configuration Debug -alltargets clean
xcodebuild -project "$PROJECT_NAME.xcodeproj" -configuration Release -alltargets clean
rm -rf "build"
\ No newline at end of file
:: Licensed to the Apache Software Foundation (ASF) under one
:: or more contributor license agreements. See the NOTICE file
:: distributed with this work for additional information
:: regarding copyright ownership. The ASF licenses this file
:: 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
:: KIND, either express or implied. See the License for the
:: specific language governing permissions and limitations
:: under the License
@ECHO OFF
SET script_path="%~dp0clean"
IF EXIST %script_path% (
node %script_path% %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'clean' script in 'cordova' folder, aborting...>&2
EXIT /B 1
)
\ No newline at end of file
...@@ -23,17 +23,12 @@ ...@@ -23,17 +23,12 @@
<!-- Preferences for iOS --> <!-- Preferences for iOS -->
<preference name="AllowInlineMediaPlayback" value="false" /> <preference name="AllowInlineMediaPlayback" value="false" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="BackupWebStorage" value="cloud" /> <preference name="BackupWebStorage" value="cloud" />
<preference name="DisallowOverscroll" value="false" /> <preference name="DisallowOverscroll" value="false" />
<preference name="EnableViewportScale" value="false" /> <preference name="EnableViewportScale" value="false" />
<preference name="FadeSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value=".25" />
<preference name="KeyboardDisplayRequiresUserAction" value="true" /> <preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="false" /> <preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="ShowSplashScreenSpinner" value="true" />
<preference name="SuppressesIncrementalRendering" value="false" /> <preference name="SuppressesIncrementalRendering" value="false" />
<preference name="TopActivityIndicator" value="gray" />
<preference name="GapBetweenPages" value="0" /> <preference name="GapBetweenPages" value="0" />
<preference name="PageLength" value="0" /> <preference name="PageLength" value="0" />
<preference name="PaginationBreakingMode" value="page" /> <!-- page, column --> <preference name="PaginationBreakingMode" value="page" /> <!-- page, column -->
......
#! /bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# 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
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
SDK=`xcodebuild -showsdks | grep Sim | tail -1 | awk '{print $6}'`
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj )
PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
source "$CORDOVA_PATH/check_reqs"
APP_PATH=${1:-$PROJECT_PATH/build/emulator/$(xcodebuild -project "$PROJECT_PATH/$PROJECT_NAME.xcodeproj" -arch i386 -target "$PROJECT_NAME" -configuration Debug -sdk $SDK -showBuildSettings | grep FULL_PRODUCT_NAME | awk -F ' = ' '{print $2}')}
TARGET=${2:-${TARGET:-iPhone-6}}
IOS_SIM_MIN_VERSION="3.0"
IOS_SIM_LOCATION=$(which ios-sim)
if [ $? != 0 ]; then
echo -e "\033[31mError: ios-sim was not found. Please download, build and install version $IOS_SIM_MIN_VERSION or greater from https://github.com/phonegap/ios-sim into your path. Or 'npm install -g ios-sim' using node.js: http://nodejs.org/\033[m" 1>&2;
exit 1;
fi
IOS_SIM_VERSION=$(ios-sim --version)
if [[ "$IOS_SIM_VERSION" < "$IOS_SIM_MIN_VERSION" ]]; then
echo "Cordova needs ios-sim version $IOS_SIM_MIN_VERSION or greater, you have version $IOS_SIM_VERSION." 1>&2;
exit 1
fi
if [ ! -d "$APP_PATH" ]; then
echo "Project '$APP_PATH' is not built. Building."
"$CORDOVA_PATH/build" || exit $?
fi
if [ ! -d "$APP_PATH" ]; then
echo "$APP_PATH not found to emulate." 1>&2;
exit 1
fi
# launch using ios-sim
ios-sim launch "$APP_PATH" --devicetypeid "com.apple.CoreSimulator.SimDeviceType.$TARGET" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" --exit
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*jshint node: true*/
var Q = require('q'),
nopt = require('nopt'),
path = require('path'),
shell = require('shelljs'),
spawn = require('./spawn'),
check_reqs = require('./check_reqs');
var projectPath = path.join(__dirname, '..', '..');
module.exports.run = function (argv) {
var args = nopt({
// "archs": String, // TODO: add support for building different archs
'debug': Boolean,
'release': Boolean,
'device': Boolean,
'emulator': Boolean,
}, {'-r': '--release'}, argv);
if (args.debug && args.release) {
return Q.reject('Only one of "debug"/"release" options should be specified');
}
if (args.device && args.emulator) {
return Q.reject('Only one of "device"/"emulator" options should be specified');
}
return check_reqs.run().then(function () {
return findXCodeProjectIn(projectPath);
}).then(function (projectName) {
var configuration = args.release ? 'Release' : 'Debug';
console.log('Building project : ' + path.join(projectPath, projectName + '.xcodeproj'));
console.log('\tConfiguration : ' + configuration);
console.log('\tPlatform : ' + (args.device ? 'device' : 'emulator'));
var xcodebuildArgs = getXcodeArgs(projectName, projectPath, configuration, args.device);
return spawn('xcodebuild', xcodebuildArgs, projectPath);
});
};
/**
* Searches for first XCode project in specified folder
* @param {String} projectPath Path where to search project
* @return {Promise} Promise either fulfilled with project name or rejected
*/
function findXCodeProjectIn(projectPath) {
// 'Searching for Xcode project in ' + projectPath);
var xcodeProjFiles = shell.ls(projectPath).filter(function (name) {
return path.extname(name) === '.xcodeproj';
});
if (xcodeProjFiles.length === 0) {
return Q.reject('No Xcode project found in ' + projectPath);
}
if (xcodeProjFiles.length > 1) {
console.warn('Found multiple .xcodeproj directories in \n' +
projectPath + '\nUsing first one');
}
var projectName = path.basename(xcodeProjFiles[0], '.xcodeproj');
return Q.resolve(projectName);
}
module.exports.findXCodeProjectIn = findXCodeProjectIn;
/**
* Returns array of arguments for xcodebuild
* @param {String} projectName Name of xcode project
* @param {String} projectPath Path to project file. Will be used to set CWD for xcodebuild
* @param {String} configuration Configuration name: debug|release
* @param {Boolean} isDevice Flag that specify target for package (device/emulator)
* @return {Array} Array of arguments that could be passed directly to spawn method
*/
function getXcodeArgs(projectName, projectPath, configuration, isDevice) {
var xcodebuildArgs;
if (isDevice) {
xcodebuildArgs = [
'-xcconfig', path.join(__dirname, '..', 'build-' + configuration.toLowerCase() + '.xcconfig'),
'-project', projectName + '.xcodeproj',
'ARCHS=armv7 armv7s arm64',
'-target', projectName,
'-configuration', configuration,
'-sdk', 'iphoneos',
'build',
'VALID_ARCHS=armv7 armv7s arm64',
'CONFIGURATION_BUILD_DIR=' + path.join(projectPath, 'build', 'device'),
'SHARED_PRECOMPS_DIR=' + path.join(projectPath, 'build', 'sharedpch')
];
} else { // emulator
xcodebuildArgs = [
'-xcconfig', path.join(__dirname, '..', 'build-' + configuration.toLowerCase() + '.xcconfig'),
'-project', projectName + '.xcodeproj',
'ARCHS=i386',
'-target', projectName ,
'-configuration', configuration,
'-sdk', 'iphonesimulator',
'build',
'VALID_ARCHS=i386',
'CONFIGURATION_BUILD_DIR=' + path.join(projectPath, 'build', 'emulator'),
'SHARED_PRECOMPS_DIR=' + path.join(projectPath, 'build', 'sharedpch')
];
}
return xcodebuildArgs;
}
// help/usage function
module.exports.help = function help() {
console.log('');
console.log('Usage: build [ --debug | --release ] [--archs=\"<list of architectures...>\"] [--device | --simulator]');
console.log(' --help : Displays this dialog.');
console.log(' --debug : Builds project in debug mode. (Default)');
console.log(' --release : Builds project in release mode.');
console.log(' -r : Shortcut :: builds project in release mode.');
// TODO: add support for building different archs
// console.log(" --archs : Builds project binaries for specific chip architectures (`anycpu`, `arm`, `x86`, `x64`).");
console.log(' --device, --simulator');
console.log(' : Specifies, what type of project to build');
console.log('examples:');
console.log(' build ');
console.log(' build --debug');
console.log(' build --release');
// TODO: add support for building different archs
// console.log(" build --release --archs=\"armv7\"");
console.log('');
process.exit(0);
};
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
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
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
indent:4, unused:vars, latedef:nofunc,
sub:true, laxcomma:true, laxbreak:true
*/
var Q = require('Q'),
os = require('os'),
shell = require('shelljs'),
versions = require('./versions');
var XCODEBUILD_MIN_VERSION = '4.6.0';
var IOS_SIM_MIN_VERSION = '3.0.0';
var IOS_SIM_NOT_FOUND_MESSAGE = 'ios-sim was not found. Please download, build and install version ' + IOS_SIM_MIN_VERSION +
' or greater from https://github.com/phonegap/ios-sim into your path.' +
' Or \'npm install -g ios-sim\' using node.js: http://nodejs.org';
var IOS_DEPLOY_MIN_VERSION = '1.2.0';
var IOS_DEPLOY_NOT_FOUND_MESSAGE = 'ios-deploy was not found. Please download, build and install version ' + IOS_DEPLOY_MIN_VERSION +
' or greater from https://github.com/phonegap/ios-deploy into your path.' +
' Or \'npm install -g ios-deploy\' using node.js: http://nodejs.org';
/**
* Checks if xcode util is available
* @return {Promise} Returns a promise either resolved with xcode version or rejected
*/
module.exports.run = module.exports.check_xcodebuild = function () {
return checkTool('xcodebuild', XCODEBUILD_MIN_VERSION);
};
/**
* Checks if ios-deploy util is available
* @return {Promise} Returns a promise either resolved with ios-deploy version or rejected
*/
module.exports.check_ios_deploy = function () {
return checkTool('ios-deploy', IOS_DEPLOY_MIN_VERSION, IOS_DEPLOY_NOT_FOUND_MESSAGE);
};
/**
* Checks if ios-sim util is available
* @return {Promise} Returns a promise either resolved with ios-sim version or rejected
*/
module.exports.check_ios_sim = function () {
return checkTool('ios-sim', IOS_SIM_MIN_VERSION, IOS_SIM_NOT_FOUND_MESSAGE);
};
module.exports.help = function () {
console.log('Usage: check_reqs or node check_reqs');
};
/**
* Checks if specific tool is available.
* @param {String} tool Tool name to check. Known tools are 'xcodebuild', 'ios-sim' and 'ios-deploy'
* @param {Number} minVersion Min allowed tool version.
* @param {String} optMessage Message that will be used to reject promise.
* @return {Promise} Returns a promise either resolved with tool version or rejected
*/
function checkTool (tool, minVersion, optMessage) {
if (os.platform() !== 'darwin'){
// Build iOS apps available for OSX platform only, so we reject on others platforms
return Q.reject('Cordova tooling for iOS requires Apple OS X');
}
// Check whether tool command is available at all
var tool_command = shell.which(tool);
if (!tool_command) {
return Q.reject(optMessage || (tool + 'command is unavailable.'));
}
// check if tool version is greater than specified one
return versions.get_tool_version(tool).then(function (version) {
return versions.compareVersions(version, minVersion) >= 0 ?
Q.resolve(version) :
Q.reject('Cordova needs ' + tool + ' version ' + minVersion +
' or greater, you have version ' + version + '.');
});
}
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* 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
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*jshint node: true*/
var Q = require('q'),
path = require('path'),
shell = require('shelljs'),
spawn = require('./spawn'),
check_reqs = require('./check_reqs');
var projectPath = path.join(__dirname, '..', '..');
module.exports.run = function() {
var projectName = shell.ls(projectPath).filter(function (name) {
return path.extname(name) === '.xcodeproj';
})[0];
if (!projectName) {
return Q.reject('No Xcode project found in ' + projectPath);
}
return check_reqs.run().then(function() {
return spawn('xcodebuild', ['-project', projectName, '-configuration', 'Debug', '-alltargets', 'clean'], projectPath);
}).then(function () {
return spawn('xcodebuild', ['-project', projectName, '-configuration', 'Release', '-alltargets', 'clean'], projectPath);
}).then(function () {
return shell.rm('-rf', path.join(projectPath, 'build'));
});
};
#!/usr/bin/env bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# 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
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
LIB_PATH=$( cd "$( dirname "$0" )" && pwd -P)
CORDOVA_PATH="$(dirname "$LIB_PATH")"
PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj )
PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
DEVICE_APP_PATH="$PROJECT_PATH/build/device/$PROJECT_NAME.app"
source "$CORDOVA_PATH/check_reqs"
if [ ! -d "$DEVICE_APP_PATH" ]; then
echo "Project '$DEVIC_APP_PATH' is not built."
exit 1
fi
IOS_DEPLOY_MIN_VERSION="1.2.0"
IOS_DEPLOY_LOCATION=$(which ios-deploy)
if [ $? != 0 ]; then
echo -e "\033[31mError: ios-deploy was not found. Please download, build and install version $IOS_DEPLOY_MIN_VERSION or greater from https://github.com/phonegap/ios-deploy into your path. Or 'npm install -g ios-deploy' using node.js: http://nodejs.org/\033[m"; exit 1;
exit 1
fi
IOS_DEPLOY_VERSION=$(ios-deploy --version)
if [[ "$IOS_DEPLOY_VERSION" < "$IOS_DEPLOY_MIN_VERSION" ]]; then
echo "Cordova needs ios-deploy version $IOS_DEPLOY_MIN_VERSION or greater, you have version $IOS_DEPLOY_VERSION."
exit 1
fi
# if we got here, we can deploy the app, then exit success
ios-deploy -b "$DEVICE_APP_PATH"
exit 0
#!/usr/bin/env bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# 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
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
OPTION_RESULT=()
TARGET="iPhone-6"
# separates "key=value", sets an array with 0th index as key, 1st index as value
_parseOption()
{
local ARG=$@
OIFS=$IFS
IFS='='
OPTION_RESULT=()
for i in ${ARG[@]}
do
OPTION_RESULT+=($i)
done
IFS=$OIFS
}
# parses key=value arguments
_parseArgs()
{
for arg in "$@"
do
_parseOption ${arg}
case "${OPTION_RESULT[0]}" in
"--target")
TARGET=${OPTION_RESULT[1]}
;;
esac
done
}
_parseArgs "$@"
LIB_PATH=$( cd "$( dirname "$0" )" && pwd -P)
CORDOVA_PATH="$(dirname "$LIB_PATH")"
PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj )
PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
SIMULATOR_APP_PATH="$PROJECT_PATH/build/emulator/$PROJECT_NAME.app"
source "$CORDOVA_PATH/check_reqs"
if [ ! -d "$SIMULATOR_APP_PATH" ]; then
echo "Project '$SIMULATOR_APP_PATH' is not built."
exit 1
fi
if [ ! -d "$SIMULATOR_APP_PATH" ]; then
echo "$SIMULATOR_APP_PATH not found to emulate."
exit 1
fi
IOS_SIM_MIN_VERSION="3.0"
IOS_SIM_LOCATION=$(which ios-sim)
if [ $? != 0 ]; then
echo -e "\033[31mError: ios-sim was not found. Please download, build and install version $IOS_SIM_MIN_VERSION or greater from https://github.com/phonegap/ios-sim into your path. Or 'npm install -g ios-sim' using node.js: http://nodejs.org/\033[m"; exit 1;
exit 1
fi
IOS_SIM_VERSION=$(ios-sim --version)
if [[ "$IOS_SIM_VERSION" < "$IOS_SIM_MIN_VERSION" ]]; then
echo "Cordova needs ios-sim version $IOS_SIM_MIN_VERSION or greater, you have version $IOS_SIM_VERSION."
exit 1
fi
# launch using ios-sim
ios-sim launch "$SIMULATOR_APP_PATH" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" --devicetypeid "com.apple.CoreSimulator.SimDeviceType.$TARGET" --exit
#!/usr/bin/env bash #!/usr/bin/env node
#
# Licensed to the Apache Software Foundation (ASF) under one /*
# or more contributor license agreements. See the NOTICE file Licensed to the Apache Software Foundation (ASF) under one
# distributed with this work for additional information or more contributor license agreements. See the NOTICE file
# regarding copyright ownership. The ASF licenses this file distributed with this work for additional information
# to you under the Apache License, Version 2.0 (the regarding copyright ownership. The ASF licenses this file
# "License"); you may not use this file except in compliance to you under the Apache License, Version 2.0 (the
# with the License. You may obtain a copy of the License at "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
# 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 Unless required by applicable law or agreed to in writing,
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY software distributed under the License is distributed on an
# KIND, either express or implied. See the License for the "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# specific language governing permissions and limitations KIND, either express or implied. See the License for the
# under the License. specific language governing permissions and limitations
# under the License.
*/
system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2 " iPad"}'
system_profiler SPUSBDataType | sed -n -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2 " iPhone"}' /*jshint node: true*/
system_profiler SPUSBDataType | sed -n -e '/iPod/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2 " iPod"}'
var Q = require('Q'),
exec = require('child_process').exec;
/**
* Gets list of connected iOS devices
* @return {Promise} Promise fulfilled with list of available iOS devices
*/
function listDevices() {
var commands = [
Q.nfcall(exec, 'system_profiler SPUSBDataType | sed -n -e \'/iPad/,/Serial/p\' | grep "Serial Number:" | awk -F ": " \'{print $2 " iPad"}\''),
Q.nfcall(exec, 'system_profiler SPUSBDataType | sed -n -e \'/iPhone/,/Serial/p\' | grep "Serial Number:" | awk -F ": " \'{print $2 " iPhone"}\''),
Q.nfcall(exec, 'system_profiler SPUSBDataType | sed -n -e \'/iPod/,/Serial/p\' | grep "Serial Number:" | awk -F ": " \'{print $2 " iPod"}\'')
];
// wrap al lexec calls into promises and wait until they're fullfilled
return Q.all(commands).then(function (promises) {
var accumulator = [];
promises.forEach(function (promise) {
if (promise.state === 'fulfilled') {
// Each command promise resolves with array [stout, stderr], and we need stdout only
// Append stdout lines to accumulator
accumulator.concat(promise.value[0].trim().split('\n'));
}
});
return accumulator;
});
}
exports.run = listDevices;
// Check if module is started as separate script.
// If so, then invoke main method and print out results.
if (!module.parent) {
listDevices().then(function (devices) {
devices.forEach(function (device) {
console.log(device);
});
});
}
#!/usr/bin/env bash #!/usr/bin/env node
#
# Licensed to the Apache Software Foundation (ASF) under one /*
# or more contributor license agreements. See the NOTICE file Licensed to the Apache Software Foundation (ASF) under one
# distributed with this work for additional information or more contributor license agreements. See the NOTICE file
# regarding copyright ownership. The ASF licenses this file distributed with this work for additional information
# to you under the Apache License, Version 2.0 (the regarding copyright ownership. The ASF licenses this file
# "License"); you may not use this file except in compliance to you under the Apache License, Version 2.0 (the
# with the License. You may obtain a copy of the License at "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
# 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 Unless required by applicable law or agreed to in writing,
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY software distributed under the License is distributed on an
# KIND, either express or implied. See the License for the "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# specific language governing permissions and limitations KIND, either express or implied. See the License for the
# under the License. specific language governing permissions and limitations
under the License.
set -e */
IOS_SIM_MIN_VERSION="3.0" /*jshint node: true*/
IOS_SIM_LOCATION=$(which ios-sim)
if [ $? != 0 ]; then var Q = require('q'),
echo -e "\033[31mError: ios-sim was not found. Please download, build and install version $IOS_SIM_MIN_VERSION or greater from https://github.com/phonegap/ios-sim into your path. Or 'npm install -g ios-sim' using node.js: http://nodejs.org/\033[m" 1>&2; exec = require('child_process').exec,
exit 1; check_reqs = require('./check_reqs');
fi
/**
IOS_SIM_VERSION=$(ios-sim --version) * Gets list of iOS devices available for simulation
* @return {Promise} Promise fulfilled with list of devices available for simulation
if [[ "$IOS_SIM_VERSION" < "$IOS_SIM_MIN_VERSION" ]]; then */
echo "Cordova needs ios-sim version $IOS_SIM_MIN_VERSION or greater, you have version $IOS_SIM_VERSION." 1>&2; function listEmulatorImages () {
exit 1 return check_reqs.check_ios_sim().then(function () {
fi return Q.nfcall(exec, 'ios-sim showdevicetypes 2>&1 | ' +
'sed "s/com.apple.CoreSimulator.SimDeviceType.//g" | ' +
ios-sim showdevicetypes 2>&1 | sed "s/com.apple.CoreSimulator.SimDeviceType.//g" | awk -F',' '{print $1}' 'awk -F\',\' \'{print $1}\'');
}).then(function (stdio) {
// Exec promise resolves with array [stout, stderr], and we need stdout only
return stdio[0].trim().split('\n');
});
}
exports.run = listEmulatorImages;
// Check if module is started as separate script.
// If so, then invoke main method and print out results.
if (!module.parent) {
listEmulatorImages().then(function (names) {
names.forEach(function (name) {
console.log(name);
});
});
}
#!/usr/bin/env bash #!/usr/bin/env node
#
# Licensed to the Apache Software Foundation (ASF) under one /*
# or more contributor license agreements. See the NOTICE file Licensed to the Apache Software Foundation (ASF) under one
# distributed with this work for additional information or more contributor license agreements. See the NOTICE file
# regarding copyright ownership. The ASF licenses this file distributed with this work for additional information
# to you under the Apache License, Version 2.0 (the regarding copyright ownership. The ASF licenses this file
# "License"); you may not use this file except in compliance to you under the Apache License, Version 2.0 (the
# with the License. You may obtain a copy of the License at "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
# 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 Unless required by applicable law or agreed to in writing,
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY software distributed under the License is distributed on an
# KIND, either express or implied. See the License for the "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# specific language governing permissions and limitations KIND, either express or implied. See the License for the
# under the License. specific language governing permissions and limitations
# under the License.
*/
set -e
/*jshint node: true*/
SIM_RUNNING=$(ps aux | grep -i "[i]OS Simulator" | wc -l)
if [ $SIM_RUNNING == 0 ]; then var Q = require('q'),
echo "No emulators are running." exec = require('child_process').exec;
exit 1
fi /**
* Gets list of running iOS simulators
SIM_ID=`defaults read com.apple.iphonesimulator "SimulateDevice"` * @return {Promise} Promise fulfilled with list of running iOS simulators
echo \"$SIM_ID\" */
function listStartedEmulators () {
// wrap exec call into promise
return Q.nfcall(exec, 'ps aux | grep -i "[i]OS Simulator"')
.then(function () {
return Q.nfcall(exec, 'defaults read com.apple.iphonesimulator "SimulateDevice"');
}).then(function (stdio) {
return stdio[0].trim().split('\n');
});
}
exports.run = listStartedEmulators;
// Check if module is started as separate script.
// If so, then invoke main method and print out results.
if (!module.parent) {
listStartedEmulators().then(function (emulators) {
emulators.forEach(function (emulator) {
console.log(emulator);
});
});
}
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
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
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
/*jshint node: true*/
var Q = require('q'),
nopt = require('nopt'),
path = require('path'),
build = require('./build'),
spawn = require('./spawn'),
check_reqs = require('./check_reqs');
var cordovaPath = path.join(__dirname, '..');
var projectPath = path.join(__dirname, '..', '..');
module.exports.run = function (argv) {
// parse args here
// --debug and --release args not parsed here
// but still valid since they can be passed down to build command
var args = nopt({
// "archs": String, // TODO: add support for building different archs
'list': Boolean,
'nobuild': Boolean,
'device': Boolean, 'emulator': Boolean, 'target': String
}, {}, argv);
// Validate args
if (args.device && args.emulator) {
return Q.reject('Only one of "device"/"emulator" options should be specified');
}
// validate target device for ios-sim
// Valid values for "--target" (case sensitive):
var validTargets = ['iPhone-4s', 'iPhone-5', 'iPhone-5s', 'iPhone-6-Plus', 'iPhone-6',
'iPad-2', 'iPad-Retina', 'iPad-Air', 'Resizable-iPhone', 'Resizable-iPad'];
if (args.target && validTargets.indexOf(args.target) < 0 ) {
return Q.reject(args.target + ' is not a valid target for emulator');
}
// support for CB-8168 `cordova/run --list`
if (args.list) {
if (args.device) return listDevices();
if (args.emulator) return listEmulators();
// if no --device or --emulator flag is specified, list both devices and emulators
return listDevices().then(function () {
return listEmulators();
});
}
// check for either ios-sim or ios-deploy is available
// depending on arguments provided
var checkTools = args.device ? check_reqs.check_ios_deploy() : check_reqs.check_ios_sim();
return checkTools.then(function () {
// if --nobuild isn't specified then build app first
if (!args.nobuild) {
return build.run(argv);
}
}).then(function () {
return build.findXCodeProjectIn(projectPath);
}).then(function (projectName) {
var appPath = path.join(projectPath, 'build', (args.device ? 'device' : 'emulator'), projectName + '.app');
// select command to run and arguments depending whether
// we're running on device/emulator
if (args.device) {
return checkDeviceConnected().then(function () {
return deployToDevice(appPath);
}, function () {
// if device connection check failed use emulator then
return deployToSim(appPath, args.target);
});
} else {
return deployToSim(appPath, args.target);
}
});
};
/**
* Checks if any iOS device is connected
* @return {Promise} Fullfilled when any device is connected, rejected otherwise
*/
function checkDeviceConnected() {
return spawn('ios-deploy', ['-c']);
}
/**
* Deploy specified app package to connected device
* using ios-deploy command
* @param {String} appPath Path to application package
* @return {Promise} Resolves when deploy succeeds otherwise rejects
*/
function deployToDevice(appPath) {
// Deploying to device...
return spawn('ios-deploy', ['-d', '-b', appPath]);
}
/**
* Deploy specified app package to ios-sim simulator
* @param {String} appPath Path to application package
* @param {String} target Target device type
* @return {Promise} Resolves when deploy succeeds otherwise rejects
*/
function deployToSim(appPath, target) {
// Select target device for emulator. Default is 'iPhone-6'
if (!target) {
target = 'iPhone-6';
console.log('No target specified for emulator. Deploying to ' + target + ' simulator');
}
var logPath = path.join(cordovaPath, 'console.log');
var simArgs = ['launch', appPath,
'--devicetypeid', 'com.apple.CoreSimulator.SimDeviceType.' + target,
// We need to redirect simulator output here to use cordova/log command
// TODO: Is there any other way to get emulator's output to use in log command?
'--stderr', logPath, '--stdout', logPath,
'--exit'];
return spawn('ios-sim', simArgs);
}
function listDevices() {
return require('./list-devices').run()
.then(function (devices) {
console.log('Available iOS Devices:');
devices.forEach(function (device) {
console.log('\t' + device);
});
});
}
function listEmulators() {
return require('./list-emulator-images').run()
.then(function (emulators) {
console.log('Available iOS Virtual Devices:');
emulators.forEach(function (emulator) {
console.log('\t' + emulator);
});
});
}
module.exports.help = function () {
console.log('\nUsage: run [ --device | [ --emulator [ --target=<id> ] ] ] [ --debug | --release | --nobuild ]');
// TODO: add support for building different archs
// console.log(" [ --archs=\"<list of target architectures>\" ] ");
console.log(' --device : Deploys and runs the project on the connected device.');
console.log(' --emulator : Deploys and runs the project on an emulator.');
console.log(' --target=<id> : Deploys and runs the project on the specified target.');
console.log(' --debug : Builds project in debug mode. (Passed down to build command, if necessary)');
console.log(' --release : Builds project in release mode. (Passed down to build command, if necessary)');
console.log(' --nobuild : Uses pre-built package, or errors if project is not built.');
// TODO: add support for building different archs
// console.log(" --archs : Specific chip architectures (`anycpu`, `arm`, `x86`, `x64`).");
console.log('');
console.log('Examples:');
console.log(' run');
console.log(' run --device');
console.log(' run --emulator --target=\"iPhone-6-Plus\"');
console.log(' run --device --release');
console.log(' run --emulator --debug');
console.log('');
process.exit(0);
};
\ No newline at end of file
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
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
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
/*jshint node: true*/
var Q = require('q'),
proc = require('child_process');
/**
* Run specified command with arguments
* @param {String} cmd Command
* @param {Array} args Array of arguments that should be passed to command
* @param {String} opt_cwd Working directory for command
* @param {String} opt_verbosity Verbosity level for command stdout output, "verbose" by default
* @return {Promise} Promise either fullfilled or rejected with error code
*/
module.exports = function(cmd, args, opt_cwd) {
var d = Q.defer();
try {
var child = proc.spawn(cmd, args, {cwd: opt_cwd, stdio: 'inherit'});
child.on('exit', function(code) {
if (code) {
d.reject('Error code ' + code + ' for command: ' + cmd + ' with args: ' + args);
} else {
d.resolve();
}
});
} catch(e) {
console.error('error caught: ' + e);
d.reject(e);
}
return d.promise;
};
#!/usr/bin/env node
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
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
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var child_process = require('child_process'),
Q = require('q');
exports.get_apple_ios_version = function() {
var d = Q.defer();
child_process.exec('xcodebuild -showsdks', function(error, stdout, stderr) {
if (error) {
d.reject(stderr);
}
else {
d.resolve(stdout);
}
});
return d.promise.then(function(output) {
var regex = /[0-9]*\.[0-9]*/,
versions = [],
regexIOS = /^iOS \d+/;
output = output.split('\n');
for (var i = 0; i < output.length; i++) {
if (output[i].trim().match(regexIOS)) {
versions[versions.length] = parseFloat(output[i].match(regex)[0]);
}
}
versions.sort();
console.log(versions[0]);
return Q();
}, function(stderr) {
return Q.reject(stderr);
});
};
exports.get_apple_osx_version = function() {
var d = Q.defer();
child_process.exec('xcodebuild -showsdks', function(error, stdout, stderr) {
if (error) {
d.reject(stderr);
}
else {
d.resolve(stdout);
}
});
return d.promise.then(function(output) {
var regex = /[0-9]*\.[0-9]*/,
versions = [],
regexOSX = /^OS X \d+/;
output = output.split('\n');
for (var i = 0; i < output.length; i++) {
if (output[i].trim().match(regexOSX)) {
versions[versions.length] = parseFloat(output[i].match(regex)[0]);
}
}
versions.sort();
console.log(versions[0]);
return Q();
}, function(stderr) {
return Q.reject(stderr);
});
};
exports.get_apple_xcode_version = function() {
var d = Q.defer();
child_process.exec('xcodebuild -version', function(error, stdout, stderr) {
var versionMatch = /Xcode (.*)/.exec(stdout);
if (error || !versionMatch) {
d.reject(stderr);
} else {
d.resolve(versionMatch[1]);
}
});
return d.promise;
};
/**
* Gets ios-deploy util version
* @return {Promise} Promise that either resolved with ios-deploy version
* or rejected in case of error
*/
exports.get_ios_deploy_version = function() {
var d = Q.defer();
child_process.exec('ios-deploy --version', function(error, stdout, stderr) {
if (error) {
d.reject(stderr);
} else {
d.resolve(stdout);
}
});
return d.promise;
};
/**
* Gets ios-sim util version
* @return {Promise} Promise that either resolved with ios-sim version
* or rejected in case of error
*/
exports.get_ios_sim_version = function() {
var d = Q.defer();
child_process.exec('ios-sim --version', function(error, stdout, stderr) {
if (error) {
d.reject(stderr);
} else {
d.resolve(stdout);
}
});
return d.promise;
};
/**
* Gets specific tool version
* @param {String} toolName Tool name to check. Known tools are 'xcodebuild', 'ios-sim' and 'ios-deploy'
* @return {Promise} Promise that either resolved with tool version
* or rejected in case of error
*/
exports.get_tool_version = function (toolName) {
switch (toolName) {
case 'xcodebuild': return exports.get_apple_xcode_version();
case 'ios-sim': return exports.get_ios_sim_version();
case 'ios-deploy': return exports.get_ios_deploy_version();
default: return Q.reject(toolName + ' is not valid tool name. Valid names are: \'xcodebuild\', \'ios-sim\' and \'ios-deploy\'');
}
};
/**
* Compares two semver-notated version strings. Returns number
* that indicates equality of provided version strings.
* @param {String} version1 Version to compare
* @param {String} version2 Another version to compare
* @return {Number} Negative number if first version is lower than the second,
* positive otherwise and 0 if versions are equal.
*/
exports.compareVersions = function (version1, version2) {
function parseVer (version) {
return version.split('.').map(function (value) {
// try to convert version segment to Number
var parsed = Number(value);
// Number constructor is strict enough and will return NaN
// if conversion fails. In this case we won't be able to compare versions properly
if (isNaN(parsed)) {
throw 'Version should contain only numbers and dots';
}
return parsed;
});
}
var parsedVer1 = parseVer(version1);
var parsedVer2 = parseVer(version2);
// Compare corresponding segments of each version
for (var i = 0; i < Math.max(parsedVer1.length, parsedVer2.length); i++) {
// if segment is not specified, assume that it is 0
// E.g. 3.1 is equal to 3.1.0
var ret = (parsedVer1[i] || 0) - (parsedVer2[i] || 0);
// if segments are not equal, we're finished
if (ret !== 0) return ret;
}
return 0;
};
Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
All rights reserved.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
All rights reserved.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
module.exports = exports = abbrev.abbrev = abbrev
abbrev.monkeyPatch = monkeyPatch
function monkeyPatch () {
Object.defineProperty(Array.prototype, 'abbrev', {
value: function () { return abbrev(this) },
enumerable: false, configurable: true, writable: true
})
Object.defineProperty(Object.prototype, 'abbrev', {
value: function () { return abbrev(Object.keys(this)) },
enumerable: false, configurable: true, writable: true
})
}
function abbrev (list) {
if (arguments.length !== 1 || !Array.isArray(list)) {
list = Array.prototype.slice.call(arguments, 0)
}
for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
}
// sort them lexicographically, so that they're next to their nearest kin
args = args.sort(lexSort)
// walk through each, seeing how much it has in common with the next and previous
var abbrevs = {}
, prev = ""
for (var i = 0, l = args.length ; i < l ; i ++) {
var current = args[i]
, next = args[i + 1] || ""
, nextMatches = true
, prevMatches = true
if (current === next) continue
for (var j = 0, cl = current.length ; j < cl ; j ++) {
var curChar = current.charAt(j)
nextMatches = nextMatches && curChar === next.charAt(j)
prevMatches = prevMatches && curChar === prev.charAt(j)
if (!nextMatches && !prevMatches) {
j ++
break
}
}
prev = current
if (j === cl) {
abbrevs[current] = current
continue
}
for (var a = current.substr(0, j) ; j <= cl ; j ++) {
abbrevs[a] = current
a += current.charAt(j)
}
}
return abbrevs
}
function lexSort (a, b) {
return a === b ? 0 : a > b ? 1 : -1
}
{
"name": "abbrev",
"version": "1.0.5",
"description": "Like ruby's abbrev module, but in js",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me"
},
"main": "abbrev.js",
"scripts": {
"test": "node test.js"
},
"repository": {
"type": "git",
"url": "http://github.com/isaacs/abbrev-js"
},
"license": {
"type": "MIT",
"url": "https://github.com/isaacs/abbrev-js/raw/master/LICENSE"
},
"readme": "# abbrev-js\n\nJust like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).\n\nUsage:\n\n var abbrev = require(\"abbrev\");\n abbrev(\"foo\", \"fool\", \"folding\", \"flop\");\n \n // returns:\n { fl: 'flop'\n , flo: 'flop'\n , flop: 'flop'\n , fol: 'folding'\n , fold: 'folding'\n , foldi: 'folding'\n , foldin: 'folding'\n , folding: 'folding'\n , foo: 'foo'\n , fool: 'fool'\n }\n\nThis is handy for command-line scripts, or other cases where you want to be able to accept shorthands.\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/isaacs/abbrev-js/issues"
},
"homepage": "https://github.com/isaacs/abbrev-js",
"_id": "abbrev@1.0.5",
"_shasum": "5d8257bd9ebe435e698b2fa431afde4fe7b10b03",
"_from": "abbrev@1",
"_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.5.tgz"
}
{
"name": "nopt",
"version": "3.0.1",
"description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"main": "lib/nopt.js",
"scripts": {
"test": "tap test/*.js"
},
"repository": {
"type": "git",
"url": "http://github.com/isaacs/nopt"
},
"bin": {
"nopt": "./bin/nopt.js"
},
"license": {
"type": "MIT",
"url": "https://github.com/isaacs/nopt/raw/master/LICENSE"
},
"dependencies": {
"abbrev": "1"
},
"devDependencies": {
"tap": "~0.4.8"
},
"readme": "If you want to write an option parser, and have it be good, there are\ntwo ways to do it. The Right Way, and the Wrong Way.\n\nThe Wrong Way is to sit down and write an option parser. We've all done\nthat.\n\nThe Right Way is to write some complex configurable program with so many\noptions that you go half-insane just trying to manage them all, and put\nit off with duct-tape solutions until you see exactly to the core of the\nproblem, and finally snap and write an awesome option parser.\n\nIf you want to write an option parser, don't write an option parser.\nWrite a package manager, or a source control system, or a service\nrestarter, or an operating system. You probably won't end up with a\ngood one of those, but if you don't give up, and you are relentless and\ndiligent enough in your procrastination, you may just end up with a very\nnice option parser.\n\n## USAGE\n\n // my-program.js\n var nopt = require(\"nopt\")\n , Stream = require(\"stream\").Stream\n , path = require(\"path\")\n , knownOpts = { \"foo\" : [String, null]\n , \"bar\" : [Stream, Number]\n , \"baz\" : path\n , \"bloo\" : [ \"big\", \"medium\", \"small\" ]\n , \"flag\" : Boolean\n , \"pick\" : Boolean\n , \"many\" : [String, Array]\n }\n , shortHands = { \"foofoo\" : [\"--foo\", \"Mr. Foo\"]\n , \"b7\" : [\"--bar\", \"7\"]\n , \"m\" : [\"--bloo\", \"medium\"]\n , \"p\" : [\"--pick\"]\n , \"f\" : [\"--flag\"]\n }\n // everything is optional.\n // knownOpts and shorthands default to {}\n // arg list defaults to process.argv\n // slice defaults to 2\n , parsed = nopt(knownOpts, shortHands, process.argv, 2)\n console.log(parsed)\n\nThis would give you support for any of the following:\n\n```bash\n$ node my-program.js --foo \"blerp\" --no-flag\n{ \"foo\" : \"blerp\", \"flag\" : false }\n\n$ node my-program.js ---bar 7 --foo \"Mr. Hand\" --flag\n{ bar: 7, foo: \"Mr. Hand\", flag: true }\n\n$ node my-program.js --foo \"blerp\" -f -----p\n{ foo: \"blerp\", flag: true, pick: true }\n\n$ node my-program.js -fp --foofoo\n{ foo: \"Mr. Foo\", flag: true, pick: true }\n\n$ node my-program.js --foofoo -- -fp # -- stops the flag parsing.\n{ foo: \"Mr. Foo\", argv: { remain: [\"-fp\"] } }\n\n$ node my-program.js --blatzk -fp # unknown opts are ok.\n{ blatzk: true, flag: true, pick: true }\n\n$ node my-program.js --blatzk=1000 -fp # but you need to use = if they have a value\n{ blatzk: 1000, flag: true, pick: true }\n\n$ node my-program.js --no-blatzk -fp # unless they start with \"no-\"\n{ blatzk: false, flag: true, pick: true }\n\n$ node my-program.js --baz b/a/z # known paths are resolved.\n{ baz: \"/Users/isaacs/b/a/z\" }\n\n# if Array is one of the types, then it can take many\n# values, and will always be an array. The other types provided\n# specify what types are allowed in the list.\n\n$ node my-program.js --many 1 --many null --many foo\n{ many: [\"1\", \"null\", \"foo\"] }\n\n$ node my-program.js --many foo\n{ many: [\"foo\"] }\n```\n\nRead the tests at the bottom of `lib/nopt.js` for more examples of\nwhat this puppy can do.\n\n## Types\n\nThe following types are supported, and defined on `nopt.typeDefs`\n\n* String: A normal string. No parsing is done.\n* path: A file system path. Gets resolved against cwd if not absolute.\n* url: A url. If it doesn't parse, it isn't accepted.\n* Number: Must be numeric.\n* Date: Must parse as a date. If it does, and `Date` is one of the options,\n then it will return a Date object, not a string.\n* Boolean: Must be either `true` or `false`. If an option is a boolean,\n then it does not need a value, and its presence will imply `true` as\n the value. To negate boolean flags, do `--no-whatever` or `--whatever\n false`\n* NaN: Means that the option is strictly not allowed. Any value will\n fail.\n* Stream: An object matching the \"Stream\" class in node. Valuable\n for use when validating programmatically. (npm uses this to let you\n supply any WriteStream on the `outfd` and `logfd` config options.)\n* Array: If `Array` is specified as one of the types, then the value\n will be parsed as a list of options. This means that multiple values\n can be specified, and that the value will always be an array.\n\nIf a type is an array of values not on this list, then those are\nconsidered valid values. For instance, in the example above, the\n`--bloo` option can only be one of `\"big\"`, `\"medium\"`, or `\"small\"`,\nand any other value will be rejected.\n\nWhen parsing unknown fields, `\"true\"`, `\"false\"`, and `\"null\"` will be\ninterpreted as their JavaScript equivalents.\n\nYou can also mix types and values, or multiple types, in a list. For\ninstance `{ blah: [Number, null] }` would allow a value to be set to\neither a Number or null. When types are ordered, this implies a\npreference, and the first type that can be used to properly interpret\nthe value will be used.\n\nTo define a new type, add it to `nopt.typeDefs`. Each item in that\nhash is an object with a `type` member and a `validate` method. The\n`type` member is an object that matches what goes in the type list. The\n`validate` method is a function that gets called with `validate(data,\nkey, val)`. Validate methods should assign `data[key]` to the valid\nvalue of `val` if it can be handled properly, or return boolean\n`false` if it cannot.\n\nYou can also call `nopt.clean(data, types, typeDefs)` to clean up a\nconfig object and remove its invalid properties.\n\n## Error Handling\n\nBy default, nopt outputs a warning to standard error when invalid\noptions are found. You can change this behavior by assigning a method\nto `nopt.invalidHandler`. This method will be called with\nthe offending `nopt.invalidHandler(key, val, types)`.\n\nIf no `nopt.invalidHandler` is assigned, then it will console.error\nits whining. If it is assigned to boolean `false` then the warning is\nsuppressed.\n\n## Abbreviations\n\nYes, they are supported. If you define options like this:\n\n```javascript\n{ \"foolhardyelephants\" : Boolean\n, \"pileofmonkeys\" : Boolean }\n```\n\nThen this will work:\n\n```bash\nnode program.js --foolhar --pil\nnode program.js --no-f --pileofmon\n# etc.\n```\n\n## Shorthands\n\nShorthands are a hash of shorter option names to a snippet of args that\nthey expand to.\n\nIf multiple one-character shorthands are all combined, and the\ncombination does not unambiguously match any other option or shorthand,\nthen they will be broken up into their constituent parts. For example:\n\n```json\n{ \"s\" : [\"--loglevel\", \"silent\"]\n, \"g\" : \"--global\"\n, \"f\" : \"--force\"\n, \"p\" : \"--parseable\"\n, \"l\" : \"--long\"\n}\n```\n\n```bash\nnpm ls -sgflp\n# just like doing this:\nnpm ls --loglevel silent --global --force --long --parseable\n```\n\n## The Rest of the args\n\nThe config object returned by nopt is given a special member called\n`argv`, which is an object with the following fields:\n\n* `remain`: The remaining args after all the parsing has occurred.\n* `original`: The args as they originally appeared.\n* `cooked`: The args after flags and shorthands are expanded.\n\n## Slicing\n\nNode programs are called with more or less the exact argv as it appears\nin C land, after the v8 and node-specific options have been plucked off.\nAs such, `argv[0]` is always `node` and `argv[1]` is always the\nJavaScript program being run.\n\nThat's usually not very useful to you. So they're sliced off by\ndefault. If you want them, then you can pass in `0` as the last\nargument, or any other number that you'd like to slice off the start of\nthe list.\n",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/isaacs/nopt/issues"
},
"homepage": "https://github.com/isaacs/nopt",
"_id": "nopt@3.0.1",
"_shasum": "bce5c42446a3291f47622a370abbf158fbbacbfd",
"_from": "nopt@",
"_resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.1.tgz"
}
Copyright 2009–2014 Kristopher Michael Kowal. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
{
"name": "q",
"version": "1.0.1",
"description": "A library for promises (CommonJS/Promises/A,B,D)",
"homepage": "https://github.com/kriskowal/q",
"author": {
"name": "Kris Kowal",
"email": "kris@cixar.com",
"url": "https://github.com/kriskowal"
},
"keywords": [
"q",
"promise",
"promises",
"promises-a",
"promises-aplus",
"deferred",
"future",
"async",
"flow control",
"fluent",
"browser",
"node"
],
"contributors": [
{
"name": "Kris Kowal",
"email": "kris@cixar.com",
"url": "https://github.com/kriskowal"
},
{
"name": "Irakli Gozalishvili",
"email": "rfobic@gmail.com",
"url": "http://jeditoolkit.com"
},
{
"name": "Domenic Denicola",
"email": "domenic@domenicdenicola.com",
"url": "http://domenicdenicola.com"
}
],
"bugs": {
"url": "http://github.com/kriskowal/q/issues"
},
"license": {
"type": "MIT",
"url": "http://github.com/kriskowal/q/raw/master/LICENSE"
},
"main": "q.js",
"repository": {
"type": "git",
"url": "git://github.com/kriskowal/q.git"
},
"engines": {
"node": ">=0.6.0",
"teleport": ">=0.2.0"
},
"dependencies": {},
"devDependencies": {
"jshint": "~2.1.9",
"cover": "*",
"jasmine-node": "1.11.0",
"opener": "*",
"promises-aplus-tests": "1.x",
"grunt": "~0.4.1",
"grunt-cli": "~0.1.9",
"grunt-contrib-uglify": "~0.2.2",
"matcha": "~0.2.0"
},
"scripts": {
"test": "jasmine-node spec && promises-aplus-tests spec/aplus-adapter",
"test-browser": "opener spec/q-spec.html",
"benchmark": "matcha",
"lint": "jshint q.js",
"cover": "cover run node_modules/jasmine-node/bin/jasmine-node spec && cover report html && opener cover_html/index.html",
"minify": "grunt",
"prepublish": "grunt"
},
"overlay": {
"teleport": {
"dependencies": {
"system": ">=0.0.4"
}
}
},
"directories": {
"test": "./spec"
},
"_id": "q@1.0.1",
"dist": {
"shasum": "11872aeedee89268110b10a718448ffb10112a14",
"tarball": "http://registry.npmjs.org/q/-/q-1.0.1.tgz"
},
"_from": "q@",
"_npmVersion": "1.4.4",
"_npmUser": {
"name": "kriskowal",
"email": "kris.kowal@cixar.com"
},
"maintainers": [
{
"name": "kriskowal",
"email": "kris.kowal@cixar.com"
},
{
"name": "domenic",
"email": "domenic@domenicdenicola.com"
}
],
"_shasum": "11872aeedee89268110b10a718448ffb10112a14",
"_resolved": "https://registry.npmjs.org/q/-/q-1.0.1.tgz"
}
var Q = require("./q");
module.exports = Queue;
function Queue() {
var ends = Q.defer();
var closed = Q.defer();
return {
put: function (value) {
var next = Q.defer();
ends.resolve({
head: value,
tail: next.promise
});
ends.resolve = next.resolve;
},
get: function () {
var result = ends.promise.get("head");
ends.promise = ends.promise.get("tail");
return result.fail(function (error) {
closed.resolve(error);
throw error;
});
},
closed: closed.promise,
close: function (error) {
error = error || new Error("Can't get value from closed queue");
var end = {head: Q.reject(error)};
end.tail = end;
ends.resolve(end);
return closed.promise;
}
};
}
Copyright (c) 2012, Artur Adib <aadib@mozilla.com>
All rights reserved.
You may use this project under the terms of the New BSD license as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Artur Adib nor the
names of the contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL ARTUR ADIB BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#!/usr/bin/env bash #!/usr/bin/env node
#
# Licensed to the Apache Software Foundation (ASF) under one /*
# or more contributor license agreements. See the NOTICE file Licensed to the Apache Software Foundation (ASF) under one
# distributed with this work for additional information or more contributor license agreements. See the NOTICE file
# regarding copyright ownership. The ASF licenses this file distributed with this work for additional information
# to you under the Apache License, Version 2.0 (the regarding copyright ownership. The ASF licenses this file
# "License"); you may not use this file except in compliance to you under the Apache License, Version 2.0 (the
# with the License. You may obtain a copy of the License at "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
# 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 Unless required by applicable law or agreed to in writing,
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY software distributed under the License is distributed on an
# KIND, either express or implied. See the License for the "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# specific language governing permissions and limitations KIND, either express or implied. See the License for the
# under the License. specific language governing permissions and limitations
# under the License.
# Valid values for "--target" (case sensitive): */
# iPhone-4s
# iPhone-5 var args = process.argv,
# iPhone-5s run = require('./lib/run');
# iPhone-6-Plus
# iPhone-6 // Handle help flag
# iPad-2 if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(args[2]) > -1) {
# iPad-Retina run.help();
# iPad-Air } else {
# Resizable-iPhone run.run(args).done(function() {
# Resizable-iPad console.log('** RUN SUCCEEDED **');
}, function (err) {
var errorMessage = (err && err.stack) ? err.stack : err;
OPTION_RESULT=() console.error(errorMessage);
TARGET="iPhone-6" process.exit(2);
});
# multi-device flow default
USE_DEVICE=true
USE_SIMULATOR=false
# separates "key=value", sets an array with 0th index as key, 1st index as value
_parseOption()
{
local ARG=$@
OIFS=$IFS
IFS='='
OPTION_RESULT=()
for i in ${ARG[@]}
do
OPTION_RESULT+=($i)
done
IFS=$OIFS
} }
\ No newline at end of file
# parses key=value arguments
_parseArgs()
{
for arg in "$@"
do
_parseOption ${arg}
case "${OPTION_RESULT[0]}" in
"--target")
TARGET=${OPTION_RESULT[1]}
;;
"--device")
USE_DEVICE=true
USE_SIMULATOR=false
;;
"--emulator")
USE_DEVICE=false
USE_SIMULATOR=true
;;
esac
done
}
_parseArgs "$@"
CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P)
PROJECT_PATH="$(dirname "$CORDOVA_PATH")"
XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj )
PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj)
SIMULATOR_APP_PATH="$PROJECT_PATH/build/emulator/$PROJECT_NAME.app"
DEVICE_APP_PATH="$PROJECT_PATH/build/device/$PROJECT_NAME.app"
source "$CORDOVA_PATH/check_reqs"
# if device build found, run it first
if "$USE_DEVICE"; then
IOS_DEPLOY_MIN_VERSION="1.2.0"
IOS_DEPLOY_LOCATION=$(which ios-deploy)
if [ $? != 0 ]; then
echo -e "\033[31mError: ios-deploy was not found. Please download, build and install version $IOS_DEPLOY_MIN_VERSION or greater from https://github.com/phonegap/ios-deploy into your path. Or 'npm install -g ios-deploy' using node.js: http://nodejs.org/\033[m" 1>&2;
exit 1
fi
IOS_DEPLOY_VERSION=$(ios-deploy --version)
if [[ "$IOS_DEPLOY_VERSION" < "$IOS_DEPLOY_MIN_VERSION" ]]; then
echo "Cordova needs ios-deploy version $IOS_DEPLOY_MIN_VERSION or greater, you have version $IOS_DEPLOY_VERSION." 1>&2;
exit 1
fi
DEVICE_CONNECTED=$(ios-deploy -c)
if [ $? != 0 ]; then
echo "No device is connected, trying Simulator." 1>&2;
USE_SIMULATOR=true
else
# if we got here, we can deploy the app, then exit success
"$CORDOVA_PATH/build" --device || exit $?
ios-deploy -d -b "$DEVICE_APP_PATH"
exit 0
fi
fi
if "$USE_SIMULATOR"; then
IOS_SIM_MIN_VERSION="3.0"
IOS_SIM_LOCATION=$(which ios-sim)
if [ $? != 0 ]; then
echo -e "\033[31mError: ios-sim was not found. Please download, build and install version $IOS_SIM_MIN_VERSION or greater from https://github.com/phonegap/ios-sim into your path. Or 'npm install -g ios-sim' using node.js: http://nodejs.org/\033[m" 1>&2;
exit 1
fi
IOS_SIM_VERSION=$(ios-sim --version)
if [[ "$IOS_SIM_VERSION" < "$IOS_SIM_MIN_VERSION" ]]; then
echo "Cordova needs ios-sim version $IOS_SIM_MIN_VERSION or greater, you have version $IOS_SIM_VERSION." 1>&2;
exit 1
fi
# launch using ios-sim
"$CORDOVA_PATH/build" --emulator || exit $?
ios-sim launch "$SIMULATOR_APP_PATH" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" --devicetypeid com.apple.CoreSimulator.SimDeviceType.$TARGET --exit
fi
:: Licensed to the Apache Software Foundation (ASF) under one
:: or more contributor license agreements. See the NOTICE file
:: distributed with this work for additional information
:: regarding copyright ownership. The ASF licenses this file
:: 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
:: KIND, either express or implied. See the License for the
:: specific language governing permissions and limitations
:: under the License
@ECHO OFF
SET script_path="%~dp0run"
IF EXIST %script_path% (
node %script_path% %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'run' script in 'cordova' folder, aborting...>&2
EXIT /B 1
)
#!/bin/bash #!/usr/bin/env node
# /*
# Licensed to the Apache Software Foundation (ASF) under one Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at 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
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# http://www.apache.org/licenses/LICENSE-2.0
# Returns the VERSION of CordovaLib used.
# Note: it does not work if the --shared option was used to create the project.
#
VERSION="3.7.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
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
echo $VERSION /*
Returns the VERSION of CordovaLib used.
Note: it does not work if the --shared option was used to create the project.
*/
var VERSION="3.8.0"
console.log(VERSION);
:: Licensed to the Apache Software Foundation (ASF) under one
:: or more contributor license agreements. See the NOTICE file
:: distributed with this work for additional information
:: regarding copyright ownership. The ASF licenses this file
:: 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
:: KIND, either express or implied. See the License for the
:: specific language governing permissions and limitations
:: under the License.
@ECHO OFF
SET script="%~dp0version"
IF EXIST %script% (
node %script% %*
) ELSE (
ECHO.
ECHO ERROR: Could not find 'version' script in 'cordova' folder, aborting...>&2
EXIT /B 1
)
// Platform: ios // Platform: ios
// 91157c2e1bf3eb098c7e2ab31404e895ccb0df2a // fc4db9145934bd0053161cbf9ffc0caf83b770c6
/* /*
Licensed to the Apache Software Foundation (ASF) under one Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file or more contributor license agreements. See the NOTICE file
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
under the License. under the License.
*/ */
;(function() { ;(function() {
var PLATFORM_VERSION_BUILD_LABEL = '3.7.0'; var PLATFORM_VERSION_BUILD_LABEL = '3.8.0';
// file: src/scripts/require.js // file: src/scripts/require.js
/*jshint -W079 */ /*jshint -W079 */
...@@ -284,10 +284,16 @@ var cordova = { ...@@ -284,10 +284,16 @@ var cordova = {
if (callback) { if (callback) {
if (isSuccess && status == cordova.callbackStatus.OK) { if (isSuccess && status == cordova.callbackStatus.OK) {
callback.success && callback.success.apply(null, args); callback.success && callback.success.apply(null, args);
} else { } else if (!isSuccess) {
callback.fail && callback.fail.apply(null, args); callback.fail && callback.fail.apply(null, args);
} }
/*
else
Note, this case is intentionally not caught.
this can happen if isSuccess is true, but callbackStatus is NO_RESULT
which is used to remove a callback from the list without calling the callbacks
typically keepCallback is false in this case
*/
// Clear callback if not expecting any more results // Clear callback if not expecting any more results
if (!keepCallback) { if (!keepCallback) {
delete cordova.callbacks[callbackId]; delete cordova.callbacks[callbackId];
...@@ -464,9 +470,14 @@ function each(objects, func, context) { ...@@ -464,9 +470,14 @@ function each(objects, func, context) {
function clobber(obj, key, value) { function clobber(obj, key, value) {
exports.replaceHookForTesting(obj, key); exports.replaceHookForTesting(obj, key);
var needsProperty = false;
try {
obj[key] = value; obj[key] = value;
} catch (e) {
needsProperty = true;
}
// Getters can only be overridden by getters. // Getters can only be overridden by getters.
if (obj[key] !== value) { if (needsProperty || obj[key] !== value) {
utils.defineGetter(obj, key, function() { utils.defineGetter(obj, key, function() {
return value; return value;
}); });
...@@ -581,7 +592,6 @@ var utils = require('cordova/utils'), ...@@ -581,7 +592,6 @@ var utils = require('cordova/utils'),
* onDeviceReady* User event fired to indicate that Cordova is ready * onDeviceReady* User event fired to indicate that Cordova is ready
* onResume User event fired to indicate a start/resume lifecycle event * onResume User event fired to indicate a start/resume lifecycle event
* onPause User event fired to indicate a pause lifecycle event * onPause User event fired to indicate a pause lifecycle event
* onDestroy* Internal event fired when app is being destroyed (User should use window.onunload event, not this one).
* *
* The events marked with an * are sticky. Once they have fired, they will stay in the fired state. * The events marked with an * are sticky. Once they have fired, they will stay in the fired state.
* All listeners that subscribe after the event is fired will be executed right away. * All listeners that subscribe after the event is fired will be executed right away.
...@@ -793,9 +803,6 @@ channel.create('onResume'); ...@@ -793,9 +803,6 @@ channel.create('onResume');
// Event to indicate a pause lifecycle event // Event to indicate a pause lifecycle event
channel.create('onPause'); channel.create('onPause');
// Event to indicate a destroy lifecycle event
channel.createSticky('onDestroy');
// Channels that must fire before "deviceready" is fired. // Channels that must fire before "deviceready" is fired.
channel.waitForInitialization('onCordovaReady'); channel.waitForInitialization('onCordovaReady');
channel.waitForInitialization('onDOMContentLoaded'); channel.waitForInitialization('onDOMContentLoaded');
...@@ -821,14 +828,14 @@ var cordova = require('cordova'), ...@@ -821,14 +828,14 @@ var cordova = require('cordova'),
// IFRAME_NAV is the fastest. // IFRAME_NAV is the fastest.
// IFRAME_HASH could be made to enable synchronous bridge calls if we wanted this feature. // IFRAME_HASH could be made to enable synchronous bridge calls if we wanted this feature.
jsToNativeModes = { jsToNativeModes = {
IFRAME_NAV: 0, IFRAME_NAV: 0, // Default. Uses a new iframe for each poke.
XHR_NO_PAYLOAD: 1, // XHR bridge appears to be flaky sometimes: CB-3900, CB-3359, CB-5457, CB-4970, CB-4998, CB-5134
XHR_WITH_PAYLOAD: 2, XHR_NO_PAYLOAD: 1, // About the same speed as IFRAME_NAV. Performance not about the same as IFRAME_NAV, but more variable.
XHR_OPTIONAL_PAYLOAD: 3, XHR_WITH_PAYLOAD: 2, // Flakey, and not as performant
IFRAME_HASH_NO_PAYLOAD: 4, XHR_OPTIONAL_PAYLOAD: 3, // Flakey, and not as performant
// Bundling the payload turns out to be slower. Probably since it has to be URI encoded / decoded. IFRAME_HASH_NO_PAYLOAD: 4, // Not fully baked. A bit faster than IFRAME_NAV, but risks jank since poke happens synchronously.
IFRAME_HASH_WITH_PAYLOAD: 5, IFRAME_HASH_WITH_PAYLOAD: 5, // Slower than no payload. Maybe since it has to be URI encoded / decoded.
WK_WEBVIEW_BINDING: 6 WK_WEBVIEW_BINDING: 6 // Only way that works for WKWebView :)
}, },
bridgeMode, bridgeMode,
execIframe, execIframe,
...@@ -838,26 +845,8 @@ var cordova = require('cordova'), ...@@ -838,26 +845,8 @@ var cordova = require('cordova'),
requestCount = 0, requestCount = 0,
vcHeaderValue = null, vcHeaderValue = null,
commandQueue = [], // Contains pending JS->Native messages. commandQueue = [], // Contains pending JS->Native messages.
isInContextOfEvalJs = 0; isInContextOfEvalJs = 0,
failSafeTimerId = 0;
function createExecIframe(src, unloadListener) {
var iframe = document.createElement("iframe");
iframe.style.display = 'none';
// Both the unload listener and the src must be set before adding the iframe
// to the document in order to avoid race conditions. Callbacks from native
// can happen within the appendChild() call!
iframe.onunload = unloadListener;
iframe.src = src;
document.body.appendChild(iframe);
return iframe;
}
function createHashIframe() {
var ret = createExecIframe('about:blank');
// Hash changes don't work on about:blank, so switch it to file:///.
ret.contentWindow.history.replaceState(null, null, 'file:///#');
return ret;
}
function shouldBundleCommandJson() { function shouldBundleCommandJson() {
if (bridgeMode === jsToNativeModes.XHR_WITH_PAYLOAD) { if (bridgeMode === jsToNativeModes.XHR_WITH_PAYLOAD) {
...@@ -990,6 +979,12 @@ function iOSExec() { ...@@ -990,6 +979,12 @@ function iOSExec() {
// Also, if there is already a command in the queue, then we've already // Also, if there is already a command in the queue, then we've already
// poked the native side, so there is no reason to do so again. // poked the native side, so there is no reason to do so again.
if (!isInContextOfEvalJs && commandQueue.length == 1) { if (!isInContextOfEvalJs && commandQueue.length == 1) {
pokeNative();
}
}
}
function pokeNative() {
switch (bridgeMode) { switch (bridgeMode) {
case jsToNativeModes.XHR_NO_PAYLOAD: case jsToNativeModes.XHR_NO_PAYLOAD:
case jsToNativeModes.XHR_WITH_PAYLOAD: case jsToNativeModes.XHR_WITH_PAYLOAD:
...@@ -999,8 +994,6 @@ function iOSExec() { ...@@ -999,8 +994,6 @@ function iOSExec() {
default: // iframe-based. default: // iframe-based.
pokeNativeViaIframe(); pokeNativeViaIframe();
} }
}
}
} }
function pokeNativeViaXhr() { function pokeNativeViaXhr() {
...@@ -1026,11 +1019,6 @@ function pokeNativeViaXhr() { ...@@ -1026,11 +1019,6 @@ function pokeNativeViaXhr() {
execXhr.send(null); execXhr.send(null);
} }
function onIframeUnload() {
execIframe = null;
setTimeout(pokeNativeViaIframe, 0);
}
function pokeNativeViaIframe() { function pokeNativeViaIframe() {
// CB-5488 - Don't attempt to create iframe before document.body is available. // CB-5488 - Don't attempt to create iframe before document.body is available.
if (!document.body) { if (!document.body) {
...@@ -1039,10 +1027,12 @@ function pokeNativeViaIframe() { ...@@ -1039,10 +1027,12 @@ function pokeNativeViaIframe() {
} }
if (bridgeMode === jsToNativeModes.IFRAME_HASH_NO_PAYLOAD || bridgeMode === jsToNativeModes.IFRAME_HASH_WITH_PAYLOAD) { if (bridgeMode === jsToNativeModes.IFRAME_HASH_NO_PAYLOAD || bridgeMode === jsToNativeModes.IFRAME_HASH_WITH_PAYLOAD) {
// TODO: This bridge mode doesn't properly support being removed from the DOM (CB-7735) // TODO: This bridge mode doesn't properly support being removed from the DOM (CB-7735)
execHashIframe = execHashIframe || createHashIframe(); if (!execHashIframe) {
// Check if they've removed it from the DOM, and put it back if so. execHashIframe = document.createElement('iframe');
if (!execHashIframe.contentWindow) { execHashIframe.style.display = 'none';
execHashIframe = createHashIframe(); document.body.appendChild(execHashIframe);
// Hash changes don't work on about:blank, so switch it to file:///.
execHashIframe.contentWindow.history.replaceState(null, null, 'file:///#');
} }
// The delegate method is called only when the hash changes, so toggle it back and forth. // The delegate method is called only when the hash changes, so toggle it back and forth.
hashToggle = hashToggle ^ 3; hashToggle = hashToggle ^ 3;
...@@ -1054,13 +1044,25 @@ function pokeNativeViaIframe() { ...@@ -1054,13 +1044,25 @@ function pokeNativeViaIframe() {
} else { } else {
// Check if they've removed it from the DOM, and put it back if so. // Check if they've removed it from the DOM, and put it back if so.
if (execIframe && execIframe.contentWindow) { if (execIframe && execIframe.contentWindow) {
// Listen for unload, since it can happen (CB-7735) that the iframe gets execIframe.contentWindow.location = 'gap://ready';
// removed from the DOM before it gets a chance to poke the native side.
execIframe.contentWindow.onunload = onIframeUnload;
execIframe.src = 'gap://ready';
} else { } else {
execIframe = createExecIframe('gap://ready', onIframeUnload); execIframe = document.createElement('iframe');
execIframe.style.display = 'none';
execIframe.src = 'gap://ready';
document.body.appendChild(execIframe);
} }
// Use a timer to protect against iframe being unloaded during the poke (CB-7735).
// This makes the bridge ~ 7% slower, but works around the poke getting lost
// when the iframe is removed from the DOM.
// An onunload listener could be used in the case where the iframe has just been
// created, but since unload events fire only once, it doesn't work in the normal
// case of iframe reuse (where unload will have already fired due to the attempted
// navigation of the page).
failSafeTimerId = setTimeout(function() {
if (commandQueue.length) {
pokeNative();
}
}, 50); // Making this > 0 improves performance (marginally) in the normal case (where it doesn't fire).
} }
} }
...@@ -1071,7 +1073,9 @@ iOSExec.setJsToNativeBridgeMode = function(mode) { ...@@ -1071,7 +1073,9 @@ iOSExec.setJsToNativeBridgeMode = function(mode) {
// can trigger browser bugs. // can trigger browser bugs.
// https://issues.apache.org/jira/browse/CB-593 // https://issues.apache.org/jira/browse/CB-593
if (execIframe) { if (execIframe) {
if (execIframe.parentNode) {
execIframe.parentNode.removeChild(execIframe); execIframe.parentNode.removeChild(execIframe);
}
execIframe = null; execIframe = null;
} }
bridgeMode = mode; bridgeMode = mode;
...@@ -1079,8 +1083,9 @@ iOSExec.setJsToNativeBridgeMode = function(mode) { ...@@ -1079,8 +1083,9 @@ iOSExec.setJsToNativeBridgeMode = function(mode) {
iOSExec.nativeFetchMessages = function() { iOSExec.nativeFetchMessages = function() {
// Stop listing for window detatch once native side confirms poke. // Stop listing for window detatch once native side confirms poke.
if (execIframe && execIframe.contentWindow) { if (failSafeTimerId) {
execIframe.contentWindow.onunload = null; clearTimeout(failSafeTimerId);
failSafeTimerId = 0;
} }
// Each entry in commandQueue is a JSON string already. // Each entry in commandQueue is a JSON string already.
if (!commandQueue.length) { if (!commandQueue.length) {
......
// Platform: ios // Platform: ios
// 91157c2e1bf3eb098c7e2ab31404e895ccb0df2a // fc4db9145934bd0053161cbf9ffc0caf83b770c6
/* /*
Licensed to the Apache Software Foundation (ASF) under one Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file or more contributor license agreements. See the NOTICE file
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
under the License. under the License.
*/ */
;(function() { ;(function() {
var PLATFORM_VERSION_BUILD_LABEL = '3.7.0'; var PLATFORM_VERSION_BUILD_LABEL = '3.8.0';
// file: src/scripts/require.js // file: src/scripts/require.js
/*jshint -W079 */ /*jshint -W079 */
...@@ -284,10 +284,16 @@ var cordova = { ...@@ -284,10 +284,16 @@ var cordova = {
if (callback) { if (callback) {
if (isSuccess && status == cordova.callbackStatus.OK) { if (isSuccess && status == cordova.callbackStatus.OK) {
callback.success && callback.success.apply(null, args); callback.success && callback.success.apply(null, args);
} else { } else if (!isSuccess) {
callback.fail && callback.fail.apply(null, args); callback.fail && callback.fail.apply(null, args);
} }
/*
else
Note, this case is intentionally not caught.
this can happen if isSuccess is true, but callbackStatus is NO_RESULT
which is used to remove a callback from the list without calling the callbacks
typically keepCallback is false in this case
*/
// Clear callback if not expecting any more results // Clear callback if not expecting any more results
if (!keepCallback) { if (!keepCallback) {
delete cordova.callbacks[callbackId]; delete cordova.callbacks[callbackId];
...@@ -464,9 +470,14 @@ function each(objects, func, context) { ...@@ -464,9 +470,14 @@ function each(objects, func, context) {
function clobber(obj, key, value) { function clobber(obj, key, value) {
exports.replaceHookForTesting(obj, key); exports.replaceHookForTesting(obj, key);
var needsProperty = false;
try {
obj[key] = value; obj[key] = value;
} catch (e) {
needsProperty = true;
}
// Getters can only be overridden by getters. // Getters can only be overridden by getters.
if (obj[key] !== value) { if (needsProperty || obj[key] !== value) {
utils.defineGetter(obj, key, function() { utils.defineGetter(obj, key, function() {
return value; return value;
}); });
...@@ -581,7 +592,6 @@ var utils = require('cordova/utils'), ...@@ -581,7 +592,6 @@ var utils = require('cordova/utils'),
* onDeviceReady* User event fired to indicate that Cordova is ready * onDeviceReady* User event fired to indicate that Cordova is ready
* onResume User event fired to indicate a start/resume lifecycle event * onResume User event fired to indicate a start/resume lifecycle event
* onPause User event fired to indicate a pause lifecycle event * onPause User event fired to indicate a pause lifecycle event
* onDestroy* Internal event fired when app is being destroyed (User should use window.onunload event, not this one).
* *
* The events marked with an * are sticky. Once they have fired, they will stay in the fired state. * The events marked with an * are sticky. Once they have fired, they will stay in the fired state.
* All listeners that subscribe after the event is fired will be executed right away. * All listeners that subscribe after the event is fired will be executed right away.
...@@ -793,9 +803,6 @@ channel.create('onResume'); ...@@ -793,9 +803,6 @@ channel.create('onResume');
// Event to indicate a pause lifecycle event // Event to indicate a pause lifecycle event
channel.create('onPause'); channel.create('onPause');
// Event to indicate a destroy lifecycle event
channel.createSticky('onDestroy');
// Channels that must fire before "deviceready" is fired. // Channels that must fire before "deviceready" is fired.
channel.waitForInitialization('onCordovaReady'); channel.waitForInitialization('onCordovaReady');
channel.waitForInitialization('onDOMContentLoaded'); channel.waitForInitialization('onDOMContentLoaded');
...@@ -821,14 +828,14 @@ var cordova = require('cordova'), ...@@ -821,14 +828,14 @@ var cordova = require('cordova'),
// IFRAME_NAV is the fastest. // IFRAME_NAV is the fastest.
// IFRAME_HASH could be made to enable synchronous bridge calls if we wanted this feature. // IFRAME_HASH could be made to enable synchronous bridge calls if we wanted this feature.
jsToNativeModes = { jsToNativeModes = {
IFRAME_NAV: 0, IFRAME_NAV: 0, // Default. Uses a new iframe for each poke.
XHR_NO_PAYLOAD: 1, // XHR bridge appears to be flaky sometimes: CB-3900, CB-3359, CB-5457, CB-4970, CB-4998, CB-5134
XHR_WITH_PAYLOAD: 2, XHR_NO_PAYLOAD: 1, // About the same speed as IFRAME_NAV. Performance not about the same as IFRAME_NAV, but more variable.
XHR_OPTIONAL_PAYLOAD: 3, XHR_WITH_PAYLOAD: 2, // Flakey, and not as performant
IFRAME_HASH_NO_PAYLOAD: 4, XHR_OPTIONAL_PAYLOAD: 3, // Flakey, and not as performant
// Bundling the payload turns out to be slower. Probably since it has to be URI encoded / decoded. IFRAME_HASH_NO_PAYLOAD: 4, // Not fully baked. A bit faster than IFRAME_NAV, but risks jank since poke happens synchronously.
IFRAME_HASH_WITH_PAYLOAD: 5, IFRAME_HASH_WITH_PAYLOAD: 5, // Slower than no payload. Maybe since it has to be URI encoded / decoded.
WK_WEBVIEW_BINDING: 6 WK_WEBVIEW_BINDING: 6 // Only way that works for WKWebView :)
}, },
bridgeMode, bridgeMode,
execIframe, execIframe,
...@@ -838,26 +845,8 @@ var cordova = require('cordova'), ...@@ -838,26 +845,8 @@ var cordova = require('cordova'),
requestCount = 0, requestCount = 0,
vcHeaderValue = null, vcHeaderValue = null,
commandQueue = [], // Contains pending JS->Native messages. commandQueue = [], // Contains pending JS->Native messages.
isInContextOfEvalJs = 0; isInContextOfEvalJs = 0,
failSafeTimerId = 0;
function createExecIframe(src, unloadListener) {
var iframe = document.createElement("iframe");
iframe.style.display = 'none';
// Both the unload listener and the src must be set before adding the iframe
// to the document in order to avoid race conditions. Callbacks from native
// can happen within the appendChild() call!
iframe.onunload = unloadListener;
iframe.src = src;
document.body.appendChild(iframe);
return iframe;
}
function createHashIframe() {
var ret = createExecIframe('about:blank');
// Hash changes don't work on about:blank, so switch it to file:///.
ret.contentWindow.history.replaceState(null, null, 'file:///#');
return ret;
}
function shouldBundleCommandJson() { function shouldBundleCommandJson() {
if (bridgeMode === jsToNativeModes.XHR_WITH_PAYLOAD) { if (bridgeMode === jsToNativeModes.XHR_WITH_PAYLOAD) {
...@@ -990,6 +979,12 @@ function iOSExec() { ...@@ -990,6 +979,12 @@ function iOSExec() {
// Also, if there is already a command in the queue, then we've already // Also, if there is already a command in the queue, then we've already
// poked the native side, so there is no reason to do so again. // poked the native side, so there is no reason to do so again.
if (!isInContextOfEvalJs && commandQueue.length == 1) { if (!isInContextOfEvalJs && commandQueue.length == 1) {
pokeNative();
}
}
}
function pokeNative() {
switch (bridgeMode) { switch (bridgeMode) {
case jsToNativeModes.XHR_NO_PAYLOAD: case jsToNativeModes.XHR_NO_PAYLOAD:
case jsToNativeModes.XHR_WITH_PAYLOAD: case jsToNativeModes.XHR_WITH_PAYLOAD:
...@@ -999,8 +994,6 @@ function iOSExec() { ...@@ -999,8 +994,6 @@ function iOSExec() {
default: // iframe-based. default: // iframe-based.
pokeNativeViaIframe(); pokeNativeViaIframe();
} }
}
}
} }
function pokeNativeViaXhr() { function pokeNativeViaXhr() {
...@@ -1026,11 +1019,6 @@ function pokeNativeViaXhr() { ...@@ -1026,11 +1019,6 @@ function pokeNativeViaXhr() {
execXhr.send(null); execXhr.send(null);
} }
function onIframeUnload() {
execIframe = null;
setTimeout(pokeNativeViaIframe, 0);
}
function pokeNativeViaIframe() { function pokeNativeViaIframe() {
// CB-5488 - Don't attempt to create iframe before document.body is available. // CB-5488 - Don't attempt to create iframe before document.body is available.
if (!document.body) { if (!document.body) {
...@@ -1039,10 +1027,12 @@ function pokeNativeViaIframe() { ...@@ -1039,10 +1027,12 @@ function pokeNativeViaIframe() {
} }
if (bridgeMode === jsToNativeModes.IFRAME_HASH_NO_PAYLOAD || bridgeMode === jsToNativeModes.IFRAME_HASH_WITH_PAYLOAD) { if (bridgeMode === jsToNativeModes.IFRAME_HASH_NO_PAYLOAD || bridgeMode === jsToNativeModes.IFRAME_HASH_WITH_PAYLOAD) {
// TODO: This bridge mode doesn't properly support being removed from the DOM (CB-7735) // TODO: This bridge mode doesn't properly support being removed from the DOM (CB-7735)
execHashIframe = execHashIframe || createHashIframe(); if (!execHashIframe) {
// Check if they've removed it from the DOM, and put it back if so. execHashIframe = document.createElement('iframe');
if (!execHashIframe.contentWindow) { execHashIframe.style.display = 'none';
execHashIframe = createHashIframe(); document.body.appendChild(execHashIframe);
// Hash changes don't work on about:blank, so switch it to file:///.
execHashIframe.contentWindow.history.replaceState(null, null, 'file:///#');
} }
// The delegate method is called only when the hash changes, so toggle it back and forth. // The delegate method is called only when the hash changes, so toggle it back and forth.
hashToggle = hashToggle ^ 3; hashToggle = hashToggle ^ 3;
...@@ -1054,13 +1044,25 @@ function pokeNativeViaIframe() { ...@@ -1054,13 +1044,25 @@ function pokeNativeViaIframe() {
} else { } else {
// Check if they've removed it from the DOM, and put it back if so. // Check if they've removed it from the DOM, and put it back if so.
if (execIframe && execIframe.contentWindow) { if (execIframe && execIframe.contentWindow) {
// Listen for unload, since it can happen (CB-7735) that the iframe gets execIframe.contentWindow.location = 'gap://ready';
// removed from the DOM before it gets a chance to poke the native side.
execIframe.contentWindow.onunload = onIframeUnload;
execIframe.src = 'gap://ready';
} else { } else {
execIframe = createExecIframe('gap://ready', onIframeUnload); execIframe = document.createElement('iframe');
execIframe.style.display = 'none';
execIframe.src = 'gap://ready';
document.body.appendChild(execIframe);
} }
// Use a timer to protect against iframe being unloaded during the poke (CB-7735).
// This makes the bridge ~ 7% slower, but works around the poke getting lost
// when the iframe is removed from the DOM.
// An onunload listener could be used in the case where the iframe has just been
// created, but since unload events fire only once, it doesn't work in the normal
// case of iframe reuse (where unload will have already fired due to the attempted
// navigation of the page).
failSafeTimerId = setTimeout(function() {
if (commandQueue.length) {
pokeNative();
}
}, 50); // Making this > 0 improves performance (marginally) in the normal case (where it doesn't fire).
} }
} }
...@@ -1071,7 +1073,9 @@ iOSExec.setJsToNativeBridgeMode = function(mode) { ...@@ -1071,7 +1073,9 @@ iOSExec.setJsToNativeBridgeMode = function(mode) {
// can trigger browser bugs. // can trigger browser bugs.
// https://issues.apache.org/jira/browse/CB-593 // https://issues.apache.org/jira/browse/CB-593
if (execIframe) { if (execIframe) {
if (execIframe.parentNode) {
execIframe.parentNode.removeChild(execIframe); execIframe.parentNode.removeChild(execIframe);
}
execIframe = null; execIframe = null;
} }
bridgeMode = mode; bridgeMode = mode;
...@@ -1079,8 +1083,9 @@ iOSExec.setJsToNativeBridgeMode = function(mode) { ...@@ -1079,8 +1083,9 @@ iOSExec.setJsToNativeBridgeMode = function(mode) {
iOSExec.nativeFetchMessages = function() { iOSExec.nativeFetchMessages = function() {
// Stop listing for window detatch once native side confirms poke. // Stop listing for window detatch once native side confirms poke.
if (execIframe && execIframe.contentWindow) { if (failSafeTimerId) {
execIframe.contentWindow.onunload = null; clearTimeout(failSafeTimerId);
failSafeTimerId = 0;
} }
// Each entry in commandQueue is a JSON string already. // Each entry in commandQueue is a JSON string already.
if (!commandQueue.length) { if (!commandQueue.length) {
......
cordova.define('cordova/plugin_list', function(require, exports, module) { cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [ module.exports = [
{ {
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification",
"clobbers": [
"cordova.plugins.notification.local",
"plugin.notification.local"
]
},
{
"file": "plugins/nl.x-services.plugins.toast/www/Toast.js", "file": "plugins/nl.x-services.plugins.toast/www/Toast.js",
"id": "nl.x-services.plugins.toast.Toast", "id": "nl.x-services.plugins.toast.Toast",
"clobbers": [ "clobbers": [
...@@ -12,14 +20,6 @@ module.exports = [ ...@@ -12,14 +20,6 @@ module.exports = [
"id": "nl.x-services.plugins.toast.tests" "id": "nl.x-services.plugins.toast.tests"
}, },
{ {
"file": "plugins/de.appplant.cordova.plugin.local-notification/www/local-notification.js",
"id": "de.appplant.cordova.plugin.local-notification.LocalNotification",
"clobbers": [
"cordova.plugins.notification.local",
"plugin.notification.local"
]
},
{
"file": "plugins/org.apache.cordova.device/www/device.js", "file": "plugins/org.apache.cordova.device/www/device.js",
"id": "org.apache.cordova.device.device", "id": "org.apache.cordova.device.device",
"clobbers": [ "clobbers": [
...@@ -30,8 +30,8 @@ module.exports = [ ...@@ -30,8 +30,8 @@ module.exports = [
module.exports.metadata = module.exports.metadata =
// TOP OF METADATA // TOP OF METADATA
{ {
"nl.x-services.plugins.toast": "2.0.3",
"de.appplant.cordova.plugin.local-notification": "0.8.0rc2", "de.appplant.cordova.plugin.local-notification": "0.8.0rc2",
"nl.x-services.plugins.toast": "2.0.3",
"org.apache.cordova.device": "0.3.1-dev" "org.apache.cordova.device": "0.3.1-dev"
} }
// BOTTOM OF METADATA // BOTTOM OF METADATA
......
...@@ -289,48 +289,48 @@ ...@@ -289,48 +289,48 @@
<!-- IDs --> <!-- IDs -->
<script type="text/javascript"> <script type="text/javascript">
var fn = function (ids) { var callback = function (ids) {
showToast(ids.length === 0 ? '- none -' : ids.join(' ,')); showToast(ids.length === 0 ? '- none -' : ids.join(' ,'));
}; };
getIds = function () { getIds = function () {
cordova.plugins.notification.local.getIds(fn); cordova.plugins.notification.local.getIds(callback);
}; };
getScheduledIds = function () { getScheduledIds = function () {
cordova.plugins.notification.local.getScheduledIds(fn); cordova.plugins.notification.local.getScheduledIds(callback);
}; };
getTriggeredIds = function () { getTriggeredIds = function () {
cordova.plugins.notification.local.getTriggeredIds(fn); cordova.plugins.notification.local.getTriggeredIds(callback);
}; };
</script> </script>
<!-- notifications --> <!-- notifications -->
<script type="text/javascript"> <script type="text/javascript">
var fn = function (notifications) { var callback = function (notifications) {
console.log(notifications); console.log(notifications);
showToast(notifications.length === 0 ? '- none -' : notifications.join(' ,')); showToast(notifications.length === 0 ? '- none -' : notifications.join(' ,'));
}; };
get = function () { get = function () {
cordova.plugins.notification.local.get(1, fn); cordova.plugins.notification.local.get(1, callback);
}; };
getMultiple = function () { getMultiple = function () {
cordova.plugins.notification.local.get([1, 2], fn); cordova.plugins.notification.local.get([1, 2], callback);
}; };
getAll = function () { getAll = function () {
cordova.plugins.notification.local.getAll(fn); cordova.plugins.notification.local.getAll(callback);
}; };
getScheduled = function () { getScheduled = function () {
cordova.plugins.notification.local.getScheduled(fn); cordova.plugins.notification.local.getScheduled(callback);
}; };
getTriggered = function () { getTriggered = function () {
cordova.plugins.notification.local.getTriggered(fn); cordova.plugins.notification.local.getTriggered(callback);
}; };
</script> </script>
......
...@@ -13,26 +13,21 @@ ...@@ -13,26 +13,21 @@
"count": 1 "count": 1
}, },
{ {
"xml": "<feature name=\"Toast\"><param name=\"ios-package\" value=\"Toast\" /></feature>", "xml": "<feature name=\"LocalNotification\"><param name=\"ios-package\" onload=\"true\" value=\"APPLocalNotification\" /><param name=\"onload\" value=\"true\" /></feature>",
"count": 1 "count": 1
}, },
{ {
"xml": "<feature name=\"LocalNotification\"><param name=\"ios-package\" onload=\"true\" value=\"APPLocalNotification\" /><param name=\"onload\" value=\"true\" /></feature>", "xml": "<feature name=\"Toast\"><param name=\"ios-package\" value=\"Toast\" /></feature>",
"count": 1 "count": 1
} }
] ]
} }
}, },
"*-Info.plist": {
"parents": {
"UIBackgroundModes": []
}
},
"framework": { "framework": {
"parents": { "parents": {
"QuartzCore.framework": [ "QuartzCore.framework": [
{ {
"xml": "false", "xml": false,
"count": 1 "count": 1
} }
] ]
...@@ -41,10 +36,10 @@ ...@@ -41,10 +36,10 @@
} }
}, },
"installed_plugins": { "installed_plugins": {
"nl.x-services.plugins.toast": { "de.appplant.cordova.plugin.local-notification": {
"PACKAGE_NAME": "de.appplant.cordova.plugin.local-notification.example" "PACKAGE_NAME": "de.appplant.cordova.plugin.local-notification.example"
}, },
"de.appplant.cordova.plugin.local-notification": { "nl.x-services.plugins.toast": {
"PACKAGE_NAME": "de.appplant.cordova.plugin.local-notification.example" "PACKAGE_NAME": "de.appplant.cordova.plugin.local-notification.example"
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment