diff options
| author | Jules Laplace <jules@okfoc.us> | 2016-11-08 11:46:59 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2016-11-08 11:46:59 -0500 |
| commit | 5fa81da81260d65113f57a293b6256d334fe8e2d (patch) | |
| tree | 01d3dd7ab7a1febccd20de1756d0801a64ae64e9 | |
| parent | e5652e9cd560ccda249819857c207643820b075f (diff) | |
| parent | 7773d1d0686de69504e9b820efdb3e94d72eff04 (diff) | |
le build
268 files changed, 8509 insertions, 7019 deletions
diff --git a/StoneIsland/config.xml b/StoneIsland/config.xml index c21885e7..3249fc69 100755 --- a/StoneIsland/config.xml +++ b/StoneIsland/config.xml @@ -31,6 +31,7 @@ <preference name="SplashMaintainAspectRatio" value="true" /> <preference name="ShowSplashScreenSpinner" value="false"/> <preference name="AutoHideSplashScreen" value="false" /> + <preference name="AllowInlineMediaPlayback" value="true" /> <platform name="android"> <allow-intent href="market:*" /> diff --git a/StoneIsland/platforms/ios/.gitignore b/StoneIsland/platforms/ios/.gitignore index cc76483f..cc76483f 100755..100644 --- a/StoneIsland/platforms/ios/.gitignore +++ b/StoneIsland/platforms/ios/.gitignore diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVAvailabilityDeprecated.h b/StoneIsland/platforms/ios/CordovaLib/Classes/CDVAvailabilityDeprecated.h deleted file mode 100755 index 216b4c1d..00000000 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVAvailabilityDeprecated.h +++ /dev/null @@ -1,38 +0,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. - */ - - -#import <UIKit/UIKit.h> - -#ifdef __clang__ -#define CDV_DEPRECATED(version, msg) __attribute__((deprecated("Deprecated in Cordova " #version ". " msg))) -#else -#define CDV_DEPRECATED(version, msg) __attribute__((deprecated())) -#endif - -static inline BOOL CDV_IsIPad(void) CDV_DEPRECATED(3.7.0, "This will be removed in 4.0.0"); -static inline BOOL CDV_IsIPhone5(void) CDV_DEPRECATED(3.7.0, "This will be removed in 4.0.0"); - -static inline BOOL CDV_IsIPad(void) { - return [[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] && [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad; -} - -static inline BOOL CDV_IsIPhone5(void) { - return ([[UIScreen mainScreen] bounds].size.width == 568 && [[UIScreen mainScreen] bounds].size.height == 320) || ([[UIScreen mainScreen] bounds].size.height == 568 && [[UIScreen mainScreen] bounds].size.width == 320); -}
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVJSON.h b/StoneIsland/platforms/ios/CordovaLib/Classes/CDVJSON.h deleted file mode 100755 index ede708f9..00000000 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVJSON.h +++ /dev/null @@ -1,37 +0,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. - */ - -#import "CDVAvailabilityDeprecated.h" - -@interface NSArray (CDVJSONSerializing) -- (NSString*)JSONString CDV_DEPRECATED(3.8 .0, "Use NSJSONSerialization instead."); - -@end - -@interface NSDictionary (CDVJSONSerializing) -- (NSString*)JSONString CDV_DEPRECATED(3.8 .0, "Use NSJSONSerialization instead."); - -@end - -@interface NSString (CDVJSONSerializing) -- (id)JSONObject CDV_DEPRECATED(3.8 .0, "Use NSJSONSerialization instead."); - -- (id)JSONFragment CDV_DEPRECATED(3.8 .0, "Use NSJSONSerialization instead."); - -@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVURLProtocol.m b/StoneIsland/platforms/ios/CordovaLib/Classes/CDVURLProtocol.m deleted file mode 100755 index fce5783a..00000000 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVURLProtocol.m +++ /dev/null @@ -1,213 +0,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. - */ - -#import <AssetsLibrary/ALAsset.h> -#import <AssetsLibrary/ALAssetRepresentation.h> -#import <AssetsLibrary/ALAssetsLibrary.h> -#import <MobileCoreServices/MobileCoreServices.h> -#import "CDVURLProtocol.h" -#import "CDVCommandQueue.h" -#import "CDVWhitelist.h" -#import "CDVViewController.h" - -static CDVWhitelist* gWhitelist = nil; -// Contains a set of NSNumbers of addresses of controllers. It doesn't store -// the actual pointer to avoid retaining. -static NSMutableSet* gRegisteredControllers = nil; - -NSString* const kCDVAssetsLibraryPrefixes = @"assets-library://"; - -// Returns the registered view controller that sent the given request. -// If the user-agent is not from a UIWebView, or if it's from an unregistered one, -// then nil is returned. -static CDVViewController *viewControllerForRequest(NSURLRequest* request) -{ - // The exec bridge explicitly sets the VC address in a header. - // This works around the User-Agent not being set for file: URLs. - NSString* addrString = [request valueForHTTPHeaderField:@"vc"]; - - if (addrString == nil) { - NSString* userAgent = [request valueForHTTPHeaderField:@"User-Agent"]; - if (userAgent == nil) { - return nil; - } - NSUInteger bracketLocation = [userAgent rangeOfString:@"(" options:NSBackwardsSearch].location; - if (bracketLocation == NSNotFound) { - return nil; - } - addrString = [userAgent substringFromIndex:bracketLocation + 1]; - } - - long long viewControllerAddress = [addrString longLongValue]; - @synchronized(gRegisteredControllers) { - if (![gRegisteredControllers containsObject:[NSNumber numberWithLongLong:viewControllerAddress]]) { - return nil; - } - } - - return (__bridge CDVViewController*)(void*)viewControllerAddress; -} - -@implementation CDVURLProtocol - -+ (void)registerPGHttpURLProtocol {} - -+ (void)registerURLProtocol {} - -// Called to register the URLProtocol, and to make it away of an instance of -// a ViewController. -+ (void)registerViewController:(CDVViewController*)viewController -{ - if (gRegisteredControllers == nil) { - [NSURLProtocol registerClass:[CDVURLProtocol class]]; - gRegisteredControllers = [[NSMutableSet alloc] initWithCapacity:8]; - // The whitelist doesn't change, so grab the first one and store it. - gWhitelist = viewController.whitelist; - - // Note that we grab the whitelist from the first viewcontroller for now - but this will change - // when we allow a registered viewcontroller to have its own whitelist (e.g InAppBrowser) - // Differentiating the requests will be through the 'vc' http header below as used for the js->objc bridge. - // The 'vc' value is generated by casting the viewcontroller object to a (long long) value (see CDVViewController::webViewDidFinishLoad) - if (gWhitelist == nil) { - NSLog(@"WARNING: NO whitelist has been set in CDVURLProtocol."); - } - } - - @synchronized(gRegisteredControllers) { - [gRegisteredControllers addObject:[NSNumber numberWithLongLong:(long long)viewController]]; - } -} - -+ (void)unregisterViewController:(CDVViewController*)viewController -{ - @synchronized(gRegisteredControllers) { - [gRegisteredControllers removeObject:[NSNumber numberWithLongLong:(long long)viewController]]; - } -} - -+ (BOOL)canInitWithRequest:(NSURLRequest*)theRequest -{ - NSURL* theUrl = [theRequest URL]; - CDVViewController* viewController = viewControllerForRequest(theRequest); - - if ([[theUrl absoluteString] hasPrefix:kCDVAssetsLibraryPrefixes]) { - return YES; - } else if (viewController != nil) { - if ([[theUrl path] isEqualToString:@"/!gap_exec"]) { - NSString* queuedCommandsJSON = [theRequest valueForHTTPHeaderField:@"cmds"]; - NSString* requestId = [theRequest valueForHTTPHeaderField:@"rc"]; - if (requestId == nil) { - NSLog(@"!cordova request missing rc header"); - return NO; - } - BOOL hasCmds = [queuedCommandsJSON length] > 0; - if (hasCmds) { - SEL sel = @selector(enqueueCommandBatch:); - [viewController.commandQueue performSelectorOnMainThread:sel withObject:queuedCommandsJSON waitUntilDone:NO]; - [viewController.commandQueue performSelectorOnMainThread:@selector(executePending) withObject:nil waitUntilDone:NO]; - } else { - SEL sel = @selector(processXhrExecBridgePoke:); - [viewController.commandQueue performSelectorOnMainThread:sel withObject:[NSNumber numberWithInteger:[requestId integerValue]] waitUntilDone:NO]; - } - // Returning NO here would be 20% faster, but it spams WebInspector's console with failure messages. - // If JS->Native bridge speed is really important for an app, they should use the iframe bridge. - // Returning YES here causes the request to come through canInitWithRequest two more times. - // For this reason, we return NO when cmds exist. - return !hasCmds; - } - // we only care about http and https connections. - // CORS takes care of http: trying to access file: URLs. - if ([gWhitelist schemeIsAllowed:[theUrl scheme]]) { - // if it FAILS the whitelist, we return TRUE, so we can fail the connection later - return ![gWhitelist URLIsAllowed:theUrl]; - } - } - - return NO; -} - -+ (NSURLRequest*)canonicalRequestForRequest:(NSURLRequest*)request -{ - // NSLog(@"%@ received %@", self, NSStringFromSelector(_cmd)); - return request; -} - -- (void)startLoading -{ - // NSLog(@"%@ received %@ - start", self, NSStringFromSelector(_cmd)); - NSURL* url = [[self request] URL]; - - if ([[url path] isEqualToString:@"/!gap_exec"]) { - [self sendResponseWithResponseCode:200 data:nil mimeType:nil]; - return; - } else if ([[url absoluteString] hasPrefix:kCDVAssetsLibraryPrefixes]) { - ALAssetsLibraryAssetForURLResultBlock resultBlock = ^(ALAsset* asset) { - if (asset) { - // We have the asset! Get the data and send it along. - ALAssetRepresentation* assetRepresentation = [asset defaultRepresentation]; - NSString* MIMEType = (__bridge_transfer NSString*)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)[assetRepresentation UTI], kUTTagClassMIMEType); - Byte* buffer = (Byte*)malloc((unsigned long)[assetRepresentation size]); - NSUInteger bufferSize = [assetRepresentation getBytes:buffer fromOffset:0.0 length:(NSUInteger)[assetRepresentation size] error:nil]; - NSData* data = [NSData dataWithBytesNoCopy:buffer length:bufferSize freeWhenDone:YES]; - [self sendResponseWithResponseCode:200 data:data mimeType:MIMEType]; - } else { - // Retrieving the asset failed for some reason. Send an error. - [self sendResponseWithResponseCode:404 data:nil mimeType:nil]; - } - }; - ALAssetsLibraryAccessFailureBlock failureBlock = ^(NSError* error) { - // Retrieving the asset failed for some reason. Send an error. - [self sendResponseWithResponseCode:401 data:nil mimeType:nil]; - }; - - ALAssetsLibrary* assetsLibrary = [[ALAssetsLibrary alloc] init]; - [assetsLibrary assetForURL:url resultBlock:resultBlock failureBlock:failureBlock]; - return; - } - - NSString* body = [gWhitelist errorStringForURL:url]; - [self sendResponseWithResponseCode:401 data:[body dataUsingEncoding:NSASCIIStringEncoding] mimeType:nil]; -} - -- (void)stopLoading -{ - // do any cleanup here -} - -+ (BOOL)requestIsCacheEquivalent:(NSURLRequest*)requestA toRequest:(NSURLRequest*)requestB -{ - return NO; -} - -- (void)sendResponseWithResponseCode:(NSInteger)statusCode data:(NSData*)data mimeType:(NSString*)mimeType -{ - if (mimeType == nil) { - mimeType = @"text/plain"; - } - - NSHTTPURLResponse* response = [[NSHTTPURLResponse alloc] initWithURL:[[self request] URL] statusCode:statusCode HTTPVersion:@"HTTP/1.1" headerFields:@{@"Content-Type" : mimeType}]; - - [[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed]; - if (data != nil) { - [[self client] URLProtocol:self didLoadData:data]; - } - [[self client] URLProtocolDidFinishLoading:self]; -} - -@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVViewController.m b/StoneIsland/platforms/ios/CordovaLib/Classes/CDVViewController.m deleted file mode 100755 index 6bfabe42..00000000 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVViewController.m +++ /dev/null @@ -1,1065 +0,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. - */ - -#import <objc/message.h> -#import "CDV.h" -#import "CDVCommandDelegateImpl.h" -#import "CDVConfigParser.h" -#import "CDVUserAgentUtil.h" -#import "CDVWebViewDelegate.h" -#import <AVFoundation/AVFoundation.h> -#import "CDVHandleOpenURL.h" - -#define degreesToRadian(x) (M_PI * (x) / 180.0) - -@interface CDVViewController () { - NSInteger _userAgentLockToken; - CDVWebViewDelegate* _webViewDelegate; -} - -@property (nonatomic, readwrite, strong) NSXMLParser* configParser; -@property (nonatomic, readwrite, strong) NSMutableDictionary* settings; -@property (nonatomic, readwrite, strong) CDVWhitelist* whitelist; -@property (nonatomic, readwrite, strong) NSMutableDictionary* pluginObjects; -@property (nonatomic, readwrite, strong) NSArray* startupPluginNames; -@property (nonatomic, readwrite, strong) NSDictionary* pluginsMap; -@property (nonatomic, readwrite, strong) NSArray* supportedOrientations; -@property (nonatomic, readwrite, assign) BOOL loadFromString; - -@property (readwrite, assign) BOOL initialized; - -@property (atomic, strong) NSURL* openURL; - -@end - -@implementation CDVViewController - -@synthesize webView, supportedOrientations; -@synthesize pluginObjects, pluginsMap, whitelist, startupPluginNames; -@synthesize configParser, settings, loadFromString; -@synthesize wwwFolderName, startPage, initialized, openURL, baseUserAgent; -@synthesize commandDelegate = _commandDelegate; -@synthesize commandQueue = _commandQueue; - -- (void)__init -{ - if ((self != nil) && !self.initialized) { - _commandQueue = [[CDVCommandQueue alloc] initWithViewController:self]; - _commandDelegate = [[CDVCommandDelegateImpl alloc] initWithViewController:self]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppWillTerminate:) - name:UIApplicationWillTerminateNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppWillResignActive:) - name:UIApplicationWillResignActiveNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppDidBecomeActive:) - name:UIApplicationDidBecomeActiveNotification object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppWillEnterForeground:) - name:UIApplicationWillEnterForegroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppDidEnterBackground:) - name:UIApplicationDidEnterBackgroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPageDidLoad:) - name:CDVPageDidLoadNotification object:nil]; - - // read from UISupportedInterfaceOrientations (or UISupportedInterfaceOrientations~iPad, if its iPad) from -Info.plist - self.supportedOrientations = [self parseInterfaceOrientations: - [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UISupportedInterfaceOrientations"]]; - - [self printVersion]; - [self printMultitaskingInfo]; - [self printPlatformVersionWarning]; - self.initialized = YES; - - // load config.xml settings - [self loadSettings]; - } -} - -- (id)initWithNibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil -{ - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - [self __init]; - return self; -} - -- (id)initWithCoder:(NSCoder*)aDecoder -{ - self = [super initWithCoder:aDecoder]; - [self __init]; - return self; -} - -- (id)init -{ - self = [super init]; - [self __init]; - return self; -} - -- (void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; -} - -- (void)viewWillDisappear:(BOOL)animated -{ - [super viewWillDisappear:animated]; -} - -- (void)printVersion -{ - NSLog(@"Apache Cordova native platform version %@ is starting.", CDV_VERSION); -} - -- (void)printPlatformVersionWarning -{ - if (!IsAtLeastiOSVersion(@"6.0")) { - NSLog(@"CRITICAL: For Cordova 3.5.0 and above, you will need to upgrade to at least iOS 6.0 or greater. Your current version of iOS is %@.", - [[UIDevice currentDevice] systemVersion] - ); - } -} - -- (void)printMultitaskingInfo -{ - UIDevice* device = [UIDevice currentDevice]; - BOOL backgroundSupported = NO; - - if ([device respondsToSelector:@selector(isMultitaskingSupported)]) { - backgroundSupported = device.multitaskingSupported; - } - - NSNumber* exitsOnSuspend = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIApplicationExitsOnSuspend"]; - if (exitsOnSuspend == nil) { // if it's missing, it should be NO (i.e. multi-tasking on by default) - exitsOnSuspend = [NSNumber numberWithBool:NO]; - } - - NSLog(@"Multi-tasking -> Device: %@, App: %@", (backgroundSupported ? @"YES" : @"NO"), (![exitsOnSuspend intValue]) ? @"YES" : @"NO"); -} - -- (BOOL)URLisAllowed:(NSURL*)url -{ - if (self.whitelist == nil) { - return YES; - } - - return [self.whitelist URLIsAllowed:url]; -} - -- (void)loadSettings -{ - CDVConfigParser* delegate = [[CDVConfigParser alloc] init]; - - // read from config.xml in the app bundle - NSString* path = [[NSBundle mainBundle] pathForResource:@"config" ofType:@"xml"]; - - if (![[NSFileManager defaultManager] fileExistsAtPath:path]) { - NSAssert(NO, @"ERROR: config.xml does not exist. Please run cordova-ios/bin/cordova_plist_to_config_xml path/to/project."); - return; - } - - NSURL* url = [NSURL fileURLWithPath:path]; - - configParser = [[NSXMLParser alloc] initWithContentsOfURL:url]; - if (configParser == nil) { - NSLog(@"Failed to initialize XML parser."); - return; - } - [configParser setDelegate:((id < NSXMLParserDelegate >)delegate)]; - [configParser parse]; - - // Get the plugin dictionary, whitelist and settings from the delegate. - self.pluginsMap = delegate.pluginsDict; - self.startupPluginNames = delegate.startupPluginNames; - self.whitelist = [[CDVWhitelist alloc] initWithArray:delegate.whitelistHosts]; - self.settings = delegate.settings; - - // And the start folder/page. - self.wwwFolderName = @"www"; - self.startPage = delegate.startPage; - if (self.startPage == nil) { - self.startPage = @"index.html"; - } - - // Initialize the plugin objects dict. - self.pluginObjects = [[NSMutableDictionary alloc] initWithCapacity:20]; -} - -- (NSURL*)appUrl -{ - NSURL* appURL = nil; - - if ([self.startPage rangeOfString:@"://"].location != NSNotFound) { - appURL = [NSURL URLWithString:self.startPage]; - } else if ([self.wwwFolderName rangeOfString:@"://"].location != NSNotFound) { - appURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@", self.wwwFolderName, self.startPage]]; - } else { - // CB-3005 strip parameters from start page to check if page exists in resources - NSURL* startURL = [NSURL URLWithString:self.startPage]; - NSString* startFilePath = [self.commandDelegate pathForResource:[startURL path]]; - - if (startFilePath == nil) { - self.loadFromString = YES; - appURL = nil; - } else { - appURL = [NSURL fileURLWithPath:startFilePath]; - // CB-3005 Add on the query params or fragment. - NSString* startPageNoParentDirs = self.startPage; - NSRange r = [startPageNoParentDirs rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"?#"] options:0]; - if (r.location != NSNotFound) { - NSString* queryAndOrFragment = [self.startPage substringFromIndex:r.location]; - appURL = [NSURL URLWithString:queryAndOrFragment relativeToURL:appURL]; - } - } - } - - return appURL; -} - -- (NSURL*)errorUrl -{ - NSURL* errorURL = nil; - - id setting = [self settingForKey:@"ErrorUrl"]; - - if (setting) { - NSString* errorUrlString = (NSString*)setting; - if ([errorUrlString rangeOfString:@"://"].location != NSNotFound) { - errorURL = [NSURL URLWithString:errorUrlString]; - } else { - NSURL* url = [NSURL URLWithString:(NSString*)setting]; - NSString* errorFilePath = [self.commandDelegate pathForResource:[url path]]; - if (errorFilePath) { - errorURL = [NSURL fileURLWithPath:errorFilePath]; - } - } - } - - return errorURL; -} - -// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. -- (void)viewDidLoad -{ - [super viewDidLoad]; - - // // Fix the iOS 5.1 SECURITY_ERR bug (CB-347), this must be before the webView is instantiated //// - - NSString* backupWebStorageType = @"cloud"; // default value - - id backupWebStorage = [self settingForKey:@"BackupWebStorage"]; - if ([backupWebStorage isKindOfClass:[NSString class]]) { - backupWebStorageType = backupWebStorage; - } - [self setSetting:backupWebStorageType forKey:@"BackupWebStorage"]; - - if (IsAtLeastiOSVersion(@"5.1")) { - [CDVLocalStorage __fixupDatabaseLocationsWithBackupType:backupWebStorageType]; - } - - // // Instantiate the WebView /////////////// - - if (!self.webView) { - [self createGapView]; - } - - // Configure WebView - _webViewDelegate = [[CDVWebViewDelegate alloc] initWithDelegate:self]; - self.webView.delegate = _webViewDelegate; - - // register this viewcontroller with the NSURLProtocol, only after the User-Agent is set - [CDVURLProtocol registerViewController:self]; - - // ///////////////// - - NSString* enableViewportScale = [self settingForKey:@"EnableViewportScale"]; - NSNumber* allowInlineMediaPlayback = [self settingForKey:@"AllowInlineMediaPlayback"]; - BOOL mediaPlaybackRequiresUserAction = YES; // default value - if ([self settingForKey:@"MediaPlaybackRequiresUserAction"]) { - mediaPlaybackRequiresUserAction = [(NSNumber*)[self settingForKey:@"MediaPlaybackRequiresUserAction"] boolValue]; - } - - self.webView.scalesPageToFit = [enableViewportScale boolValue]; - - /* - * Fire up CDVLocalStorage to work-around WebKit storage limitations: on all iOS 5.1+ versions for local-only backups, but only needed on iOS 5.1 for cloud backup. - */ - if (IsAtLeastiOSVersion(@"5.1") && (([backupWebStorageType isEqualToString:@"local"]) || - ([backupWebStorageType isEqualToString:@"cloud"] && !IsAtLeastiOSVersion(@"6.0")))) { - [self registerPlugin:[[CDVLocalStorage alloc] initWithWebView:self.webView] withClassName:NSStringFromClass([CDVLocalStorage class])]; - } - - /* - * This is for iOS 4.x, where you can allow inline <video> and <audio>, and also autoplay them - */ - if ([allowInlineMediaPlayback boolValue] && [self.webView respondsToSelector:@selector(allowsInlineMediaPlayback)]) { - self.webView.allowsInlineMediaPlayback = YES; - } - if ((mediaPlaybackRequiresUserAction == NO) && [self.webView respondsToSelector:@selector(mediaPlaybackRequiresUserAction)]) { - self.webView.mediaPlaybackRequiresUserAction = NO; - } - - // By default, overscroll bouncing is allowed. - // UIWebViewBounce has been renamed to DisallowOverscroll, but both are checked. - BOOL bounceAllowed = YES; - NSNumber* disallowOverscroll = [self settingForKey:@"DisallowOverscroll"]; - if (disallowOverscroll == nil) { - NSNumber* bouncePreference = [self settingForKey:@"UIWebViewBounce"]; - bounceAllowed = (bouncePreference == nil || [bouncePreference boolValue]); - } else { - bounceAllowed = ![disallowOverscroll boolValue]; - } - - // prevent webView from bouncing - // based on the DisallowOverscroll/UIWebViewBounce key in config.xml - if (!bounceAllowed) { - if ([self.webView respondsToSelector:@selector(scrollView)]) { - ((UIScrollView*)[self.webView scrollView]).bounces = NO; - } else { - for (id subview in self.webView.subviews) { - if ([[subview class] isSubclassOfClass:[UIScrollView class]]) { - ((UIScrollView*)subview).bounces = NO; - } - } - } - } - - NSString* decelerationSetting = [self settingForKey:@"UIWebViewDecelerationSpeed"]; - if (![@"fast" isEqualToString:decelerationSetting]) { - [self.webView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal]; - } - - /* - * iOS 6.0 UIWebView properties - */ - if (IsAtLeastiOSVersion(@"6.0")) { - BOOL keyboardDisplayRequiresUserAction = YES; // KeyboardDisplayRequiresUserAction - defaults to YES - if ([self settingForKey:@"KeyboardDisplayRequiresUserAction"] != nil) { - if ([self settingForKey:@"KeyboardDisplayRequiresUserAction"]) { - keyboardDisplayRequiresUserAction = [(NSNumber*)[self settingForKey:@"KeyboardDisplayRequiresUserAction"] boolValue]; - } - } - - // property check for compiling under iOS < 6 - if ([self.webView respondsToSelector:@selector(setKeyboardDisplayRequiresUserAction:)]) { - [self.webView setValue:[NSNumber numberWithBool:keyboardDisplayRequiresUserAction] forKey:@"keyboardDisplayRequiresUserAction"]; - } - - BOOL suppressesIncrementalRendering = NO; // SuppressesIncrementalRendering - defaults to NO - if ([self settingForKey:@"SuppressesIncrementalRendering"] != nil) { - if ([self settingForKey:@"SuppressesIncrementalRendering"]) { - suppressesIncrementalRendering = [(NSNumber*)[self settingForKey:@"SuppressesIncrementalRendering"] boolValue]; - } - } - - // property check for compiling under iOS < 6 - if ([self.webView respondsToSelector:@selector(setSuppressesIncrementalRendering:)]) { - [self.webView setValue:[NSNumber numberWithBool:suppressesIncrementalRendering] forKey:@"suppressesIncrementalRendering"]; - } - } - - /* - * iOS 7.0 UIWebView properties - */ - if (IsAtLeastiOSVersion(@"7.0")) { - SEL ios7sel = nil; - id prefObj = nil; - - CGFloat gapBetweenPages = 0.0; // default - prefObj = [self settingForKey:@"GapBetweenPages"]; - if (prefObj != nil) { - gapBetweenPages = [prefObj floatValue]; - } - - // property check for compiling under iOS < 7 - ios7sel = NSSelectorFromString(@"setGapBetweenPages:"); - if ([self.webView respondsToSelector:ios7sel]) { - [self.webView setValue:[NSNumber numberWithFloat:gapBetweenPages] forKey:@"gapBetweenPages"]; - } - - CGFloat pageLength = 0.0; // default - prefObj = [self settingForKey:@"PageLength"]; - if (prefObj != nil) { - pageLength = [[self settingForKey:@"PageLength"] floatValue]; - } - - // property check for compiling under iOS < 7 - ios7sel = NSSelectorFromString(@"setPageLength:"); - if ([self.webView respondsToSelector:ios7sel]) { - [self.webView setValue:[NSNumber numberWithBool:pageLength] forKey:@"pageLength"]; - } - - NSInteger paginationBreakingMode = 0; // default - UIWebPaginationBreakingModePage - prefObj = [self settingForKey:@"PaginationBreakingMode"]; - if (prefObj != nil) { - NSArray* validValues = @[@"page", @"column"]; - NSString* prefValue = [validValues objectAtIndex:0]; - - if ([prefObj isKindOfClass:[NSString class]]) { - prefValue = prefObj; - } - - paginationBreakingMode = [validValues indexOfObject:[prefValue lowercaseString]]; - if (paginationBreakingMode == NSNotFound) { - paginationBreakingMode = 0; - } - } - - // property check for compiling under iOS < 7 - ios7sel = NSSelectorFromString(@"setPaginationBreakingMode:"); - if ([self.webView respondsToSelector:ios7sel]) { - [self.webView setValue:[NSNumber numberWithInteger:paginationBreakingMode] forKey:@"paginationBreakingMode"]; - } - - NSInteger paginationMode = 0; // default - UIWebPaginationModeUnpaginated - prefObj = [self settingForKey:@"PaginationMode"]; - if (prefObj != nil) { - NSArray* validValues = @[@"unpaginated", @"lefttoright", @"toptobottom", @"bottomtotop", @"righttoleft"]; - NSString* prefValue = [validValues objectAtIndex:0]; - - if ([prefObj isKindOfClass:[NSString class]]) { - prefValue = prefObj; - } - - paginationMode = [validValues indexOfObject:[prefValue lowercaseString]]; - if (paginationMode == NSNotFound) { - paginationMode = 0; - } - } - - // property check for compiling under iOS < 7 - ios7sel = NSSelectorFromString(@"setPaginationMode:"); - if ([self.webView respondsToSelector:ios7sel]) { - [self.webView setValue:[NSNumber numberWithInteger:paginationMode] forKey:@"paginationMode"]; - } - } - - if ([self.startupPluginNames count] > 0) { - [CDVTimer start:@"TotalPluginStartup"]; - - for (NSString* pluginName in self.startupPluginNames) { - [CDVTimer start:pluginName]; - [self getCommandInstance:pluginName]; - [CDVTimer stop:pluginName]; - } - - [CDVTimer stop:@"TotalPluginStartup"]; - } - - [self registerPlugin:[[CDVHandleOpenURL alloc] initWithWebView:self.webView] withClassName:NSStringFromClass([CDVHandleOpenURL class])]; - - // ///////////////// - NSURL* appURL = [self appUrl]; - - [CDVUserAgentUtil acquireLock:^(NSInteger lockToken) { - _userAgentLockToken = lockToken; - [CDVUserAgentUtil setUserAgent:self.userAgent lockToken:lockToken]; - if (appURL) { - NSURLRequest* appReq = [NSURLRequest requestWithURL:appURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0]; - [self.webView loadRequest:appReq]; - } else { - NSString* loadErr = [NSString stringWithFormat:@"ERROR: Start Page at '%@/%@' was not found.", self.wwwFolderName, self.startPage]; - NSLog(@"%@", loadErr); - - NSURL* errorUrl = [self errorUrl]; - if (errorUrl) { - errorUrl = [NSURL URLWithString:[NSString stringWithFormat:@"?error=%@", [loadErr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] relativeToURL:errorUrl]; - NSLog(@"%@", [errorUrl absoluteString]); - [self.webView loadRequest:[NSURLRequest requestWithURL:errorUrl]]; - } else { - NSString* html = [NSString stringWithFormat:@"<html><body> %@ </body></html>", loadErr]; - [self.webView loadHTMLString:html baseURL:nil]; - } - } - }]; -} - -- (id)settingForKey:(NSString*)key -{ - return [[self settings] objectForKey:[key lowercaseString]]; -} - -- (void)setSetting:(id)setting forKey:(NSString*)key -{ - [[self settings] setObject:setting forKey:[key lowercaseString]]; -} - -- (NSArray*)parseInterfaceOrientations:(NSArray*)orientations -{ - NSMutableArray* result = [[NSMutableArray alloc] init]; - - if (orientations != nil) { - NSEnumerator* enumerator = [orientations objectEnumerator]; - NSString* orientationString; - - while (orientationString = [enumerator nextObject]) { - if ([orientationString isEqualToString:@"UIInterfaceOrientationPortrait"]) { - [result addObject:[NSNumber numberWithInt:UIInterfaceOrientationPortrait]]; - } else if ([orientationString isEqualToString:@"UIInterfaceOrientationPortraitUpsideDown"]) { - [result addObject:[NSNumber numberWithInt:UIInterfaceOrientationPortraitUpsideDown]]; - } else if ([orientationString isEqualToString:@"UIInterfaceOrientationLandscapeLeft"]) { - [result addObject:[NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft]]; - } else if ([orientationString isEqualToString:@"UIInterfaceOrientationLandscapeRight"]) { - [result addObject:[NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight]]; - } - } - } - - // default - if ([result count] == 0) { - [result addObject:[NSNumber numberWithInt:UIInterfaceOrientationPortrait]]; - } - - return result; -} - -- (NSInteger)mapIosOrientationToJsOrientation:(UIInterfaceOrientation)orientation -{ - switch (orientation) { - case UIInterfaceOrientationPortraitUpsideDown: - return 180; - - case UIInterfaceOrientationLandscapeLeft: - return -90; - - case UIInterfaceOrientationLandscapeRight: - return 90; - - case UIInterfaceOrientationPortrait: - return 0; - - default: - return 0; - } -} - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation -{ - // First, ask the webview via JS if it supports the new orientation - NSString* jsCall = [NSString stringWithFormat: - @"window.shouldRotateToOrientation && window.shouldRotateToOrientation(%ld);" - , (long)[self mapIosOrientationToJsOrientation:interfaceOrientation]]; - NSString* res = [webView stringByEvaluatingJavaScriptFromString:jsCall]; - - if ([res length] > 0) { - return [res boolValue]; - } - - // if js did not handle the new orientation (no return value), use values from the plist (via supportedOrientations) - return [self supportsOrientation:interfaceOrientation]; -} - -- (BOOL)shouldAutorotate -{ - return YES; -} - -- (NSUInteger)supportedInterfaceOrientations -{ - NSUInteger ret = 0; - - if ([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortrait]) { - ret = ret | (1 << UIInterfaceOrientationPortrait); - } - if ([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortraitUpsideDown]) { - ret = ret | (1 << UIInterfaceOrientationPortraitUpsideDown); - } - if ([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight]) { - ret = ret | (1 << UIInterfaceOrientationLandscapeRight); - } - if ([self shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft]) { - ret = ret | (1 << UIInterfaceOrientationLandscapeLeft); - } - - return ret; -} - -- (BOOL)supportsOrientation:(UIInterfaceOrientation)orientation -{ - return [self.supportedOrientations containsObject:[NSNumber numberWithInt:orientation]]; -} - -- (UIWebView*)newCordovaViewWithFrame:(CGRect)bounds -{ - return [[UIWebView alloc] initWithFrame:bounds]; -} - -- (NSString*)userAgent -{ - if (_userAgent != nil) { - return _userAgent; - } - - NSString* localBaseUserAgent; - if (self.baseUserAgent != nil) { - localBaseUserAgent = self.baseUserAgent; - } else if ([self settingForKey:@"OverrideUserAgent"] != nil) { - localBaseUserAgent = [self settingForKey:@"OverrideUserAgent"]; - } else { - localBaseUserAgent = [CDVUserAgentUtil originalUserAgent]; - } - NSString* appendUserAgent = [self settingForKey:@"AppendUserAgent"]; - if (appendUserAgent) { - _userAgent = [NSString stringWithFormat:@"%@ %@", localBaseUserAgent, appendUserAgent]; - } else { - // Use our address as a unique number to append to the User-Agent. - _userAgent = [NSString stringWithFormat:@"%@ (%lld)", localBaseUserAgent, (long long)self]; - } - return _userAgent; -} - -- (void)createGapView -{ - CGRect webViewBounds = self.view.bounds; - - webViewBounds.origin = self.view.bounds.origin; - - self.webView = [self newCordovaViewWithFrame:webViewBounds]; - self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); - - [self.view addSubview:self.webView]; - [self.view sendSubviewToBack:self.webView]; -} - -- (void)didReceiveMemoryWarning -{ - // iterate through all the plugin objects, and call hasPendingOperation - // if at least one has a pending operation, we don't call [super didReceiveMemoryWarning] - - NSEnumerator* enumerator = [self.pluginObjects objectEnumerator]; - CDVPlugin* plugin; - - BOOL doPurge = YES; - - while ((plugin = [enumerator nextObject])) { - if (plugin.hasPendingOperation) { - NSLog(@"Plugin '%@' has a pending operation, memory purge is delayed for didReceiveMemoryWarning.", NSStringFromClass([plugin class])); - doPurge = NO; - } - } - - if (doPurge) { - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - } - - // Release any cached data, images, etc. that aren't in use. -} - -- (void)viewDidUnload -{ - // Release any retained subviews of the main view. - // e.g. self.myOutlet = nil; - - self.webView.delegate = nil; - self.webView = nil; - [CDVUserAgentUtil releaseLock:&_userAgentLockToken]; - - [super viewDidUnload]; -} - -#pragma mark UIWebViewDelegate - -/** - When web application loads Add stuff to the DOM, mainly the user-defined settings from the Settings.plist file, and - the device's data such as device ID, platform version, etc. - */ -- (void)webViewDidStartLoad:(UIWebView*)theWebView -{ - NSLog(@"Resetting plugins due to page load."); - [_commandQueue resetRequestId]; - [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginResetNotification object:self.webView]]; -} - -/** - Called when the webview finishes loading. This stops the activity view. - */ -- (void)webViewDidFinishLoad:(UIWebView*)theWebView -{ - NSLog(@"Finished load of: %@", theWebView.request.URL); - // It's safe to release the lock even if this is just a sub-frame that's finished loading. - [CDVUserAgentUtil releaseLock:&_userAgentLockToken]; - - /* - * Hide the Top Activity THROBBER in the Battery Bar - */ - [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; - - [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPageDidLoadNotification object:self.webView]]; -} - -- (void)webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error -{ - [CDVUserAgentUtil releaseLock:&_userAgentLockToken]; - - NSString* message = [NSString stringWithFormat:@"Failed to load webpage with error: %@", [error localizedDescription]]; - NSLog(@"%@", message); - - NSURL* errorUrl = [self errorUrl]; - if (errorUrl) { - errorUrl = [NSURL URLWithString:[NSString stringWithFormat:@"?error=%@", [message stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] relativeToURL:errorUrl]; - NSLog(@"%@", [errorUrl absoluteString]); - [theWebView loadRequest:[NSURLRequest requestWithURL:errorUrl]]; - } -} - -- (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType -{ - NSURL* url = [request URL]; - - /* - * Execute any commands queued with cordova.exec() on the JS side. - * The part of the URL after gap:// is irrelevant. - */ - if ([[url scheme] isEqualToString:@"gap"]) { - [_commandQueue fetchCommandsFromJs]; - // The delegate is called asynchronously in this case, so we don't have to use - // flushCommandQueueWithDelayedJs (setTimeout(0)) as we do with hash changes. - [_commandQueue executePending]; - return NO; - } - - if ([[url fragment] hasPrefix:@"%01"] || [[url fragment] hasPrefix:@"%02"]) { - // Delegate is called *immediately* for hash changes. This means that any - // calls to stringByEvaluatingJavascriptFromString will occur in the middle - // of an existing (paused) call stack. This doesn't cause errors, but may - // be unexpected to callers (exec callbacks will be called before exec() even - // returns). To avoid this, we do not do any synchronous JS evals by using - // flushCommandQueueWithDelayedJs. - NSString* inlineCommands = [[url fragment] substringFromIndex:3]; - if ([inlineCommands length] == 0) { - // Reach in right away since the WebCore / Main thread are already synchronized. - [_commandQueue fetchCommandsFromJs]; - } else { - inlineCommands = [inlineCommands stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - [_commandQueue enqueueCommandBatch:inlineCommands]; - } - // Switch these for minor performance improvements, and to really live on the wild side. - // Callbacks will occur in the middle of the location.hash = ... statement! - [(CDVCommandDelegateImpl*)_commandDelegate flushCommandQueueWithDelayedJs]; - // [_commandQueue executePending]; - - // Although we return NO, the hash change does end up taking effect. - return NO; - } - - /* - * Give plugins the chance to handle the url - */ - for (NSString* pluginName in pluginObjects) { - CDVPlugin* plugin = [pluginObjects objectForKey:pluginName]; - SEL selector = NSSelectorFromString(@"shouldOverrideLoadWithRequest:navigationType:"); - if ([plugin respondsToSelector:selector]) { - if (((BOOL (*)(id, SEL, id, int))objc_msgSend)(plugin, selector, request, navigationType) == YES) { - return NO; - } - } - } - - /* - * If a URL is being loaded that's a file/http/https URL, just load it internally - */ - if ([url isFileURL]) { - return YES; - } - - /* - * If we loaded the HTML from a string, we let the app handle it - */ - else if (self.loadFromString == YES) { - self.loadFromString = NO; - return YES; - } - - /* - * all tel: scheme urls we let the UIWebview handle it using the default behavior - */ - else if ([[url scheme] isEqualToString:@"tel"]) { - return YES; - } - - /* - * all about: scheme urls are not handled - */ - else if ([[url scheme] isEqualToString:@"about"]) { - return NO; - } - - /* - * all data: scheme urls are handled - */ - else if ([[url scheme] isEqualToString:@"data"]) { - return YES; - } - - /* - * Handle all other types of urls (tel:, sms:), and requests to load a url in the main webview. - */ - else { - if ([self.whitelist schemeIsAllowed:[url scheme]]) { - return [self.whitelist URLIsAllowed:url]; - } else { - if ([[UIApplication sharedApplication] canOpenURL:url]) { - [[UIApplication sharedApplication] openURL:url]; - } else { // handle any custom schemes to plugins - [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]]; - } - } - - return NO; - } - - return YES; -} - -#pragma mark GapHelpers - -- (void)javascriptAlert:(NSString*)text -{ - NSString* jsString = [NSString stringWithFormat:@"alert('%@');", text]; - - [self.commandDelegate evalJs:jsString]; -} - -+ (NSString*)applicationDocumentsDirectory -{ - NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - NSString* basePath = (([paths count] > 0) ? ([paths objectAtIndex : 0]) : nil); - - return basePath; -} - -#pragma mark CordovaCommands - -- (void)registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className -{ - if ([plugin respondsToSelector:@selector(setViewController:)]) { - [plugin setViewController:self]; - } - - if ([plugin respondsToSelector:@selector(setCommandDelegate:)]) { - [plugin setCommandDelegate:_commandDelegate]; - } - - [self.pluginObjects setObject:plugin forKey:className]; - [plugin pluginInitialize]; -} - -- (void)registerPlugin:(CDVPlugin*)plugin withPluginName:(NSString*)pluginName -{ - if ([plugin respondsToSelector:@selector(setViewController:)]) { - [plugin setViewController:self]; - } - - if ([plugin respondsToSelector:@selector(setCommandDelegate:)]) { - [plugin setCommandDelegate:_commandDelegate]; - } - - NSString* className = NSStringFromClass([plugin class]); - [self.pluginObjects setObject:plugin forKey:className]; - [self.pluginsMap setValue:className forKey:[pluginName lowercaseString]]; - [plugin pluginInitialize]; -} - -/** - Returns an instance of a CordovaCommand object, based on its name. If one exists already, it is returned. - */ -- (id)getCommandInstance:(NSString*)pluginName -{ - // first, we try to find the pluginName in the pluginsMap - // (acts as a whitelist as well) if it does not exist, we return nil - // NOTE: plugin names are matched as lowercase to avoid problems - however, a - // possible issue is there can be duplicates possible if you had: - // "org.apache.cordova.Foo" and "org.apache.cordova.foo" - only the lower-cased entry will match - NSString* className = [self.pluginsMap objectForKey:[pluginName lowercaseString]]; - - if (className == nil) { - return nil; - } - - id obj = [self.pluginObjects objectForKey:className]; - if (!obj) { - obj = [[NSClassFromString(className)alloc] initWithWebView:webView]; - - if (obj != nil) { - [self registerPlugin:obj withClassName:className]; - } else { - NSLog(@"CDVPlugin class %@ (pluginName: %@) does not exist.", className, pluginName); - } - } - return obj; -} - -#pragma mark - - -- (NSString*)appURLScheme -{ - NSString* URLScheme = nil; - - NSArray* URLTypes = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleURLTypes"]; - - if (URLTypes != nil) { - NSDictionary* dict = [URLTypes objectAtIndex:0]; - if (dict != nil) { - NSArray* URLSchemes = [dict objectForKey:@"CFBundleURLSchemes"]; - if (URLSchemes != nil) { - URLScheme = [URLSchemes objectAtIndex:0]; - } - } - } - - return URLScheme; -} - -/** - Returns the contents of the named plist bundle, loaded as a dictionary object - */ -+ (NSDictionary*)getBundlePlist:(NSString*)plistName -{ - NSString* errorDesc = nil; - NSPropertyListFormat format; - NSString* plistPath = [[NSBundle mainBundle] pathForResource:plistName ofType:@"plist"]; - NSData* plistXML = [[NSFileManager defaultManager] contentsAtPath:plistPath]; - NSDictionary* temp = (NSDictionary*)[NSPropertyListSerialization - propertyListFromData:plistXML - mutabilityOption:NSPropertyListMutableContainersAndLeaves - format:&format errorDescription:&errorDesc]; - - return temp; -} - -#pragma mark - -#pragma mark UIApplicationDelegate impl - -/* - This method lets your application know that it is about to be terminated and purged from memory entirely - */ -- (void)onAppWillTerminate:(NSNotification*)notification -{ - // empty the tmp directory - NSFileManager* fileMgr = [[NSFileManager alloc] init]; - NSError* __autoreleasing err = nil; - - // clear contents of NSTemporaryDirectory - NSString* tempDirectoryPath = NSTemporaryDirectory(); - NSDirectoryEnumerator* directoryEnumerator = [fileMgr enumeratorAtPath:tempDirectoryPath]; - NSString* fileName = nil; - BOOL result; - - while ((fileName = [directoryEnumerator nextObject])) { - NSString* filePath = [tempDirectoryPath stringByAppendingPathComponent:fileName]; - result = [fileMgr removeItemAtPath:filePath error:&err]; - if (!result && err) { - NSLog(@"Failed to delete: %@ (error: %@)", filePath, err); - } - } -} - -/* - This method is called to let your application know that it is about to move from the active to inactive state. - You should use this method to pause ongoing tasks, disable timer, ... - */ -- (void)onAppWillResignActive:(NSNotification*)notification -{ - // NSLog(@"%@",@"applicationWillResignActive"); - [self.commandDelegate evalJs:@"cordova.fireDocumentEvent('resign');" scheduledOnRunLoop:NO]; -} - -/* - In iOS 4.0 and later, this method is called as part of the transition from the background to the inactive state. - You can use this method to undo many of the changes you made to your application upon entering the background. - invariably followed by applicationDidBecomeActive - */ -- (void)onAppWillEnterForeground:(NSNotification*)notification -{ - // NSLog(@"%@",@"applicationWillEnterForeground"); - [self.commandDelegate evalJs:@"cordova.fireDocumentEvent('resume');"]; - - /** Clipboard fix **/ - UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; - NSString *string = pasteboard.string; - if (string) { - [pasteboard setValue:string forPasteboardType:@"public.text"]; - } -} - -// This method is called to let your application know that it moved from the inactive to active state. -- (void)onAppDidBecomeActive:(NSNotification*)notification -{ - // NSLog(@"%@",@"applicationDidBecomeActive"); - [self.commandDelegate evalJs:@"cordova.fireDocumentEvent('active');"]; -} - -/* - In iOS 4.0 and later, this method is called instead of the applicationWillTerminate: method - when the user quits an application that supports background execution. - */ -- (void)onAppDidEnterBackground:(NSNotification*)notification -{ - // NSLog(@"%@",@"applicationDidEnterBackground"); - [self.commandDelegate evalJs:@"cordova.fireDocumentEvent('pause', null, true);" scheduledOnRunLoop:NO]; -} - -// /////////////////////// - -- (void)onPageDidLoad:(NSNotification*)notification -{ - if (self.openURL) { - [self processOpenUrl:self.openURL pageLoaded:YES]; - self.openURL = nil; - } -} - -- (void)processOpenUrl:(NSURL*)url pageLoaded:(BOOL)pageLoaded -{ - if (!pageLoaded) { - // query the webview for readystate - NSString* readyState = [webView stringByEvaluatingJavaScriptFromString:@"document.readyState"]; - pageLoaded = [readyState isEqualToString:@"loaded"] || [readyState isEqualToString:@"complete"]; - } - - if (pageLoaded) { - // calls into javascript global function 'handleOpenURL' - NSString* jsString = [NSString stringWithFormat:@"if (typeof handleOpenURL === 'function') { handleOpenURL(\"%@\");}", url]; - [self.webView stringByEvaluatingJavaScriptFromString:jsString]; - } else { - // save for when page has loaded - self.openURL = url; - } -} - -- (void)processOpenUrl:(NSURL*)url -{ - [self processOpenUrl:url pageLoaded:NO]; -} - -// /////////////////////// - -- (void)dealloc -{ - [CDVURLProtocol unregisterViewController:self]; - [[NSNotificationCenter defaultCenter] removeObserver:self]; - - self.webView.delegate = nil; - self.webView = nil; - [CDVUserAgentUtil releaseLock:&_userAgentLockToken]; - [_commandQueue dispose]; - [[self.pluginObjects allValues] makeObjectsPerformSelector:@selector(dispose)]; -} - -@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/NSData+Base64.h b/StoneIsland/platforms/ios/CordovaLib/Classes/NSData+Base64.h deleted file mode 100755 index 1633a72b..00000000 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/NSData+Base64.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// NSData+Base64.h -// base64 -// -// Created by Matt Gallagher on 2009/06/03. -// Copyright 2009 Matt Gallagher. All rights reserved. -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. Permission is granted to anyone to -// use this software for any purpose, including commercial applications, and to -// alter it and redistribute it freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source -// distribution. -// - -#import <Foundation/Foundation.h> -#import "CDVAvailabilityDeprecated.h" - -void *CDVNewBase64Decode( - const char* inputBuffer, - size_t length, - size_t * outputLength); - -char *CDVNewBase64Encode( - const void* inputBuffer, - size_t length, - bool separateLines, - size_t * outputLength); - -@interface NSData (CDVBase64) - -+ (NSData*)dataFromBase64String:(NSString*)aString CDV_DEPRECATED(3.8 .0, "Use cdv_dataFromBase64String"); - -- (NSString*)base64EncodedString CDV_DEPRECATED(3.8 .0, "Use [NSData cdv_base64EncodedString]"); - -+ (NSData*)cdv_dataFromBase64String:(NSString*)aString CDV_DEPRECATED(3.9.2, "Use NSData initWithBase64EncodedString instead. This will be removed in 4.0.0"); -- (NSString*)cdv_base64EncodedString CDV_DEPRECATED(3.9.2, "Use NSData base64EncodedStringWithOptions instead. This will be removed in 4.0.0"); - -@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/NSData+Base64.m b/StoneIsland/platforms/ios/CordovaLib/Classes/NSData+Base64.m deleted file mode 100755 index 634dff67..00000000 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/NSData+Base64.m +++ /dev/null @@ -1,308 +0,0 @@ -// -// NSData+Base64.m -// base64 -// -// Created by Matt Gallagher on 2009/06/03. -// Copyright 2009 Matt Gallagher. All rights reserved. -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. Permission is granted to anyone to -// use this software for any purpose, including commercial applications, and to -// alter it and redistribute it freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source -// distribution. -// - -#import "NSData+Base64.h" - -// -// Mapping from 6 bit pattern to ASCII character. -// -static unsigned char base64EncodeLookup[65] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -// -// Definition for "masked-out" areas of the base64DecodeLookup mapping -// -#define xx 65 - -// -// Mapping from ASCII character to 6 bit pattern. -// -static unsigned char base64DecodeLookup[256] = -{ - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, 62, xx, xx, xx, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, xx, xx, xx, xx, xx, xx, - xx, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, xx, xx, xx, xx, xx, - xx, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, -}; - -// -// Fundamental sizes of the binary and base64 encode/decode units in bytes -// -#define BINARY_UNIT_SIZE 3 -#define BASE64_UNIT_SIZE 4 - -// -// NewBase64Decode -// -// Decodes the base64 ASCII string in the inputBuffer to a newly malloced -// output buffer. -// -// inputBuffer - the source ASCII string for the decode -// length - the length of the string or -1 (to specify strlen should be used) -// outputLength - if not-NULL, on output will contain the decoded length -// -// returns the decoded buffer. Must be free'd by caller. Length is given by -// outputLength. -// -void *CDVNewBase64Decode( - const char* inputBuffer, - size_t length, - size_t * outputLength) -{ - if (length == -1) { - length = strlen(inputBuffer); - } - - size_t outputBufferSize = - ((length + BASE64_UNIT_SIZE - 1) / BASE64_UNIT_SIZE) * BINARY_UNIT_SIZE; - unsigned char* outputBuffer = (unsigned char*)malloc(outputBufferSize); - - size_t i = 0; - size_t j = 0; - - while (i < length) { - // - // Accumulate 4 valid characters (ignore everything else) - // - unsigned char accumulated[BASE64_UNIT_SIZE]; - size_t accumulateIndex = 0; - - while (i < length) { - unsigned char decode = base64DecodeLookup[inputBuffer[i++]]; - if (decode != xx) { - accumulated[accumulateIndex] = decode; - accumulateIndex++; - - if (accumulateIndex == BASE64_UNIT_SIZE) { - break; - } - } - } - - // - // Store the 6 bits from each of the 4 characters as 3 bytes - // - // (Uses improved bounds checking suggested by Alexandre Colucci) - // - if (accumulateIndex >= 2) { - outputBuffer[j] = (accumulated[0] << 2) | (accumulated[1] >> 4); - } - if (accumulateIndex >= 3) { - outputBuffer[j + 1] = (accumulated[1] << 4) | (accumulated[2] >> 2); - } - if (accumulateIndex >= 4) { - outputBuffer[j + 2] = (accumulated[2] << 6) | accumulated[3]; - } - j += accumulateIndex - 1; - } - - if (outputLength) { - *outputLength = j; - } - return outputBuffer; -} - -// -// NewBase64Encode -// -// Encodes the arbitrary data in the inputBuffer as base64 into a newly malloced -// output buffer. -// -// inputBuffer - the source data for the encode -// length - the length of the input in bytes -// separateLines - if zero, no CR/LF characters will be added. Otherwise -// a CR/LF pair will be added every 64 encoded chars. -// outputLength - if not-NULL, on output will contain the encoded length -// (not including terminating 0 char) -// -// returns the encoded buffer. Must be free'd by caller. Length is given by -// outputLength. -// -char *CDVNewBase64Encode( - const void* buffer, - size_t length, - bool separateLines, - size_t * outputLength) -{ - const unsigned char* inputBuffer = (const unsigned char*)buffer; - -#define MAX_NUM_PADDING_CHARS 2 -#define OUTPUT_LINE_LENGTH 64 -#define INPUT_LINE_LENGTH ((OUTPUT_LINE_LENGTH / BASE64_UNIT_SIZE) * BINARY_UNIT_SIZE) -#define CR_LF_SIZE 2 - - // - // Byte accurate calculation of final buffer size - // - size_t outputBufferSize = - ((length / BINARY_UNIT_SIZE) - + ((length % BINARY_UNIT_SIZE) ? 1 : 0)) - * BASE64_UNIT_SIZE; - if (separateLines) { - outputBufferSize += - (outputBufferSize / OUTPUT_LINE_LENGTH) * CR_LF_SIZE; - } - - // - // Include space for a terminating zero - // - outputBufferSize += 1; - - // - // Allocate the output buffer - // - char* outputBuffer = (char*)malloc(outputBufferSize); - if (!outputBuffer) { - return NULL; - } - - size_t i = 0; - size_t j = 0; - const size_t lineLength = separateLines ? INPUT_LINE_LENGTH : length; - size_t lineEnd = lineLength; - - while (true) { - if (lineEnd > length) { - lineEnd = length; - } - - for (; i + BINARY_UNIT_SIZE - 1 < lineEnd; i += BINARY_UNIT_SIZE) { - // - // Inner loop: turn 48 bytes into 64 base64 characters - // - outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2]; - outputBuffer[j++] = base64EncodeLookup[((inputBuffer[i] & 0x03) << 4) - | ((inputBuffer[i + 1] & 0xF0) >> 4)]; - outputBuffer[j++] = base64EncodeLookup[((inputBuffer[i + 1] & 0x0F) << 2) - | ((inputBuffer[i + 2] & 0xC0) >> 6)]; - outputBuffer[j++] = base64EncodeLookup[inputBuffer[i + 2] & 0x3F]; - } - - if (lineEnd == length) { - break; - } - - // - // Add the newline - // - // outputBuffer[j++] = '\r'; - // outputBuffer[j++] = '\n'; - lineEnd += lineLength; - } - - if (i + 1 < length) { - // - // Handle the single '=' case - // - outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2]; - outputBuffer[j++] = base64EncodeLookup[((inputBuffer[i] & 0x03) << 4) - | ((inputBuffer[i + 1] & 0xF0) >> 4)]; - outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i + 1] & 0x0F) << 2]; - outputBuffer[j++] = '='; - } else if (i < length) { - // - // Handle the double '=' case - // - outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2]; - outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0x03) << 4]; - outputBuffer[j++] = '='; - outputBuffer[j++] = '='; - } - outputBuffer[j] = 0; - - // - // Set the output length and return the buffer - // - if (outputLength) { - *outputLength = j; - } - return outputBuffer; -} - -@implementation NSData (CDVBase64) - -// -// dataFromBase64String: -// -// Creates an NSData object containing the base64 decoded representation of -// the base64 string 'aString' -// -// Parameters: -// aString - the base64 string to decode -// -// returns the autoreleased NSData representation of the base64 string -// -+ (NSData*)cdv_dataFromBase64String:(NSString*)aString -{ - size_t outputLength = 0; - void* outputBuffer = CDVNewBase64Decode([aString UTF8String], [aString length], &outputLength); - - return [NSData dataWithBytesNoCopy:outputBuffer length:outputLength freeWhenDone:YES]; -} - -// -// base64EncodedString -// -// Creates an NSString object that contains the base 64 encoding of the -// receiver's data. Lines are broken at 64 characters long. -// -// returns an autoreleased NSString being the base 64 representation of the -// receiver. -// -- (NSString*)cdv_base64EncodedString -{ - size_t outputLength = 0; - char* outputBuffer = - CDVNewBase64Encode([self bytes], [self length], true, &outputLength); - - NSString* result = [[NSString alloc] initWithBytesNoCopy:outputBuffer - length:outputLength - encoding:NSASCIIStringEncoding - freeWhenDone:YES]; - - return result; -} - -+ (NSData*)dataFromBase64String:(NSString*)aString -{ - return [self cdv_dataFromBase64String:aString]; -} - -- (NSString*)base64EncodedString -{ - return [self cdv_base64EncodedString]; -} - -@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/NSDictionary+Extensions.h b/StoneIsland/platforms/ios/CordovaLib/Classes/NSDictionary+Extensions.h deleted file mode 100755 index 4020864e..00000000 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/NSDictionary+Extensions.h +++ /dev/null @@ -1,43 +0,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. - */ - -#import <Foundation/Foundation.h> -#import "CDVAvailabilityDeprecated.h" - -@interface NSDictionary (org_apache_cordova_NSDictionary_Extension) - -- (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 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 diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/NSDictionary+Extensions.m b/StoneIsland/platforms/ios/CordovaLib/Classes/NSDictionary+Extensions.m deleted file mode 100755 index 0361ff95..00000000 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/NSDictionary+Extensions.m +++ /dev/null @@ -1,159 +0,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. - */ - -#import "NSDictionary+Extensions.h" -#import <math.h> - -@implementation NSDictionary (org_apache_cordova_NSDictionary_Extension) - -- (bool)existsValue:(NSString*)expectedValue forKey:(NSString*)key -{ - id val = [self valueForKey:key]; - bool exists = false; - - if (val != nil) { - exists = [(NSString*)val compare : expectedValue options : NSCaseInsensitiveSearch] == 0; - } - - return exists; -} - -- (NSInteger)integerValueForKey:(NSString*)key defaultValue:(NSInteger)defaultValue withRange:(NSRange)range -{ - NSInteger value = defaultValue; - - NSNumber* val = [self valueForKey:key]; // value is an NSNumber - - if (val != nil) { - value = [val integerValue]; - } - - // min, max checks - value = MAX(range.location, value); - value = MIN(range.length, value); - - return value; -} - -- (NSInteger)integerValueForKey:(NSString*)key defaultValue:(NSInteger)defaultValue -{ - NSInteger value = defaultValue; - - NSNumber* val = [self valueForKey:key]; // value is an NSNumber - - if (val != nil) { - value = [val integerValue]; - } - return value; -} - -/* - * Determine the type of object stored in a dictionary - * IN: - * (BOOL*) bString - if exists will be set to YES if object is an NSString, NO if not - * (BOOL*) bNull - if exists will be set to YES if object is an NSNull, NO if not - * (BOOL*) bArray - if exists will be set to YES if object is an NSArray, NO if not - * (BOOL*) bNumber - if exists will be set to YES if object is an NSNumber, NO if not - * - * OUT: - * YES if key exists - * NO if key does not exist. Input parameters remain untouched - * - */ - -- (BOOL)typeValueForKey:(NSString*)key isArray:(BOOL*)bArray isNull:(BOOL*)bNull isNumber:(BOOL*)bNumber isString:(BOOL*)bString -{ - BOOL bExists = YES; - NSObject* value = [self objectForKey:key]; - - if (value) { - bExists = YES; - if (bString) { - *bString = [value isKindOfClass:[NSString class]]; - } - if (bNull) { - *bNull = [value isKindOfClass:[NSNull class]]; - } - if (bArray) { - *bArray = [value isKindOfClass:[NSArray class]]; - } - if (bNumber) { - *bNumber = [value isKindOfClass:[NSNumber class]]; - } - } - return bExists; -} - -- (BOOL)valueForKeyIsArray:(NSString*)key -{ - BOOL bArray = NO; - NSObject* value = [self objectForKey:key]; - - if (value) { - bArray = [value isKindOfClass:[NSArray class]]; - } - return bArray; -} - -- (BOOL)valueForKeyIsNull:(NSString*)key -{ - BOOL bNull = NO; - NSObject* value = [self objectForKey:key]; - - if (value) { - bNull = [value isKindOfClass:[NSNull class]]; - } - return bNull; -} - -- (BOOL)valueForKeyIsString:(NSString*)key -{ - BOOL bString = NO; - NSObject* value = [self objectForKey:key]; - - if (value) { - bString = [value isKindOfClass:[NSString class]]; - } - return bString; -} - -- (BOOL)valueForKeyIsNumber:(NSString*)key -{ - BOOL bNumber = NO; - NSObject* value = [self objectForKey:key]; - - if (value) { - bNumber = [value isKindOfClass:[NSNumber class]]; - } - return bNumber; -} - -- (NSDictionary*)dictionaryWithLowercaseKeys -{ - NSMutableDictionary* result = [NSMutableDictionary dictionaryWithCapacity:self.count]; - NSString* key; - - for (key in self) { - [result setObject:[self objectForKey:key] forKey:[key lowercaseString]]; - } - - return result; -} - -@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVDebug.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/CDVDebug.h index 4a0d9f92..4a0d9f92 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVDebug.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/CDVDebug.h diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVJSON_private.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/CDVJSON_private.h index afb5cc66..afb5cc66 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVJSON_private.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/CDVJSON_private.h diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVJSON_private.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/CDVJSON_private.m index 53856806..53856806 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVJSON_private.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/CDVJSON_private.m diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVShared.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/CDVPlugin+Private.h index 68acc5c2..f88638c2 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVShared.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/CDVPlugin+Private.h @@ -17,6 +17,8 @@ under the License. */ -// This file was emptied out in 3.6.0 release (July 2014). -// It will be deleted in a future release. -#import <CoreLocation/CoreLocation.h> +@interface CDVPlugin (Private) + +- (instancetype)initWithWebViewEngine:(id <CDVWebViewEngineProtocol>)theWebViewEngine; + +@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVGestureHandler/CDVGestureHandler.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVGestureHandler/CDVGestureHandler.h new file mode 100644 index 00000000..510b6ebf --- /dev/null +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVGestureHandler/CDVGestureHandler.h @@ -0,0 +1,26 @@ +/* + 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 CDVGestureHandler : CDVPlugin + +@property (nonatomic, strong) UILongPressGestureRecognizer* lpgr; + +@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVGestureHandler/CDVGestureHandler.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVGestureHandler/CDVGestureHandler.m new file mode 100644 index 00000000..242ac55b --- /dev/null +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVGestureHandler/CDVGestureHandler.m @@ -0,0 +1,74 @@ +/* + 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 "CDVGestureHandler.h" + +@implementation CDVGestureHandler + +- (void)pluginInitialize +{ + [self applyLongPressFix]; +} + +- (void)applyLongPressFix +{ + // You can't suppress 3D Touch and still have regular longpress, + // so if this is false, let's not consider the 3D Touch setting at all. + if (![self.commandDelegate.settings objectForKey:@"suppresseslongpressgesture"] || + ![[self.commandDelegate.settings objectForKey:@"suppresseslongpressgesture"] boolValue]) { + return; + } + + self.lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPressGestures:)]; + self.lpgr.minimumPressDuration = 0.45f; + self.lpgr.allowableMovement = 100.0f; + + // 0.45 is ok for 'regular longpress', 0.05-0.08 is required for '3D Touch longpress', + // but since this will also kill onclick handlers (not ontouchend) it's optional. + if ([self.commandDelegate.settings objectForKey:@"suppresses3dtouchgesture"] && + [[self.commandDelegate.settings objectForKey:@"suppresses3dtouchgesture"] boolValue]) { + self.lpgr.minimumPressDuration = 0.05f; + } + + NSArray *views = self.webView.subviews; + if (views.count == 0) { + NSLog(@"No webview subviews found, not applying the longpress fix."); + return; + } + for (int i=0; i<views.count; i++) { + UIView *webViewScrollView = views[i]; + if ([webViewScrollView isKindOfClass:[UIScrollView class]]) { + NSArray *webViewScrollViewSubViews = webViewScrollView.subviews; + UIView *browser = webViewScrollViewSubViews[0]; + [browser addGestureRecognizer:self.lpgr]; + break; + } + } +} + +- (void)handleLongPressGestures:(UILongPressGestureRecognizer*)sender +{ + if ([sender isEqual:self.lpgr]) { + if (sender.state == UIGestureRecognizerStateBegan) { + NSLog(@"Ignoring a longpress in order to suppress the magnifying glass."); + } + } +} + +@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVHandleOpenURL.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVHandleOpenURL/CDVHandleOpenURL.h index 24f461f3..f9b0bffa 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVHandleOpenURL.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVHandleOpenURL/CDVHandleOpenURL.h @@ -25,4 +25,3 @@ @property (nonatomic, assign) BOOL pageLoaded; @end - diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVHandleOpenURL.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVHandleOpenURL/CDVHandleOpenURL.m index e5dcdd5a..72199b9c 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVHandleOpenURL.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVHandleOpenURL/CDVHandleOpenURL.m @@ -30,9 +30,10 @@ - (void)applicationLaunchedWithUrl:(NSNotification*)notification { - NSURL *url = [notification object]; + NSURL* url = [notification object]; + self.url = url; - + // warm-start handler if (self.pageLoaded) { [self processOpenUrl:self.url pageLoaded:YES]; @@ -43,7 +44,7 @@ - (void)applicationPageDidLoad:(NSNotification*)notification { // cold-start handler - + self.pageLoaded = YES; if (self.url) { @@ -54,21 +55,32 @@ - (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) { + __weak __typeof(self) weakSelf = self; + + dispatch_block_t handleOpenUrl = ^(void) { // calls into javascript global function 'handleOpenURL' - NSString* jsString = [NSString stringWithFormat:@"document.addEventListener('deviceready',function(){if (typeof handleOpenURL === 'function') { handleOpenURL(\"%@\");}});", url]; - [self.webView stringByEvaluatingJavaScriptFromString:jsString]; + NSString* jsString = [NSString stringWithFormat:@"document.addEventListener('deviceready',function(){if (typeof handleOpenURL === 'function') { handleOpenURL(\"%@\");}});", url.absoluteString]; + + [weakSelf.webViewEngine evaluateJavaScript:jsString completionHandler:nil]; + }; + + if (!pageLoaded) { + NSString* jsString = @"document.readystate"; + [self.webViewEngine evaluateJavaScript:jsString + completionHandler:^(id object, NSError* error) { + if ((error == nil) && [object isKindOfClass:[NSString class]]) { + NSString* readyState = (NSString*)object; + BOOL ready = [readyState isEqualToString:@"loaded"] || [readyState isEqualToString:@"complete"]; + if (ready) { + handleOpenUrl(); + } else { + self.url = url; + } + } + }]; } else { - // save for when page has loaded - self.url = url; + handleOpenUrl(); } } - @end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.h new file mode 100644 index 00000000..ee89e1a8 --- /dev/null +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.h @@ -0,0 +1,34 @@ +/* + 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" +#import "CDVWhitelist.h" + +typedef NS_ENUM(NSInteger, CDVIntentAndNavigationFilterValue) { + CDVIntentAndNavigationFilterValueIntentAllowed, + CDVIntentAndNavigationFilterValueNavigationAllowed, + CDVIntentAndNavigationFilterValueNoneAllowed +}; + +@interface CDVIntentAndNavigationFilter : CDVPlugin <NSXMLParserDelegate> + ++ (CDVIntentAndNavigationFilterValue) filterUrl:(NSURL*)url intentsWhitelist:(CDVWhitelist*)intentsWhitelist navigationsWhitelist:(CDVWhitelist*)navigationsWhitelist; ++ (BOOL)shouldOverrideLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType filterValue:(CDVIntentAndNavigationFilterValue)filterValue; ++ (BOOL)shouldOpenURLRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType; +@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.m new file mode 100644 index 00000000..bc8f7200 --- /dev/null +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.m @@ -0,0 +1,142 @@ +/* + 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 "CDVIntentAndNavigationFilter.h" +#import <Cordova/CDV.h> + +@interface CDVIntentAndNavigationFilter () + +@property (nonatomic, readwrite) NSMutableArray* allowIntents; +@property (nonatomic, readwrite) NSMutableArray* allowNavigations; +@property (nonatomic, readwrite) CDVWhitelist* allowIntentsWhitelist; +@property (nonatomic, readwrite) CDVWhitelist* allowNavigationsWhitelist; + +@end + +@implementation CDVIntentAndNavigationFilter + +#pragma mark NSXMLParserDelegate + +- (void)parser:(NSXMLParser*)parser didStartElement:(NSString*)elementName namespaceURI:(NSString*)namespaceURI qualifiedName:(NSString*)qualifiedName attributes:(NSDictionary*)attributeDict +{ + if ([elementName isEqualToString:@"allow-navigation"]) { + [self.allowNavigations addObject:attributeDict[@"href"]]; + } + if ([elementName isEqualToString:@"allow-intent"]) { + [self.allowIntents addObject:attributeDict[@"href"]]; + } +} + +- (void)parserDidStartDocument:(NSXMLParser*)parser +{ + // file: url <allow-navigations> are added by default + self.allowNavigations = [[NSMutableArray alloc] initWithArray:@[ @"file://" ]]; + // no intents are added by default + self.allowIntents = [[NSMutableArray alloc] init]; +} + +- (void)parserDidEndDocument:(NSXMLParser*)parser +{ + self.allowIntentsWhitelist = [[CDVWhitelist alloc] initWithArray:self.allowIntents]; + self.allowNavigationsWhitelist = [[CDVWhitelist alloc] initWithArray:self.allowNavigations]; +} + +- (void)parser:(NSXMLParser*)parser parseErrorOccurred:(NSError*)parseError +{ + NSAssert(NO, @"config.xml parse error line %ld col %ld", (long)[parser lineNumber], (long)[parser columnNumber]); +} + +#pragma mark CDVPlugin + +- (void)pluginInitialize +{ + if ([self.viewController isKindOfClass:[CDVViewController class]]) { + [(CDVViewController*)self.viewController parseSettingsWithParser:self]; + } +} + ++ (CDVIntentAndNavigationFilterValue) filterUrl:(NSURL*)url intentsWhitelist:(CDVWhitelist*)intentsWhitelist navigationsWhitelist:(CDVWhitelist*)navigationsWhitelist +{ + // a URL can only allow-intent OR allow-navigation, if both are specified, + // only allow-navigation is allowed + + BOOL allowNavigationsPass = [navigationsWhitelist URLIsAllowed:url logFailure:NO]; + BOOL allowIntentPass = [intentsWhitelist URLIsAllowed:url logFailure:NO]; + + if (allowNavigationsPass && allowIntentPass) { + return CDVIntentAndNavigationFilterValueNavigationAllowed; + } else if (allowNavigationsPass) { + return CDVIntentAndNavigationFilterValueNavigationAllowed; + } else if (allowIntentPass) { + return CDVIntentAndNavigationFilterValueIntentAllowed; + } + + return CDVIntentAndNavigationFilterValueNoneAllowed; +} + +- (CDVIntentAndNavigationFilterValue) filterUrl:(NSURL*)url +{ + return [[self class] filterUrl:url intentsWhitelist:self.allowIntentsWhitelist navigationsWhitelist:self.allowNavigationsWhitelist]; +} + ++ (BOOL)shouldOpenURLRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType +{ + return (UIWebViewNavigationTypeLinkClicked == navigationType || + (UIWebViewNavigationTypeOther == navigationType && + [[request.mainDocumentURL absoluteString] isEqualToString:[request.URL absoluteString]] + ) + ); +} + ++ (BOOL)shouldOverrideLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType filterValue:(CDVIntentAndNavigationFilterValue)filterValue +{ + NSString* allowIntents_whitelistRejectionFormatString = @"ERROR External navigation rejected - <allow-intent> not set for url='%@'"; + NSString* allowNavigations_whitelistRejectionFormatString = @"ERROR Internal navigation rejected - <allow-navigation> not set for url='%@'"; + + NSURL* url = [request URL]; + + switch (filterValue) { + case CDVIntentAndNavigationFilterValueNavigationAllowed: + return YES; + case CDVIntentAndNavigationFilterValueIntentAllowed: + // only allow-intent if it's a UIWebViewNavigationTypeLinkClicked (anchor tag) OR + // it's a UIWebViewNavigationTypeOther, and it's an internal link + if ([[self class] shouldOpenURLRequest:request navigationType:navigationType]){ + [[UIApplication sharedApplication] openURL:url]; + } + + // consume the request (i.e. no error) if it wasn't handled above + return NO; + case CDVIntentAndNavigationFilterValueNoneAllowed: + // allow-navigation attempt failed for sure + NSLog(@"%@", [NSString stringWithFormat:allowNavigations_whitelistRejectionFormatString, [url absoluteString]]); + // anchor tag link means it was an allow-intent attempt that failed as well + if (UIWebViewNavigationTypeLinkClicked == navigationType) { + NSLog(@"%@", [NSString stringWithFormat:allowIntents_whitelistRejectionFormatString, [url absoluteString]]); + } + return NO; + } +} + +- (BOOL)shouldOverrideLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType +{ + return [[self class] shouldOverrideLoadWithRequest:request navigationType:navigationType filterValue:[self filterUrl:request.URL]]; +} + +@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVLocalStorage.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVLocalStorage/CDVLocalStorage.h index dec6ab3b..dec6ab3b 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVLocalStorage.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVLocalStorage/CDVLocalStorage.h diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVLocalStorage.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVLocalStorage/CDVLocalStorage.m index 8aec403b..252dfaf1 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVLocalStorage.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVLocalStorage/CDVLocalStorage.m @@ -121,10 +121,9 @@ + (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL*)URL skip:(BOOL)skip { - NSAssert(IsAtLeastiOSVersion(@"5.1"), @"Cannot mark files for NSURLIsExcludedFromBackupKey on iOS less than 5.1"); - NSError* error = nil; BOOL success = [URL setResourceValue:[NSNumber numberWithBool:skip] forKey:NSURLIsExcludedFromBackupKey error:&error]; + if (!success) { NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error); } @@ -330,10 +329,6 @@ + (void)__restoreLegacyDatabaseLocationsWithBackupType:(NSString*)backupType { // on iOS 6, if you toggle between cloud/local backup, you must move database locations. Default upgrade from iOS5.1 to iOS6 is like a toggle from local to cloud. - if (!IsAtLeastiOSVersion(@"6.0")) { - return; - } - NSString* appLibraryFolder = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString* appDocumentsFolder = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVWebViewDelegate.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.h index f6c419f7..d77f1913 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVWebViewDelegate.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.h @@ -26,7 +26,7 @@ * and didFinishLoad is called only for top-level navigations. * Relevant bug: CB-2389 */ -@interface CDVWebViewDelegate : NSObject <UIWebViewDelegate>{ +@interface CDVUIWebViewDelegate : NSObject <UIWebViewDelegate>{ __weak NSObject <UIWebViewDelegate>* _delegate; NSInteger _loadCount; NSInteger _state; diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVWebViewDelegate.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m index a7e29086..0af97dfb 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVWebViewDelegate.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m @@ -76,11 +76,11 @@ // TODO: Record order when page is re-navigated before the first navigation finishes. // -#import "CDVWebViewDelegate.h" -#import "CDVAvailability.h" +#import "CDVUIWebViewDelegate.h" // #define VerboseLog NSLog -#define VerboseLog(...) do {} while (0) +#define VerboseLog(...) do { \ +} while (0) typedef enum { STATE_IDLE = 0, @@ -101,7 +101,7 @@ static NSString *stripFragment(NSString* url) return [url substringToIndex:r.location]; } -@implementation CDVWebViewDelegate +@implementation CDVUIWebViewDelegate - (id)initWithDelegate:(NSObject <UIWebViewDelegate>*)delegate { @@ -196,12 +196,13 @@ static NSString *stripFragment(NSString* url) - (BOOL)shouldLoadRequest:(NSURLRequest*)request { NSString* scheme = [[request URL] scheme]; - - if ([scheme isEqualToString:@"mailto"] || [scheme isEqualToString:@"tel"] || [scheme isEqualToString:@"sms"] || [scheme isEqualToString:@"blob"]) { + NSArray* allowedSchemes = [NSArray arrayWithObjects:@"mailto",@"tel",@"blob",@"sms",@"data", nil]; + if([allowedSchemes containsObject:scheme]) { return YES; } - - return [NSURLConnection canHandleRequest:request]; + else { + return [NSURLConnection canHandleRequest:request]; + } } - (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType @@ -257,7 +258,7 @@ static NSString *stripFragment(NSString* url) _state = STATE_WAITING_FOR_LOAD_START; if ([_delegate respondsToSelector:@selector(webView:didFailLoadWithError:)]) { NSDictionary* errorDictionary = @{NSLocalizedDescriptionKey : description}; - NSError* error = [[NSError alloc] initWithDomain:@"CDVWebViewDelegate" code:1 userInfo:errorDictionary]; + NSError* error = [[NSError alloc] initWithDomain:@"CDVUIWebViewDelegate" code:1 userInfo:errorDictionary]; [_delegate webView:webView didFailLoadWithError:error]; } } @@ -278,19 +279,6 @@ static NSString *stripFragment(NSString* url) BOOL fireCallback = NO; switch (_state) { case STATE_IDLE: - if (IsAtLeastiOSVersion(@"6.0")) { - break; - } - // If history.go(-1) is used pre-iOS6, the shouldStartLoadWithRequest function is not called. - // Without shouldLoad, we can't distinguish an iframe from a top-level navigation. - // We could try to distinguish using [UIWebView canGoForward], but that's too much complexity, - // and would work only on the first time it was used. - - // Our work-around is to set a JS variable and poll until it disappears (from a navigation). - _state = STATE_IOS5_POLLING_FOR_LOAD_START; - _loadStartPollCount = 0; - [self setLoadToken:webView]; - [self pollForPageLoadStart:webView]; break; case STATE_CANCELLED: diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewEngine.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewEngine.h new file mode 100644 index 00000000..6a9ee77e --- /dev/null +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewEngine.h @@ -0,0 +1,27 @@ +/* + 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" +#import "CDVWebViewEngineProtocol.h" + +@interface CDVUIWebViewEngine : CDVPlugin <CDVWebViewEngineProtocol> + +@property (nonatomic, strong, readonly) id <UIWebViewDelegate> uiWebViewDelegate; + +@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewEngine.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewEngine.m new file mode 100644 index 00000000..f571d80a --- /dev/null +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewEngine.m @@ -0,0 +1,202 @@ +/* + 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 "CDVUIWebViewEngine.h" +#import "CDVUIWebViewDelegate.h" +#import "CDVUIWebViewNavigationDelegate.h" +#import "NSDictionary+CordovaPreferences.h" + +#import <objc/message.h> + +@interface CDVUIWebViewEngine () + +@property (nonatomic, strong, readwrite) UIView* engineWebView; +@property (nonatomic, strong, readwrite) id <UIWebViewDelegate> uiWebViewDelegate; +@property (nonatomic, strong, readwrite) CDVUIWebViewNavigationDelegate* navWebViewDelegate; + +@end + +@implementation CDVUIWebViewEngine + +@synthesize engineWebView = _engineWebView; + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super init]; + if (self) { + self.engineWebView = [[UIWebView alloc] initWithFrame:frame]; + NSLog(@"Using UIWebView"); + } + + return self; +} + +- (void)pluginInitialize +{ + // viewController would be available now. we attempt to set all possible delegates to it, by default + + UIWebView* uiWebView = (UIWebView*)_engineWebView; + + if ([self.viewController conformsToProtocol:@protocol(UIWebViewDelegate)]) { + self.uiWebViewDelegate = [[CDVUIWebViewDelegate alloc] initWithDelegate:(id <UIWebViewDelegate>)self.viewController]; + uiWebView.delegate = self.uiWebViewDelegate; + } else { + self.navWebViewDelegate = [[CDVUIWebViewNavigationDelegate alloc] initWithEnginePlugin:self]; + self.uiWebViewDelegate = [[CDVUIWebViewDelegate alloc] initWithDelegate:self.navWebViewDelegate]; + uiWebView.delegate = self.uiWebViewDelegate; + } + + [self updateSettings:self.commandDelegate.settings]; +} + +- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler +{ + NSString* ret = [(UIWebView*)_engineWebView stringByEvaluatingJavaScriptFromString:javaScriptString]; + + if (completionHandler) { + completionHandler(ret, nil); + } +} + +- (id)loadRequest:(NSURLRequest*)request +{ + [(UIWebView*)_engineWebView loadRequest:request]; + return nil; +} + +- (id)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL +{ + [(UIWebView*)_engineWebView loadHTMLString:string baseURL:baseURL]; + return nil; +} + +- (NSURL*)URL +{ + return [[(UIWebView*)_engineWebView request] URL]; +} + +- (BOOL) canLoadRequest:(NSURLRequest*)request +{ + return (request != nil); +} + +- (void)updateSettings:(NSDictionary*)settings +{ + UIWebView* uiWebView = (UIWebView*)_engineWebView; + + uiWebView.scalesPageToFit = [settings cordovaBoolSettingForKey:@"EnableViewportScale" defaultValue:NO]; + uiWebView.allowsInlineMediaPlayback = [settings cordovaBoolSettingForKey:@"AllowInlineMediaPlayback" defaultValue:NO]; + uiWebView.mediaPlaybackRequiresUserAction = [settings cordovaBoolSettingForKey:@"MediaPlaybackRequiresUserAction" defaultValue:YES]; + uiWebView.mediaPlaybackAllowsAirPlay = [settings cordovaBoolSettingForKey:@"MediaPlaybackAllowsAirPlay" defaultValue:YES]; + uiWebView.keyboardDisplayRequiresUserAction = [settings cordovaBoolSettingForKey:@"KeyboardDisplayRequiresUserAction" defaultValue:YES]; + uiWebView.suppressesIncrementalRendering = [settings cordovaBoolSettingForKey:@"SuppressesIncrementalRendering" defaultValue:NO]; + uiWebView.gapBetweenPages = [settings cordovaFloatSettingForKey:@"GapBetweenPages" defaultValue:0.0]; + uiWebView.pageLength = [settings cordovaFloatSettingForKey:@"PageLength" defaultValue:0.0]; + + id prefObj = nil; + + // By default, DisallowOverscroll is false (thus bounce is allowed) + BOOL bounceAllowed = !([settings cordovaBoolSettingForKey:@"DisallowOverscroll" defaultValue:NO]); + + // prevent webView from bouncing + if (!bounceAllowed) { + if ([uiWebView respondsToSelector:@selector(scrollView)]) { + ((UIScrollView*)[uiWebView scrollView]).bounces = NO; + } else { + for (id subview in self.webView.subviews) { + if ([[subview class] isSubclassOfClass:[UIScrollView class]]) { + ((UIScrollView*)subview).bounces = NO; + } + } + } + } + + NSString* decelerationSetting = [settings cordovaSettingForKey:@"UIWebViewDecelerationSpeed"]; + if (![@"fast" isEqualToString:decelerationSetting]) { + [uiWebView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal]; + } + + NSInteger paginationBreakingMode = 0; // default - UIWebPaginationBreakingModePage + prefObj = [settings cordovaSettingForKey:@"PaginationBreakingMode"]; + if (prefObj != nil) { + NSArray* validValues = @[@"page", @"column"]; + NSString* prefValue = [validValues objectAtIndex:0]; + + if ([prefObj isKindOfClass:[NSString class]]) { + prefValue = prefObj; + } + + paginationBreakingMode = [validValues indexOfObject:[prefValue lowercaseString]]; + if (paginationBreakingMode == NSNotFound) { + paginationBreakingMode = 0; + } + } + uiWebView.paginationBreakingMode = paginationBreakingMode; + + NSInteger paginationMode = 0; // default - UIWebPaginationModeUnpaginated + prefObj = [settings cordovaSettingForKey:@"PaginationMode"]; + if (prefObj != nil) { + NSArray* validValues = @[@"unpaginated", @"lefttoright", @"toptobottom", @"bottomtotop", @"righttoleft"]; + NSString* prefValue = [validValues objectAtIndex:0]; + + if ([prefObj isKindOfClass:[NSString class]]) { + prefValue = prefObj; + } + + paginationMode = [validValues indexOfObject:[prefValue lowercaseString]]; + if (paginationMode == NSNotFound) { + paginationMode = 0; + } + } + uiWebView.paginationMode = paginationMode; +} + +- (void)updateWithInfo:(NSDictionary*)info +{ + UIWebView* uiWebView = (UIWebView*)_engineWebView; + + id <UIWebViewDelegate> uiWebViewDelegate = [info objectForKey:kCDVWebViewEngineUIWebViewDelegate]; + NSDictionary* settings = [info objectForKey:kCDVWebViewEngineWebViewPreferences]; + + if (uiWebViewDelegate && + [uiWebViewDelegate conformsToProtocol:@protocol(UIWebViewDelegate)]) { + self.uiWebViewDelegate = [[CDVUIWebViewDelegate alloc] initWithDelegate:(id <UIWebViewDelegate>)self.viewController]; + uiWebView.delegate = self.uiWebViewDelegate; + } + + if (settings && [settings isKindOfClass:[NSDictionary class]]) { + [self updateSettings:settings]; + } +} + +// This forwards the methods that are in the header that are not implemented here. +// Both WKWebView and UIWebView implement the below: +// loadHTMLString:baseURL: +// loadRequest: +- (id)forwardingTargetForSelector:(SEL)aSelector +{ + return _engineWebView; +} + +- (UIView*)webView +{ + return self.engineWebView; +} + +@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVJSON.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.h index 85db545a..9138deba 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVJSON.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.h @@ -17,36 +17,13 @@ under the License. */ -#import "CDVJSON_private.h" +#import <UIKit/UIKit.h> +#import "CDVUIWebViewEngine.h" -@implementation NSArray (CDVJSONSerializing) +@interface CDVUIWebViewNavigationDelegate : NSObject <UIWebViewDelegate> -- (NSString*)JSONString -{ - return [self cdv_JSONString]; -} +@property (nonatomic, weak) CDVPlugin* enginePlugin; -@end - -@implementation NSDictionary (CDVJSONSerializing) - -- (NSString*)JSONString -{ - return [self cdv_JSONString]; -} - -@end - -@implementation NSString (CDVJSONSerializing) - -- (id)JSONObject -{ - return [self cdv_JSONObject]; -} - -- (id)JSONFragment -{ - return [self cdv_JSONFragment]; -} +- (instancetype)initWithEnginePlugin:(CDVPlugin*)enginePlugin; @end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.m new file mode 100644 index 00000000..6e316595 --- /dev/null +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.m @@ -0,0 +1,151 @@ +/* + 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 "CDVUIWebViewNavigationDelegate.h" +#import <Cordova/CDVViewController.h> +#import <Cordova/CDVCommandDelegateImpl.h> +#import <Cordova/CDVUserAgentUtil.h> +#import <objc/message.h> + +@implementation CDVUIWebViewNavigationDelegate + +- (instancetype)initWithEnginePlugin:(CDVPlugin*)theEnginePlugin +{ + self = [super init]; + if (self) { + self.enginePlugin = theEnginePlugin; + } + + return self; +} + +/** + When web application loads Add stuff to the DOM, mainly the user-defined settings from the Settings.plist file, and + the device's data such as device ID, platform version, etc. + */ +- (void)webViewDidStartLoad:(UIWebView*)theWebView +{ + NSLog(@"Resetting plugins due to page load."); + CDVViewController* vc = (CDVViewController*)self.enginePlugin.viewController; + + [vc.commandQueue resetRequestId]; + [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginResetNotification object:self.enginePlugin.webView]]; +} + +/** + Called when the webview finishes loading. This stops the activity view. + */ +- (void)webViewDidFinishLoad:(UIWebView*)theWebView +{ + NSLog(@"Finished load of: %@", theWebView.request.URL); + CDVViewController* vc = (CDVViewController*)self.enginePlugin.viewController; + + // It's safe to release the lock even if this is just a sub-frame that's finished loading. + [CDVUserAgentUtil releaseLock:vc.userAgentLockToken]; + + /* + * Hide the Top Activity THROBBER in the Battery Bar + */ + [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; + + [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPageDidLoadNotification object:self.enginePlugin.webView]]; +} + +- (void)webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error +{ + CDVViewController* vc = (CDVViewController*)self.enginePlugin.viewController; + + [CDVUserAgentUtil releaseLock:vc.userAgentLockToken]; + + NSString* message = [NSString stringWithFormat:@"Failed to load webpage with error: %@", [error localizedDescription]]; + NSLog(@"%@", message); + + NSURL* errorUrl = vc.errorURL; + if (errorUrl) { + errorUrl = [NSURL URLWithString:[NSString stringWithFormat:@"?error=%@", [message stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] relativeToURL:errorUrl]; + NSLog(@"%@", [errorUrl absoluteString]); + [theWebView loadRequest:[NSURLRequest requestWithURL:errorUrl]]; + } +} + +- (BOOL)defaultResourcePolicyForURL:(NSURL*)url +{ + /* + * If a URL is being loaded that's a file url, just load it internally + */ + if ([url isFileURL]) { + return YES; + } + + return NO; +} + +- (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType +{ + NSURL* url = [request URL]; + CDVViewController* vc = (CDVViewController*)self.enginePlugin.viewController; + + /* + * Execute any commands queued with cordova.exec() on the JS side. + * The part of the URL after gap:// is irrelevant. + */ + if ([[url scheme] isEqualToString:@"gap"]) { + [vc.commandQueue fetchCommandsFromJs]; + // The delegate is called asynchronously in this case, so we don't have to use + // flushCommandQueueWithDelayedJs (setTimeout(0)) as we do with hash changes. + [vc.commandQueue executePending]; + return NO; + } + + /* + * Give plugins the chance to handle the url + */ + BOOL anyPluginsResponded = NO; + BOOL shouldAllowRequest = NO; + + for (NSString* pluginName in vc.pluginObjects) { + CDVPlugin* plugin = [vc.pluginObjects objectForKey:pluginName]; + SEL selector = NSSelectorFromString(@"shouldOverrideLoadWithRequest:navigationType:"); + if ([plugin respondsToSelector:selector]) { + anyPluginsResponded = YES; + shouldAllowRequest = (((BOOL (*)(id, SEL, id, int))objc_msgSend)(plugin, selector, request, navigationType)); + if (!shouldAllowRequest) { + break; + } + } + } + + if (anyPluginsResponded) { + return shouldAllowRequest; + } + + /* + * Handle all other types of urls (tel:, sms:), and requests to load a url in the main webview. + */ + BOOL shouldAllowNavigation = [self defaultResourcePolicyForURL:url]; + if (shouldAllowNavigation) { + return YES; + } else { + [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]]; + } + + return NO; +} + +@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDV.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDV.h index 6cf592a0..96d6efc8 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDV.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDV.h @@ -18,24 +18,15 @@ */ #import "CDVAvailability.h" - +#import "CDVAvailabilityDeprecated.h" +#import "CDVAppDelegate.h" #import "CDVPlugin.h" +#import "CDVPluginResult.h" #import "CDVViewController.h" #import "CDVCommandDelegate.h" #import "CDVURLProtocol.h" #import "CDVInvokedUrlCommand.h" - -#import "CDVDebug.h" -#import "CDVPluginResult.h" #import "CDVWhitelist.h" -#import "CDVLocalStorage.h" #import "CDVScreenOrientationDelegate.h" #import "CDVTimer.h" - -#import "NSArray+Comparisons.h" -#import "NSData+Base64.h" -#import "NSDictionary+Extensions.h" -#import "NSMutableArray+QueueAdditions.h" -#import "UIDevice+Extensions.h" - -#import "CDVJSON.h" +#import "CDVUserAgentUtil.h" diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/NSArray+Comparisons.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVAppDelegate.h index 7dd68290..de5b518f 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/NSArray+Comparisons.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVAppDelegate.h @@ -18,10 +18,11 @@ */ #import <Foundation/Foundation.h> -#import "CDVAvailabilityDeprecated.h" +#import "CDVViewController.h" -@interface NSArray (Comparisons) +@interface CDVAppDelegate : NSObject <UIApplicationDelegate>{} -- (id)objectAtIndex:(NSUInteger)index withDefault:(id)aDefault CDV_DEPRECATED(3.8 .0, "Use [command argumentAtIndex] instead."); +@property (nonatomic, strong) IBOutlet UIWindow* window; +@property (nonatomic, strong) IBOutlet CDVViewController* viewController; @end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVAppDelegate.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVAppDelegate.m new file mode 100644 index 00000000..13c2e7bd --- /dev/null +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVAppDelegate.m @@ -0,0 +1,105 @@ +/* + 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 "CDVAppDelegate.h" + +@implementation CDVAppDelegate + +@synthesize window, viewController; + +- (id)init +{ + /** If you need to do any extra app-specific initialization, you can do it here + * -jm + **/ + NSHTTPCookieStorage* cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; + + [cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; + + int cacheSizeMemory = 8 * 1024 * 1024; // 8MB + int cacheSizeDisk = 32 * 1024 * 1024; // 32MB + NSURLCache* sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"]; + [NSURLCache setSharedURLCache:sharedCache]; + + self = [super init]; + return self; +} + +#pragma mark UIApplicationDelegate implementation + +/** + * This is main kick off after the app inits, the views and Settings are setup here. (preferred - iOS4 and up) + */ +- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions +{ + CGRect screenBounds = [[UIScreen mainScreen] bounds]; + + self.window = [[UIWindow alloc] initWithFrame:screenBounds]; + self.window.autoresizesSubviews = YES; + + // only set if not already set in subclass + if (self.viewController == nil) { + self.viewController = [[CDVViewController alloc] init]; + } + + // Set your app's start page by setting the <content src='foo.html' /> tag in config.xml. + // If necessary, uncomment the line below to override it. + // self.viewController.startPage = @"index.html"; + + // NOTE: To customize the view's frame size (which defaults to full screen), override + // [self.viewController viewWillAppear:] in your view controller. + + self.window.rootViewController = self.viewController; + [self.window makeKeyAndVisible]; + + return YES; +} + +// this happens while we are running ( in the background, or from within our own app ) +// only valid if 40x-Info.plist specifies a protocol to handle +- (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation +{ + if (!url) { + return NO; + } + + // all plugins will get the notification, and their handlers will be called + [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]]; + + return YES; +} + +#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000 +- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window +#else +- (UIInterfaceOrientationMask)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window +#endif +{ + // iPhone doesn't support upside down by default, while the iPad does. Override to allow all orientations always, and let the root view controller decide what's allowed (the supported orientations mask gets intersected). + NSUInteger supportedInterfaceOrientations = (1 << UIInterfaceOrientationPortrait) | (1 << UIInterfaceOrientationLandscapeLeft) | (1 << UIInterfaceOrientationLandscapeRight) | (1 << UIInterfaceOrientationPortraitUpsideDown); + + return supportedInterfaceOrientations; +} + +- (void)applicationDidReceiveMemoryWarning:(UIApplication*)application +{ + [[NSURLCache sharedURLCache] removeAllCachedResponses]; +} + +@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVAvailability.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVAvailability.h index 059152ea..c9244327 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVAvailability.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVAvailability.h @@ -58,17 +58,26 @@ #define __CORDOVA_3_9_0 30900 #define __CORDOVA_3_9_1 30901 #define __CORDOVA_3_9_2 30902 +#define __CORDOVA_4_0_0 40000 +#define __CORDOVA_4_0_1 40001 +#define __CORDOVA_4_1_0 40100 +#define __CORDOVA_4_1_1 40101 +#define __CORDOVA_4_2_0 40200 +#define __CORDOVA_4_2_1 40201 +#define __CORDOVA_4_3_0 40300 +/* coho:next-version,insert-before */ #define __CORDOVA_NA 99999 /* not available */ /* - #if CORDOVA_VERSION_MIN_REQUIRED >= __CORDOVA_1_7_0 - // do something when its at least 1.7.0 + #if CORDOVA_VERSION_MIN_REQUIRED >= __CORDOVA_4_0_0 + // do something when its at least 4.0.0 #else - // do something else (non 1.7.0) + // do something else (non 4.0.0) #endif */ #ifndef CORDOVA_VERSION_MIN_REQUIRED - #define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_3_9_2 + /* coho:next-version-min-required,replace-after */ + #define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_4_3_0 #endif /* @@ -91,5 +100,6 @@ #if CDV_ENABLE_EXEC_LOGGING #define CDV_EXEC_LOG NSLog #else - #define CDV_EXEC_LOG(...) do {} while (NO) + #define CDV_EXEC_LOG(...) do { \ +} while (NO) #endif diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVAvailabilityDeprecated.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVAvailabilityDeprecated.h new file mode 100644 index 00000000..abf7a16a --- /dev/null +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVAvailabilityDeprecated.h @@ -0,0 +1,26 @@ +/* + 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 <UIKit/UIKit.h> + +#ifdef __clang__ + #define CDV_DEPRECATED(version, msg) __attribute__((deprecated("Deprecated in Cordova " #version ". " msg))) +#else + #define CDV_DEPRECATED(version, msg) __attribute__((deprecated())) +#endif diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVCommandDelegate.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVCommandDelegate.h index 04df6bc7..3d9d90c9 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVCommandDelegate.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVCommandDelegate.h @@ -24,9 +24,12 @@ @class CDVPluginResult; @class CDVWhitelist; +typedef NSURL* (^ UrlTransformerBlock)(NSURL*); + @protocol CDVCommandDelegate <NSObject> @property (nonatomic, readonly) NSDictionary* settings; +@property (nonatomic, copy) UrlTransformerBlock urlTransformer; - (NSString*)pathForResource:(NSString*)resourcepath; - (id)getCommandInstance:(NSString*)pluginName; @@ -44,7 +47,5 @@ - (void)runInBackground:(void (^)())block; // Returns the User-Agent of the associated UIWebView. - (NSString*)userAgent; -// Returns whether the given URL passes the white-list. -- (BOOL)URLIsWhitelisted:(NSURL*)url; @end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVCommandDelegateImpl.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVCommandDelegateImpl.h index 05311343..05311343 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVCommandDelegateImpl.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVCommandDelegateImpl.h diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVCommandDelegateImpl.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVCommandDelegateImpl.m index be7eb63a..fd8b3e8d 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVCommandDelegateImpl.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVCommandDelegateImpl.m @@ -25,6 +25,8 @@ @implementation CDVCommandDelegateImpl +@synthesize urlTransformer; + - (id)initWithViewController:(CDVViewController*)viewController { self = [super init]; @@ -71,13 +73,18 @@ - (void)evalJsHelper2:(NSString*)js { CDV_EXEC_LOG(@"Exec: evalling: %@", [js substringToIndex:MIN([js length], 160)]); - NSString* commandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString:js]; - if ([commandsJSON length] > 0) { - CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by chaining."); - } + [_viewController.webViewEngine evaluateJavaScript:js completionHandler:^(id obj, NSError* error) { + // TODO: obj can be something other than string + if ([obj isKindOfClass:[NSString class]]) { + NSString* commandsJSON = (NSString*)obj; + if ([commandsJSON length] > 0) { + CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by chaining."); + } - [_commandQueue enqueueCommandBatch:commandsJSON]; - [_commandQueue executePending]; + [_commandQueue enqueueCommandBatch:commandsJSON]; + [_commandQueue executePending]; + } + }]; } - (void)evalJsHelper:(NSString*)js @@ -119,7 +126,7 @@ { CDV_EXEC_LOG(@"Exec(%@): Sending result. Status=%@", callbackId, result.status); // This occurs when there is are no win/fail callbacks for the call. - if ([@"INVALID" isEqualToString : callbackId]) { + if ([@"INVALID" isEqualToString:callbackId]) { return; } // This occurs when the callback id is malformed. @@ -130,8 +137,13 @@ int status = [result.status intValue]; BOOL keepCallback = [result.keepCallback boolValue]; NSString* argumentsAsJSON = [result argumentsAsJSON]; + BOOL debug = NO; + +#ifdef DEBUG + debug = YES; +#endif - NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d)", callbackId, status, argumentsAsJSON, keepCallback]; + NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d, %d)", callbackId, status, argumentsAsJSON, keepCallback, debug]; [self evalJsHelper:js]; } @@ -143,7 +155,7 @@ - (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop { - js = [NSString stringWithFormat:@"try{cordova.require('cordova/exec').nativeEvalAndFetch(function(){%@})}catch(e){console.log('exeption nativeEvalAndFetch : '+e);};", js]; + js = [NSString stringWithFormat:@"try{cordova.require('cordova/exec').nativeEvalAndFetch(function(){%@})}catch(e){console.log('exception nativeEvalAndFetch : '+e);};", js]; if (scheduledOnRunLoop) { [self evalJsHelper:js]; } else { @@ -166,12 +178,6 @@ return [_viewController userAgent]; } -- (BOOL)URLIsWhitelisted:(NSURL*)url -{ - return ![_viewController.whitelist schemeIsAllowed:[url scheme]] || - [_viewController.whitelist URLIsAllowed:url logFailure:NO]; -} - - (NSDictionary*)settings { return _viewController.settings; diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVCommandQueue.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVCommandQueue.h index 3329078a..cb7bd6e4 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVCommandQueue.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVCommandQueue.h @@ -32,7 +32,6 @@ - (void)resetRequestId; - (void)enqueueCommandBatch:(NSString*)batchJSON; -- (void)processXhrExecBridgePoke:(NSNumber*)requestId; - (void)fetchCommandsFromJs; - (void)executePending; - (BOOL)execute:(CDVInvokedUrlCommand*)command; diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVCommandQueue.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVCommandQueue.m index 48264b2a..b78ed833 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVCommandQueue.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVCommandQueue.m @@ -18,11 +18,11 @@ */ #include <objc/message.h> -#import "CDV.h" #import "CDVCommandQueue.h" #import "CDVViewController.h" #import "CDVCommandDelegateImpl.h" #import "CDVJSON_private.h" +#import "CDVDebug.h" // Parse JS on the main thread if it's shorter than this. static const NSInteger JSON_SIZE_FOR_MAIN_THREAD = 4 * 1024; // Chosen arbitrarily. @@ -74,48 +74,31 @@ static const double MAX_EXECUTION_TIME = .008; // Half of a 60fps frame. [commandBatchHolder addObject:[batchJSON cdv_JSONObject]]; } else { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^() { - NSMutableArray* result = [batchJSON cdv_JSONObject]; - @synchronized(commandBatchHolder) { - [commandBatchHolder addObject:result]; - } - [self performSelectorOnMainThread:@selector(executePending) withObject:nil waitUntilDone:NO]; - }); + NSMutableArray* result = [batchJSON cdv_JSONObject]; + @synchronized(commandBatchHolder) { + [commandBatchHolder addObject:result]; + } + [self performSelectorOnMainThread:@selector(executePending) withObject:nil waitUntilDone:NO]; + }); } } } -- (void)processXhrExecBridgePoke:(NSNumber*)requestId -{ - NSInteger rid = [requestId integerValue]; - - // An ID of 1 is a special case because that signifies the first request of - // the page. Since resetRequestId is called from webViewDidStartLoad, and the - // JS context at the time of webViewDidStartLoad is still that of the previous - // page, it's possible for requests from the previous page to come in after this - // point. We ignore these by enforcing that ID=1 be the first ID. - if ((_lastCommandQueueFlushRequestId == 0) && (rid != 1)) { - CDV_EXEC_LOG(@"Exec: Ignoring exec request from previous page."); - return; - } - - // Use the request ID to determine if we've already flushed for this request. - // This is required only because the NSURLProtocol enqueues the same request - // multiple times. - if (rid > _lastCommandQueueFlushRequestId) { - _lastCommandQueueFlushRequestId = [requestId integerValue]; - [self fetchCommandsFromJs]; - [self executePending]; - } -} - - (void)fetchCommandsFromJs { - // Grab all the queued commands from the JS side. - NSString* queuedCommandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString: - @"cordova.require('cordova/exec').nativeFetchMessages()"]; + __weak CDVCommandQueue* weakSelf = self; + NSString* js = @"cordova.require('cordova/exec').nativeFetchMessages()"; - CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0); - [self enqueueCommandBatch:queuedCommandsJSON]; + [_viewController.webViewEngine evaluateJavaScript:js + completionHandler:^(id obj, NSError* error) { + if ((error == nil) && [obj isKindOfClass:[NSString class]]) { + NSString* queuedCommandsJSON = (NSString*)obj; + CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0); + [weakSelf enqueueCommandBatch:queuedCommandsJSON]; + // this has to be called here now, because fetchCommandsFromJs is now async (previously: synchronous) + [self executePending]; + } + }]; } - (void)executePending @@ -141,7 +124,7 @@ static const double MAX_EXECUTION_TIME = .008; // Half of a 60fps frame. while ([commandBatch count] > 0) { @autoreleasepool { // Execute the commands one-at-a-time. - NSArray* jsonEntry = [commandBatch dequeue]; + NSArray* jsonEntry = [commandBatch cdv_dequeue]; if ([commandBatch count] == 0) { [_queue removeObjectAtIndex:0]; } @@ -153,7 +136,7 @@ static const double MAX_EXECUTION_TIME = .008; // Half of a 60fps frame. NSString* commandJson = [jsonEntry cdv_JSONString]; static NSUInteger maxLogLength = 1024; NSString* commandString = ([commandJson length] > maxLogLength) ? - [NSString stringWithFormat:@"%@[...]", [commandJson substringToIndex:maxLogLength]] : + [NSString stringWithFormat : @"%@[...]", [commandJson substringToIndex:maxLogLength]] : commandJson; DLog(@"FAILED pluginJSON = %@", commandString); diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVConfigParser.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVConfigParser.h index 2e06c88f..bae3d0f8 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVConfigParser.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVConfigParser.h @@ -24,7 +24,6 @@ @property (nonatomic, readonly, strong) NSMutableDictionary* pluginsDict; @property (nonatomic, readonly, strong) NSMutableDictionary* settings; -@property (nonatomic, readonly, strong) NSMutableArray* whitelistHosts; @property (nonatomic, readonly, strong) NSMutableArray* startupPluginNames; @property (nonatomic, readonly, strong) NSString* startPage; diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVConfigParser.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVConfigParser.m index 4b73b60a..ab32b4a7 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVConfigParser.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVConfigParser.m @@ -23,7 +23,6 @@ @property (nonatomic, readwrite, strong) NSMutableDictionary* pluginsDict; @property (nonatomic, readwrite, strong) NSMutableDictionary* settings; -@property (nonatomic, readwrite, strong) NSMutableArray* whitelistHosts; @property (nonatomic, readwrite, strong) NSMutableArray* startupPluginNames; @property (nonatomic, readwrite, strong) NSString* startPage; @@ -31,7 +30,7 @@ @implementation CDVConfigParser -@synthesize pluginsDict, settings, whitelistHosts, startPage, startupPluginNames; +@synthesize pluginsDict, settings, startPage, startupPluginNames; - (id)init { @@ -39,10 +38,6 @@ if (self != nil) { self.pluginsDict = [[NSMutableDictionary alloc] initWithCapacity:30]; self.settings = [[NSMutableDictionary alloc] initWithCapacity:30]; - self.whitelistHosts = [[NSMutableArray alloc] initWithCapacity:30]; - [self.whitelistHosts addObject:@"file:///*"]; - [self.whitelistHosts addObject:@"content:///*"]; - [self.whitelistHosts addObject:@"data:///*"]; self.startupPluginNames = [[NSMutableArray alloc] initWithCapacity:8]; featureName = nil; } @@ -66,8 +61,6 @@ if (paramIsOnload || attribIsOnload) { [self.startupPluginNames addObject:featureName]; } - } else if ([elementName isEqualToString:@"access"]) { - [whitelistHosts addObject:attributeDict[@"origin"]]; } else if ([elementName isEqualToString:@"content"]) { self.startPage = attributeDict[@"src"]; } diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVInvokedUrlCommand.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVInvokedUrlCommand.h index 993e0a28..993e0a28 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVInvokedUrlCommand.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVInvokedUrlCommand.h diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVInvokedUrlCommand.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVInvokedUrlCommand.m index 3a5e8e75..5b4281df 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVInvokedUrlCommand.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVInvokedUrlCommand.m @@ -19,7 +19,6 @@ #import "CDVInvokedUrlCommand.h" #import "CDVJSON_private.h" -#import "NSData+Base64.h" @implementation CDVInvokedUrlCommand @@ -85,7 +84,7 @@ newArgs = [NSMutableArray arrayWithArray:_arguments]; _arguments = newArgs; } - [newArgs replaceObjectAtIndex:i withObject:[NSData cdv_dataFromBase64String:data]]; + [newArgs replaceObjectAtIndex:i withObject:[[NSData alloc] initWithBase64EncodedString:data options:0]]; } } diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/UIDevice+Extensions.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVPlugin+Resources.h index c0c91af2..cc43b16b 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/UIDevice+Extensions.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVPlugin+Resources.h @@ -18,30 +18,22 @@ */ #import <UIKit/UIKit.h> -#import "UIDevice+Extensions.h" +#import "CDVPlugin.h" -@implementation UIDevice (org_apache_cordova_UIDevice_Extension) +@interface CDVPlugin (CDVPluginResources) -- (NSString*)uniqueAppInstanceIdentifier -{ - NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; - static NSString* UUID_KEY = @"CDVUUID"; - - NSString* app_uuid = [userDefaults stringForKey:UUID_KEY]; - - if (app_uuid == nil) { - CFUUIDRef uuidRef = CFUUIDCreate(kCFAllocatorDefault); - CFStringRef uuidString = CFUUIDCreateString(kCFAllocatorDefault, uuidRef); - - app_uuid = [NSString stringWithString:(__bridge NSString*)uuidString]; - [userDefaults setObject:app_uuid forKey:UUID_KEY]; - [userDefaults synchronize]; - - CFRelease(uuidString); - CFRelease(uuidRef); - } +/* + This will return the localized string for a key in a .bundle that is named the same as your class + For example, if your plugin class was called Foo, and you have a Spanish localized strings file, it will + try to load the desired key from Foo.bundle/es.lproj/Localizable.strings + */ +- (NSString*)pluginLocalizedString:(NSString*)key; - return app_uuid; -} +/* + This will return the image for a name in a .bundle that is named the same as your class + For example, if your plugin class was called Foo, and you have an image called "bar", + it will try to load the image from Foo.bundle/bar.png (and appropriately named retina versions) + */ +- (UIImage*)pluginImageResource:(NSString*)name; @end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/NSArray+Comparisons.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVPlugin+Resources.m index e29c03da..56907385 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/NSArray+Comparisons.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVPlugin+Resources.m @@ -17,27 +17,22 @@ under the License. */ -#import "NSArray+Comparisons.h" +#import "CDVPlugin+Resources.h" -@implementation NSArray (Comparisons) +@implementation CDVPlugin (CDVPluginResources) -- (id)objectAtIndex:(NSUInteger)index withDefault:(id)aDefault +- (NSString*)pluginLocalizedString:(NSString*)key { - id obj = nil; - - @try { - if (index < [self count]) { - obj = [self objectAtIndex:index]; - } - if ((obj == [NSNull null]) || (obj == nil)) { - return aDefault; - } - } - @catch(NSException* exception) { - NSLog(@"Exception - Name: %@ Reason: %@", [exception name], [exception reason]); - } - - return obj; + NSBundle* bundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:NSStringFromClass([self class]) ofType:@"bundle"]]; + + return [bundle localizedStringForKey:(key) value:nil table:nil]; +} + +- (UIImage*)pluginImageResource:(NSString*)name +{ + NSString* resourceIdentifier = [NSString stringWithFormat:@"%@.bundle/%@", NSStringFromClass([self class]), name]; + + return [UIImage imageNamed:resourceIdentifier]; } @end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVPlugin.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVPlugin.h index c9991e57..d59507ae 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVPlugin.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVPlugin.h @@ -22,23 +22,46 @@ #import "CDVPluginResult.h" #import "NSMutableArray+QueueAdditions.h" #import "CDVCommandDelegate.h" +#import "CDVWebViewEngineProtocol.h" + +@interface UIView (org_apache_cordova_UIView_Extension) + +@property (nonatomic, weak) UIScrollView* scrollView; + +@end extern NSString* const CDVPageDidLoadNotification; extern NSString* const CDVPluginHandleOpenURLNotification; extern NSString* const CDVPluginResetNotification; -extern NSString* const CDVLocalNotification; -extern NSString* const CDVRemoteNotification; -extern NSString* const CDVRemoteNotificationError; +extern NSString* const CDVViewWillAppearNotification; +extern NSString* const CDVViewDidAppearNotification; +extern NSString* const CDVViewWillDisappearNotification; +extern NSString* const CDVViewDidDisappearNotification; +extern NSString* const CDVViewWillLayoutSubviewsNotification; +extern NSString* const CDVViewDidLayoutSubviewsNotification; +extern NSString* const CDVViewWillTransitionToSizeNotification; + +/* + * The local and remote push notification functionality has been removed from the core in cordova-ios 4.x, + * but these constants have unfortunately have not been removed, but will be removed in 5.x. + * + * To have the same functionality as 3.x, use a third-party plugin or the experimental + * https://github.com/apache/cordova-plugins/tree/master/notification-rebroadcast + */ +extern NSString* const CDVLocalNotification CDV_DEPRECATED(4.0, "Functionality removed in 4.0, constant will be removed in 5.0"); +extern NSString* const CDVRemoteNotification CDV_DEPRECATED(4.0, "Functionality removed in 4.0, constant will be removed in 5.0"); +extern NSString* const CDVRemoteNotificationError CDV_DEPRECATED(4.0, "Functionality removed in 4.0, constant will be removed in 5.0"); @interface CDVPlugin : NSObject {} -@property (nonatomic, weak) UIWebView* webView; +@property (nonatomic, readonly, weak) UIView* webView; +@property (nonatomic, readonly, weak) id <CDVWebViewEngineProtocol> webViewEngine; + @property (nonatomic, weak) UIViewController* viewController; @property (nonatomic, weak) id <CDVCommandDelegate> commandDelegate; @property (readonly, assign) BOOL hasPendingOperation; -- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView CDV_DEPRECATED(3.9.2, "Use pluginInitialize method instead. This will be removed in 4.0.0"); - (void)pluginInitialize; - (void)handleOpenURL:(NSNotification*)notification; @@ -53,15 +76,8 @@ extern NSString* const CDVRemoteNotificationError; - (void) onResume {} - (void) onOrientationWillChange {} - (void) onOrientationDidChange {} - - (void)didReceiveLocalNotification:(NSNotification *)notification; */ - (id)appDelegate; -- (NSString*)writeJavascript:(NSString*)javascript CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate equivalent of evalJs:. This will be removed in 4.0.0"); - -- (NSString*)success:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate equivalent of sendPluginResult:callbackId. This will be removed in 4.0.0"); - -- (NSString*)error:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate equivalent of sendPluginResult:callbackId. This will be removed in 4.0.0"); - @end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVPlugin.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVPlugin.m index ea81ddd1..f16f7fbe 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVPlugin.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVPlugin.m @@ -18,6 +18,27 @@ */ #import "CDVPlugin.h" +#import "CDVPlugin+Private.h" +#import "CDVPlugin+Resources.h" +#import "CDVViewController.h" +#include <objc/message.h> + +@implementation UIView (org_apache_cordova_UIView_Extension) + +@dynamic scrollView; + +- (UIScrollView*)scrollView +{ + SEL scrollViewSelector = NSSelectorFromString(@"scrollView"); + + if ([self respondsToSelector:scrollViewSelector]) { + return ((id (*)(id, SEL))objc_msgSend)(self, scrollViewSelector); + } + + return nil; +} + +@end NSString* const CDVPageDidLoadNotification = @"CDVPageDidLoadNotification"; NSString* const CDVPluginHandleOpenURLNotification = @"CDVPluginHandleOpenURLNotification"; @@ -25,32 +46,36 @@ NSString* const CDVPluginResetNotification = @"CDVPluginResetNotification"; NSString* const CDVLocalNotification = @"CDVLocalNotification"; NSString* const CDVRemoteNotification = @"CDVRemoteNotification"; NSString* const CDVRemoteNotificationError = @"CDVRemoteNotificationError"; +NSString* const CDVViewWillAppearNotification = @"CDVViewWillAppearNotification"; +NSString* const CDVViewDidAppearNotification = @"CDVViewDidAppearNotification"; +NSString* const CDVViewWillDisappearNotification = @"CDVViewWillDisappearNotification"; +NSString* const CDVViewDidDisappearNotification = @"CDVViewDidDisappearNotification"; +NSString* const CDVViewWillLayoutSubviewsNotification = @"CDVViewWillLayoutSubviewsNotification"; +NSString* const CDVViewDidLayoutSubviewsNotification = @"CDVViewDidLayoutSubviewsNotification"; +NSString* const CDVViewWillTransitionToSizeNotification = @"CDVViewWillTransitionToSizeNotification"; @interface CDVPlugin () @property (readwrite, assign) BOOL hasPendingOperation; +@property (nonatomic, readwrite, weak) id <CDVWebViewEngineProtocol> webViewEngine; @end @implementation CDVPlugin -@synthesize webView, viewController, commandDelegate, hasPendingOperation; +@synthesize webViewEngine, viewController, commandDelegate, hasPendingOperation; +@dynamic webView; // Do not override these methods. Use pluginInitialize instead. -- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView settings:(NSDictionary*)classSettings -{ - return [self initWithWebView:theWebView]; -} - -- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView +- (instancetype)initWithWebViewEngine:(id <CDVWebViewEngineProtocol>)theWebViewEngine { self = [super init]; if (self) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppTerminate) name:UIApplicationWillTerminateNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onMemoryWarning) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleOpenURL:) name:CDVPluginHandleOpenURLNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onReset) name:CDVPluginResetNotification object:theWebView]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onReset) name:CDVPluginResetNotification object:theWebViewEngine.engineWebView]; - self.webView = theWebView; + self.webViewEngine = theWebViewEngine; } return self; } @@ -67,18 +92,31 @@ NSString* const CDVRemoteNotificationError = @"CDVRemoteNotificationError"; // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationWillChange) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil]; // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationDidChange) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; - // Added in 2.3.0 - // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveLocalNotification:) name:CDVLocalNotification object:nil]; - // Added in 2.5.0 // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad:) name:CDVPageDidLoadNotification object:self.webView]; + //Added in 4.3.0 + // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewWillAppear:) name:CDVViewWillAppearNotification object:nil]; + // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewDidAppear:) name:CDVViewDidAppearNotification object:nil]; + // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewWillDisappear:) name:CDVViewWillDisappearNotification object:nil]; + // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewDidDisappear:) name:CDVViewDidDisappearNotification object:nil]; + // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewWillLayoutSubviews:) name:CDVViewWillLayoutSubviewsNotification object:nil]; + // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewDidLayoutSubviews:) name:CDVViewDidLayoutSubviewsNotification object:nil]; + // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewWillTransitionToSize:) name:CDVViewWillTransitionToSizeNotification object:nil]; } - (void)dispose { viewController = nil; commandDelegate = nil; - webView = nil; +} + +- (UIView*)webView +{ + if (self.webViewEngine != nil) { + return self.webViewEngine.engineWebView; + } + + return nil; } /* @@ -120,7 +158,7 @@ NSString* const CDVRemoteNotificationError = @"CDVRemoteNotificationError"; - (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; // this will remove all notification unless added using addObserverForName:object:queue:usingBlock: + [[NSNotificationCenter defaultCenter] removeObserver:self]; // this will remove all notifications unless added using addObserverForName:object:queue:usingBlock: } - (id)appDelegate @@ -128,27 +166,4 @@ NSString* const CDVRemoteNotificationError = @"CDVRemoteNotificationError"; return [[UIApplication sharedApplication] delegate]; } -- (NSString*)writeJavascript:(NSString*)javascript -{ - return [self.webView stringByEvaluatingJavaScriptFromString:javascript]; -} - -- (NSString*)success:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId -{ - [self.commandDelegate evalJs:[pluginResult toSuccessCallbackString:callbackId]]; - return @""; -} - -- (NSString*)error:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId -{ - [self.commandDelegate evalJs:[pluginResult toErrorCallbackString:callbackId]]; - return @""; -} - -// default implementation does nothing, ideally, we are not registered for notification if we aren't going to do anything. -// - (void)didReceiveLocalNotification:(NSNotification *)notification -// { -// // UILocalNotification* localNotification = [notification object]; // get the payload as a LocalNotification -// } - @end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVPluginResult.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVPluginResult.h index e624d4de..56b8c232 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVPluginResult.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVPluginResult.h @@ -47,6 +47,8 @@ typedef enum { + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsString:(NSString*)theMessage; + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArray:(NSArray*)theMessage; + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsInt:(int)theMessage; ++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsNSInteger:(NSInteger)theMessage; ++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsNSUInteger:(NSUInteger)theMessage; + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDouble:(double)theMessage; + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsBool:(BOOL)theMessage; + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDictionary:(NSDictionary*)theMessage; @@ -61,11 +63,4 @@ typedef enum { - (NSString*)argumentsAsJSON; -// These methods are used by the legacy plugin return result method -- (NSString*)toJSONString CDV_DEPRECATED(3.6, "Only used by toSuccessCallbackString and toErrorCallbackString which are deprecated. This will be removed in 4.0.0"); - -- (NSString*)toSuccessCallbackString:(NSString*)callbackId CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate method sendPluginResult:callbackId instead. This will be removed in 4.0.0"); - -- (NSString*)toErrorCallbackString:(NSString*)callbackId CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate method sendPluginResult:callbackId instead. This will be removed in 4.0.0"); - @end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVPluginResult.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVPluginResult.m index 13839efd..3521e6d7 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVPluginResult.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVPluginResult.m @@ -20,7 +20,6 @@ #import "CDVPluginResult.h" #import "CDVJSON_private.h" #import "CDVDebug.h" -#import "NSData+Base64.h" @interface CDVPluginResult () @@ -37,7 +36,7 @@ id messageFromArrayBuffer(NSData* data) { return @{ @"CDVType" : @"ArrayBuffer", - @"data" :[data cdv_base64EncodedString] + @"data" :[data base64EncodedStringWithOptions:0] }; } @@ -114,6 +113,16 @@ id messageFromMultipart(NSArray* theMessages) return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithInt:theMessage]]; } ++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsNSInteger:(NSInteger)theMessage +{ + return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithInteger:theMessage]]; +} + ++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsNSUInteger:(NSUInteger)theMessage +{ + return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithUnsignedInteger:theMessage]]; +} + + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDouble:(double)theMessage { return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithDouble:theMessage]]; @@ -163,53 +172,6 @@ id messageFromMultipart(NSArray* theMessages) return argumentsJSON; } -// These methods are used by the legacy plugin return result method -- (NSString*)toJSONString -{ - NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys: - self.status, @"status", - self.message ? self. message:[NSNull null], @"message", - self.keepCallback, @"keepCallback", - nil]; - - NSError* error = nil; - NSData* jsonData = [NSJSONSerialization dataWithJSONObject:dict - options:NSJSONWritingPrettyPrinted - error:&error]; - NSString* resultString = nil; - - if (error != nil) { - NSLog(@"toJSONString error: %@", [error localizedDescription]); - } else { - resultString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; - } - - if ([[self class] isVerbose]) { - NSLog(@"PluginResult:toJSONString - %@", resultString); - } - return resultString; -} - -- (NSString*)toSuccessCallbackString:(NSString*)callbackId -{ - NSString* successCB = [NSString stringWithFormat:@"cordova.callbackSuccess('%@',%@);", callbackId, [self toJSONString]]; - - if ([[self class] isVerbose]) { - NSLog(@"PluginResult toSuccessCallbackString: %@", successCB); - } - return successCB; -} - -- (NSString*)toErrorCallbackString:(NSString*)callbackId -{ - NSString* errorCB = [NSString stringWithFormat:@"cordova.callbackError('%@',%@);", callbackId, [self toJSONString]]; - - if ([[self class] isVerbose]) { - NSLog(@"PluginResult toErrorCallbackString: %@", errorCB); - } - return errorCB; -} - static BOOL gIsVerbose = NO; + (void)setVerbose:(BOOL)verbose { diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVScreenOrientationDelegate.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVScreenOrientationDelegate.h index 7226205a..7226205a 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVScreenOrientationDelegate.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVScreenOrientationDelegate.h diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVTimer.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVTimer.h index 6d31593f..6d31593f 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVTimer.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVTimer.h diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVTimer.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVTimer.m index 784e94d3..784e94d3 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVTimer.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVTimer.m diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVURLProtocol.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVURLProtocol.h index 5444f6d1..0561e04d 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVURLProtocol.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVURLProtocol.h @@ -24,6 +24,4 @@ @interface CDVURLProtocol : NSURLProtocol {} -+ (void)registerViewController:(CDVViewController*)viewController; -+ (void)unregisterViewController:(CDVViewController*)viewController; @end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVURLProtocol.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVURLProtocol.m new file mode 100644 index 00000000..7b2c5ce5 --- /dev/null +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVURLProtocol.m @@ -0,0 +1,113 @@ +/* + 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 <AssetsLibrary/ALAsset.h> +#import <AssetsLibrary/ALAssetRepresentation.h> +#import <AssetsLibrary/ALAssetsLibrary.h> +#import <MobileCoreServices/MobileCoreServices.h> +#import "CDVURLProtocol.h" +#import "CDVCommandQueue.h" +#import "CDVViewController.h" + +// Contains a set of NSNumbers of addresses of controllers. It doesn't store +// the actual pointer to avoid retaining. +static NSMutableSet* gRegisteredControllers = nil; + +NSString* const kCDVAssetsLibraryPrefixes = @"assets-library://"; + +@implementation CDVURLProtocol + + ++ (BOOL)canInitWithRequest:(NSURLRequest*)theRequest +{ + NSURL* theUrl = [theRequest URL]; + + if ([[theUrl absoluteString] hasPrefix:kCDVAssetsLibraryPrefixes]) { + return YES; + } + + return NO; +} + ++ (NSURLRequest*)canonicalRequestForRequest:(NSURLRequest*)request +{ + // NSLog(@"%@ received %@", self, NSStringFromSelector(_cmd)); + return request; +} + +- (void)startLoading +{ + // NSLog(@"%@ received %@ - start", self, NSStringFromSelector(_cmd)); + NSURL* url = [[self request] URL]; + + if ([[url absoluteString] hasPrefix:kCDVAssetsLibraryPrefixes]) { + ALAssetsLibraryAssetForURLResultBlock resultBlock = ^(ALAsset* asset) { + if (asset) { + // We have the asset! Get the data and send it along. + ALAssetRepresentation* assetRepresentation = [asset defaultRepresentation]; + NSString* MIMEType = (__bridge_transfer NSString*)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)[assetRepresentation UTI], kUTTagClassMIMEType); + Byte* buffer = (Byte*)malloc((unsigned long)[assetRepresentation size]); + NSUInteger bufferSize = [assetRepresentation getBytes:buffer fromOffset:0.0 length:(NSUInteger)[assetRepresentation size] error:nil]; + NSData* data = [NSData dataWithBytesNoCopy:buffer length:bufferSize freeWhenDone:YES]; + [self sendResponseWithResponseCode:200 data:data mimeType:MIMEType]; + } else { + // Retrieving the asset failed for some reason. Send an error. + [self sendResponseWithResponseCode:404 data:nil mimeType:nil]; + } + }; + ALAssetsLibraryAccessFailureBlock failureBlock = ^(NSError* error) { + // Retrieving the asset failed for some reason. Send an error. + [self sendResponseWithResponseCode:401 data:nil mimeType:nil]; + }; + + ALAssetsLibrary* assetsLibrary = [[ALAssetsLibrary alloc] init]; + [assetsLibrary assetForURL:url resultBlock:resultBlock failureBlock:failureBlock]; + return; + } + + NSString* body = [NSString stringWithFormat:@"Access not allowed to URL: %@", url]; + [self sendResponseWithResponseCode:401 data:[body dataUsingEncoding:NSASCIIStringEncoding] mimeType:nil]; +} + +- (void)stopLoading +{ + // do any cleanup here +} + ++ (BOOL)requestIsCacheEquivalent:(NSURLRequest*)requestA toRequest:(NSURLRequest*)requestB +{ + return NO; +} + +- (void)sendResponseWithResponseCode:(NSInteger)statusCode data:(NSData*)data mimeType:(NSString*)mimeType +{ + if (mimeType == nil) { + mimeType = @"text/plain"; + } + + NSHTTPURLResponse* response = [[NSHTTPURLResponse alloc] initWithURL:[[self request] URL] statusCode:statusCode HTTPVersion:@"HTTP/1.1" headerFields:@{@"Content-Type" : mimeType}]; + + [[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed]; + if (data != nil) { + [[self client] URLProtocol:self didLoadData:data]; + } + [[self client] URLProtocolDidFinishLoading:self]; +} + +@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVUserAgentUtil.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVUserAgentUtil.h index 4de382f0..4de382f0 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVUserAgentUtil.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVUserAgentUtil.h diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVUserAgentUtil.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVUserAgentUtil.m index c3402d08..b589e1f3 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVUserAgentUtil.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVUserAgentUtil.m @@ -45,7 +45,9 @@ static NSMutableArray* gPendingSetUserAgentBlocks = nil; NSString* localeStr = [[NSLocale currentLocale] localeIdentifier]; // Record the model since simulator can change it without re-install (CB-5420). NSString* model = [UIDevice currentDevice].model; - NSString* systemAndLocale = [NSString stringWithFormat:@"%@ %@ %@", model, systemVersion, localeStr]; + // Record the version of the app so that we can bust the cache when it changes (CB-10078) + NSString* appVersion = [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"]; + NSString* systemAndLocale = [NSString stringWithFormat:@"%@ %@ %@ %@", appVersion, model, systemVersion, localeStr]; NSString* cordovaUserAgentVersion = [userDefaults stringForKey:kCdvUserAgentVersionKey]; gOriginalUserAgent = [userDefaults stringForKey:kCdvUserAgentKey]; diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVViewController.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVViewController.h index ed114049..90d33d22 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVViewController.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVViewController.h @@ -23,11 +23,13 @@ #import "CDVInvokedUrlCommand.h" #import "CDVCommandDelegate.h" #import "CDVCommandQueue.h" -#import "CDVWhitelist.h" #import "CDVScreenOrientationDelegate.h" #import "CDVPlugin.h" +#import "CDVWebViewEngineProtocol.h" -@interface CDVViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate>{ +@interface CDVViewController : UIViewController <CDVScreenOrientationDelegate>{ + @protected + id <CDVWebViewEngineProtocol> _webViewEngine; @protected id <CDVCommandDelegate> _commandDelegate; @protected @@ -35,18 +37,18 @@ NSString* _userAgent; } -@property (nonatomic, strong) IBOutlet UIWebView* webView; +@property (nonatomic, readonly, weak) IBOutlet UIView* webView; @property (nonatomic, readonly, strong) NSMutableDictionary* pluginObjects; @property (nonatomic, readonly, strong) NSDictionary* pluginsMap; @property (nonatomic, readonly, strong) NSMutableDictionary* settings; @property (nonatomic, readonly, strong) NSXMLParser* configParser; -@property (nonatomic, readonly, strong) CDVWhitelist* whitelist CDV_DEPRECATED(3.9.2, "Use URLisAllowed to check specific URL. This will be removed in 4.0.0"); // readonly for public -@property (nonatomic, readonly, assign) BOOL loadFromString CDV_DEPRECATED(3.9.2, "This will be removed in 4.0.0"); +@property (nonatomic, readwrite, copy) NSString* configFile; @property (nonatomic, readwrite, copy) NSString* wwwFolderName; @property (nonatomic, readwrite, copy) NSString* startPage; @property (nonatomic, readonly, strong) CDVCommandQueue* commandQueue; +@property (nonatomic, readonly, strong) id <CDVWebViewEngineProtocol> webViewEngine; @property (nonatomic, readonly, strong) id <CDVCommandDelegate> commandDelegate; /** @@ -61,15 +63,21 @@ */ @property (nonatomic, readwrite, copy) NSString* baseUserAgent; -+ (NSDictionary*)getBundlePlist:(NSString*)plistName CDV_DEPRECATED(3.9.2, "This will be removed in 4.0.0"); -+ (NSString*)applicationDocumentsDirectory CDV_DEPRECATED(3.9.2, "This will be removed in 4.0.0"); +/** + Takes/Gives an array of UIInterfaceOrientation (int) objects + ex. UIInterfaceOrientationPortrait +*/ +@property (nonatomic, readwrite, strong) NSArray* supportedOrientations; + +/** + The address of the lock token used for controlling access to setting the user-agent + */ +@property (nonatomic, readonly) NSInteger* userAgentLockToken; -- (void)printMultitaskingInfo CDV_DEPRECATED(3.9.2, "This will be removed in 4.0.0"); -- (void)createGapView CDV_DEPRECATED(3.9.2, "This will be removed in 4.0.0"); -- (UIWebView*)newCordovaViewWithFrame:(CGRect)bounds; +- (UIView*)newCordovaViewWithFrame:(CGRect)bounds; -- (void)javascriptAlert:(NSString*)text CDV_DEPRECATED(3.9.2, "Use the CDVCommandDelegate evalJs: directly. This will be removed in 4.0.0"); - (NSString*)appURLScheme; +- (NSURL*)errorURL; - (NSArray*)parseInterfaceOrientations:(NSArray*)orientations; - (BOOL)supportsOrientation:(UIInterfaceOrientation)orientation; @@ -78,7 +86,6 @@ - (void)registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className; - (void)registerPlugin:(CDVPlugin*)plugin withPluginName:(NSString*)pluginName; -- (BOOL)URLisAllowed:(NSURL*)url; -- (void)processOpenUrl:(NSURL*)url; +- (void)parseSettingsWithParser:(NSObject <NSXMLParserDelegate>*)delegate; @end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVViewController.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVViewController.m new file mode 100644 index 00000000..4019c204 --- /dev/null +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVViewController.m @@ -0,0 +1,719 @@ +/* + 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 <objc/message.h> +#import "CDV.h" +#import "CDVPlugin+Private.h" +#import "CDVUIWebViewDelegate.h" +#import "CDVConfigParser.h" +#import "CDVUserAgentUtil.h" +#import <AVFoundation/AVFoundation.h> +#import "NSDictionary+CordovaPreferences.h" +#import "CDVLocalStorage.h" +#import "CDVCommandDelegateImpl.h" + +@interface CDVViewController () { + NSInteger _userAgentLockToken; +} + +@property (nonatomic, readwrite, strong) NSXMLParser* configParser; +@property (nonatomic, readwrite, strong) NSMutableDictionary* settings; +@property (nonatomic, readwrite, strong) NSMutableDictionary* pluginObjects; +@property (nonatomic, readwrite, strong) NSMutableArray* startupPluginNames; +@property (nonatomic, readwrite, strong) NSDictionary* pluginsMap; +@property (nonatomic, readwrite, strong) id <CDVWebViewEngineProtocol> webViewEngine; + +@property (readwrite, assign) BOOL initialized; + +@property (atomic, strong) NSURL* openURL; + +@end + +@implementation CDVViewController + +@synthesize supportedOrientations; +@synthesize pluginObjects, pluginsMap, startupPluginNames; +@synthesize configParser, settings; +@synthesize wwwFolderName, startPage, initialized, openURL, baseUserAgent; +@synthesize commandDelegate = _commandDelegate; +@synthesize commandQueue = _commandQueue; +@synthesize webViewEngine = _webViewEngine; +@dynamic webView; + +- (void)__init +{ + if ((self != nil) && !self.initialized) { + _commandQueue = [[CDVCommandQueue alloc] initWithViewController:self]; + _commandDelegate = [[CDVCommandDelegateImpl alloc] initWithViewController:self]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppWillTerminate:) + name:UIApplicationWillTerminateNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppWillResignActive:) + name:UIApplicationWillResignActiveNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppDidBecomeActive:) + name:UIApplicationDidBecomeActiveNotification object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppWillEnterForeground:) + name:UIApplicationWillEnterForegroundNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppDidEnterBackground:) + name:UIApplicationDidEnterBackgroundNotification object:nil]; + + // read from UISupportedInterfaceOrientations (or UISupportedInterfaceOrientations~iPad, if its iPad) from -Info.plist + self.supportedOrientations = [self parseInterfaceOrientations: + [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UISupportedInterfaceOrientations"]]; + + [self printVersion]; + [self printMultitaskingInfo]; + [self printPlatformVersionWarning]; + self.initialized = YES; + } +} + +- (id)initWithNibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + [self __init]; + return self; +} + +- (id)initWithCoder:(NSCoder*)aDecoder +{ + self = [super initWithCoder:aDecoder]; + [self __init]; + return self; +} + +- (id)init +{ + self = [super init]; + [self __init]; + return self; +} + +- (void)printVersion +{ + NSLog(@"Apache Cordova native platform version %@ is starting.", CDV_VERSION); +} + +- (void)printPlatformVersionWarning +{ + if (!IsAtLeastiOSVersion(@"8.0")) { + NSLog(@"CRITICAL: For Cordova 4.0.0 and above, you will need to upgrade to at least iOS 8.0 or greater. Your current version of iOS is %@.", + [[UIDevice currentDevice] systemVersion] + ); + } +} + +- (void)printMultitaskingInfo +{ + UIDevice* device = [UIDevice currentDevice]; + BOOL backgroundSupported = NO; + + if ([device respondsToSelector:@selector(isMultitaskingSupported)]) { + backgroundSupported = device.multitaskingSupported; + } + + NSNumber* exitsOnSuspend = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIApplicationExitsOnSuspend"]; + if (exitsOnSuspend == nil) { // if it's missing, it should be NO (i.e. multi-tasking on by default) + exitsOnSuspend = [NSNumber numberWithBool:NO]; + } + + NSLog(@"Multi-tasking -> Device: %@, App: %@", (backgroundSupported ? @"YES" : @"NO"), (![exitsOnSuspend intValue]) ? @"YES" : @"NO"); +} + +-(NSString*)configFilePath{ + NSString* path = self.configFile ?: @"config.xml"; + + // if path is relative, resolve it against the main bundle + if(![path isAbsolutePath]){ + NSString* absolutePath = [[NSBundle mainBundle] pathForResource:path ofType:nil]; + if(!absolutePath){ + NSAssert(NO, @"ERROR: %@ not found in the main bundle!", path); + } + path = absolutePath; + } + + // Assert file exists + if (![[NSFileManager defaultManager] fileExistsAtPath:path]) { + NSAssert(NO, @"ERROR: %@ does not exist. Please run cordova-ios/bin/cordova_plist_to_config_xml path/to/project.", path); + return nil; + } + + return path; +} + +- (void)parseSettingsWithParser:(NSObject <NSXMLParserDelegate>*)delegate +{ + // read from config.xml in the app bundle + NSString* path = [self configFilePath]; + + NSURL* url = [NSURL fileURLWithPath:path]; + + self.configParser = [[NSXMLParser alloc] initWithContentsOfURL:url]; + if (self.configParser == nil) { + NSLog(@"Failed to initialize XML parser."); + return; + } + [self.configParser setDelegate:((id < NSXMLParserDelegate >)delegate)]; + [self.configParser parse]; +} + +- (void)loadSettings +{ + CDVConfigParser* delegate = [[CDVConfigParser alloc] init]; + + [self parseSettingsWithParser:delegate]; + + // Get the plugin dictionary, whitelist and settings from the delegate. + self.pluginsMap = delegate.pluginsDict; + self.startupPluginNames = delegate.startupPluginNames; + self.settings = delegate.settings; + + // And the start folder/page. + if(self.wwwFolderName == nil){ + self.wwwFolderName = @"www"; + } + if(delegate.startPage && self.startPage == nil){ + self.startPage = delegate.startPage; + } + if (self.startPage == nil) { + self.startPage = @"index.html"; + } + + // Initialize the plugin objects dict. + self.pluginObjects = [[NSMutableDictionary alloc] initWithCapacity:20]; +} + +- (NSURL*)appUrl +{ + NSURL* appURL = nil; + + if ([self.startPage rangeOfString:@"://"].location != NSNotFound) { + appURL = [NSURL URLWithString:self.startPage]; + } else if ([self.wwwFolderName rangeOfString:@"://"].location != NSNotFound) { + appURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@", self.wwwFolderName, self.startPage]]; + } else if([self.wwwFolderName hasSuffix:@".bundle"]){ + // www folder is actually a bundle + NSBundle* bundle = [NSBundle bundleWithPath:self.wwwFolderName]; + appURL = [bundle URLForResource:self.startPage withExtension:nil]; + } else if([self.wwwFolderName hasSuffix:@".framework"]){ + // www folder is actually a framework + NSBundle* bundle = [NSBundle bundleWithPath:self.wwwFolderName]; + appURL = [bundle URLForResource:self.startPage withExtension:nil]; + } else { + // CB-3005 strip parameters from start page to check if page exists in resources + NSURL* startURL = [NSURL URLWithString:self.startPage]; + NSString* startFilePath = [self.commandDelegate pathForResource:[startURL path]]; + + if (startFilePath == nil) { + appURL = nil; + } else { + appURL = [NSURL fileURLWithPath:startFilePath]; + // CB-3005 Add on the query params or fragment. + NSString* startPageNoParentDirs = self.startPage; + NSRange r = [startPageNoParentDirs rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"?#"] options:0]; + if (r.location != NSNotFound) { + NSString* queryAndOrFragment = [self.startPage substringFromIndex:r.location]; + appURL = [NSURL URLWithString:queryAndOrFragment relativeToURL:appURL]; + } + } + } + + return appURL; +} + +- (NSURL*)errorURL +{ + NSURL* errorUrl = nil; + + id setting = [self.settings cordovaSettingForKey:@"ErrorUrl"]; + + if (setting) { + NSString* errorUrlString = (NSString*)setting; + if ([errorUrlString rangeOfString:@"://"].location != NSNotFound) { + errorUrl = [NSURL URLWithString:errorUrlString]; + } else { + NSURL* url = [NSURL URLWithString:(NSString*)setting]; + NSString* errorFilePath = [self.commandDelegate pathForResource:[url path]]; + if (errorFilePath) { + errorUrl = [NSURL fileURLWithPath:errorFilePath]; + } + } + } + + return errorUrl; +} + +- (UIView*)webView +{ + if (self.webViewEngine != nil) { + return self.webViewEngine.engineWebView; + } + + return nil; +} + +// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. +- (void)viewDidLoad +{ + [super viewDidLoad]; + + // Load settings + [self loadSettings]; + + NSString* backupWebStorageType = @"cloud"; // default value + + id backupWebStorage = [self.settings cordovaSettingForKey:@"BackupWebStorage"]; + if ([backupWebStorage isKindOfClass:[NSString class]]) { + backupWebStorageType = backupWebStorage; + } + [self.settings setCordovaSetting:backupWebStorageType forKey:@"BackupWebStorage"]; + + [CDVLocalStorage __fixupDatabaseLocationsWithBackupType:backupWebStorageType]; + + // // Instantiate the WebView /////////////// + + if (!self.webView) { + [self createGapView]; + } + + // ///////////////// + + /* + * Fire up CDVLocalStorage to work-around WebKit storage limitations: on all iOS 5.1+ versions for local-only backups, but only needed on iOS 5.1 for cloud backup. + With minimum iOS 7/8 supported, only first clause applies. + */ + if ([backupWebStorageType isEqualToString:@"local"]) { + NSString* localStorageFeatureName = @"localstorage"; + if ([self.pluginsMap objectForKey:localStorageFeatureName]) { // plugin specified in config + [self.startupPluginNames addObject:localStorageFeatureName]; + } + } + + if ([self.startupPluginNames count] > 0) { + [CDVTimer start:@"TotalPluginStartup"]; + + for (NSString* pluginName in self.startupPluginNames) { + [CDVTimer start:pluginName]; + [self getCommandInstance:pluginName]; + [CDVTimer stop:pluginName]; + } + + [CDVTimer stop:@"TotalPluginStartup"]; + } + + // ///////////////// + NSURL* appURL = [self appUrl]; + + [CDVUserAgentUtil acquireLock:^(NSInteger lockToken) { + _userAgentLockToken = lockToken; + [CDVUserAgentUtil setUserAgent:self.userAgent lockToken:lockToken]; + if (appURL) { + NSURLRequest* appReq = [NSURLRequest requestWithURL:appURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0]; + [self.webViewEngine loadRequest:appReq]; + } else { + NSString* loadErr = [NSString stringWithFormat:@"ERROR: Start Page at '%@/%@' was not found.", self.wwwFolderName, self.startPage]; + NSLog(@"%@", loadErr); + + NSURL* errorUrl = [self errorURL]; + if (errorUrl) { + errorUrl = [NSURL URLWithString:[NSString stringWithFormat:@"?error=%@", [loadErr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] relativeToURL:errorUrl]; + NSLog(@"%@", [errorUrl absoluteString]); + [self.webViewEngine loadRequest:[NSURLRequest requestWithURL:errorUrl]]; + } else { + NSString* html = [NSString stringWithFormat:@"<html><body> %@ </body></html>", loadErr]; + [self.webViewEngine loadHTMLString:html baseURL:nil]; + } + } + }]; +} + +-(void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVViewWillAppearNotification object:nil]]; +} + +-(void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; + [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVViewDidAppearNotification object:nil]]; +} + +-(void)viewWillDisappear:(BOOL)animated +{ + [super viewWillDisappear:animated]; + [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVViewWillDisappearNotification object:nil]]; +} + +-(void)viewDidDisappear:(BOOL)animated +{ + [super viewDidDisappear:animated]; + [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVViewDidDisappearNotification object:nil]]; +} + +-(void)viewWillLayoutSubviews +{ + [super viewWillLayoutSubviews]; + [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVViewWillLayoutSubviewsNotification object:nil]]; +} + +-(void)viewDidLayoutSubviews +{ + [super viewDidLayoutSubviews]; + [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVViewDidLayoutSubviewsNotification object:nil]]; +} + +-(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator +{ + [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; + [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVViewWillTransitionToSizeNotification object:[NSValue valueWithCGSize:size]]]; +} + +- (NSArray*)parseInterfaceOrientations:(NSArray*)orientations +{ + NSMutableArray* result = [[NSMutableArray alloc] init]; + + if (orientations != nil) { + NSEnumerator* enumerator = [orientations objectEnumerator]; + NSString* orientationString; + + while (orientationString = [enumerator nextObject]) { + if ([orientationString isEqualToString:@"UIInterfaceOrientationPortrait"]) { + [result addObject:[NSNumber numberWithInt:UIInterfaceOrientationPortrait]]; + } else if ([orientationString isEqualToString:@"UIInterfaceOrientationPortraitUpsideDown"]) { + [result addObject:[NSNumber numberWithInt:UIInterfaceOrientationPortraitUpsideDown]]; + } else if ([orientationString isEqualToString:@"UIInterfaceOrientationLandscapeLeft"]) { + [result addObject:[NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft]]; + } else if ([orientationString isEqualToString:@"UIInterfaceOrientationLandscapeRight"]) { + [result addObject:[NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight]]; + } + } + } + + // default + if ([result count] == 0) { + [result addObject:[NSNumber numberWithInt:UIInterfaceOrientationPortrait]]; + } + + return result; +} + +- (BOOL)shouldAutorotate +{ + return YES; +} + +- (NSUInteger)supportedInterfaceOrientations +{ + NSUInteger ret = 0; + + if ([self supportsOrientation:UIInterfaceOrientationPortrait]) { + ret = ret | (1 << UIInterfaceOrientationPortrait); + } + if ([self supportsOrientation:UIInterfaceOrientationPortraitUpsideDown]) { + ret = ret | (1 << UIInterfaceOrientationPortraitUpsideDown); + } + if ([self supportsOrientation:UIInterfaceOrientationLandscapeRight]) { + ret = ret | (1 << UIInterfaceOrientationLandscapeRight); + } + if ([self supportsOrientation:UIInterfaceOrientationLandscapeLeft]) { + ret = ret | (1 << UIInterfaceOrientationLandscapeLeft); + } + + return ret; +} + +- (BOOL)supportsOrientation:(UIInterfaceOrientation)orientation +{ + return [self.supportedOrientations containsObject:[NSNumber numberWithInt:orientation]]; +} + +- (UIView*)newCordovaViewWithFrame:(CGRect)bounds +{ + NSString* defaultWebViewEngineClass = [self.settings cordovaSettingForKey:@"CordovaDefaultWebViewEngine"]; + NSString* webViewEngineClass = [self.settings cordovaSettingForKey:@"CordovaWebViewEngine"]; + + if (!defaultWebViewEngineClass) { + defaultWebViewEngineClass = @"CDVUIWebViewEngine"; + } + if (!webViewEngineClass) { + webViewEngineClass = defaultWebViewEngineClass; + } + + // Find webViewEngine + if (NSClassFromString(webViewEngineClass)) { + self.webViewEngine = [[NSClassFromString(webViewEngineClass) alloc] initWithFrame:bounds]; + // if a webView engine returns nil (not supported by the current iOS version) or doesn't conform to the protocol, or can't load the request, we use UIWebView + if (!self.webViewEngine || ![self.webViewEngine conformsToProtocol:@protocol(CDVWebViewEngineProtocol)] || ![self.webViewEngine canLoadRequest:[NSURLRequest requestWithURL:self.appUrl]]) { + self.webViewEngine = [[NSClassFromString(defaultWebViewEngineClass) alloc] initWithFrame:bounds]; + } + } else { + self.webViewEngine = [[NSClassFromString(defaultWebViewEngineClass) alloc] initWithFrame:bounds]; + } + + if ([self.webViewEngine isKindOfClass:[CDVPlugin class]]) { + [self registerPlugin:(CDVPlugin*)self.webViewEngine withClassName:webViewEngineClass]; + } + + return self.webViewEngine.engineWebView; +} + +- (NSString*)userAgent +{ + if (_userAgent != nil) { + return _userAgent; + } + + NSString* localBaseUserAgent; + if (self.baseUserAgent != nil) { + localBaseUserAgent = self.baseUserAgent; + } else if ([self.settings cordovaSettingForKey:@"OverrideUserAgent"] != nil) { + localBaseUserAgent = [self.settings cordovaSettingForKey:@"OverrideUserAgent"]; + } else { + localBaseUserAgent = [CDVUserAgentUtil originalUserAgent]; + } + NSString* appendUserAgent = [self.settings cordovaSettingForKey:@"AppendUserAgent"]; + if (appendUserAgent) { + _userAgent = [NSString stringWithFormat:@"%@ %@", localBaseUserAgent, appendUserAgent]; + } else { + // Use our address as a unique number to append to the User-Agent. + _userAgent = [NSString stringWithFormat:@"%@ (%lld)", localBaseUserAgent, (long long)self]; + } + return _userAgent; +} + +- (void)createGapView +{ + CGRect webViewBounds = self.view.bounds; + + webViewBounds.origin = self.view.bounds.origin; + + UIView* view = [self newCordovaViewWithFrame:webViewBounds]; + + view.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); + [self.view addSubview:view]; + [self.view sendSubviewToBack:view]; +} + +- (void)didReceiveMemoryWarning +{ + // iterate through all the plugin objects, and call hasPendingOperation + // if at least one has a pending operation, we don't call [super didReceiveMemoryWarning] + + NSEnumerator* enumerator = [self.pluginObjects objectEnumerator]; + CDVPlugin* plugin; + + BOOL doPurge = YES; + + while ((plugin = [enumerator nextObject])) { + if (plugin.hasPendingOperation) { + NSLog(@"Plugin '%@' has a pending operation, memory purge is delayed for didReceiveMemoryWarning.", NSStringFromClass([plugin class])); + doPurge = NO; + } + } + + if (doPurge) { + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + } + + // Release any cached data, images, etc. that aren't in use. +} + +- (void)viewDidUnload +{ + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; + + [CDVUserAgentUtil releaseLock:&_userAgentLockToken]; + + [super viewDidUnload]; +} + +#pragma mark CordovaCommands + +- (void)registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className +{ + if ([plugin respondsToSelector:@selector(setViewController:)]) { + [plugin setViewController:self]; + } + + if ([plugin respondsToSelector:@selector(setCommandDelegate:)]) { + [plugin setCommandDelegate:_commandDelegate]; + } + + [self.pluginObjects setObject:plugin forKey:className]; + [plugin pluginInitialize]; +} + +- (void)registerPlugin:(CDVPlugin*)plugin withPluginName:(NSString*)pluginName +{ + if ([plugin respondsToSelector:@selector(setViewController:)]) { + [plugin setViewController:self]; + } + + if ([plugin respondsToSelector:@selector(setCommandDelegate:)]) { + [plugin setCommandDelegate:_commandDelegate]; + } + + NSString* className = NSStringFromClass([plugin class]); + [self.pluginObjects setObject:plugin forKey:className]; + [self.pluginsMap setValue:className forKey:[pluginName lowercaseString]]; + [plugin pluginInitialize]; +} + +/** + Returns an instance of a CordovaCommand object, based on its name. If one exists already, it is returned. + */ +- (id)getCommandInstance:(NSString*)pluginName +{ + // first, we try to find the pluginName in the pluginsMap + // (acts as a whitelist as well) if it does not exist, we return nil + // NOTE: plugin names are matched as lowercase to avoid problems - however, a + // possible issue is there can be duplicates possible if you had: + // "org.apache.cordova.Foo" and "org.apache.cordova.foo" - only the lower-cased entry will match + NSString* className = [self.pluginsMap objectForKey:[pluginName lowercaseString]]; + + if (className == nil) { + return nil; + } + + id obj = [self.pluginObjects objectForKey:className]; + if (!obj) { + obj = [[NSClassFromString(className)alloc] initWithWebViewEngine:_webViewEngine]; + + if (obj != nil) { + [self registerPlugin:obj withClassName:className]; + } else { + NSLog(@"CDVPlugin class %@ (pluginName: %@) does not exist.", className, pluginName); + } + } + return obj; +} + +#pragma mark - + +- (NSString*)appURLScheme +{ + NSString* URLScheme = nil; + + NSArray* URLTypes = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleURLTypes"]; + + if (URLTypes != nil) { + NSDictionary* dict = [URLTypes objectAtIndex:0]; + if (dict != nil) { + NSArray* URLSchemes = [dict objectForKey:@"CFBundleURLSchemes"]; + if (URLSchemes != nil) { + URLScheme = [URLSchemes objectAtIndex:0]; + } + } + } + + return URLScheme; +} + +#pragma mark - +#pragma mark UIApplicationDelegate impl + +/* + This method lets your application know that it is about to be terminated and purged from memory entirely + */ +- (void)onAppWillTerminate:(NSNotification*)notification +{ + // empty the tmp directory + NSFileManager* fileMgr = [[NSFileManager alloc] init]; + NSError* __autoreleasing err = nil; + + // clear contents of NSTemporaryDirectory + NSString* tempDirectoryPath = NSTemporaryDirectory(); + NSDirectoryEnumerator* directoryEnumerator = [fileMgr enumeratorAtPath:tempDirectoryPath]; + NSString* fileName = nil; + BOOL result; + + while ((fileName = [directoryEnumerator nextObject])) { + NSString* filePath = [tempDirectoryPath stringByAppendingPathComponent:fileName]; + result = [fileMgr removeItemAtPath:filePath error:&err]; + if (!result && err) { + NSLog(@"Failed to delete: %@ (error: %@)", filePath, err); + } + } +} + +/* + This method is called to let your application know that it is about to move from the active to inactive state. + You should use this method to pause ongoing tasks, disable timer, ... + */ +- (void)onAppWillResignActive:(NSNotification*)notification +{ + // NSLog(@"%@",@"applicationWillResignActive"); + [self.commandDelegate evalJs:@"cordova.fireDocumentEvent('resign');" scheduledOnRunLoop:NO]; +} + +/* + In iOS 4.0 and later, this method is called as part of the transition from the background to the inactive state. + You can use this method to undo many of the changes you made to your application upon entering the background. + invariably followed by applicationDidBecomeActive + */ +- (void)onAppWillEnterForeground:(NSNotification*)notification +{ + // NSLog(@"%@",@"applicationWillEnterForeground"); + [self.commandDelegate evalJs:@"cordova.fireDocumentEvent('resume');"]; + + /** Clipboard fix **/ + UIPasteboard* pasteboard = [UIPasteboard generalPasteboard]; + NSString* string = pasteboard.string; + if (string) { + [pasteboard setValue:string forPasteboardType:@"public.text"]; + } +} + +// This method is called to let your application know that it moved from the inactive to active state. +- (void)onAppDidBecomeActive:(NSNotification*)notification +{ + // NSLog(@"%@",@"applicationDidBecomeActive"); + [self.commandDelegate evalJs:@"cordova.fireDocumentEvent('active');"]; +} + +/* + In iOS 4.0 and later, this method is called instead of the applicationWillTerminate: method + when the user quits an application that supports background execution. + */ +- (void)onAppDidEnterBackground:(NSNotification*)notification +{ + // NSLog(@"%@",@"applicationDidEnterBackground"); + [self.commandDelegate evalJs:@"cordova.fireDocumentEvent('pause', null, true);" scheduledOnRunLoop:NO]; +} + +// /////////////////////// + +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; + + [CDVUserAgentUtil releaseLock:&_userAgentLockToken]; + [_commandQueue dispose]; + [[self.pluginObjects allValues] makeObjectsPerformSelector:@selector(dispose)]; +} + +- (NSInteger*)userAgentLockToken +{ + return &_userAgentLockToken; +} + +@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVWebViewEngineProtocol.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVWebViewEngineProtocol.h new file mode 100644 index 00000000..34d07f3d --- /dev/null +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVWebViewEngineProtocol.h @@ -0,0 +1,42 @@ +/* + 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 <UIKit/UIKit.h> + +#define kCDVWebViewEngineScriptMessageHandlers @"kCDVWebViewEngineScriptMessageHandlers" +#define kCDVWebViewEngineUIWebViewDelegate @"kCDVWebViewEngineUIWebViewDelegate" +#define kCDVWebViewEngineWKNavigationDelegate @"kCDVWebViewEngineWKNavigationDelegate" +#define kCDVWebViewEngineWKUIDelegate @"kCDVWebViewEngineWKUIDelegate" +#define kCDVWebViewEngineWebViewPreferences @"kCDVWebViewEngineWebViewPreferences" + +@protocol CDVWebViewEngineProtocol <NSObject> + +@property (nonatomic, strong, readonly) UIView* engineWebView; + +- (id)loadRequest:(NSURLRequest*)request; +- (id)loadHTMLString:(NSString*)string baseURL:(NSURL*)baseURL; +- (void)evaluateJavaScript:(NSString*)javaScriptString completionHandler:(void (^)(id, NSError*))completionHandler; + +- (NSURL*)URL; +- (BOOL)canLoadRequest:(NSURLRequest*)request; + +- (instancetype)initWithFrame:(CGRect)frame; +- (void)updateWithInfo:(NSDictionary*)info; + +@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVWhitelist.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVWhitelist.h index 91650970..91650970 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVWhitelist.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVWhitelist.h diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVWhitelist.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVWhitelist.m index 8e3be752..552ea957 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/CDVWhitelist.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/CDVWhitelist.m @@ -64,7 +64,7 @@ NSString* const kCDVDefaultSchemeName = @"cdv-default-scheme"; } else { _scheme = [NSRegularExpression regularExpressionWithPattern:[CDVWhitelistPattern regexFromPattern:scheme allowWildcards:NO] options:NSRegularExpressionCaseInsensitive error:nil]; } - if ([host isEqualToString:@"*"]) { + if ([host isEqualToString:@"*"] || host == nil) { _host = nil; } else if ([host hasPrefix:@"*."]) { _host = [NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"([a-z0-9.-]*\\.)?%@", [CDVWhitelistPattern regexFromPattern:[host substringFromIndex:2] allowWildcards:false]] options:NSRegularExpressionCaseInsensitive error:nil]; @@ -88,7 +88,7 @@ NSString* const kCDVDefaultSchemeName = @"cdv-default-scheme"; - (bool)matches:(NSURL*)url { return (_scheme == nil || [_scheme numberOfMatchesInString:[url scheme] options:NSMatchingAnchored range:NSMakeRange(0, [[url scheme] length])]) && - (_host == nil || [_host numberOfMatchesInString:[url host] options:NSMatchingAnchored range:NSMakeRange(0, [[url host] length])]) && + (_host == nil || ([url host] != nil && [_host numberOfMatchesInString:[url host] options:NSMatchingAnchored range:NSMakeRange(0, [[url host] length])])) && (_port == nil || [[url port] isEqualToNumber:_port]) && (_path == nil || [_path numberOfMatchesInString:[url path] options:NSMatchingAnchored range:NSMakeRange(0, [[url path] length])]) ; @@ -169,7 +169,7 @@ NSString* const kCDVDefaultSchemeName = @"cdv-default-scheme"; self.whitelist = nil; self.permittedSchemes = nil; } else { // specific access - NSRegularExpression* parts = [NSRegularExpression regularExpressionWithPattern:@"^((\\*|[A-Za-z-]+)://)?(((\\*\\.)?[^*/:]+)|\\*)?(:(\\d+))?(/.*)?" options:0 error:nil]; + NSRegularExpression* parts = [NSRegularExpression regularExpressionWithPattern:@"^((\\*|[A-Za-z-]+):/?/?)?(((\\*\\.)?[^*/:]+)|\\*)?(:(\\d+))?(/.*)?" options:0 error:nil]; NSTextCheckingResult* m = [parts firstMatchInString:origin options:NSMatchingAnchored range:NSMakeRange(0, [origin length])]; if (m != nil) { NSRange r; diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/UIDevice+Extensions.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/NSDictionary+CordovaPreferences.h index 1b2c0739..9be2be2d 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/UIDevice+Extensions.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/NSDictionary+CordovaPreferences.h @@ -18,15 +18,18 @@ */ #import <Foundation/Foundation.h> -#import "CDVAvailabilityDeprecated.h" +#import <UIKit/UIKit.h> -@interface UIDevice (org_apache_cordova_UIDevice_Extension) +@interface NSDictionary (CordovaPreferences) -/* - Get the unique identifier from the app bundle's folder, which is already a GUID - Upgrading and/or deleting the app and re-installing will get you a new GUID, so - this is only unique per install per device. - */ -- (NSString*)uniqueAppInstanceIdentifier CDV_DEPRECATED(3.8 .0, "API is slated for removal in 4.0.0"); +- (id)cordovaSettingForKey:(NSString*)key; +- (BOOL)cordovaBoolSettingForKey:(NSString*)key defaultValue:(BOOL)defaultValue; +- (CGFloat)cordovaFloatSettingForKey:(NSString*)key defaultValue:(CGFloat)defaultValue; + +@end + +@interface NSMutableDictionary (CordovaPreferences) + +- (void)setCordovaSetting:(id)value forKey:(NSString*)key; @end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/Public/NSDictionary+CordovaPreferences.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/NSDictionary+CordovaPreferences.m new file mode 100644 index 00000000..dcac40f1 --- /dev/null +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/NSDictionary+CordovaPreferences.m @@ -0,0 +1,63 @@ +/* + 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 "NSDictionary+CordovaPreferences.h" +#import <Foundation/Foundation.h> + +@implementation NSDictionary (CordovaPreferences) + +- (id)cordovaSettingForKey:(NSString*)key +{ + return [self objectForKey:[key lowercaseString]]; +} + +- (BOOL)cordovaBoolSettingForKey:(NSString*)key defaultValue:(BOOL)defaultValue +{ + BOOL value = defaultValue; + id prefObj = [self cordovaSettingForKey:key]; + + if (prefObj != nil) { + value = [(NSNumber*)prefObj boolValue]; + } + + return value; +} + +- (CGFloat)cordovaFloatSettingForKey:(NSString*)key defaultValue:(CGFloat)defaultValue +{ + CGFloat value = defaultValue; + id prefObj = [self cordovaSettingForKey:key]; + + if (prefObj != nil) { + value = [prefObj floatValue]; + } + + return value; +} + +@end + +@implementation NSMutableDictionary (CordovaPreferences) + +- (void)setCordovaSetting:(id)value forKey:(NSString*)key +{ + [self setObject:value forKey:[key lowercaseString]]; +} + +@end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/NSMutableArray+QueueAdditions.h b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/NSMutableArray+QueueAdditions.h index 31940949..79e65164 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/NSMutableArray+QueueAdditions.h +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/NSMutableArray+QueueAdditions.h @@ -21,9 +21,9 @@ @interface NSMutableArray (QueueAdditions) -- (id)pop; -- (id)queueHead; -- (id)dequeue; -- (void)enqueue:(id)obj; +- (id)cdv_pop; +- (id)cdv_queueHead; +- (id)cdv_dequeue; +- (void)cdv_enqueue:(id)obj; @end diff --git a/StoneIsland/platforms/ios/CordovaLib/Classes/NSMutableArray+QueueAdditions.m b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/NSMutableArray+QueueAdditions.m index 9e67edeb..2b3acdc0 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/Classes/NSMutableArray+QueueAdditions.m +++ b/StoneIsland/platforms/ios/CordovaLib/Classes/Public/NSMutableArray+QueueAdditions.m @@ -21,7 +21,7 @@ @implementation NSMutableArray (QueueAdditions) -- (id)queueHead +- (id)cdv_queueHead { if ([self count] == 0) { return nil; @@ -30,7 +30,7 @@ return [self objectAtIndex:0]; } -- (__autoreleasing id)dequeue +- (__autoreleasing id)cdv_dequeue { if ([self count] == 0) { return nil; @@ -45,12 +45,12 @@ return head; } -- (id)pop +- (id)cdv_pop { - return [self dequeue]; + return [self cdv_dequeue]; } -- (void)enqueue:(id)object +- (void)cdv_enqueue:(id)object { [self addObject:object]; } diff --git a/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/project.pbxproj index c6b0f234..b2581715 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/project.pbxproj +++ b/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/project.pbxproj @@ -7,121 +7,120 @@ objects = { /* Begin PBXBuildFile section */ - 1B701028177A61CF00AE11F4 /* CDVShared.h in Headers */ = {isa = PBXBuildFile; fileRef = 1B701026177A61CF00AE11F4 /* CDVShared.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 1F92F4A01314023E0046367C /* CDVPluginResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F92F49E1314023E0046367C /* CDVPluginResult.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 1F92F4A11314023E0046367C /* CDVPluginResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F92F49F1314023E0046367C /* CDVPluginResult.m */; }; - 301F2F2A14F3C9CA003FE9FC /* CDV.h in Headers */ = {isa = PBXBuildFile; fileRef = 301F2F2914F3C9CA003FE9FC /* CDV.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 302965BC13A94E9D007046C5 /* CDVDebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 302965BB13A94E9D007046C5 /* CDVDebug.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3034979C1513D56A0090E688 /* CDVLocalStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 3034979A1513D56A0090E688 /* CDVLocalStorage.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3034979E1513D56A0090E688 /* CDVLocalStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 3034979B1513D56A0090E688 /* CDVLocalStorage.m */; }; - 30392E4E14F4FCAB00B9E0B8 /* CDVAvailability.h in Headers */ = {isa = PBXBuildFile; fileRef = 30392E4D14F4FCAB00B9E0B8 /* CDVAvailability.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3062D120151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3062D122151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */; }; - 3073E9ED1656D51200957977 /* CDVScreenOrientationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3073E9EC1656D51200957977 /* CDVScreenOrientationDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 30C684801406CB38004C1A8E /* CDVWhitelist.h in Headers */ = {isa = PBXBuildFile; fileRef = 30C6847E1406CB38004C1A8E /* CDVWhitelist.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 30C684821406CB38004C1A8E /* CDVWhitelist.m in Sources */ = {isa = PBXBuildFile; fileRef = 30C6847F1406CB38004C1A8E /* CDVWhitelist.m */; }; - 30C684941407044B004C1A8E /* CDVURLProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 30C684921407044A004C1A8E /* CDVURLProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 30C684961407044B004C1A8E /* CDVURLProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 30C684931407044A004C1A8E /* CDVURLProtocol.m */; }; - 30E33AF213A7E24B00594D64 /* CDVPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E33AF013A7E24B00594D64 /* CDVPlugin.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 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, ); }; }; - 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, ); }; }; - 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, ); }; }; - 7E14B5A81705050A0032169E /* CDVTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E14B5A61705050A0032169E /* CDVTimer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7E14B5A91705050A0032169E /* CDVTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E14B5A71705050A0032169E /* CDVTimer.m */; }; - 7E22B88519E4C0210026F95E /* CDVAvailabilityDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8852C43A14B65FD800F0E735 /* CDVViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 8852C43614B65FD800F0E735 /* CDVViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8852C43C14B65FD800F0E735 /* CDVViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8852C43714B65FD800F0E735 /* CDVViewController.m */; }; - 8887FD681090FBE7009987E8 /* NSDictionary+Extensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD281090FBE7009987E8 /* NSDictionary+Extensions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8887FD691090FBE7009987E8 /* NSDictionary+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 8887FD291090FBE7009987E8 /* NSDictionary+Extensions.m */; }; - 8887FD741090FBE7009987E8 /* CDVInvokedUrlCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD341090FBE7009987E8 /* CDVInvokedUrlCommand.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8887FD751090FBE7009987E8 /* CDVInvokedUrlCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 8887FD351090FBE7009987E8 /* CDVInvokedUrlCommand.m */; }; - 8887FD8F1090FBE7009987E8 /* NSData+Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8887FD501090FBE7009987E8 /* NSData+Base64.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8887FD901090FBE7009987E8 /* NSData+Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = 8887FD511090FBE7009987E8 /* NSData+Base64.m */; }; - EB3B3547161CB44D003DBE7D /* CDVCommandQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = EB3B3545161CB44D003DBE7D /* CDVCommandQueue.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 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, ); }; }; - 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, ); }; }; - 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, ); }; }; - EBA3557515ABD38C00F4DE24 /* NSArray+Comparisons.m in Sources */ = {isa = PBXBuildFile; fileRef = EBA3557215ABD38C00F4DE24 /* NSArray+Comparisons.m */; }; - EBFF4DBC16D3FE2E008F452B /* CDVWebViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = EBFF4DBA16D3FE2E008F452B /* CDVWebViewDelegate.m */; }; - EBFF4DBD16D3FE2E008F452B /* CDVWebViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = EBFF4DBB16D3FE2E008F452B /* CDVWebViewDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F858FBC6166009A8007DA594 /* CDVConfigParser.h in Headers */ = {isa = PBXBuildFile; fileRef = F858FBC4166009A8007DA594 /* CDVConfigParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F858FBC7166009A8007DA594 /* CDVConfigParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F858FBC5166009A8007DA594 /* CDVConfigParser.m */; }; + 30193A501AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 30193A4E1AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.m */; }; + 30193A511AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 30193A4F1AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.h */; }; + 3093E2231B16D6A3003F381A /* CDVIntentAndNavigationFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 3093E2211B16D6A3003F381A /* CDVIntentAndNavigationFilter.h */; }; + 3093E2241B16D6A3003F381A /* CDVIntentAndNavigationFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 3093E2221B16D6A3003F381A /* CDVIntentAndNavigationFilter.m */; }; + 7E7F69B61ABA35D8007546F4 /* CDVLocalStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95CFB1AB9028C008C4574 /* CDVLocalStorage.h */; }; + 7E7F69B81ABA368F007546F4 /* CDVUIWebViewEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D001AB9028C008C4574 /* CDVUIWebViewEngine.h */; }; + 7E7F69B91ABA3692007546F4 /* CDVHandleOpenURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95CF81AB9028C008C4574 /* CDVHandleOpenURL.h */; }; + 7ED95D021AB9028C008C4574 /* CDVDebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95CF21AB9028C008C4574 /* CDVDebug.h */; }; + 7ED95D031AB9028C008C4574 /* CDVJSON_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95CF31AB9028C008C4574 /* CDVJSON_private.h */; }; + 7ED95D041AB9028C008C4574 /* CDVJSON_private.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95CF41AB9028C008C4574 /* CDVJSON_private.m */; }; + 7ED95D051AB9028C008C4574 /* CDVPlugin+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95CF51AB9028C008C4574 /* CDVPlugin+Private.h */; }; + 7ED95D071AB9028C008C4574 /* CDVHandleOpenURL.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95CF91AB9028C008C4574 /* CDVHandleOpenURL.m */; }; + 7ED95D091AB9028C008C4574 /* CDVLocalStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95CFC1AB9028C008C4574 /* CDVLocalStorage.m */; }; + 7ED95D0A1AB9028C008C4574 /* CDVUIWebViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95CFE1AB9028C008C4574 /* CDVUIWebViewDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D0B1AB9028C008C4574 /* CDVUIWebViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95CFF1AB9028C008C4574 /* CDVUIWebViewDelegate.m */; }; + 7ED95D0D1AB9028C008C4574 /* CDVUIWebViewEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D011AB9028C008C4574 /* CDVUIWebViewEngine.m */; }; + 7ED95D351AB9029B008C4574 /* CDV.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D0F1AB9029B008C4574 /* CDV.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D361AB9029B008C4574 /* CDVAppDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D101AB9029B008C4574 /* CDVAppDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D371AB9029B008C4574 /* CDVAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D111AB9029B008C4574 /* CDVAppDelegate.m */; }; + 7ED95D381AB9029B008C4574 /* CDVAvailability.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D121AB9029B008C4574 /* CDVAvailability.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D391AB9029B008C4574 /* CDVAvailabilityDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D131AB9029B008C4574 /* CDVAvailabilityDeprecated.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D3A1AB9029B008C4574 /* CDVCommandDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D141AB9029B008C4574 /* CDVCommandDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D3B1AB9029B008C4574 /* CDVCommandDelegateImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D151AB9029B008C4574 /* CDVCommandDelegateImpl.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D3C1AB9029B008C4574 /* CDVCommandDelegateImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D161AB9029B008C4574 /* CDVCommandDelegateImpl.m */; }; + 7ED95D3D1AB9029B008C4574 /* CDVCommandQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D171AB9029B008C4574 /* CDVCommandQueue.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D3E1AB9029B008C4574 /* CDVCommandQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D181AB9029B008C4574 /* CDVCommandQueue.m */; }; + 7ED95D3F1AB9029B008C4574 /* CDVConfigParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D191AB9029B008C4574 /* CDVConfigParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D401AB9029B008C4574 /* CDVConfigParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D1A1AB9029B008C4574 /* CDVConfigParser.m */; }; + 7ED95D411AB9029B008C4574 /* CDVInvokedUrlCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D1B1AB9029B008C4574 /* CDVInvokedUrlCommand.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D421AB9029B008C4574 /* CDVInvokedUrlCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D1C1AB9029B008C4574 /* CDVInvokedUrlCommand.m */; }; + 7ED95D431AB9029B008C4574 /* CDVPlugin+Resources.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D1D1AB9029B008C4574 /* CDVPlugin+Resources.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D441AB9029B008C4574 /* CDVPlugin+Resources.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D1E1AB9029B008C4574 /* CDVPlugin+Resources.m */; }; + 7ED95D451AB9029B008C4574 /* CDVPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D1F1AB9029B008C4574 /* CDVPlugin.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D461AB9029B008C4574 /* CDVPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D201AB9029B008C4574 /* CDVPlugin.m */; }; + 7ED95D471AB9029B008C4574 /* CDVPluginResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D211AB9029B008C4574 /* CDVPluginResult.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D481AB9029B008C4574 /* CDVPluginResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D221AB9029B008C4574 /* CDVPluginResult.m */; }; + 7ED95D491AB9029B008C4574 /* CDVScreenOrientationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D231AB9029B008C4574 /* CDVScreenOrientationDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D4A1AB9029B008C4574 /* CDVTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D241AB9029B008C4574 /* CDVTimer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D4B1AB9029B008C4574 /* CDVTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D251AB9029B008C4574 /* CDVTimer.m */; }; + 7ED95D4C1AB9029B008C4574 /* CDVURLProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D261AB9029B008C4574 /* CDVURLProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D4D1AB9029B008C4574 /* CDVURLProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D271AB9029B008C4574 /* CDVURLProtocol.m */; }; + 7ED95D4E1AB9029B008C4574 /* CDVUserAgentUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D281AB9029B008C4574 /* CDVUserAgentUtil.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D4F1AB9029B008C4574 /* CDVUserAgentUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D291AB9029B008C4574 /* CDVUserAgentUtil.m */; }; + 7ED95D501AB9029B008C4574 /* CDVViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D2A1AB9029B008C4574 /* CDVViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D511AB9029B008C4574 /* CDVViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D2B1AB9029B008C4574 /* CDVViewController.m */; }; + 7ED95D521AB9029B008C4574 /* CDVWebViewEngineProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D2C1AB9029B008C4574 /* CDVWebViewEngineProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D531AB9029B008C4574 /* CDVWhitelist.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D2D1AB9029B008C4574 /* CDVWhitelist.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D541AB9029B008C4574 /* CDVWhitelist.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D2E1AB9029B008C4574 /* CDVWhitelist.m */; }; + 7ED95D571AB9029B008C4574 /* NSDictionary+CordovaPreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D311AB9029B008C4574 /* NSDictionary+CordovaPreferences.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D581AB9029B008C4574 /* NSDictionary+CordovaPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D321AB9029B008C4574 /* NSDictionary+CordovaPreferences.m */; }; + 7ED95D591AB9029B008C4574 /* NSMutableArray+QueueAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ED95D331AB9029B008C4574 /* NSMutableArray+QueueAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7ED95D5A1AB9029B008C4574 /* NSMutableArray+QueueAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ED95D341AB9029B008C4574 /* NSMutableArray+QueueAdditions.m */; }; + A3B082D41BB15CEA00D8DC35 /* CDVGestureHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = A3B082D21BB15CEA00D8DC35 /* CDVGestureHandler.h */; }; + A3B082D51BB15CEA00D8DC35 /* CDVGestureHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = A3B082D31BB15CEA00D8DC35 /* CDVGestureHandler.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 1B701026177A61CF00AE11F4 /* CDVShared.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVShared.h; path = Classes/CDVShared.h; sourceTree = "<group>"; }; - 1F92F49E1314023E0046367C /* CDVPluginResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVPluginResult.h; path = Classes/CDVPluginResult.h; sourceTree = "<group>"; }; - 1F92F49F1314023E0046367C /* CDVPluginResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVPluginResult.m; path = Classes/CDVPluginResult.m; sourceTree = "<group>"; }; - 301F2F2914F3C9CA003FE9FC /* CDV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDV.h; path = Classes/CDV.h; sourceTree = "<group>"; }; - 302965BB13A94E9D007046C5 /* CDVDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVDebug.h; path = Classes/CDVDebug.h; sourceTree = "<group>"; }; + 30193A4E1AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVUIWebViewNavigationDelegate.m; sourceTree = "<group>"; }; + 30193A4F1AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVUIWebViewNavigationDelegate.h; sourceTree = "<group>"; }; 30325A0B136B343700982B63 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = "<group>"; }; - 3034979A1513D56A0090E688 /* CDVLocalStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVLocalStorage.h; path = Classes/CDVLocalStorage.h; sourceTree = "<group>"; }; - 3034979B1513D56A0090E688 /* CDVLocalStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVLocalStorage.m; path = Classes/CDVLocalStorage.m; sourceTree = "<group>"; }; - 30392E4D14F4FCAB00B9E0B8 /* CDVAvailability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVAvailability.h; path = Classes/CDVAvailability.h; sourceTree = "<group>"; }; - 3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIDevice+Extensions.h"; path = "Classes/UIDevice+Extensions.h"; sourceTree = "<group>"; }; - 3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIDevice+Extensions.m"; path = "Classes/UIDevice+Extensions.m"; sourceTree = "<group>"; }; - 3073E9EC1656D51200957977 /* CDVScreenOrientationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVScreenOrientationDelegate.h; path = Classes/CDVScreenOrientationDelegate.h; sourceTree = "<group>"; }; - 30C6847E1406CB38004C1A8E /* CDVWhitelist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWhitelist.h; path = Classes/CDVWhitelist.h; sourceTree = "<group>"; }; - 30C6847F1406CB38004C1A8E /* CDVWhitelist.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWhitelist.m; path = Classes/CDVWhitelist.m; sourceTree = "<group>"; }; - 30C684921407044A004C1A8E /* CDVURLProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVURLProtocol.h; path = Classes/CDVURLProtocol.h; sourceTree = "<group>"; }; - 30C684931407044A004C1A8E /* CDVURLProtocol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVURLProtocol.m; path = Classes/CDVURLProtocol.m; sourceTree = "<group>"; }; - 30E33AF013A7E24B00594D64 /* CDVPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVPlugin.h; path = Classes/CDVPlugin.h; 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>"; }; - 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>"; }; - 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>"; }; - 686357AA141002F100DF4CF2 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 686357AC141002F100DF4CF2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 686357AE141002F100DF4CF2 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 686357CC14100AAD00DF4CF2 /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; }; - 686357CE14100ADA00DF4CF2 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; - 686357CF14100ADB00DF4CF2 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; - 686357D014100ADE00DF4CF2 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; - 686357D214100AE700DF4CF2 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; - 686357D414100AF200DF4CF2 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; - 686357DC14100B1600DF4CF2 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + 3093E2211B16D6A3003F381A /* CDVIntentAndNavigationFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVIntentAndNavigationFilter.h; sourceTree = "<group>"; }; + 3093E2221B16D6A3003F381A /* CDVIntentAndNavigationFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVIntentAndNavigationFilter.m; sourceTree = "<group>"; }; 68A32D7114102E1C006B237C /* libCordova.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCordova.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 68A32D7414103017006B237C /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; }; - 7E14B5A61705050A0032169E /* CDVTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVTimer.h; path = Classes/CDVTimer.h; sourceTree = "<group>"; }; - 7E14B5A71705050A0032169E /* CDVTimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVTimer.m; path = Classes/CDVTimer.m; sourceTree = "<group>"; }; - 7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVAvailabilityDeprecated.h; path = Classes/CDVAvailabilityDeprecated.h; sourceTree = "<group>"; }; - 8220B5C316D5427E00EC3921 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; }; - 8852C43614B65FD800F0E735 /* CDVViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVViewController.h; path = Classes/CDVViewController.h; sourceTree = "<group>"; }; - 8852C43714B65FD800F0E735 /* CDVViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVViewController.m; path = Classes/CDVViewController.m; sourceTree = "<group>"; }; - 8887FD281090FBE7009987E8 /* NSDictionary+Extensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSDictionary+Extensions.h"; path = "Classes/NSDictionary+Extensions.h"; sourceTree = "<group>"; }; - 8887FD291090FBE7009987E8 /* NSDictionary+Extensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSDictionary+Extensions.m"; path = "Classes/NSDictionary+Extensions.m"; sourceTree = "<group>"; }; - 8887FD341090FBE7009987E8 /* CDVInvokedUrlCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVInvokedUrlCommand.h; path = Classes/CDVInvokedUrlCommand.h; sourceTree = "<group>"; }; - 8887FD351090FBE7009987E8 /* CDVInvokedUrlCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVInvokedUrlCommand.m; path = Classes/CDVInvokedUrlCommand.m; sourceTree = "<group>"; }; - 8887FD501090FBE7009987E8 /* NSData+Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSData+Base64.h"; path = "Classes/NSData+Base64.h"; sourceTree = "<group>"; }; - 8887FD511090FBE7009987E8 /* NSData+Base64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSData+Base64.m"; path = "Classes/NSData+Base64.m"; sourceTree = "<group>"; }; + 7ED95CF21AB9028C008C4574 /* CDVDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVDebug.h; sourceTree = "<group>"; }; + 7ED95CF31AB9028C008C4574 /* CDVJSON_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVJSON_private.h; sourceTree = "<group>"; }; + 7ED95CF41AB9028C008C4574 /* CDVJSON_private.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVJSON_private.m; sourceTree = "<group>"; }; + 7ED95CF51AB9028C008C4574 /* CDVPlugin+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CDVPlugin+Private.h"; sourceTree = "<group>"; }; + 7ED95CF81AB9028C008C4574 /* CDVHandleOpenURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVHandleOpenURL.h; sourceTree = "<group>"; }; + 7ED95CF91AB9028C008C4574 /* CDVHandleOpenURL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVHandleOpenURL.m; sourceTree = "<group>"; }; + 7ED95CFB1AB9028C008C4574 /* CDVLocalStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVLocalStorage.h; sourceTree = "<group>"; }; + 7ED95CFC1AB9028C008C4574 /* CDVLocalStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVLocalStorage.m; sourceTree = "<group>"; }; + 7ED95CFE1AB9028C008C4574 /* CDVUIWebViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVUIWebViewDelegate.h; sourceTree = "<group>"; }; + 7ED95CFF1AB9028C008C4574 /* CDVUIWebViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVUIWebViewDelegate.m; sourceTree = "<group>"; }; + 7ED95D001AB9028C008C4574 /* CDVUIWebViewEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVUIWebViewEngine.h; sourceTree = "<group>"; }; + 7ED95D011AB9028C008C4574 /* CDVUIWebViewEngine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVUIWebViewEngine.m; sourceTree = "<group>"; }; + 7ED95D0F1AB9029B008C4574 /* CDV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDV.h; sourceTree = "<group>"; }; + 7ED95D101AB9029B008C4574 /* CDVAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVAppDelegate.h; sourceTree = "<group>"; }; + 7ED95D111AB9029B008C4574 /* CDVAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVAppDelegate.m; sourceTree = "<group>"; }; + 7ED95D121AB9029B008C4574 /* CDVAvailability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVAvailability.h; sourceTree = "<group>"; }; + 7ED95D131AB9029B008C4574 /* CDVAvailabilityDeprecated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVAvailabilityDeprecated.h; sourceTree = "<group>"; }; + 7ED95D141AB9029B008C4574 /* CDVCommandDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVCommandDelegate.h; sourceTree = "<group>"; }; + 7ED95D151AB9029B008C4574 /* CDVCommandDelegateImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVCommandDelegateImpl.h; sourceTree = "<group>"; }; + 7ED95D161AB9029B008C4574 /* CDVCommandDelegateImpl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVCommandDelegateImpl.m; sourceTree = "<group>"; }; + 7ED95D171AB9029B008C4574 /* CDVCommandQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVCommandQueue.h; sourceTree = "<group>"; }; + 7ED95D181AB9029B008C4574 /* CDVCommandQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVCommandQueue.m; sourceTree = "<group>"; }; + 7ED95D191AB9029B008C4574 /* CDVConfigParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVConfigParser.h; sourceTree = "<group>"; }; + 7ED95D1A1AB9029B008C4574 /* CDVConfigParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVConfigParser.m; sourceTree = "<group>"; }; + 7ED95D1B1AB9029B008C4574 /* CDVInvokedUrlCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVInvokedUrlCommand.h; sourceTree = "<group>"; }; + 7ED95D1C1AB9029B008C4574 /* CDVInvokedUrlCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVInvokedUrlCommand.m; sourceTree = "<group>"; }; + 7ED95D1D1AB9029B008C4574 /* CDVPlugin+Resources.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CDVPlugin+Resources.h"; sourceTree = "<group>"; }; + 7ED95D1E1AB9029B008C4574 /* CDVPlugin+Resources.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CDVPlugin+Resources.m"; sourceTree = "<group>"; }; + 7ED95D1F1AB9029B008C4574 /* CDVPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVPlugin.h; sourceTree = "<group>"; }; + 7ED95D201AB9029B008C4574 /* CDVPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVPlugin.m; sourceTree = "<group>"; }; + 7ED95D211AB9029B008C4574 /* CDVPluginResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVPluginResult.h; sourceTree = "<group>"; }; + 7ED95D221AB9029B008C4574 /* CDVPluginResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVPluginResult.m; sourceTree = "<group>"; }; + 7ED95D231AB9029B008C4574 /* CDVScreenOrientationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVScreenOrientationDelegate.h; sourceTree = "<group>"; }; + 7ED95D241AB9029B008C4574 /* CDVTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVTimer.h; sourceTree = "<group>"; }; + 7ED95D251AB9029B008C4574 /* CDVTimer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVTimer.m; sourceTree = "<group>"; }; + 7ED95D261AB9029B008C4574 /* CDVURLProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVURLProtocol.h; sourceTree = "<group>"; }; + 7ED95D271AB9029B008C4574 /* CDVURLProtocol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVURLProtocol.m; sourceTree = "<group>"; }; + 7ED95D281AB9029B008C4574 /* CDVUserAgentUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVUserAgentUtil.h; sourceTree = "<group>"; }; + 7ED95D291AB9029B008C4574 /* CDVUserAgentUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVUserAgentUtil.m; sourceTree = "<group>"; }; + 7ED95D2A1AB9029B008C4574 /* CDVViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVViewController.h; sourceTree = "<group>"; }; + 7ED95D2B1AB9029B008C4574 /* CDVViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVViewController.m; sourceTree = "<group>"; }; + 7ED95D2C1AB9029B008C4574 /* CDVWebViewEngineProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVWebViewEngineProtocol.h; sourceTree = "<group>"; }; + 7ED95D2D1AB9029B008C4574 /* CDVWhitelist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVWhitelist.h; sourceTree = "<group>"; }; + 7ED95D2E1AB9029B008C4574 /* CDVWhitelist.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVWhitelist.m; sourceTree = "<group>"; }; + 7ED95D311AB9029B008C4574 /* NSDictionary+CordovaPreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+CordovaPreferences.h"; sourceTree = "<group>"; }; + 7ED95D321AB9029B008C4574 /* NSDictionary+CordovaPreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+CordovaPreferences.m"; sourceTree = "<group>"; }; + 7ED95D331AB9029B008C4574 /* NSMutableArray+QueueAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+QueueAdditions.h"; sourceTree = "<group>"; }; + 7ED95D341AB9029B008C4574 /* NSMutableArray+QueueAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray+QueueAdditions.m"; sourceTree = "<group>"; }; + A3B082D21BB15CEA00D8DC35 /* CDVGestureHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVGestureHandler.h; sourceTree = "<group>"; }; + A3B082D31BB15CEA00D8DC35 /* CDVGestureHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVGestureHandler.m; sourceTree = "<group>"; }; AA747D9E0F9514B9006C5449 /* CordovaLib_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CordovaLib_Prefix.pch; sourceTree = SOURCE_ROOT; }; - EB3B3545161CB44D003DBE7D /* CDVCommandQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVCommandQueue.h; path = Classes/CDVCommandQueue.h; 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>"; }; - 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>"; }; - 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>"; }; - EBA3557215ABD38C00F4DE24 /* NSArray+Comparisons.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSArray+Comparisons.m"; path = "Classes/NSArray+Comparisons.m"; sourceTree = "<group>"; }; - EBFF4DBA16D3FE2E008F452B /* CDVWebViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVWebViewDelegate.m; path = Classes/CDVWebViewDelegate.m; sourceTree = "<group>"; }; - EBFF4DBB16D3FE2E008F452B /* CDVWebViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVWebViewDelegate.h; path = Classes/CDVWebViewDelegate.h; sourceTree = "<group>"; }; - F858FBC4166009A8007DA594 /* CDVConfigParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVConfigParser.h; path = Classes/CDVConfigParser.h; sourceTree = "<group>"; }; - F858FBC5166009A8007DA594 /* CDVConfigParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVConfigParser.m; path = Classes/CDVConfigParser.m; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -146,120 +145,131 @@ 0867D691FE84028FC02AAC07 /* CordovaLib */ = { isa = PBXGroup; children = ( - 8887FD101090FB43009987E8 /* Classes */, - 32C88DFF0371C24200C91783 /* Other Sources */, - 0867D69AFE84028FC02AAC07 /* Frameworks */, + 7ED95D0E1AB9029B008C4574 /* Public */, + 7ED95CF11AB9028C008C4574 /* Private */, 034768DFFF38A50411DB9C8B /* Products */, 30325A0B136B343700982B63 /* VERSION */, ); name = CordovaLib; sourceTree = "<group>"; }; - 0867D69AFE84028FC02AAC07 /* Frameworks */ = { + 3093E2201B16D6A3003F381A /* CDVIntentAndNavigationFilter */ = { isa = PBXGroup; children = ( - 68A32D7414103017006B237C /* AddressBook.framework */, - 8220B5C316D5427E00EC3921 /* AssetsLibrary.framework */, - 686357DC14100B1600DF4CF2 /* CoreMedia.framework */, - 686357CE14100ADA00DF4CF2 /* AudioToolbox.framework */, - 686357CF14100ADB00DF4CF2 /* AVFoundation.framework */, - 686357D014100ADE00DF4CF2 /* CoreLocation.framework */, - 686357D214100AE700DF4CF2 /* MobileCoreServices.framework */, - 686357D414100AF200DF4CF2 /* SystemConfiguration.framework */, - 686357CC14100AAD00DF4CF2 /* AddressBookUI.framework */, - 686357AA141002F100DF4CF2 /* UIKit.framework */, - 686357AC141002F100DF4CF2 /* Foundation.framework */, - 686357AE141002F100DF4CF2 /* CoreGraphics.framework */, + 3093E2211B16D6A3003F381A /* CDVIntentAndNavigationFilter.h */, + 3093E2221B16D6A3003F381A /* CDVIntentAndNavigationFilter.m */, ); - name = Frameworks; + path = CDVIntentAndNavigationFilter; sourceTree = "<group>"; }; - 3054098714B77FF3009841CA /* Cleaver */ = { + 7ED95CF11AB9028C008C4574 /* Private */ = { isa = PBXGroup; children = ( - F858FBC4166009A8007DA594 /* CDVConfigParser.h */, - F858FBC5166009A8007DA594 /* CDVConfigParser.m */, - 8852C43614B65FD800F0E735 /* CDVViewController.h */, - 8852C43714B65FD800F0E735 /* CDVViewController.m */, - EB3B3545161CB44D003DBE7D /* CDVCommandQueue.h */, - EB3B3546161CB44D003DBE7D /* CDVCommandQueue.m */, + AA747D9E0F9514B9006C5449 /* CordovaLib_Prefix.pch */, + 7ED95CF21AB9028C008C4574 /* CDVDebug.h */, + 7ED95CF31AB9028C008C4574 /* CDVJSON_private.h */, + 7ED95CF41AB9028C008C4574 /* CDVJSON_private.m */, + 7ED95CF51AB9028C008C4574 /* CDVPlugin+Private.h */, + 7ED95CF61AB9028C008C4574 /* Plugins */, ); - name = Cleaver; + name = Private; + path = Classes/Private; sourceTree = "<group>"; }; - 32C88DFF0371C24200C91783 /* Other Sources */ = { + 7ED95CF61AB9028C008C4574 /* Plugins */ = { isa = PBXGroup; children = ( - AA747D9E0F9514B9006C5449 /* CordovaLib_Prefix.pch */, + A3B082D11BB15CEA00D8DC35 /* CDVGestureHandler */, + 3093E2201B16D6A3003F381A /* CDVIntentAndNavigationFilter */, + 7ED95CF71AB9028C008C4574 /* CDVHandleOpenURL */, + 7ED95CFA1AB9028C008C4574 /* CDVLocalStorage */, + 7ED95CFD1AB9028C008C4574 /* CDVUIWebViewEngine */, + ); + path = Plugins; + sourceTree = "<group>"; + }; + 7ED95CF71AB9028C008C4574 /* CDVHandleOpenURL */ = { + isa = PBXGroup; + children = ( + 7ED95CF81AB9028C008C4574 /* CDVHandleOpenURL.h */, + 7ED95CF91AB9028C008C4574 /* CDVHandleOpenURL.m */, ); - name = "Other Sources"; + path = CDVHandleOpenURL; sourceTree = "<group>"; }; - 888700D710922F56009987E8 /* Commands */ = { + 7ED95CFA1AB9028C008C4574 /* CDVLocalStorage */ = { isa = PBXGroup; children = ( - 30E6B8CB1A8ADD900025B9EE /* CDVHandleOpenURL.h */, - 30E6B8CC1A8ADD900025B9EE /* CDVHandleOpenURL.m */, - 7E22B88419E4C0210026F95E /* CDVAvailabilityDeprecated.h */, - EBFF4DBA16D3FE2E008F452B /* CDVWebViewDelegate.m */, - EBFF4DBB16D3FE2E008F452B /* CDVWebViewDelegate.h */, - 301F2F2914F3C9CA003FE9FC /* CDV.h */, - 3034979A1513D56A0090E688 /* CDVLocalStorage.h */, - 3034979B1513D56A0090E688 /* CDVLocalStorage.m */, - 30392E4D14F4FCAB00B9E0B8 /* CDVAvailability.h */, - 30F5EBA914CA26E700987760 /* CDVCommandDelegate.h */, - EB3B357A161F2A44003DBE7D /* CDVCommandDelegateImpl.h */, - EB3B357B161F2A45003DBE7D /* CDVCommandDelegateImpl.m */, - 30C684921407044A004C1A8E /* CDVURLProtocol.h */, - 30C684931407044A004C1A8E /* CDVURLProtocol.m */, - 30C6847E1406CB38004C1A8E /* CDVWhitelist.h */, - 1B701026177A61CF00AE11F4 /* CDVShared.h */, - 30C6847F1406CB38004C1A8E /* CDVWhitelist.m */, - 30E33AF013A7E24B00594D64 /* CDVPlugin.h */, - 30E33AF113A7E24B00594D64 /* CDVPlugin.m */, - 1F92F49E1314023E0046367C /* CDVPluginResult.h */, - 1F92F49F1314023E0046367C /* CDVPluginResult.m */, - 8887FD341090FBE7009987E8 /* CDVInvokedUrlCommand.h */, - 8887FD351090FBE7009987E8 /* CDVInvokedUrlCommand.m */, - 3073E9EC1656D51200957977 /* CDVScreenOrientationDelegate.h */, - 30F39309169F839700B22307 /* CDVJSON.h */, - 30F3930A169F839700B22307 /* CDVJSON.m */, - EB6A98521A77EE470013FCDB /* CDVJSON_private.m */, - EB6A98531A77EE470013FCDB /* CDVJSON_private.h */, - EB96673916A8970900D86CDF /* CDVUserAgentUtil.h */, - EB96673A16A8970900D86CDF /* CDVUserAgentUtil.m */, + 7ED95CFB1AB9028C008C4574 /* CDVLocalStorage.h */, + 7ED95CFC1AB9028C008C4574 /* CDVLocalStorage.m */, ); - name = Commands; + path = CDVLocalStorage; sourceTree = "<group>"; }; - 888700D910923009009987E8 /* Util */ = { + 7ED95CFD1AB9028C008C4574 /* CDVUIWebViewEngine */ = { isa = PBXGroup; children = ( - 3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */, - 3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */, - EBA3557115ABD38C00F4DE24 /* NSArray+Comparisons.h */, - EBA3557215ABD38C00F4DE24 /* NSArray+Comparisons.m */, - 8887FD281090FBE7009987E8 /* NSDictionary+Extensions.h */, - 8887FD291090FBE7009987E8 /* NSDictionary+Extensions.m */, - 302965BB13A94E9D007046C5 /* CDVDebug.h */, - 30E563CD13E217EC00C949AA /* NSMutableArray+QueueAdditions.h */, - 30E563CE13E217EC00C949AA /* NSMutableArray+QueueAdditions.m */, - 8887FD501090FBE7009987E8 /* NSData+Base64.h */, - 8887FD511090FBE7009987E8 /* NSData+Base64.m */, - 7E14B5A61705050A0032169E /* CDVTimer.h */, - 7E14B5A71705050A0032169E /* CDVTimer.m */, + 30193A4E1AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.m */, + 30193A4F1AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.h */, + 7ED95CFE1AB9028C008C4574 /* CDVUIWebViewDelegate.h */, + 7ED95CFF1AB9028C008C4574 /* CDVUIWebViewDelegate.m */, + 7ED95D001AB9028C008C4574 /* CDVUIWebViewEngine.h */, + 7ED95D011AB9028C008C4574 /* CDVUIWebViewEngine.m */, ); - name = Util; + path = CDVUIWebViewEngine; sourceTree = "<group>"; }; - 8887FD101090FB43009987E8 /* Classes */ = { + 7ED95D0E1AB9029B008C4574 /* Public */ = { isa = PBXGroup; children = ( - 3054098714B77FF3009841CA /* Cleaver */, - 888700D710922F56009987E8 /* Commands */, - 888700D910923009009987E8 /* Util */, + 7ED95D0F1AB9029B008C4574 /* CDV.h */, + 7ED95D101AB9029B008C4574 /* CDVAppDelegate.h */, + 7ED95D111AB9029B008C4574 /* CDVAppDelegate.m */, + 7ED95D121AB9029B008C4574 /* CDVAvailability.h */, + 7ED95D131AB9029B008C4574 /* CDVAvailabilityDeprecated.h */, + 7ED95D141AB9029B008C4574 /* CDVCommandDelegate.h */, + 7ED95D151AB9029B008C4574 /* CDVCommandDelegateImpl.h */, + 7ED95D161AB9029B008C4574 /* CDVCommandDelegateImpl.m */, + 7ED95D171AB9029B008C4574 /* CDVCommandQueue.h */, + 7ED95D181AB9029B008C4574 /* CDVCommandQueue.m */, + 7ED95D191AB9029B008C4574 /* CDVConfigParser.h */, + 7ED95D1A1AB9029B008C4574 /* CDVConfigParser.m */, + 7ED95D1B1AB9029B008C4574 /* CDVInvokedUrlCommand.h */, + 7ED95D1C1AB9029B008C4574 /* CDVInvokedUrlCommand.m */, + 7ED95D1D1AB9029B008C4574 /* CDVPlugin+Resources.h */, + 7ED95D1E1AB9029B008C4574 /* CDVPlugin+Resources.m */, + 7ED95D1F1AB9029B008C4574 /* CDVPlugin.h */, + 7ED95D201AB9029B008C4574 /* CDVPlugin.m */, + 7ED95D211AB9029B008C4574 /* CDVPluginResult.h */, + 7ED95D221AB9029B008C4574 /* CDVPluginResult.m */, + 7ED95D231AB9029B008C4574 /* CDVScreenOrientationDelegate.h */, + 7ED95D241AB9029B008C4574 /* CDVTimer.h */, + 7ED95D251AB9029B008C4574 /* CDVTimer.m */, + 7ED95D261AB9029B008C4574 /* CDVURLProtocol.h */, + 7ED95D271AB9029B008C4574 /* CDVURLProtocol.m */, + 7ED95D281AB9029B008C4574 /* CDVUserAgentUtil.h */, + 7ED95D291AB9029B008C4574 /* CDVUserAgentUtil.m */, + 7ED95D2A1AB9029B008C4574 /* CDVViewController.h */, + 7ED95D2B1AB9029B008C4574 /* CDVViewController.m */, + 7ED95D2C1AB9029B008C4574 /* CDVWebViewEngineProtocol.h */, + 7ED95D2D1AB9029B008C4574 /* CDVWhitelist.h */, + 7ED95D2E1AB9029B008C4574 /* CDVWhitelist.m */, + 7ED95D311AB9029B008C4574 /* NSDictionary+CordovaPreferences.h */, + 7ED95D321AB9029B008C4574 /* NSDictionary+CordovaPreferences.m */, + 7ED95D331AB9029B008C4574 /* NSMutableArray+QueueAdditions.h */, + 7ED95D341AB9029B008C4574 /* NSMutableArray+QueueAdditions.m */, ); - name = Classes; + name = Public; + path = Classes/Public; + sourceTree = "<group>"; + }; + A3B082D11BB15CEA00D8DC35 /* CDVGestureHandler */ = { + isa = PBXGroup; + children = ( + A3B082D21BB15CEA00D8DC35 /* CDVGestureHandler.h */, + A3B082D31BB15CEA00D8DC35 /* CDVGestureHandler.m */, + ); + path = CDVGestureHandler; sourceTree = "<group>"; }; /* End PBXGroup section */ @@ -269,33 +279,37 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 8887FD681090FBE7009987E8 /* NSDictionary+Extensions.h in Headers */, - 8887FD741090FBE7009987E8 /* CDVInvokedUrlCommand.h in Headers */, - 8887FD8F1090FBE7009987E8 /* NSData+Base64.h in Headers */, - 1F92F4A01314023E0046367C /* CDVPluginResult.h in Headers */, - 30E33AF213A7E24B00594D64 /* CDVPlugin.h in Headers */, - 30E6B8CD1A8ADD900025B9EE /* CDVHandleOpenURL.h in Headers */, - 302965BC13A94E9D007046C5 /* CDVDebug.h in Headers */, - 30E563CF13E217EC00C949AA /* NSMutableArray+QueueAdditions.h in Headers */, - 30C684801406CB38004C1A8E /* CDVWhitelist.h in Headers */, - 30C684941407044B004C1A8E /* CDVURLProtocol.h in Headers */, - 8852C43A14B65FD800F0E735 /* CDVViewController.h in Headers */, - 30F5EBAB14CA26E700987760 /* CDVCommandDelegate.h in Headers */, - 301F2F2A14F3C9CA003FE9FC /* CDV.h in Headers */, - 30392E4E14F4FCAB00B9E0B8 /* CDVAvailability.h in Headers */, - 7E22B88519E4C0210026F95E /* CDVAvailabilityDeprecated.h in Headers */, - 3034979C1513D56A0090E688 /* CDVLocalStorage.h in Headers */, - 3062D120151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */, - EBA3557315ABD38C00F4DE24 /* NSArray+Comparisons.h in Headers */, - EB3B3547161CB44D003DBE7D /* CDVCommandQueue.h in Headers */, - EB3B357C161F2A45003DBE7D /* CDVCommandDelegateImpl.h in Headers */, - 1B701028177A61CF00AE11F4 /* CDVShared.h in Headers */, - 3073E9ED1656D51200957977 /* CDVScreenOrientationDelegate.h in Headers */, - F858FBC6166009A8007DA594 /* CDVConfigParser.h in Headers */, - 30F3930B169F839700B22307 /* CDVJSON.h in Headers */, - EBFF4DBD16D3FE2E008F452B /* CDVWebViewDelegate.h in Headers */, - EB96673B16A8970A00D86CDF /* CDVUserAgentUtil.h in Headers */, - 7E14B5A81705050A0032169E /* CDVTimer.h in Headers */, + 7ED95D521AB9029B008C4574 /* CDVWebViewEngineProtocol.h in Headers */, + 7ED95D491AB9029B008C4574 /* CDVScreenOrientationDelegate.h in Headers */, + 7ED95D351AB9029B008C4574 /* CDV.h in Headers */, + A3B082D41BB15CEA00D8DC35 /* CDVGestureHandler.h in Headers */, + 7ED95D3B1AB9029B008C4574 /* CDVCommandDelegateImpl.h in Headers */, + 7ED95D3D1AB9029B008C4574 /* CDVCommandQueue.h in Headers */, + 7ED95D531AB9029B008C4574 /* CDVWhitelist.h in Headers */, + 7ED95D361AB9029B008C4574 /* CDVAppDelegate.h in Headers */, + 7ED95D431AB9029B008C4574 /* CDVPlugin+Resources.h in Headers */, + 7ED95D381AB9029B008C4574 /* CDVAvailability.h in Headers */, + 7ED95D0A1AB9028C008C4574 /* CDVUIWebViewDelegate.h in Headers */, + 7ED95D471AB9029B008C4574 /* CDVPluginResult.h in Headers */, + 7ED95D591AB9029B008C4574 /* NSMutableArray+QueueAdditions.h in Headers */, + 7ED95D411AB9029B008C4574 /* CDVInvokedUrlCommand.h in Headers */, + 7ED95D571AB9029B008C4574 /* NSDictionary+CordovaPreferences.h in Headers */, + 7ED95D451AB9029B008C4574 /* CDVPlugin.h in Headers */, + 7ED95D4C1AB9029B008C4574 /* CDVURLProtocol.h in Headers */, + 7ED95D3A1AB9029B008C4574 /* CDVCommandDelegate.h in Headers */, + 7ED95D391AB9029B008C4574 /* CDVAvailabilityDeprecated.h in Headers */, + 7ED95D4E1AB9029B008C4574 /* CDVUserAgentUtil.h in Headers */, + 7ED95D4A1AB9029B008C4574 /* CDVTimer.h in Headers */, + 7ED95D3F1AB9029B008C4574 /* CDVConfigParser.h in Headers */, + 7ED95D501AB9029B008C4574 /* CDVViewController.h in Headers */, + 7ED95D031AB9028C008C4574 /* CDVJSON_private.h in Headers */, + 7ED95D021AB9028C008C4574 /* CDVDebug.h in Headers */, + 7ED95D051AB9028C008C4574 /* CDVPlugin+Private.h in Headers */, + 7E7F69B61ABA35D8007546F4 /* CDVLocalStorage.h in Headers */, + 3093E2231B16D6A3003F381A /* CDVIntentAndNavigationFilter.h in Headers */, + 7E7F69B81ABA368F007546F4 /* CDVUIWebViewEngine.h in Headers */, + 7E7F69B91ABA3692007546F4 /* CDVHandleOpenURL.h in Headers */, + 30193A511AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -325,7 +339,7 @@ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0510; + LastUpgradeCheck = 0720; }; buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "CordovaLib" */; compatibilityVersion = "Xcode 3.2"; @@ -353,27 +367,29 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8887FD691090FBE7009987E8 /* NSDictionary+Extensions.m in Sources */, - 8887FD751090FBE7009987E8 /* CDVInvokedUrlCommand.m in Sources */, - 8887FD901090FBE7009987E8 /* NSData+Base64.m in Sources */, - 1F92F4A11314023E0046367C /* CDVPluginResult.m in Sources */, - 30E33AF313A7E24B00594D64 /* CDVPlugin.m in Sources */, - 30E563D013E217EC00C949AA /* NSMutableArray+QueueAdditions.m in Sources */, - 30C684821406CB38004C1A8E /* CDVWhitelist.m in Sources */, - 30C684961407044B004C1A8E /* CDVURLProtocol.m in Sources */, - 8852C43C14B65FD800F0E735 /* CDVViewController.m in Sources */, - 3034979E1513D56A0090E688 /* CDVLocalStorage.m in Sources */, - 3062D122151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */, - EBA3557515ABD38C00F4DE24 /* NSArray+Comparisons.m in Sources */, - EB3B3548161CB44D003DBE7D /* CDVCommandQueue.m in Sources */, - EB6A98541A77EE470013FCDB /* CDVJSON_private.m in Sources */, - EB3B357D161F2A45003DBE7D /* CDVCommandDelegateImpl.m in Sources */, - F858FBC7166009A8007DA594 /* CDVConfigParser.m in Sources */, - 30F3930C169F839700B22307 /* CDVJSON.m in Sources */, - EB96673C16A8970A00D86CDF /* CDVUserAgentUtil.m in Sources */, - 30E6B8CE1A8ADD900025B9EE /* CDVHandleOpenURL.m in Sources */, - EBFF4DBC16D3FE2E008F452B /* CDVWebViewDelegate.m in Sources */, - 7E14B5A91705050A0032169E /* CDVTimer.m in Sources */, + 7ED95D511AB9029B008C4574 /* CDVViewController.m in Sources */, + 7ED95D581AB9029B008C4574 /* NSDictionary+CordovaPreferences.m in Sources */, + 7ED95D371AB9029B008C4574 /* CDVAppDelegate.m in Sources */, + 7ED95D0B1AB9028C008C4574 /* CDVUIWebViewDelegate.m in Sources */, + 7ED95D3C1AB9029B008C4574 /* CDVCommandDelegateImpl.m in Sources */, + 7ED95D041AB9028C008C4574 /* CDVJSON_private.m in Sources */, + 7ED95D541AB9029B008C4574 /* CDVWhitelist.m in Sources */, + 7ED95D421AB9029B008C4574 /* CDVInvokedUrlCommand.m in Sources */, + 7ED95D4B1AB9029B008C4574 /* CDVTimer.m in Sources */, + 7ED95D4F1AB9029B008C4574 /* CDVUserAgentUtil.m in Sources */, + 7ED95D401AB9029B008C4574 /* CDVConfigParser.m in Sources */, + A3B082D51BB15CEA00D8DC35 /* CDVGestureHandler.m in Sources */, + 7ED95D071AB9028C008C4574 /* CDVHandleOpenURL.m in Sources */, + 30193A501AE6350A0069A75F /* CDVUIWebViewNavigationDelegate.m in Sources */, + 7ED95D5A1AB9029B008C4574 /* NSMutableArray+QueueAdditions.m in Sources */, + 7ED95D3E1AB9029B008C4574 /* CDVCommandQueue.m in Sources */, + 7ED95D481AB9029B008C4574 /* CDVPluginResult.m in Sources */, + 7ED95D441AB9029B008C4574 /* CDVPlugin+Resources.m in Sources */, + 7ED95D4D1AB9029B008C4574 /* CDVURLProtocol.m in Sources */, + 7ED95D0D1AB9028C008C4574 /* CDVUIWebViewEngine.m in Sources */, + 7ED95D461AB9029B008C4574 /* CDVPlugin.m in Sources */, + 7ED95D091AB9028C008C4574 /* CDVLocalStorage.m in Sources */, + 3093E2241B16D6A3003F381A /* CDVIntentAndNavigationFilter.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -384,6 +400,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; DSTROOT = "/tmp/$(PROJECT_NAME).dst"; @@ -407,6 +424,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; DSTROOT = "/tmp/$(PROJECT_NAME).dst"; GCC_MODEL_TUNING = G5; @@ -416,7 +434,7 @@ GCC_THUMB_SUPPORT = NO; GCC_VERSION = ""; INSTALL_PATH = /usr/local/lib; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; PRODUCT_NAME = Cordova; PUBLIC_HEADERS_FOLDER_PATH = include/Cordova; SKIP_INSTALL = YES; @@ -432,6 +450,7 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ""; @@ -442,7 +461,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = "-DDEBUG"; PUBLIC_HEADERS_FOLDER_PATH = include/Cordova; @@ -471,7 +490,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; ONLY_ACTIVE_ARCH = NO; PUBLIC_HEADERS_FOLDER_PATH = include/Cordova; SDKROOT = iphoneos; diff --git a/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/jules.xcuserdatad/xcschemes/CordovaLib.xcscheme b/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/jules.xcuserdatad/xcschemes/CordovaLib.xcscheme deleted file mode 100644 index 195df7f5..00000000 --- a/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/jules.xcuserdatad/xcschemes/CordovaLib.xcscheme +++ /dev/null @@ -1,80 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Scheme - LastUpgradeVersion = "0720" - 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 - buildConfiguration = "Debug" - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> - <Testables> - </Testables> - <AdditionalOptions> - </AdditionalOptions> - </TestAction> - <LaunchAction - buildConfiguration = "Debug" - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - launchStyle = "0" - useCustomWorkingDirectory = "NO" - ignoresPersistentStateOnLaunch = "NO" - debugDocumentVersioning = "YES" - debugServiceExtension = "internal" - allowLocationSimulation = "YES"> - <MacroExpansion> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "D2AAC07D0554694100DB518D" - BuildableName = "libCordova.a" - BlueprintName = "CordovaLib" - ReferencedContainer = "container:CordovaLib.xcodeproj"> - </BuildableReference> - </MacroExpansion> - <AdditionalOptions> - </AdditionalOptions> - </LaunchAction> - <ProfileAction - buildConfiguration = "Release" - shouldUseLaunchSchemeArgsEnv = "YES" - savedToolIdentifier = "" - useCustomWorkingDirectory = "NO" - 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> diff --git a/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/jules.xcuserdatad/xcschemes/xcschememanagement.plist b/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/jules.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 283503be..00000000 --- a/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/jules.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ -<?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> diff --git a/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/CordovaLib.xcscheme b/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/CordovaLib.xcscheme deleted file mode 100755 index 3d9754c8..00000000 --- a/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/CordovaLib.xcscheme +++ /dev/null @@ -1,80 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Scheme - LastUpgradeVersion = "0710" - 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 - buildConfiguration = "Debug" - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> - <Testables> - </Testables> - <AdditionalOptions> - </AdditionalOptions> - </TestAction> - <LaunchAction - buildConfiguration = "Debug" - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - launchStyle = "0" - useCustomWorkingDirectory = "NO" - ignoresPersistentStateOnLaunch = "NO" - debugDocumentVersioning = "YES" - debugServiceExtension = "internal" - allowLocationSimulation = "YES"> - <MacroExpansion> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "D2AAC07D0554694100DB518D" - BuildableName = "libCordova.a" - BlueprintName = "CordovaLib" - ReferencedContainer = "container:CordovaLib.xcodeproj"> - </BuildableReference> - </MacroExpansion> - <AdditionalOptions> - </AdditionalOptions> - </LaunchAction> - <ProfileAction - buildConfiguration = "Release" - shouldUseLaunchSchemeArgsEnv = "YES" - savedToolIdentifier = "" - useCustomWorkingDirectory = "NO" - 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> diff --git a/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/xcschememanagement.plist b/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100755 index 283503be..00000000 --- a/StoneIsland/platforms/ios/CordovaLib/CordovaLib.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ -<?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> diff --git a/StoneIsland/platforms/ios/CordovaLib/CordovaLib_Prefix.pch b/StoneIsland/platforms/ios/CordovaLib/CordovaLib_Prefix.pch index 95455807..95455807 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/CordovaLib_Prefix.pch +++ b/StoneIsland/platforms/ios/CordovaLib/CordovaLib_Prefix.pch diff --git a/StoneIsland/platforms/ios/CordovaLib/VERSION b/StoneIsland/platforms/ios/CordovaLib/VERSION index 2009c7df..80895903 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/VERSION +++ b/StoneIsland/platforms/ios/CordovaLib/VERSION @@ -1 +1 @@ -3.9.2 +4.3.0 diff --git a/StoneIsland/platforms/ios/CordovaLib/cordova.js b/StoneIsland/platforms/ios/CordovaLib/cordova.js index 46ab90b7..9dce1f9f 100755..100644 --- a/StoneIsland/platforms/ios/CordovaLib/cordova.js +++ b/StoneIsland/platforms/ios/CordovaLib/cordova.js @@ -1,5 +1,5 @@ // Platform: ios -// 49a8db57fa070d20ea7b304a53ffec3d7250c5af +// f28234fbc27c578b9a335f1dabfa2d1b96bfc03d /* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file @@ -19,7 +19,7 @@ under the License. */ ;(function() { -var PLATFORM_VERSION_BUILD_LABEL = '3.9.2'; +var PLATFORM_VERSION_BUILD_LABEL = '4.3.0'; // file: src/scripts/require.js /*jshint -W079 */ @@ -697,8 +697,13 @@ var Channel = function(type, sticky) { } }; -function forceFunction(f) { - if (typeof f != 'function') throw "Function required as first argument!"; +function checkSubscriptionArgument(argument) { + if (typeof argument !== "function" && typeof argument.handleEvent !== "function") { + throw new Error( + "Must provide a function or an EventListener object " + + "implementing the handleEvent interface." + ); + } } /** @@ -708,28 +713,39 @@ function forceFunction(f) { * and a guid that can be used to stop subscribing to the channel. * Returns the guid. */ -Channel.prototype.subscribe = function(f, c) { - // need a function to call - forceFunction(f); +Channel.prototype.subscribe = function(eventListenerOrFunction, eventListener) { + checkSubscriptionArgument(eventListenerOrFunction); + var handleEvent, guid; + + if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") { + // Received an EventListener object implementing the handleEvent interface + handleEvent = eventListenerOrFunction.handleEvent; + eventListener = eventListenerOrFunction; + } else { + // Received a function to handle event + handleEvent = eventListenerOrFunction; + } + if (this.state == 2) { - f.apply(c || this, this.fireArgs); + handleEvent.apply(eventListener || this, this.fireArgs); return; } - var func = f, - guid = f.observer_guid; - if (typeof c == "object") { func = utils.close(c, f); } + guid = eventListenerOrFunction.observer_guid; + if (typeof eventListener === "object") { + handleEvent = utils.close(eventListener, handleEvent); + } if (!guid) { - // first time any channel has seen this subscriber + // First time any channel has seen this subscriber guid = '' + nextGuid++; } - func.observer_guid = guid; - f.observer_guid = guid; + handleEvent.observer_guid = guid; + eventListenerOrFunction.observer_guid = guid; // Don't add the same handler more than once. if (!this.handlers[guid]) { - this.handlers[guid] = func; + this.handlers[guid] = handleEvent; this.numHandlers++; if (this.numHandlers == 1) { this.onHasSubscribersChange && this.onHasSubscribersChange(); @@ -740,12 +756,20 @@ Channel.prototype.subscribe = function(f, c) { /** * Unsubscribes the function with the given guid from the channel. */ -Channel.prototype.unsubscribe = function(f) { - // need a function to unsubscribe - forceFunction(f); +Channel.prototype.unsubscribe = function(eventListenerOrFunction) { + checkSubscriptionArgument(eventListenerOrFunction); + var handleEvent, guid, handler; + + if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") { + // Received an EventListener object implementing the handleEvent interface + handleEvent = eventListenerOrFunction.handleEvent; + } else { + // Received a function to handle event + handleEvent = eventListenerOrFunction; + } - var guid = f.observer_guid, - handler = this.handlers[guid]; + guid = handleEvent.observer_guid; + handler = this.handlers[guid]; if (handler) { delete this.handlers[guid]; this.numHandlers--; @@ -817,58 +841,23 @@ module.exports = channel; }); -// file: e:/cordova/cordova-ios/cordova-js-src/exec.js +// file: /Users/shazron/Documents/git/apache/cordova-ios/cordova-js-src/exec.js define("cordova/exec", function(require, exports, module) { +/*global require, module, atob, document */ + /** * Creates a gap bridge iframe used to notify the native code about queued * commands. */ var cordova = require('cordova'), - channel = require('cordova/channel'), utils = require('cordova/utils'), base64 = require('cordova/base64'), - // XHR mode does not work on iOS 4.2. - // XHR mode's main advantage is working around a bug in -webkit-scroll, which - // doesn't exist only on iOS 5.x devices. - // IFRAME_NAV is the fastest. - // IFRAME_HASH could be made to enable synchronous bridge calls if we wanted this feature. - jsToNativeModes = { - IFRAME_NAV: 0, // Default. Uses a new iframe for each poke. - // XHR bridge appears to be flaky sometimes: CB-3900, CB-3359, CB-5457, CB-4970, CB-4998, CB-5134 - XHR_NO_PAYLOAD: 1, // About the same speed as IFRAME_NAV. Performance not about the same as IFRAME_NAV, but more variable. - XHR_WITH_PAYLOAD: 2, // Flakey, and not as performant - XHR_OPTIONAL_PAYLOAD: 3, // Flakey, and not as performant - 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, // Slower than no payload. Maybe since it has to be URI encoded / decoded. - WK_WEBVIEW_BINDING: 6 // Only way that works for WKWebView :) - }, - bridgeMode, execIframe, - execHashIframe, - hashToggle = 1, - execXhr, - requestCount = 0, - vcHeaderValue = null, commandQueue = [], // Contains pending JS->Native messages. isInContextOfEvalJs = 0, failSafeTimerId = 0; -function shouldBundleCommandJson() { - if (bridgeMode === jsToNativeModes.XHR_WITH_PAYLOAD) { - return true; - } - if (bridgeMode === jsToNativeModes.XHR_OPTIONAL_PAYLOAD) { - var payloadLength = 0; - for (var i = 0; i < commandQueue.length; ++i) { - payloadLength += commandQueue[i].length; - } - // The value here was determined using the benchmark within CordovaLibApp on an iPad 3. - return payloadLength < 4500; - } - return false; -} - function massageArgsJsToNative(args) { if (!args || utils.typeName(args) != 'Array') { return args; @@ -919,17 +908,10 @@ function convertMessageToArgsNativeToJs(message) { } function iOSExec() { - if (bridgeMode === undefined) { - bridgeMode = jsToNativeModes.IFRAME_NAV; - } - - if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.cordova && window.webkit.messageHandlers.cordova.postMessage) { - bridgeMode = jsToNativeModes.WK_WEBVIEW_BINDING; - } - var successCallback, failCallback, service, action, actionArgs, splitCommand; + var successCallback, failCallback, service, action, actionArgs; var callbackId = null; - if (typeof arguments[0] !== "string") { + if (typeof arguments[0] !== 'string') { // FORMAT ONE successCallback = arguments[0]; failCallback = arguments[1]; @@ -943,18 +925,9 @@ function iOSExec() { // an invalid callbackId and passes it even if no callbacks were given. callbackId = 'INVALID'; } else { - // FORMAT TWO, REMOVED - try { - splitCommand = arguments[0].split("."); - action = splitCommand.pop(); - service = splitCommand.join("."); - actionArgs = Array.prototype.splice.call(arguments, 1); - - console.log('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + - "cordova.exec(null, null, \"" + service + "\", \"" + action + "\"," + JSON.stringify(actionArgs) + ");" - ); - return; - } catch (e) {} + throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + + 'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);' + ); } // If actionArgs is not provided, default to an empty array @@ -976,116 +949,79 @@ function iOSExec() { // effectively clone the command arguments in case they are mutated before // the command is executed. commandQueue.push(JSON.stringify(command)); - - if (bridgeMode === jsToNativeModes.WK_WEBVIEW_BINDING) { - window.webkit.messageHandlers.cordova.postMessage(command); - } else { - // If we're in the context of a stringByEvaluatingJavaScriptFromString call, - // then the queue will be flushed when it returns; no need for a poke. - // 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. - if (!isInContextOfEvalJs && commandQueue.length == 1) { - pokeNative(); - } + + // If we're in the context of a stringByEvaluatingJavaScriptFromString call, + // then the queue will be flushed when it returns; no need for a poke. + // 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. + if (!isInContextOfEvalJs && commandQueue.length == 1) { + pokeNative(); } } -function pokeNative() { - switch (bridgeMode) { - case jsToNativeModes.XHR_NO_PAYLOAD: - case jsToNativeModes.XHR_WITH_PAYLOAD: - case jsToNativeModes.XHR_OPTIONAL_PAYLOAD: - pokeNativeViaXhr(); - break; - default: // iframe-based. - pokeNativeViaIframe(); - } +// CB-10530 +function proxyChanged() { + var cexec = cordovaExec(); + + return (execProxy !== cexec && // proxy objects are different + iOSExec !== cexec // proxy object is not the current iOSExec + ); } -function pokeNativeViaXhr() { - // This prevents sending an XHR when there is already one being sent. - // This should happen only in rare circumstances (refer to unit tests). - if (execXhr && execXhr.readyState != 4) { - execXhr = null; - } - // Re-using the XHR improves exec() performance by about 10%. - execXhr = execXhr || new XMLHttpRequest(); - // Changing this to a GET will make the XHR reach the URIProtocol on 4.2. - // For some reason it still doesn't work though... - // Add a timestamp to the query param to prevent caching. - execXhr.open('HEAD', "/!gap_exec?" + (+new Date()), true); - if (!vcHeaderValue) { - vcHeaderValue = /.*\((.*)\)$/.exec(navigator.userAgent)[1]; - } - execXhr.setRequestHeader('vc', vcHeaderValue); - execXhr.setRequestHeader('rc', ++requestCount); - if (shouldBundleCommandJson()) { - execXhr.setRequestHeader('cmds', iOSExec.nativeFetchMessages()); +// CB-10106 +function handleBridgeChange() { + if (proxyChanged()) { + var commandString = commandQueue.shift(); + while(commandString) { + var command = JSON.parse(commandString); + var callbackId = command[0]; + var service = command[1]; + var action = command[2]; + var actionArgs = command[3]; + var callbacks = cordova.callbacks[callbackId] || {}; + + execProxy(callbacks.success, callbacks.fail, service, action, actionArgs); + + commandString = commandQueue.shift(); + }; + return true; } - execXhr.send(null); + + return false; } -function pokeNativeViaIframe() { +function pokeNative() { // CB-5488 - Don't attempt to create iframe before document.body is available. if (!document.body) { - setTimeout(pokeNativeViaIframe); + setTimeout(pokeNative); return; } - 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) - if (!execHashIframe) { - execHashIframe = document.createElement('iframe'); - execHashIframe.style.display = 'none'; - 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. - hashToggle = hashToggle ^ 3; - var hashValue = '%0' + hashToggle; - if (bridgeMode === jsToNativeModes.IFRAME_HASH_WITH_PAYLOAD) { - hashValue += iOSExec.nativeFetchMessages(); - } - execHashIframe.contentWindow.location.hash = hashValue; + + // Check if they've removed it from the DOM, and put it back if so. + if (execIframe && execIframe.contentWindow) { + execIframe.contentWindow.location = 'gap://ready'; } else { - // Check if they've removed it from the DOM, and put it back if so. - if (execIframe && execIframe.contentWindow) { - execIframe.contentWindow.location = 'gap://ready'; - } else { - 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). + execIframe = document.createElement('iframe'); + execIframe.style.display = 'none'; + execIframe.src = 'gap://ready'; + document.body.appendChild(execIframe); } -} - -iOSExec.jsToNativeModes = jsToNativeModes; - -iOSExec.setJsToNativeBridgeMode = function(mode) { - // Remove the iFrame since it may be no longer required, and its existence - // can trigger browser bugs. - // https://issues.apache.org/jira/browse/CB-593 - if (execIframe) { - if (execIframe.parentNode) { - execIframe.parentNode.removeChild(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) { + // CB-10106 - flush the queue on bridge change + if (!handleBridgeChange()) { + pokeNative(); + } } - execIframe = null; - } - bridgeMode = mode; -}; + }, 50); // Making this > 0 improves performance (marginally) in the normal case (where it doesn't fire). +} iOSExec.nativeFetchMessages = function() { // Stop listing for window detatch once native side confirms poke. @@ -1102,11 +1038,14 @@ iOSExec.nativeFetchMessages = function() { return json; }; -iOSExec.nativeCallback = function(callbackId, status, message, keepCallback) { +iOSExec.nativeCallback = function(callbackId, status, message, keepCallback, debug) { return iOSExec.nativeEvalAndFetch(function() { var success = status === 0 || status === 1; var args = convertMessageToArgsNativeToJs(message); - cordova.callbackFromNative(callbackId, success, status, args, keepCallback); + function nc2() { + cordova.callbackFromNative(callbackId, success, status, args, keepCallback); + } + setTimeout(nc2, 0); }); }; @@ -1121,7 +1060,31 @@ iOSExec.nativeEvalAndFetch = function(func) { } }; -module.exports = iOSExec; +// Proxy the exec for bridge changes. See CB-10106 + +function cordovaExec() { + var cexec = require('cordova/exec'); + var cexec_valid = (typeof cexec.nativeFetchMessages === 'function') && (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function'); + return (cexec_valid && execProxy !== cexec)? cexec : iOSExec; +} + +function execProxy() { + cordovaExec().apply(null, arguments); +}; + +execProxy.nativeFetchMessages = function() { + return cordovaExec().nativeFetchMessages.apply(null, arguments); +}; + +execProxy.nativeEvalAndFetch = function() { + return cordovaExec().nativeEvalAndFetch.apply(null, arguments); +}; + +execProxy.nativeCallback = function() { + return cordovaExec().nativeCallback.apply(null, arguments); +}; + +module.exports = execProxy; }); @@ -1606,7 +1569,7 @@ exports.reset(); }); -// file: e:/cordova/cordova-ios/cordova-js-src/platform.js +// file: /Users/shazron/Documents/git/apache/cordova-ios/cordova-js-src/platform.js define("cordova/platform", function(require, exports, module) { module.exports = { @@ -1888,7 +1851,10 @@ utils.clone = function(obj) { retVal = {}; for(i in obj){ - if(!(i in retVal) || retVal[i] != obj[i]) { + // https://issues.apache.org/jira/browse/CB-11522 'unknown' type may be returned in + // custom protocol activation case on Windows Phone 8.1 causing "No such interface supported" exception + // on cloning. + if((!(i in retVal) || retVal[i] != obj[i]) && typeof obj[i] != 'undefined' && typeof obj[i] != 'unknown') { retVal[i] = utils.clone(obj[i]); } } diff --git a/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.pbxproj b/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.pbxproj index 803a62a5..b647d931 100755 --- a/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.pbxproj +++ b/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.pbxproj @@ -5,71 +5,47 @@ }; objectVersion = 46; objects = { - /* Begin PBXBuildFile section */ - 04679954946B416BAF5109F4 /* AppDelegate+notification.m in Sources */ = {isa = PBXBuildFile; fileRef = E281A1AF5CAC496486193F7D /* AppDelegate+notification.m */; }; - 0D43DE7D3F4F4D2CA1143CCD /* CDVLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 02EC23045EE24BFE9394BE84 /* CDVLogger.m */; }; - 11985887CF254F1E9F1F784D /* CDVNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = A1FE471673034577ABDADC36 /* CDVNotification.m */; }; - 12F814F101B54B69BBBCC136 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A4EF415F441417C98D8794B /* libz.dylib */; }; - 1C6E37642CB44321B8FD1542 /* CDVDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = D8F867F531144EFD9B5D1277 /* CDVDevice.m */; }; + 0207DA581B56EA530066E2B4 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0207DA571B56EA530066E2B4 /* Images.xcassets */; }; 1D3623260D0F684500981E51 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* AppDelegate.m */; }; 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; - 253B3D6A9B1B46C6A20040D4 /* CDVConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E381DE32F02400EA258418E /* CDVConnection.m */; }; - 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; 301BF552109A68D80062928A /* libCordova.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF535109A57CC0062928A /* libCordova.a */; }; 302D95F114D2391D003F00A1 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 302D95EF14D2391D003F00A1 /* MainViewController.m */; }; 302D95F214D2391D003F00A1 /* MainViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 302D95F014D2391D003F00A1 /* MainViewController.xib */; }; - 305D5FD1115AB8F900A74A75 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */; }; - 3088BBBD154F3926009F9C59 /* Default-Landscape@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBB7154F3926009F9C59 /* Default-Landscape@2x~ipad.png */; }; - 3088BBBE154F3926009F9C59 /* Default-Landscape~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBB8154F3926009F9C59 /* Default-Landscape~ipad.png */; }; - 3088BBBF154F3926009F9C59 /* Default-Portrait@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBB9154F3926009F9C59 /* Default-Portrait@2x~ipad.png */; }; - 3088BBC0154F3926009F9C59 /* Default-Portrait~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBBA154F3926009F9C59 /* Default-Portrait~ipad.png */; }; - 3088BBC1154F3926009F9C59 /* Default@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBBB154F3926009F9C59 /* Default@2x~iphone.png */; }; - 3088BBC2154F3926009F9C59 /* Default~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBBC154F3926009F9C59 /* Default~iphone.png */; }; - 308D05371370CCF300D202BF /* icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 308D052E1370CCF300D202BF /* icon-72.png */; }; - 308D05381370CCF300D202BF /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 308D052F1370CCF300D202BF /* icon.png */; }; - 308D05391370CCF300D202BF /* icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 308D05301370CCF300D202BF /* icon@2x.png */; }; - 30B4F30019D5E07200D9F7D8 /* Default-667h.png in Resources */ = {isa = PBXBuildFile; fileRef = 30B4F2FD19D5E07200D9F7D8 /* Default-667h.png */; }; - 30B4F30119D5E07200D9F7D8 /* Default-736h.png in Resources */ = {isa = PBXBuildFile; fileRef = 30B4F2FE19D5E07200D9F7D8 /* Default-736h.png */; }; - 30B4F30219D5E07200D9F7D8 /* Default-Landscape-736h.png in Resources */ = {isa = PBXBuildFile; fileRef = 30B4F2FF19D5E07200D9F7D8 /* Default-Landscape-736h.png */; }; - 30C1856619D5FC0A00212699 /* icon-60@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 30C1856519D5FC0A00212699 /* icon-60@3x.png */; }; - 30FC414916E50CA1004E6F35 /* icon-72@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 30FC414816E50CA1004E6F35 /* icon-72@2x.png */; }; - 3102D8D9D718447EA83756B0 /* Accounts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DBAC083B6EEF4FB38ED1C4B2 /* Accounts.framework */; }; - 32C7881E372548B8B10FCD81 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5E8712951F2426B9EC42E16 /* SystemConfiguration.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; - 408BB6834FA04C6191311981 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D56062D99BAE4CDA88CB01BD /* AudioToolbox.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; - 54A78D3704F04282B4BD0B36 /* SocialSharing.m in Sources */ = {isa = PBXBuildFile; fileRef = A3766D89217745BD942966AA /* SocialSharing.m */; }; - 571B90B51E784D48BDAE8EB8 /* Bolts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1045410447CE4A2EA0F38BDD /* Bolts.framework */; }; - 5B1594DD16A7569C00FEF299 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B1594DC16A7569C00FEF299 /* AssetsLibrary.framework */; }; - 5F8DBCF934714D4D8F58F78C /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 7084D4977636441A9FCB146A /* libsqlite3.dylib */; }; - 63C9F749184B43B0BE065836 /* UIWebViewExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 212497AFB9DF4A2DB3E5FD54 /* UIWebViewExtension.m */; }; - 68795A6B86504E52812A115C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E164C253C9004A0898A7606E /* Security.framework */; }; - 6E6F1C559C9840249E48D92E /* Parse.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EDCE0392D0524C77B377854D /* Parse.framework */; }; - 732516F97C734279A694F2E2 /* CDVReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B028C25F84445B7A197B963 /* CDVReachability.m */; }; - 741DEC619396417790762781 /* CDVSplashScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 50D9FE1D2FA7402BB6B538DD /* CDVSplashScreen.m */; }; - 7E7966DE1810823500FA85AD /* icon-40.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966D41810823500FA85AD /* icon-40.png */; }; - 7E7966DF1810823500FA85AD /* icon-40@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966D51810823500FA85AD /* icon-40@2x.png */; }; - 7E7966E01810823500FA85AD /* icon-50.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966D61810823500FA85AD /* icon-50.png */; }; - 7E7966E11810823500FA85AD /* icon-50@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966D71810823500FA85AD /* icon-50@2x.png */; }; - 7E7966E21810823500FA85AD /* icon-60.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966D81810823500FA85AD /* icon-60.png */; }; - 7E7966E31810823500FA85AD /* icon-60@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966D91810823500FA85AD /* icon-60@2x.png */; }; - 7E7966E41810823500FA85AD /* icon-76.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966DA1810823500FA85AD /* icon-76.png */; }; - 7E7966E51810823500FA85AD /* icon-76@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966DB1810823500FA85AD /* icon-76@2x.png */; }; - 7E7966E61810823500FA85AD /* icon-small.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966DC1810823500FA85AD /* icon-small.png */; }; - 7E7966E71810823500FA85AD /* icon-small@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7E7966DD1810823500FA85AD /* icon-small@2x.png */; }; - 93F9C9374ABA4745AF40DA08 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 983FEA48E6A049E8BAF9C572 /* StoreKit.framework */; }; - 9E30F0C9E89D48B7BDD54E6B /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 74FE79B2BBB342FE8959B854 /* CoreLocation.framework */; }; - A51DA261CB3F4B89BC98FFDE /* PushPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = E88AD47F098D47C99EC93E5B /* PushPlugin.m */; }; - A7F71F118E604F32AE765DFD /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 38EE2AA2E4DD46CEA0DA5F7C /* QuartzCore.framework */; }; - BC44C1F8D6E54E169B1C3024 /* CDVLocation.m in Sources */ = {isa = PBXBuildFile; fileRef = F0AAFF41056245EFBF8D4D8F /* CDVLocation.m */; }; - C520CB1888FA4F4E963A4605 /* Social.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 34ADAA286CAF455C830BBC5A /* Social.framework */; settings = {ATTRIBUTES = (Required, ); }; }; - C637100EF6E8411FA1763828 /* IonicKeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 62533E046CE7411F9CEA6CD8 /* IonicKeyboard.m */; }; - CE2E2F6D58504A0EA2470AEE /* CDVParsePlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 3048B836F3BD467E83BFF217 /* CDVParsePlugin.m */; }; - D4A0D8761607E02300AEF8BB /* Default-568h@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = D4A0D8751607E02300AEF8BB /* Default-568h@2x~iphone.png */; }; - E0D1A618D2134B69A25CAE5A /* CDVNotification.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 72C981F273644F2AA5D17C78 /* CDVNotification.bundle */; }; - E507737F3A0941E68A569F9B /* CDVViewController+SplashScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F1FF1ED80D34C91A03C18FD /* CDVViewController+SplashScreen.m */; }; - E9AB3A7C5BC846C8877B780D /* CDVInAppBrowser.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DA5A6FCAA884998901EF477 /* CDVInAppBrowser.m */; }; - F15FEE33CBCA427DA2D787F4 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 581F34F5A1784D4D9A99F383 /* CFNetwork.framework */; }; - F7CC7E6030524635AC59C0A0 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 900B1AD106FC41E3BFA9FE3C /* MessageUI.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 3047A5121AB8059700498E2A /* build-debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 3047A50F1AB8059700498E2A /* build-debug.xcconfig */; }; + 3047A5131AB8059700498E2A /* build-release.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 3047A5101AB8059700498E2A /* build-release.xcconfig */; }; + 3047A5141AB8059700498E2A /* build.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 3047A5111AB8059700498E2A /* build.xcconfig */; }; + 6AFF5BF91D6E424B00AB3073 /* CDVLaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6AFF5BF81D6E424B00AB3073 /* CDVLaunchScreen.storyboard */; }; + C5CB6DF47C5D417891456B4D /* IonicKeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 35719EF303D44796AE2F8232 /* IonicKeyboard.m */; }; + CD393F23C04449E48147FEFA /* UIWebViewExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BEFB560983744AF95D76E66 /* UIWebViewExtension.m */; }; + 9BF4E6A8A54F45E4BDCB35E8 /* CDVParsePlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 8961158EB65445E1BB6CB501 /* CDVParsePlugin.m */; }; + 9920D41C2D9C41AC9F772D8B /* Accounts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F97090F6B544E2BB1609DBE /* Accounts.framework */; }; + 0315761036204E3B845F89A9 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DC035EE9BA24D4FA0966C97 /* AudioToolbox.framework */; }; + 6D2024FED5EA43498DA1928E /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B23FCE8A14F4788A06368CD /* CFNetwork.framework */; }; + CF20D68FB9D547DF8164F3A5 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71127DE451034E8DADBC2908 /* CoreLocation.framework */; }; + 5977ACEEEDF4439A93AD46A5 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5FA9837E4C93446C84474512 /* QuartzCore.framework */; }; + 4DD3F0B57F8247199AA52EE7 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED0B669B92E5409282AE1703 /* Security.framework */; }; + 79567EACD25049808A22E639 /* Social.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B4768CC0A2D74CFF84597C0C /* Social.framework */; }; + 67EB671357AC4E29ADCE0B7C /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CCE8D44B5FFF4EF4BB46F74F /* StoreKit.framework */; }; + 64541CA1793A46F7AE78DA82 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94099699ABA44203A173F33E /* SystemConfiguration.framework */; }; + 4CEA203A6C864572AB3D4718 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 8998048060D1426C8BD2870D /* libz.dylib */; }; + 0580F77611BF4A32B709B4AB /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B6675D8E364642F0ABE3B97F /* libsqlite3.dylib */; }; + C03FF8C4AD384677BC558F8E /* Bolts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 34D6F0009780486D8A07BD47 /* Bolts.framework */; }; + 4F04AAC460204786A9B6F8D6 /* Parse.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 21B8104F65F9433D9A7D53F9 /* Parse.framework */; }; + 203198C6486B4906B0D2EAF3 /* CDVLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = A14E782B69CC473DAD94F0C7 /* CDVLogger.m */; }; + E23A6ED28D414A9FA31C18D6 /* CDVDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 5ABD34598B224612824BAE63 /* CDVDevice.m */; }; + CCDF00EE9C05477D9BD17C8D /* CDVNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 8661BF08EC7E4B558802CD5B /* CDVNotification.m */; }; + 932BB112D8D247E59DBC8C55 /* CDVNotification.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 00599E51D9234D71BE6C6B79 /* CDVNotification.bundle */; }; + C8B9F882FA744E0A85EBFA1F /* CDVLocation.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C77AAEFAED7486E987AEB6B /* CDVLocation.m */; }; + 3325D19426B948B38F318D73 /* CDVInAppBrowser.m in Sources */ = {isa = PBXBuildFile; fileRef = 7A42A487C79A4ADA9A06AF42 /* CDVInAppBrowser.m */; }; + 891101010EEA4D5491CA8B0B /* CDVConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 44DD171A422D46B1B1ADBF83 /* CDVConnection.m */; }; + 79688F2F8B804507B919AE23 /* CDVReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 279BD4938BA54F7ABCCEFC0E /* CDVReachability.m */; }; + E95FE2CE364D40F896F2D12A /* CDVSplashScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 1065E9EBB93145AA8CAFDE8A /* CDVSplashScreen.m */; }; + AAF050E78DED436DB51647A4 /* CDVViewController+SplashScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 16CA61E384604A269060D490 /* CDVViewController+SplashScreen.m */; }; + 8C9F50FD574A4962975E4B50 /* SocialSharing.m in Sources */ = {isa = PBXBuildFile; fileRef = AC21935FEAD34A7DA271CCF4 /* SocialSharing.m */; }; + A02C9C20257D48A3AB5125C9 /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E71962D2059240E3BCCFF098 /* MessageUI.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 566265D394B24F0F851B64B8 /* AppDelegate+notification.m in Sources */ = {isa = PBXBuildFile; fileRef = 51738B4AC1F2488D928587E2 /* AppDelegate+notification.m */; }; + 05BFC92227794306A1A49D2D /* PushPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E50FC1FE8224862947FA2D3 /* PushPlugin.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -90,94 +66,71 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 02EC23045EE24BFE9394BE84 /* CDVLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVLogger.m; path = "cordova-plugin-console/CDVLogger.m"; sourceTree = "<group>"; }; - 04159F17E941486B943DF119 /* CDVConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVConnection.h; path = "cordova-plugin-network-information/CDVConnection.h"; sourceTree = "<group>"; }; - 1045410447CE4A2EA0F38BDD /* Bolts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Bolts.framework; path = "Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework"; sourceTree = "<group>"; }; - 10DCEB5771BD4985B87AEE16 /* UIWebViewExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIWebViewExtension.h; path = com.ionic.keyboard/UIWebViewExtension.h; sourceTree = "<group>"; }; + 0207DA571B56EA530066E2B4 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = "Stone Island/Images.xcassets"; sourceTree = SOURCE_ROOT; }; 1D3623240D0F684500981E51 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; 1D3623250D0F684500981E51 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; 1D6058910D05DD3D006BFB54 /* Stone Island.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Stone Island.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 212497AFB9DF4A2DB3E5FD54 /* UIWebViewExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UIWebViewExtension.m; path = com.ionic.keyboard/UIWebViewExtension.m; sourceTree = "<group>"; }; - 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; - 2A4EF415F441417C98D8794B /* libz.dylib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; - 2B028C25F84445B7A197B963 /* CDVReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVReachability.m; path = "cordova-plugin-network-information/CDVReachability.m"; sourceTree = "<group>"; }; 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CordovaLib.xcodeproj; path = CordovaLib/CordovaLib.xcodeproj; sourceTree = "<group>"; }; 301BF56E109A69640062928A /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; path = www; sourceTree = SOURCE_ROOT; }; 302D95EE14D2391D003F00A1 /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = "<group>"; }; 302D95EF14D2391D003F00A1 /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = "<group>"; }; 302D95F014D2391D003F00A1 /* MainViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainViewController.xib; sourceTree = "<group>"; }; - 3048B836F3BD467E83BFF217 /* CDVParsePlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVParsePlugin.m; path = com.parse.cordova.core.pushplugin/CDVParsePlugin.m; sourceTree = "<group>"; }; - 305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; - 3088BBB7154F3926009F9C59 /* Default-Landscape@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape@2x~ipad.png"; sourceTree = "<group>"; }; - 3088BBB8154F3926009F9C59 /* Default-Landscape~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape~ipad.png"; sourceTree = "<group>"; }; - 3088BBB9154F3926009F9C59 /* Default-Portrait@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait@2x~ipad.png"; sourceTree = "<group>"; }; - 3088BBBA154F3926009F9C59 /* Default-Portrait~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait~ipad.png"; sourceTree = "<group>"; }; - 3088BBBB154F3926009F9C59 /* Default@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x~iphone.png"; sourceTree = "<group>"; }; - 3088BBBC154F3926009F9C59 /* Default~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default~iphone.png"; sourceTree = "<group>"; }; - 308D052E1370CCF300D202BF /* icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-72.png"; sourceTree = "<group>"; }; - 308D052F1370CCF300D202BF /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; }; - 308D05301370CCF300D202BF /* icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon@2x.png"; sourceTree = "<group>"; }; - 30B4F2FD19D5E07200D9F7D8 /* Default-667h.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-667h.png"; sourceTree = "<group>"; }; - 30B4F2FE19D5E07200D9F7D8 /* Default-736h.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-736h.png"; sourceTree = "<group>"; }; - 30B4F2FF19D5E07200D9F7D8 /* Default-Landscape-736h.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape-736h.png"; sourceTree = "<group>"; }; - 30C1856519D5FC0A00212699 /* icon-60@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-60@3x.png"; sourceTree = "<group>"; }; - 30FC414816E50CA1004E6F35 /* icon-72@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-72@2x.png"; sourceTree = "<group>"; }; + 3047A50F1AB8059700498E2A /* build-debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "build-debug.xcconfig"; path = cordova/build-debug.xcconfig; sourceTree = SOURCE_ROOT; }; + 3047A5101AB8059700498E2A /* build-release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "build-release.xcconfig"; path = cordova/build-release.xcconfig; sourceTree = SOURCE_ROOT; }; + 3047A5111AB8059700498E2A /* build.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = build.xcconfig; path = cordova/build.xcconfig; sourceTree = SOURCE_ROOT; }; 32CA4F630368D1EE00C91783 /* Stone Island-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Stone Island-Prefix.pch"; sourceTree = "<group>"; }; - 34ADAA286CAF455C830BBC5A /* Social.framework */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.framework; name = Social.framework; path = System/Library/Frameworks/Social.framework; sourceTree = SDKROOT; }; - 38EE2AA2E4DD46CEA0DA5F7C /* QuartzCore.framework */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - 48C0A6981FEE47D091E9781C /* CDVParsePlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVParsePlugin.h; path = com.parse.cordova.core.pushplugin/CDVParsePlugin.h; sourceTree = "<group>"; }; - 48DD63B975BE476F9E36BE07 /* CDVLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVLocation.h; path = "cordova-plugin-geolocation/CDVLocation.h"; sourceTree = "<group>"; }; - 4F1FF1ED80D34C91A03C18FD /* CDVViewController+SplashScreen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "CDVViewController+SplashScreen.m"; path = "cordova-plugin-splashscreen/CDVViewController+SplashScreen.m"; sourceTree = "<group>"; }; - 50D9FE1D2FA7402BB6B538DD /* CDVSplashScreen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVSplashScreen.m; path = "cordova-plugin-splashscreen/CDVSplashScreen.m"; sourceTree = "<group>"; }; - 581F34F5A1784D4D9A99F383 /* CFNetwork.framework */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; - 5B1594DC16A7569C00FEF299 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; }; - 62533E046CE7411F9CEA6CD8 /* IonicKeyboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = IonicKeyboard.m; path = com.ionic.keyboard/IonicKeyboard.m; sourceTree = "<group>"; }; - 6FC663108EE441BDBE0A8798 /* CDVLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVLogger.h; path = "cordova-plugin-console/CDVLogger.h"; sourceTree = "<group>"; }; - 7084D4977636441A9FCB146A /* libsqlite3.dylib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; }; - 72C981F273644F2AA5D17C78 /* CDVNotification.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = CDVNotification.bundle; sourceTree = "<group>"; }; - 74C07E6CE112438D85A76E75 /* CDVNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVNotification.h; path = "cordova-plugin-dialogs/CDVNotification.h"; sourceTree = "<group>"; }; - 74FE79B2BBB342FE8959B854 /* CoreLocation.framework */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; - 7E7966D41810823500FA85AD /* icon-40.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-40.png"; sourceTree = "<group>"; }; - 7E7966D51810823500FA85AD /* icon-40@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-40@2x.png"; sourceTree = "<group>"; }; - 7E7966D61810823500FA85AD /* icon-50.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-50.png"; sourceTree = "<group>"; }; - 7E7966D71810823500FA85AD /* icon-50@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-50@2x.png"; sourceTree = "<group>"; }; - 7E7966D81810823500FA85AD /* icon-60.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-60.png"; sourceTree = "<group>"; }; - 7E7966D91810823500FA85AD /* icon-60@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-60@2x.png"; sourceTree = "<group>"; }; - 7E7966DA1810823500FA85AD /* icon-76.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-76.png"; sourceTree = "<group>"; }; - 7E7966DB1810823500FA85AD /* icon-76@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-76@2x.png"; sourceTree = "<group>"; }; - 7E7966DC1810823500FA85AD /* icon-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small.png"; sourceTree = "<group>"; }; - 7E7966DD1810823500FA85AD /* icon-small@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-small@2x.png"; sourceTree = "<group>"; }; - 8830DF01B00A4C6D921E419F /* CDVReachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVReachability.h; path = "cordova-plugin-network-information/CDVReachability.h"; sourceTree = "<group>"; }; - 8CCA6E6A75254F1B96D427E5 /* CDVSplashScreen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVSplashScreen.h; path = "cordova-plugin-splashscreen/CDVSplashScreen.h"; sourceTree = "<group>"; }; - 8D1107310486CEB800E47090 /* Stone Island-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Stone Island-Info.plist"; path = "../Stone Island-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; }; - 8E381DE32F02400EA258418E /* CDVConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVConnection.m; path = "cordova-plugin-network-information/CDVConnection.m"; sourceTree = "<group>"; }; - 900B1AD106FC41E3BFA9FE3C /* MessageUI.framework */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; }; - 957624AEF43F4195A559B6D1 /* IonicKeyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IonicKeyboard.h; path = com.ionic.keyboard/IonicKeyboard.h; sourceTree = "<group>"; }; - 983FEA48E6A049E8BAF9C572 /* StoreKit.framework */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; - 9DA5A6FCAA884998901EF477 /* CDVInAppBrowser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVInAppBrowser.m; path = "cordova-plugin-inappbrowser/CDVInAppBrowser.m"; sourceTree = "<group>"; }; - A1FE471673034577ABDADC36 /* CDVNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVNotification.m; path = "cordova-plugin-dialogs/CDVNotification.m"; sourceTree = "<group>"; }; - A3766D89217745BD942966AA /* SocialSharing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SocialSharing.m; path = "cordova-plugin-x-socialsharing/SocialSharing.m"; sourceTree = "<group>"; }; - AA6C7622E794422B951B8F12 /* AppDelegate+notification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "AppDelegate+notification.h"; path = "phonegap-plugin-push/AppDelegate+notification.h"; sourceTree = "<group>"; }; - B3F3C58C9BDE42978CEB4933 /* CDVInAppBrowser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVInAppBrowser.h; path = "cordova-plugin-inappbrowser/CDVInAppBrowser.h"; sourceTree = "<group>"; }; - B5EFE915B36849CE94B2AE61 /* SocialSharing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SocialSharing.h; path = "cordova-plugin-x-socialsharing/SocialSharing.h"; sourceTree = "<group>"; }; - C5E8712951F2426B9EC42E16 /* SystemConfiguration.framework */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; - D4A0D8751607E02300AEF8BB /* Default-568h@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x~iphone.png"; sourceTree = "<group>"; }; - D56062D99BAE4CDA88CB01BD /* AudioToolbox.framework */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; - D589BCAC5A8B4E5A94206C36 /* CDVDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVDevice.h; path = "cordova-plugin-device/CDVDevice.h"; sourceTree = "<group>"; }; - D8F867F531144EFD9B5D1277 /* CDVDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVDevice.m; path = "cordova-plugin-device/CDVDevice.m"; sourceTree = "<group>"; }; - DBAC083B6EEF4FB38ED1C4B2 /* Accounts.framework */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.framework; name = Accounts.framework; path = System/Library/Frameworks/Accounts.framework; sourceTree = SDKROOT; }; - E0289321840940989600F684 /* PushPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PushPlugin.h; path = "phonegap-plugin-push/PushPlugin.h"; sourceTree = "<group>"; }; - E164C253C9004A0898A7606E /* Security.framework */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; - E281A1AF5CAC496486193F7D /* AppDelegate+notification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "AppDelegate+notification.m"; path = "phonegap-plugin-push/AppDelegate+notification.m"; sourceTree = "<group>"; }; - E88AD47F098D47C99EC93E5B /* PushPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PushPlugin.m; path = "phonegap-plugin-push/PushPlugin.m"; sourceTree = "<group>"; }; - E8CD74D09FBA4BE8AE8FA935 /* CDVViewController+SplashScreen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "CDVViewController+SplashScreen.h"; path = "cordova-plugin-splashscreen/CDVViewController+SplashScreen.h"; sourceTree = "<group>"; }; - EB87FDF21871DA7A0020F90C /* merges */ = {isa = PBXFileReference; lastKnownFileType = folder; name = merges; path = ../../merges; sourceTree = "<group>"; }; + 6AFF5BF81D6E424B00AB3073 /* CDVLaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = CDVLaunchScreen.storyboard; path = "Stone Island/CDVLaunchScreen.storyboard"; sourceTree = SOURCE_ROOT; }; + 8D1107310486CEB800E47090 /* Stone Island-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Stone Island-Info.plist"; path = "Stone Island/Stone Island-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = SOURCE_ROOT; }; EB87FDF31871DA8E0020F90C /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; name = www; path = ../../www; sourceTree = "<group>"; }; EB87FDF41871DAF40020F90C /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = config.xml; path = ../../config.xml; sourceTree = "<group>"; }; - EDCE0392D0524C77B377854D /* Parse.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Parse.framework; path = "Stone Island/Plugins/com.parse.cordova.core.pushplugin/Parse.framework"; sourceTree = "<group>"; }; - F0AAFF41056245EFBF8D4D8F /* CDVLocation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVLocation.m; path = "cordova-plugin-geolocation/CDVLocation.m"; sourceTree = "<group>"; }; F840E1F0165FE0F500CFE078 /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = config.xml; path = "Stone Island/config.xml"; sourceTree = "<group>"; }; + ED33DF2A687741AEAF9F8254 /* Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "Bridging-Header.h"; path = "Bridging-Header.h"; sourceTree = "<group>"; }; + 35719EF303D44796AE2F8232 /* IonicKeyboard.m */ = {isa = PBXFileReference; name = "IonicKeyboard.m"; path = "com.ionic.keyboard/IonicKeyboard.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + 4BEFB560983744AF95D76E66 /* UIWebViewExtension.m */ = {isa = PBXFileReference; name = "UIWebViewExtension.m"; path = "com.ionic.keyboard/UIWebViewExtension.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + CF48BF1935C2459594839AE5 /* IonicKeyboard.h */ = {isa = PBXFileReference; name = "IonicKeyboard.h"; path = "com.ionic.keyboard/IonicKeyboard.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 06638D058B744ADBA7DF0E3E /* UIWebViewExtension.h */ = {isa = PBXFileReference; name = "UIWebViewExtension.h"; path = "com.ionic.keyboard/UIWebViewExtension.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 8961158EB65445E1BB6CB501 /* CDVParsePlugin.m */ = {isa = PBXFileReference; name = "CDVParsePlugin.m"; path = "com.parse.cordova.core.pushplugin/CDVParsePlugin.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + 2ABCC9D074F74A0680DAE629 /* CDVParsePlugin.h */ = {isa = PBXFileReference; name = "CDVParsePlugin.h"; path = "com.parse.cordova.core.pushplugin/CDVParsePlugin.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 3F97090F6B544E2BB1609DBE /* Accounts.framework */ = {isa = PBXFileReference; name = "Accounts.framework"; path = "System/Library/Frameworks/Accounts.framework"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = wrapper.framework; explicitFileType = undefined; includeInIndex = 0; }; + 1DC035EE9BA24D4FA0966C97 /* AudioToolbox.framework */ = {isa = PBXFileReference; name = "AudioToolbox.framework"; path = "System/Library/Frameworks/AudioToolbox.framework"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = wrapper.framework; explicitFileType = undefined; includeInIndex = 0; }; + 9B23FCE8A14F4788A06368CD /* CFNetwork.framework */ = {isa = PBXFileReference; name = "CFNetwork.framework"; path = "System/Library/Frameworks/CFNetwork.framework"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = wrapper.framework; explicitFileType = undefined; includeInIndex = 0; }; + 71127DE451034E8DADBC2908 /* CoreLocation.framework */ = {isa = PBXFileReference; name = "CoreLocation.framework"; path = "System/Library/Frameworks/CoreLocation.framework"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = wrapper.framework; explicitFileType = undefined; includeInIndex = 0; }; + 5FA9837E4C93446C84474512 /* QuartzCore.framework */ = {isa = PBXFileReference; name = "QuartzCore.framework"; path = "System/Library/Frameworks/QuartzCore.framework"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = wrapper.framework; explicitFileType = undefined; includeInIndex = 0; }; + ED0B669B92E5409282AE1703 /* Security.framework */ = {isa = PBXFileReference; name = "Security.framework"; path = "System/Library/Frameworks/Security.framework"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = wrapper.framework; explicitFileType = undefined; includeInIndex = 0; }; + B4768CC0A2D74CFF84597C0C /* Social.framework */ = {isa = PBXFileReference; name = "Social.framework"; path = "System/Library/Frameworks/Social.framework"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = wrapper.framework; explicitFileType = undefined; includeInIndex = 0; }; + CCE8D44B5FFF4EF4BB46F74F /* StoreKit.framework */ = {isa = PBXFileReference; name = "StoreKit.framework"; path = "System/Library/Frameworks/StoreKit.framework"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = wrapper.framework; explicitFileType = undefined; includeInIndex = 0; }; + 94099699ABA44203A173F33E /* SystemConfiguration.framework */ = {isa = PBXFileReference; name = "SystemConfiguration.framework"; path = "System/Library/Frameworks/SystemConfiguration.framework"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = wrapper.framework; explicitFileType = undefined; includeInIndex = 0; }; + 8998048060D1426C8BD2870D /* libz.dylib */ = {isa = PBXFileReference; name = "libz.dylib"; path = "usr/lib/libz.dylib"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = compiled.mach-o.dylib; explicitFileType = undefined; includeInIndex = 0; }; + B6675D8E364642F0ABE3B97F /* libsqlite3.dylib */ = {isa = PBXFileReference; name = "libsqlite3.dylib"; path = "usr/lib/libsqlite3.dylib"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = compiled.mach-o.dylib; explicitFileType = undefined; includeInIndex = 0; }; + 34D6F0009780486D8A07BD47 /* Bolts.framework */ = {isa = PBXFileReference; name = "Bolts.framework"; path = "Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.framework; explicitFileType = undefined; includeInIndex = 0; }; + 21B8104F65F9433D9A7D53F9 /* Parse.framework */ = {isa = PBXFileReference; name = "Parse.framework"; path = "Stone Island/Plugins/com.parse.cordova.core.pushplugin/Parse.framework"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.framework; explicitFileType = undefined; includeInIndex = 0; }; + A14E782B69CC473DAD94F0C7 /* CDVLogger.m */ = {isa = PBXFileReference; name = "CDVLogger.m"; path = "cordova-plugin-console/CDVLogger.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + 18F0008910714D37A5AAB051 /* CDVLogger.h */ = {isa = PBXFileReference; name = "CDVLogger.h"; path = "cordova-plugin-console/CDVLogger.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 5ABD34598B224612824BAE63 /* CDVDevice.m */ = {isa = PBXFileReference; name = "CDVDevice.m"; path = "cordova-plugin-device/CDVDevice.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + 1D3E5D77A1C04222A06877D1 /* CDVDevice.h */ = {isa = PBXFileReference; name = "CDVDevice.h"; path = "cordova-plugin-device/CDVDevice.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 8661BF08EC7E4B558802CD5B /* CDVNotification.m */ = {isa = PBXFileReference; name = "CDVNotification.m"; path = "cordova-plugin-dialogs/CDVNotification.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + 91BCA5405B914228B95870B5 /* CDVNotification.h */ = {isa = PBXFileReference; name = "CDVNotification.h"; path = "cordova-plugin-dialogs/CDVNotification.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 00599E51D9234D71BE6C6B79 /* CDVNotification.bundle */ = {isa = PBXFileReference; name = "CDVNotification.bundle"; path = "CDVNotification.bundle"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.plug-in; explicitFileType = undefined; includeInIndex = 0; }; + 8C77AAEFAED7486E987AEB6B /* CDVLocation.m */ = {isa = PBXFileReference; name = "CDVLocation.m"; path = "cordova-plugin-geolocation/CDVLocation.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + 2028DD29E5AF40B897C31D46 /* CDVLocation.h */ = {isa = PBXFileReference; name = "CDVLocation.h"; path = "cordova-plugin-geolocation/CDVLocation.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 7A42A487C79A4ADA9A06AF42 /* CDVInAppBrowser.m */ = {isa = PBXFileReference; name = "CDVInAppBrowser.m"; path = "cordova-plugin-inappbrowser/CDVInAppBrowser.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + 71D53167DC724B13A307C921 /* CDVInAppBrowser.h */ = {isa = PBXFileReference; name = "CDVInAppBrowser.h"; path = "cordova-plugin-inappbrowser/CDVInAppBrowser.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 44DD171A422D46B1B1ADBF83 /* CDVConnection.m */ = {isa = PBXFileReference; name = "CDVConnection.m"; path = "cordova-plugin-network-information/CDVConnection.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + 279BD4938BA54F7ABCCEFC0E /* CDVReachability.m */ = {isa = PBXFileReference; name = "CDVReachability.m"; path = "cordova-plugin-network-information/CDVReachability.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + 391D852A25F441A3855582E1 /* CDVConnection.h */ = {isa = PBXFileReference; name = "CDVConnection.h"; path = "cordova-plugin-network-information/CDVConnection.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 9056B9226A1F4D3EA6BD1AE3 /* CDVReachability.h */ = {isa = PBXFileReference; name = "CDVReachability.h"; path = "cordova-plugin-network-information/CDVReachability.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 1065E9EBB93145AA8CAFDE8A /* CDVSplashScreen.m */ = {isa = PBXFileReference; name = "CDVSplashScreen.m"; path = "cordova-plugin-splashscreen/CDVSplashScreen.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + 16CA61E384604A269060D490 /* CDVViewController+SplashScreen.m */ = {isa = PBXFileReference; name = "CDVViewController+SplashScreen.m"; path = "cordova-plugin-splashscreen/CDVViewController+SplashScreen.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + 4578B94774954F959F83F234 /* CDVSplashScreen.h */ = {isa = PBXFileReference; name = "CDVSplashScreen.h"; path = "cordova-plugin-splashscreen/CDVSplashScreen.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + E3EB360F480E4833900EAECA /* CDVViewController+SplashScreen.h */ = {isa = PBXFileReference; name = "CDVViewController+SplashScreen.h"; path = "cordova-plugin-splashscreen/CDVViewController+SplashScreen.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + AC21935FEAD34A7DA271CCF4 /* SocialSharing.m */ = {isa = PBXFileReference; name = "SocialSharing.m"; path = "cordova-plugin-x-socialsharing/SocialSharing.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + 914101A237AF4A50823AB148 /* SocialSharing.h */ = {isa = PBXFileReference; name = "SocialSharing.h"; path = "cordova-plugin-x-socialsharing/SocialSharing.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + E71962D2059240E3BCCFF098 /* MessageUI.framework */ = {isa = PBXFileReference; name = "MessageUI.framework"; path = "System/Library/Frameworks/MessageUI.framework"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = wrapper.framework; explicitFileType = undefined; includeInIndex = 0; }; + 51738B4AC1F2488D928587E2 /* AppDelegate+notification.m */ = {isa = PBXFileReference; name = "AppDelegate+notification.m"; path = "phonegap-plugin-push/AppDelegate+notification.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + 8E50FC1FE8224862947FA2D3 /* PushPlugin.m */ = {isa = PBXFileReference; name = "PushPlugin.m"; path = "phonegap-plugin-push/PushPlugin.m"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; explicitFileType = undefined; includeInIndex = 0; }; + 244D1A19F6214FEB8FF6B8F0 /* AppDelegate+notification.h */ = {isa = PBXFileReference; name = "AppDelegate+notification.h"; path = "phonegap-plugin-push/AppDelegate+notification.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; + 4A0B9D17F3654DC0BC822CED /* PushPlugin.h */ = {isa = PBXFileReference; name = "PushPlugin.h"; path = "phonegap-plugin-push/PushPlugin.h"; sourceTree = "<group>"; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; explicitFileType = undefined; includeInIndex = 0; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -185,24 +138,21 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 5B1594DD16A7569C00FEF299 /* AssetsLibrary.framework in Frameworks */, 301BF552109A68D80062928A /* libCordova.a in Frameworks */, - 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */, - 305D5FD1115AB8F900A74A75 /* MobileCoreServices.framework in Frameworks */, - 408BB6834FA04C6191311981 /* AudioToolbox.framework in Frameworks */, - 9E30F0C9E89D48B7BDD54E6B /* CoreLocation.framework in Frameworks */, - 32C7881E372548B8B10FCD81 /* SystemConfiguration.framework in Frameworks */, - C520CB1888FA4F4E963A4605 /* Social.framework in Frameworks */, - F7CC7E6030524635AC59C0A0 /* MessageUI.framework in Frameworks */, - 3102D8D9D718447EA83756B0 /* Accounts.framework in Frameworks */, - F15FEE33CBCA427DA2D787F4 /* CFNetwork.framework in Frameworks */, - A7F71F118E604F32AE765DFD /* QuartzCore.framework in Frameworks */, - 68795A6B86504E52812A115C /* Security.framework in Frameworks */, - 93F9C9374ABA4745AF40DA08 /* StoreKit.framework in Frameworks */, - 12F814F101B54B69BBBCC136 /* libz.dylib in Frameworks */, - 5F8DBCF934714D4D8F58F78C /* libsqlite3.dylib in Frameworks */, - 571B90B51E784D48BDAE8EB8 /* Bolts.framework in Frameworks */, - 6E6F1C559C9840249E48D92E /* Parse.framework in Frameworks */, + 9920D41C2D9C41AC9F772D8B /* Accounts.framework in Frameworks */, + 0315761036204E3B845F89A9 /* AudioToolbox.framework in Frameworks */, + 6D2024FED5EA43498DA1928E /* CFNetwork.framework in Frameworks */, + CF20D68FB9D547DF8164F3A5 /* CoreLocation.framework in Frameworks */, + 5977ACEEEDF4439A93AD46A5 /* QuartzCore.framework in Frameworks */, + 4DD3F0B57F8247199AA52EE7 /* Security.framework in Frameworks */, + 79567EACD25049808A22E639 /* Social.framework in Frameworks */, + 67EB671357AC4E29ADCE0B7C /* StoreKit.framework in Frameworks */, + 64541CA1793A46F7AE78DA82 /* SystemConfiguration.framework in Frameworks */, + 4CEA203A6C864572AB3D4718 /* libz.dylib in Frameworks */, + 0580F77611BF4A32B709B4AB /* libsqlite3.dylib in Frameworks */, + C03FF8C4AD384677BC558F8E /* Bolts.framework in Frameworks */, + 4F04AAC460204786A9B6F8D6 /* Parse.framework in Frameworks */, + A02C9C20257D48A3AB5125C9 /* MessageUI.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -235,7 +185,6 @@ children = ( EB87FDF41871DAF40020F90C /* config.xml */, EB87FDF31871DA8E0020F90C /* www */, - EB87FDF21871DA7A0020F90C /* merges */, EB87FDF11871DA420020F90C /* Staging */, 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */, 080E96DDFE201D6D7F000001 /* Classes */, @@ -253,6 +202,7 @@ children = ( 32CA4F630368D1EE00C91783 /* Stone Island-Prefix.pch */, 29B97316FDCFA39411CA2CEA /* main.m */, + ED33DF2A687741AEAF9F8254 /* Bridging-Header.h */, ); name = "Other Sources"; path = "Stone Island"; @@ -261,10 +211,11 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( - 308D052D1370CCF300D202BF /* icons */, - 308D05311370CCF300D202BF /* splash */, + 0207DA571B56EA530066E2B4 /* Images.xcassets */, + 3047A50E1AB8057F00498E2A /* config */, 8D1107310486CEB800E47090 /* Stone Island-Info.plist */, - 72C981F273644F2AA5D17C78 /* CDVNotification.bundle */, + 6AFF5BF81D6E424B00AB3073 /* CDVLaunchScreen.storyboard */, + 00599E51D9234D71BE6C6B79 /* CDVNotification.bundle */, ); name = Resources; path = "Stone Island/Resources"; @@ -273,23 +224,20 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( - 5B1594DC16A7569C00FEF299 /* AssetsLibrary.framework */, - 288765FC0DF74451002DB57D /* CoreGraphics.framework */, - 305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */, - D56062D99BAE4CDA88CB01BD /* AudioToolbox.framework */, - 74FE79B2BBB342FE8959B854 /* CoreLocation.framework */, - C5E8712951F2426B9EC42E16 /* SystemConfiguration.framework */, - 34ADAA286CAF455C830BBC5A /* Social.framework */, - 900B1AD106FC41E3BFA9FE3C /* MessageUI.framework */, - DBAC083B6EEF4FB38ED1C4B2 /* Accounts.framework */, - 581F34F5A1784D4D9A99F383 /* CFNetwork.framework */, - 38EE2AA2E4DD46CEA0DA5F7C /* QuartzCore.framework */, - E164C253C9004A0898A7606E /* Security.framework */, - 983FEA48E6A049E8BAF9C572 /* StoreKit.framework */, - 2A4EF415F441417C98D8794B /* libz.dylib */, - 7084D4977636441A9FCB146A /* libsqlite3.dylib */, - 1045410447CE4A2EA0F38BDD /* Bolts.framework */, - EDCE0392D0524C77B377854D /* Parse.framework */, + 3F97090F6B544E2BB1609DBE /* Accounts.framework */, + 1DC035EE9BA24D4FA0966C97 /* AudioToolbox.framework */, + 9B23FCE8A14F4788A06368CD /* CFNetwork.framework */, + 71127DE451034E8DADBC2908 /* CoreLocation.framework */, + 5FA9837E4C93446C84474512 /* QuartzCore.framework */, + ED0B669B92E5409282AE1703 /* Security.framework */, + B4768CC0A2D74CFF84597C0C /* Social.framework */, + CCE8D44B5FFF4EF4BB46F74F /* StoreKit.framework */, + 94099699ABA44203A173F33E /* SystemConfiguration.framework */, + 8998048060D1426C8BD2870D /* libz.dylib */, + B6675D8E364642F0ABE3B97F /* libsqlite3.dylib */, + 34D6F0009780486D8A07BD47 /* Bolts.framework */, + 21B8104F65F9433D9A7D53F9 /* Parse.framework */, + E71962D2059240E3BCCFF098 /* MessageUI.framework */, ); name = Frameworks; sourceTree = "<group>"; @@ -302,82 +250,53 @@ name = Products; sourceTree = "<group>"; }; - 307C750510C5A3420062BCA9 /* Plugins */ = { + 3047A50E1AB8057F00498E2A /* config */ = { isa = PBXGroup; children = ( - 62533E046CE7411F9CEA6CD8 /* IonicKeyboard.m */, - 212497AFB9DF4A2DB3E5FD54 /* UIWebViewExtension.m */, - 957624AEF43F4195A559B6D1 /* IonicKeyboard.h */, - 10DCEB5771BD4985B87AEE16 /* UIWebViewExtension.h */, - 02EC23045EE24BFE9394BE84 /* CDVLogger.m */, - 6FC663108EE441BDBE0A8798 /* CDVLogger.h */, - D8F867F531144EFD9B5D1277 /* CDVDevice.m */, - D589BCAC5A8B4E5A94206C36 /* CDVDevice.h */, - A1FE471673034577ABDADC36 /* CDVNotification.m */, - 74C07E6CE112438D85A76E75 /* CDVNotification.h */, - F0AAFF41056245EFBF8D4D8F /* CDVLocation.m */, - 48DD63B975BE476F9E36BE07 /* CDVLocation.h */, - 8E381DE32F02400EA258418E /* CDVConnection.m */, - 2B028C25F84445B7A197B963 /* CDVReachability.m */, - 04159F17E941486B943DF119 /* CDVConnection.h */, - 8830DF01B00A4C6D921E419F /* CDVReachability.h */, - 50D9FE1D2FA7402BB6B538DD /* CDVSplashScreen.m */, - 4F1FF1ED80D34C91A03C18FD /* CDVViewController+SplashScreen.m */, - 8CCA6E6A75254F1B96D427E5 /* CDVSplashScreen.h */, - E8CD74D09FBA4BE8AE8FA935 /* CDVViewController+SplashScreen.h */, - A3766D89217745BD942966AA /* SocialSharing.m */, - B5EFE915B36849CE94B2AE61 /* SocialSharing.h */, - E281A1AF5CAC496486193F7D /* AppDelegate+notification.m */, - E88AD47F098D47C99EC93E5B /* PushPlugin.m */, - AA6C7622E794422B951B8F12 /* AppDelegate+notification.h */, - E0289321840940989600F684 /* PushPlugin.h */, - 9DA5A6FCAA884998901EF477 /* CDVInAppBrowser.m */, - B3F3C58C9BDE42978CEB4933 /* CDVInAppBrowser.h */, - 3048B836F3BD467E83BFF217 /* CDVParsePlugin.m */, - 48C0A6981FEE47D091E9781C /* CDVParsePlugin.h */, + 3047A50F1AB8059700498E2A /* build-debug.xcconfig */, + 3047A5101AB8059700498E2A /* build-release.xcconfig */, + 3047A5111AB8059700498E2A /* build.xcconfig */, ); - name = Plugins; - path = "Stone Island/Plugins"; - sourceTree = SOURCE_ROOT; - }; - 308D052D1370CCF300D202BF /* icons */ = { - isa = PBXGroup; - children = ( - 30C1856519D5FC0A00212699 /* icon-60@3x.png */, - 7E7966D41810823500FA85AD /* icon-40.png */, - 7E7966D51810823500FA85AD /* icon-40@2x.png */, - 7E7966D61810823500FA85AD /* icon-50.png */, - 7E7966D71810823500FA85AD /* icon-50@2x.png */, - 7E7966D81810823500FA85AD /* icon-60.png */, - 7E7966D91810823500FA85AD /* icon-60@2x.png */, - 7E7966DA1810823500FA85AD /* icon-76.png */, - 7E7966DB1810823500FA85AD /* icon-76@2x.png */, - 7E7966DC1810823500FA85AD /* icon-small.png */, - 7E7966DD1810823500FA85AD /* icon-small@2x.png */, - 30FC414816E50CA1004E6F35 /* icon-72@2x.png */, - 308D052E1370CCF300D202BF /* icon-72.png */, - 308D052F1370CCF300D202BF /* icon.png */, - 308D05301370CCF300D202BF /* icon@2x.png */, - ); - path = icons; + name = config; sourceTree = "<group>"; }; - 308D05311370CCF300D202BF /* splash */ = { + 307C750510C5A3420062BCA9 /* Plugins */ = { isa = PBXGroup; children = ( - 30B4F2FD19D5E07200D9F7D8 /* Default-667h.png */, - 30B4F2FE19D5E07200D9F7D8 /* Default-736h.png */, - 30B4F2FF19D5E07200D9F7D8 /* Default-Landscape-736h.png */, - D4A0D8751607E02300AEF8BB /* Default-568h@2x~iphone.png */, - 3088BBB7154F3926009F9C59 /* Default-Landscape@2x~ipad.png */, - 3088BBB8154F3926009F9C59 /* Default-Landscape~ipad.png */, - 3088BBB9154F3926009F9C59 /* Default-Portrait@2x~ipad.png */, - 3088BBBA154F3926009F9C59 /* Default-Portrait~ipad.png */, - 3088BBBB154F3926009F9C59 /* Default@2x~iphone.png */, - 3088BBBC154F3926009F9C59 /* Default~iphone.png */, + 35719EF303D44796AE2F8232 /* IonicKeyboard.m */, + 4BEFB560983744AF95D76E66 /* UIWebViewExtension.m */, + CF48BF1935C2459594839AE5 /* IonicKeyboard.h */, + 06638D058B744ADBA7DF0E3E /* UIWebViewExtension.h */, + 8961158EB65445E1BB6CB501 /* CDVParsePlugin.m */, + 2ABCC9D074F74A0680DAE629 /* CDVParsePlugin.h */, + A14E782B69CC473DAD94F0C7 /* CDVLogger.m */, + 18F0008910714D37A5AAB051 /* CDVLogger.h */, + 5ABD34598B224612824BAE63 /* CDVDevice.m */, + 1D3E5D77A1C04222A06877D1 /* CDVDevice.h */, + 8661BF08EC7E4B558802CD5B /* CDVNotification.m */, + 91BCA5405B914228B95870B5 /* CDVNotification.h */, + 8C77AAEFAED7486E987AEB6B /* CDVLocation.m */, + 2028DD29E5AF40B897C31D46 /* CDVLocation.h */, + 7A42A487C79A4ADA9A06AF42 /* CDVInAppBrowser.m */, + 71D53167DC724B13A307C921 /* CDVInAppBrowser.h */, + 44DD171A422D46B1B1ADBF83 /* CDVConnection.m */, + 279BD4938BA54F7ABCCEFC0E /* CDVReachability.m */, + 391D852A25F441A3855582E1 /* CDVConnection.h */, + 9056B9226A1F4D3EA6BD1AE3 /* CDVReachability.h */, + 1065E9EBB93145AA8CAFDE8A /* CDVSplashScreen.m */, + 16CA61E384604A269060D490 /* CDVViewController+SplashScreen.m */, + 4578B94774954F959F83F234 /* CDVSplashScreen.h */, + E3EB360F480E4833900EAECA /* CDVViewController+SplashScreen.h */, + AC21935FEAD34A7DA271CCF4 /* SocialSharing.m */, + 914101A237AF4A50823AB148 /* SocialSharing.h */, + 51738B4AC1F2488D928587E2 /* AppDelegate+notification.m */, + 8E50FC1FE8224862947FA2D3 /* PushPlugin.m */, + 244D1A19F6214FEB8FF6B8F0 /* AppDelegate+notification.h */, + 4A0B9D17F3654DC0BC822CED /* PushPlugin.h */, ); - path = splash; - sourceTree = "<group>"; + name = Plugins; + path = "Stone Island/Plugins"; + sourceTree = SOURCE_ROOT; }; EB87FDF11871DA420020F90C /* Staging */ = { isa = PBXGroup; @@ -417,31 +336,11 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 510; - TargetAttributes = { - 1D6058900D05DD3D006BFB54 = { - DevelopmentTeam = C6JQTPGJ97; - SystemCapabilities = { - com.apple.Push = { - enabled = 1; - }; - }; - }; - }; }; - buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Stone Island" */; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "__NON-CLI__" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - en, - es, - de, - se, - ); mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; projectDirPath = ""; projectReferences = ( @@ -472,33 +371,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 7E7966E41810823500FA85AD /* icon-76.png in Resources */, - 7E7966DF1810823500FA85AD /* icon-40@2x.png in Resources */, - 308D05371370CCF300D202BF /* icon-72.png in Resources */, - 30B4F30119D5E07200D9F7D8 /* Default-736h.png in Resources */, - 308D05381370CCF300D202BF /* icon.png in Resources */, - 308D05391370CCF300D202BF /* icon@2x.png in Resources */, 302D95F214D2391D003F00A1 /* MainViewController.xib in Resources */, - 7E7966E01810823500FA85AD /* icon-50.png in Resources */, - 7E7966E31810823500FA85AD /* icon-60@2x.png in Resources */, - 7E7966E61810823500FA85AD /* icon-small.png in Resources */, - 3088BBBD154F3926009F9C59 /* Default-Landscape@2x~ipad.png in Resources */, - 3088BBBE154F3926009F9C59 /* Default-Landscape~ipad.png in Resources */, - 3088BBBF154F3926009F9C59 /* Default-Portrait@2x~ipad.png in Resources */, - 7E7966E71810823500FA85AD /* icon-small@2x.png in Resources */, - 3088BBC0154F3926009F9C59 /* Default-Portrait~ipad.png in Resources */, - 30B4F30019D5E07200D9F7D8 /* Default-667h.png in Resources */, - 7E7966DE1810823500FA85AD /* icon-40.png in Resources */, - 3088BBC1154F3926009F9C59 /* Default@2x~iphone.png in Resources */, - 7E7966E21810823500FA85AD /* icon-60.png in Resources */, - 3088BBC2154F3926009F9C59 /* Default~iphone.png in Resources */, - D4A0D8761607E02300AEF8BB /* Default-568h@2x~iphone.png in Resources */, - 30B4F30219D5E07200D9F7D8 /* Default-Landscape-736h.png in Resources */, - 30C1856619D5FC0A00212699 /* icon-60@3x.png in Resources */, - 7E7966E11810823500FA85AD /* icon-50@2x.png in Resources */, - 7E7966E51810823500FA85AD /* icon-76@2x.png in Resources */, - 30FC414916E50CA1004E6F35 /* icon-72@2x.png in Resources */, - E0D1A618D2134B69A25CAE5A /* CDVNotification.bundle in Resources */, + 0207DA581B56EA530066E2B4 /* Images.xcassets in Resources */, + 6AFF5BF91D6E424B00AB3073 /* CDVLaunchScreen.storyboard in Resources */, + 932BB112D8D247E59DBC8C55 /* CDVNotification.bundle in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -530,21 +406,21 @@ 1D60589B0D05DD56006BFB54 /* main.m in Sources */, 1D3623260D0F684500981E51 /* AppDelegate.m in Sources */, 302D95F114D2391D003F00A1 /* MainViewController.m in Sources */, - C637100EF6E8411FA1763828 /* IonicKeyboard.m in Sources */, - 63C9F749184B43B0BE065836 /* UIWebViewExtension.m in Sources */, - 0D43DE7D3F4F4D2CA1143CCD /* CDVLogger.m in Sources */, - 1C6E37642CB44321B8FD1542 /* CDVDevice.m in Sources */, - 11985887CF254F1E9F1F784D /* CDVNotification.m in Sources */, - BC44C1F8D6E54E169B1C3024 /* CDVLocation.m in Sources */, - 253B3D6A9B1B46C6A20040D4 /* CDVConnection.m in Sources */, - 732516F97C734279A694F2E2 /* CDVReachability.m in Sources */, - 741DEC619396417790762781 /* CDVSplashScreen.m in Sources */, - E507737F3A0941E68A569F9B /* CDVViewController+SplashScreen.m in Sources */, - 54A78D3704F04282B4BD0B36 /* SocialSharing.m in Sources */, - 04679954946B416BAF5109F4 /* AppDelegate+notification.m in Sources */, - A51DA261CB3F4B89BC98FFDE /* PushPlugin.m in Sources */, - E9AB3A7C5BC846C8877B780D /* CDVInAppBrowser.m in Sources */, - CE2E2F6D58504A0EA2470AEE /* CDVParsePlugin.m in Sources */, + C5CB6DF47C5D417891456B4D /* IonicKeyboard.m in Sources */, + CD393F23C04449E48147FEFA /* UIWebViewExtension.m in Sources */, + 9BF4E6A8A54F45E4BDCB35E8 /* CDVParsePlugin.m in Sources */, + 203198C6486B4906B0D2EAF3 /* CDVLogger.m in Sources */, + E23A6ED28D414A9FA31C18D6 /* CDVDevice.m in Sources */, + CCDF00EE9C05477D9BD17C8D /* CDVNotification.m in Sources */, + C8B9F882FA744E0A85EBFA1F /* CDVLocation.m in Sources */, + 3325D19426B948B38F318D73 /* CDVInAppBrowser.m in Sources */, + 891101010EEA4D5491CA8B0B /* CDVConnection.m in Sources */, + 79688F2F8B804507B919AE23 /* CDVReachability.m in Sources */, + E95FE2CE364D40F896F2D12A /* CDVSplashScreen.m in Sources */, + AAF050E78DED436DB51647A4 /* CDVViewController+SplashScreen.m in Sources */, + 8C9F50FD574A4962975E4B50 /* SocialSharing.m in Sources */, + 566265D394B24F0F851B64B8 /* AppDelegate+notification.m in Sources */, + 05BFC92227794306A1A49D2D /* PushPlugin.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -561,18 +437,14 @@ /* Begin XCBuildConfiguration section */ 1D6058940D05DD3E006BFB54 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 3047A50F1AB8059700498E2A /* build-debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"Stone Island/Plugins/com.parse.cordova.core.pushplugin\"", - "\"Stone Island/Plugins/com.parse.cordova.core.pushplugin\"", - ); GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -580,67 +452,46 @@ GCC_THUMB_SUPPORT = NO; GCC_VERSION = ""; INFOPLIST_FILE = "Stone Island/Stone Island-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; - ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ( - "-weak_framework", - CoreFoundation, - "-weak_framework", - UIKit, - "-weak_framework", - AVFoundation, - "-weak_framework", - CoreMedia, - "-weak-lSystem", - "-ObjC", - ); + LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; PRODUCT_NAME = "Stone Island"; - PROVISIONING_PROFILE = ""; - TARGETED_DEVICE_FAMILY = 1; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"Stone Island/Plugins/com.parse.cordova.core.pushplugin\"", + "\"Stone Island/Plugins/com.parse.cordova.core.pushplugin\"", + ); }; name = Debug; }; 1D6058950D05DD3E006BFB54 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 3047A5101AB8059700498E2A /* build-release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"Stone Island/Plugins/com.parse.cordova.core.pushplugin\"", - "\"Stone Island/Plugins/com.parse.cordova.core.pushplugin\"", - ); GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Stone Island/Stone Island-Prefix.pch"; GCC_THUMB_SUPPORT = NO; GCC_VERSION = ""; INFOPLIST_FILE = "Stone Island/Stone Island-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; - OTHER_LDFLAGS = ( - "-weak_framework", - CoreFoundation, - "-weak_framework", - UIKit, - "-weak_framework", - AVFoundation, - "-weak_framework", - CoreMedia, - "-weak-lSystem", - "-ObjC", - ); + LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; PRODUCT_NAME = "Stone Island"; - PROVISIONING_PROFILE = ""; - TARGETED_DEVICE_FAMILY = 1; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"Stone Island/Plugins/com.parse.cordova.core.pushplugin\"", + "\"Stone Island/Plugins/com.parse.cordova.core.pushplugin\"", + ); }; name = Release; }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 3047A5111AB8059700498E2A /* build.xcconfig */; buildSettings = { + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; @@ -648,7 +499,6 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = c99; GCC_THUMB_SUPPORT = NO; GCC_VERSION = ""; @@ -657,34 +507,17 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "\"$(TARGET_BUILD_DIR)/usr/local/lib/include\"", - "\"$(OBJROOT)/UninstalledProducts/include\"", - "\"$(BUILT_PRODUCTS_DIR)\"", - ); - IPHONEOS_DEPLOYMENT_TARGET = 6.0; ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ( - "-weak_framework", - CoreFoundation, - "-weak_framework", - UIKit, - "-weak_framework", - AVFoundation, - "-weak_framework", - CoreMedia, - "-weak-lSystem", - "-ObjC", - ); SDKROOT = iphoneos; SKIP_INSTALL = NO; - USER_HEADER_SEARCH_PATHS = ""; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 3047A5111AB8059700498E2A /* build.xcconfig */; buildSettings = { + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; @@ -692,7 +525,6 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = c99; GCC_THUMB_SUPPORT = NO; GCC_VERSION = ""; @@ -701,28 +533,8 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "\"$(TARGET_BUILD_DIR)/usr/local/lib/include\"", - "\"$(OBJROOT)/UninstalledProducts/include\"", - "\"$(BUILT_PRODUCTS_DIR)\"", - "\"$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include\"", - ); - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - OTHER_LDFLAGS = ( - "-weak_framework", - CoreFoundation, - "-weak_framework", - UIKit, - "-weak_framework", - AVFoundation, - "-weak_framework", - CoreMedia, - "-weak-lSystem", - "-ObjC", - ); SDKROOT = iphoneos; SKIP_INSTALL = NO; - USER_HEADER_SEARCH_PATHS = ""; }; name = Release; }; @@ -738,7 +550,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Stone Island" */ = { + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "__NON-CLI__" */ = { isa = XCConfigurationList; buildConfigurations = ( C01FCF4F08A954540054247B /* Debug */, diff --git a/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/jules.xcuserdatad/UserInterfaceState.xcuserstate b/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/jules.xcuserdatad/UserInterfaceState.xcuserstate Binary files differdeleted file mode 100644 index d4c956dc..00000000 --- a/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/jules.xcuserdatad/UserInterfaceState.xcuserstate +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate b/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate Binary files differdeleted file mode 100755 index 36d4b5a6..00000000 --- a/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island.xcodeproj/xcuserdata/jules.xcuserdatad/xcschemes/xcschememanagement.plist b/StoneIsland/platforms/ios/Stone Island.xcodeproj/xcuserdata/jules.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index b41bffe9..00000000 --- a/StoneIsland/platforms/ios/Stone Island.xcodeproj/xcuserdata/jules.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ -<?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>Stone Island.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> diff --git a/StoneIsland/platforms/ios/Stone Island.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/Stone Island.xcscheme b/StoneIsland/platforms/ios/Stone Island.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/Stone Island.xcscheme deleted file mode 100755 index ca1a24ee..00000000 --- a/StoneIsland/platforms/ios/Stone Island.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/Stone Island.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Scheme - LastUpgradeVersion = "0710" - 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 = "Stone Island.app" - BlueprintName = "Stone Island" - ReferencedContainer = "container:Stone Island.xcodeproj"> - </BuildableReference> - </BuildActionEntry> - </BuildActionEntries> - </BuildAction> - <TestAction - buildConfiguration = "Debug" - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> - <Testables> - </Testables> - <MacroExpansion> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "1D6058900D05DD3D006BFB54" - BuildableName = "Stone Island.app" - BlueprintName = "Stone Island" - ReferencedContainer = "container:Stone Island.xcodeproj"> - </BuildableReference> - </MacroExpansion> - <AdditionalOptions> - </AdditionalOptions> - </TestAction> - <LaunchAction - buildConfiguration = "Debug" - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - launchStyle = "0" - useCustomWorkingDirectory = "NO" - ignoresPersistentStateOnLaunch = "NO" - debugDocumentVersioning = "YES" - debugServiceExtension = "internal" - allowLocationSimulation = "YES"> - <BuildableProductRunnable - runnableDebuggingMode = "0"> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "1D6058900D05DD3D006BFB54" - BuildableName = "Stone Island.app" - BlueprintName = "Stone Island" - ReferencedContainer = "container:Stone Island.xcodeproj"> - </BuildableReference> - </BuildableProductRunnable> - <AdditionalOptions> - </AdditionalOptions> - </LaunchAction> - <ProfileAction - buildConfiguration = "Release" - shouldUseLaunchSchemeArgsEnv = "YES" - savedToolIdentifier = "" - useCustomWorkingDirectory = "NO" - debugDocumentVersioning = "YES"> - <BuildableProductRunnable - runnableDebuggingMode = "0"> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "1D6058900D05DD3D006BFB54" - BuildableName = "Stone Island.app" - BlueprintName = "Stone Island" - ReferencedContainer = "container:Stone Island.xcodeproj"> - </BuildableReference> - </BuildableProductRunnable> - </ProfileAction> - <AnalyzeAction - buildConfiguration = "Debug"> - </AnalyzeAction> - <ArchiveAction - buildConfiguration = "Release" - revealArchiveInOrganizer = "YES"> - </ArchiveAction> -</Scheme> diff --git a/StoneIsland/platforms/ios/Stone Island.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/xcschememanagement.plist b/StoneIsland/platforms/ios/Stone Island.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100755 index b41bffe9..00000000 --- a/StoneIsland/platforms/ios/Stone Island.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ -<?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>Stone Island.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> diff --git a/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/StoneIsland/platforms/ios/Stone Island.xcworkspace/contents.xcworkspacedata index 919434a6..db71c716 100755..100644 --- a/StoneIsland/platforms/ios/Stone Island.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/StoneIsland/platforms/ios/Stone Island.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ <Workspace version = "1.0"> <FileRef - location = "self:"> + location = "group:Stone Island.xcodeproj"> </FileRef> </Workspace> diff --git a/StoneIsland/platforms/ios/Stone Island.xcodeproj/xcuserdata/jules.xcuserdatad/xcschemes/Stone Island.xcscheme b/StoneIsland/platforms/ios/Stone Island.xcworkspace/xcshareddata/xcschemes/Stone Island.xcscheme index 98d3e24f..72339618 100644 --- a/StoneIsland/platforms/ios/Stone Island.xcodeproj/xcuserdata/jules.xcuserdatad/xcschemes/Stone Island.xcscheme +++ b/StoneIsland/platforms/ios/Stone Island.xcworkspace/xcshareddata/xcschemes/Stone Island.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0720" + LastUpgradeVersion = "0730" version = "1.3"> <BuildAction parallelizeBuildables = "YES" diff --git a/StoneIsland/platforms/ios/Stone Island/.gitignore b/StoneIsland/platforms/ios/Stone Island/.gitignore index cc76483f..cc76483f 100755..100644 --- a/StoneIsland/platforms/ios/Stone Island/.gitignore +++ b/StoneIsland/platforms/ios/Stone Island/.gitignore diff --git a/StoneIsland/platforms/ios/Stone Island/Bridging-Header.h b/StoneIsland/platforms/ios/Stone Island/Bridging-Header.h new file mode 100644 index 00000000..5d8abc98 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Bridging-Header.h @@ -0,0 +1,28 @@ +/* + 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. + */ +// +// Bridging-Header.h +// __PROJECT_NAME__ +// +// Created by ___FULLUSERNAME___ on ___DATE___. +// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. +// +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + +#import <Cordova/CDV.h> diff --git a/StoneIsland/platforms/ios/Stone Island/CDVLaunchScreen.storyboard b/StoneIsland/platforms/ios/Stone Island/CDVLaunchScreen.storyboard new file mode 100644 index 00000000..51cdcf6d --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/CDVLaunchScreen.storyboard @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + 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. +--> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM"> + <dependencies> + <deployment identifier="iOS"/> + <development version="6100" identifier="xcode"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/> + </dependencies> + <scenes> + <!--View Controller--> + <scene sceneID="EHf-IW-A2E"> + <objects> + <viewController id="01J-lp-oVM" sceneMemberID="viewController"> + <layoutGuides> + <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/> + <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/> + </layoutGuides> + <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> + <rect key="frame" x="0.0" y="0.0" width="600" height="600"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="LaunchStoryboard" translatesAutoresizingMaskIntoConstraints="NO" id="2ns-9I-Qjs"> + <rect key="frame" x="0.0" y="0.0" width="600" height="600"/> + </imageView> + </subviews> + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> + <constraints> + <constraint firstAttribute="trailing" secondItem="2ns-9I-Qjs" secondAttribute="trailing" id="FZL-3Z-NFz"/> + <constraint firstItem="2ns-9I-Qjs" firstAttribute="bottom" secondItem="xb3-aO-Qok" secondAttribute="top" id="L9l-pw-wXj"/> + <constraint firstItem="2ns-9I-Qjs" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="oGN-hc-Uzj"/> + <constraint firstItem="2ns-9I-Qjs" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="rS9-Wd-zY4"/> + </constraints> + </view> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="53" y="375"/> + </scene> + </scenes> + <resources> + <image name="LaunchStoryboard" width="1366" height="1366"/> + </resources> +</document> diff --git a/StoneIsland/platforms/ios/Stone Island/Classes/AppDelegate.h b/StoneIsland/platforms/ios/Stone Island/Classes/AppDelegate.h index ee3f0764..69ba6c08 100755..100644 --- a/StoneIsland/platforms/ios/Stone Island/Classes/AppDelegate.h +++ b/StoneIsland/platforms/ios/Stone Island/Classes/AppDelegate.h @@ -25,18 +25,9 @@ // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. // -#import <UIKit/UIKit.h> - #import <Cordova/CDVViewController.h> +#import <Cordova/CDVAppDelegate.h> -@interface AppDelegate : NSObject <UIApplicationDelegate>{} - -// invoke string is passed to your app on launch, this is only valid if you -// edit Stone Island-Info.plist to add a protocol -// a simple tutorial can be found here : -// http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html - -@property (nonatomic, strong) IBOutlet UIWindow* window; -@property (nonatomic, strong) IBOutlet CDVViewController* viewController; +@interface AppDelegate : CDVAppDelegate {} @end diff --git a/StoneIsland/platforms/ios/Stone Island/Classes/AppDelegate.m b/StoneIsland/platforms/ios/Stone Island/Classes/AppDelegate.m index c2d42df8..bc84bed9 100755..100644 --- a/StoneIsland/platforms/ios/Stone Island/Classes/AppDelegate.m +++ b/StoneIsland/platforms/ios/Stone Island/Classes/AppDelegate.m @@ -28,128 +28,12 @@ #import "AppDelegate.h" #import "MainViewController.h" -#import <Cordova/CDVPlugin.h> - @implementation AppDelegate -@synthesize window, viewController; - -- (id)init -{ - /** If you need to do any extra app-specific initialization, you can do it here - * -jm - **/ - NSHTTPCookieStorage* cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; - - [cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; - - int cacheSizeMemory = 8 * 1024 * 1024; // 8MB - int cacheSizeDisk = 32 * 1024 * 1024; // 32MB -#if __has_feature(objc_arc) - NSURLCache* sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"]; -#else - NSURLCache* sharedCache = [[[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"] autorelease]; -#endif - [NSURLCache setSharedURLCache:sharedCache]; - - self = [super init]; - return self; -} - -#pragma mark UIApplicationDelegate implementation - -/** - * This is main kick off after the app inits, the views and Settings are setup here. (preferred - iOS4 and up) - */ - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { - CGRect screenBounds = [[UIScreen mainScreen] bounds]; - -#if __has_feature(objc_arc) - self.window = [[UIWindow alloc] initWithFrame:screenBounds]; -#else - self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease]; -#endif - self.window.autoresizesSubviews = YES; - -#if __has_feature(objc_arc) - self.viewController = [[MainViewController alloc] init]; -#else - self.viewController = [[[MainViewController alloc] init] autorelease]; -#endif - - // Set your app's start page by setting the <content src='foo.html' /> tag in config.xml. - // If necessary, uncomment the line below to override it. - // self.viewController.startPage = @"index.html"; - - // NOTE: To customize the view's frame size (which defaults to full screen), override - // [self.viewController viewWillAppear:] in your view controller. - - self.window.rootViewController = self.viewController; - [self.window makeKeyAndVisible]; - - return YES; -} - -// this happens while we are running ( in the background, or from within our own app ) -// only valid if Stone Island-Info.plist specifies a protocol to handle -- (BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation -{ - if (!url) { - return NO; - } - - // all plugins will get the notification, and their handlers will be called - [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]]; - - return YES; -} - -// repost all remote and local notification using the default NSNotificationCenter so multiple plugins may respond -- (void) application:(UIApplication*)application - didReceiveLocalNotification:(UILocalNotification*)notification -{ - // re-post ( broadcast ) - [[NSNotificationCenter defaultCenter] postNotificationName:CDVLocalNotification object:notification]; -} - -#ifndef DISABLE_PUSH_NOTIFICATIONS - - - (void) application:(UIApplication*)application - didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken - { - // re-post ( broadcast ) - NSString* token = [[[[deviceToken description] - stringByReplacingOccurrencesOfString:@"<" withString:@""] - stringByReplacingOccurrencesOfString:@">" withString:@""] - stringByReplacingOccurrencesOfString:@" " withString:@""]; - - [[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotification object:token]; - } - - - (void) application:(UIApplication*)application - didFailToRegisterForRemoteNotificationsWithError:(NSError*)error - { - // re-post ( broadcast ) - [[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotificationError object:error]; - } -#endif - -#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000 -- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window -#else -- (UIInterfaceOrientationMask)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window -#endif -{ - // iPhone doesn't support upside down by default, while the iPad does. Override to allow all orientations always, and let the root view controller decide what's allowed (the supported orientations mask gets intersected). - NSUInteger supportedInterfaceOrientations = (1 << UIInterfaceOrientationPortrait) | (1 << UIInterfaceOrientationLandscapeLeft) | (1 << UIInterfaceOrientationLandscapeRight) | (1 << UIInterfaceOrientationPortraitUpsideDown); - - return supportedInterfaceOrientations; -} - -- (void)applicationDidReceiveMemoryWarning:(UIApplication*)application -{ - [[NSURLCache sharedURLCache] removeAllCachedResponses]; + self.viewController = [[MainViewController alloc] init]; + return [super application:application didFinishLaunchingWithOptions:launchOptions]; } @end diff --git a/StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.h b/StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.h index a9aaeeaf..a9aaeeaf 100755..100644 --- a/StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.h +++ b/StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.h diff --git a/StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.m b/StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.m index a066b197..3f3a0c8e 100755..100644 --- a/StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.m +++ b/StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.m @@ -84,12 +84,6 @@ // e.g. self.myOutlet = nil; } -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation -{ - // Return YES for supported orientations - return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation]; -} - /* Comment out the block below to over-ride */ /* @@ -97,35 +91,20 @@ { return[super newCordovaViewWithFrame:bounds]; } -*/ - -#pragma mark UIWebDelegate implementation -- (void)webViewDidFinishLoad:(UIWebView*)theWebView +- (NSUInteger)supportedInterfaceOrientations { - // Black base color for background matches the native apps - theWebView.backgroundColor = [UIColor blackColor]; - - return [super webViewDidFinishLoad:theWebView]; + return [super supportedInterfaceOrientations]; } -/* Comment out the block below to over-ride */ - -/* - -- (void) webViewDidStartLoad:(UIWebView*)theWebView +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - return [super webViewDidStartLoad:theWebView]; -} - -- (void) webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error -{ - return [super webView:theWebView didFailLoadWithError:error]; + return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation]; } -- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType +- (BOOL)shouldAutorotate { - return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType]; + return [super shouldAutorotate]; } */ diff --git a/StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.xib b/StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.xib index e45d65c6..e45d65c6 100755..100644 --- a/StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.xib +++ b/StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.xib diff --git a/StoneIsland/platforms/ios/Stone Island/Entitlements-Debug.plist b/StoneIsland/platforms/ios/Stone Island/Entitlements-Debug.plist new file mode 100644 index 00000000..1ed4ae5b --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Entitlements-Debug.plist @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!-- + 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. +--> +<plist version="1.0"> + <dict> + </dict> +</plist> diff --git a/StoneIsland/platforms/ios/Stone Island/Entitlements-Release.plist b/StoneIsland/platforms/ios/Stone Island/Entitlements-Release.plist new file mode 100644 index 00000000..1ed4ae5b --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Entitlements-Release.plist @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<!-- + 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. +--> +<plist version="1.0"> + <dict> + </dict> +</plist> diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/Contents.json b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d19e65fd --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,182 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "filename" : "icon-small.png", + "scale" : "1x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "filename" : "icon-small@2x.png", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "filename" : "icon-small@3x.png", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "filename" : "icon-40@2x.png", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "filename" : "icon-60@2x.png", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "57x57", + "filename" : "icon.png", + "scale" : "1x" + }, + { + "idiom" : "iphone", + "size" : "57x57", + "filename" : "icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "filename" : "icon-60@2x.png", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "filename" : "icon-60@3x.png", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "filename" : "icon-small.png", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "filename" : "icon-small@2x.png", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "filename" : "icon-40.png", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "filename" : "icon-40@2x.png", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "50x50", + "filename" : "icon-50.png", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "50x50", + "filename" : "icon-50@2x.png", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "72x72", + "filename" : "icon-72.png", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "72x72", + "filename" : "icon-72@2x.png", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "filename" : "icon-76.png", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "filename" : "icon-76@2x.png", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "filename" : "icon-83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "24x24", + "idiom" : "watch", + "scale" : "2x", + "role" : "notificationCenter", + "subtype" : "38mm" + }, + { + "size" : "27.5x27.5", + "idiom" : "watch", + "scale" : "2x", + "role" : "notificationCenter", + "subtype" : "42mm" + }, + { + "size" : "29x29", + "idiom" : "watch", + "role" : "companionSettings", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "watch", + "role" : "companionSettings", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "watch", + "scale" : "2x", + "role" : "appLauncher", + "subtype" : "38mm" + }, + { + "size" : "44x44", + "idiom" : "watch", + "scale" : "2x", + "role" : "longLook", + "subtype" : "42mm" + }, + { + "size" : "86x86", + "idiom" : "watch", + "scale" : "2x", + "role" : "quickLook", + "subtype" : "38mm" + }, + { + "size" : "98x98", + "idiom" : "watch", + "scale" : "2x", + "role" : "quickLook", + "subtype" : "42mm" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +}
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-40.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-40.png Binary files differnew file mode 100644 index 00000000..e865adbc --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-40.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-40@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-40@2x.png Binary files differnew file mode 100644 index 00000000..6d07dce5 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-40@2x.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-50.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-50.png Binary files differnew file mode 100644 index 00000000..98a9d96d --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-50.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-50@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-50@2x.png Binary files differnew file mode 100644 index 00000000..bac693f7 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-50@2x.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-60@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-60@2x.png Binary files differnew file mode 100644 index 00000000..955af362 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-60@2x.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-60@3x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-60@3x.png Binary files differnew file mode 100644 index 00000000..e1268916 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-60@3x.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-72.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-72.png Binary files differnew file mode 100644 index 00000000..8c6e5df3 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-72.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-72@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-72@2x.png Binary files differnew file mode 100644 index 00000000..dd819da6 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-72@2x.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-76.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-76.png Binary files differnew file mode 100644 index 00000000..63afe7f1 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-76.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-76@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-76@2x.png Binary files differnew file mode 100644 index 00000000..4cff29a2 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-76@2x.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-83.5@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-83.5@2x.png Binary files differnew file mode 100644 index 00000000..3c1a0115 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-83.5@2x.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small.png Binary files differnew file mode 100644 index 00000000..0ea1c42f --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@2x.png Binary files differnew file mode 100644 index 00000000..2c72038e --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@2x.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@3x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@3x.png Binary files differnew file mode 100644 index 00000000..5c37dfc2 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@3x.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon.png Binary files differnew file mode 100644 index 00000000..b2571a71 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon@2x.png Binary files differnew file mode 100644 index 00000000..d75098f5 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon@2x.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/Contents.json b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +}
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Contents.json b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Contents.json new file mode 100644 index 00000000..175f378c --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -0,0 +1,156 @@ +{ + "images" : [ + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "736h", + "filename" : "Default-736h.png", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "3x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "736h", + "filename" : "Default-Landscape-736h.png", + "minimum-system-version" : "8.0", + "orientation" : "landscape", + "scale" : "3x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "667h", + "filename" : "Default-667h.png", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "filename" : "Default@2x~iphone.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "retina4", + "filename" : "Default-568h@2x~iphone.png", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "filename" : "Default-Portrait~ipad.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "filename" : "Default-Landscape~ipad.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "filename" : "Default-Portrait@2x~ipad.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "filename" : "Default-Landscape@2x~ipad.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "filename" : "Default~iphone.png", + "extent" : "full-screen", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "filename" : "Default@2x~iphone.png", + "extent" : "full-screen", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "filename" : "Default-568h@2x~iphone.png", + "extent" : "full-screen", + "subtype" : "retina4", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "filename" : "Default-Portrait~ipad.png", + "extent" : "full-screen", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "filename" : "Default-Portrait@2x~ipad.png", + "extent" : "full-screen", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +}
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-568h@2x~iphone.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-568h@2x~iphone.png Binary files differnew file mode 100644 index 00000000..10ed683c --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-568h@2x~iphone.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-667h.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-667h.png Binary files differnew file mode 100644 index 00000000..d9bcf61d --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-667h.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-736h.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-736h.png Binary files differnew file mode 100644 index 00000000..1fcef229 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-736h.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h.png Binary files differnew file mode 100644 index 00000000..eae0792d --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png Binary files differnew file mode 100644 index 00000000..1fc8c7db --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.png Binary files differnew file mode 100644 index 00000000..58ea2fbd --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png Binary files differnew file mode 100644 index 00000000..1570b37d --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.png Binary files differnew file mode 100644 index 00000000..223e75d0 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default@2x~iphone.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default@2x~iphone.png Binary files differnew file mode 100644 index 00000000..0098dc73 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default@2x~iphone.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default~iphone.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default~iphone.png Binary files differnew file mode 100644 index 00000000..42b8fdea --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default~iphone.png diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchStoryboard.imageset/Contents.json b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchStoryboard.imageset/Contents.json new file mode 100644 index 00000000..71f82acb --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchStoryboard.imageset/Contents.json @@ -0,0 +1,168 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + }, + { + "idiom" : "universal", + "scale" : "1x", + "height-class" : "compact" + }, + { + "idiom" : "universal", + "scale" : "2x", + "height-class" : "compact" + }, + { + "idiom" : "universal", + "height-class" : "compact", + "scale" : "3x" + }, + { + "idiom" : "universal", + "scale" : "1x", + "width-class" : "compact" + }, + { + "idiom" : "universal", + "width-class" : "compact", + "scale" : "2x" + }, + { + "idiom" : "universal", + "width-class" : "compact", + "scale" : "3x" + }, + { + "idiom" : "universal", + "width-class" : "compact", + "height-class" : "compact", + "scale" : "1x" + }, + { + "idiom" : "universal", + "width-class" : "compact", + "height-class" : "compact", + "scale" : "2x" + }, + { + "idiom" : "universal", + "width-class" : "compact", + "height-class" : "compact", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "scale" : "1x" + }, + { + "idiom" : "iphone", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "scale" : "1x", + "height-class" : "compact" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "height-class" : "compact" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "height-class" : "compact" + }, + { + "idiom" : "iphone", + "scale" : "1x", + "width-class" : "compact" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "width-class" : "compact" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "width-class" : "compact" + }, + { + "idiom" : "iphone", + "width-class" : "compact", + "height-class" : "compact", + "scale" : "1x" + }, + { + "idiom" : "iphone", + "width-class" : "compact", + "height-class" : "compact", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "width-class" : "compact", + "height-class" : "compact", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "height-class" : "compact" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "height-class" : "compact" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "width-class" : "compact" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "width-class" : "compact" + }, + { + "idiom" : "ipad", + "width-class" : "compact", + "height-class" : "compact", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "width-class" : "compact", + "height-class" : "compact", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +}
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/README b/StoneIsland/platforms/ios/Stone Island/Plugins/README index 87df09f2..87df09f2 100755..100644 --- a/StoneIsland/platforms/ios/Stone Island/Plugins/README +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/README diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Bolts b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Bolts Binary files differindex 190cc04c..2f6ba68d 120000..100644 --- a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Bolts +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Bolts diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers deleted file mode 120000 index b0cc393f..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers +++ /dev/null @@ -1 +0,0 @@ -./Versions/A/Headers
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLink.h b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLink.h new file mode 100644 index 00000000..5e51acd8 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLink.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import <Foundation/Foundation.h> + +/*! The version of the App Link protocol that this library supports */ +FOUNDATION_EXPORT NSString *const BFAppLinkVersion; + +/*! + Contains App Link metadata relevant for navigation on this device + derived from the HTML at a given URL. + */ +@interface BFAppLink : NSObject + +/*! + Creates a BFAppLink with the given list of BFAppLinkTargets and target URL. + + Generally, this will only be used by implementers of the BFAppLinkResolving protocol, + as these implementers will produce App Link metadata for a given URL. + + @param sourceURL the URL from which this App Link is derived + @param targets an ordered list of BFAppLinkTargets for this platform derived + from App Link metadata. + @param webURL the fallback web URL, if any, for the app link. + */ ++ (instancetype)appLinkWithSourceURL:(NSURL *)sourceURL + targets:(NSArray *)targets + webURL:(NSURL *)webURL; + +/*! The URL from which this BFAppLink was derived */ +@property (nonatomic, strong, readonly) NSURL *sourceURL; + +/*! + The ordered list of targets applicable to this platform that will be used + for navigation. + */ +@property (nonatomic, copy, readonly) NSArray *targets; + +/*! The fallback web URL to use if no targets are installed on this device. */ +@property (nonatomic, strong, readonly) NSURL *webURL; + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLinkNavigation.h b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLinkNavigation.h new file mode 100644 index 00000000..d459f722 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLinkNavigation.h @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import <Foundation/Foundation.h> + +#import <Bolts/BFAppLink.h> + +/*! + The result of calling navigate on a BFAppLinkNavigation + */ +typedef NS_ENUM(NSInteger, BFAppLinkNavigationType) { + /*! Indicates that the navigation failed and no app was opened */ + BFAppLinkNavigationTypeFailure, + /*! Indicates that the navigation succeeded by opening the URL in the browser */ + BFAppLinkNavigationTypeBrowser, + /*! Indicates that the navigation succeeded by opening the URL in an app on the device */ + BFAppLinkNavigationTypeApp +}; + +@protocol BFAppLinkResolving; +@class BFTask; + +/*! + Represents a pending request to navigate to an App Link. Most developers will + simply use navigateToURLInBackground: to open a URL, but developers can build + custom requests with additional navigation and app data attached to them by + creating BFAppLinkNavigations themselves. + */ +@interface BFAppLinkNavigation : NSObject + +/*! + The extras for the AppLinkNavigation. This will generally contain application-specific + data that should be passed along with the request, such as advertiser or affiliate IDs or + other such metadata relevant on this device. + */ +@property (nonatomic, copy, readonly) NSDictionary *extras; + +/*! + The al_applink_data for the AppLinkNavigation. This will generally contain data common to + navigation attempts such as back-links, user agents, and other information that may be used + in routing and handling an App Link request. + */ +@property (nonatomic, copy, readonly) NSDictionary *appLinkData; + +/*! The AppLink to navigate to */ +@property (nonatomic, strong, readonly) BFAppLink *appLink; + +/*! Creates an AppLinkNavigation with the given link, extras, and App Link data */ ++ (instancetype)navigationWithAppLink:(BFAppLink *)appLink + extras:(NSDictionary *)extras + appLinkData:(NSDictionary *)appLinkData; + +/*! Performs the navigation */ +- (BFAppLinkNavigationType)navigate:(NSError **)error; + +/*! Returns a BFAppLink for the given URL */ ++ (BFTask *)resolveAppLinkInBackground:(NSURL *)destination; + +/*! Returns a BFAppLink for the given URL using the given App Link resolution strategy */ ++ (BFTask *)resolveAppLinkInBackground:(NSURL *)destination resolver:(id<BFAppLinkResolving>)resolver; + +/*! Navigates to a BFAppLink and returns whether it opened in-app or in-browser */ ++ (BFAppLinkNavigationType)navigateToAppLink:(BFAppLink *)link error:(NSError **)error; + +/*! Navigates to a URL (an asynchronous action) and returns a BFNavigationType */ ++ (BFTask *)navigateToURLInBackground:(NSURL *)destination; + +/*! + Navigates to a URL (an asynchronous action) using the given App Link resolution + strategy and returns a BFNavigationType + */ ++ (BFTask *)navigateToURLInBackground:(NSURL *)destination resolver:(id<BFAppLinkResolving>)resolver; + +/*! + Gets the default resolver to be used for App Link resolution. If the developer has not set one explicitly, + a basic, built-in resolver will be used. + */ ++ (id<BFAppLinkResolving>)defaultResolver; + +/*! + Sets the default resolver to be used for App Link resolution. Setting this to nil will revert the + default resolver to the basic, built-in resolver provided by Bolts. + */ ++ (void)setDefaultResolver:(id<BFAppLinkResolving>)resolver; + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLinkResolving.h b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLinkResolving.h new file mode 100644 index 00000000..baa1451e --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLinkResolving.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import <Foundation/Foundation.h> + +@class BFTask; + +/*! + Implement this protocol to provide an alternate strategy for resolving + App Links that may include pre-fetching, caching, or querying for App Link + data from an index provided by a service provider. + */ +@protocol BFAppLinkResolving <NSObject> + +/*! + Asynchronously resolves App Link data for a given URL. + + @param url The URL to resolve into an App Link. + @returns A BFTask that will return a BFAppLink for the given URL. + */ +- (BFTask *)appLinkFromURLInBackground:(NSURL *)url; + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLinkReturnToRefererController.h b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLinkReturnToRefererController.h new file mode 100644 index 00000000..22648d44 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLinkReturnToRefererController.h @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import <Foundation/Foundation.h> +#import <UIKit/UIKit.h> + +#import <Bolts/BFAppLinkReturnToRefererView.h> + +@class BFAppLink; +@class BFAppLinkReturnToRefererController; + +/*! + Protocol that a class can implement in order to be notified when the user has navigated back + to the referer of an App Link. + */ +@protocol BFAppLinkReturnToRefererControllerDelegate <NSObject> + +@optional + +/*! Called when the user has tapped to navigate, but before the navigation has been performed. */ +- (void)returnToRefererController:(BFAppLinkReturnToRefererController *)controller + willNavigateToAppLink:(BFAppLink *)appLink; + +/*! Called after the navigation has been attempted, with an indication of whether the referer + app link was successfully opened. */ +- (void)returnToRefererController:(BFAppLinkReturnToRefererController *)controller + didNavigateToAppLink:(BFAppLink *)url + type:(BFAppLinkNavigationType)type; + +@end + +/*! + A controller class that implements default behavior for a BFAppLinkReturnToRefererView, including + the ability to display the view above the navigation bar for navigation-bsaed apps. + */ +@interface BFAppLinkReturnToRefererController : NSObject <BFAppLinkReturnToRefererViewDelegate> + +/*! + The delegate that will be notified when the user navigates back to the referer. + */ +@property (nonatomic, weak) id<BFAppLinkReturnToRefererControllerDelegate> delegate; + +/*! + The BFAppLinkReturnToRefererView this controller is controlling. + */ +@property (nonatomic, strong) BFAppLinkReturnToRefererView *view; + +/*! + Initializes a controller suitable for controlling a BFAppLinkReturnToRefererView that is to be displayed + contained within another UIView (i.e., not displayed above the navigation bar). + */ +- (instancetype)init; + +/*! + Initializes a controller suitable for controlling a BFAppLinkReturnToRefererView that is to be displayed + displayed above the navigation bar. + */ +- (instancetype)initForDisplayAboveNavController:(UINavigationController *)navController; + +/*! + Removes the view entirely from the navigation controller it is currently displayed in. + */ +- (void)removeFromNavController; + +/*! + Shows the BFAppLinkReturnToRefererView with the specified referer information. If nil or missing data, + the view will not be displayed. */ +- (void)showViewForRefererAppLink:(BFAppLink *)refererAppLink; + +/*! + Shows the BFAppLinkReturnToRefererView with referer information extracted from the specified URL. + If nil or missing referer App Link data, the view will not be displayed. */ +- (void)showViewForRefererURL:(NSURL *)url; + +/*! + Closes the view, possibly animating it. + */ +- (void)closeViewAnimated:(BOOL)animated; + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLinkReturnToRefererView.h b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLinkReturnToRefererView.h new file mode 100644 index 00000000..e3af9408 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLinkReturnToRefererView.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import <Foundation/Foundation.h> +#import <UIKit/UIKit.h> + +#import <Bolts/BFAppLinkNavigation.h> + +@class BFAppLinkReturnToRefererView; +@class BFURL; + +typedef enum BFIncludeStatusBarInSize { + BFIncludeStatusBarInSizeNever, + BFIncludeStatusBarInSizeIOS7AndLater, + BFIncludeStatusBarInSizeAlways, +} BFIncludeStatusBarInSize; + +/*! + Protocol that a class can implement in order to be notified when the user has navigated back + to the referer of an App Link. + */ +@protocol BFAppLinkReturnToRefererViewDelegate <NSObject> + +/*! + Called when the user has tapped inside the close button. + */ +- (void)returnToRefererViewDidTapInsideCloseButton:(BFAppLinkReturnToRefererView *)view; + +/*! + Called when the user has tapped inside the App Link portion of the view. + */ +- (void)returnToRefererViewDidTapInsideLink:(BFAppLinkReturnToRefererView *)view + link:(BFAppLink *)link; + +@end + +/*! + Provides a UIView that displays a button allowing users to navigate back to the + application that launched the App Link currently being handled, if the App Link + contained referer data. The user can also close the view by clicking a close button + rather than navigating away. If the view is provided an App Link that does not contain + referer data, it will have zero size and no UI will be displayed. + */ +@interface BFAppLinkReturnToRefererView : UIView + +/*! + The delegate that will be notified when the user navigates back to the referer. + */ +@property (nonatomic, weak) id<BFAppLinkReturnToRefererViewDelegate> delegate; + +/*! + The color of the text label and close button. + */ +@property (nonatomic, strong) UIColor *textColor; + +@property (nonatomic, strong) BFAppLink *refererAppLink; + +/*! + Indicates whether to extend the size of the view to include the current status bar + size, for use in scenarios where the view might extend under the status bar on iOS 7 and + above; this property has no effect on earlier versions of iOS. + */ +@property (nonatomic, assign) BFIncludeStatusBarInSize includeStatusBarInSize; + +/*! + Indicates whether the user has closed the view by clicking the close button. + */ +@property (nonatomic, assign) BOOL closed; + +/*! + For apps that use a navigation controller, this method allows for displaying the view as + a banner above the navigation bar of the navigation controller. It will listen for orientation + change and other events to ensure it stays properly positioned above the nevigation bar. + If this method is called from, e.g., viewDidAppear, its counterpart, detachFromMainWindow should + be called from, e.g., viewWillDisappear. + */ +//- (void)attachToMainWindowAboveNavigationController:(UINavigationController *)navigationController view:(UIView *)view; + +/*! + Indicates that the view should no longer position itself above a navigation bar. + */ +//- (void)detachFromMainWindow; + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLinkTarget.h b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLinkTarget.h new file mode 100644 index 00000000..61721269 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFAppLinkTarget.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import <Foundation/Foundation.h> + +/*! + Represents a target defined in App Link metadata, consisting of at least + a URL, and optionally an App Store ID and name. + */ +@interface BFAppLinkTarget : NSObject + +/*! Creates a BFAppLinkTarget with the given app site and target URL. */ ++ (instancetype)appLinkTargetWithURL:(NSURL *)url + appStoreId:(NSString *)appStoreId + appName:(NSString *)appName; + +/*! The URL prefix for this app link target */ +@property (nonatomic, strong, readonly) NSURL *URL; + +/*! The app ID for the app store */ +@property (nonatomic, copy, readonly) NSString *appStoreId; + +/*! The name of the app */ +@property (nonatomic, copy, readonly) NSString *appName; + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFExecutor.h b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFExecutor.h new file mode 100644 index 00000000..02af9ba2 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFExecutor.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import <Foundation/Foundation.h> + +/*! + An object that can run a given block. + */ +@interface BFExecutor : NSObject + +/*! + Returns a default executor, which runs continuations immediately until the call stack gets too + deep, then dispatches to a new GCD queue. + */ ++ (instancetype)defaultExecutor; + +/*! + Returns an executor that runs continuations on the thread where the previous task was completed. + */ ++ (instancetype)immediateExecutor; + +/*! + Returns an executor that runs continuations on the main thread. + */ ++ (instancetype)mainThreadExecutor; + +/*! + Returns a new executor that uses the given block to execute continuations. + @param block The block to use. + */ ++ (instancetype)executorWithBlock:(void(^)(void(^block)()))block; + +/*! + Returns a new executor that runs continuations on the given queue. + @param queue The instance of `dispatch_queue_t` to dispatch all continuations onto. + */ ++ (instancetype)executorWithDispatchQueue:(dispatch_queue_t)queue; + +/*! + Returns a new executor that runs continuations on the given queue. + @param queue The instance of `NSOperationQueue` to run all continuations on. + */ ++ (instancetype)executorWithOperationQueue:(NSOperationQueue *)queue; + +/*! + Runs the given block using this executor's particular strategy. + @param block The block to execute. + */ +- (void)execute:(void(^)())block; + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFMeasurementEvent.h b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFMeasurementEvent.h new file mode 100644 index 00000000..7a9948c3 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFMeasurementEvent.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import <Foundation/Foundation.h> + +/*! The name of the notification posted by BFMeasurementEvent */ +FOUNDATION_EXPORT NSString *const BFMeasurementEventNotificationName; + +/*! Defines keys in the userInfo object for the notification named BFMeasurementEventNotificationName */ +/*! The string field for the name of the event */ +FOUNDATION_EXPORT NSString *const BFMeasurementEventNameKey; +/*! The dictionary field for the arguments of the event */ +FOUNDATION_EXPORT NSString *const BFMeasurementEventArgsKey; + + +/*! Bolts Events raised by BFMeasurementEvent for Applink */ +/*! + The name of the event posted when [BFURL URLWithURL:] is called successfully. This represents the successful parsing of an app link URL. + */ +FOUNDATION_EXPORT NSString *const BFAppLinkParseEventName; + +/*! + The name of the event posted when [BFURL URLWithInboundURL:] is called successfully. + This represents parsing an inbound app link URL from a different application + */ +FOUNDATION_EXPORT NSString *const BFAppLinkNavigateInEventName; + +/*! The event raised when the user navigates from your app to other apps */ +FOUNDATION_EXPORT NSString *const BFAppLinkNavigateOutEventName; + +/*! + The event raised when the user navigates out from your app and back to the referrer app. + e.g when the user leaves your app after tapping the back-to-referrer navigation bar + */ +FOUNDATION_EXPORT NSString *const BFAppLinkNavigateBackToReferrerEventName; + +@interface BFMeasurementEvent : NSObject + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFTask.h b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFTask.h new file mode 100644 index 00000000..2ac84d60 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFTask.h @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import <Foundation/Foundation.h> + +@class BFExecutor; +@class BFTask; + +/*! + A block that can act as a continuation for a task. + */ +typedef id(^BFContinuationBlock)(BFTask *task); + +/*! + The consumer view of a Task. A BFTask has methods to + inspect the state of the task, and to add continuations to + be run once the task is complete. + */ +@interface BFTask : NSObject + +/*! + Creates a task that is already completed with the given result. + @param result The result for the task. + */ ++ (instancetype)taskWithResult:(id)result; + +/*! + Creates a task that is already completed with the given error. + @param error The error for the task. + */ ++ (instancetype)taskWithError:(NSError *)error; + +/*! + Creates a task that is already completed with the given exception. + @param exception The exception for the task. + */ ++ (instancetype)taskWithException:(NSException *)exception; + +/*! + Creates a task that is already cancelled. + */ ++ (instancetype)cancelledTask; + +/*! + Returns a task that will be completed (with result == nil) once + all of the input tasks have completed. + @param tasks An `NSArray` of the tasks to use as an input. + */ ++ (instancetype)taskForCompletionOfAllTasks:(NSArray *)tasks; + +/*! + Returns a task that will be completed a certain amount of time in the future. + @param millis The approximate number of milliseconds to wait before the + task will be finished (with result == nil). + */ ++ (instancetype)taskWithDelay:(int)millis; + +/*! + Returns a task that will be completed after the given block completes with + the specified executor. + @param executor A BFExecutor responsible for determining how the + continuation block will be run. + @param block The block to immediately schedule to run with the given executor. + @returns A task that will be completed after block has run. + If block returns a BFTask, then the task returned from + this method will not be completed until that task is completed. + */ ++ (instancetype)taskFromExecutor:(BFExecutor *)executor + withBlock:(id (^)())block; + +// Properties that will be set on the task once it is completed. + +/*! + The result of a successful task. + */ +@property (nonatomic, strong, readonly) id result; + + +/*! + The error of a failed task. + */ +@property (nonatomic, strong, readonly) NSError *error; + +/*! + The exception of a failed task. + */ +@property (nonatomic, strong, readonly) NSException *exception; + +/*! + Whether this task has been cancelled. + */ +@property (nonatomic, assign, readonly, getter = isCancelled) BOOL cancelled; + +/*! + Whether this task has completed. + */ +@property (nonatomic, assign, readonly, getter = isCompleted) BOOL completed; + +/*! + Enqueues the given block to be run once this task is complete. + This method uses a default execution strategy. The block will be + run on the thread where the previous task completes, unless the + the stack depth is too deep, in which case it will be run on a + dispatch queue with default priority. + @param block The block to be run once this task is complete. + @returns A task that will be completed after block has run. + If block returns a BFTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (instancetype)continueWithBlock:(BFContinuationBlock)block; + +/*! + Enqueues the given block to be run once this task is complete. + @param executor A BFExecutor responsible for determining how the + continuation block will be run. + @param block The block to be run once this task is complete. + @returns A task that will be completed after block has run. + If block returns a BFTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (instancetype)continueWithExecutor:(BFExecutor *)executor + withBlock:(BFContinuationBlock)block; + +/*! + Identical to continueWithBlock:, except that the block is only run + if this task did not produce a cancellation, error, or exception. + If it did, then the failure will be propagated to the returned + task. + @param block The block to be run once this task is complete. + @returns A task that will be completed after block has run. + If block returns a BFTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (instancetype)continueWithSuccessBlock:(BFContinuationBlock)block; + +/*! + Identical to continueWithExecutor:withBlock:, except that the block + is only run if this task did not produce a cancellation, error, or + exception. If it did, then the failure will be propagated to the + returned task. + @param executor A BFExecutor responsible for determining how the + continuation block will be run. + @param block The block to be run once this task is complete. + @returns A task that will be completed after block has run. + If block returns a BFTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (instancetype)continueWithExecutor:(BFExecutor *)executor + withSuccessBlock:(BFContinuationBlock)block; + +/*! + Waits until this operation is completed. + This method is inefficient and consumes a thread resource while + it's running. It should be avoided. This method logs a warning + message if it is used on the main thread. + */ +- (void)waitUntilFinished; + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFTaskCompletionSource.h b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFTaskCompletionSource.h new file mode 100644 index 00000000..d0ea545d --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFTaskCompletionSource.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import <Foundation/Foundation.h> + +@class BFTask; + +/*! + A BFTaskCompletionSource represents the producer side of tasks. + It is a task that also has methods for changing the state of the + task by settings its completion values. + */ +@interface BFTaskCompletionSource : NSObject + +/*! + Creates a new unfinished task. + */ ++ (instancetype)taskCompletionSource; + +/*! + The task associated with this TaskCompletionSource. + */ +@property (nonatomic, retain, readonly) BFTask *task; + +/*! + Completes the task by setting the result. + Attempting to set this for a completed task will raise an exception. + @param result The result of the task. + */ +- (void)setResult:(id)result; + +/*! + Completes the task by setting the error. + Attempting to set this for a completed task will raise an exception. + @param error The error for the task. + */ +- (void)setError:(NSError *)error; + +/*! + Completes the task by setting an exception. + Attempting to set this for a completed task will raise an exception. + @param exception The exception for the task. + */ +- (void)setException:(NSException *)exception; + +/*! + Completes the task by marking it as cancelled. + Attempting to set this for a completed task will raise an exception. + */ +- (void)cancel; + +/*! + Sets the result of the task if it wasn't already completed. + @returns whether the new value was set. + */ +- (BOOL)trySetResult:(id)result; + +/*! + Sets the error of the task if it wasn't already completed. + @param error The error for the task. + @returns whether the new value was set. + */ +- (BOOL)trySetError:(NSError *)error; + +/*! + Sets the exception of the task if it wasn't already completed. + @param exception The exception for the task. + @returns whether the new value was set. + */ +- (BOOL)trySetException:(NSException *)exception; + +/*! + Sets the cancellation state of the task if it wasn't already completed. + @returns whether the new value was set. + */ +- (BOOL)trySetCancelled; + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFURL.h b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFURL.h new file mode 100644 index 00000000..f269e2d1 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFURL.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import <Foundation/Foundation.h> + + + +@class BFAppLink; + +/*! + Provides a set of utilities for working with NSURLs, such as parsing of query parameters + and handling for App Link requests. + */ +@interface BFURL : NSObject + +/*! + Creates a link target from a raw URL. + On success, this posts the BFAppLinkParseEventName measurement event. If you are constructing the BFURL within your application delegate's + application:openURL:sourceApplication:annotation:, you should instead use URLWithInboundURL:sourceApplication: + to support better BFMeasurementEvent notifications + @param url The instance of `NSURL` to create BFURL from. + */ ++ (BFURL *)URLWithURL:(NSURL *)url; + +/*! + Creates a link target from a raw URL received from an external application. This is typically called from the app delegate's + application:openURL:sourceApplication:annotation: and will post the BFAppLinkNavigateInEventName measurement event. + @param url The instance of `NSURL` to create BFURL from. + @param sourceApplication the bundle ID of the app that is requesting your app to open the URL. The same sourceApplication in application:openURL:sourceApplication:annotation: +*/ ++ (BFURL *)URLWithInboundURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication; + +/*! + Gets the target URL. If the link is an App Link, this is the target of the App Link. + Otherwise, it is the url that created the target. + */ +@property (nonatomic, strong, readonly) NSURL *targetURL; + +/*! + Gets the query parameters for the target, parsed into an NSDictionary. + */ +@property (nonatomic, strong, readonly) NSDictionary *targetQueryParameters; + +/*! + If this link target is an App Link, this is the data found in al_applink_data. + Otherwise, it is nil. + */ +@property (nonatomic, strong, readonly) NSDictionary *appLinkData; + +/*! + If this link target is an App Link, this is the data found in extras. + */ +@property (nonatomic, strong, readonly) NSDictionary *appLinkExtras; + +/*! + The App Link indicating how to navigate back to the referer app, if any. + */ +@property (nonatomic, strong, readonly) BFAppLink *appLinkReferer; + +/*! + The URL that was used to create this BFURL. + */ +@property (nonatomic, strong, readonly) NSURL *inputURL; + +/*! + The query parameters of the inputURL, parsed into an NSDictionary. + */ +@property (nonatomic, strong, readonly) NSDictionary *inputQueryParameters; + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFWebViewAppLinkResolver.h b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFWebViewAppLinkResolver.h new file mode 100644 index 00000000..cffa5292 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BFWebViewAppLinkResolver.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import <Foundation/Foundation.h> + +#import <Bolts/BFAppLinkResolving.h> + +/*! + A reference implementation for an App Link resolver that uses a hidden UIWebView + to parse the HTML containing App Link metadata. + */ +@interface BFWebViewAppLinkResolver : NSObject<BFAppLinkResolving> + +/*! + Gets the instance of a BFWebViewAppLinkResolver. + */ ++ (instancetype)sharedInstance; + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/Bolts.h b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/Bolts.h new file mode 100644 index 00000000..e22bdd54 --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/Bolts.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import <Bolts/BoltsVersion.h> +#import <Bolts/BFExecutor.h> +#import <Bolts/BFTask.h> +#import <Bolts/BFTaskCompletionSource.h> + +#if TARGET_OS_IPHONE +#import <Bolts/BFAppLinkNavigation.h> +#import <Bolts/BFAppLink.h> +#import <Bolts/BFAppLinkTarget.h> +#import <Bolts/BFURL.h> +#import <Bolts/BFMeasurementEvent.h> +#import <Bolts/BFAppLinkReturnToRefererController.h> +#import <Bolts/BFAppLinkReturnToRefererView.h> +#endif + +/*! @abstract 80175001: There were multiple errors. */ +extern NSInteger const kBFMultipleErrorsError; + +@interface Bolts : NSObject + +/*! + Returns the version of the Bolts Framework as an NSString. + @returns The NSString representation of the current version. + */ ++ (NSString *)version; + +@end diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BoltsVersion.h b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BoltsVersion.h new file mode 100644 index 00000000..24e802ed --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/com.parse.cordova.core.pushplugin/Bolts.framework/Headers/BoltsVersion.h @@ -0,0 +1 @@ +#define BOLTS_VERSION @"1.1.3" diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.h index 0d6ae397..0d6ae397 100755..100644 --- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.h +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.h diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.m index 43b356ad..a1add304 100755..100644 --- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.m +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.m @@ -22,14 +22,14 @@ #import <Cordova/CDVScreenOrientationDelegate.h> #import "CDVViewController+SplashScreen.h" -#define kSplashScreenDurationDefault 0.25f +#define kSplashScreenDurationDefault 3000.0f @implementation CDVSplashScreen - (void)pluginInitialize { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad) name:CDVPageDidLoadNotification object:self.webView]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad) name:CDVPageDidLoadNotification object:nil]; [self setVisible:YES]; } @@ -82,11 +82,16 @@ NSString* topActivityIndicator = [self.commandDelegate.settings objectForKey:[@"TopActivityIndicator" lowercaseString]]; UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray; - if ([topActivityIndicator isEqualToString:@"whiteLarge"]) { + if ([topActivityIndicator isEqualToString:@"whiteLarge"]) + { topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhiteLarge; - } else if ([topActivityIndicator isEqualToString:@"white"]) { + } + else if ([topActivityIndicator isEqualToString:@"white"]) + { topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhite; - } else if ([topActivityIndicator isEqualToString:@"gray"]) { + } + else if ([topActivityIndicator isEqualToString:@"gray"]) + { topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray; } @@ -104,7 +109,8 @@ id showSplashScreenSpinnerValue = [self.commandDelegate.settings objectForKey:[@"ShowSplashScreenSpinner" lowercaseString]]; // backwards compatibility - if key is missing, default to true - if ((showSplashScreenSpinnerValue == nil) || [showSplashScreenSpinnerValue boolValue]) { + if ((showSplashScreenSpinnerValue == nil) || [showSplashScreenSpinnerValue boolValue]) + { [parentView addSubview:_activityView]; } @@ -116,6 +122,12 @@ [self updateImage]; } +- (void)hideViews +{ + [_imageView setAlpha:0]; + [_activityView setAlpha:0]; +} + - (void)destroyViews { [(CDVViewController *)self.viewController setEnabledAutorotation:[(CDVViewController *)self.viewController shouldAutorotateDefaultValue]]; @@ -167,21 +179,33 @@ // this means there are no mixed orientations in there BOOL isOrientationLocked = !(supportsPortrait && supportsLandscape); - if (imageName) { + if (imageName) + { imageName = [imageName stringByDeletingPathExtension]; - } else { + } + else + { imageName = @"Default"; } - if (device.iPhone5) { // does not support landscape + if (device.iPhone5) + { // does not support landscape imageName = [imageName stringByAppendingString:@"-568h"]; - } else if (device.iPhone6) { // does not support landscape + } + else if (device.iPhone6) + { // does not support landscape imageName = [imageName stringByAppendingString:@"-667h"]; - } else if (device.iPhone6Plus) { // supports landscape - if (isOrientationLocked) { + } + else if (device.iPhone6Plus) + { // supports landscape + if (isOrientationLocked) + { imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"")]; - } else { - switch (currentOrientation) { + } + else + { + switch (currentOrientation) + { case UIInterfaceOrientationLandscapeLeft: case UIInterfaceOrientationLandscapeRight: imageName = [imageName stringByAppendingString:@"-Landscape"]; @@ -192,11 +216,17 @@ } imageName = [imageName stringByAppendingString:@"-736h"]; - } else if (device.iPad) { // supports landscape - if (isOrientationLocked) { + } + else if (device.iPad) + { // supports landscape + if (isOrientationLocked) + { imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"-Portrait")]; - } else { - switch (currentOrientation) { + } + else + { + switch (currentOrientation) + { case UIInterfaceOrientationLandscapeLeft: case UIInterfaceOrientationLandscapeRight: imageName = [imageName stringByAppendingString:@"-Landscape"]; @@ -219,16 +249,20 @@ { NSString* imageName = [self getImageName:[[UIApplication sharedApplication] statusBarOrientation] delegate:(id<CDVScreenOrientationDelegate>)self.viewController device:[self getCurrentDevice]]; - if (![imageName isEqualToString:_curImageName]) { + if (![imageName isEqualToString:_curImageName]) + { UIImage* img = [UIImage imageNamed:imageName]; _imageView.image = img; _curImageName = imageName; } // Check that splash screen's image exists before updating bounds - if (_imageView.image) { + if (_imageView.image) + { [self updateBounds]; - } else { + } + else + { NSLog(@"WARNING: The splashscreen image named %@ was not found", imageName); } } @@ -248,26 +282,34 @@ * correctly. */ BOOL isIPad = [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad; - if (UIInterfaceOrientationIsLandscape(orientation) && !isIPad) { + if (UIInterfaceOrientationIsLandscape(orientation) && !isIPad) + { imgTransform = CGAffineTransformMakeRotation(M_PI / 2); imgBounds.size = CGSizeMake(imgBounds.size.height, imgBounds.size.width); } // There's a special case when the image is the size of the screen. - if (CGSizeEqualToSize(screenSize, imgBounds.size)) { + if (CGSizeEqualToSize(screenSize, imgBounds.size)) + { CGRect statusFrame = [self.viewController.view convertRect:[UIApplication sharedApplication].statusBarFrame fromView:nil]; - if (!(IsAtLeastiOSVersion(@"7.0"))) { + if (!(IsAtLeastiOSVersion(@"7.0"))) + { imgBounds.origin.y -= statusFrame.size.height; } - } else if (imgBounds.size.width > 0) { + } + else if (imgBounds.size.width > 0) + { CGRect viewBounds = self.viewController.view.bounds; CGFloat imgAspect = imgBounds.size.width / imgBounds.size.height; CGFloat viewAspect = viewBounds.size.width / viewBounds.size.height; // This matches the behaviour of the native splash screen. CGFloat ratio; - if (viewAspect > imgAspect) { + if (viewAspect > imgAspect) + { ratio = viewBounds.size.width / imgBounds.size.width; - } else { + } + else + { ratio = viewBounds.size.height / imgBounds.size.height; } imgBounds.size.height *= ratio; @@ -280,50 +322,54 @@ - (void)setVisible:(BOOL)visible { - if (visible == _visible) { - return; - } - _visible = visible; + if (visible != _visible) + { + _visible = visible; - id fadeSplashScreenValue = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreen" lowercaseString]]; - id fadeSplashScreenDuration = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreenDuration" lowercaseString]]; + id fadeSplashScreenValue = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreen" lowercaseString]]; + id fadeSplashScreenDuration = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreenDuration" lowercaseString]]; - float fadeDuration = fadeSplashScreenDuration == nil ? kSplashScreenDurationDefault : [fadeSplashScreenDuration floatValue]; + float fadeDuration = fadeSplashScreenDuration == nil ? kSplashScreenDurationDefault : [fadeSplashScreenDuration floatValue]; - if ((fadeSplashScreenValue == nil) || ![fadeSplashScreenValue boolValue]) { - fadeDuration = 0; - } - - // Never animate the showing of the splash screen. - if (visible) { - if (_imageView == nil) { - [self createViews]; + if ((fadeSplashScreenValue == nil) || ![fadeSplashScreenValue boolValue]) + { + fadeDuration = 0; + } + else if(fadeDuration < 30) + { + // [CB-9750] This value used to be in decimal seconds, so we will assume that if someone specifies 10 + // they mean 10 seconds, and not the meaningless 10ms + fadeDuration *= 1000; + } + + if (_visible) + { + if (_imageView == nil) + { + [self createViews]; + } + } + else if (fadeDuration == 0) + { + [self destroyViews]; + } + else + { + __weak __typeof(self) weakSelf = self; + [UIView transitionWithView:self.viewController.view + duration:(fadeDuration / 1000) + options:UIViewAnimationOptionTransitionNone + animations:^(void) { + [weakSelf hideViews]; + } + completion:^(BOOL finished) { + if (finished) { + [weakSelf destroyViews]; + // TODO: It might also be nice to have a js event happen here -jm + } + } + ]; } - } else if (fadeDuration == 0) { - [self destroyViews]; - } else { - __weak __typeof(self) weakSelf = self; - - [UIView transitionWithView:self.viewController.view - duration:fadeDuration - options:UIViewAnimationOptionTransitionNone - animations:^(void) { - __typeof(self) strongSelf = weakSelf; - if (strongSelf != nil) { - dispatch_async(dispatch_get_main_queue(), ^{ - [strongSelf->_activityView setAlpha:0]; - [strongSelf->_imageView setAlpha:0]; - }); - } - } - completion:^(BOOL finished) { - if (finished) { - dispatch_async(dispatch_get_main_queue(), ^{ - [weakSelf destroyViews]; - }); - } - } - ]; } } diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVViewController+SplashScreen.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVViewController+SplashScreen.h index a948ea31..a948ea31 100755..100644 --- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVViewController+SplashScreen.h +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVViewController+SplashScreen.h diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVViewController+SplashScreen.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVViewController+SplashScreen.m index 5736b6f2..5736b6f2 100755..100644 --- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVViewController+SplashScreen.m +++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVViewController+SplashScreen.m diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-40.png b/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-40.png Binary files differdeleted file mode 100755 index 6234d357..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-40.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-40@2x.png b/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-40@2x.png Binary files differdeleted file mode 100755 index 1f417b6a..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-40@2x.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-50.png b/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-50.png Binary files differdeleted file mode 100755 index 48b83e00..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-50.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-50@2x.png b/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-50@2x.png Binary files differdeleted file mode 100755 index 214899d7..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-50@2x.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-60.png b/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-60.png Binary files differdeleted file mode 100755 index eb0e8577..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-60.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-60@2x.png b/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-60@2x.png Binary files differdeleted file mode 100755 index f790d9e7..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-60@2x.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-60@3x.png b/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-60@3x.png Binary files differdeleted file mode 100755 index e3df8b92..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-60@3x.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-72.png b/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-72.png Binary files differdeleted file mode 100755 index eb9ef36b..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-72.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-72@2x.png b/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-72@2x.png Binary files differdeleted file mode 100755 index add109d8..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-72@2x.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-76.png b/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-76.png Binary files differdeleted file mode 100755 index c3bcf073..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-76.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-76@2x.png b/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-76@2x.png Binary files differdeleted file mode 100755 index 4b757ba9..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-76@2x.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-small.png b/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-small.png Binary files differdeleted file mode 100755 index b4d688f5..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-small.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-small@2x.png b/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-small@2x.png Binary files differdeleted file mode 100755 index 055d4761..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon-small@2x.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon.png b/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon.png Binary files differdeleted file mode 100755 index c898ad8b..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon@2x.png b/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon@2x.png Binary files differdeleted file mode 100755 index a633fcbb..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/icons/icon@2x.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-568h@2x~iphone.png b/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-568h@2x~iphone.png Binary files differdeleted file mode 100755 index 47079c45..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-568h@2x~iphone.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-667h.png b/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-667h.png Binary files differdeleted file mode 100755 index 57a8f40e..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-667h.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-736h.png b/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-736h.png Binary files differdeleted file mode 100755 index 2f00da21..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-736h.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-Landscape-736h.png b/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-Landscape-736h.png Binary files differdeleted file mode 100755 index fc6512f7..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-Landscape-736h.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-Landscape@2x~ipad.png b/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-Landscape@2x~ipad.png Binary files differdeleted file mode 100755 index f0fa0658..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-Landscape@2x~ipad.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-Landscape~ipad.png b/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-Landscape~ipad.png Binary files differdeleted file mode 100755 index 89964903..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-Landscape~ipad.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-Portrait@2x~ipad.png b/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-Portrait@2x~ipad.png Binary files differdeleted file mode 100755 index 9002f6f3..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-Portrait@2x~ipad.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-Portrait~ipad.png b/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-Portrait~ipad.png Binary files differdeleted file mode 100755 index 2916e875..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default-Portrait~ipad.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default@2x~iphone.png b/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default@2x~iphone.png Binary files differdeleted file mode 100755 index 13ada67a..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default@2x~iphone.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default~iphone.png b/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default~iphone.png Binary files differdeleted file mode 100755 index 19d2b2ae..00000000 --- a/StoneIsland/platforms/ios/Stone Island/Resources/splash/Default~iphone.png +++ /dev/null diff --git a/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist b/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist index a8e57f0b..903a41d6 100755..100644 --- a/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist +++ b/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist @@ -8,46 +8,10 @@ <string>${PRODUCT_NAME}</string> <key>CFBundleExecutable</key> <string>${EXECUTABLE_NAME}</string> - <key>CFBundleIconFile</key> - <string>icon.png</string> <key>CFBundleIcons</key> - <dict> - <key>CFBundlePrimaryIcon</key> - <dict> - <key>CFBundleIconFiles</key> - <array> - <string>icon-40</string> - <string>icon-small</string> - <string>icon-60</string> - <string>icon.png</string> - <string>icon@2x</string> - <string>icon-72</string> - <string>icon-72@2x</string> - </array> - <key>UIPrerenderedIcon</key> - <false/> - </dict> - </dict> + <dict/> <key>CFBundleIcons~ipad</key> - <dict> - <key>CFBundlePrimaryIcon</key> - <dict> - <key>CFBundleIconFiles</key> - <array> - <string>icon-small</string> - <string>icon-40</string> - <string>icon-50</string> - <string>icon-76</string> - <string>icon-60</string> - <string>icon</string> - <string>icon@2x</string> - <string>icon-72</string> - <string>icon-72@2x</string> - </array> - <key>UIPrerenderedIcon</key> - <false/> - </dict> - </dict> + <dict/> <key>CFBundleIdentifier</key> <string>us.okfoc.stoneisland</string> <key>CFBundleInfoDictionaryVersion</key> @@ -60,154 +24,49 @@ <string>0.6.1</string> <key>CFBundleSignature</key> <string>????</string> - <key>CFBundleURLTypes</key> - <array> - <dict> - <key>CFBundleURLSchemes</key> - <array> - <string>stoneisland</string> - </array> - </dict> - </array> <key>CFBundleVersion</key> <string>0.6.1</string> - <key>LSApplicationQueriesSchemes</key> + <key>LSRequiresIPhoneOS</key> + <true/> + <key>NSMainNibFile</key> + <string/> + <key>NSMainNibFile~ipad</key> + <string/> + <key>UISupportedInterfaceOrientations</key> <array> - <string>youtube</string> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationPortraitUpsideDown</string> </array> - <key>LSRequiresIPhoneOS</key> + <key>UISupportedInterfaceOrientations~ipad</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationPortraitUpsideDown</string> + </array> + <key>UIRequiresFullScreen</key> <true/> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict> - <key>NSLocationWhenInUseUsageDescription</key> - <string/> - <key>NSMainNibFile~ipad</key> - <string/> - <key>UIBackgroundModes</key> - <array> - <string>remote-notification</string> - </array> <key>UIInterfaceOrientation</key> <array> <string>UIInterfaceOrientationPortrait</string> </array> - <key>UILaunchImages</key> + <key>CFBundleURLTypes</key> <array> <dict> - <key>UILaunchImageMinimumOSVersion</key> - <string>8.0</string> - <key>UILaunchImageName</key> - <string>Default</string> - <key>UILaunchImageOrientation</key> - <string>Portrait</string> - <key>UILaunchImageSize</key> - <string>{320, 480}</string> - </dict> - <dict> - <key>UILaunchImageMinimumOSVersion</key> - <string>8.0</string> - <key>UILaunchImageName</key> - <string>Default</string> - <key>UILaunchImageOrientation</key> - <string>Landscape</string> - <key>UILaunchImageSize</key> - <string>{320, 480}</string> - </dict> - <dict> - <key>UILaunchImageMinimumOSVersion</key> - <string>8.0</string> - <key>UILaunchImageName</key> - <string>Default-568h</string> - <key>UILaunchImageOrientation</key> - <string>Portrait</string> - <key>UILaunchImageSize</key> - <string>{320, 568}</string> - </dict> - <dict> - <key>UILaunchImageMinimumOSVersion</key> - <string>8.0</string> - <key>UILaunchImageName</key> - <string>Default-568h</string> - <key>UILaunchImageOrientation</key> - <string>Landscape</string> - <key>UILaunchImageSize</key> - <string>{320, 568}</string> - </dict> - <dict> - <key>UILaunchImageMinimumOSVersion</key> - <string>8.0</string> - <key>UILaunchImageName</key> - <string>Default-667h</string> - <key>UILaunchImageOrientation</key> - <string>Portrait</string> - <key>UILaunchImageSize</key> - <string>{375, 667}</string> - </dict> - <dict> - <key>UILaunchImageMinimumOSVersion</key> - <string>8.0</string> - <key>UILaunchImageName</key> - <string>Default-667h</string> - <key>UILaunchImageOrientation</key> - <string>Landscape</string> - <key>UILaunchImageSize</key> - <string>{375, 667}</string> - </dict> - <dict> - <key>UILaunchImageMinimumOSVersion</key> - <string>8.0</string> - <key>UILaunchImageName</key> - <string>Default-736h</string> - <key>UILaunchImageOrientation</key> - <string>Portrait</string> - <key>UILaunchImageSize</key> - <string>{414, 736}</string> - </dict> - <dict> - <key>UILaunchImageMinimumOSVersion</key> - <string>8.0</string> - <key>UILaunchImageName</key> - <string>Default-Landscape-736h</string> - <key>UILaunchImageOrientation</key> - <string>Landscape</string> - <key>UILaunchImageSize</key> - <string>{414, 736}</string> - </dict> - <dict> - <key>UILaunchImageMinimumOSVersion</key> - <string>8.0</string> - <key>UILaunchImageName</key> - <string>Default-Portrait</string> - <key>UILaunchImageOrientation</key> - <string>Portrait</string> - <key>UILaunchImageSize</key> - <string>{768, 1024}</string> - </dict> - <dict> - <key>UILaunchImageMinimumOSVersion</key> - <string>8.0</string> - <key>UILaunchImageName</key> - <string>Default-Landscape</string> - <key>UILaunchImageOrientation</key> - <string>Landscape</string> - <key>UILaunchImageSize</key> - <string>{768, 1024}</string> + <key>CFBundleURLSchemes</key> + <array> + <string>stoneisland</string> + </array> </dict> </array> - <key>UIRequiresFullScreen</key> - <true/> - <key>UISupportedInterfaceOrientations</key> - <array> - <string>UIInterfaceOrientationPortrait</string> - <string>UIInterfaceOrientationPortraitUpsideDown</string> - </array> - <key>UISupportedInterfaceOrientations~ipad</key> + <key>NSLocationWhenInUseUsageDescription</key> + <string/> + <key>UIBackgroundModes</key> <array> - <string>UIInterfaceOrientationPortrait</string> - <string>UIInterfaceOrientationPortraitUpsideDown</string> + <string>remote-notification</string> </array> </dict> </plist>
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/Stone Island/Stone Island-Prefix.pch b/StoneIsland/platforms/ios/Stone Island/Stone Island-Prefix.pch index d1b4e1e8..d1b4e1e8 100755..100644 --- a/StoneIsland/platforms/ios/Stone Island/Stone Island-Prefix.pch +++ b/StoneIsland/platforms/ios/Stone Island/Stone Island-Prefix.pch diff --git a/StoneIsland/platforms/ios/Stone Island/config.xml b/StoneIsland/platforms/ios/Stone Island/config.xml index 4b1803b1..90d98387 100755 --- a/StoneIsland/platforms/ios/Stone Island/config.xml +++ b/StoneIsland/platforms/ios/Stone Island/config.xml @@ -3,9 +3,24 @@ <feature name="LocalStorage"> <param name="ios-package" value="CDVLocalStorage" /> </feature> + <feature name="HandleOpenUrl"> + <param name="ios-package" value="CDVHandleOpenURL" /> + <param name="onload" value="true" /> + </feature> + <feature name="IntentAndNavigationFilter"> + <param name="ios-package" value="CDVIntentAndNavigationFilter" /> + <param name="onload" value="true" /> + </feature> + <feature name="GestureHandler"> + <param name="ios-package" value="CDVGestureHandler" /> + <param name="onload" value="true" /> + </feature> <feature name="Keyboard"> <param name="ios-package" onload="true" value="IonicKeyboard" /> </feature> + <feature name="ParsePlugin"> + <param name="ios-package" value="CDVParsePlugin" /> + </feature> <feature name="Console"> <param name="ios-package" value="CDVLogger" /> </feature> @@ -18,6 +33,9 @@ <feature name="Geolocation"> <param name="ios-package" value="CDVLocation" /> </feature> + <feature name="InAppBrowser"> + <param name="ios-package" value="CDVInAppBrowser" /> + </feature> <feature name="NetworkStatus"> <param name="ios-package" value="CDVConnection" /> </feature> @@ -32,12 +50,6 @@ <feature name="PushNotification"> <param name="ios-package" value="PushPlugin" /> </feature> - <feature name="InAppBrowser"> - <param name="ios-package" value="CDVInAppBrowser" /> - </feature> - <feature name="ParsePlugin"> - <param name="ios-package" value="CDVParsePlugin" /> - </feature> <name>Stone Island</name> <description> Stone Island @@ -55,13 +67,15 @@ <allow-intent href="geo:*" /> <allow-intent href="itms:*" /> <allow-intent href="itms-apps:*" /> - <preference name="AllowInlineMediaPlayback" value="false" /> + <preference name="AllowInlineMediaPlayback" value="true" /> <preference name="BackupWebStorage" value="local" /> <preference name="DisallowOverscroll" value="true" /> <preference name="EnableViewportScale" value="true" /> <preference name="KeyboardDisplayRequiresUserAction" value="false" /> <preference name="MediaPlaybackRequiresUserAction" value="false" /> <preference name="SuppressesIncrementalRendering" value="true" /> + <preference name="SuppressesLongPressGesture" value="false" /> + <preference name="Suppresses3DTouchGesture" value="false" /> <preference name="GapBetweenPages" value="0" /> <preference name="PageLength" value="0" /> <preference name="PaginationBreakingMode" value="page" /> diff --git a/StoneIsland/platforms/ios/Stone Island/main.m b/StoneIsland/platforms/ios/Stone Island/main.m index 2c0b35c3..2c0b35c3 100755..100644 --- a/StoneIsland/platforms/ios/Stone Island/main.m +++ b/StoneIsland/platforms/ios/Stone Island/main.m diff --git a/StoneIsland/platforms/ios/cordova/Api.js b/StoneIsland/platforms/ios/cordova/Api.js new file mode 100755 index 00000000..b95f8e8c --- /dev/null +++ b/StoneIsland/platforms/ios/cordova/Api.js @@ -0,0 +1,470 @@ +/** + 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. +*/ + +/*jslint node: true */ + +var fs = require('fs'); +var path = require('path'); +var unorm = require('unorm'); +var projectFile = require('./lib/projectFile'); +var CordovaError = require('cordova-common').CordovaError; +var CordovaLogger = require('cordova-common').CordovaLogger; +var events = require('cordova-common').events; +var PluginManager = require('cordova-common').PluginManager; +var Q = require('q'); +var util = require('util'); + +function setupEvents(externalEventEmitter) { + if (externalEventEmitter) { + // This will make the platform internal events visible outside + events.forwardEventsTo(externalEventEmitter); + } else { + // There is no logger if external emitter is not present, + // so attach a console logger + CordovaLogger.get().subscribe(events); + } +} + +/** + * Creates a new PlatformApi instance. + * + * @param {String} [platform] Platform name, used for backward compatibility + * w/ PlatformPoly (CordovaLib). + * @param {String} [platformRootDir] Platform root location, used for backward + * compatibility w/ PlatformPoly (CordovaLib). + * @param {EventEmitter} [events] An EventEmitter instance that will be used for + * logging purposes. If no EventEmitter provided, all events will be logged to + * console + */ +function Api(platform, platformRootDir, events) { + // 'platform' property is required as per PlatformApi spec + this.platform = platform || 'ios'; + this.root = platformRootDir || path.resolve(__dirname, '..'); + + setupEvents(events); + + var xcodeProjDir; + var xcodeCordovaProj; + + try { + xcodeProjDir = fs.readdirSync(this.root).filter( function(e) { return e.match(/\.xcodeproj$/i); })[0]; + if (!xcodeProjDir) { + throw new CordovaError('The provided path "' + this.root + '" is not a Cordova iOS project.'); + } + + var cordovaProjName = xcodeProjDir.substring(xcodeProjDir.lastIndexOf(path.sep)+1, xcodeProjDir.indexOf('.xcodeproj')); + xcodeCordovaProj = path.join(this.root, cordovaProjName); + } catch(e) { + throw new CordovaError('The provided path "'+this.root+'" is not a Cordova iOS project.'); + } + + this.locations = { + root: this.root, + www: path.join(this.root, 'www'), + platformWww: path.join(this.root, 'platform_www'), + configXml: path.join(xcodeCordovaProj, 'config.xml'), + defaultConfigXml: path.join(this.root, 'cordova/defaults.xml'), + pbxproj: path.join(this.root, xcodeProjDir, 'project.pbxproj'), + xcodeProjDir: path.join(this.root, xcodeProjDir), + xcodeCordovaProj: xcodeCordovaProj, + // NOTE: this is required by browserify logic. + // As per platformApi spec we return relative to template root paths here + cordovaJs: 'bin/CordovaLib/cordova.js', + cordovaJsSrc: 'bin/cordova-js-src' + }; +} + +/** + * Creates platform in a specified directory. + * + * @param {String} destination Destination directory, where install platform to + * @param {ConfigParser} [config] ConfgiParser instance, used to retrieve + * project creation options, such as package id and project name. + * @param {Object} [options] An options object. The most common options are: + * @param {String} [options.customTemplate] A path to custom template, that + * should override the default one from platform. + * @param {Boolean} [options.link] Flag that indicates that platform's + * sources will be linked to installed platform instead of copying. + * @param {EventEmitter} [events] An EventEmitter instance that will be used for + * logging purposes. If no EventEmitter provided, all events will be logged to + * console + * + * @return {Promise<PlatformApi>} Promise either fulfilled with PlatformApi + * instance or rejected with CordovaError. + */ +Api.createPlatform = function (destination, config, options, events) { + setupEvents(events); + + // CB-6992 it is necessary to normalize characters + // because node and shell scripts handles unicode symbols differently + // We need to normalize the name to NFD form since iOS uses NFD unicode form + var name = unorm.nfd(config.name()); + var result; + try { + result = require('../../../lib/create') + .createProject(destination, config.packageName(), name, options) + .then(function () { + // after platform is created we return Api instance based on new Api.js location + // This is required to correctly resolve paths in the future api calls + var PlatformApi = require(path.resolve(destination, 'cordova/Api')); + return new PlatformApi('ios', destination, events); + }); + } + catch(e) { + events.emit('error','createPlatform is not callable from the iOS project API.'); + throw(e); + } + return result; +}; + +/** + * Updates already installed platform. + * + * @param {String} destination Destination directory, where platform installed + * @param {Object} [options] An options object. The most common options are: + * @param {String} [options.customTemplate] A path to custom template, that + * should override the default one from platform. + * @param {Boolean} [options.link] Flag that indicates that platform's + * sources will be linked to installed platform instead of copying. + * @param {EventEmitter} [events] An EventEmitter instance that will be used for + * logging purposes. If no EventEmitter provided, all events will be logged to + * console + * + * @return {Promise<PlatformApi>} Promise either fulfilled with PlatformApi + * instance or rejected with CordovaError. + */ +Api.updatePlatform = function (destination, options, events) { + setupEvents(events); + + var result; + try { + result = require('../../../lib/create') + .updateProject(destination, options) + .then(function () { + var PlatformApi = require(path.resolve(destination, 'cordova/Api')); + return new PlatformApi('ios', destination, events); + }); + } + catch (e) { + events.emit('error','updatePlatform is not callable from the iOS project API, you will need to do this manually.'); + throw(e); + } + return result; +}; + +/** + * Gets a CordovaPlatform object, that represents the platform structure. + * + * @return {CordovaPlatform} A structure that contains the description of + * platform's file structure and other properties of platform. + */ +Api.prototype.getPlatformInfo = function () { + var result = {}; + result.locations = this.locations; + result.root = this.root; + result.name = this.platform; + result.version = require('./version'); + result.projectConfig = this._config; + + return result; +}; + +/** + * Updates installed platform with provided www assets and new app + * configuration. This method is required for CLI workflow and will be called + * each time before build, so the changes, made to app configuration and www + * code, will be applied to platform. + * + * @param {CordovaProject} cordovaProject A CordovaProject instance, that defines a + * project structure and configuration, that should be applied to platform + * (contains project's www location and ConfigParser instance for project's + * config). + * + * @return {Promise} Return a promise either fulfilled, or rejected with + * CordovaError instance. + */ +Api.prototype.prepare = function (cordovaProject) { + return require('./lib/prepare').prepare.call(this, cordovaProject); +}; + +/** + * Installs a new plugin into platform. It doesn't resolves plugin dependencies. + * + * @param {PluginInfo} plugin A PluginInfo instance that represents plugin + * that will be installed. + * @param {Object} installOptions An options object. Possible options below: + * @param {Boolean} installOptions.link: Flag that specifies that plugin + * sources will be symlinked to app's directory instead of copying (if + * possible). + * @param {Object} installOptions.variables An object that represents + * variables that will be used to install plugin. See more details on plugin + * variables in documentation: + * https://cordova.apache.org/docs/en/4.0.0/plugin_ref_spec.md.html + * + * @return {Promise} Return a promise either fulfilled, or rejected with + * CordovaError instance. + */ +Api.prototype.addPlugin = function (plugin, installOptions) { + var xcodeproj = projectFile.parse(this.locations); + var self = this; + + installOptions = installOptions || {}; + installOptions.variables = installOptions.variables || {}; + // Add PACKAGE_NAME variable into vars + if (!installOptions.variables.PACKAGE_NAME) { + installOptions.variables.PACKAGE_NAME = xcodeproj.getPackageName(); + } + + return PluginManager.get(self.platform, self.locations, xcodeproj) + .addPlugin(plugin, installOptions) + .then(function(){ + var frameworkTags = plugin.getFrameworks(self.platform); + var frameworkPods = frameworkTags.filter(function(obj){ + return (obj.type == 'podspec'); + }); + + return Q.resolve(frameworkPods); + }) + .then(function(frameworkPods) { + if (!(frameworkPods.length)) { + return Q.resolve(); + } + + var project_dir = self.locations.root; + var project_name = self.locations.xcodeCordovaProj.split('/').pop(); + + var Podfile = require('./lib/Podfile').Podfile; + var PodsJson = require('./lib/PodsJson').PodsJson; + + events.emit('verbose', 'Adding pods since the plugin contained <framework>(s) with type="podspec"'); + + var podsjsonFile = new PodsJson(path.join(project_dir, PodsJson.FILENAME)); + var podfileFile = new Podfile(path.join(project_dir, Podfile.FILENAME), project_name); + + frameworkPods.forEach(function(obj) { + var podJson = { + name: obj.src, + type: obj.type, + spec: obj.spec + }; + + var val = podsjsonFile.get(podJson.name); + if (val) { // found + if (podJson.spec !== val.spec) { // exists, different spec, print warning + events.emit('warn', plugin.id + ' depends on ' + podJson.name + '@' + podJson.spec + ', which conflicts with another plugin. ' + podJson.name + '@' + val.spec + ' is already installed and was not overwritten.'); + } + // increment count, but don't add in Podfile because it already exists + podsjsonFile.increment(podJson.name); + } else { // not found, write new + podJson.count = 1; + podsjsonFile.setJson(podJson.name, podJson); + // add to Podfile + podfileFile.addSpec(podJson.name, podJson.spec); + } + }); + + // now that all the pods have been processed, write to pods.json + podsjsonFile.write(); + + // only write and pod install if the Podfile changed + if (podfileFile.isDirty()) { + podfileFile.write(); + events.emit('verbose', 'Running `pod install` (to install plugins)'); + + var check_reqs = require('./lib/check_reqs'); + return podfileFile.install(check_reqs.check_cocoapods); + } else { + events.emit('verbose', 'Podfile unchanged, skipping `pod install`'); + } + }) + // CB-11022 return non-falsy value to indicate + // that there is no need to run prepare after + .thenResolve(true); +}; + +/** + * Removes an installed plugin from platform. + * + * Since method accepts PluginInfo instance as input parameter instead of plugin + * id, caller shoud take care of managing/storing PluginInfo instances for + * future uninstalls. + * + * @param {PluginInfo} plugin A PluginInfo instance that represents plugin + * that will be installed. + * + * @return {Promise} Return a promise either fulfilled, or rejected with + * CordovaError instance. + */ +Api.prototype.removePlugin = function (plugin, uninstallOptions) { + var xcodeproj = projectFile.parse(this.locations); + var self = this; + + return PluginManager.get(self.platform, self.locations, xcodeproj) + .removePlugin(plugin, uninstallOptions) + .then(function(){ + var frameworkTags = plugin.getFrameworks(self.platform); + var frameworkPods = frameworkTags.filter(function(obj){ + return (obj.type == 'podspec'); + }); + + return Q.resolve(frameworkPods); + }) + .then(function(frameworkPods) { + if (!(frameworkPods.length)) { + return Q.resolve(); + } + + var project_dir = self.locations.root; + var project_name = self.locations.xcodeCordovaProj.split('/').pop(); + + var Podfile = require('./lib/Podfile').Podfile; + var PodsJson = require('./lib/PodsJson').PodsJson; + + events.emit('verbose', 'Adding pods since the plugin contained <framework>(s) with type=\"podspec\"'); + + var podsjsonFile = new PodsJson(path.join(project_dir, PodsJson.FILENAME)); + var podfileFile = new Podfile(path.join(project_dir, Podfile.FILENAME), project_name); + + frameworkPods.forEach(function(obj) { + var podJson = { + name: obj.src, + type: obj.type, + spec: obj.spec + }; + + var val = podsjsonFile.get(podJson.name); + if (val) { // found, decrement count + podsjsonFile.decrement(podJson.name); + } else { // not found (perhaps a sync error) + var message = util.format('plugin \"%s\" podspec \"%s\" does not seem to be in pods.json, nothing to remove. Will attempt to remove from Podfile.', plugin.id, podJson.name); + events.emit('verbose', message); + } + + // always remove from the Podfile + podfileFile.removeSpec(podJson.name); + }); + + // now that all the pods have been processed, write to pods.json + podsjsonFile.write(); + + if (podfileFile.isDirty()) { + podfileFile.write(); + events.emit('verbose', 'Running `pod install` (to uninstall pods)'); + + var check_reqs = require('./lib/check_reqs'); + return podfileFile.install(check_reqs.check_cocoapods); + } else { + events.emit('verbose', 'Podfile unchanged, skipping `pod install`'); + } + }) + // CB-11022 return non-falsy value to indicate + // that there is no need to run prepare after + .thenResolve(true); +}; + +/** + * Builds an application package for current platform. + * + * @param {Object} buildOptions A build options. This object's structure is + * highly depends on platform's specific. The most common options are: + * @param {Boolean} buildOptions.debug Indicates that packages should be + * built with debug configuration. This is set to true by default unless the + * 'release' option is not specified. + * @param {Boolean} buildOptions.release Indicates that packages should be + * built with release configuration. If not set to true, debug configuration + * will be used. + * @param {Boolean} buildOptions.device Specifies that built app is intended + * to run on device + * @param {Boolean} buildOptions.emulator: Specifies that built app is + * intended to run on emulator + * @param {String} buildOptions.target Specifies the device id that will be + * used to run built application. + * @param {Boolean} buildOptions.nobuild Indicates that this should be a + * dry-run call, so no build artifacts will be produced. + * @param {String[]} buildOptions.archs Specifies chip architectures which + * app packages should be built for. List of valid architectures is depends on + * platform. + * @param {String} buildOptions.buildConfig The path to build configuration + * file. The format of this file is depends on platform. + * @param {String[]} buildOptions.argv Raw array of command-line arguments, + * passed to `build` command. The purpose of this property is to pass a + * platform-specific arguments, and eventually let platform define own + * arguments processing logic. + * + * @return {Promise} Return a promise either fulfilled, or rejected with + * CordovaError instance. + */ +Api.prototype.build = function (buildOptions) { + var self = this; + return require('./lib/check_reqs').run() + .then(function () { + return require('./lib/build').run.call(self, buildOptions); + }); +}; + +/** + * Builds an application package for current platform and runs it on + * specified/default device. If no 'device'/'emulator'/'target' options are + * specified, then tries to run app on default device if connected, otherwise + * runs the app on emulator. + * + * @param {Object} runOptions An options object. The structure is the same + * as for build options. + * + * @return {Promise} A promise either fulfilled if package was built and ran + * successfully, or rejected with CordovaError. + */ +Api.prototype.run = function(runOptions) { + var self = this; + return require('./lib/check_reqs').run() + .then(function () { + return require('./lib/run').run.call(self, runOptions); + }); +}; + +/** + * Cleans out the build artifacts from platform's directory. + * + * @return {Promise} Return a promise either fulfilled, or rejected with + * CordovaError. + */ +Api.prototype.clean = function(cleanOptions) { + var self = this; + return require('./lib/check_reqs').run() + .then(function () { + return require('./lib/clean').run.call(self, cleanOptions); + }) + .then(function () { + return require('./lib/prepare').clean.call(self, cleanOptions); + }); +}; + +/** + * Performs a requirements check for current platform. Each platform defines its + * own set of requirements, which should be resolved before platform can be + * built successfully. + * + * @return {Promise<Requirement[]>} Promise, resolved with set of Requirement + * objects for current platform. + */ +Api.prototype.requirements = function() { + return require('./lib/check_reqs').check_all(); +}; + +module.exports = Api; diff --git a/StoneIsland/platforms/ios/cordova/build b/StoneIsland/platforms/ios/cordova/build index 5007627f..61d26cca 100755 --- a/StoneIsland/platforms/ios/cordova/build +++ b/StoneIsland/platforms/ios/cordova/build @@ -19,18 +19,45 @@ under the License. */ -var build = require('./lib/build'), - args = process.argv; +var args = process.argv; +var Api = require('./Api'); +var nopt = require('nopt'); +var path = require('path'); -// Handle help flag -if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(args[2]) > -1) { - build.help(); -} else { - build.run(args).done(function() { +// Support basic help commands +if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) { + require('./lib/build').help(); + process.exit(0); +} + +// Parse arguments +var buildOpts = nopt({ + 'verbose' : Boolean, + 'silent' : Boolean, + 'archs': String, + 'debug': Boolean, + 'release': Boolean, + 'device': Boolean, + 'emulator': Boolean, + 'codeSignIdentity': String, + 'codeSignResourceRules': String, + 'provisioningProfile': String, + 'developmentTeam': String, + 'packageType': String, + 'buildConfig' : String, + 'buildFlag' : [String, Array], + 'noSign' : Boolean +}, { '-r': '--release', 'd' : '--verbose' }, args); + +// Make buildOptions compatible with PlatformApi build method spec +buildOpts.argv = buildOpts.argv.remain; + +require('./loggingHelper').adjustLoggerLevel(buildOpts); + +new Api().build(buildOpts).done(function() { console.log('** BUILD SUCCEEDED **'); }, function(err) { var errorMessage = (err && err.stack) ? err.stack : err; console.error(errorMessage); process.exit(2); }); -}
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/cordova/build-debug.xcconfig b/StoneIsland/platforms/ios/cordova/build-debug.xcconfig index 124d020b..3f4767d2 100755 --- a/StoneIsland/platforms/ios/cordova/build-debug.xcconfig +++ b/StoneIsland/platforms/ios/cordova/build-debug.xcconfig @@ -22,4 +22,11 @@ // #include "build.xcconfig" + +GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 + #include "build-extras.xcconfig" + +// (CB-11792) +// @COCOAPODS_SILENCE_WARNINGS@ // +#include "../pods-debug.xcconfig" diff --git a/StoneIsland/platforms/ios/cordova/build-extras.xcconfig b/StoneIsland/platforms/ios/cordova/build-extras.xcconfig index e69de29b..7e631112 100755 --- a/StoneIsland/platforms/ios/cordova/build-extras.xcconfig +++ b/StoneIsland/platforms/ios/cordova/build-extras.xcconfig @@ -0,0 +1,22 @@ +// +// 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. +// + +// +// Auto-generated config file to override configuration files (build-release/build-debug). +// diff --git a/StoneIsland/platforms/ios/cordova/build-release.xcconfig b/StoneIsland/platforms/ios/cordova/build-release.xcconfig index 674aa796..70b0f073 100755 --- a/StoneIsland/platforms/ios/cordova/build-release.xcconfig +++ b/StoneIsland/platforms/ios/cordova/build-release.xcconfig @@ -27,3 +27,7 @@ CODE_SIGN_IDENTITY = iPhone Distribution CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Distribution #include "build-extras.xcconfig" + +// (CB-11792) +// @COCOAPODS_SILENCE_WARNINGS@ // +#include "../pods-release.xcconfig" diff --git a/StoneIsland/platforms/ios/cordova/build.bat b/StoneIsland/platforms/ios/cordova/build.bat new file mode 100755 index 00000000..2f97fcb4 --- /dev/null +++ b/StoneIsland/platforms/ios/cordova/build.bat @@ -0,0 +1,19 @@ +:: 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 +ECHO WARN: The 'build' command is not available for cordova-ios on windows machines.>&2 diff --git a/StoneIsland/platforms/ios/cordova/build.xcconfig b/StoneIsland/platforms/ios/cordova/build.xcconfig index 54a5abd4..bc9e0e3f 100755 --- a/StoneIsland/platforms/ios/cordova/build.xcconfig +++ b/StoneIsland/platforms/ios/cordova/build.xcconfig @@ -22,6 +22,10 @@ // Settings are overridden by configuration-level .xcconfig file (build-release/build-debug). // +HEADER_SEARCH_PATHS = "$(TARGET_BUILD_DIR)/usr/local/lib/include" "$(OBJROOT)/UninstalledProducts/include" "$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include" "$(BUILT_PRODUCTS_DIR)" +IPHONEOS_DEPLOYMENT_TARGET = 8.0 +OTHER_LDFLAGS = -ObjC +TARGETED_DEVICE_FAMILY = 1,2 // Type of signing identity used for codesigning, resolves to first match of given type. // "iPhone Developer": Development builds (default, local only; iOS Development certificate) or "iPhone Distribution": Distribution builds (Adhoc/In-House/AppStore; iOS Distribution certificate) @@ -30,3 +34,12 @@ CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer // (CB-9721) Set ENABLE_BITCODE to NO in build.xcconfig ENABLE_BITCODE = NO + +// (CB-9719) Set CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES to YES in build.xcconfig +CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES + +// (CB-10072) +SWIFT_OBJC_BRIDGING_HEADER = $(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h + +// (CB-11854) +CODE_SIGN_ENTITLEMENTS = $(PROJECT_DIR)/$(PROJECT_NAME)/Entitlements-$(CONFIGURATION).plist diff --git a/StoneIsland/platforms/ios/cordova/check_reqs b/StoneIsland/platforms/ios/cordova/check_reqs index ba68ceb4..d101ccd1 100755 --- a/StoneIsland/platforms/ios/cordova/check_reqs +++ b/StoneIsland/platforms/ios/cordova/check_reqs @@ -23,10 +23,10 @@ var check_reqs = require('./lib/check_reqs'); // check for help flag if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) > -1) { - check_reqs.help(); + console.log('Usage: check_reqs or node check_reqs'); } 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 +} diff --git a/StoneIsland/platforms/ios/cordova/clean b/StoneIsland/platforms/ios/cordova/clean index ae61078d..56665c48 100755 --- a/StoneIsland/platforms/ios/cordova/clean +++ b/StoneIsland/platforms/ios/cordova/clean @@ -19,11 +19,32 @@ under the License. */ -var clean = require('./lib/clean'); +var Api = require('./Api'); +var path = require('path'); +var nopt = require('nopt'); -clean.run(process.argv).done(function () { +if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) { + console.log('Cleans the project directory.'); + process.exit(0); +} + +// Do some basic argument parsing +var opts = nopt({ + 'verbose' : Boolean, + 'silent' : Boolean +}, { 'd' : '--verbose' }); + +// Make buildOptions compatible with PlatformApi clean method spec +opts.argv = opts.argv.original; + +// Skip cleaning prepared files when not invoking via cordova CLI. +opts.noPrepare = true; + +require('./loggingHelper').adjustLoggerLevel(opts); + +new Api().clean(opts).done(function() { console.log('** CLEAN SUCCEEDED **'); }, function(err) { console.error(err); process.exit(2); -});
\ No newline at end of file +}); diff --git a/StoneIsland/platforms/ios/cordova/clean.bat b/StoneIsland/platforms/ios/cordova/clean.bat index 25f17901..58307287 100755 --- a/StoneIsland/platforms/ios/cordova/clean.bat +++ b/StoneIsland/platforms/ios/cordova/clean.bat @@ -14,12 +14,6 @@ :: 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 +ECHO WARN: The 'clean' command is not available for cordova-ios on windows machines.>&2 diff --git a/StoneIsland/platforms/ios/cordova/defaults.xml b/StoneIsland/platforms/ios/cordova/defaults.xml index c98d846b..f3ae2075 100755 --- a/StoneIsland/platforms/ios/cordova/defaults.xml +++ b/StoneIsland/platforms/ios/cordova/defaults.xml @@ -29,6 +29,8 @@ <preference name="KeyboardDisplayRequiresUserAction" value="true" /> <preference name="MediaPlaybackRequiresUserAction" value="false" /> <preference name="SuppressesIncrementalRendering" value="false" /> + <preference name="SuppressesLongPressGesture" value="false" /> + <preference name="Suppresses3DTouchGesture" value="false" /> <preference name="GapBetweenPages" value="0" /> <preference name="PageLength" value="0" /> <preference name="PaginationBreakingMode" value="page" /> <!-- page, column --> @@ -37,4 +39,17 @@ <feature name="LocalStorage"> <param name="ios-package" value="CDVLocalStorage"/> </feature> + <feature name="HandleOpenUrl"> + <param name="ios-package" value="CDVHandleOpenURL"/> + <param name="onload" value="true"/> + </feature> + <feature name="IntentAndNavigationFilter"> + <param name="ios-package" value="CDVIntentAndNavigationFilter"/> + <param name="onload" value="true"/> + </feature> + <feature name="GestureHandler"> + <param name="ios-package" value="CDVGestureHandler"/> + <param name="onload" value="true"/> + </feature> + </widget> diff --git a/StoneIsland/platforms/ios/cordova/lib/Podfile.js b/StoneIsland/platforms/ios/cordova/lib/Podfile.js new file mode 100755 index 00000000..2cf254cc --- /dev/null +++ b/StoneIsland/platforms/ios/cordova/lib/Podfile.js @@ -0,0 +1,230 @@ +/* + 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 fs = require('fs'), + path = require('path'), + util = require('util'), + events = require('cordova-common').events, + Q = require('q'), + superspawn = require('cordova-common').superspawn, + CordovaError = require('cordova-common').CordovaError; + +Podfile.FILENAME = 'Podfile'; + +function Podfile(podFilePath, projectName) { + this.podToken = '##INSERT_POD##'; + + this.path = podFilePath; + this.projectName = projectName; + this.contents = null; + this.pods = null; + this.__dirty = false; + + // check whether it is named Podfile + var filename = this.path.split(path.sep).pop(); + if (filename !== Podfile.FILENAME) { + throw new CordovaError(util.format('Podfile: The file at %s is not `%s`.', this.path, Podfile.FILENAME)); + } + + if (!projectName) { + throw new CordovaError('Podfile: The projectName was not specified in the constructor.'); + } + + if (!fs.existsSync(this.path)) { + events.emit('verbose', util.format('Podfile: The file at %s does not exist.', this.path)); + events.emit('verbose', 'Creating new Podfile in platforms/ios'); + this.clear(); + this.write(); + } else { + events.emit('verbose', 'Podfile found in platforms/ios'); + // parse for pods + this.pods = this.__parseForPods(fs.readFileSync(this.path, 'utf8')); + } +} + +Podfile.prototype.__parseForPods = function(text) { + // split by \n + var arr = text.split('\n'); + + // aim is to match (space insignificant around the comma, comma optional): + // pod 'Foobar', '1.2' + // pod 'Foobar', 'abc 123 1.2' + // pod 'PonyDebugger', :configurations => ['Debug', 'Beta'] + var podRE = new RegExp('pod \'(\\w+)\'\\s*,?\\s*(.*)'); + + // only grab lines that don't have the pod spec' + return arr.filter(function(line) { + var m = podRE.exec(line); + + return (m !== null); + }) + .reduce(function(obj, line){ + var m = podRE.exec(line); + + if (m !== null) { + // strip out any single quotes around the value m[2] + var podSpec = m[2].replace(/^\'|\'$/g, ''); + obj[m[1]] = podSpec; // i.e pod 'Foo', '1.2' ==> { 'Foo' : '1.2'} + } + + return obj; + }, {}); +}; + +Podfile.prototype.getTemplate = function() { + return util.format( + '# DO NOT MODIFY -- auto-generated by Apache Cordova\n' + + 'platform :ios, \'8.0\'\n' + + 'target \'%s\' do\n' + + '\tproject \'%s.xcodeproj\'\n' + + '%s\n' + + 'end\n', + this.projectName, this.projectName, this.podToken); +}; + +Podfile.prototype.addSpec = function(name, spec) { + name = name || ''; + spec = spec; // optional + + if (!name.length) { // blank names are not allowed + throw new CordovaError('Podfile addSpec: name is not specified.'); + } + + this.pods[name] = spec; + this.__dirty = true; + + events.emit('verbose', util.format('Added pod line for `%s`', name)); +}; + +Podfile.prototype.removeSpec = function(name) { + if (this.existsSpec(name)) { + delete this.pods[name]; + this.__dirty = true; + } + + events.emit('verbose', util.format('Removed pod line for `%s`', name)); +}; + +Podfile.prototype.getSpec = function(name) { + return this.pods[name]; +}; + +Podfile.prototype.existsSpec = function(name) { + return (name in this.pods); +}; + +Podfile.prototype.clear = function() { + this.pods = {}; + this.__dirty = true; +}; + +Podfile.prototype.destroy = function() { + fs.unlinkSync(this.path); + events.emit('verbose', util.format('Deleted `%s`', this.path)); +}; + +Podfile.prototype.write = function() { + var text = this.getTemplate(); + var self = this; + + var podsString = + Object.keys(this.pods).map(function(key) { + var name = key; + var spec = self.pods[key]; + + if (spec.length) { + if (spec.indexOf(':') === 0) { + // don't quote it, it's a specification (starts with ':') + return util.format('\tpod \'%s\', %s', name, spec); + } else { + // quote it, it's a version + return util.format('\tpod \'%s\', \'%s\'', name, spec); + } + } else { + return util.format('\tpod \'%s\'', name); + } + }) + .join('\n'); + + text = text.replace(this.podToken, podsString); + fs.writeFileSync(this.path, text, 'utf8'); + this.__dirty = false; + + events.emit('verbose', 'Wrote to Podfile.'); +}; + +Podfile.prototype.isDirty = function() { + return this.__dirty; +}; + +Podfile.prototype.before_install = function() { + // Template tokens in order: project name, project name, debug | release + var template = + '// DO NOT MODIFY -- auto-generated by Apache Cordova\n' + + '#include "Pods/Target Support Files/Pods-%s/Pods-%s.%s.xcconfig"'; + + var debugContents = util.format(template, this.projectName, this.projectName, 'debug'); + var releaseContents = util.format(template, this.projectName, this.projectName, 'release'); + + var debugConfigPath = path.join(this.path, '..', 'pods-debug.xcconfig'); + var releaseConfigPath = path.join(this.path, '..', 'pods-release.xcconfig'); + + fs.writeFileSync(debugConfigPath, debugContents, 'utf8'); + fs.writeFileSync(releaseConfigPath, releaseContents, 'utf8'); + + return Q.resolve(); +}; + +Podfile.prototype.install = function(requirementsCheckerFunction) { + var opts = {}; + opts.cwd = path.join(this.path, '..'); // parent path of this Podfile + opts.stdio = 'pipe'; + var first = true; + var self = this; + + if (!requirementsCheckerFunction) { + requirementsCheckerFunction = Q(); + } + + return requirementsCheckerFunction() + .then(function() { + return self.before_install(); + }) + .then(function() { + return superspawn.spawn('pod', ['install', '--verbose'], opts) + .progress(function (stdio){ + if (stdio.stderr) { console.error(stdio.stderr); } + if (stdio.stdout) { + if (first) { + events.emit('verbose', '==== pod install start ====\n'); + first = false; + } + events.emit('verbose', stdio.stdout); + } + }); + }) + .then(function() { // done + events.emit('verbose', '==== pod install end ====\n'); + }) + .fail(function(error){ + throw error; + }); +}; + +module.exports.Podfile = Podfile;
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/cordova/lib/PodsJson.js b/StoneIsland/platforms/ios/cordova/lib/PodsJson.js new file mode 100755 index 00000000..b13a1afe --- /dev/null +++ b/StoneIsland/platforms/ios/cordova/lib/PodsJson.js @@ -0,0 +1,115 @@ +/* + 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 fs = require('fs'), + path = require('path'), + util = require('util'), + events = require('cordova-common').events, + CordovaError = require('cordova-common').CordovaError; + +PodsJson.FILENAME = 'pods.json'; + +function PodsJson(podsJsonPath) { + this.path = podsJsonPath; + this.contents = null; + this.__dirty = false; + + var filename = this.path.split(path.sep).pop(); + if (filename !== PodsJson.FILENAME) { + throw new CordovaError(util.format('PodsJson: The file at %s is not `%s`.', this.path, PodsJson.FILENAME)); + } + + if (!fs.existsSync(this.path)) { + events.emit('verbose', util.format('pods.json: The file at %s does not exist.', this.path)); + events.emit('verbose', 'Creating new pods.json in platforms/ios'); + this.clear(); + this.write(); + } else { + events.emit('verbose', 'pods.json found in platforms/ios'); + // load contents + this.contents = fs.readFileSync(this.path, 'utf8'); + this.contents = JSON.parse(this.contents); + } +} + +PodsJson.prototype.get = function(name) { + return this.contents[name]; +}; + +PodsJson.prototype.remove = function(name) { + if (this.contents[name]) { + delete this.contents[name]; + this.__dirty = true; + events.emit('verbose', util.format('Remove from pods.json for `%s`', name)); + } +}; + +PodsJson.prototype.clear = function() { + this.contents = {}; + this.__dirty = true; +}; + +PodsJson.prototype.destroy = function() { + fs.unlinkSync(this.path); + events.emit('verbose', util.format('Deleted `%s`', this.path)); +}; + +PodsJson.prototype.write = function() { + if (this.contents) { + fs.writeFileSync(this.path, JSON.stringify(this.contents, null, 4)); + this.__dirty = false; + events.emit('verbose', 'Wrote to pods.json.'); + } +}; + +PodsJson.prototype.set = function(name, type, spec, count) { + this.setJson(name, { name: name, type: type, spec: spec, count: count }); +}; + +PodsJson.prototype.increment = function(name) { + var val = this.get(name); + if (val) { + val.count++; + this.setJson(val); + } +}; + +PodsJson.prototype.decrement = function(name) { + var val = this.get(name); + if (val) { + val.count--; + if (val.count <= 0) { + this.remove(name); + } else { + this.setJson(val); + } + } +}; + +PodsJson.prototype.setJson = function(name, json) { + this.contents[name] = json; + this.__dirty = true; + events.emit('verbose', util.format('Set pods.json for `%s`', name)); +}; + +PodsJson.prototype.isDirty = function() { + return this.__dirty; +}; + +module.exports.PodsJson = PodsJson; diff --git a/StoneIsland/platforms/ios/cordova/lib/build.js b/StoneIsland/platforms/ios/cordova/lib/build.js index 2213ef8c..a26f1983 100755 --- a/StoneIsland/platforms/ios/cordova/lib/build.js +++ b/StoneIsland/platforms/ios/cordova/lib/build.js @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -20,98 +20,170 @@ /*jshint node: true*/ var Q = require('q'), - nopt = require('nopt'), path = require('path'), shell = require('shelljs'), spawn = require('./spawn'), - check_reqs = require('./check_reqs'), - fs = require('fs'); + fs = require('fs'), + plist = require('plist'), + util = require('util'); + +var check_reqs; +try { + check_reqs = require('./check_reqs'); +} catch (err) { + // For unit tests, check_reqs.js is not a sibling to build.js + check_reqs = require('../../../../lib/check_reqs'); +} + +var events = require('cordova-common').events; var projectPath = path.join(__dirname, '..', '..'); var projectName = null; -module.exports.run = function (argv) { +// These are regular expressions to detect if the user is changing any of the built-in xcodebuildArgs +var buildFlagMatchers = { + 'xcconfig' : /^\-xcconfig\s*(.*)$/, + 'workspace' : /^\-workspace\s*(.*)/, + 'scheme' : /^\-scheme\s*(.*)/, + 'configuration' : /^\-configuration\s*(.*)/, + 'sdk' : /^\-sdk\s*(.*)/, + 'destination' : /^\-destination\s*(.*)/, + 'archivePath' : /^\-archivePath\s*(.*)/, + 'configuration_build_dir' : /^(CONFIGURATION_BUILD_DIR=.*)/, + 'shared_precomps_dir' : /^(SHARED_PRECOMPS_DIR=.*)/ +}; - var args = nopt({ - // "archs": String, // TODO: add support for building different archs - 'debug': Boolean, - 'release': Boolean, - 'device': Boolean, - 'emulator': Boolean, - 'codeSignIdentity': String, - 'codeSignResourceRules': String, - 'provisioningProfile': String, - 'buildConfig' : String - }, {'-r': '--release'}, argv); +module.exports.run = function (buildOpts) { - if (args.debug && args.release) { - return Q.reject('Only one of "debug"/"release" options should be specified'); + buildOpts = buildOpts || {}; + + if (buildOpts.debug && buildOpts.release) { + return Q.reject('Cannot specify "debug" and "release" options together.'); } - if (args.device && args.emulator) { - return Q.reject('Only one of "device"/"emulator" options should be specified'); + if (buildOpts.device && buildOpts.emulator) { + return Q.reject('Cannot specify "device" and "emulator" options together.'); } - if(args.buildConfig) { - if(!fs.existsSync(args.buildConfig)) { - return Q.reject('Build config file does not exist:' + args.buildConfig); + if(buildOpts.buildConfig) { + if(!fs.existsSync(buildOpts.buildConfig)) { + return Q.reject('Build config file does not exist:' + buildOpts.buildConfig); } - console.log('Reading build config file:', path.resolve(args.buildConfig)); - var buildConfig = JSON.parse(fs.readFileSync(args.buildConfig, 'utf-8')); + events.emit('log','Reading build config file:', path.resolve(buildOpts.buildConfig)); + var contents = fs.readFileSync(buildOpts.buildConfig, 'utf-8'); + var buildConfig = JSON.parse(contents.replace(/^\ufeff/, '')); // Remove BOM if(buildConfig.ios) { - var buildType = args.release ? 'release' : 'debug'; + var buildType = buildOpts.release ? 'release' : 'debug'; var config = buildConfig.ios[buildType]; if(config) { - ['codeSignIdentity', 'codeSignResourceRules', 'provisioningProfile'].forEach( + ['codeSignIdentity', 'codeSignResourceRules', 'provisioningProfile', 'developmentTeam', 'packageType'].forEach( function(key) { - args[key] = args[key] || config[key]; + buildOpts[key] = buildOpts[key] || config[key]; }); } } } - + return check_reqs.run().then(function () { return findXCodeProjectIn(projectPath); }).then(function (name) { projectName = name; var extraConfig = ''; - if (args.codeSignIdentity) { - extraConfig += 'CODE_SIGN_IDENTITY = ' + args.codeSignIdentity + '\n'; - extraConfig += 'CODE_SIGN_IDENTITY[sdk=iphoneos*] = ' + args.codeSignIdentity + '\n'; + if (buildOpts.codeSignIdentity) { + extraConfig += 'CODE_SIGN_IDENTITY = ' + buildOpts.codeSignIdentity + '\n'; + extraConfig += 'CODE_SIGN_IDENTITY[sdk=iphoneos*] = ' + buildOpts.codeSignIdentity + '\n'; } - if (args.codeSignResourceRules) { - extraConfig += 'CODE_SIGN_RESOURCE_RULES_PATH = ' + args.codeSignResourceRules + '\n'; + if (buildOpts.codeSignResourceRules) { + extraConfig += 'CODE_SIGN_RESOURCE_RULES_PATH = ' + buildOpts.codeSignResourceRules + '\n'; } - if (args.provisioningProfile) { - extraConfig += 'PROVISIONING_PROFILE = ' + args.provisioningProfile + '\n'; + if (buildOpts.provisioningProfile) { + extraConfig += 'PROVISIONING_PROFILE = ' + buildOpts.provisioningProfile + '\n'; + } + if (buildOpts.developmentTeam) { + extraConfig += 'DEVELOPMENT_TEAM = ' + buildOpts.developmentTeam + '\n'; } return Q.nfcall(fs.writeFile, path.join(__dirname, '..', 'build-extras.xcconfig'), extraConfig, 'utf-8'); }).then(function () { - var configuration = args.release ? 'Release' : 'Debug'; + var configuration = buildOpts.release ? 'Release' : 'Debug'; + + events.emit('log','Building project: ' + path.join(projectPath, projectName + '.xcworkspace')); + events.emit('log','\tConfiguration: ' + configuration); + events.emit('log','\tPlatform: ' + (buildOpts.device ? 'device' : 'emulator')); + + var buildOutputDir = path.join(projectPath, 'build', 'device'); - console.log('Building project : ' + path.join(projectPath, projectName + '.xcodeproj')); - console.log('\tConfiguration : ' + configuration); - console.log('\tPlatform : ' + (args.device ? 'device' : 'emulator')); + // remove the build/device folder before building + return spawn('rm', [ '-rf', buildOutputDir ], projectPath) + .then(function() { + var xcodebuildArgs = getXcodeBuildArgs(projectName, projectPath, configuration, buildOpts.device, buildOpts.buildFlag); + return spawn('xcodebuild', xcodebuildArgs, projectPath); + }); - var xcodebuildArgs = getXcodeArgs(projectName, projectPath, configuration, args.device); - return spawn('xcodebuild', xcodebuildArgs, projectPath); }).then(function () { - if (!args.device) { + if (!buildOpts.device || buildOpts.noSign) { return; } + + var exportOptions = {'compileBitcode': false, 'method': 'development'}; + + if (buildOpts.packageType) { + exportOptions.method = buildOpts.packageType; + } + + if (buildOpts.developmentTeam) { + exportOptions.teamID = buildOpts.developmentTeam; + } + + var exportOptionsPlist = plist.build(exportOptions); + var exportOptionsPath = path.join(projectPath, 'exportOptions.plist'); + var buildOutputDir = path.join(projectPath, 'build', 'device'); - var pathToApp = path.join(buildOutputDir, projectName + '.app'); - var pathToIpa = path.join(buildOutputDir, projectName + '.ipa'); - var xcRunArgs = ['-sdk', 'iphoneos', 'PackageApplication', - '-v', pathToApp, - '-o', pathToIpa]; - if (args.codeSignIdentity) { - xcRunArgs.concat('--sign', args.codeSignIdentity); + + + function checkSystemRuby() { + var ruby_cmd = shell.which('ruby'); + + if (ruby_cmd != '/usr/bin/ruby') { + events.emit('warn', 'Non-system Ruby in use. This may cause packaging to fail.\n' + + 'If you use RVM, please run `rvm use system`.\n' + + 'If you use chruby, please run `chruby system`.'); + } + } + + function packageArchive() { + var xcodearchiveArgs = getXcodeArchiveArgs(projectName, projectPath, buildOutputDir, exportOptionsPath); + return spawn('xcodebuild', xcodearchiveArgs, projectPath); + } + + function unpackIPA() { + var ipafile = path.join(buildOutputDir, projectName + '.ipa'); + + // unpack the existing platform/ios/build/device/appname.ipa (zipfile), will create a Payload folder + return spawn('unzip', [ '-o', '-qq', ipafile ], buildOutputDir); } - if (args.provisioningProfile) { - xcRunArgs.concat('--embed', args.provisioningProfile); + + function moveApp() { + var appFileInflated = path.join(buildOutputDir, 'Payload', projectName + '.app'); + var appFile = path.join(buildOutputDir, projectName + '.app'); + var payloadFolder = path.join(buildOutputDir, 'Payload'); + + // delete the existing platform/ios/build/device/appname.app + return spawn('rm', [ '-rf', appFile ], buildOutputDir) + .then(function() { + // move the platform/ios/build/device/Payload/appname.app to parent + return spawn('mv', [ '-f', appFileInflated, buildOutputDir ], buildOutputDir); + }) + .then(function() { + // delete the platform/ios/build/device/Payload folder + return spawn('rm', [ '-rf', payloadFolder ], buildOutputDir); + }); } - return spawn('xcrun', xcRunArgs, projectPath); + + return Q.nfcall(fs.writeFile, exportOptionsPath, exportOptionsPlist, 'utf-8') + .then(checkSystemRuby) + .then(packageArchive) + .then(unpackIPA) + .then(moveApp); }); }; @@ -125,12 +197,12 @@ function findXCodeProjectIn(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' + + events.emit('warn','Found multiple .xcodeproj directories in \n' + projectPath + '\nUsing first one'); } @@ -148,38 +220,111 @@ module.exports.findXCodeProjectIn = findXCodeProjectIn; * @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) { +function getXcodeBuildArgs(projectName, projectPath, configuration, isDevice, buildFlags) { var xcodebuildArgs; + var options; + var buildActions; + var settings; + var customArgs = {}; + customArgs.otherFlags = []; + + if (buildFlags) { + if (typeof buildFlags === 'string' || buildFlags instanceof String) { + parseBuildFlag(buildFlags, customArgs); + } else { // buildFlags is an Array of strings + buildFlags.forEach( function(flag) { + parseBuildFlag(flag, customArgs); + }); + } + } + 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') + options = [ + '-xcconfig', customArgs.xcconfig || path.join(__dirname, '..', 'build-' + configuration.toLowerCase() + '.xcconfig'), + '-workspace', customArgs.workspace || projectName + '.xcworkspace', + '-scheme', customArgs.scheme || projectName, + '-configuration', customArgs.configuration || configuration, + '-destination', customArgs.destination || 'generic/platform=iOS', + '-archivePath', customArgs.archivePath || projectName + '.xcarchive' + ]; + buildActions = [ 'archive' ]; + settings = [ + customArgs.configuration_build_dir || 'CONFIGURATION_BUILD_DIR=' + path.join(projectPath, 'build', 'device'), + customArgs.shared_precomps_dir || 'SHARED_PRECOMPS_DIR=' + path.join(projectPath, 'build', 'sharedpch') ]; + // Add other matched flags to otherFlags to let xcodebuild present an appropriate error. + // This is preferable to just ignoring the flags that the user has passed in. + if (customArgs.sdk) { + customArgs.otherFlags = customArgs.otherFlags.concat(['-sdk', customArgs.sdk]); + } } 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') + options = [ + '-xcconfig', customArgs.xcconfig || path.join(__dirname, '..', 'build-' + configuration.toLowerCase() + '.xcconfig'), + '-workspace', customArgs.project || projectName + '.xcworkspace', + '-scheme', customArgs.scheme || projectName, + '-configuration', customArgs.configuration || configuration, + '-sdk', customArgs.sdk || 'iphonesimulator', + '-destination', customArgs.destination || 'platform=iOS Simulator,name=iPhone 5s' + ]; + buildActions = [ 'build' ]; + settings = [ + customArgs.configuration_build_dir || 'CONFIGURATION_BUILD_DIR=' + path.join(projectPath, 'build', 'emulator'), + customArgs.shared_precomps_dir || 'SHARED_PRECOMPS_DIR=' + path.join(projectPath, 'build', 'sharedpch') ]; + // Add other matched flags to otherFlags to let xcodebuild present an appropriate error. + // This is preferable to just ignoring the flags that the user has passed in. + if (customArgs.archivePath) { + customArgs.otherFlags = customArgs.otherFlags.concat(['-archivePath', customArgs.archivePath]); + } } + xcodebuildArgs = options.concat(buildActions).concat(settings).concat(customArgs.otherFlags); return xcodebuildArgs; } + +/** + * 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} outputPath Output directory to contain the IPA + * @param {String} exportOptionsPath Path to the exportOptions.plist file + * @return {Array} Array of arguments that could be passed directly to spawn method + */ +function getXcodeArchiveArgs(projectName, projectPath, outputPath, exportOptionsPath) { + return [ + '-exportArchive', + '-archivePath', projectName + '.xcarchive', + '-exportOptionsPlist', exportOptionsPath, + '-exportPath', outputPath + ]; +} + +function parseBuildFlag(buildFlag, args) { + var matched; + for (var key in buildFlagMatchers) { + var found = buildFlag.match(buildFlagMatchers[key]); + if (found) { + matched = true; + // found[0] is the whole match, found[1] is the first match in parentheses. + args[key] = found[1]; + events.emit('warn', util.format('Overriding xcodebuildArg: %s', buildFlag)); + } + } + + if (!matched) { + // If the flag starts with a '-' then it is an xcodebuild built-in option or a + // user-defined setting. The regex makes sure that we don't split a user-defined + // setting that is wrapped in quotes. + if (buildFlag[0] === '-' && !buildFlag.match(/^.*=(\".*\")|(\'.*\')$/)) { + args.otherFlags = args.otherFlags.concat(buildFlag.split(' ')); + events.emit('warn', util.format('Adding xcodebuildArg: %s', buildFlag.split(' '))); + } else { + args.otherFlags.push(buildFlag); + events.emit('warn', util.format('Adding xcodebuildArg: %s', buildFlag)); + } + } +} + // help/usage function module.exports.help = function help() { console.log(''); @@ -198,6 +343,7 @@ module.exports.help = function help() { console.log(' --codeSignIdentity : Type of signing identity used for code signing.'); console.log(' --codeSignResourceRules : Path to ResourceRules.plist.'); console.log(' --provisioningProfile : UUID of the profile.'); + console.log(' --device --noSign : Builds project without application signing.'); console.log(''); console.log('examples:'); console.log(' build '); diff --git a/StoneIsland/platforms/ios/cordova/lib/check_reqs.js b/StoneIsland/platforms/ios/cordova/lib/check_reqs.js index d1f6333c..ae21f989 100755 --- a/StoneIsland/platforms/ios/cordova/lib/check_reqs.js +++ b/StoneIsland/platforms/ios/cordova/lib/check_reqs.js @@ -19,22 +19,28 @@ var Q = require('q'), shell = require('shelljs'), + util = require('util'), versions = require('./versions'); -var XCODEBUILD_MIN_VERSION = '4.6.0'; +var XCODEBUILD_MIN_VERSION = '7.0.0'; var XCODEBUILD_NOT_FOUND_MESSAGE = 'Please install version ' + XCODEBUILD_MIN_VERSION + ' or greater from App Store'; -var IOS_SIM_MIN_VERSION = '3.0.0'; -var IOS_SIM_NOT_FOUND_MESSAGE = - 'Please download, build and install version ' + IOS_SIM_MIN_VERSION + ' or greater' + - ' from https://github.com/phonegap/ios-sim into your path, or do \'npm install -g ios-sim\''; - -var IOS_DEPLOY_MIN_VERSION = '1.4.0'; +var IOS_DEPLOY_MIN_VERSION = '1.9.0'; var IOS_DEPLOY_NOT_FOUND_MESSAGE = 'Please download, build and install version ' + IOS_DEPLOY_MIN_VERSION + ' or greater' + ' from https://github.com/phonegap/ios-deploy into your path, or do \'npm install -g ios-deploy\''; +var COCOAPODS_MIN_VERSION = '1.0.1'; +var COCOAPODS_NOT_FOUND_MESSAGE = + 'Please install version ' + COCOAPODS_MIN_VERSION + ' or greater from https://cocoapods.org/'; +var COCOAPODS_NOT_SYNCED_MESSAGE = + 'The CocoaPods repo has not been synced yet, this will take a long time (approximately 500MB as of Sept 2016). Please run `pod setup` first to sync the repo.'; +var COCOAPODS_SYNCED_MIN_SIZE = 475; // in megabytes +var COCOAPODS_SYNC_ERROR_MESSAGE = + 'The CocoaPods repo has been created, but there appears to be a sync error. The repo size should be at least ' + COCOAPODS_SYNCED_MIN_SIZE + '. Please run `pod setup --verbose` to sync the repo.'; +var COCOAPODS_REPO_NOT_FOUND_MESSAGE = 'The CocoaPods repo at ~/.cocoapods was not found.'; + /** * Checks if xcode util is available * @return {Promise} Returns a promise either resolved with xcode version or rejected @@ -51,14 +57,6 @@ 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.check_os = function () { // Build iOS apps available for OSX platform only, so we reject on others platforms return process.platform === 'darwin' ? @@ -66,29 +64,81 @@ module.exports.check_os = function () { Q.reject('Cordova tooling for iOS requires Apple OS X'); }; -module.exports.help = function () { - console.log('Usage: check_reqs or node check_reqs'); +function check_cocoapod_tool() { + return checkTool('pod', COCOAPODS_MIN_VERSION, COCOAPODS_NOT_FOUND_MESSAGE, 'CocoaPods'); +} + +/** + * Checks if cocoapods repo size is what is expected + * @return {Promise} Returns a promise either resolved or rejected + */ +module.exports.check_cocoapods_repo_size = function () { + return check_cocoapod_tool() + .then(function() { + // check size of ~/.cocoapods repo + var commandString = util.format('du -sh %s/.cocoapods', process.env.HOME); + var command = shell.exec(commandString, { silent:true }); + if (command.code !== 0) { // error, perhaps not found + return Q.reject(util.format('%s (%s)', COCOAPODS_REPO_NOT_FOUND_MESSAGE, command.output)); + } else { // success, parse output + // command.output is e.g "750M path/to/.cocoapods", we just scan the number + return Q.resolve(parseFloat(command.output)); + } + }) + .then(function(repoSize) { + if (COCOAPODS_SYNCED_MIN_SIZE > repoSize) { + return Q.reject(COCOAPODS_SYNC_ERROR_MESSAGE); + } else { + return Q.resolve(); + } + }); +}; + +/** + * Checks if cocoapods is available, and whether the repo is synced (because it takes a long time to download) + * @return {Promise} Returns a promise either resolved or rejected + */ +module.exports.check_cocoapods = function () { + return check_cocoapod_tool() + // check whether the cocoapods repo has been synced through `pod repo` command + // a value of '0 repos' means it hasn't been synced + .then(function() { + var code = shell.exec('pod repo | grep -e "^0 repos"', { silent:true }).code; + return Q.resolve(code !== 0); // non-zero means it is synced (has 1 repo at least) + }) + .then(function(repoIsSynced) { + if (repoIsSynced) { + // return check_cocoapods_repo_size(); + // we could check the repo size above, but it takes too long. + return Q.resolve(); + } else { + return Q.reject(COCOAPODS_NOT_SYNCED_MESSAGE); + } + }); }; /** * Checks if specific tool is available. - * @param {String} tool Tool name to check. Known tools are 'xcodebuild', 'ios-sim' and 'ios-deploy' + * @param {String} tool Tool name to check. Known tools are 'xcodebuild' and 'ios-deploy' * @param {Number} minVersion Min allowed tool version. * @param {String} message Message that will be used to reject promise. + * @param {String} toolFriendlyName Friendly name of the tool, to report to the user. Optional. * @return {Promise} Returns a promise either resolved with tool version or rejected */ -function checkTool (tool, minVersion, message) { +function checkTool (tool, minVersion, message, toolFriendlyName) { + toolFriendlyName = toolFriendlyName || tool; + // Check whether tool command is available at all var tool_command = shell.which(tool); if (!tool_command) { - return Q.reject(tool + ' was not found. ' + (message || '')); + return Q.reject(toolFriendlyName + ' was not found. ' + (message || '')); } // check if tool version is greater than specified one return versions.get_tool_version(tool).then(function (version) { version = version.trim(); return versions.compareVersions(version, minVersion) >= 0 ? Q.resolve(version) : - Q.reject('Cordova needs ' + tool + ' version ' + minVersion + + Q.reject('Cordova needs ' + toolFriendlyName + ' version ' + minVersion + ' or greater, you have version ' + version + '. ' + (message || '')); }); } @@ -120,7 +170,7 @@ module.exports.check_all = function() { new Requirement('os', 'Apple OS X', true), new Requirement('xcode', 'Xcode'), new Requirement('ios-deploy', 'ios-deploy'), - new Requirement('ios-sim', 'ios-sim') + new Requirement('CocoaPods', 'CocoaPods') ]; var result = []; @@ -130,7 +180,7 @@ module.exports.check_all = function() { module.exports.check_os, module.exports.check_xcodebuild, module.exports.check_ios_deploy, - module.exports.check_ios_sim + module.exports.check_cocoapods ]; // Then execute requirement checks one-by-one diff --git a/StoneIsland/platforms/ios/cordova/lib/clean.js b/StoneIsland/platforms/ios/cordova/lib/clean.js index 6d955cf1..7c8cf56e 100755 --- a/StoneIsland/platforms/ios/cordova/lib/clean.js +++ b/StoneIsland/platforms/ios/cordova/lib/clean.js @@ -22,8 +22,7 @@ var Q = require('q'), path = require('path'), shell = require('shelljs'), - spawn = require('./spawn'), - check_reqs = require('./check_reqs'); + spawn = require('./spawn'); var projectPath = path.join(__dirname, '..', '..'); @@ -36,9 +35,8 @@ module.exports.run = function() { 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', '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')); diff --git a/StoneIsland/platforms/ios/cordova/lib/copy-www-build-step.js b/StoneIsland/platforms/ios/cordova/lib/copy-www-build-step.js index 7a81b93e..7caa200f 100755 --- a/StoneIsland/platforms/ios/cordova/lib/copy-www-build-step.js +++ b/StoneIsland/platforms/ios/cordova/lib/copy-www-build-step.js @@ -32,7 +32,6 @@ var BUILT_PRODUCTS_DIR = process.env.BUILT_PRODUCTS_DIR, var path = require('path'), fs = require('fs'), shell = require('shelljs'), - glob = require('glob'), srcDir = 'www', dstDir = path.join(BUILT_PRODUCTS_DIR, FULL_PRODUCT_NAME), dstWwwDir = path.join(dstDir, 'www'); @@ -46,7 +45,7 @@ try { fs.statSync(srcDir); } catch (e) { console.error('Path does not exist: ' + srcDir); - process.exit(1); + process.exit(2); } // Code signing files must be removed or else there are @@ -57,11 +56,16 @@ shell.rm('-rf', path.join(dstDir, 'PkgInfo')); shell.rm('-rf', path.join(dstDir, 'embedded.mobileprovision')); // Copy www dir recursively +var code; if(!!COPY_HIDDEN) { - shell.mkdir('-p', dstWwwDir); - shell.cp('-r', glob.sync(srcDir + '/**', { dot: true }), dstWwwDir); + code = shell.exec('rsync -Lra "' + srcDir + '" "' + dstDir + '"').code; } else { - shell.cp('-r', srcDir, dstDir); + code = shell.exec('rsync -Lra --exclude="- .*" "' + srcDir + '" "' + dstDir + '"').code; +} + +if(code !== 0) { + console.error('Error occured on copying www. Code: ' + code); + process.exit(3); } // Copy the config.xml file. diff --git a/StoneIsland/platforms/ios/cordova/lib/list-emulator-images b/StoneIsland/platforms/ios/cordova/lib/list-emulator-images index 07dd1a48..87a5ad27 100755 --- a/StoneIsland/platforms/ios/cordova/lib/list-emulator-images +++ b/StoneIsland/platforms/ios/cordova/lib/list-emulator-images @@ -22,6 +22,7 @@ /*jshint node: true*/ var Q = require('q'), + iossim = require('ios-sim'), exec = require('child_process').exec, check_reqs = require('./check_reqs'); @@ -30,15 +31,10 @@ var Q = require('q'), * @return {Promise} Promise fulfilled with list of devices available for simulation */ function listEmulatorImages () { - return check_reqs.check_ios_sim().then(function () { - return Q.nfcall(exec, 'ios-sim showdevicetypes 2>&1 | ' + - 'sed "s/com.apple.CoreSimulator.SimDeviceType.//g"'); - }).then(function (stdio) { - // Exec promise resolves with array [stout, stderr], and we need stdout only - return stdio[0].trim().split('\n'); - }); + return Q.resolve(iossim.getdevicetypes()); } + exports.run = listEmulatorImages; // Check if module is started as separate script. diff --git a/StoneIsland/platforms/ios/cordova/lib/plugman/pluginHandlers.js b/StoneIsland/platforms/ios/cordova/lib/plugman/pluginHandlers.js new file mode 100755 index 00000000..297e3863 --- /dev/null +++ b/StoneIsland/platforms/ios/cordova/lib/plugman/pluginHandlers.js @@ -0,0 +1,375 @@ +/* + 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 fs = require('fs'); +var path = require('path'); +var shell = require('shelljs'); +var events = require('cordova-common').events; +var CordovaError = require('cordova-common').CordovaError; + +// These frameworks are required by cordova-ios by default. We should never add/remove them. +var keep_these_frameworks = [ + 'MobileCoreServices.framework', + 'CoreGraphics.framework', + 'AssetsLibrary.framework' +]; + +var handlers = { + 'source-file':{ + install:function(obj, plugin, project, options) { + installHelper('source-file', obj, plugin.dir, project.projectDir, plugin.id, options, project); + }, + uninstall:function(obj, plugin, project, options) { + uninstallHelper('source-file', obj, project.projectDir, plugin.id, options, project); + } + }, + 'header-file':{ + install:function(obj, plugin, project, options) { + installHelper('header-file', obj, plugin.dir, project.projectDir, plugin.id, options, project); + }, + uninstall:function(obj, plugin, project, options) { + uninstallHelper('header-file', obj, project.projectDir, plugin.id, options, project); + } + }, + 'resource-file':{ + install:function(obj, plugin, project, options) { + var src = obj.src, + srcFile = path.resolve(plugin.dir, src), + destFile = path.resolve(project.resources_dir, path.basename(src)); + if (!fs.existsSync(srcFile)) throw new CordovaError('Cannot find resource file "' + srcFile + '" for plugin ' + plugin.id + ' in iOS platform'); + if (fs.existsSync(destFile)) throw new CordovaError('File already exists at detination "' + destFile + '" for resource file specified by plugin ' + plugin.id + ' in iOS platform'); + project.xcode.addResourceFile(path.join('Resources', path.basename(src))); + var link = !!(options && options.link); + copyFile(plugin.dir, src, project.projectDir, destFile, link); + }, + uninstall:function(obj, plugin, project, options) { + var src = obj.src, + destFile = path.resolve(project.resources_dir, path.basename(src)); + project.xcode.removeResourceFile(path.join('Resources', path.basename(src))); + shell.rm('-rf', destFile); + } + }, + 'framework':{ // CB-5238 custom frameworks only + install:function(obj, plugin, project, options) { + var src = obj.src, + custom = obj.custom; + if (!custom) { + var keepFrameworks = keep_these_frameworks; + + if (keepFrameworks.indexOf(src) < 0) { + if (obj.type === 'podspec') { + //podspec handled in Api.js + } else { + project.frameworks[src] = project.frameworks[src] || 0; + project.frameworks[src]++; + project.xcode.addFramework(src, {weak: obj.weak}); + } + } + return; + } + var srcFile = path.resolve(plugin.dir, src), + targetDir = path.resolve(project.plugins_dir, plugin.id, path.basename(src)); + if (!fs.existsSync(srcFile)) throw new CordovaError('Cannot find framework "' + srcFile + '" for plugin ' + plugin.id + ' in iOS platform'); + if (fs.existsSync(targetDir)) throw new CordovaError('Framework "' + targetDir + '" for plugin ' + plugin.id + ' already exists in iOS platform'); + var link = !!(options && options.link); + copyFile(plugin.dir, src, project.projectDir, targetDir, link); // frameworks are directories + // CB-10773 translate back slashes to forward on win32 + var project_relative = fixPathSep(path.relative(project.projectDir, targetDir)); + var pbxFile = project.xcode.addFramework(project_relative, {customFramework: true}); + if (pbxFile) { + project.xcode.addToPbxEmbedFrameworksBuildPhase(pbxFile); + } + }, + uninstall:function(obj, plugin, project, options) { + var src = obj.src; + + if (!obj.custom) { //CB-9825 cocoapod integration for plugins + var keepFrameworks = keep_these_frameworks; + if (keepFrameworks.indexOf(src) < 0) { + if (obj.type === 'podspec') { + var podsJSON = require(path.join(project.projectDir, 'pods.json')); + if(podsJSON[src]) { + if(podsJSON[src].count > 1) { + podsJSON[src].count = podsJSON[src].count - 1; + } else { + delete podsJSON[src]; + } + } + } else { + //this should be refactored + project.frameworks[src] = project.frameworks[src] || 1; + project.frameworks[src]--; + if (project.frameworks[src] < 1) { + // Only remove non-custom framework from xcode project + // if there is no references remains + project.xcode.removeFramework(src); + delete project.frameworks[src]; + } + } + } + return; + } + + var targetDir = fixPathSep(path.resolve(project.plugins_dir, plugin.id, path.basename(src))), + pbxFile = project.xcode.removeFramework(targetDir, {customFramework: true}); + if (pbxFile) { + project.xcode.removeFromPbxEmbedFrameworksBuildPhase(pbxFile); + } + shell.rm('-rf', targetDir); + } + }, + 'lib-file': { + install:function(obj, plugin, project, options) { + events.emit('verbose', '<lib-file> install is not supported for iOS plugins'); + }, + uninstall:function(obj, plugin, project, options) { + events.emit('verbose', '<lib-file> uninstall is not supported for iOS plugins'); + } + }, + 'asset':{ + install:function(obj, plugin, project, options) { + if (!obj.src) { + throw new CordovaError(generateAttributeError('src', 'asset', plugin.id)); + } + if (!obj.target) { + throw new CordovaError(generateAttributeError('target', 'asset', plugin.id)); + } + + copyFile(plugin.dir, obj.src, project.www, obj.target); + if (options && options.usePlatformWww) copyFile(plugin.dir, obj.src, project.platformWww, obj.target); + }, + uninstall:function(obj, plugin, project, options) { + var target = obj.target; + + if (!target) { + throw new CordovaError(generateAttributeError('target', 'asset', plugin.id)); + } + + removeFile(project.www, target); + removeFileF(path.resolve(project.www, 'plugins', plugin.id)); + if (options && options.usePlatformWww) { + removeFile(project.platformWww, target); + removeFileF(path.resolve(project.platformWww, 'plugins', plugin.id)); + } + } + }, + 'js-module': { + install: function (obj, plugin, project, options) { + // Copy the plugin's files into the www directory. + var moduleSource = path.resolve(plugin.dir, obj.src); + var moduleName = plugin.id + '.' + (obj.name || path.basename(obj.src, path.extname (obj.src))); + + // Read in the file, prepend the cordova.define, and write it back out. + var scriptContent = fs.readFileSync(moduleSource, 'utf-8').replace(/^\ufeff/, ''); // Window BOM + if (moduleSource.match(/.*\.json$/)) { + scriptContent = 'module.exports = ' + scriptContent; + } + scriptContent = 'cordova.define("' + moduleName + '", function(require, exports, module) {\n' + scriptContent + '\n});\n'; + + var moduleDestination = path.resolve(project.www, 'plugins', plugin.id, obj.src); + shell.mkdir('-p', path.dirname(moduleDestination)); + fs.writeFileSync(moduleDestination, scriptContent, 'utf-8'); + if (options && options.usePlatformWww) { + var platformWwwDestination = path.resolve(project.platformWww, 'plugins', plugin.id, obj.src); + shell.mkdir('-p', path.dirname(platformWwwDestination)); + fs.writeFileSync(platformWwwDestination, scriptContent, 'utf-8'); + } + }, + uninstall: function (obj, plugin, project, options) { + var pluginRelativePath = path.join('plugins', plugin.id, obj.src); + removeFileAndParents(project.www, pluginRelativePath); + if (options && options.usePlatformWww) removeFileAndParents(project.platformWww, pluginRelativePath); + } + } +}; + +module.exports.getInstaller = function (type) { + if (handlers[type] && handlers[type].install) { + return handlers[type].install; + } + + events.emit('warn', '<' + type + '> is not supported for iOS plugins'); +}; + +module.exports.getUninstaller = function(type) { + if (handlers[type] && handlers[type].uninstall) { + return handlers[type].uninstall; + } + + events.emit('warn', '<' + type + '> is not supported for iOS plugins'); +}; + +function installHelper(type, obj, plugin_dir, project_dir, plugin_id, options, project) { + var srcFile = path.resolve(plugin_dir, obj.src); + var targetDir = path.resolve(project.plugins_dir, plugin_id, obj.targetDir || ''); + var destFile = path.join(targetDir, path.basename(obj.src)); + + var project_ref; + var link = !!(options && options.link); + if (link) { + var trueSrc = fs.realpathSync(srcFile); + // Create a symlink in the expected place, so that uninstall can use it. + if (options && options.force) { + copyFile(plugin_dir, trueSrc, project_dir, destFile, link); + } else { + copyNewFile(plugin_dir, trueSrc, project_dir, destFile, link); + } + // Xcode won't save changes to a file if there is a symlink involved. + // Make the Xcode reference the file directly. + // Note: Can't use path.join() here since it collapses 'Plugins/..', and xcode + // library special-cases Plugins/ prefix. + project_ref = 'Plugins/' + fixPathSep(path.relative(fs.realpathSync(project.plugins_dir), trueSrc)); + } else { + if (options && options.force) { + copyFile(plugin_dir, srcFile, project_dir, destFile, link); + } else { + copyNewFile(plugin_dir, srcFile, project_dir, destFile, link); + } + project_ref = 'Plugins/' + fixPathSep(path.relative(project.plugins_dir, destFile)); + } + + if (type == 'header-file') { + project.xcode.addHeaderFile(project_ref); + } else if (obj.framework) { + var opt = { weak: obj.weak }; + var project_relative = path.join(path.basename(project.xcode_path), project_ref); + project.xcode.addFramework(project_relative, opt); + project.xcode.addToLibrarySearchPaths({path:project_ref}); + } else { + project.xcode.addSourceFile(project_ref, obj.compilerFlags ? {compilerFlags:obj.compilerFlags} : {}); + } +} + +function uninstallHelper(type, obj, project_dir, plugin_id, options, project) { + var targetDir = path.resolve(project.plugins_dir, plugin_id, obj.targetDir || ''); + var destFile = path.join(targetDir, path.basename(obj.src)); + + var project_ref; + var link = !!(options && options.link); + if (link) { + var trueSrc = fs.readlinkSync(destFile); + project_ref = 'Plugins/' + fixPathSep(path.relative(fs.realpathSync(project.plugins_dir), trueSrc)); + } else { + project_ref = 'Plugins/' + fixPathSep(path.relative(project.plugins_dir, destFile)); + } + + shell.rm('-rf', targetDir); + + if (type == 'header-file') { + project.xcode.removeHeaderFile(project_ref); + } else if (obj.framework) { + var project_relative = path.join(path.basename(project.xcode_path), project_ref); + project.xcode.removeFramework(project_relative); + project.xcode.removeFromLibrarySearchPaths({path:project_ref}); + } else { + project.xcode.removeSourceFile(project_ref); + } +} + +var pathSepFix = new RegExp(path.sep.replace(/\\/,'\\\\'),'g'); +function fixPathSep(file) { + return file.replace(pathSepFix, '/'); +} + +function copyFile (plugin_dir, src, project_dir, dest, link) { + src = path.resolve(plugin_dir, src); + if (!fs.existsSync(src)) throw new CordovaError('"' + src + '" not found!'); + + // check that src path is inside plugin directory + var real_path = fs.realpathSync(src); + var real_plugin_path = fs.realpathSync(plugin_dir); + if (real_path.indexOf(real_plugin_path) !== 0) + throw new CordovaError('File "' + src + '" is located outside the plugin directory "' + plugin_dir + '"'); + + dest = path.resolve(project_dir, dest); + + // check that dest path is located in project directory + if (dest.indexOf(project_dir) !== 0) + throw new CordovaError('Destination "' + dest + '" for source file "' + src + '" is located outside the project'); + + shell.mkdir('-p', path.dirname(dest)); + + if (link) { + symlinkFileOrDirTree(src, dest); + } else if (fs.statSync(src).isDirectory()) { + // XXX shelljs decides to create a directory when -R|-r is used which sucks. http://goo.gl/nbsjq + shell.cp('-Rf', path.join(src, '/*'), dest); + } else { + shell.cp('-f', src, dest); + } +} + +// Same as copy file but throws error if target exists +function copyNewFile (plugin_dir, src, project_dir, dest, link) { + var target_path = path.resolve(project_dir, dest); + if (fs.existsSync(target_path)) + throw new CordovaError('"' + target_path + '" already exists!'); + + copyFile(plugin_dir, src, project_dir, dest, !!link); +} + +function symlinkFileOrDirTree(src, dest) { + if (fs.existsSync(dest)) { + shell.rm('-Rf', dest); + } + + if (fs.statSync(src).isDirectory()) { + shell.mkdir('-p', dest); + fs.readdirSync(src).forEach(function(entry) { + symlinkFileOrDirTree(path.join(src, entry), path.join(dest, entry)); + }); + } + else { + fs.symlinkSync(path.relative(fs.realpathSync(path.dirname(dest)), src), dest); + } +} + +// checks if file exists and then deletes. Error if doesn't exist +function removeFile (project_dir, src) { + var file = path.resolve(project_dir, src); + shell.rm('-Rf', file); +} + +// deletes file/directory without checking +function removeFileF (file) { + shell.rm('-Rf', file); +} + +function removeFileAndParents (baseDir, destFile, stopper) { + stopper = stopper || '.'; + var file = path.resolve(baseDir, destFile); + if (!fs.existsSync(file)) return; + + removeFileF(file); + + // check if directory is empty + var curDir = path.dirname(file); + + while(curDir !== path.resolve(baseDir, stopper)) { + if(fs.existsSync(curDir) && fs.readdirSync(curDir).length === 0) { + fs.rmdirSync(curDir); + curDir = path.resolve(curDir, '..'); + } else { + // directory not empty...do nothing + break; + } + } +} + +function generateAttributeError(attribute, element, id) { + return 'Required attribute "' + attribute + '" not specified in <' + element + '> element from plugin: ' + id; +} diff --git a/StoneIsland/platforms/ios/cordova/lib/prepare.js b/StoneIsland/platforms/ios/cordova/lib/prepare.js new file mode 100755 index 00000000..8d1cda94 --- /dev/null +++ b/StoneIsland/platforms/ios/cordova/lib/prepare.js @@ -0,0 +1,1003 @@ +/** + 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 Q = require('q'); +var fs = require('fs'); +var path = require('path'); +var shell = require('shelljs'); +var xcode = require('xcode'); +var unorm = require('unorm'); +var plist = require('plist'); +var URL = require('url'); +var events = require('cordova-common').events; +var xmlHelpers = require('cordova-common').xmlHelpers; +var ConfigParser = require('cordova-common').ConfigParser; +var CordovaError = require('cordova-common').CordovaError; +var PlatformJson = require('cordova-common').PlatformJson; +var PlatformMunger = require('cordova-common').ConfigChanges.PlatformMunger; +var PluginInfoProvider = require('cordova-common').PluginInfoProvider; +var FileUpdater = require('cordova-common').FileUpdater; + +/*jshint sub:true*/ + +module.exports.prepare = function (cordovaProject, options) { + var self = this; + + var platformJson = PlatformJson.load(this.locations.root, 'ios'); + var munger = new PlatformMunger('ios', this.locations.root, platformJson, new PluginInfoProvider()); + + this._config = updateConfigFile(cordovaProject.projectConfig, munger, this.locations); + + // Update own www dir with project's www assets and plugins' assets and js-files + return Q.when(updateWww(cordovaProject, this.locations)) + .then(function () { + // update project according to config.xml changes. + return updateProject(self._config, self.locations); + }) + .then(function () { + updateIcons(cordovaProject, self.locations); + updateSplashScreens(cordovaProject, self.locations); + updateLaunchStoryboardImages(cordovaProject, self.locations); + }) + .then(function () { + events.emit('verbose', 'Prepared iOS project successfully'); + }); +}; + +module.exports.clean = function (options) { + // A cordovaProject isn't passed into the clean() function, because it might have + // been called from the platform shell script rather than the CLI. Check for the + // noPrepare option passed in by the non-CLI clean script. If that's present, or if + // there's no config.xml found at the project root, then don't clean prepared files. + var projectRoot = path.resolve(this.root, '../..'); + var projectConfigFile = path.join(projectRoot, 'config.xml'); + if ((options && options.noPrepare) || !fs.existsSync(projectConfigFile) || + !fs.existsSync(this.locations.configXml)) { + return Q(); + } + + var projectConfig = new ConfigParser(this.locations.configXml); + + var self = this; + return Q().then(function () { + cleanWww(projectRoot, self.locations); + cleanIcons(projectRoot, projectConfig, self.locations); + cleanSplashScreens(projectRoot, projectConfig, self.locations); + cleanLaunchStoryboardImages(projectRoot, projectConfig, self.locations); + }); +}; + +/** + * Updates config files in project based on app's config.xml and config munge, + * generated by plugins. + * + * @param {ConfigParser} sourceConfig A project's configuration that will + * be merged into platform's config.xml + * @param {ConfigChanges} configMunger An initialized ConfigChanges instance + * for this platform. + * @param {Object} locations A map of locations for this platform + * + * @return {ConfigParser} An instance of ConfigParser, that + * represents current project's configuration. When returned, the + * configuration is already dumped to appropriate config.xml file. + */ +function updateConfigFile(sourceConfig, configMunger, locations) { + events.emit('verbose', 'Generating platform-specific config.xml from defaults for iOS at ' + locations.configXml); + + // First cleanup current config and merge project's one into own + // Overwrite platform config.xml with defaults.xml. + shell.cp('-f', locations.defaultConfigXml, locations.configXml); + + // Then apply config changes from global munge to all config files + // in project (including project's config) + configMunger.reapply_global_munge().save_all(); + + events.emit('verbose', 'Merging project\'s config.xml into platform-specific iOS config.xml'); + // Merge changes from app's config.xml into platform's one + var config = new ConfigParser(locations.configXml); + xmlHelpers.mergeXml(sourceConfig.doc.getroot(), + config.doc.getroot(), 'ios', /*clobber=*/true); + + config.write(); + return config; +} + +/** + * Logs all file operations via the verbose event stream, indented. + */ +function logFileOp(message) { + events.emit('verbose', ' ' + message); +} + +/** + * Updates platform 'www' directory by replacing it with contents of + * 'platform_www' and app www. Also copies project's overrides' folder into + * the platform 'www' folder + * + * @param {Object} cordovaProject An object which describes cordova project. + * @param {boolean} destinations An object that contains destinations + * paths for www files. + */ +function updateWww(cordovaProject, destinations) { + var sourceDirs = [ + path.relative(cordovaProject.root, cordovaProject.locations.www), + path.relative(cordovaProject.root, destinations.platformWww) + ]; + + // If project contains 'merges' for our platform, use them as another overrides + var merges_path = path.join(cordovaProject.root, 'merges', 'ios'); + if (fs.existsSync(merges_path)) { + events.emit('verbose', 'Found "merges/ios" folder. Copying its contents into the iOS project.'); + sourceDirs.push(path.join('merges', 'ios')); + } + + var targetDir = path.relative(cordovaProject.root, destinations.www); + events.emit( + 'verbose', 'Merging and updating files from [' + sourceDirs.join(', ') + '] to ' + targetDir); + FileUpdater.mergeAndUpdateDir( + sourceDirs, targetDir, { rootDir: cordovaProject.root }, logFileOp); +} + +/** + * Cleans all files from the platform 'www' directory. + */ +function cleanWww(projectRoot, locations) { + var targetDir = path.relative(projectRoot, locations.www); + events.emit('verbose', 'Cleaning ' + targetDir); + + // No source paths are specified, so mergeAndUpdateDir() will clear the target directory. + FileUpdater.mergeAndUpdateDir( + [], targetDir, { rootDir: projectRoot, all: true }, logFileOp); +} + +/** + * Updates project structure and AndroidManifest according to project's configuration. + * + * @param {ConfigParser} platformConfig A project's configuration that will + * be used to update project + * @param {Object} locations A map of locations for this platform (In/Out) + */ +function updateProject(platformConfig, locations) { + + // CB-6992 it is necessary to normalize characters + // because node and shell scripts handles unicode symbols differently + // We need to normalize the name to NFD form since iOS uses NFD unicode form + var name = unorm.nfd(platformConfig.name()); + var pkg = platformConfig.getAttribute('ios-CFBundleIdentifier') || platformConfig.packageName(); + var version = platformConfig.version(); + + var originalName = path.basename(locations.xcodeCordovaProj); + + // Update package id (bundle id) + var plistFile = path.join(locations.xcodeCordovaProj, originalName + '-Info.plist'); + var infoPlist = plist.parse(fs.readFileSync(plistFile, 'utf8')); + infoPlist['CFBundleIdentifier'] = pkg; + + // Update version (bundle version) + infoPlist['CFBundleShortVersionString'] = version; + var CFBundleVersion = platformConfig.getAttribute('ios-CFBundleVersion') || default_CFBundleVersion(version); + infoPlist['CFBundleVersion'] = CFBundleVersion; + + if (platformConfig.getAttribute('defaultlocale')) { + infoPlist['CFBundleDevelopmentRegion'] = platformConfig.getAttribute('defaultlocale'); + } + + // replace Info.plist ATS entries according to <access> and <allow-navigation> config.xml entries + var ats = writeATSEntries(platformConfig); + if (Object.keys(ats).length > 0) { + infoPlist['NSAppTransportSecurity'] = ats; + } else { + delete infoPlist['NSAppTransportSecurity']; + } + + handleOrientationSettings(platformConfig, infoPlist); + updateProjectPlistForLaunchStoryboard(platformConfig, infoPlist); + + var info_contents = plist.build(infoPlist); + info_contents = info_contents.replace(/<string>[\s\r\n]*<\/string>/g,'<string></string>'); + fs.writeFileSync(plistFile, info_contents, 'utf-8'); + events.emit('verbose', 'Wrote out iOS Bundle Identifier "' + pkg + '" and iOS Bundle Version "' + version + '" to ' + plistFile); + + return handleBuildSettings(platformConfig, locations).then(function() { + if (name == originalName) { + events.emit('verbose', 'iOS Product Name has not changed (still "' + originalName + '")'); + return Q(); + } else { // CB-11712 <name> was changed, we don't support it' + var errorString = + 'The product name change (<name> tag) in config.xml is not supported dynamically.\n' + + 'To change your product name, you have to remove, then add your ios platform again.\n' + + 'Make sure you save your plugins beforehand using `cordova plugin save`.\n' + + '\tcordova plugin save\n' + + '\tcordova platform rm ios\n' + + '\tcordova platform add ios\n' + ; + + return Q.reject(new CordovaError(errorString)); + } + }); +} + +function handleOrientationSettings(platformConfig, infoPlist) { + + switch (getOrientationValue(platformConfig)) { + case 'portrait': + infoPlist['UIInterfaceOrientation'] = [ 'UIInterfaceOrientationPortrait' ]; + infoPlist['UISupportedInterfaceOrientations'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown' ]; + infoPlist['UISupportedInterfaceOrientations~ipad'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown' ]; + break; + case 'landscape': + infoPlist['UIInterfaceOrientation'] = [ 'UIInterfaceOrientationLandscapeLeft' ]; + infoPlist['UISupportedInterfaceOrientations'] = [ 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]; + infoPlist['UISupportedInterfaceOrientations~ipad'] = [ 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]; + break; + case 'all': + infoPlist['UIInterfaceOrientation'] = [ 'UIInterfaceOrientationPortrait' ]; + infoPlist['UISupportedInterfaceOrientations'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]; + infoPlist['UISupportedInterfaceOrientations~ipad'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]; + break; + case 'default': + infoPlist['UISupportedInterfaceOrientations'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]; + infoPlist['UISupportedInterfaceOrientations~ipad'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]; + delete infoPlist['UIInterfaceOrientation']; + } +} + +function handleBuildSettings(platformConfig, locations) { + var targetDevice = parseTargetDevicePreference(platformConfig.getPreference('target-device', 'ios')); + var deploymentTarget = platformConfig.getPreference('deployment-target', 'ios'); + + // no build settings provided, we don't need to parse and update .pbxproj file + if (!targetDevice && !deploymentTarget) { + return Q(); + } + + var proj = new xcode.project(locations.pbxproj); + + try { + proj.parseSync(); + } catch (err) { + return Q.reject(new CordovaError('Could not parse project.pbxproj: ' + err)); + } + + if (targetDevice) { + events.emit('verbose', 'Set TARGETED_DEVICE_FAMILY to ' + targetDevice + '.'); + proj.updateBuildProperty('TARGETED_DEVICE_FAMILY', targetDevice); + } + + if (deploymentTarget) { + events.emit('verbose', 'Set IPHONEOS_DEPLOYMENT_TARGET to "' + deploymentTarget + '".'); + proj.updateBuildProperty('IPHONEOS_DEPLOYMENT_TARGET', deploymentTarget); + } + + fs.writeFileSync(locations.pbxproj, proj.writeSync(), 'utf-8'); + + return Q(); +} + +function mapIconResources(icons, iconsDir) { + // See https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html + // for launch images sizes reference. + var platformIcons = [ + {dest: 'icon-60@2x.png', width: 120, height: 120}, + {dest: 'icon-60@3x.png', width: 180, height: 180}, + {dest: 'icon-76.png', width: 76, height: 76}, + {dest: 'icon-76@2x.png', width: 152, height: 152}, + {dest: 'icon-small.png', width: 29, height: 29}, + {dest: 'icon-small@2x.png', width: 58, height: 58}, + {dest: 'icon-40.png', width: 40, height: 40}, + {dest: 'icon-40@2x.png', width: 80, height: 80}, + {dest: 'icon-small@3x.png', width: 87, height: 87}, + {dest: 'icon.png', width: 57, height: 57}, + {dest: 'icon@2x.png', width: 114, height: 114}, + {dest: 'icon-72.png', width: 72, height: 72}, + {dest: 'icon-72@2x.png', width: 144, height: 144}, + {dest: 'icon-50.png', width: 50, height: 50}, + {dest: 'icon-50@2x.png', width: 100, height: 100}, + {dest: 'icon-83.5@2x.png', width: 167, height: 167} + ]; + + var pathMap = {}; + platformIcons.forEach(function (item) { + var icon = icons.getBySize(item.width, item.height) || icons.getDefault(); + if (icon) { + var target = path.join(iconsDir, item.dest); + pathMap[target] = icon.src; + } + }); + return pathMap; +} + +function getIconsDir(projectRoot, platformProjDir) { + var iconsDir; + var xcassetsExists = folderExists(path.join(projectRoot, platformProjDir, 'Images.xcassets/')); + + if (xcassetsExists) { + iconsDir = path.join(platformProjDir, 'Images.xcassets/AppIcon.appiconset/'); + } else { + iconsDir = path.join(platformProjDir, 'Resources/icons/'); + } + + return iconsDir; +} + +function updateIcons(cordovaProject, locations) { + var icons = cordovaProject.projectConfig.getIcons('ios'); + + if (icons.length === 0) { + events.emit('verbose', 'This app does not have icons defined'); + return; + } + + var platformProjDir = path.relative(cordovaProject.root, locations.xcodeCordovaProj); + var iconsDir = getIconsDir(cordovaProject.root, platformProjDir); + var resourceMap = mapIconResources(icons, iconsDir); + events.emit('verbose', 'Updating icons at ' + iconsDir); + FileUpdater.updatePaths( + resourceMap, { rootDir: cordovaProject.root }, logFileOp); +} + +function cleanIcons(projectRoot, projectConfig, locations) { + var icons = projectConfig.getIcons('ios'); + if (icons.length > 0) { + var platformProjDir = path.relative(projectRoot, locations.xcodeCordovaProj); + var iconsDir = getIconsDir(projectRoot, platformProjDir); + var resourceMap = mapIconResources(icons, iconsDir); + Object.keys(resourceMap).forEach(function (targetIconPath) { + resourceMap[targetIconPath] = null; + }); + events.emit('verbose', 'Cleaning icons at ' + iconsDir); + + // Source paths are removed from the map, so updatePaths() will delete the target files. + FileUpdater.updatePaths( + resourceMap, { rootDir: projectRoot, all: true }, logFileOp); + } +} + +function mapSplashScreenResources(splashScreens, splashScreensDir) { + var platformSplashScreens = [ + {dest: 'Default~iphone.png', width: 320, height: 480}, + {dest: 'Default@2x~iphone.png', width: 640, height: 960}, + {dest: 'Default-Portrait~ipad.png', width: 768, height: 1024}, + {dest: 'Default-Portrait@2x~ipad.png', width: 1536, height: 2048}, + {dest: 'Default-Landscape~ipad.png', width: 1024, height: 768}, + {dest: 'Default-Landscape@2x~ipad.png', width: 2048, height: 1536}, + {dest: 'Default-568h@2x~iphone.png', width: 640, height: 1136}, + {dest: 'Default-667h.png', width: 750, height: 1334}, + {dest: 'Default-736h.png', width: 1242, height: 2208}, + {dest: 'Default-Landscape-736h.png', width: 2208, height: 1242} + ]; + + var pathMap = {}; + platformSplashScreens.forEach(function (item) { + var splash = splashScreens.getBySize(item.width, item.height); + if (splash) { + var target = path.join(splashScreensDir, item.dest); + pathMap[target] = splash.src; + } + }); + return pathMap; +} + +function getSplashScreensDir(projectRoot, platformProjDir) { + var splashScreensDir; + var xcassetsExists = folderExists(path.join(projectRoot, platformProjDir, 'Images.xcassets/')); + + if (xcassetsExists) { + splashScreensDir = path.join(platformProjDir, 'Images.xcassets/LaunchImage.launchimage/'); + } else { + splashScreensDir = path.join(platformProjDir, 'Resources/splash/'); + } + + return splashScreensDir; +} + +function updateSplashScreens(cordovaProject, locations) { + var splashScreens = cordovaProject.projectConfig.getSplashScreens('ios'); + + if (splashScreens.length === 0) { + events.emit('verbose', 'This app does not have splash screens defined'); + return; + } + + var platformProjDir = path.relative(cordovaProject.root, locations.xcodeCordovaProj); + var splashScreensDir = getSplashScreensDir(cordovaProject.root, platformProjDir); + var resourceMap = mapSplashScreenResources(splashScreens, splashScreensDir); + events.emit('verbose', 'Updating splash screens at ' + splashScreensDir); + FileUpdater.updatePaths( + resourceMap, { rootDir: cordovaProject.root }, logFileOp); +} + +function cleanSplashScreens(projectRoot, projectConfig, locations) { + var splashScreens = projectConfig.getSplashScreens('ios'); + if (splashScreens.length > 0) { + var platformProjDir = path.relative(projectRoot, locations.xcodeCordovaProj); + var splashScreensDir = getSplashScreensDir(projectRoot, platformProjDir); + var resourceMap = mapIconResources(splashScreens, splashScreensDir); + Object.keys(resourceMap).forEach(function (targetSplashPath) { + resourceMap[targetSplashPath] = null; + }); + events.emit('verbose', 'Cleaning splash screens at ' + splashScreensDir); + + // Source paths are removed from the map, so updatePaths() will delete the target files. + FileUpdater.updatePaths( + resourceMap, { rootDir: projectRoot, all: true }, logFileOp); + } +} + +/** + * Returns an array of images for each possible idiom, scale, and size class. The images themselves are + * located in the platform's splash images by their pattern (@scale~idiom~sizesize). All possible + * combinations are returned, but not all will have a `filename` property. If the latter isn't present, + * the device won't attempt to load an image matching the same traits. If the filename is present, + * the device will try to load the image if it corresponds to the traits. + * + * The resulting return looks like this: + * + * [ + * { + * idiom: 'universal|ipad|iphone', + * scale: '1x|2x|3x', + * width: 'any|com', + * height: 'any|com', + * filename: undefined|'Default@scale~idiom~widthheight.png', + * src: undefined|'path/to/original/matched/image/from/splash/screens.png', + * target: undefined|'path/to/asset/library/Default@scale~idiom~widthheight.png' + * }, ... + * ] + * + * @param {Array<Object>} splashScreens splash screens as defined in config.xml for this platform + * @param {string} launchStoryboardImagesDir project-root/Images.xcassets/LaunchStoryboard.imageset/ + * @return {Array<Object>} + */ +function mapLaunchStoryboardContents(splashScreens, launchStoryboardImagesDir) { + var platformLaunchStoryboardImages = []; + var idioms = ['universal', 'ipad', 'iphone']; + var scalesForIdiom = { + universal: ['1x', '2x', '3x'], + ipad: ['1x', '2x'], + iphone: ['1x', '2x', '3x'] + }; + var sizes = ['com', 'any']; + + idioms.forEach(function (idiom) { + scalesForIdiom[idiom].forEach(function (scale) { + sizes.forEach(function(width) { + sizes.forEach(function(height) { + var item = { + idiom: idiom, + scale: scale, + width: width, + height: height + }; + + /* examples of the search pattern: + * scale ~ idiom ~ width height + * @2x ~ universal ~ any any + * @3x ~ iphone ~ com any + * @2x ~ ipad ~ com any + */ + var searchPattern = '@' + scale + '~' + idiom + '~' + width + height; + + /* because old node versions don't have Array.find, the below is + * functionally equivalent to this: + * var launchStoryboardImage = splashScreens.find(function(item) { + * return item.src.indexOf(searchPattern) >= 0; + * }); + */ + var launchStoryboardImage = splashScreens.reduce(function (p, c) { + return (c.src.indexOf(searchPattern) >= 0) ? c : p; + }, undefined); + + if (launchStoryboardImage) { + item.filename = 'Default' + searchPattern + '.png'; + item.src = launchStoryboardImage.src; + item.target = path.join(launchStoryboardImagesDir, item.filename); + } + + platformLaunchStoryboardImages.push(item); + }); + }); + }); + }); + return platformLaunchStoryboardImages; +} + +/** + * Returns a dictionary representing the source and destination paths for the launch storyboard images + * that need to be copied. + * + * The resulting return looks like this: + * + * { + * 'target-path': 'source-path', + * ... + * } + * + * @param {Array<Object>} splashScreens splash screens as defined in config.xml for this platform + * @param {string} launchStoryboardImagesDir project-root/Images.xcassets/LaunchStoryboard.imageset/ + * @return {Object} + */ +function mapLaunchStoryboardResources(splashScreens, launchStoryboardImagesDir) { + var platformLaunchStoryboardImages = mapLaunchStoryboardContents(splashScreens, launchStoryboardImagesDir); + var pathMap = {}; + platformLaunchStoryboardImages.forEach(function (item) { + if (item.target) { + pathMap[item.target] = item.src; + } + }); + return pathMap; +} + +/** + * Builds the object that represents the contents.json file for the LaunchStoryboard image set. + * + * The resulting return looks like this: + * + * { + * images: [ + * { + * idiom: 'universal|ipad|iphone', + * scale: '1x|2x|3x', + * width-class: undefined|'compact', + * height-class: undefined|'compact' + * }, ... + * ], + * info: { + * author: 'Xcode', + * version: 1 + * } + * } + * + * A bit of minor logic is used to map from the array of images returned from mapLaunchStoryboardContents + * to the format requried by Xcode. + * + * @param {Array<Object>} splashScreens splash screens as defined in config.xml for this platform + * @param {string} launchStoryboardImagesDir project-root/Images.xcassets/LaunchStoryboard.imageset/ + * @return {Object} + */ +function getLaunchStoryboardContentsJSON(splashScreens, launchStoryboardImagesDir) { + var IMAGESET_COMPACT_SIZE_CLASS = 'compact'; + var CDV_ANY_SIZE_CLASS = 'any'; + + var platformLaunchStoryboardImages = mapLaunchStoryboardContents(splashScreens, launchStoryboardImagesDir); + var contentsJSON = { + images: [], + info: { + author: 'Xcode', + version: 1 + } + }; + contentsJSON.images = platformLaunchStoryboardImages.map(function(item) { + var newItem = { + idiom: item.idiom, + scale: item.scale + }; + + // Xcode doesn't want any size class property if the class is "any" + // If our size class is "com", Xcode wants "compact". + if (item.width !== CDV_ANY_SIZE_CLASS) { + newItem['width-class'] = IMAGESET_COMPACT_SIZE_CLASS; + } + if (item.height !== CDV_ANY_SIZE_CLASS) { + newItem['height-class'] = IMAGESET_COMPACT_SIZE_CLASS; + } + + // Xcode doesn't want a filename property if there's no image for these traits + if (item.filename) { + newItem.filename = item.filename; + } + return newItem; + }); + return contentsJSON; +} + +/** + * Updates the project's plist based upon our launch storyboard images. If there are no images, then we should + * fall back to the regular launch images that might be supplied (that is, our app will be scaled on an iPad Pro), + * and if there are some images, we need to alter the UILaunchStoryboardName property to point to + * CDVLaunchScreen. + * + * There's some logic here to avoid overwriting changes the user might have made to their plist if they are using + * their own launch storyboard. + */ +function updateProjectPlistForLaunchStoryboard(platformConfig, infoPlist) { + var UI_LAUNCH_STORYBOARD_NAME = 'UILaunchStoryboardName'; + var CDV_LAUNCH_STORYBOARD_NAME = 'CDVLaunchScreen'; + + var splashScreens = platformConfig.getSplashScreens('ios'); + var contentsJSON = getLaunchStoryboardContentsJSON(splashScreens, ''); // note: we don't need a file path here; we're just counting + var currentLaunchStoryboard = infoPlist[UI_LAUNCH_STORYBOARD_NAME]; + + events.emit('verbose', 'Current launch storyboard ' + currentLaunchStoryboard); + + + /* do we have any launch images do we have for our launch storyboard? + * Again, for old Node versions, the below code is equivalent to this: + * var hasLaunchStoryboardImages = !!contentsJSON.images.find(function (item) { + * return item.filename !== undefined; + * }); + */ + var hasLaunchStoryboardImages = !!contentsJSON.images.reduce(function (p, c) { + return (c.filename !== undefined) ? c : p; + }, undefined); + + if (hasLaunchStoryboardImages && !currentLaunchStoryboard) { + // only change the launch storyboard if we have images to use AND the current value is blank + // if it's not blank, we've either done this before, or the user has their own launch storyboard + events.emit('verbose', 'Changing project to use our launch storyboard'); + infoPlist[UI_LAUNCH_STORYBOARD_NAME] = CDV_LAUNCH_STORYBOARD_NAME; + return; + } + + if (!hasLaunchStoryboardImages && currentLaunchStoryboard === CDV_LAUNCH_STORYBOARD_NAME) { + // only revert to using the launch images if we have don't have any images for the launch storyboard + // but only clear it if current launch storyboard is our storyboard; the user might be using their + // own storyboard instead. + events.emit('verbose', 'Changing project to use launch images'); + infoPlist[UI_LAUNCH_STORYBOARD_NAME] = undefined; + return; + } + events.emit('verbose', 'Not changing launch storyboard setting.'); +} + +/** + * Returns the directory for the Launch Storyboard image set, if image sets are being used. If they aren't + * being used, returns null. + * + * @param {string} projectRoot The project's root directory + * @param {string} platformProjDir The platform's project directory + */ +function getLaunchStoryboardImagesDir(projectRoot, platformProjDir) { + var launchStoryboardImagesDir; + var xcassetsExists = folderExists(path.join(projectRoot, platformProjDir, 'Images.xcassets/')); + + if (xcassetsExists) { + launchStoryboardImagesDir = path.join(platformProjDir, 'Images.xcassets/LaunchStoryboard.imageset/'); + } else { + // if we don't have a asset library for images, we can't do the storyboard. + launchStoryboardImagesDir = null; + } + + return launchStoryboardImagesDir; +} + +/** + * Update the images for the Launch Storyboard and updates the image set's contents.json file appropriately. + * + * @param {Object} cordovaProject The cordova project + * @param {Object} locations A dictionary containing useful location paths + */ +function updateLaunchStoryboardImages(cordovaProject, locations) { + var splashScreens = cordovaProject.projectConfig.getSplashScreens('ios'); + var platformProjDir = locations.xcodeCordovaProj; + var launchStoryboardImagesDir = getLaunchStoryboardImagesDir(cordovaProject.root, platformProjDir); + + if (launchStoryboardImagesDir) { + var resourceMap = mapLaunchStoryboardResources(splashScreens, launchStoryboardImagesDir); + var contentsJSON = getLaunchStoryboardContentsJSON(splashScreens, launchStoryboardImagesDir); + + events.emit('verbose', 'Updating launch storyboard images at ' + launchStoryboardImagesDir); + FileUpdater.updatePaths( + resourceMap, { rootDir: cordovaProject.root }, logFileOp); + + events.emit('verbose', 'Updating Storyboard image set contents.json'); + fs.writeFileSync(path.join(launchStoryboardImagesDir, 'contents.json'), + JSON.stringify(contentsJSON, null, 2)); + } +} + +/** + * Removes the images from the launch storyboard's image set and updates the image set's contents.json + * file appropriately. + * + * @param {string} projectRoot Path to the project root + * @param {Object} projectConfig The project's config.xml + * @param {Object} locations A dictionary containing useful location paths + */ +function cleanLaunchStoryboardImages(projectRoot, projectConfig, locations) { + var splashScreens = projectConfig.getSplashScreens('ios'); + var platformProjDir = locations.xcodeCordovaProj; + var launchStoryboardImagesDir = getLaunchStoryboardImagesDir(projectRoot, platformProjDir); + if (launchStoryboardImagesDir) { + var resourceMap = mapLaunchStoryboardResources(splashScreens, launchStoryboardImagesDir); + var contentsJSON = getLaunchStoryboardContentsJSON(splashScreens, launchStoryboardImagesDir); + + Object.keys(resourceMap).forEach(function (targetPath) { + resourceMap[targetPath] = null; + }); + events.emit('verbose', 'Cleaning storyboard image set at ' + launchStoryboardImagesDir); + + // Source paths are removed from the map, so updatePaths() will delete the target files. + FileUpdater.updatePaths( + resourceMap, { rootDir: projectRoot, all: true }, logFileOp); + + // delete filename from contents.json + contentsJSON.images.forEach(function(image) { + image.filename = undefined; + }); + + events.emit('verbose', 'Updating Storyboard image set contents.json'); + fs.writeFileSync(path.join(launchStoryboardImagesDir, 'contents.json'), + JSON.stringify(contentsJSON, null, 2)); + } +} + +/** + * Queries ConfigParser object for the orientation <preference> value. Warns if + * global preference value is not supported by platform. + * + * @param {Object} platformConfig ConfigParser object + * + * @return {String} Global/platform-specific orientation in lower-case + * (or empty string if both are undefined). + */ +function getOrientationValue(platformConfig) { + + var ORIENTATION_DEFAULT = 'default'; + + var orientation = platformConfig.getPreference('orientation'); + if (!orientation) { + return ''; + } + + orientation = orientation.toLowerCase(); + + // Check if the given global orientation is supported + if (['default', 'portrait','landscape', 'all'].indexOf(orientation) >= 0) { + return orientation; + } + + events.emit('warn', 'Unrecognized value for Orientation preference: ' + orientation + + '. Defaulting to value: ' + ORIENTATION_DEFAULT + '.'); + + return ORIENTATION_DEFAULT; +} + +/* + Parses all <access> and <allow-navigation> entries and consolidates duplicates (for ATS). + Returns an object with a Hostname as the key, and the value an object with properties: + { + Hostname, // String + NSExceptionAllowsInsecureHTTPLoads, // boolean + NSIncludesSubdomains, // boolean + NSExceptionMinimumTLSVersion, // String + NSExceptionRequiresForwardSecrecy, // boolean + NSRequiresCertificateTransparency, // boolean + + // the three below _only_ show when the Hostname is '*' + // if any of the three are set, it disables setting NSAllowsArbitraryLoads + // (Apple already enforces this in ATS) + NSAllowsArbitraryLoadsInWebContent, // boolean (default: false) + NSAllowsLocalNetworking, // boolean (default: false) + NSAllowsArbitraryLoadsInMedia, // boolean (default:false) + } +*/ +function processAccessAndAllowNavigationEntries(config) { + var accesses = config.getAccesses(); + var allow_navigations = config.getAllowNavigations(); + + return allow_navigations + // we concat allow_navigations and accesses, after processing accesses + .concat(accesses.map(function(obj) { + // map accesses to a common key interface using 'href', not origin + obj.href = obj.origin; + delete obj.origin; + return obj; + })) + // we reduce the array to an object with all the entries processed (key is Hostname) + .reduce(function(previousReturn, currentElement) { + var options = { + minimum_tls_version : currentElement.minimum_tls_version, + requires_forward_secrecy : currentElement.requires_forward_secrecy, + requires_certificate_transparency : currentElement.requires_certificate_transparency, + allows_arbitrary_loads_in_media : currentElement.allows_arbitrary_loads_in_media, + allows_arbitrary_loads_in_web_content : currentElement.allows_arbitrary_loads_in_web_content, + allows_local_networking : currentElement.allows_local_networking + }; + var obj = parseWhitelistUrlForATS(currentElement.href, options); + + if (obj) { + // we 'union' duplicate entries + var item = previousReturn[obj.Hostname]; + if (!item) { + item = {}; + } + for(var o in obj) { + if (obj.hasOwnProperty(o)) { + item[o] = obj[o]; + } + } + previousReturn[obj.Hostname] = item; + } + return previousReturn; + }, {}); +} + +/* + Parses a URL and returns an object with these keys: + { + Hostname, // String + NSExceptionAllowsInsecureHTTPLoads, // boolean (default: false) + NSIncludesSubdomains, // boolean (default: false) + NSExceptionMinimumTLSVersion, // String (default: 'TLSv1.2') + NSExceptionRequiresForwardSecrecy, // boolean (default: true) + NSRequiresCertificateTransparency, // boolean (default: false) + + // the three below _only_ apply when the Hostname is '*' + // if any of the three are set, it disables setting NSAllowsArbitraryLoads + // (Apple already enforces this in ATS) + NSAllowsArbitraryLoadsInWebContent, // boolean (default: false) + NSAllowsLocalNetworking, // boolean (default: false) + NSAllowsArbitraryLoadsInMedia, // boolean (default:false) + } + + null is returned if the URL cannot be parsed, or is to be skipped for ATS. +*/ +function parseWhitelistUrlForATS(url, options) { + var href = URL.parse(url); + var retObj = {}; + retObj.Hostname = href.hostname; + + // Guiding principle: we only set values in retObj if they are NOT the default + + if (url === '*') { + retObj.Hostname = '*'; + var val; + + val = (options.allows_arbitrary_loads_in_web_content === 'true'); + if (options.allows_arbitrary_loads_in_web_content && val) { // default is false + retObj.NSAllowsArbitraryLoadsInWebContent = true; + } + + val = (options.allows_arbitrary_loads_in_media === 'true'); + if (options.allows_arbitrary_loads_in_media && val) { // default is false + retObj.NSAllowsArbitraryLoadsInMedia = true; + } + + val = (options.allows_local_networking === 'true'); + if (options.allows_local_networking && val) { // default is false + retObj.NSAllowsLocalNetworking = true; + } + + return retObj; + } + + if (!retObj.Hostname) { + // check origin, if it allows subdomains (wildcard in hostname), we set NSIncludesSubdomains to YES. Default is NO + var subdomain1 = '/*.'; // wildcard in hostname + var subdomain2 = '*://*.'; // wildcard in hostname and protocol + var subdomain3 = '*://'; // wildcard in protocol only + if (href.pathname.indexOf(subdomain1) === 0) { + retObj.NSIncludesSubdomains = true; + retObj.Hostname = href.pathname.substring(subdomain1.length); + } else if (href.pathname.indexOf(subdomain2) === 0) { + retObj.NSIncludesSubdomains = true; + retObj.Hostname = href.pathname.substring(subdomain2.length); + } else if (href.pathname.indexOf(subdomain3) === 0) { + retObj.Hostname = href.pathname.substring(subdomain3.length); + } else { + // Handling "scheme:*" case to avoid creating of a blank key in NSExceptionDomains. + return null; + } + } + + if (options.minimum_tls_version && options.minimum_tls_version !== 'TLSv1.2') { // default is TLSv1.2 + retObj.NSExceptionMinimumTLSVersion = options.minimum_tls_version; + } + + var rfs = (options.requires_forward_secrecy === 'true'); + if (options.requires_forward_secrecy && !rfs) { // default is true + retObj.NSExceptionRequiresForwardSecrecy = false; + } + + var rct = (options.requires_certificate_transparency === 'true'); + if (options.requires_certificate_transparency && rct) { // default is false + retObj.NSRequiresCertificateTransparency = true; + } + + // if the scheme is HTTP, we set NSExceptionAllowsInsecureHTTPLoads to YES. Default is NO + if (href.protocol === 'http:') { + retObj.NSExceptionAllowsInsecureHTTPLoads = true; + } + else if (!href.protocol && href.pathname.indexOf('*:/') === 0) { // wilcard in protocol + retObj.NSExceptionAllowsInsecureHTTPLoads = true; + } + + return retObj; +} + + +/* + App Transport Security (ATS) writer from <access> and <allow-navigation> tags + in config.xml +*/ +function writeATSEntries(config) { + var pObj = processAccessAndAllowNavigationEntries(config); + + var ats = {}; + + for(var hostname in pObj) { + if (pObj.hasOwnProperty(hostname)) { + var entry = pObj[hostname]; + + // Guiding principle: we only set values if they are available + + if (hostname === '*') { + // always write this, for iOS 9, since in iOS 10 it will be overriden if + // any of the other three keys are written + ats['NSAllowsArbitraryLoads'] = true; + + // at least one of the overriding keys is present + if (entry.NSAllowsArbitraryLoadsInWebContent) { + ats['NSAllowsArbitraryLoadsInWebContent'] = true; + } + if (entry.NSAllowsArbitraryLoadsInMedia) { + ats['NSAllowsArbitraryLoadsInMedia'] = true; + } + if (entry.NSAllowsLocalNetworking) { + ats['NSAllowsLocalNetworking'] = true; + } + + continue; + } + + var exceptionDomain = {}; + + for(var key in entry) { + if (entry.hasOwnProperty(key) && key !== 'Hostname') { + exceptionDomain[key] = entry[key]; + } + } + + if (!ats['NSExceptionDomains']) { + ats['NSExceptionDomains'] = {}; + } + + ats['NSExceptionDomains'][hostname] = exceptionDomain; + } + } + + return ats; +} + +function folderExists(folderPath) { + try { + var stat = fs.statSync(folderPath); + return stat && stat.isDirectory(); + } catch (e) { + return false; + } +} + +// Construct a default value for CFBundleVersion as the version with any +// -rclabel stripped=. +function default_CFBundleVersion(version) { + return version.split('-')[0]; +} + +// Converts cordova specific representation of target device to XCode value +function parseTargetDevicePreference(value) { + if (!value) return null; + var map = { 'universal': '"1,2"', 'handset': '"1"', 'tablet': '"2"'}; + if (map[value.toLowerCase()]) { + return map[value.toLowerCase()]; + } + events.emit('warn', 'Unrecognized value for target-device preference: ' + value + '.'); + return null; +} diff --git a/StoneIsland/platforms/ios/cordova/lib/projectFile.js b/StoneIsland/platforms/ios/cordova/lib/projectFile.js new file mode 100755 index 00000000..aab38639 --- /dev/null +++ b/StoneIsland/platforms/ios/cordova/lib/projectFile.js @@ -0,0 +1,136 @@ +/* + 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 xcode = require('xcode'); +var plist = require('plist'); +var _ = require('underscore'); +var path = require('path'); +var fs = require('fs'); +var shell = require('shelljs'); + +var pluginHandlers = require('./plugman/pluginHandlers'); +var CordovaError = require('cordova-common').CordovaError; + +var cachedProjectFiles = {}; + +function parseProjectFile(locations) { + var project_dir = locations.root; + var pbxPath = locations.pbxproj; + + if (cachedProjectFiles[project_dir]) { + return cachedProjectFiles[project_dir]; + } + + var xcodeproj = xcode.project(pbxPath); + xcodeproj.parseSync(); + + var xcBuildConfiguration = xcodeproj.pbxXCBuildConfigurationSection(); + var plist_file_entry = _.find(xcBuildConfiguration, function (entry) { return entry.buildSettings && entry.buildSettings.INFOPLIST_FILE; }); + var plist_file = path.join(project_dir, plist_file_entry.buildSettings.INFOPLIST_FILE.replace(/^"(.*)"$/g, '$1').replace(/\\&/g, '&')); + var config_file = path.join(path.dirname(plist_file), 'config.xml'); + + if (!fs.existsSync(plist_file) || !fs.existsSync(config_file)) { + throw new CordovaError('Could not find *-Info.plist file, or config.xml file.'); + } + + var frameworks_file = path.join(project_dir, 'frameworks.json'); + var frameworks = {}; + try { + frameworks = require(frameworks_file); + } catch (e) { } + + var xcode_dir = path.dirname(plist_file); + var pluginsDir = path.resolve(xcode_dir, 'Plugins'); + var resourcesDir = path.resolve(xcode_dir, 'Resources'); + + cachedProjectFiles[project_dir] = { + plugins_dir:pluginsDir, + resources_dir:resourcesDir, + xcode:xcodeproj, + xcode_path:xcode_dir, + pbx: pbxPath, + projectDir: project_dir, + platformWww: path.join(project_dir, 'platform_www'), + www: path.join(project_dir, 'www'), + write: function () { + fs.writeFileSync(pbxPath, xcodeproj.writeSync()); + if (Object.keys(this.frameworks).length === 0){ + // If there is no framework references remain in the project, just remove this file + shell.rm('-rf', frameworks_file); + return; + } + fs.writeFileSync(frameworks_file, JSON.stringify(this.frameworks, null, 4)); + }, + getPackageName: function() { + return plist.parse(fs.readFileSync(plist_file, 'utf8')).CFBundleIdentifier; + }, + getInstaller: function (name) { + return pluginHandlers.getInstaller(name); + }, + getUninstaller: function (name) { + return pluginHandlers.getUninstaller(name); + }, + frameworks: frameworks + }; + return cachedProjectFiles[project_dir]; +} + +function purgeProjectFileCache(project_dir) { + delete cachedProjectFiles[project_dir]; +} + +module.exports = { + parse: parseProjectFile, + purgeProjectFileCache: purgeProjectFileCache +}; + +xcode.project.prototype.pbxEmbedFrameworksBuildPhaseObj = function (target) { + return this.buildPhaseObject('PBXCopyFilesBuildPhase', 'Embed Frameworks', target); +}; + +xcode.project.prototype.addToPbxEmbedFrameworksBuildPhase = function (file) { + var sources = this.pbxEmbedFrameworksBuildPhaseObj(file.target); + if (sources) { + sources.files.push(pbxBuildPhaseObj(file)); + } +}; +xcode.project.prototype.removeFromPbxEmbedFrameworksBuildPhase = function (file) { + var sources = this.pbxEmbedFrameworksBuildPhaseObj(file.target); + if (sources) { + sources.files = _.reject(sources.files, function(file){ + return file.comment === longComment(file); + }); + } +}; + +// special handlers to add frameworks to the 'Embed Frameworks' build phase, needed for custom frameworks +// see CB-9517. should probably be moved to node-xcode. +var util = require('util'); +function pbxBuildPhaseObj(file) { + var obj = Object.create(null); + obj.value = file.uuid; + obj.comment = longComment(file); + return obj; +} + +function longComment(file) { + return util.format('%s in %s', file.basename, file.group); +} diff --git a/StoneIsland/platforms/ios/cordova/lib/run.js b/StoneIsland/platforms/ios/cordova/lib/run.js index fcd39015..68c315a5 100755 --- a/StoneIsland/platforms/ios/cordova/lib/run.js +++ b/StoneIsland/platforms/ios/cordova/lib/run.js @@ -20,84 +20,103 @@ /*jshint node: true*/ var Q = require('q'), - nopt = require('nopt'), - path = require('path'), - build = require('./build'), - spawn = require('./spawn'), + path = require('path'), + iossim = require('ios-sim'), + build = require('./build'), + spawn = require('./spawn'), check_reqs = require('./check_reqs'); +var events = require('cordova-common').events; + 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); +module.exports.run = function (runOptions) { // Validate args - if (args.device && args.emulator) { + if (runOptions.device && runOptions.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.device) && args.target && validTargets.indexOf(args.target.split(',')[0]) < 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 (runOptions.list) { + if (runOptions.device) return listDevices(); + if (runOptions.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(); + var useDevice = !!runOptions.device; - return checkTools.then(function () { - // if --nobuild isn't specified then build app first - if (!args.nobuild) { - return build.run(argv); + return require('./list-devices').run() + .then(function (devices) { + if (devices.length > 0 && !(runOptions.emulator)) { + useDevice = true; + // we also explicitly set device flag in options as we pass + // those parameters to other api (build as an example) + runOptions.device = true; + return check_reqs.check_ios_deploy(); + } + }).then(function () { + if (!runOptions.nobuild) { + return build.run(runOptions); + } else { + return Q.resolve(); } }).then(function () { return build.findXCodeProjectIn(projectPath); }).then(function (projectName) { - var appPath = path.join(projectPath, 'build', (args.device ? 'device' : 'emulator'), projectName + '.app'); + var appPath = path.join(projectPath, 'build', 'emulator', projectName + '.app'); // select command to run and arguments depending whether // we're running on device/emulator - if (args.device) { + if (useDevice) { return checkDeviceConnected().then(function () { - return deployToDevice(appPath); + appPath = path.join(projectPath, 'build', 'device', projectName + '.app'); + var extraArgs = []; + if (runOptions.argv) { + // argv.slice(2) removes node and run.js, filterSupportedArgs removes the run.js args + extraArgs = filterSupportedArgs(runOptions.argv.slice(2)); + } + return deployToDevice(appPath, runOptions.target, extraArgs); }, function () { // if device connection check failed use emulator then - return deployToSim(appPath, args.target); + return deployToSim(appPath, runOptions.target); }); } else { - return deployToSim(appPath, args.target); + return deployToSim(appPath, runOptions.target); } }); }; /** + * Filters the args array and removes supported args for the 'run' command. + * + * @return {Array} array with unsupported args for the 'run' command + */ +function filterSupportedArgs(args) { + var filtered = []; + var sargs = ['--device', '--emulator', '--nobuild', '--list', '--target', '--debug', '--release']; + var re = new RegExp(sargs.join('|')); + + args.forEach(function(element) { + // supported args not found, we add + // we do a regex search because --target can be "--target=XXX" + if (element.search(re) == -1) { + filtered.push(element); + } + }, this); + + return filtered; +} + +/** * Checks if any iOS device is connected * @return {Promise} Fullfilled when any device is connected, rejected otherwise */ function checkDeviceConnected() { - return spawn('ios-deploy', ['-c']); + return spawn('ios-deploy', ['-c', '-t', '1']); } /** @@ -106,9 +125,13 @@ function checkDeviceConnected() { * @param {String} appPath Path to application package * @return {Promise} Resolves when deploy succeeds otherwise rejects */ -function deployToDevice(appPath) { +function deployToDevice(appPath, target, extraArgs) { // Deploying to device... - return spawn('ios-deploy', ['-d', '-b', appPath]); + if (target) { + return spawn('ios-deploy', ['--justlaunch', '-d', '-b', appPath, '-i', target].concat(extraArgs)); + } else { + return spawn('ios-deploy', ['--justlaunch', '--no-wifi', '-d', '-b', appPath].concat(extraArgs)); + } } /** @@ -118,27 +141,38 @@ function deployToDevice(appPath) { * @return {Promise} Resolves when deploy succeeds otherwise rejects */ function deployToSim(appPath, target) { - // Select target device for emulator. Default is 'iPhone-6' + // 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'); + return require('./list-emulator-images').run() + .then(function (emulators) { + if (emulators.length > 0) { + target = emulators[0]; + } + emulators.forEach(function (emulator) { + if (emulator.indexOf('iPhone') === 0) { + target = emulator; + } + }); + events.emit('log','No target specified for emulator. Deploying to ' + target + ' simulator'); + return startSim(appPath, target); + }); + } else { + return startSim(appPath, target); } +} + +function startSim(appPath, target) { 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); + + return iossim.launch(appPath, 'com.apple.CoreSimulator.SimDeviceType.' + target, logPath, '--exit'); } function listDevices() { return require('./list-devices').run() .then(function (devices) { - console.log('Available iOS Devices:'); + events.emit('log','Available iOS Devices:'); devices.forEach(function (device) { - console.log('\t' + device); + events.emit('log','\t' + device); }); }); } @@ -146,9 +180,9 @@ function listDevices() { function listEmulators() { return require('./list-emulator-images').run() .then(function (emulators) { - console.log('Available iOS Virtual Devices:'); + events.emit('log','Available iOS Simulators:'); emulators.forEach(function (emulator) { - console.log('\t' + emulator); + events.emit('log','\t' + emulator); }); }); } diff --git a/StoneIsland/platforms/ios/cordova/lib/spawn.js b/StoneIsland/platforms/ios/cordova/lib/spawn.js index 1cb31615..2162b9c7 100755 --- a/StoneIsland/platforms/ios/cordova/lib/spawn.js +++ b/StoneIsland/platforms/ios/cordova/lib/spawn.js @@ -43,7 +43,6 @@ module.exports = function(cmd, args, opt_cwd) { } }); } catch(e) { - console.error('error caught: ' + e); d.reject(e); } return d.promise; diff --git a/StoneIsland/platforms/ios/cordova/lib/versions.js b/StoneIsland/platforms/ios/cordova/lib/versions.js index e22e499a..da31d4fa 100755 --- a/StoneIsland/platforms/ios/cordova/lib/versions.js +++ b/StoneIsland/platforms/ios/cordova/lib/versions.js @@ -111,6 +111,23 @@ exports.get_ios_deploy_version = function() { }; /** + * Gets pod (CocoaPods) util version + * @return {Promise} Promise that either resolved with pod version + * or rejected in case of error + */ +exports.get_cocoapods_version = function() { + var d = Q.defer(); + child_process.exec('pod --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 @@ -138,7 +155,8 @@ exports.get_tool_version = function (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\''); + case 'pod': return exports.get_cocoapods_version(); + default: return Q.reject(toolName + ' is not valid tool name. Valid names are: \'xcodebuild\', \'ios-sim\', \'ios-deploy\', and \'pod\''); } }; diff --git a/StoneIsland/platforms/ios/cordova/log.bat b/StoneIsland/platforms/ios/cordova/log.bat new file mode 100755 index 00000000..4710e57e --- /dev/null +++ b/StoneIsland/platforms/ios/cordova/log.bat @@ -0,0 +1,19 @@ +:: 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 +ECHO WARN: The 'log' command is not available for cordova-ios on windows machines.>&2 diff --git a/StoneIsland/platforms/ios/cordova/loggingHelper.js b/StoneIsland/platforms/ios/cordova/loggingHelper.js new file mode 100755 index 00000000..e353399c --- /dev/null +++ b/StoneIsland/platforms/ios/cordova/loggingHelper.js @@ -0,0 +1,30 @@ +/** + 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 CordovaLogger = require('cordova-common').CordovaLogger; + +module.exports = { + adjustLoggerLevel: function (opts) { + if (opts.verbose || (Array.isArray(opts) && opts.indexOf('--verbose') !== -1)) { + CordovaLogger.get().setLevel('verbose'); + } else if (opts.silent || (Array.isArray(opts) && opts.indexOf('--silent') !== -1)) { + CordovaLogger.get().setLevel('error'); + } + } +}; diff --git a/StoneIsland/platforms/ios/cordova/node_modules/nopt/LICENSE b/StoneIsland/platforms/ios/cordova/node_modules/nopt/LICENSE index 05a40109..19129e31 100755 --- a/StoneIsland/platforms/ios/cordova/node_modules/nopt/LICENSE +++ b/StoneIsland/platforms/ios/cordova/node_modules/nopt/LICENSE @@ -1,23 +1,15 @@ -Copyright 2009, 2010, 2011 Isaac Z. Schlueter. -All rights reserved. +The ISC License -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: +Copyright (c) Isaac Z. Schlueter and Contributors -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -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. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/StoneIsland/platforms/ios/cordova/node_modules/nopt/lib/nopt.js b/StoneIsland/platforms/ios/cordova/node_modules/nopt/lib/nopt.js index 5309a00f..97707e78 100755 --- a/StoneIsland/platforms/ios/cordova/node_modules/nopt/lib/nopt.js +++ b/StoneIsland/platforms/ios/cordova/node_modules/nopt/lib/nopt.js @@ -207,7 +207,8 @@ function validate (data, k, val, type, typeDefs) { for (var i = 0, l = types.length; i < l; i ++) { debug("test type %j %j %j", k, val, types[i]) var t = typeDefs[types[i]] - if (t && type === t.type) { + if (t && + ((type && type.name && t.type && t.type.name) ? (type.name === t.type.name) : (type === t.type))) { var d = {} ok = false !== t.validate(d, k, val) val = d[k] diff --git a/StoneIsland/platforms/ios/cordova/node_modules/nopt/node_modules/abbrev/LICENSE b/StoneIsland/platforms/ios/cordova/node_modules/nopt/node_modules/abbrev/LICENSE deleted file mode 100755 index 05a40109..00000000 --- a/StoneIsland/platforms/ios/cordova/node_modules/nopt/node_modules/abbrev/LICENSE +++ /dev/null @@ -1,23 +0,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. diff --git a/StoneIsland/platforms/ios/cordova/node_modules/nopt/node_modules/abbrev/abbrev.js b/StoneIsland/platforms/ios/cordova/node_modules/nopt/node_modules/abbrev/abbrev.js deleted file mode 100755 index 69cfeac5..00000000 --- a/StoneIsland/platforms/ios/cordova/node_modules/nopt/node_modules/abbrev/abbrev.js +++ /dev/null @@ -1,62 +0,0 @@ - -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 -} diff --git a/StoneIsland/platforms/ios/cordova/node_modules/nopt/node_modules/abbrev/package.json b/StoneIsland/platforms/ios/cordova/node_modules/nopt/node_modules/abbrev/package.json deleted file mode 100755 index 91f1dd9c..00000000 --- a/StoneIsland/platforms/ios/cordova/node_modules/nopt/node_modules/abbrev/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "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" -} diff --git a/StoneIsland/platforms/ios/cordova/node_modules/nopt/package.json b/StoneIsland/platforms/ios/cordova/node_modules/nopt/package.json index 62d0fe84..c0025bda 100755 --- a/StoneIsland/platforms/ios/cordova/node_modules/nopt/package.json +++ b/StoneIsland/platforms/ios/cordova/node_modules/nopt/package.json @@ -1,41 +1,54 @@ { - "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" + "bugs": { + "url": "https://github.com/npm/nopt/issues" }, "dependencies": { "abbrev": "1" }, + "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.", "devDependencies": { - "tap": "~0.4.8" + "tap": "^1.2.0" }, - "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" + "directories": {}, + "dist": { + "shasum": "c6465dbf08abcd4db359317f79ac68a646b28ff9", + "tarball": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz" + }, + "gitHead": "10a750c9bb99c1950160353459e733ac2aa18cb6", + "homepage": "https://github.com/npm/nopt#readme", + "license": "ISC", + "main": "lib/nopt.js", + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + }, + { + "name": "othiym23", + "email": "ogd@aoaioxxysz.net" + }, + { + "name": "zkat", + "email": "kat@sykosomatic.org" + } + ], + "name": "nopt", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/nopt.git" + }, + "scripts": { + "test": "tap test/*.js" }, - "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" -} + "version": "3.0.6" +}
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/cordova/node_modules/q/package.json b/StoneIsland/platforms/ios/cordova/node_modules/q/package.json index 7b7f3c6c..5ad2a032 100755 --- a/StoneIsland/platforms/ios/cordova/node_modules/q/package.json +++ b/StoneIsland/platforms/ios/cordova/node_modules/q/package.json @@ -1,27 +1,12 @@ { - "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" - ], + "bugs": { + "url": "http://github.com/kriskowal/q/issues" + }, "contributors": [ { "name": "Kris Kowal", @@ -39,64 +24,56 @@ "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": {}, + "description": "A library for promises (CommonJS/Promises/A,B,D)", "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" - } - } + "grunt-contrib-uglify": "~0.9.1", + "jasmine-node": "1.11.0", + "jshint": "~2.1.9", + "matcha": "~0.2.0", + "opener": "*", + "promises-aplus-tests": "1.x" }, "directories": { "test": "./spec" }, - "_id": "q@1.0.1", "dist": { - "shasum": "11872aeedee89268110b10a718448ffb10112a14", - "tarball": "http://registry.npmjs.org/q/-/q-1.0.1.tgz" + "shasum": "55705bcd93c5f3673530c2c2cbc0c2b3addc286e", + "tarball": "https://registry.npmjs.org/q/-/q-1.4.1.tgz" }, - "_from": "q@", - "_npmVersion": "1.4.4", - "_npmUser": { - "name": "kriskowal", - "email": "kris.kowal@cixar.com" + "engines": { + "node": ">=0.6.0", + "teleport": ">=0.2.0" }, + "files": [ + "LICENSE", + "q.js", + "queue.js" + ], + "gitHead": "d373079d3620152e3d60e82f27265a09ee0e81bd", + "homepage": "https://github.com/kriskowal/q", + "keywords": [ + "q", + "promise", + "promises", + "promises-a", + "promises-aplus", + "deferred", + "future", + "async", + "flow control", + "fluent", + "browser", + "node" + ], + "license": { + "type": "MIT", + "url": "http://github.com/kriskowal/q/raw/master/LICENSE" + }, + "main": "q.js", "maintainers": [ { "name": "kriskowal", @@ -107,6 +84,28 @@ "email": "domenic@domenicdenicola.com" } ], - "_shasum": "11872aeedee89268110b10a718448ffb10112a14", - "_resolved": "https://registry.npmjs.org/q/-/q-1.0.1.tgz" -} + "name": "q", + "optionalDependencies": {}, + "overlay": { + "teleport": { + "dependencies": { + "system": ">=0.0.4" + } + } + }, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/kriskowal/q.git" + }, + "scripts": { + "benchmark": "matcha", + "cover": "cover run jasmine-node spec && cover report html && opener cover_html/index.html", + "lint": "jshint q.js", + "minify": "grunt", + "prepublish": "grunt", + "test": "jasmine-node spec && promises-aplus-tests spec/aplus-adapter", + "test-browser": "opener spec/q-spec.html" + }, + "version": "1.4.1" +}
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/cordova/node_modules/q/q.js b/StoneIsland/platforms/ios/cordova/node_modules/q/q.js index df36027e..cf5339e3 100755 --- a/StoneIsland/platforms/ios/cordova/node_modules/q/q.js +++ b/StoneIsland/platforms/ios/cordova/node_modules/q/q.js @@ -27,8 +27,7 @@ */ (function (definition) { - // Turn off strict mode for this function so we can assign to global.Q - /* jshint strict: false */ + "use strict"; // This file will function properly as a <script> tag, or a module // using CommonJS and NodeJS or RequireJS module formats. In @@ -40,7 +39,7 @@ bootstrap("promise", definition); // CommonJS - } else if (typeof exports === "object") { + } else if (typeof exports === "object" && typeof module === "object") { module.exports = definition(); // RequireJS @@ -56,8 +55,25 @@ } // <script> + } else if (typeof window !== "undefined" || typeof self !== "undefined") { + // Prefer window over self for add-on scripts. Use self for + // non-windowed contexts. + var global = typeof window !== "undefined" ? window : self; + + // Get the `window` object, save the previous Q global + // and initialize Q as a global. + var previousQ = global.Q; + global.Q = definition(); + + // Add a noConflict function so Q can be removed from the + // global namespace. + global.Q.noConflict = function () { + global.Q = previousQ; + return this; + }; + } else { - Q = definition(); + throw new Error("This environment was not anticipated by Q. Please file a bug."); } })(function () { @@ -89,57 +105,67 @@ var nextTick =(function () { var flushing = false; var requestTick = void 0; var isNodeJS = false; + // queue for late tasks, used by unhandled rejection tracking + var laterQueue = []; function flush() { /* jshint loopfunc: true */ + var task, domain; while (head.next) { head = head.next; - var task = head.task; + task = head.task; head.task = void 0; - var domain = head.domain; + domain = head.domain; if (domain) { head.domain = void 0; domain.enter(); } + runSingle(task, domain); - try { - task(); - - } catch (e) { - if (isNodeJS) { - // In node, uncaught exceptions are considered fatal errors. - // Re-throw them synchronously to interrupt flushing! - - // Ensure continuation if the uncaught exception is suppressed - // listening "uncaughtException" events (as domains does). - // Continue in next event to avoid tick recursion. - if (domain) { - domain.exit(); - } - setTimeout(flush, 0); - if (domain) { - domain.enter(); - } + } + while (laterQueue.length) { + task = laterQueue.pop(); + runSingle(task); + } + flushing = false; + } + // runs a single function in the async queue + function runSingle(task, domain) { + try { + task(); - throw e; + } catch (e) { + if (isNodeJS) { + // In node, uncaught exceptions are considered fatal errors. + // Re-throw them synchronously to interrupt flushing! - } else { - // In browsers, uncaught exceptions are not fatal. - // Re-throw them asynchronously to avoid slow-downs. - setTimeout(function() { - throw e; - }, 0); + // Ensure continuation if the uncaught exception is suppressed + // listening "uncaughtException" events (as domains does). + // Continue in next event to avoid tick recursion. + if (domain) { + domain.exit(); + } + setTimeout(flush, 0); + if (domain) { + domain.enter(); } - } - if (domain) { - domain.exit(); + throw e; + + } else { + // In browsers, uncaught exceptions are not fatal. + // Re-throw them asynchronously to avoid slow-downs. + setTimeout(function () { + throw e; + }, 0); } } - flushing = false; + if (domain) { + domain.exit(); + } } nextTick = function (task) { @@ -155,9 +181,16 @@ var nextTick =(function () { } }; - if (typeof process !== "undefined" && process.nextTick) { - // Node.js before 0.9. Note that some fake-Node environments, like the - // Mocha test runner, introduce a `process` global without a `nextTick`. + if (typeof process === "object" && + process.toString() === "[object process]" && process.nextTick) { + // Ensure Q is in a real Node environment, with a `process.nextTick`. + // To see through fake Node environments: + // * Mocha test runner - exposes a `process` global without a `nextTick` + // * Browserify - exposes a `process.nexTick` function that uses + // `setTimeout`. In this case `setImmediate` is preferred because + // it is faster. Browserify's `process.toString()` yields + // "[object Object]", while in a real Node environment + // `process.nextTick()` yields "[object process]". isNodeJS = true; requestTick = function () { @@ -201,7 +234,16 @@ var nextTick =(function () { setTimeout(flush, 0); }; } - + // runs a task after all other tasks have been run + // this is useful for unhandled rejection tracking that needs to happen + // after all `then`d tasks have been run. + nextTick.runAfter = function (task) { + laterQueue.push(task); + if (!flushing) { + flushing = true; + requestTick(); + } + }; return nextTick; })(); @@ -450,7 +492,7 @@ function Q(value) { // If the object is already a Promise, return it directly. This enables // the resolve function to both be used to created references from objects, // but to tolerably coerce non-promises to promises. - if (isPromise(value)) { + if (value instanceof Promise) { return value; } @@ -474,6 +516,11 @@ Q.nextTick = nextTick; */ Q.longStackSupport = false; +// enable long stacks if Q_DEBUG is set +if (typeof process === "object" && process && process.env && process.env.Q_DEBUG) { + Q.longStackSupport = true; +} + /** * Constructs a {promise, resolve, reject} object. * @@ -505,7 +552,7 @@ function defer() { progressListeners.push(operands[1]); } } else { - nextTick(function () { + Q.nextTick(function () { resolvedPromise.promiseDispatch.apply(resolvedPromise, args); }); } @@ -553,7 +600,7 @@ function defer() { promise.source = newPromise; array_reduce(messages, function (undefined, message) { - nextTick(function () { + Q.nextTick(function () { newPromise.promiseDispatch.apply(newPromise, message); }); }, void 0); @@ -591,7 +638,7 @@ function defer() { } array_reduce(progressListeners, function (undefined, progressListener) { - nextTick(function () { + Q.nextTick(function () { progressListener(progress); }); }, void 0); @@ -684,15 +731,15 @@ Promise.prototype.join = function (that) { }; /** - * Returns a promise for the first of an array of promises to become fulfilled. + * Returns a promise for the first of an array of promises to become settled. * @param answers {Array[Any*]} promises to race - * @returns {Any*} the first promise to be fulfilled + * @returns {Any*} the first promise to be settled */ Q.race = race; function race(answerPs) { - return promise(function(resolve, reject) { + return promise(function (resolve, reject) { // Switch to this once we can assume at least ES5 - // answerPs.forEach(function(answerP) { + // answerPs.forEach(function (answerP) { // Q(answerP).then(resolve, reject); // }); // Use this in the meantime @@ -806,7 +853,7 @@ Promise.prototype.then = function (fulfilled, rejected, progressed) { return typeof progressed === "function" ? progressed(value) : value; } - nextTick(function () { + Q.nextTick(function () { self.promiseDispatch(function (value) { if (done) { return; @@ -847,6 +894,30 @@ Promise.prototype.then = function (fulfilled, rejected, progressed) { return deferred.promise; }; +Q.tap = function (promise, callback) { + return Q(promise).tap(callback); +}; + +/** + * Works almost like "finally", but not called for rejections. + * Original resolution value is passed through callback unaffected. + * Callback may return a promise that will be awaited for. + * @param {Function} callback + * @returns {Q.Promise} + * @example + * doSomething() + * .then(...) + * .tap(console.log) + * .then(...); + */ +Promise.prototype.tap = function (callback) { + callback = Q(callback); + + return this.then(function (value) { + return callback.fcall(value).thenResolve(value); + }); +}; + /** * Registers an observer on a promise. * @@ -912,9 +983,7 @@ function nearer(value) { */ Q.isPromise = isPromise; function isPromise(object) { - return isObject(object) && - typeof object.promiseDispatch === "function" && - typeof object.inspect === "function"; + return object instanceof Promise; } Q.isPromiseAlike = isPromiseAlike; @@ -968,6 +1037,7 @@ Promise.prototype.isRejected = function () { // shimmed environments, this would naturally be a `Set`. var unhandledReasons = []; var unhandledRejections = []; +var reportedUnhandledRejections = []; var trackUnhandledRejections = true; function resetUnhandledRejections() { @@ -983,6 +1053,14 @@ function trackRejection(promise, reason) { if (!trackUnhandledRejections) { return; } + if (typeof process === "object" && typeof process.emit === "function") { + Q.nextTick.runAfter(function () { + if (array_indexOf(unhandledRejections, promise) !== -1) { + process.emit("unhandledRejection", reason, promise); + reportedUnhandledRejections.push(promise); + } + }); + } unhandledRejections.push(promise); if (reason && typeof reason.stack !== "undefined") { @@ -999,6 +1077,15 @@ function untrackRejection(promise) { var at = array_indexOf(unhandledRejections, promise); if (at !== -1) { + if (typeof process === "object" && typeof process.emit === "function") { + Q.nextTick.runAfter(function () { + var atReport = array_indexOf(reportedUnhandledRejections, promise); + if (atReport !== -1) { + process.emit("rejectionHandled", unhandledReasons[at], promise); + reportedUnhandledRejections.splice(atReport, 1); + } + }); + } unhandledRejections.splice(at, 1); unhandledReasons.splice(at, 1); } @@ -1092,7 +1179,7 @@ function fulfill(value) { */ function coerce(promise) { var deferred = defer(); - nextTick(function () { + Q.nextTick(function () { try { promise.then(deferred.resolve, deferred.reject, deferred.notify); } catch (exception) { @@ -1193,7 +1280,7 @@ function async(makeGenerator) { return reject(exception); } if (result.done) { - return result.value; + return Q(result.value); } else { return when(result.value, callback, errback); } @@ -1204,7 +1291,7 @@ function async(makeGenerator) { result = generator[verb](arg); } catch (exception) { if (isStopIteration(exception)) { - return exception.value; + return Q(exception.value); } else { return reject(exception); } @@ -1300,7 +1387,7 @@ function dispatch(object, op, args) { Promise.prototype.dispatch = function (op, args) { var self = this; var deferred = defer(); - nextTick(function () { + Q.nextTick(function () { self.promiseDispatch(deferred.resolve, op, args); }); return deferred.promise; @@ -1473,7 +1560,7 @@ Promise.prototype.keys = function () { Q.all = all; function all(promises) { return when(promises, function (promises) { - var countDown = 0; + var pendingCount = 0; var deferred = defer(); array_reduce(promises, function (undefined, promise, index) { var snapshot; @@ -1483,12 +1570,12 @@ function all(promises) { ) { promises[index] = snapshot.value; } else { - ++countDown; + ++pendingCount; when( promise, function (value) { promises[index] = value; - if (--countDown === 0) { + if (--pendingCount === 0) { deferred.resolve(promises); } }, @@ -1499,7 +1586,7 @@ function all(promises) { ); } }, void 0); - if (countDown === 0) { + if (pendingCount === 0) { deferred.resolve(promises); } return deferred.promise; @@ -1511,6 +1598,55 @@ Promise.prototype.all = function () { }; /** + * Returns the first resolved promise of an array. Prior rejected promises are + * ignored. Rejects only if all promises are rejected. + * @param {Array*} an array containing values or promises for values + * @returns a promise fulfilled with the value of the first resolved promise, + * or a rejected promise if all promises are rejected. + */ +Q.any = any; + +function any(promises) { + if (promises.length === 0) { + return Q.resolve(); + } + + var deferred = Q.defer(); + var pendingCount = 0; + array_reduce(promises, function (prev, current, index) { + var promise = promises[index]; + + pendingCount++; + + when(promise, onFulfilled, onRejected, onProgress); + function onFulfilled(result) { + deferred.resolve(result); + } + function onRejected() { + pendingCount--; + if (pendingCount === 0) { + deferred.reject(new Error( + "Can't get fulfillment value from any promise, all " + + "promises were rejected." + )); + } + } + function onProgress(progress) { + deferred.notify({ + index: index, + value: progress + }); + } + }, undefined); + + return deferred.promise; +} + +Promise.prototype.any = function () { + return any(this); +}; + +/** * Waits for all promises to be settled, either fulfilled or * rejected. This is distinct from `all` since that would stop * waiting at the first rejection. The promise returned by @@ -1643,7 +1779,7 @@ Promise.prototype.done = function (fulfilled, rejected, progress) { var onUnhandledError = function (error) { // forward to a future turn so that ``when`` // does not catch it and turn it into a rejection. - nextTick(function () { + Q.nextTick(function () { makeStackTraceLong(error, promise); if (Q.onerror) { Q.onerror(error); @@ -1670,18 +1806,22 @@ Promise.prototype.done = function (fulfilled, rejected, progress) { * some milliseconds time out. * @param {Any*} promise * @param {Number} milliseconds timeout - * @param {String} custom error message (optional) + * @param {Any*} custom error message or Error object (optional) * @returns a promise for the resolution of the given promise if it is * fulfilled before the timeout, otherwise rejected. */ -Q.timeout = function (object, ms, message) { - return Q(object).timeout(ms, message); +Q.timeout = function (object, ms, error) { + return Q(object).timeout(ms, error); }; -Promise.prototype.timeout = function (ms, message) { +Promise.prototype.timeout = function (ms, error) { var deferred = defer(); var timeoutId = setTimeout(function () { - deferred.reject(new Error(message || "Timed out after " + ms + " ms")); + if (!error || "string" === typeof error) { + error = new Error(error || "Timed out after " + ms + " ms"); + error.code = "ETIMEDOUT"; + } + deferred.reject(error); }, ms); this.then(function (value) { @@ -1883,11 +2023,11 @@ function nodeify(object, nodeback) { Promise.prototype.nodeify = function (nodeback) { if (nodeback) { this.then(function (value) { - nextTick(function () { + Q.nextTick(function () { nodeback(null, value); }); }, function (error) { - nextTick(function () { + Q.nextTick(function () { nodeback(error); }); }); @@ -1896,6 +2036,10 @@ Promise.prototype.nodeify = function (nodeback) { } }; +Q.noConflict = function() { + throw new Error("Q.noConflict only works when Q is used as a global"); +}; + // All code before this point will be filtered from stack traces. var qEndingLine = captureLine(); diff --git a/StoneIsland/platforms/ios/cordova/node_modules/shelljs/package.json b/StoneIsland/platforms/ios/cordova/node_modules/shelljs/package.json index 674a1ffb..9827ccbc 100755 --- a/StoneIsland/platforms/ios/cordova/node_modules/shelljs/package.json +++ b/StoneIsland/platforms/ios/cordova/node_modules/shelljs/package.json @@ -1,11 +1,29 @@ { - "name": "shelljs", - "version": "0.1.4", "author": { "name": "Artur Adib", - "email": "aadib@mozilla.com" + "email": "arturadib@gmail.com" }, + "bin": { + "shjs": "./bin/shjs" + }, + "bugs": { + "url": "https://github.com/arturadib/shelljs/issues" + }, + "dependencies": {}, "description": "Portable Unix shell commands for Node.js", + "devDependencies": { + "jshint": "~2.1.11" + }, + "directories": {}, + "dist": { + "shasum": "c54982b996c76ef0c1e6b59fbdc5825f5b713113", + "tarball": "https://registry.npmjs.org/shelljs/-/shelljs-0.5.3.tgz" + }, + "engines": { + "node": ">=0.8.0" + }, + "gitHead": "22d0975040b9b8234755dc6e692d6869436e8485", + "homepage": "http://github.com/arturadib/shelljs", "keywords": [ "unix", "shell", @@ -14,35 +32,23 @@ "jake", "synchronous" ], + "license": "BSD*", + "main": "./shell.js", + "maintainers": [ + { + "name": "artur", + "email": "arturadib@gmail.com" + } + ], + "name": "shelljs", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", "repository": { "type": "git", "url": "git://github.com/arturadib/shelljs.git" }, - "homepage": "http://github.com/arturadib/shelljs", - "main": "./shell.js", "scripts": { "test": "node scripts/run-tests" }, - "bin": { - "shjs": "./bin/shjs" - }, - "dependencies": {}, - "devDependencies": { - "jshint": "~1.1.0" - }, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "readme": "# ShellJS - Unix shell commands for Node.js [](http://travis-ci.org/arturadib/shelljs)\n\nShellJS is a portable **(Windows/Linux/OS X)** implementation of Unix shell commands on top of the Node.js API. You can use it to eliminate your shell script's dependency on Unix while still keeping its familiar and powerful commands. You can also install it globally so you can run it from outside Node projects - say goodbye to those gnarly Bash scripts!\n\nThe project is [unit-tested](http://travis-ci.org/arturadib/shelljs) and battled-tested in projects like:\n\n+ [PDF.js](http://github.com/mozilla/pdf.js) - Firefox's next-gen PDF reader\n+ [Firebug](http://getfirebug.com/) - Firefox's infamous debugger\n+ [JSHint](http://jshint.com) - Most popular JavaScript linter\n+ [Zepto](http://zeptojs.com) - jQuery-compatible JavaScript library for modern browsers\n+ [Yeoman](http://yeoman.io/) - Web application stack and development tool\n+ [Deployd.com](http://deployd.com) - Open source PaaS for quick API backend generation\n\nand [many more](https://npmjs.org/browse/depended/shelljs).\n\n## Installing\n\nVia npm:\n\n```bash\n$ npm install [-g] shelljs\n```\n\nIf the global option `-g` is specified, the binary `shjs` will be installed. This makes it possible to\nrun ShellJS scripts much like any shell script from the command line, i.e. without requiring a `node_modules` folder:\n\n```bash\n$ shjs my_script\n```\n\nYou can also just copy `shell.js` into your project's directory, and `require()` accordingly.\n\n\n## Examples\n\n### JavaScript\n\n```javascript\nrequire('shelljs/global');\n\nif (!which('git')) {\n echo('Sorry, this script requires git');\n exit(1);\n}\n\n// Copy files to release dir\nmkdir('-p', 'out/Release');\ncp('-R', 'stuff/*', 'out/Release');\n\n// Replace macros in each .js file\ncd('lib');\nls('*.js').forEach(function(file) {\n sed('-i', 'BUILD_VERSION', 'v0.1.2', file);\n sed('-i', /.*REMOVE_THIS_LINE.*\\n/, '', file);\n sed('-i', /.*REPLACE_LINE_WITH_MACRO.*\\n/, cat('macro.js'), file);\n});\ncd('..');\n\n// Run external tool synchronously\nif (exec('git commit -am \"Auto-commit\"').code !== 0) {\n echo('Error: Git commit failed');\n exit(1);\n}\n```\n\n### CoffeeScript\n\n```coffeescript\nrequire 'shelljs/global'\n\nif not which 'git'\n echo 'Sorry, this script requires git'\n exit 1\n\n# Copy files to release dir\nmkdir '-p', 'out/Release'\ncp '-R', 'stuff/*', 'out/Release'\n\n# Replace macros in each .js file\ncd 'lib'\nfor file in ls '*.js'\n sed '-i', 'BUILD_VERSION', 'v0.1.2', file\n sed '-i', /.*REMOVE_THIS_LINE.*\\n/, '', file\n sed '-i', /.*REPLACE_LINE_WITH_MACRO.*\\n/, cat 'macro.js', file\ncd '..'\n\n# Run external tool synchronously\nif (exec 'git commit -am \"Auto-commit\"').code != 0\n echo 'Error: Git commit failed'\n exit 1\n```\n\n## Global vs. Local\n\nThe example above uses the convenience script `shelljs/global` to reduce verbosity. If polluting your global namespace is not desirable, simply require `shelljs`.\n\nExample:\n\n```javascript\nvar shell = require('shelljs');\nshell.echo('hello world');\n```\n\n## Make tool\n\nA convenience script `shelljs/make` is also provided to mimic the behavior of a Unix Makefile. In this case all shell objects are global, and command line arguments will cause the script to execute only the corresponding function in the global `target` object. To avoid redundant calls, target functions are executed only once per script.\n\nExample (CoffeeScript):\n\n```coffeescript\nrequire 'shelljs/make'\n\ntarget.all = ->\n target.bundle()\n target.docs()\n\ntarget.bundle = ->\n cd __dirname\n mkdir 'build'\n cd 'lib'\n (cat '*.js').to '../build/output.js'\n\ntarget.docs = ->\n cd __dirname\n mkdir 'docs'\n cd 'lib'\n for file in ls '*.js'\n text = grep '//@', file # extract special comments\n text.replace '//@', '' # remove comment tags\n text.to 'docs/my_docs.md'\n```\n\nTo run the target `all`, call the above script without arguments: `$ node make`. To run the target `docs`: `$ node make docs`, and so on.\n\n\n\n<!-- \n\n DO NOT MODIFY BEYOND THIS POINT - IT'S AUTOMATICALLY GENERATED\n\n-->\n\n\n## Command reference\n\n\nAll commands run synchronously, unless otherwise stated.\n\n\n### cd('dir')\nChanges to directory `dir` for the duration of the script\n\n### pwd()\nReturns the current directory.\n\n### ls([options ,] path [,path ...])\n### ls([options ,] path_array)\nAvailable options:\n\n+ `-R`: recursive\n+ `-A`: all files (include files beginning with `.`, except for `.` and `..`)\n\nExamples:\n\n```javascript\nls('projs/*.js');\nls('-R', '/users/me', '/tmp');\nls('-R', ['/users/me', '/tmp']); // same as above\n```\n\nReturns array of files in the given path, or in current directory if no path provided.\n\n### find(path [,path ...])\n### find(path_array)\nExamples:\n\n```javascript\nfind('src', 'lib');\nfind(['src', 'lib']); // same as above\nfind('.').filter(function(file) { return file.match(/\\.js$/); });\n```\n\nReturns array of all files (however deep) in the given paths.\n\nThe main difference from `ls('-R', path)` is that the resulting file names\ninclude the base directories, e.g. `lib/resources/file1` instead of just `file1`.\n\n### cp([options ,] source [,source ...], dest)\n### cp([options ,] source_array, dest)\nAvailable options:\n\n+ `-f`: force\n+ `-r, -R`: recursive\n\nExamples:\n\n```javascript\ncp('file1', 'dir1');\ncp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');\ncp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above\n```\n\nCopies files. The wildcard `*` is accepted.\n\n### rm([options ,] file [, file ...])\n### rm([options ,] file_array)\nAvailable options:\n\n+ `-f`: force\n+ `-r, -R`: recursive\n\nExamples:\n\n```javascript\nrm('-rf', '/tmp/*');\nrm('some_file.txt', 'another_file.txt');\nrm(['some_file.txt', 'another_file.txt']); // same as above\n```\n\nRemoves files. The wildcard `*` is accepted.\n\n### mv(source [, source ...], dest')\n### mv(source_array, dest')\nAvailable options:\n\n+ `f`: force\n\nExamples:\n\n```javascript\nmv('-f', 'file', 'dir/');\nmv('file1', 'file2', 'dir/');\nmv(['file1', 'file2'], 'dir/'); // same as above\n```\n\nMoves files. The wildcard `*` is accepted.\n\n### mkdir([options ,] dir [, dir ...])\n### mkdir([options ,] dir_array)\nAvailable options:\n\n+ `p`: full path (will create intermediate dirs if necessary)\n\nExamples:\n\n```javascript\nmkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g');\nmkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above\n```\n\nCreates directories.\n\n### test(expression)\nAvailable expression primaries:\n\n+ `'-b', 'path'`: true if path is a block device\n+ `'-c', 'path'`: true if path is a character device\n+ `'-d', 'path'`: true if path is a directory\n+ `'-e', 'path'`: true if path exists\n+ `'-f', 'path'`: true if path is a regular file\n+ `'-L', 'path'`: true if path is a symbolic link\n+ `'-p', 'path'`: true if path is a pipe (FIFO)\n+ `'-S', 'path'`: true if path is a socket\n\nExamples:\n\n```javascript\nif (test('-d', path)) { /* do something with dir */ };\nif (!test('-f', path)) continue; // skip if it's a regular file\n```\n\nEvaluates expression using the available primaries and returns corresponding value.\n\n### cat(file [, file ...])\n### cat(file_array)\n\nExamples:\n\n```javascript\nvar str = cat('file*.txt');\nvar str = cat('file1', 'file2');\nvar str = cat(['file1', 'file2']); // same as above\n```\n\nReturns a string containing the given file, or a concatenated string\ncontaining the files if more than one file is given (a new line character is\nintroduced between each file). Wildcard `*` accepted.\n\n### 'string'.to(file)\n\nExamples:\n\n```javascript\ncat('input.txt').to('output.txt');\n```\n\nAnalogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as\nthose returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_\n\n### sed([options ,] search_regex, replace_str, file)\nAvailable options:\n\n+ `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_\n\nExamples:\n\n```javascript\nsed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');\nsed(/.*DELETE_THIS_LINE.*\\n/, '', 'source.js');\n```\n\nReads an input string from `file` and performs a JavaScript `replace()` on the input\nusing the given search regex and replacement string. Returns the new string after replacement.\n\n### grep([options ,] regex_filter, file [, file ...])\n### grep([options ,] regex_filter, file_array)\nAvailable options:\n\n+ `-v`: Inverse the sense of the regex and print the lines not matching the criteria.\n\nExamples:\n\n```javascript\ngrep('-v', 'GLOBAL_VARIABLE', '*.js');\ngrep('GLOBAL_VARIABLE', '*.js');\n```\n\nReads input string from given files and returns a string containing all lines of the\nfile that match the given `regex_filter`. Wildcard `*` accepted.\n\n### which(command)\n\nExamples:\n\n```javascript\nvar nodeExec = which('node');\n```\n\nSearches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions.\nReturns string containing the absolute path to the command.\n\n### echo(string [,string ...])\n\nExamples:\n\n```javascript\necho('hello world');\nvar str = echo('hello world');\n```\n\nPrints string to stdout, and returns string with additional utility methods\nlike `.to()`.\n\n### dirs([options | '+N' | '-N'])\n\nAvailable options:\n\n+ `-c`: Clears the directory stack by deleting all of the elements.\n\nArguments:\n\n+ `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.\n+ `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.\n\nDisplay the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.\n\nSee also: pushd, popd\n\n### pushd([options,] [dir | '-N' | '+N'])\n\nAvailable options:\n\n+ `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.\n\nArguments:\n\n+ `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`.\n+ `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.\n+ `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.\n\nExamples:\n\n```javascript\n// process.cwd() === '/usr'\npushd('/etc'); // Returns /etc /usr\npushd('+1'); // Returns /usr /etc\n```\n\nSave the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.\n\n### popd([options,] ['-N' | '+N'])\n\nAvailable options:\n\n+ `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.\n\nArguments:\n\n+ `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.\n+ `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.\n\nExamples:\n\n```javascript\necho(process.cwd()); // '/usr'\npushd('/etc'); // '/etc /usr'\necho(process.cwd()); // '/etc'\npopd(); // '/usr'\necho(process.cwd()); // '/usr'\n```\n\nWhen no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.\n\n### exit(code)\nExits the current process with the given exit code.\n\n### env['VAR_NAME']\nObject containing environment variables (both getter and setter). Shortcut to process.env.\n\n### exec(command [, options] [, callback])\nAvailable options (all `false` by default):\n\n+ `async`: Asynchronous execution. Defaults to true if a callback is provided.\n+ `silent`: Do not echo program output to console.\n\nExamples:\n\n```javascript\nvar version = exec('node --version', {silent:true}).output;\n\nvar child = exec('some_long_running_process', {async:true});\nchild.stdout.on('data', function(data) {\n /* ... do something with data ... */\n});\n\nexec('some_long_running_process', function(code, output) {\n console.log('Exit code:', code);\n console.log('Program output:', output);\n});\n```\n\nExecutes the given `command` _synchronously_, unless otherwise specified.\nWhen in synchronous mode returns the object `{ code:..., output:... }`, containing the program's\n`output` (stdout + stderr) and its exit `code`. Otherwise returns the child process object, and\nthe `callback` gets the arguments `(code, output)`.\n\n**Note:** For long-lived processes, it's best to run `exec()` asynchronously as\nthe current synchronous implementation uses a lot of CPU. This should be getting\nfixed soon.\n\n### chmod(octal_mode || octal_string, file)\n### chmod(symbolic_mode, file)\n\nAvailable options:\n\n+ `-v`: output a diagnostic for every file processed\n+ `-c`: like verbose but report only when a change is made\n+ `-R`: change files and directories recursively\n\nExamples:\n\n```javascript\nchmod(755, '/Users/brandon');\nchmod('755', '/Users/brandon'); // same as above \nchmod('u+x', '/Users/brandon');\n```\n\nAlters the permissions of a file or directory by either specifying the\nabsolute permissions in octal form or expressing the changes in symbols.\nThis command tries to mimic the POSIX behavior as much as possible.\nNotable exceptions:\n\n+ In symbolic modes, 'a-r' and '-r' are identical. No consideration is\n given to the umask.\n+ There is no \"quiet\" option since default behavior is to run silent.\n\n## Configuration\n\n\n### config.silent\nExample:\n\n```javascript\nvar silentState = config.silent; // save old silent state\nconfig.silent = true;\n/* ... */\nconfig.silent = silentState; // restore old silent state\n```\n\nSuppresses all command output if `true`, except for `echo()` calls.\nDefault is `false`.\n\n### config.fatal\nExample:\n\n```javascript\nconfig.fatal = true;\ncp('this_file_does_not_exist', '/dev/null'); // dies here\n/* more commands... */\n```\n\nIf `true` the script will die on errors. Default is `false`.\n\n## Non-Unix commands\n\n\n### tempdir()\nSearches and returns string containing a writeable, platform-dependent temporary directory.\nFollows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).\n\n### error()\nTests if error occurred in the last command. Returns `null` if no error occurred,\notherwise returns string explaining the error\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/arturadib/shelljs/issues" - }, - "_id": "shelljs@0.1.4", - "dist": { - "shasum": "7a8aeaa3dc3c0be2e59d83168e83b4c4bc4dac95" - }, - "_from": "shelljs@0.1.4", - "_resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.1.4.tgz" -} + "version": "0.5.3" +}
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/cordova/node_modules/shelljs/shell.js b/StoneIsland/platforms/ios/cordova/node_modules/shelljs/shell.js index 4190aa34..bdeb5597 100755 --- a/StoneIsland/platforms/ios/cordova/node_modules/shelljs/shell.js +++ b/StoneIsland/platforms/ios/cordova/node_modules/shelljs/shell.js @@ -6,1062 +6,88 @@ // http://github.com/arturadib/shelljs // -var fs = require('fs'), - path = require('path'), - util = require('util'), - vm = require('vm'), - child = require('child_process'), - os = require('os'); - -// Node shims for < v0.7 -fs.existsSync = fs.existsSync || path.existsSync; - -var config = { - silent: false, - fatal: false -}; - -var state = { - error: null, - currentCmd: 'shell.js', - tempDir: null - }, - platform = os.type().match(/^Win/) ? 'win' : 'unix'; +var common = require('./src/common'); //@ //@ All commands run synchronously, unless otherwise stated. //@ +//@include ./src/cd +var _cd = require('./src/cd'); +exports.cd = common.wrap('cd', _cd); -//@ -//@ ### cd('dir') -//@ Changes to directory `dir` for the duration of the script -function _cd(options, dir) { - if (!dir) - error('directory not specified'); - - if (!fs.existsSync(dir)) - error('no such file or directory: ' + dir); - - if (!fs.statSync(dir).isDirectory()) - error('not a directory: ' + dir); - - process.chdir(dir); -} -exports.cd = wrap('cd', _cd); - -//@ -//@ ### pwd() -//@ Returns the current directory. -function _pwd(options) { - var pwd = path.resolve(process.cwd()); - return ShellString(pwd); -} -exports.pwd = wrap('pwd', _pwd); - - -//@ -//@ ### ls([options ,] path [,path ...]) -//@ ### ls([options ,] path_array) -//@ Available options: -//@ -//@ + `-R`: recursive -//@ + `-A`: all files (include files beginning with `.`, except for `.` and `..`) -//@ -//@ Examples: -//@ -//@ ```javascript -//@ ls('projs/*.js'); -//@ ls('-R', '/users/me', '/tmp'); -//@ ls('-R', ['/users/me', '/tmp']); // same as above -//@ ``` -//@ -//@ Returns array of files in the given path, or in current directory if no path provided. -function _ls(options, paths) { - options = parseOptions(options, { - 'R': 'recursive', - 'A': 'all', - 'a': 'all_deprecated' - }); - - if (options.all_deprecated) { - // We won't support the -a option as it's hard to image why it's useful - // (it includes '.' and '..' in addition to '.*' files) - // For backwards compatibility we'll dump a deprecated message and proceed as before - log('ls: Option -a is deprecated. Use -A instead'); - options.all = true; - } - - if (!paths) - paths = ['.']; - else if (typeof paths === 'object') - paths = paths; // assume array - else if (typeof paths === 'string') - paths = [].slice.call(arguments, 1); - - var list = []; - - // Conditionally pushes file to list - returns true if pushed, false otherwise - // (e.g. prevents hidden files to be included unless explicitly told so) - function pushFile(file, query) { - // hidden file? - if (path.basename(file)[0] === '.') { - // not explicitly asking for hidden files? - if (!options.all && !(path.basename(query)[0] === '.' && path.basename(query).length > 1)) - return false; - } - - if (platform === 'win') - file = file.replace(/\\/g, '/'); - - list.push(file); - return true; - } - - paths.forEach(function(p) { - if (fs.existsSync(p)) { - var stats = fs.statSync(p); - // Simple file? - if (stats.isFile()) { - pushFile(p, p); - return; // continue - } - - // Simple dir? - if (stats.isDirectory()) { - // Iterate over p contents - fs.readdirSync(p).forEach(function(file) { - if (!pushFile(file, p)) - return; - - // Recursive? - if (options.recursive) { - var oldDir = _pwd(); - _cd('', p); - if (fs.statSync(file).isDirectory()) - list = list.concat(_ls('-R'+(options.all?'A':''), file+'/*')); - _cd('', oldDir); - } - }); - return; // continue - } - } - - // p does not exist - possible wildcard present - - var basename = path.basename(p); - var dirname = path.dirname(p); - // Wildcard present on an existing dir? (e.g. '/tmp/*.js') - if (basename.search(/\*/) > -1 && fs.existsSync(dirname) && fs.statSync(dirname).isDirectory) { - // Escape special regular expression chars - var regexp = basename.replace(/(\^|\$|\(|\)|<|>|\[|\]|\{|\}|\.|\+|\?)/g, '\\$1'); - // Translates wildcard into regex - regexp = '^' + regexp.replace(/\*/g, '.*') + '$'; - // Iterate over directory contents - fs.readdirSync(dirname).forEach(function(file) { - if (file.match(new RegExp(regexp))) { - if (!pushFile(path.normalize(dirname+'/'+file), basename)) - return; - - // Recursive? - if (options.recursive) { - var pp = dirname + '/' + file; - if (fs.lstatSync(pp).isDirectory()) - list = list.concat(_ls('-R'+(options.all?'A':''), pp+'/*')); - } // recursive - } // if file matches - }); // forEach - return; - } - - error('no such file or directory: ' + p, true); - }); - - return list; -} -exports.ls = wrap('ls', _ls); - - -//@ -//@ ### find(path [,path ...]) -//@ ### find(path_array) -//@ Examples: -//@ -//@ ```javascript -//@ find('src', 'lib'); -//@ find(['src', 'lib']); // same as above -//@ find('.').filter(function(file) { return file.match(/\.js$/); }); -//@ ``` -//@ -//@ Returns array of all files (however deep) in the given paths. -//@ -//@ The main difference from `ls('-R', path)` is that the resulting file names -//@ include the base directories, e.g. `lib/resources/file1` instead of just `file1`. -function _find(options, paths) { - if (!paths) - error('no path specified'); - else if (typeof paths === 'object') - paths = paths; // assume array - else if (typeof paths === 'string') - paths = [].slice.call(arguments, 1); - - var list = []; - - function pushFile(file) { - if (platform === 'win') - file = file.replace(/\\/g, '/'); - list.push(file); - } - - // why not simply do ls('-R', paths)? because the output wouldn't give the base dirs - // to get the base dir in the output, we need instead ls('-R', 'dir/*') for every directory - - paths.forEach(function(file) { - pushFile(file); - - if (fs.statSync(file).isDirectory()) { - _ls('-RA', file+'/*').forEach(function(subfile) { - pushFile(subfile); - }); - } - }); - - return list; -} -exports.find = wrap('find', _find); - - -//@ -//@ ### cp([options ,] source [,source ...], dest) -//@ ### cp([options ,] source_array, dest) -//@ Available options: -//@ -//@ + `-f`: force -//@ + `-r, -R`: recursive -//@ -//@ Examples: -//@ -//@ ```javascript -//@ cp('file1', 'dir1'); -//@ cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp'); -//@ cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above -//@ ``` -//@ -//@ Copies files. The wildcard `*` is accepted. -function _cp(options, sources, dest) { - options = parseOptions(options, { - 'f': 'force', - 'R': 'recursive', - 'r': 'recursive' - }); - - // Get sources, dest - if (arguments.length < 3) { - error('missing <source> and/or <dest>'); - } else if (arguments.length > 3) { - sources = [].slice.call(arguments, 1, arguments.length - 1); - dest = arguments[arguments.length - 1]; - } else if (typeof sources === 'string') { - sources = [sources]; - } else if ('length' in sources) { - sources = sources; // no-op for array - } else { - error('invalid arguments'); - } - - var exists = fs.existsSync(dest), - stats = exists && fs.statSync(dest); - - // Dest is not existing dir, but multiple sources given - if ((!exists || !stats.isDirectory()) && sources.length > 1) - error('dest is not a directory (too many sources)'); - - // Dest is an existing file, but no -f given - if (exists && stats.isFile() && !options.force) - error('dest file already exists: ' + dest); - - if (options.recursive) { - // Recursive allows the shortcut syntax "sourcedir/" for "sourcedir/*" - // (see Github issue #15) - sources.forEach(function(src, i) { - if (src[src.length - 1] === '/') - sources[i] += '*'; - }); - - // Create dest - try { - fs.mkdirSync(dest, parseInt('0777', 8)); - } catch (e) { - // like Unix's cp, keep going even if we can't create dest dir - } - } - - sources = expand(sources); - - sources.forEach(function(src) { - if (!fs.existsSync(src)) { - error('no such file or directory: '+src, true); - return; // skip file - } - - // If here, src exists - if (fs.statSync(src).isDirectory()) { - if (!options.recursive) { - // Non-Recursive - log(src + ' is a directory (not copied)'); - } else { - // Recursive - // 'cp /a/source dest' should create 'source' in 'dest' - var newDest = path.join(dest, path.basename(src)), - checkDir = fs.statSync(src); - try { - fs.mkdirSync(newDest, checkDir.mode); - } catch (e) { - //if the directory already exists, that's okay - if (e.code !== 'EEXIST') throw e; - } - - cpdirSyncRecursive(src, newDest, {force: options.force}); - } - return; // done with dir - } - - // If here, src is a file - - // When copying to '/path/dir': - // thisDest = '/path/dir/file1' - var thisDest = dest; - if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) - thisDest = path.normalize(dest + '/' + path.basename(src)); - - if (fs.existsSync(thisDest) && !options.force) { - error('dest file already exists: ' + thisDest, true); - return; // skip file - } - - copyFileSync(src, thisDest); - }); // forEach(src) -} -exports.cp = wrap('cp', _cp); - -//@ -//@ ### rm([options ,] file [, file ...]) -//@ ### rm([options ,] file_array) -//@ Available options: -//@ -//@ + `-f`: force -//@ + `-r, -R`: recursive -//@ -//@ Examples: -//@ -//@ ```javascript -//@ rm('-rf', '/tmp/*'); -//@ rm('some_file.txt', 'another_file.txt'); -//@ rm(['some_file.txt', 'another_file.txt']); // same as above -//@ ``` -//@ -//@ Removes files. The wildcard `*` is accepted. -function _rm(options, files) { - options = parseOptions(options, { - 'f': 'force', - 'r': 'recursive', - 'R': 'recursive' - }); - if (!files) - error('no paths given'); - - if (typeof files === 'string') - files = [].slice.call(arguments, 1); - // if it's array leave it as it is - - files = expand(files); - - files.forEach(function(file) { - if (!fs.existsSync(file)) { - // Path does not exist, no force flag given - if (!options.force) - error('no such file or directory: '+file, true); - - return; // skip file - } - - // If here, path exists - - var stats = fs.statSync(file); - // Remove simple file - if (stats.isFile()) { - - // Do not check for file writing permissions - if (options.force) { - _unlinkSync(file); - return; - } - - if (isWriteable(file)) - _unlinkSync(file); - else - error('permission denied: '+file, true); - - return; - } // simple file - - // Path is an existing directory, but no -r flag given - if (stats.isDirectory() && !options.recursive) { - error('path is a directory', true); - return; // skip path - } - - // Recursively remove existing directory - if (stats.isDirectory() && options.recursive) { - rmdirSyncRecursive(file, options.force); - } - }); // forEach(file) -} // rm -exports.rm = wrap('rm', _rm); - -//@ -//@ ### mv(source [, source ...], dest') -//@ ### mv(source_array, dest') -//@ Available options: -//@ -//@ + `f`: force -//@ -//@ Examples: -//@ -//@ ```javascript -//@ mv('-f', 'file', 'dir/'); -//@ mv('file1', 'file2', 'dir/'); -//@ mv(['file1', 'file2'], 'dir/'); // same as above -//@ ``` -//@ -//@ Moves files. The wildcard `*` is accepted. -function _mv(options, sources, dest) { - options = parseOptions(options, { - 'f': 'force' - }); - - // Get sources, dest - if (arguments.length < 3) { - error('missing <source> and/or <dest>'); - } else if (arguments.length > 3) { - sources = [].slice.call(arguments, 1, arguments.length - 1); - dest = arguments[arguments.length - 1]; - } else if (typeof sources === 'string') { - sources = [sources]; - } else if ('length' in sources) { - sources = sources; // no-op for array - } else { - error('invalid arguments'); - } - - sources = expand(sources); - - var exists = fs.existsSync(dest), - stats = exists && fs.statSync(dest); - - // Dest is not existing dir, but multiple sources given - if ((!exists || !stats.isDirectory()) && sources.length > 1) - error('dest is not a directory (too many sources)'); - - // Dest is an existing file, but no -f given - if (exists && stats.isFile() && !options.force) - error('dest file already exists: ' + dest); - - sources.forEach(function(src) { - if (!fs.existsSync(src)) { - error('no such file or directory: '+src, true); - return; // skip file - } - - // If here, src exists - - // When copying to '/path/dir': - // thisDest = '/path/dir/file1' - var thisDest = dest; - if (fs.existsSync(dest) && fs.statSync(dest).isDirectory()) - thisDest = path.normalize(dest + '/' + path.basename(src)); - - if (fs.existsSync(thisDest) && !options.force) { - error('dest file already exists: ' + thisDest, true); - return; // skip file - } - - if (path.resolve(src) === path.dirname(path.resolve(thisDest))) { - error('cannot move to self: '+src, true); - return; // skip file - } - - fs.renameSync(src, thisDest); - }); // forEach(src) -} // mv -exports.mv = wrap('mv', _mv); - -//@ -//@ ### mkdir([options ,] dir [, dir ...]) -//@ ### mkdir([options ,] dir_array) -//@ Available options: -//@ -//@ + `p`: full path (will create intermediate dirs if necessary) -//@ -//@ Examples: -//@ -//@ ```javascript -//@ mkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g'); -//@ mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above -//@ ``` -//@ -//@ Creates directories. -function _mkdir(options, dirs) { - options = parseOptions(options, { - 'p': 'fullpath' - }); - if (!dirs) - error('no paths given'); - - if (typeof dirs === 'string') - dirs = [].slice.call(arguments, 1); - // if it's array leave it as it is - - dirs.forEach(function(dir) { - if (fs.existsSync(dir)) { - if (!options.fullpath) - error('path already exists: ' + dir, true); - return; // skip dir - } - - // Base dir does not exist, and no -p option given - var baseDir = path.dirname(dir); - if (!fs.existsSync(baseDir) && !options.fullpath) { - error('no such file or directory: ' + baseDir, true); - return; // skip dir - } - - if (options.fullpath) - mkdirSyncRecursive(dir); - else - fs.mkdirSync(dir, parseInt('0777', 8)); - }); -} // mkdir -exports.mkdir = wrap('mkdir', _mkdir); - -//@ -//@ ### test(expression) -//@ Available expression primaries: -//@ -//@ + `'-b', 'path'`: true if path is a block device -//@ + `'-c', 'path'`: true if path is a character device -//@ + `'-d', 'path'`: true if path is a directory -//@ + `'-e', 'path'`: true if path exists -//@ + `'-f', 'path'`: true if path is a regular file -//@ + `'-L', 'path'`: true if path is a symbolic link -//@ + `'-p', 'path'`: true if path is a pipe (FIFO) -//@ + `'-S', 'path'`: true if path is a socket -//@ -//@ Examples: -//@ -//@ ```javascript -//@ if (test('-d', path)) { /* do something with dir */ }; -//@ if (!test('-f', path)) continue; // skip if it's a regular file -//@ ``` -//@ -//@ Evaluates expression using the available primaries and returns corresponding value. -function _test(options, path) { - if (!path) - error('no path given'); - - // hack - only works with unary primaries - options = parseOptions(options, { - 'b': 'block', - 'c': 'character', - 'd': 'directory', - 'e': 'exists', - 'f': 'file', - 'L': 'link', - 'p': 'pipe', - 'S': 'socket' - }); - - var canInterpret = false; - for (var key in options) - if (options[key] === true) { - canInterpret = true; - break; - } - - if (!canInterpret) - error('could not interpret expression'); - - if (options.link) { - try { - return fs.lstatSync(path).isSymbolicLink(); - } catch(e) { - return false; - } - } - - if (!fs.existsSync(path)) - return false; - - if (options.exists) - return true; - - var stats = fs.statSync(path); - - if (options.block) - return stats.isBlockDevice(); - - if (options.character) - return stats.isCharacterDevice(); - - if (options.directory) - return stats.isDirectory(); - - if (options.file) - return stats.isFile(); - - if (options.pipe) - return stats.isFIFO(); - - if (options.socket) - return stats.isSocket(); -} // test -exports.test = wrap('test', _test); - - -//@ -//@ ### cat(file [, file ...]) -//@ ### cat(file_array) -//@ -//@ Examples: -//@ -//@ ```javascript -//@ var str = cat('file*.txt'); -//@ var str = cat('file1', 'file2'); -//@ var str = cat(['file1', 'file2']); // same as above -//@ ``` -//@ -//@ Returns a string containing the given file, or a concatenated string -//@ containing the files if more than one file is given (a new line character is -//@ introduced between each file). Wildcard `*` accepted. -function _cat(options, files) { - var cat = ''; - - if (!files) - error('no paths given'); - - if (typeof files === 'string') - files = [].slice.call(arguments, 1); - // if it's array leave it as it is - - files = expand(files); - - files.forEach(function(file) { - if (!fs.existsSync(file)) - error('no such file or directory: ' + file); - - cat += fs.readFileSync(file, 'utf8') + '\n'; - }); - - if (cat[cat.length-1] === '\n') - cat = cat.substring(0, cat.length-1); - - return ShellString(cat); -} -exports.cat = wrap('cat', _cat); - -//@ -//@ ### 'string'.to(file) -//@ -//@ Examples: -//@ -//@ ```javascript -//@ cat('input.txt').to('output.txt'); -//@ ``` -//@ -//@ Analogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as -//@ those returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_ -function _to(options, file) { - if (!file) - error('wrong arguments'); - - if (!fs.existsSync( path.dirname(file) )) - error('no such file or directory: ' + path.dirname(file)); - - try { - fs.writeFileSync(file, this.toString(), 'utf8'); - } catch(e) { - error('could not write to file (code '+e.code+'): '+file, true); - } -} -// In the future, when Proxies are default, we can add methods like `.to()` to primitive strings. -// For now, this is a dummy function to bookmark places we need such strings -function ShellString(str) { - return str; -} -String.prototype.to = wrap('to', _to); - -//@ -//@ ### sed([options ,] search_regex, replace_str, file) -//@ Available options: -//@ -//@ + `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_ -//@ -//@ Examples: -//@ -//@ ```javascript -//@ sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js'); -//@ sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js'); -//@ ``` -//@ -//@ Reads an input string from `file` and performs a JavaScript `replace()` on the input -//@ using the given search regex and replacement string. Returns the new string after replacement. -function _sed(options, regex, replacement, file) { - options = parseOptions(options, { - 'i': 'inplace' - }); - - if (typeof replacement === 'string') - replacement = replacement; // no-op - else if (typeof replacement === 'number') - replacement = replacement.toString(); // fallback - else - error('invalid replacement string'); - - if (!file) - error('no file given'); - - if (!fs.existsSync(file)) - error('no such file or directory: ' + file); - - var result = fs.readFileSync(file, 'utf8').replace(regex, replacement); - if (options.inplace) - fs.writeFileSync(file, result, 'utf8'); - - return ShellString(result); -} -exports.sed = wrap('sed', _sed); - -//@ -//@ ### grep([options ,] regex_filter, file [, file ...]) -//@ ### grep([options ,] regex_filter, file_array) -//@ Available options: -//@ -//@ + `-v`: Inverse the sense of the regex and print the lines not matching the criteria. -//@ -//@ Examples: -//@ -//@ ```javascript -//@ grep('-v', 'GLOBAL_VARIABLE', '*.js'); -//@ grep('GLOBAL_VARIABLE', '*.js'); -//@ ``` -//@ -//@ Reads input string from given files and returns a string containing all lines of the -//@ file that match the given `regex_filter`. Wildcard `*` accepted. -function _grep(options, regex, files) { - options = parseOptions(options, { - 'v': 'inverse' - }); - - if (!files) - error('no paths given'); - - if (typeof files === 'string') - files = [].slice.call(arguments, 2); - // if it's array leave it as it is - - files = expand(files); - - var grep = ''; - files.forEach(function(file) { - if (!fs.existsSync(file)) { - error('no such file or directory: ' + file, true); - return; - } - - var contents = fs.readFileSync(file, 'utf8'), - lines = contents.split(/\r*\n/); - lines.forEach(function(line) { - var matched = line.match(regex); - if ((options.inverse && !matched) || (!options.inverse && matched)) - grep += line + '\n'; - }); - }); - - return ShellString(grep); -} -exports.grep = wrap('grep', _grep); - - -//@ -//@ ### which(command) -//@ -//@ Examples: -//@ -//@ ```javascript -//@ var nodeExec = which('node'); -//@ ``` -//@ -//@ Searches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions. -//@ Returns string containing the absolute path to the command. -function _which(options, cmd) { - if (!cmd) - error('must specify command'); - - var pathEnv = process.env.path || process.env.Path || process.env.PATH, - pathArray = splitPath(pathEnv), - where = null; - - // No relative/absolute paths provided? - if (cmd.search(/\//) === -1) { - // Search for command in PATH - pathArray.forEach(function(dir) { - if (where) - return; // already found it - - var attempt = path.resolve(dir + '/' + cmd); - if (fs.existsSync(attempt)) { - where = attempt; - return; - } - - if (platform === 'win') { - var baseAttempt = attempt; - attempt = baseAttempt + '.exe'; - if (fs.existsSync(attempt)) { - where = attempt; - return; - } - attempt = baseAttempt + '.cmd'; - if (fs.existsSync(attempt)) { - where = attempt; - return; - } - attempt = baseAttempt + '.bat'; - if (fs.existsSync(attempt)) { - where = attempt; - return; - } - } // if 'win' - }); - } - - // Command not found anywhere? - if (!fs.existsSync(cmd) && !where) - return null; - - where = where || path.resolve(cmd); - - return ShellString(where); -} -exports.which = wrap('which', _which); - -//@ -//@ ### echo(string [,string ...]) -//@ -//@ Examples: -//@ -//@ ```javascript -//@ echo('hello world'); -//@ var str = echo('hello world'); -//@ ``` -//@ -//@ Prints string to stdout, and returns string with additional utility methods -//@ like `.to()`. -function _echo() { - var messages = [].slice.call(arguments, 0); - console.log.apply(this, messages); - return ShellString(messages.join(' ')); -} -exports.echo = _echo; // don't wrap() as it could parse '-options' - -// Pushd/popd/dirs internals -var _dirStack = []; - -function _isStackIndex(index) { - return (/^[\-+]\d+$/).test(index); -} +//@include ./src/pwd +var _pwd = require('./src/pwd'); +exports.pwd = common.wrap('pwd', _pwd); -function _parseStackIndex(index) { - if (_isStackIndex(index)) { - if (Math.abs(index) < _dirStack.length + 1) { // +1 for pwd - return (/^-/).test(index) ? Number(index) - 1 : Number(index); - } else { - error(index + ': directory stack index out of range'); - } - } else { - error(index + ': invalid number'); - } -} +//@include ./src/ls +var _ls = require('./src/ls'); +exports.ls = common.wrap('ls', _ls); -function _actualDirStack() { - return [process.cwd()].concat(_dirStack); -} +//@include ./src/find +var _find = require('./src/find'); +exports.find = common.wrap('find', _find); -//@ -//@ ### dirs([options | '+N' | '-N']) -//@ -//@ Available options: -//@ -//@ + `-c`: Clears the directory stack by deleting all of the elements. -//@ -//@ Arguments: -//@ -//@ + `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero. -//@ + `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero. -//@ -//@ Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified. -//@ -//@ See also: pushd, popd -function _dirs(options, index) { - if (_isStackIndex(options)) { - index = options; - options = ''; - } +//@include ./src/cp +var _cp = require('./src/cp'); +exports.cp = common.wrap('cp', _cp); - options = parseOptions(options, { - 'c' : 'clear' - }); +//@include ./src/rm +var _rm = require('./src/rm'); +exports.rm = common.wrap('rm', _rm); - if (options['clear']) { - _dirStack = []; - return _dirStack; - } +//@include ./src/mv +var _mv = require('./src/mv'); +exports.mv = common.wrap('mv', _mv); - var stack = _actualDirStack(); +//@include ./src/mkdir +var _mkdir = require('./src/mkdir'); +exports.mkdir = common.wrap('mkdir', _mkdir); - if (index) { - index = _parseStackIndex(index); +//@include ./src/test +var _test = require('./src/test'); +exports.test = common.wrap('test', _test); - if (index < 0) { - index = stack.length + index; - } +//@include ./src/cat +var _cat = require('./src/cat'); +exports.cat = common.wrap('cat', _cat); - log(stack[index]); - return stack[index]; - } +//@include ./src/to +var _to = require('./src/to'); +String.prototype.to = common.wrap('to', _to); - log(stack.join(' ')); +//@include ./src/toEnd +var _toEnd = require('./src/toEnd'); +String.prototype.toEnd = common.wrap('toEnd', _toEnd); - return stack; -} -exports.dirs = wrap("dirs", _dirs); +//@include ./src/sed +var _sed = require('./src/sed'); +exports.sed = common.wrap('sed', _sed); -//@ -//@ ### pushd([options,] [dir | '-N' | '+N']) -//@ -//@ Available options: -//@ -//@ + `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated. -//@ -//@ Arguments: -//@ -//@ + `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`. -//@ + `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack. -//@ + `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack. -//@ -//@ Examples: -//@ -//@ ```javascript -//@ // process.cwd() === '/usr' -//@ pushd('/etc'); // Returns /etc /usr -//@ pushd('+1'); // Returns /usr /etc -//@ ``` -//@ -//@ Save the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack. -function _pushd(options, dir) { - if (_isStackIndex(options)) { - dir = options; - options = ''; - } +//@include ./src/grep +var _grep = require('./src/grep'); +exports.grep = common.wrap('grep', _grep); - options = parseOptions(options, { - 'n' : 'no-cd' - }); +//@include ./src/which +var _which = require('./src/which'); +exports.which = common.wrap('which', _which); - var dirs = _actualDirStack(); +//@include ./src/echo +var _echo = require('./src/echo'); +exports.echo = _echo; // don't common.wrap() as it could parse '-options' - if (dir === '+0') { - return dirs; // +0 is a noop - } else if (!dir) { - if (dirs.length > 1) { - dirs = dirs.splice(1, 1).concat(dirs); - } else { - return error('no other directory'); - } - } else if (_isStackIndex(dir)) { - var n = _parseStackIndex(dir); - dirs = dirs.slice(n).concat(dirs.slice(0, n)); - } else { - if (options['no-cd']) { - dirs.splice(1, 0, dir); - } else { - dirs.unshift(dir); - } - } +//@include ./src/dirs +var _dirs = require('./src/dirs').dirs; +exports.dirs = common.wrap("dirs", _dirs); +var _pushd = require('./src/dirs').pushd; +exports.pushd = common.wrap('pushd', _pushd); +var _popd = require('./src/dirs').popd; +exports.popd = common.wrap("popd", _popd); - if (options['no-cd']) { - dirs = dirs.slice(1); - } else { - dir = path.resolve(dirs.shift()); - _cd('', dir); - } - - _dirStack = dirs; - return _dirs(''); -} -exports.pushd = wrap('pushd', _pushd); - -//@ -//@ ### popd([options,] ['-N' | '+N']) -//@ -//@ Available options: -//@ -//@ + `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated. -//@ -//@ Arguments: -//@ -//@ + `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero. -//@ + `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero. -//@ -//@ Examples: -//@ -//@ ```javascript -//@ echo(process.cwd()); // '/usr' -//@ pushd('/etc'); // '/etc /usr' -//@ echo(process.cwd()); // '/etc' -//@ popd(); // '/usr' -//@ echo(process.cwd()); // '/usr' -//@ ``` -//@ -//@ When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack. -function _popd(options, index) { - if (_isStackIndex(options)) { - index = options; - options = ''; - } - - options = parseOptions(options, { - 'n' : 'no-cd' - }); - - if (!_dirStack.length) { - return error('directory stack empty'); - } - - index = _parseStackIndex(index || '+0'); - - if (options['no-cd'] || index > 0 || _dirStack.length + index === 0) { - index = index > 0 ? index - 1 : index; - _dirStack.splice(index, 1); - } else { - var dir = path.resolve(_dirStack.shift()); - _cd('', dir); - } - - return _dirs(''); -} -exports.popd = wrap("popd", _popd); +//@include ./src/ln +var _ln = require('./src/ln'); +exports.ln = common.wrap('ln', _ln); //@ //@ ### exit(code) @@ -1073,288 +99,47 @@ exports.exit = process.exit; //@ Object containing environment variables (both getter and setter). Shortcut to process.env. exports.env = process.env; -//@ -//@ ### exec(command [, options] [, callback]) -//@ Available options (all `false` by default): -//@ -//@ + `async`: Asynchronous execution. Defaults to true if a callback is provided. -//@ + `silent`: Do not echo program output to console. -//@ -//@ Examples: -//@ -//@ ```javascript -//@ var version = exec('node --version', {silent:true}).output; -//@ -//@ var child = exec('some_long_running_process', {async:true}); -//@ child.stdout.on('data', function(data) { -//@ /* ... do something with data ... */ -//@ }); -//@ -//@ exec('some_long_running_process', function(code, output) { -//@ console.log('Exit code:', code); -//@ console.log('Program output:', output); -//@ }); -//@ ``` -//@ -//@ Executes the given `command` _synchronously_, unless otherwise specified. -//@ When in synchronous mode returns the object `{ code:..., output:... }`, containing the program's -//@ `output` (stdout + stderr) and its exit `code`. Otherwise returns the child process object, and -//@ the `callback` gets the arguments `(code, output)`. -//@ -//@ **Note:** For long-lived processes, it's best to run `exec()` asynchronously as -//@ the current synchronous implementation uses a lot of CPU. This should be getting -//@ fixed soon. -function _exec(command, options, callback) { - if (!command) - error('must specify command'); - - // Callback is defined instead of options. - if (typeof options === 'function') { - callback = options; - options = { async: true }; - } - - // Callback is defined with options. - if (typeof options === 'object' && typeof callback === 'function') { - options.async = true; - } - - options = extend({ - silent: config.silent, - async: false - }, options); +//@include ./src/exec +var _exec = require('./src/exec'); +exports.exec = common.wrap('exec', _exec, {notUnix:true}); - if (options.async) - return execAsync(command, options, callback); - else - return execSync(command, options); -} -exports.exec = wrap('exec', _exec, {notUnix:true}); +//@include ./src/chmod +var _chmod = require('./src/chmod'); +exports.chmod = common.wrap('chmod', _chmod); -var PERMS = (function (base) { - return { - OTHER_EXEC : base.EXEC, - OTHER_WRITE : base.WRITE, - OTHER_READ : base.READ, - GROUP_EXEC : base.EXEC << 3, - GROUP_WRITE : base.WRITE << 3, - GROUP_READ : base.READ << 3, - OWNER_EXEC : base.EXEC << 6, - OWNER_WRITE : base.WRITE << 6, - OWNER_READ : base.READ << 6, - - // Literal octal numbers are apparently not allowed in "strict" javascript. Using parseInt is - // the preferred way, else a jshint warning is thrown. - STICKY : parseInt('01000', 8), - SETGID : parseInt('02000', 8), - SETUID : parseInt('04000', 8), - - TYPE_MASK : parseInt('0770000', 8) - }; -})({ - EXEC : 1, - WRITE : 2, - READ : 4 -}); - - -//@ -//@ ### chmod(octal_mode || octal_string, file) -//@ ### chmod(symbolic_mode, file) -//@ -//@ Available options: //@ -//@ + `-v`: output a diagnostic for every file processed//@ -//@ + `-c`: like verbose but report only when a change is made//@ -//@ + `-R`: change files and directories recursively//@ -//@ -//@ Examples: -//@ -//@ ```javascript -//@ chmod(755, '/Users/brandon'); -//@ chmod('755', '/Users/brandon'); // same as above -//@ chmod('u+x', '/Users/brandon'); -//@ ``` -//@ -//@ Alters the permissions of a file or directory by either specifying the -//@ absolute permissions in octal form or expressing the changes in symbols. -//@ This command tries to mimic the POSIX behavior as much as possible. -//@ Notable exceptions: +//@ ## Non-Unix commands //@ -//@ + In symbolic modes, 'a-r' and '-r' are identical. No consideration is -//@ given to the umask. -//@ + There is no "quiet" option since default behavior is to run silent. -function _chmod(options, mode, filePattern) { - if (!filePattern) { - if (options.length > 0 && options.charAt(0) === '-') { - // Special case where the specified file permissions started with - to subtract perms, which - // get picked up by the option parser as command flags. - // If we are down by one argument and options starts with -, shift everything over. - filePattern = mode; - mode = options; - options = ''; - } - else { - error('You must specify a file.'); - } - } - - options = parseOptions(options, { - 'R': 'recursive', - 'c': 'changes', - 'v': 'verbose' - }); - - if (typeof filePattern === 'string') { - filePattern = [ filePattern ]; - } - - var files; - - if (options.recursive) { - files = []; - expand(filePattern).forEach(function addFile(expandedFile) { - var stat = fs.lstatSync(expandedFile); - - if (!stat.isSymbolicLink()) { - files.push(expandedFile); - - if (stat.isDirectory()) { // intentionally does not follow symlinks. - fs.readdirSync(expandedFile).forEach(function (child) { - addFile(expandedFile + '/' + child); - }); - } - } - }); - } - else { - files = expand(filePattern); - } - - files.forEach(function innerChmod(file) { - file = path.resolve(file); - if (!fs.existsSync(file)) { - error('File not found: ' + file); - } - // When recursing, don't follow symlinks. - if (options.recursive && fs.lstatSync(file).isSymbolicLink()) { - return; - } +//@include ./src/tempdir +var _tempDir = require('./src/tempdir'); +exports.tempdir = common.wrap('tempdir', _tempDir); - var perms = fs.statSync(file).mode; - var type = perms & PERMS.TYPE_MASK; - var newPerms = perms; +//@include ./src/error +var _error = require('./src/error'); +exports.error = _error; - if (isNaN(parseInt(mode, 8))) { - // parse options - mode.split(',').forEach(function (symbolicMode) { - /*jshint regexdash:true */ - var pattern = /([ugoa]*)([=\+-])([rwxXst]*)/i; - var matches = pattern.exec(symbolicMode); - - if (matches) { - var applyTo = matches[1]; - var operator = matches[2]; - var change = matches[3]; - - var changeOwner = applyTo.indexOf('u') != -1 || applyTo === 'a' || applyTo === ''; - var changeGroup = applyTo.indexOf('g') != -1 || applyTo === 'a' || applyTo === ''; - var changeOther = applyTo.indexOf('o') != -1 || applyTo === 'a' || applyTo === ''; - - var changeRead = change.indexOf('r') != -1; - var changeWrite = change.indexOf('w') != -1; - var changeExec = change.indexOf('x') != -1; - var changeSticky = change.indexOf('t') != -1; - var changeSetuid = change.indexOf('s') != -1; - - var mask = 0; - if (changeOwner) { - mask |= (changeRead ? PERMS.OWNER_READ : 0) + (changeWrite ? PERMS.OWNER_WRITE : 0) + (changeExec ? PERMS.OWNER_EXEC : 0) + (changeSetuid ? PERMS.SETUID : 0); - } - if (changeGroup) { - mask |= (changeRead ? PERMS.GROUP_READ : 0) + (changeWrite ? PERMS.GROUP_WRITE : 0) + (changeExec ? PERMS.GROUP_EXEC : 0) + (changeSetuid ? PERMS.SETGID : 0); - } - if (changeOther) { - mask |= (changeRead ? PERMS.OTHER_READ : 0) + (changeWrite ? PERMS.OTHER_WRITE : 0) + (changeExec ? PERMS.OTHER_EXEC : 0); - } - - // Sticky bit is special - it's not tied to user, group or other. - if (changeSticky) { - mask |= PERMS.STICKY; - } - - switch (operator) { - case '+': - newPerms |= mask; - break; - - case '-': - newPerms &= ~mask; - break; - - case '=': - newPerms = type + mask; - - // According to POSIX, when using = to explicitly set the permissions, setuid and setgid can never be cleared. - if (fs.statSync(file).isDirectory()) { - newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms; - } - break; - } - - if (options.verbose) { - log(file + ' -> ' + newPerms.toString(8)); - } - - if (perms != newPerms) { - if (!options.verbose && options.changes) { - log(file + ' -> ' + newPerms.toString(8)); - } - fs.chmodSync(file, newPerms); - } - } - else { - error('Invalid symbolic mode change: ' + symbolicMode); - } - }); - } - else { - // they gave us a full number - newPerms = type + parseInt(mode, 8); - - // POSIX rules are that setuid and setgid can only be added using numeric form, but not cleared. - if (fs.statSync(file).isDirectory()) { - newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms; - } - - fs.chmodSync(file, newPerms); - } - }); -} -exports.chmod = wrap('chmod', _chmod); //@ //@ ## Configuration //@ - - -exports.config = config; +exports.config = common.config; //@ //@ ### config.silent //@ Example: //@ //@ ```javascript -//@ var silentState = config.silent; // save old silent state -//@ config.silent = true; +//@ var sh = require('shelljs'); +//@ var silentState = sh.config.silent; // save old silent state +//@ sh.config.silent = true; //@ /* ... */ -//@ config.silent = silentState; // restore old silent state +//@ sh.config.silent = silentState; // restore old silent state //@ ``` //@ //@ Suppresses all command output if `true`, except for `echo()` calls. @@ -1365,537 +150,10 @@ exports.config = config; //@ Example: //@ //@ ```javascript +//@ require('shelljs/global'); //@ config.fatal = true; //@ cp('this_file_does_not_exist', '/dev/null'); // dies here //@ /* more commands... */ //@ ``` //@ //@ If `true` the script will die on errors. Default is `false`. - - - - -//@ -//@ ## Non-Unix commands -//@ - - - - - - -//@ -//@ ### tempdir() -//@ Searches and returns string containing a writeable, platform-dependent temporary directory. -//@ Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir). -exports.tempdir = wrap('tempdir', tempDir); - - -//@ -//@ ### error() -//@ Tests if error occurred in the last command. Returns `null` if no error occurred, -//@ otherwise returns string explaining the error -exports.error = function() { - return state.error; -}; - - - - - -//////////////////////////////////////////////////////////////////////////////////////////////// -// -// Auxiliary functions (internal use only) -// - -function log() { - if (!config.silent) - console.log.apply(this, arguments); -} - -function deprecate(what, msg) { - console.log('*** ShellJS.'+what+': This function is deprecated.', msg); -} - -function write(msg) { - if (!config.silent) - process.stdout.write(msg); -} - -// Shows error message. Throws unless _continue or config.fatal are true -function error(msg, _continue) { - if (state.error === null) - state.error = ''; - state.error += state.currentCmd + ': ' + msg + '\n'; - - log(state.error); - - if (config.fatal) - process.exit(1); - - if (!_continue) - throw ''; -} - -// Returns {'alice': true, 'bob': false} when passed: -// parseOptions('-a', {'a':'alice', 'b':'bob'}); -function parseOptions(str, map) { - if (!map) - error('parseOptions() internal error: no map given'); - - // All options are false by default - var options = {}; - for (var letter in map) - options[map[letter]] = false; - - if (!str) - return options; // defaults - - if (typeof str !== 'string') - error('parseOptions() internal error: wrong str'); - - // e.g. match[1] = 'Rf' for str = '-Rf' - var match = str.match(/^\-(.+)/); - if (!match) - return options; - - // e.g. chars = ['R', 'f'] - var chars = match[1].split(''); - - chars.forEach(function(c) { - if (c in map) - options[map[c]] = true; - else - error('option not recognized: '+c); - }); - - return options; -} - -// Common wrapper for all Unix-like commands -function wrap(cmd, fn, options) { - return function() { - var retValue = null; - - state.currentCmd = cmd; - state.error = null; - - try { - var args = [].slice.call(arguments, 0); - - if (options && options.notUnix) { - retValue = fn.apply(this, args); - } else { - if (args.length === 0 || typeof args[0] !== 'string' || args[0][0] !== '-') - args.unshift(''); // only add dummy option if '-option' not already present - retValue = fn.apply(this, args); - } - } catch (e) { - if (!state.error) { - // If state.error hasn't been set it's an error thrown by Node, not us - probably a bug... - console.log('shell.js: internal error'); - console.log(e.stack || e); - process.exit(1); - } - if (config.fatal) - throw e; - } - - state.currentCmd = 'shell.js'; - return retValue; - }; -} // wrap - -// Buffered file copy, synchronous -// (Using readFileSync() + writeFileSync() could easily cause a memory overflow -// with large files) -function copyFileSync(srcFile, destFile) { - if (!fs.existsSync(srcFile)) - error('copyFileSync: no such file or directory: ' + srcFile); - - var BUF_LENGTH = 64*1024, - buf = new Buffer(BUF_LENGTH), - bytesRead = BUF_LENGTH, - pos = 0, - fdr = null, - fdw = null; - - try { - fdr = fs.openSync(srcFile, 'r'); - } catch(e) { - error('copyFileSync: could not read src file ('+srcFile+')'); - } - - try { - fdw = fs.openSync(destFile, 'w'); - } catch(e) { - error('copyFileSync: could not write to dest file (code='+e.code+'):'+destFile); - } - - while (bytesRead === BUF_LENGTH) { - bytesRead = fs.readSync(fdr, buf, 0, BUF_LENGTH, pos); - fs.writeSync(fdw, buf, 0, bytesRead); - pos += bytesRead; - } - - fs.closeSync(fdr); - fs.closeSync(fdw); -} - -// Recursively copies 'sourceDir' into 'destDir' -// Adapted from https://github.com/ryanmcgrath/wrench-js -// -// Copyright (c) 2010 Ryan McGrath -// Copyright (c) 2012 Artur Adib -// -// Licensed under the MIT License -// http://www.opensource.org/licenses/mit-license.php -function cpdirSyncRecursive(sourceDir, destDir, opts) { - if (!opts) opts = {}; - - /* Create the directory where all our junk is moving to; read the mode of the source directory and mirror it */ - var checkDir = fs.statSync(sourceDir); - try { - fs.mkdirSync(destDir, checkDir.mode); - } catch (e) { - //if the directory already exists, that's okay - if (e.code !== 'EEXIST') throw e; - } - - var files = fs.readdirSync(sourceDir); - - for(var i = 0; i < files.length; i++) { - var currFile = fs.lstatSync(sourceDir + "/" + files[i]); - - if (currFile.isDirectory()) { - /* recursion this thing right on back. */ - cpdirSyncRecursive(sourceDir + "/" + files[i], destDir + "/" + files[i], opts); - } else if (currFile.isSymbolicLink()) { - var symlinkFull = fs.readlinkSync(sourceDir + "/" + files[i]); - fs.symlinkSync(symlinkFull, destDir + "/" + files[i]); - } else { - /* At this point, we've hit a file actually worth copying... so copy it on over. */ - if (fs.existsSync(destDir + "/" + files[i]) && !opts.force) { - log('skipping existing file: ' + files[i]); - } else { - copyFileSync(sourceDir + "/" + files[i], destDir + "/" + files[i]); - } - } - - } // for files -} // cpdirSyncRecursive - -// Recursively removes 'dir' -// Adapted from https://github.com/ryanmcgrath/wrench-js -// -// Copyright (c) 2010 Ryan McGrath -// Copyright (c) 2012 Artur Adib -// -// Licensed under the MIT License -// http://www.opensource.org/licenses/mit-license.php -function rmdirSyncRecursive(dir, force) { - var files; - - files = fs.readdirSync(dir); - - // Loop through and delete everything in the sub-tree after checking it - for(var i = 0; i < files.length; i++) { - var file = dir + "/" + files[i], - currFile = fs.lstatSync(file); - - if(currFile.isDirectory()) { // Recursive function back to the beginning - rmdirSyncRecursive(file, force); - } - - else if(currFile.isSymbolicLink()) { // Unlink symlinks - if (force || isWriteable(file)) { - try { - _unlinkSync(file); - } catch (e) { - error('could not remove file (code '+e.code+'): ' + file, true); - } - } - } - - else // Assume it's a file - perhaps a try/catch belongs here? - if (force || isWriteable(file)) { - try { - _unlinkSync(file); - } catch (e) { - error('could not remove file (code '+e.code+'): ' + file, true); - } - } - } - - // Now that we know everything in the sub-tree has been deleted, we can delete the main directory. - // Huzzah for the shopkeep. - - var result; - try { - result = fs.rmdirSync(dir); - } catch(e) { - error('could not remove directory (code '+e.code+'): ' + dir, true); - } - - return result; -} // rmdirSyncRecursive - -// Recursively creates 'dir' -function mkdirSyncRecursive(dir) { - var baseDir = path.dirname(dir); - - // Base dir exists, no recursion necessary - if (fs.existsSync(baseDir)) { - fs.mkdirSync(dir, parseInt('0777', 8)); - return; - } - - // Base dir does not exist, go recursive - mkdirSyncRecursive(baseDir); - - // Base dir created, can create dir - fs.mkdirSync(dir, parseInt('0777', 8)); -} - -// e.g. 'shelljs_a5f185d0443ca...' -function randomFileName() { - function randomHash(count) { - if (count === 1) - return parseInt(16*Math.random(), 10).toString(16); - else { - var hash = ''; - for (var i=0; i<count; i++) - hash += randomHash(1); - return hash; - } - } - - return 'shelljs_'+randomHash(20); -} - -// Returns false if 'dir' is not a writeable directory, 'dir' otherwise -function writeableDir(dir) { - if (!dir || !fs.existsSync(dir)) - return false; - - if (!fs.statSync(dir).isDirectory()) - return false; - - var testFile = dir+'/'+randomFileName(); - try { - fs.writeFileSync(testFile, ' '); - _unlinkSync(testFile); - return dir; - } catch (e) { - return false; - } -} - -// Cross-platform method for getting an available temporary directory. -// Follows the algorithm of Python's tempfile.tempdir -// http://docs.python.org/library/tempfile.html#tempfile.tempdir -function tempDir() { - if (state.tempDir) - return state.tempDir; // from cache - - state.tempDir = writeableDir(process.env['TMPDIR']) || - writeableDir(process.env['TEMP']) || - writeableDir(process.env['TMP']) || - writeableDir(process.env['Wimp$ScrapDir']) || // RiscOS - writeableDir('C:\\TEMP') || // Windows - writeableDir('C:\\TMP') || // Windows - writeableDir('\\TEMP') || // Windows - writeableDir('\\TMP') || // Windows - writeableDir('/tmp') || - writeableDir('/var/tmp') || - writeableDir('/usr/tmp') || - writeableDir('.'); // last resort - - return state.tempDir; -} - -// Wrapper around exec() to enable echoing output to console in real time -function execAsync(cmd, opts, callback) { - var output = ''; - - var options = extend({ - silent: config.silent - }, opts); - - var c = child.exec(cmd, {env: process.env, maxBuffer: 20*1024*1024}, function(err) { - if (callback) - callback(err ? err.code : 0, output); - }); - - c.stdout.on('data', function(data) { - output += data; - if (!options.silent) - process.stdout.write(data); - }); - - c.stderr.on('data', function(data) { - output += data; - if (!options.silent) - process.stdout.write(data); - }); - - return c; -} - -// Hack to run child_process.exec() synchronously (sync avoids callback hell) -// Uses a custom wait loop that checks for a flag file, created when the child process is done. -// (Can't do a wait loop that checks for internal Node variables/messages as -// Node is single-threaded; callbacks and other internal state changes are done in the -// event loop). -function execSync(cmd, opts) { - var stdoutFile = path.resolve(tempDir()+'/'+randomFileName()), - codeFile = path.resolve(tempDir()+'/'+randomFileName()), - scriptFile = path.resolve(tempDir()+'/'+randomFileName()), - sleepFile = path.resolve(tempDir()+'/'+randomFileName()); - - var options = extend({ - silent: config.silent - }, opts); - - var previousStdoutContent = ''; - // Echoes stdout changes from running process, if not silent - function updateStdout() { - if (options.silent || !fs.existsSync(stdoutFile)) - return; - - var stdoutContent = fs.readFileSync(stdoutFile, 'utf8'); - // No changes since last time? - if (stdoutContent.length <= previousStdoutContent.length) - return; - - process.stdout.write(stdoutContent.substr(previousStdoutContent.length)); - previousStdoutContent = stdoutContent; - } - - function escape(str) { - return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0"); - } - - cmd += ' > '+stdoutFile+' 2>&1'; // works on both win/unix - - var script = - "var child = require('child_process')," + - " fs = require('fs');" + - "child.exec('"+escape(cmd)+"', {env: process.env, maxBuffer: 20*1024*1024}, function(err) {" + - " fs.writeFileSync('"+escape(codeFile)+"', err ? err.code.toString() : '0');" + - "});"; - - if (fs.existsSync(scriptFile)) _unlinkSync(scriptFile); - if (fs.existsSync(stdoutFile)) _unlinkSync(stdoutFile); - if (fs.existsSync(codeFile)) _unlinkSync(codeFile); - - fs.writeFileSync(scriptFile, script); - child.exec('"'+process.execPath+'" '+scriptFile, { - env: process.env, - cwd: exports.pwd(), - maxBuffer: 20*1024*1024 - }); - - // The wait loop - // sleepFile is used as a dummy I/O op to mitigate unnecessary CPU usage - // (tried many I/O sync ops, writeFileSync() seems to be only one that is effective in reducing - // CPU usage, though apparently not so much on Windows) - while (!fs.existsSync(codeFile)) { updateStdout(); fs.writeFileSync(sleepFile, 'a'); } - while (!fs.existsSync(stdoutFile)) { updateStdout(); fs.writeFileSync(sleepFile, 'a'); } - - // At this point codeFile exists, but it's not necessarily flushed yet. - // Keep reading it until it is. - var code = parseInt('', 10); - while (isNaN(code)) { - code = parseInt(fs.readFileSync(codeFile, 'utf8'), 10); - } - - var stdout = fs.readFileSync(stdoutFile, 'utf8'); - - // No biggie if we can't erase the files now -- they're in a temp dir anyway - try { _unlinkSync(scriptFile); } catch(e) {} - try { _unlinkSync(stdoutFile); } catch(e) {} - try { _unlinkSync(codeFile); } catch(e) {} - try { _unlinkSync(sleepFile); } catch(e) {} - - // True if successful, false if not - var obj = { - code: code, - output: stdout - }; - return obj; -} // execSync() - -// Expands wildcards with matching file names. For a given array of file names 'list', returns -// another array containing all file names as per ls(list[i]). -// For example: -// expand(['file*.js']) = ['file1.js', 'file2.js', ...] -// (if the files 'file1.js', 'file2.js', etc, exist in the current dir) -function expand(list) { - var expanded = []; - list.forEach(function(listEl) { - // Wildcard present? - if (listEl.search(/\*/) > -1) { - _ls('', listEl).forEach(function(file) { - expanded.push(file); - }); - } else { - expanded.push(listEl); - } - }); - return expanded; -} - -// Cross-platform method for splitting environment PATH variables -function splitPath(p) { - if (!p) - return []; - - if (platform === 'win') - return p.split(';'); - else - return p.split(':'); -} - -// extend(target_obj, source_obj1 [, source_obj2 ...]) -// Shallow extend, e.g.: -// extend({A:1}, {b:2}, {c:3}) returns {A:1, b:2, c:3} -function extend(target) { - var sources = [].slice.call(arguments, 1); - sources.forEach(function(source) { - for (var key in source) - target[key] = source[key]; - }); - - return target; -} - -// Normalizes _unlinkSync() across platforms to match Unix behavior, i.e. -// file can be unlinked even if it's read-only, see joyent/node#3006 -function _unlinkSync(file) { - try { - fs.unlinkSync(file); - } catch(e) { - // Try to override file permission - if (e.code === 'EPERM') { - fs.chmodSync(file, '0666'); - fs.unlinkSync(file); - } else { - throw e; - } - } -} - -// Hack to determine if file has write permissions for current user -// Avoids having to check user, group, etc, but it's probably slow -function isWriteable(file) { - var writePermission = true; - try { - var __fd = fs.openSync(file, 'a'); - fs.closeSync(__fd); - } catch(e) { - writePermission = false; - } - - return writePermission; -} diff --git a/StoneIsland/platforms/ios/cordova/run b/StoneIsland/platforms/ios/cordova/run index d2c376d5..470384b5 100755 --- a/StoneIsland/platforms/ios/cordova/run +++ b/StoneIsland/platforms/ios/cordova/run @@ -19,18 +19,45 @@ under the License. */ -var args = process.argv, - run = require('./lib/run'); + +var args = process.argv; +var Api = require('./Api'); +var nopt = require('nopt'); // Handle help flag -if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(args[2]) > -1) { - run.help(); -} else { - run.run(args).done(function() { +if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) { + require('./lib/run').help(); + process.exit(0); +} + +// Parse arguments (includes build params as well) +var opts = nopt({ + 'verbose' : Boolean, + 'silent' : Boolean, + 'debug': Boolean, + 'release': Boolean, + 'nobuild': Boolean, + 'archs': String, + 'list': Boolean, + 'device': Boolean, + 'emulator': Boolean, + 'target' : String, + 'codeSignIdentity': String, + 'codeSignResourceRules': String, + 'provisioningProfile': String, + 'buildConfig' : String, + 'noSign' : Boolean +}, { 'd' : '--verbose' }, args); + +// Make options compatible with PlatformApi build method spec +opts.argv = opts.argv.remain; + +require('./loggingHelper').adjustLoggerLevel(opts); + +new Api().run(opts).done(function() { console.log('** RUN SUCCEEDED **'); }, function (err) { var errorMessage = (err && err.stack) ? err.stack : err; console.error(errorMessage); process.exit(2); }); -}
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/cordova/run.bat b/StoneIsland/platforms/ios/cordova/run.bat index 0d10321a..8a3cad2a 100755 --- a/StoneIsland/platforms/ios/cordova/run.bat +++ b/StoneIsland/platforms/ios/cordova/run.bat @@ -14,12 +14,6 @@ :: 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 -) +ECHO WARN: The `run` is not available for cordova-ios on windows machines.>&2 diff --git a/StoneIsland/platforms/ios/cordova/version b/StoneIsland/platforms/ios/cordova/version index 542a2173..99ce9729 100755 --- a/StoneIsland/platforms/ios/cordova/version +++ b/StoneIsland/platforms/ios/cordova/version @@ -25,6 +25,11 @@ Note: it does not work if the --shared option was used to create the project. */ -var VERSION="3.9.2" +// Coho updates this line +var VERSION="4.3.0"; -console.log(VERSION); +module.exports.version = VERSION; + +if (!module.parent) { + console.log(VERSION); +} diff --git a/StoneIsland/platforms/ios/frameworks.json b/StoneIsland/platforms/ios/frameworks.json index 615b5f0b..efdb887d 100755..100644 --- a/StoneIsland/platforms/ios/frameworks.json +++ b/StoneIsland/platforms/ios/frameworks.json @@ -1,14 +1,14 @@ { - "AudioToolbox.framework": 2, - "CoreLocation.framework": 2, - "SystemConfiguration.framework": 2, - "Social.framework": 2, - "MessageUI.framework": 1, "Accounts.framework": 1, + "AudioToolbox.framework": 2, "CFNetwork.framework": 1, + "CoreLocation.framework": 2, "QuartzCore.framework": 1, "Security.framework": 1, + "Social.framework": 2, "StoreKit.framework": 1, + "SystemConfiguration.framework": 2, "libz.dylib": 1, - "libsqlite3.dylib": 1 + "libsqlite3.dylib": 1, + "MessageUI.framework": 1 }
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/ios.json b/StoneIsland/platforms/ios/ios.json index 08b0488c..433e304a 100755..100644 --- a/StoneIsland/platforms/ios/ios.json +++ b/StoneIsland/platforms/ios/ios.json @@ -13,6 +13,10 @@ "count": 1 }, { + "xml": "<feature name=\"ParsePlugin\"><param name=\"ios-package\" value=\"CDVParsePlugin\" /></feature>", + "count": 1 + }, + { "xml": "<feature name=\"Console\"><param name=\"ios-package\" value=\"CDVLogger\" /></feature>", "count": 1 }, @@ -29,6 +33,10 @@ "count": 1 }, { + "xml": "<feature name=\"InAppBrowser\"><param name=\"ios-package\" value=\"CDVInAppBrowser\" /></feature>", + "count": 1 + }, + { "xml": "<feature name=\"NetworkStatus\"><param name=\"ios-package\" value=\"CDVConnection\" /></feature>", "count": 1 }, @@ -43,14 +51,6 @@ { "xml": "<feature name=\"PushNotification\"><param name=\"ios-package\" value=\"PushPlugin\" /></feature>", "count": 1 - }, - { - "xml": "<feature name=\"InAppBrowser\"><param name=\"ios-package\" value=\"CDVInAppBrowser\" /></feature>", - "count": 1 - }, - { - "xml": "<feature name=\"ParsePlugin\"><param name=\"ios-package\" value=\"CDVParsePlugin\" /></feature>", - "count": 1 } ] } @@ -83,6 +83,9 @@ "com.ionic.keyboard": { "PACKAGE_NAME": "us.okfoc.stoneisland" }, + "com.parse.cordova.core.pushplugin": { + "PACKAGE_NAME": "us.okfoc.stoneisland" + }, "cordova-plugin-console": { "PACKAGE_NAME": "us.okfoc.stoneisland" }, @@ -99,6 +102,9 @@ "cordova-plugin-geolocation": { "PACKAGE_NAME": "us.okfoc.stoneisland" }, + "cordova-plugin-inappbrowser": { + "PACKAGE_NAME": "us.okfoc.stoneisland" + }, "cordova-plugin-network-information": { "PACKAGE_NAME": "us.okfoc.stoneisland" }, @@ -113,99 +119,110 @@ }, "phonegap-plugin-push": { "PACKAGE_NAME": "us.okfoc.stoneisland" - }, - "cordova-plugin-inappbrowser": { - "PACKAGE_NAME": "us.okfoc.stoneisland" - }, - "com.parse.cordova.core.pushplugin": { - "PACKAGE_NAME": "us.okfoc.stoneisland" } }, "dependent_plugins": {}, "modules": [ { - "file": "plugins/com.ionic.keyboard/www/keyboard.js", "id": "com.ionic.keyboard.keyboard", + "file": "plugins/com.ionic.keyboard/www/keyboard.js", "pluginId": "com.ionic.keyboard", "clobbers": [ "cordova.plugins.Keyboard" ] }, { - "file": "plugins/cordova-plugin-console/www/logger.js", + "id": "com.parse.cordova.core.pushplugin.ParsePlugin", + "file": "plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js", + "pluginId": "com.parse.cordova.core.pushplugin", + "clobbers": [ + "window.parsePlugin" + ] + }, + { "id": "cordova-plugin-console.logger", + "file": "plugins/cordova-plugin-console/www/logger.js", "pluginId": "cordova-plugin-console", "clobbers": [ "cordova.logger" ] }, { - "file": "plugins/cordova-plugin-console/www/console-via-logger.js", "id": "cordova-plugin-console.console", + "file": "plugins/cordova-plugin-console/www/console-via-logger.js", "pluginId": "cordova-plugin-console", "clobbers": [ "console" ] }, { - "file": "plugins/cordova-plugin-customurlscheme/www/ios/LaunchMyApp.js", "id": "cordova-plugin-customurlscheme.LaunchMyApp", + "file": "plugins/cordova-plugin-customurlscheme/www/ios/LaunchMyApp.js", "pluginId": "cordova-plugin-customurlscheme", "clobbers": [ "window.plugins.launchmyapp" ] }, { - "file": "plugins/cordova-plugin-device/www/device.js", "id": "cordova-plugin-device.device", + "file": "plugins/cordova-plugin-device/www/device.js", "pluginId": "cordova-plugin-device", "clobbers": [ "device" ] }, { - "file": "plugins/cordova-plugin-dialogs/www/notification.js", "id": "cordova-plugin-dialogs.notification", + "file": "plugins/cordova-plugin-dialogs/www/notification.js", "pluginId": "cordova-plugin-dialogs", "merges": [ "navigator.notification" ] }, { - "file": "plugins/cordova-plugin-geolocation/www/Coordinates.js", "id": "cordova-plugin-geolocation.Coordinates", + "file": "plugins/cordova-plugin-geolocation/www/Coordinates.js", "pluginId": "cordova-plugin-geolocation", "clobbers": [ "Coordinates" ] }, { - "file": "plugins/cordova-plugin-geolocation/www/PositionError.js", "id": "cordova-plugin-geolocation.PositionError", + "file": "plugins/cordova-plugin-geolocation/www/PositionError.js", "pluginId": "cordova-plugin-geolocation", "clobbers": [ "PositionError" ] }, { - "file": "plugins/cordova-plugin-geolocation/www/Position.js", "id": "cordova-plugin-geolocation.Position", + "file": "plugins/cordova-plugin-geolocation/www/Position.js", "pluginId": "cordova-plugin-geolocation", "clobbers": [ "Position" ] }, { - "file": "plugins/cordova-plugin-geolocation/www/geolocation.js", "id": "cordova-plugin-geolocation.geolocation", + "file": "plugins/cordova-plugin-geolocation/www/geolocation.js", "pluginId": "cordova-plugin-geolocation", "clobbers": [ "navigator.geolocation" ] }, { - "file": "plugins/cordova-plugin-network-information/www/network.js", + "id": "cordova-plugin-inappbrowser.inappbrowser", + "file": "plugins/cordova-plugin-inappbrowser/www/inappbrowser.js", + "pluginId": "cordova-plugin-inappbrowser", + "clobbers": [ + "cordova.InAppBrowser.open", + "window.open" + ] + }, + { "id": "cordova-plugin-network-information.network", + "file": "plugins/cordova-plugin-network-information/www/network.js", "pluginId": "cordova-plugin-network-information", "clobbers": [ "navigator.connection", @@ -213,68 +230,51 @@ ] }, { - "file": "plugins/cordova-plugin-network-information/www/Connection.js", "id": "cordova-plugin-network-information.Connection", + "file": "plugins/cordova-plugin-network-information/www/Connection.js", "pluginId": "cordova-plugin-network-information", "clobbers": [ "Connection" ] }, { - "file": "plugins/cordova-plugin-splashscreen/www/splashscreen.js", "id": "cordova-plugin-splashscreen.SplashScreen", + "file": "plugins/cordova-plugin-splashscreen/www/splashscreen.js", "pluginId": "cordova-plugin-splashscreen", "clobbers": [ "navigator.splashscreen" ] }, { - "file": "plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js", "id": "cordova-plugin-x-socialsharing.SocialSharing", + "file": "plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js", "pluginId": "cordova-plugin-x-socialsharing", "clobbers": [ "window.plugins.socialsharing" ] }, { - "file": "plugins/phonegap-plugin-push/www/push.js", "id": "phonegap-plugin-push.PushNotification", + "file": "plugins/phonegap-plugin-push/www/push.js", "pluginId": "phonegap-plugin-push", "clobbers": [ "PushNotification" ] - }, - { - "file": "plugins/cordova-plugin-inappbrowser/www/inappbrowser.js", - "id": "cordova-plugin-inappbrowser.inappbrowser", - "pluginId": "cordova-plugin-inappbrowser", - "clobbers": [ - "cordova.InAppBrowser.open", - "window.open" - ] - }, - { - "file": "plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js", - "id": "com.parse.cordova.core.pushplugin.ParsePlugin", - "pluginId": "com.parse.cordova.core.pushplugin", - "clobbers": [ - "window.parsePlugin" - ] } ], "plugin_metadata": { "com.ionic.keyboard": "1.0.4", + "com.parse.cordova.core.pushplugin": "0.1.0", "cordova-plugin-console": "1.0.1", "cordova-plugin-customurlscheme": "4.0.0", "cordova-plugin-device": "1.0.1", "cordova-plugin-dialogs": "1.1.1", "cordova-plugin-geolocation": "1.0.1", + "cordova-plugin-inappbrowser": "1.1.0", "cordova-plugin-network-information": "1.0.1", - "cordova-plugin-splashscreen": "2.1.0", + "cordova-plugin-splashscreen": "3.0.0", "cordova-plugin-whitelist": "1.0.0", "cordova-plugin-x-socialsharing": "5.0.7", - "phonegap-plugin-push": "1.4.4", - "cordova-plugin-inappbrowser": "1.1.0", - "com.parse.cordova.core.pushplugin": "0.1.0" + "phonegap-plugin-push": "1.4.4" } }
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/platform_www/cordova-js-src/exec.js b/StoneIsland/platforms/ios/platform_www/cordova-js-src/exec.js index 32a3f8b5..3fb7fa19 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/cordova-js-src/exec.js +++ b/StoneIsland/platforms/ios/platform_www/cordova-js-src/exec.js @@ -19,55 +19,20 @@ * */ +/*global require, module, atob, document */ + /** * Creates a gap bridge iframe used to notify the native code about queued * commands. */ var cordova = require('cordova'), - channel = require('cordova/channel'), utils = require('cordova/utils'), base64 = require('cordova/base64'), - // XHR mode does not work on iOS 4.2. - // XHR mode's main advantage is working around a bug in -webkit-scroll, which - // doesn't exist only on iOS 5.x devices. - // IFRAME_NAV is the fastest. - // IFRAME_HASH could be made to enable synchronous bridge calls if we wanted this feature. - jsToNativeModes = { - IFRAME_NAV: 0, // Default. Uses a new iframe for each poke. - // XHR bridge appears to be flaky sometimes: CB-3900, CB-3359, CB-5457, CB-4970, CB-4998, CB-5134 - XHR_NO_PAYLOAD: 1, // About the same speed as IFRAME_NAV. Performance not about the same as IFRAME_NAV, but more variable. - XHR_WITH_PAYLOAD: 2, // Flakey, and not as performant - XHR_OPTIONAL_PAYLOAD: 3, // Flakey, and not as performant - 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, // Slower than no payload. Maybe since it has to be URI encoded / decoded. - WK_WEBVIEW_BINDING: 6 // Only way that works for WKWebView :) - }, - bridgeMode, execIframe, - execHashIframe, - hashToggle = 1, - execXhr, - requestCount = 0, - vcHeaderValue = null, commandQueue = [], // Contains pending JS->Native messages. isInContextOfEvalJs = 0, failSafeTimerId = 0; -function shouldBundleCommandJson() { - if (bridgeMode === jsToNativeModes.XHR_WITH_PAYLOAD) { - return true; - } - if (bridgeMode === jsToNativeModes.XHR_OPTIONAL_PAYLOAD) { - var payloadLength = 0; - for (var i = 0; i < commandQueue.length; ++i) { - payloadLength += commandQueue[i].length; - } - // The value here was determined using the benchmark within CordovaLibApp on an iPad 3. - return payloadLength < 4500; - } - return false; -} - function massageArgsJsToNative(args) { if (!args || utils.typeName(args) != 'Array') { return args; @@ -118,17 +83,10 @@ function convertMessageToArgsNativeToJs(message) { } function iOSExec() { - if (bridgeMode === undefined) { - bridgeMode = jsToNativeModes.IFRAME_NAV; - } - - if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.cordova && window.webkit.messageHandlers.cordova.postMessage) { - bridgeMode = jsToNativeModes.WK_WEBVIEW_BINDING; - } - var successCallback, failCallback, service, action, actionArgs, splitCommand; + var successCallback, failCallback, service, action, actionArgs; var callbackId = null; - if (typeof arguments[0] !== "string") { + if (typeof arguments[0] !== 'string') { // FORMAT ONE successCallback = arguments[0]; failCallback = arguments[1]; @@ -142,18 +100,9 @@ function iOSExec() { // an invalid callbackId and passes it even if no callbacks were given. callbackId = 'INVALID'; } else { - // FORMAT TWO, REMOVED - try { - splitCommand = arguments[0].split("."); - action = splitCommand.pop(); - service = splitCommand.join("."); - actionArgs = Array.prototype.splice.call(arguments, 1); - - console.log('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + - "cordova.exec(null, null, \"" + service + "\", \"" + action + "\"," + JSON.stringify(actionArgs) + ");" - ); - return; - } catch (e) {} + throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + + 'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);' + ); } // If actionArgs is not provided, default to an empty array @@ -175,116 +124,79 @@ function iOSExec() { // effectively clone the command arguments in case they are mutated before // the command is executed. commandQueue.push(JSON.stringify(command)); - - if (bridgeMode === jsToNativeModes.WK_WEBVIEW_BINDING) { - window.webkit.messageHandlers.cordova.postMessage(command); - } else { - // If we're in the context of a stringByEvaluatingJavaScriptFromString call, - // then the queue will be flushed when it returns; no need for a poke. - // 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. - if (!isInContextOfEvalJs && commandQueue.length == 1) { - pokeNative(); - } + + // If we're in the context of a stringByEvaluatingJavaScriptFromString call, + // then the queue will be flushed when it returns; no need for a poke. + // 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. + if (!isInContextOfEvalJs && commandQueue.length == 1) { + pokeNative(); } } -function pokeNative() { - switch (bridgeMode) { - case jsToNativeModes.XHR_NO_PAYLOAD: - case jsToNativeModes.XHR_WITH_PAYLOAD: - case jsToNativeModes.XHR_OPTIONAL_PAYLOAD: - pokeNativeViaXhr(); - break; - default: // iframe-based. - pokeNativeViaIframe(); - } +// CB-10530 +function proxyChanged() { + var cexec = cordovaExec(); + + return (execProxy !== cexec && // proxy objects are different + iOSExec !== cexec // proxy object is not the current iOSExec + ); } -function pokeNativeViaXhr() { - // This prevents sending an XHR when there is already one being sent. - // This should happen only in rare circumstances (refer to unit tests). - if (execXhr && execXhr.readyState != 4) { - execXhr = null; - } - // Re-using the XHR improves exec() performance by about 10%. - execXhr = execXhr || new XMLHttpRequest(); - // Changing this to a GET will make the XHR reach the URIProtocol on 4.2. - // For some reason it still doesn't work though... - // Add a timestamp to the query param to prevent caching. - execXhr.open('HEAD', "/!gap_exec?" + (+new Date()), true); - if (!vcHeaderValue) { - vcHeaderValue = /.*\((.*)\)$/.exec(navigator.userAgent)[1]; - } - execXhr.setRequestHeader('vc', vcHeaderValue); - execXhr.setRequestHeader('rc', ++requestCount); - if (shouldBundleCommandJson()) { - execXhr.setRequestHeader('cmds', iOSExec.nativeFetchMessages()); +// CB-10106 +function handleBridgeChange() { + if (proxyChanged()) { + var commandString = commandQueue.shift(); + while(commandString) { + var command = JSON.parse(commandString); + var callbackId = command[0]; + var service = command[1]; + var action = command[2]; + var actionArgs = command[3]; + var callbacks = cordova.callbacks[callbackId] || {}; + + execProxy(callbacks.success, callbacks.fail, service, action, actionArgs); + + commandString = commandQueue.shift(); + }; + return true; } - execXhr.send(null); + + return false; } -function pokeNativeViaIframe() { +function pokeNative() { // CB-5488 - Don't attempt to create iframe before document.body is available. if (!document.body) { - setTimeout(pokeNativeViaIframe); + setTimeout(pokeNative); return; } - 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) - if (!execHashIframe) { - execHashIframe = document.createElement('iframe'); - execHashIframe.style.display = 'none'; - 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. - hashToggle = hashToggle ^ 3; - var hashValue = '%0' + hashToggle; - if (bridgeMode === jsToNativeModes.IFRAME_HASH_WITH_PAYLOAD) { - hashValue += iOSExec.nativeFetchMessages(); - } - execHashIframe.contentWindow.location.hash = hashValue; + + // Check if they've removed it from the DOM, and put it back if so. + if (execIframe && execIframe.contentWindow) { + execIframe.contentWindow.location = 'gap://ready'; } else { - // Check if they've removed it from the DOM, and put it back if so. - if (execIframe && execIframe.contentWindow) { - execIframe.contentWindow.location = 'gap://ready'; - } else { - 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). + execIframe = document.createElement('iframe'); + execIframe.style.display = 'none'; + execIframe.src = 'gap://ready'; + document.body.appendChild(execIframe); } -} - -iOSExec.jsToNativeModes = jsToNativeModes; - -iOSExec.setJsToNativeBridgeMode = function(mode) { - // Remove the iFrame since it may be no longer required, and its existence - // can trigger browser bugs. - // https://issues.apache.org/jira/browse/CB-593 - if (execIframe) { - if (execIframe.parentNode) { - execIframe.parentNode.removeChild(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) { + // CB-10106 - flush the queue on bridge change + if (!handleBridgeChange()) { + pokeNative(); + } } - execIframe = null; - } - bridgeMode = mode; -}; + }, 50); // Making this > 0 improves performance (marginally) in the normal case (where it doesn't fire). +} iOSExec.nativeFetchMessages = function() { // Stop listing for window detatch once native side confirms poke. @@ -301,11 +213,14 @@ iOSExec.nativeFetchMessages = function() { return json; }; -iOSExec.nativeCallback = function(callbackId, status, message, keepCallback) { +iOSExec.nativeCallback = function(callbackId, status, message, keepCallback, debug) { return iOSExec.nativeEvalAndFetch(function() { var success = status === 0 || status === 1; var args = convertMessageToArgsNativeToJs(message); - cordova.callbackFromNative(callbackId, success, status, args, keepCallback); + function nc2() { + cordova.callbackFromNative(callbackId, success, status, args, keepCallback); + } + setTimeout(nc2, 0); }); }; @@ -320,4 +235,28 @@ iOSExec.nativeEvalAndFetch = function(func) { } }; -module.exports = iOSExec; +// Proxy the exec for bridge changes. See CB-10106 + +function cordovaExec() { + var cexec = require('cordova/exec'); + var cexec_valid = (typeof cexec.nativeFetchMessages === 'function') && (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function'); + return (cexec_valid && execProxy !== cexec)? cexec : iOSExec; +} + +function execProxy() { + cordovaExec().apply(null, arguments); +}; + +execProxy.nativeFetchMessages = function() { + return cordovaExec().nativeFetchMessages.apply(null, arguments); +}; + +execProxy.nativeEvalAndFetch = function() { + return cordovaExec().nativeEvalAndFetch.apply(null, arguments); +}; + +execProxy.nativeCallback = function() { + return cordovaExec().nativeCallback.apply(null, arguments); +}; + +module.exports = execProxy; diff --git a/StoneIsland/platforms/ios/platform_www/cordova-js-src/platform.js b/StoneIsland/platforms/ios/platform_www/cordova-js-src/platform.js index 36529ba5..36529ba5 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/cordova-js-src/platform.js +++ b/StoneIsland/platforms/ios/platform_www/cordova-js-src/platform.js diff --git a/StoneIsland/platforms/ios/platform_www/cordova.js b/StoneIsland/platforms/ios/platform_www/cordova.js index 46ab90b7..9dce1f9f 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/cordova.js +++ b/StoneIsland/platforms/ios/platform_www/cordova.js @@ -1,5 +1,5 @@ // Platform: ios -// 49a8db57fa070d20ea7b304a53ffec3d7250c5af +// f28234fbc27c578b9a335f1dabfa2d1b96bfc03d /* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file @@ -19,7 +19,7 @@ under the License. */ ;(function() { -var PLATFORM_VERSION_BUILD_LABEL = '3.9.2'; +var PLATFORM_VERSION_BUILD_LABEL = '4.3.0'; // file: src/scripts/require.js /*jshint -W079 */ @@ -697,8 +697,13 @@ var Channel = function(type, sticky) { } }; -function forceFunction(f) { - if (typeof f != 'function') throw "Function required as first argument!"; +function checkSubscriptionArgument(argument) { + if (typeof argument !== "function" && typeof argument.handleEvent !== "function") { + throw new Error( + "Must provide a function or an EventListener object " + + "implementing the handleEvent interface." + ); + } } /** @@ -708,28 +713,39 @@ function forceFunction(f) { * and a guid that can be used to stop subscribing to the channel. * Returns the guid. */ -Channel.prototype.subscribe = function(f, c) { - // need a function to call - forceFunction(f); +Channel.prototype.subscribe = function(eventListenerOrFunction, eventListener) { + checkSubscriptionArgument(eventListenerOrFunction); + var handleEvent, guid; + + if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") { + // Received an EventListener object implementing the handleEvent interface + handleEvent = eventListenerOrFunction.handleEvent; + eventListener = eventListenerOrFunction; + } else { + // Received a function to handle event + handleEvent = eventListenerOrFunction; + } + if (this.state == 2) { - f.apply(c || this, this.fireArgs); + handleEvent.apply(eventListener || this, this.fireArgs); return; } - var func = f, - guid = f.observer_guid; - if (typeof c == "object") { func = utils.close(c, f); } + guid = eventListenerOrFunction.observer_guid; + if (typeof eventListener === "object") { + handleEvent = utils.close(eventListener, handleEvent); + } if (!guid) { - // first time any channel has seen this subscriber + // First time any channel has seen this subscriber guid = '' + nextGuid++; } - func.observer_guid = guid; - f.observer_guid = guid; + handleEvent.observer_guid = guid; + eventListenerOrFunction.observer_guid = guid; // Don't add the same handler more than once. if (!this.handlers[guid]) { - this.handlers[guid] = func; + this.handlers[guid] = handleEvent; this.numHandlers++; if (this.numHandlers == 1) { this.onHasSubscribersChange && this.onHasSubscribersChange(); @@ -740,12 +756,20 @@ Channel.prototype.subscribe = function(f, c) { /** * Unsubscribes the function with the given guid from the channel. */ -Channel.prototype.unsubscribe = function(f) { - // need a function to unsubscribe - forceFunction(f); +Channel.prototype.unsubscribe = function(eventListenerOrFunction) { + checkSubscriptionArgument(eventListenerOrFunction); + var handleEvent, guid, handler; + + if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") { + // Received an EventListener object implementing the handleEvent interface + handleEvent = eventListenerOrFunction.handleEvent; + } else { + // Received a function to handle event + handleEvent = eventListenerOrFunction; + } - var guid = f.observer_guid, - handler = this.handlers[guid]; + guid = handleEvent.observer_guid; + handler = this.handlers[guid]; if (handler) { delete this.handlers[guid]; this.numHandlers--; @@ -817,58 +841,23 @@ module.exports = channel; }); -// file: e:/cordova/cordova-ios/cordova-js-src/exec.js +// file: /Users/shazron/Documents/git/apache/cordova-ios/cordova-js-src/exec.js define("cordova/exec", function(require, exports, module) { +/*global require, module, atob, document */ + /** * Creates a gap bridge iframe used to notify the native code about queued * commands. */ var cordova = require('cordova'), - channel = require('cordova/channel'), utils = require('cordova/utils'), base64 = require('cordova/base64'), - // XHR mode does not work on iOS 4.2. - // XHR mode's main advantage is working around a bug in -webkit-scroll, which - // doesn't exist only on iOS 5.x devices. - // IFRAME_NAV is the fastest. - // IFRAME_HASH could be made to enable synchronous bridge calls if we wanted this feature. - jsToNativeModes = { - IFRAME_NAV: 0, // Default. Uses a new iframe for each poke. - // XHR bridge appears to be flaky sometimes: CB-3900, CB-3359, CB-5457, CB-4970, CB-4998, CB-5134 - XHR_NO_PAYLOAD: 1, // About the same speed as IFRAME_NAV. Performance not about the same as IFRAME_NAV, but more variable. - XHR_WITH_PAYLOAD: 2, // Flakey, and not as performant - XHR_OPTIONAL_PAYLOAD: 3, // Flakey, and not as performant - 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, // Slower than no payload. Maybe since it has to be URI encoded / decoded. - WK_WEBVIEW_BINDING: 6 // Only way that works for WKWebView :) - }, - bridgeMode, execIframe, - execHashIframe, - hashToggle = 1, - execXhr, - requestCount = 0, - vcHeaderValue = null, commandQueue = [], // Contains pending JS->Native messages. isInContextOfEvalJs = 0, failSafeTimerId = 0; -function shouldBundleCommandJson() { - if (bridgeMode === jsToNativeModes.XHR_WITH_PAYLOAD) { - return true; - } - if (bridgeMode === jsToNativeModes.XHR_OPTIONAL_PAYLOAD) { - var payloadLength = 0; - for (var i = 0; i < commandQueue.length; ++i) { - payloadLength += commandQueue[i].length; - } - // The value here was determined using the benchmark within CordovaLibApp on an iPad 3. - return payloadLength < 4500; - } - return false; -} - function massageArgsJsToNative(args) { if (!args || utils.typeName(args) != 'Array') { return args; @@ -919,17 +908,10 @@ function convertMessageToArgsNativeToJs(message) { } function iOSExec() { - if (bridgeMode === undefined) { - bridgeMode = jsToNativeModes.IFRAME_NAV; - } - - if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.cordova && window.webkit.messageHandlers.cordova.postMessage) { - bridgeMode = jsToNativeModes.WK_WEBVIEW_BINDING; - } - var successCallback, failCallback, service, action, actionArgs, splitCommand; + var successCallback, failCallback, service, action, actionArgs; var callbackId = null; - if (typeof arguments[0] !== "string") { + if (typeof arguments[0] !== 'string') { // FORMAT ONE successCallback = arguments[0]; failCallback = arguments[1]; @@ -943,18 +925,9 @@ function iOSExec() { // an invalid callbackId and passes it even if no callbacks were given. callbackId = 'INVALID'; } else { - // FORMAT TWO, REMOVED - try { - splitCommand = arguments[0].split("."); - action = splitCommand.pop(); - service = splitCommand.join("."); - actionArgs = Array.prototype.splice.call(arguments, 1); - - console.log('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + - "cordova.exec(null, null, \"" + service + "\", \"" + action + "\"," + JSON.stringify(actionArgs) + ");" - ); - return; - } catch (e) {} + throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + + 'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);' + ); } // If actionArgs is not provided, default to an empty array @@ -976,116 +949,79 @@ function iOSExec() { // effectively clone the command arguments in case they are mutated before // the command is executed. commandQueue.push(JSON.stringify(command)); - - if (bridgeMode === jsToNativeModes.WK_WEBVIEW_BINDING) { - window.webkit.messageHandlers.cordova.postMessage(command); - } else { - // If we're in the context of a stringByEvaluatingJavaScriptFromString call, - // then the queue will be flushed when it returns; no need for a poke. - // 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. - if (!isInContextOfEvalJs && commandQueue.length == 1) { - pokeNative(); - } + + // If we're in the context of a stringByEvaluatingJavaScriptFromString call, + // then the queue will be flushed when it returns; no need for a poke. + // 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. + if (!isInContextOfEvalJs && commandQueue.length == 1) { + pokeNative(); } } -function pokeNative() { - switch (bridgeMode) { - case jsToNativeModes.XHR_NO_PAYLOAD: - case jsToNativeModes.XHR_WITH_PAYLOAD: - case jsToNativeModes.XHR_OPTIONAL_PAYLOAD: - pokeNativeViaXhr(); - break; - default: // iframe-based. - pokeNativeViaIframe(); - } +// CB-10530 +function proxyChanged() { + var cexec = cordovaExec(); + + return (execProxy !== cexec && // proxy objects are different + iOSExec !== cexec // proxy object is not the current iOSExec + ); } -function pokeNativeViaXhr() { - // This prevents sending an XHR when there is already one being sent. - // This should happen only in rare circumstances (refer to unit tests). - if (execXhr && execXhr.readyState != 4) { - execXhr = null; - } - // Re-using the XHR improves exec() performance by about 10%. - execXhr = execXhr || new XMLHttpRequest(); - // Changing this to a GET will make the XHR reach the URIProtocol on 4.2. - // For some reason it still doesn't work though... - // Add a timestamp to the query param to prevent caching. - execXhr.open('HEAD', "/!gap_exec?" + (+new Date()), true); - if (!vcHeaderValue) { - vcHeaderValue = /.*\((.*)\)$/.exec(navigator.userAgent)[1]; - } - execXhr.setRequestHeader('vc', vcHeaderValue); - execXhr.setRequestHeader('rc', ++requestCount); - if (shouldBundleCommandJson()) { - execXhr.setRequestHeader('cmds', iOSExec.nativeFetchMessages()); +// CB-10106 +function handleBridgeChange() { + if (proxyChanged()) { + var commandString = commandQueue.shift(); + while(commandString) { + var command = JSON.parse(commandString); + var callbackId = command[0]; + var service = command[1]; + var action = command[2]; + var actionArgs = command[3]; + var callbacks = cordova.callbacks[callbackId] || {}; + + execProxy(callbacks.success, callbacks.fail, service, action, actionArgs); + + commandString = commandQueue.shift(); + }; + return true; } - execXhr.send(null); + + return false; } -function pokeNativeViaIframe() { +function pokeNative() { // CB-5488 - Don't attempt to create iframe before document.body is available. if (!document.body) { - setTimeout(pokeNativeViaIframe); + setTimeout(pokeNative); return; } - 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) - if (!execHashIframe) { - execHashIframe = document.createElement('iframe'); - execHashIframe.style.display = 'none'; - 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. - hashToggle = hashToggle ^ 3; - var hashValue = '%0' + hashToggle; - if (bridgeMode === jsToNativeModes.IFRAME_HASH_WITH_PAYLOAD) { - hashValue += iOSExec.nativeFetchMessages(); - } - execHashIframe.contentWindow.location.hash = hashValue; + + // Check if they've removed it from the DOM, and put it back if so. + if (execIframe && execIframe.contentWindow) { + execIframe.contentWindow.location = 'gap://ready'; } else { - // Check if they've removed it from the DOM, and put it back if so. - if (execIframe && execIframe.contentWindow) { - execIframe.contentWindow.location = 'gap://ready'; - } else { - 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). + execIframe = document.createElement('iframe'); + execIframe.style.display = 'none'; + execIframe.src = 'gap://ready'; + document.body.appendChild(execIframe); } -} - -iOSExec.jsToNativeModes = jsToNativeModes; - -iOSExec.setJsToNativeBridgeMode = function(mode) { - // Remove the iFrame since it may be no longer required, and its existence - // can trigger browser bugs. - // https://issues.apache.org/jira/browse/CB-593 - if (execIframe) { - if (execIframe.parentNode) { - execIframe.parentNode.removeChild(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) { + // CB-10106 - flush the queue on bridge change + if (!handleBridgeChange()) { + pokeNative(); + } } - execIframe = null; - } - bridgeMode = mode; -}; + }, 50); // Making this > 0 improves performance (marginally) in the normal case (where it doesn't fire). +} iOSExec.nativeFetchMessages = function() { // Stop listing for window detatch once native side confirms poke. @@ -1102,11 +1038,14 @@ iOSExec.nativeFetchMessages = function() { return json; }; -iOSExec.nativeCallback = function(callbackId, status, message, keepCallback) { +iOSExec.nativeCallback = function(callbackId, status, message, keepCallback, debug) { return iOSExec.nativeEvalAndFetch(function() { var success = status === 0 || status === 1; var args = convertMessageToArgsNativeToJs(message); - cordova.callbackFromNative(callbackId, success, status, args, keepCallback); + function nc2() { + cordova.callbackFromNative(callbackId, success, status, args, keepCallback); + } + setTimeout(nc2, 0); }); }; @@ -1121,7 +1060,31 @@ iOSExec.nativeEvalAndFetch = function(func) { } }; -module.exports = iOSExec; +// Proxy the exec for bridge changes. See CB-10106 + +function cordovaExec() { + var cexec = require('cordova/exec'); + var cexec_valid = (typeof cexec.nativeFetchMessages === 'function') && (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function'); + return (cexec_valid && execProxy !== cexec)? cexec : iOSExec; +} + +function execProxy() { + cordovaExec().apply(null, arguments); +}; + +execProxy.nativeFetchMessages = function() { + return cordovaExec().nativeFetchMessages.apply(null, arguments); +}; + +execProxy.nativeEvalAndFetch = function() { + return cordovaExec().nativeEvalAndFetch.apply(null, arguments); +}; + +execProxy.nativeCallback = function() { + return cordovaExec().nativeCallback.apply(null, arguments); +}; + +module.exports = execProxy; }); @@ -1606,7 +1569,7 @@ exports.reset(); }); -// file: e:/cordova/cordova-ios/cordova-js-src/platform.js +// file: /Users/shazron/Documents/git/apache/cordova-ios/cordova-js-src/platform.js define("cordova/platform", function(require, exports, module) { module.exports = { @@ -1888,7 +1851,10 @@ utils.clone = function(obj) { retVal = {}; for(i in obj){ - if(!(i in retVal) || retVal[i] != obj[i]) { + // https://issues.apache.org/jira/browse/CB-11522 'unknown' type may be returned in + // custom protocol activation case on Windows Phone 8.1 causing "No such interface supported" exception + // on cloning. + if((!(i in retVal) || retVal[i] != obj[i]) && typeof obj[i] != 'undefined' && typeof obj[i] != 'unknown') { retVal[i] = utils.clone(obj[i]); } } diff --git a/StoneIsland/platforms/ios/platform_www/cordova_plugins.js b/StoneIsland/platforms/ios/platform_www/cordova_plugins.js index ba2c072d..c17b360b 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/cordova_plugins.js +++ b/StoneIsland/platforms/ios/platform_www/cordova_plugins.js @@ -1,88 +1,105 @@ cordova.define('cordova/plugin_list', function(require, exports, module) { module.exports = [ { - "file": "plugins/com.ionic.keyboard/www/keyboard.js", "id": "com.ionic.keyboard.keyboard", + "file": "plugins/com.ionic.keyboard/www/keyboard.js", "pluginId": "com.ionic.keyboard", "clobbers": [ "cordova.plugins.Keyboard" ] }, { - "file": "plugins/cordova-plugin-console/www/logger.js", + "id": "com.parse.cordova.core.pushplugin.ParsePlugin", + "file": "plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js", + "pluginId": "com.parse.cordova.core.pushplugin", + "clobbers": [ + "window.parsePlugin" + ] + }, + { "id": "cordova-plugin-console.logger", + "file": "plugins/cordova-plugin-console/www/logger.js", "pluginId": "cordova-plugin-console", "clobbers": [ "cordova.logger" ] }, { - "file": "plugins/cordova-plugin-console/www/console-via-logger.js", "id": "cordova-plugin-console.console", + "file": "plugins/cordova-plugin-console/www/console-via-logger.js", "pluginId": "cordova-plugin-console", "clobbers": [ "console" ] }, { - "file": "plugins/cordova-plugin-customurlscheme/www/ios/LaunchMyApp.js", "id": "cordova-plugin-customurlscheme.LaunchMyApp", + "file": "plugins/cordova-plugin-customurlscheme/www/ios/LaunchMyApp.js", "pluginId": "cordova-plugin-customurlscheme", "clobbers": [ "window.plugins.launchmyapp" ] }, { - "file": "plugins/cordova-plugin-device/www/device.js", "id": "cordova-plugin-device.device", + "file": "plugins/cordova-plugin-device/www/device.js", "pluginId": "cordova-plugin-device", "clobbers": [ "device" ] }, { - "file": "plugins/cordova-plugin-dialogs/www/notification.js", "id": "cordova-plugin-dialogs.notification", + "file": "plugins/cordova-plugin-dialogs/www/notification.js", "pluginId": "cordova-plugin-dialogs", "merges": [ "navigator.notification" ] }, { - "file": "plugins/cordova-plugin-geolocation/www/Coordinates.js", "id": "cordova-plugin-geolocation.Coordinates", + "file": "plugins/cordova-plugin-geolocation/www/Coordinates.js", "pluginId": "cordova-plugin-geolocation", "clobbers": [ "Coordinates" ] }, { - "file": "plugins/cordova-plugin-geolocation/www/PositionError.js", "id": "cordova-plugin-geolocation.PositionError", + "file": "plugins/cordova-plugin-geolocation/www/PositionError.js", "pluginId": "cordova-plugin-geolocation", "clobbers": [ "PositionError" ] }, { - "file": "plugins/cordova-plugin-geolocation/www/Position.js", "id": "cordova-plugin-geolocation.Position", + "file": "plugins/cordova-plugin-geolocation/www/Position.js", "pluginId": "cordova-plugin-geolocation", "clobbers": [ "Position" ] }, { - "file": "plugins/cordova-plugin-geolocation/www/geolocation.js", "id": "cordova-plugin-geolocation.geolocation", + "file": "plugins/cordova-plugin-geolocation/www/geolocation.js", "pluginId": "cordova-plugin-geolocation", "clobbers": [ "navigator.geolocation" ] }, { - "file": "plugins/cordova-plugin-network-information/www/network.js", + "id": "cordova-plugin-inappbrowser.inappbrowser", + "file": "plugins/cordova-plugin-inappbrowser/www/inappbrowser.js", + "pluginId": "cordova-plugin-inappbrowser", + "clobbers": [ + "cordova.InAppBrowser.open", + "window.open" + ] + }, + { "id": "cordova-plugin-network-information.network", + "file": "plugins/cordova-plugin-network-information/www/network.js", "pluginId": "cordova-plugin-network-information", "clobbers": [ "navigator.connection", @@ -90,71 +107,54 @@ module.exports = [ ] }, { - "file": "plugins/cordova-plugin-network-information/www/Connection.js", "id": "cordova-plugin-network-information.Connection", + "file": "plugins/cordova-plugin-network-information/www/Connection.js", "pluginId": "cordova-plugin-network-information", "clobbers": [ "Connection" ] }, { - "file": "plugins/cordova-plugin-splashscreen/www/splashscreen.js", "id": "cordova-plugin-splashscreen.SplashScreen", + "file": "plugins/cordova-plugin-splashscreen/www/splashscreen.js", "pluginId": "cordova-plugin-splashscreen", "clobbers": [ "navigator.splashscreen" ] }, { - "file": "plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js", "id": "cordova-plugin-x-socialsharing.SocialSharing", + "file": "plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js", "pluginId": "cordova-plugin-x-socialsharing", "clobbers": [ "window.plugins.socialsharing" ] }, { - "file": "plugins/phonegap-plugin-push/www/push.js", "id": "phonegap-plugin-push.PushNotification", + "file": "plugins/phonegap-plugin-push/www/push.js", "pluginId": "phonegap-plugin-push", "clobbers": [ "PushNotification" ] - }, - { - "file": "plugins/cordova-plugin-inappbrowser/www/inappbrowser.js", - "id": "cordova-plugin-inappbrowser.inappbrowser", - "pluginId": "cordova-plugin-inappbrowser", - "clobbers": [ - "cordova.InAppBrowser.open", - "window.open" - ] - }, - { - "file": "plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js", - "id": "com.parse.cordova.core.pushplugin.ParsePlugin", - "pluginId": "com.parse.cordova.core.pushplugin", - "clobbers": [ - "window.parsePlugin" - ] } ]; module.exports.metadata = // TOP OF METADATA { "com.ionic.keyboard": "1.0.4", + "com.parse.cordova.core.pushplugin": "0.1.0", "cordova-plugin-console": "1.0.1", "cordova-plugin-customurlscheme": "4.0.0", "cordova-plugin-device": "1.0.1", "cordova-plugin-dialogs": "1.1.1", "cordova-plugin-geolocation": "1.0.1", + "cordova-plugin-inappbrowser": "1.1.0", "cordova-plugin-network-information": "1.0.1", - "cordova-plugin-splashscreen": "2.1.0", + "cordova-plugin-splashscreen": "3.0.0", "cordova-plugin-whitelist": "1.0.0", "cordova-plugin-x-socialsharing": "5.0.7", - "phonegap-plugin-push": "1.4.4", - "cordova-plugin-inappbrowser": "1.1.0", - "com.parse.cordova.core.pushplugin": "0.1.0" -} + "phonegap-plugin-push": "1.4.4" +}; // BOTTOM OF METADATA });
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/platform_www/plugins/com.ionic.keyboard/www/keyboard.js b/StoneIsland/platforms/ios/platform_www/plugins/com.ionic.keyboard/www/keyboard.js index 7d30ba59..ad09ae2d 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/com.ionic.keyboard/www/keyboard.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/com.ionic.keyboard/www/keyboard.js @@ -1,4 +1,5 @@ -cordova.define("com.ionic.keyboard.keyboard", function(require, exports, module) { +cordova.define("com.ionic.keyboard.keyboard", function(require, exports, module) { + var argscheck = require('cordova/argscheck'), utils = require('cordova/utils'), exec = require('cordova/exec'); diff --git a/StoneIsland/platforms/ios/platform_www/plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js b/StoneIsland/platforms/ios/platform_www/plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js index e732f80d..983c4764 100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js @@ -1,4 +1,5 @@ -cordova.define("com.parse.cordova.core.pushplugin.ParsePlugin", function(require, exports, module) { var parsePlugin = { +cordova.define("com.parse.cordova.core.pushplugin.ParsePlugin", function(require, exports, module) { +var parsePlugin = { registerCallback: function(ecb, successCallback, errorCallback) { cordova.exec( diff --git a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-console/www/console-via-logger.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-console/www/console-via-logger.js index 0ce8cea8..f7de4b64 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-console/www/console-via-logger.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-console/www/console-via-logger.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-console.console", function(require, exports, module) { /* +cordova.define("cordova-plugin-console.console", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-console/www/logger.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-console/www/logger.js index 7a9a75d3..dd42c01d 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-console/www/logger.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-console/www/logger.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-console.logger", function(require, exports, module) { /* +cordova.define("cordova-plugin-console.logger", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-customurlscheme/www/ios/LaunchMyApp.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-customurlscheme/www/ios/LaunchMyApp.js index 3568c73f..72fee9e3 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-customurlscheme/www/ios/LaunchMyApp.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-customurlscheme/www/ios/LaunchMyApp.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-customurlscheme.LaunchMyApp", function(require, exports, module) { "use strict"; +cordova.define("cordova-plugin-customurlscheme.LaunchMyApp", function(require, exports, module) { +"use strict"; /* Q: Why an empty file? diff --git a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-device/www/device.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-device/www/device.js index 023bafd2..775c123f 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-device/www/device.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-device/www/device.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-device.device", function(require, exports, module) { /* +cordova.define("cordova-plugin-device.device", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-dialogs/www/notification.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-dialogs/www/notification.js index ea97eefb..adc5c077 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-dialogs/www/notification.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-dialogs/www/notification.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-dialogs.notification", function(require, exports, module) { /* +cordova.define("cordova-plugin-dialogs.notification", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-geolocation/www/Coordinates.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-geolocation/www/Coordinates.js index f7255659..4a995077 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-geolocation/www/Coordinates.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-geolocation/www/Coordinates.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-geolocation.Coordinates", function(require, exports, module) { /* +cordova.define("cordova-plugin-geolocation.Coordinates", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-geolocation/www/Position.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-geolocation/www/Position.js index 206bf8b4..116abb4f 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-geolocation/www/Position.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-geolocation/www/Position.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-geolocation.Position", function(require, exports, module) { /* +cordova.define("cordova-plugin-geolocation.Position", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-geolocation/www/PositionError.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-geolocation/www/PositionError.js index 11ffe491..c335381e 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-geolocation/www/PositionError.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-geolocation/www/PositionError.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-geolocation.PositionError", function(require, exports, module) { /* +cordova.define("cordova-plugin-geolocation.PositionError", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-geolocation/www/geolocation.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-geolocation/www/geolocation.js index ec9bb6e8..37bdaabb 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-geolocation/www/geolocation.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-geolocation/www/geolocation.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-geolocation.geolocation", function(require, exports, module) { /* +cordova.define("cordova-plugin-geolocation.geolocation", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js index 6c7a844a..b18a2ba7 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-inappbrowser.inappbrowser", function(require, exports, module) { /* +cordova.define("cordova-plugin-inappbrowser.inappbrowser", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-network-information/www/Connection.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-network-information/www/Connection.js index 1450e953..5f7279c5 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-network-information/www/Connection.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-network-information/www/Connection.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-network-information.Connection", function(require, exports, module) { /* +cordova.define("cordova-plugin-network-information.Connection", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-network-information/www/network.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-network-information/www/network.js index bfac2e3f..770e6ba5 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-network-information/www/network.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-network-information/www/network.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-network-information.network", function(require, exports, module) { /* +cordova.define("cordova-plugin-network-information.network", function(require, exports, module) { +/* * 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 diff --git a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-splashscreen/www/splashscreen.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-splashscreen/www/splashscreen.js index 0e6a10af..5beaa5fd 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-splashscreen/www/splashscreen.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-splashscreen/www/splashscreen.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-splashscreen.SplashScreen", function(require, exports, module) { /* +cordova.define("cordova-plugin-splashscreen.SplashScreen", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js index aa82acf6..2e1295cd 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-x-socialsharing.SocialSharing", function(require, exports, module) { var cordova = require('cordova'); +cordova.define("cordova-plugin-x-socialsharing.SocialSharing", function(require, exports, module) { +var cordova = require('cordova'); function SocialSharing() { } diff --git a/StoneIsland/platforms/ios/platform_www/plugins/phonegap-plugin-push/www/push.js b/StoneIsland/platforms/ios/platform_www/plugins/phonegap-plugin-push/www/push.js index 7aa30fd7..ea60bc9f 100755..100644 --- a/StoneIsland/platforms/ios/platform_www/plugins/phonegap-plugin-push/www/push.js +++ b/StoneIsland/platforms/ios/platform_www/plugins/phonegap-plugin-push/www/push.js @@ -1,4 +1,5 @@ -cordova.define("phonegap-plugin-push.PushNotification", function(require, exports, module) { /* global cordova:false */ +cordova.define("phonegap-plugin-push.PushNotification", function(require, exports, module) { +/* global cordova:false */ /*! * Module dependencies. diff --git a/StoneIsland/platforms/ios/pods-debug.xcconfig b/StoneIsland/platforms/ios/pods-debug.xcconfig new file mode 100644 index 00000000..12c70651 --- /dev/null +++ b/StoneIsland/platforms/ios/pods-debug.xcconfig @@ -0,0 +1,20 @@ +// +// 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. +// + +// DO NOT MODIFY -- auto-generated by Apache Cordova diff --git a/StoneIsland/platforms/ios/pods-release.xcconfig b/StoneIsland/platforms/ios/pods-release.xcconfig new file mode 100644 index 00000000..12e2b13f --- /dev/null +++ b/StoneIsland/platforms/ios/pods-release.xcconfig @@ -0,0 +1,20 @@ +// +// 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. +// + +// DO NOT MODIFY -- auto-generated by Apache Cordova
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/cordova-js-src/exec.js b/StoneIsland/platforms/ios/www/cordova-js-src/exec.js index 32a3f8b5..3fb7fa19 100755..100644 --- a/StoneIsland/platforms/ios/www/cordova-js-src/exec.js +++ b/StoneIsland/platforms/ios/www/cordova-js-src/exec.js @@ -19,55 +19,20 @@ * */ +/*global require, module, atob, document */ + /** * Creates a gap bridge iframe used to notify the native code about queued * commands. */ var cordova = require('cordova'), - channel = require('cordova/channel'), utils = require('cordova/utils'), base64 = require('cordova/base64'), - // XHR mode does not work on iOS 4.2. - // XHR mode's main advantage is working around a bug in -webkit-scroll, which - // doesn't exist only on iOS 5.x devices. - // IFRAME_NAV is the fastest. - // IFRAME_HASH could be made to enable synchronous bridge calls if we wanted this feature. - jsToNativeModes = { - IFRAME_NAV: 0, // Default. Uses a new iframe for each poke. - // XHR bridge appears to be flaky sometimes: CB-3900, CB-3359, CB-5457, CB-4970, CB-4998, CB-5134 - XHR_NO_PAYLOAD: 1, // About the same speed as IFRAME_NAV. Performance not about the same as IFRAME_NAV, but more variable. - XHR_WITH_PAYLOAD: 2, // Flakey, and not as performant - XHR_OPTIONAL_PAYLOAD: 3, // Flakey, and not as performant - 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, // Slower than no payload. Maybe since it has to be URI encoded / decoded. - WK_WEBVIEW_BINDING: 6 // Only way that works for WKWebView :) - }, - bridgeMode, execIframe, - execHashIframe, - hashToggle = 1, - execXhr, - requestCount = 0, - vcHeaderValue = null, commandQueue = [], // Contains pending JS->Native messages. isInContextOfEvalJs = 0, failSafeTimerId = 0; -function shouldBundleCommandJson() { - if (bridgeMode === jsToNativeModes.XHR_WITH_PAYLOAD) { - return true; - } - if (bridgeMode === jsToNativeModes.XHR_OPTIONAL_PAYLOAD) { - var payloadLength = 0; - for (var i = 0; i < commandQueue.length; ++i) { - payloadLength += commandQueue[i].length; - } - // The value here was determined using the benchmark within CordovaLibApp on an iPad 3. - return payloadLength < 4500; - } - return false; -} - function massageArgsJsToNative(args) { if (!args || utils.typeName(args) != 'Array') { return args; @@ -118,17 +83,10 @@ function convertMessageToArgsNativeToJs(message) { } function iOSExec() { - if (bridgeMode === undefined) { - bridgeMode = jsToNativeModes.IFRAME_NAV; - } - - if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.cordova && window.webkit.messageHandlers.cordova.postMessage) { - bridgeMode = jsToNativeModes.WK_WEBVIEW_BINDING; - } - var successCallback, failCallback, service, action, actionArgs, splitCommand; + var successCallback, failCallback, service, action, actionArgs; var callbackId = null; - if (typeof arguments[0] !== "string") { + if (typeof arguments[0] !== 'string') { // FORMAT ONE successCallback = arguments[0]; failCallback = arguments[1]; @@ -142,18 +100,9 @@ function iOSExec() { // an invalid callbackId and passes it even if no callbacks were given. callbackId = 'INVALID'; } else { - // FORMAT TWO, REMOVED - try { - splitCommand = arguments[0].split("."); - action = splitCommand.pop(); - service = splitCommand.join("."); - actionArgs = Array.prototype.splice.call(arguments, 1); - - console.log('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + - "cordova.exec(null, null, \"" + service + "\", \"" + action + "\"," + JSON.stringify(actionArgs) + ");" - ); - return; - } catch (e) {} + throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + + 'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);' + ); } // If actionArgs is not provided, default to an empty array @@ -175,116 +124,79 @@ function iOSExec() { // effectively clone the command arguments in case they are mutated before // the command is executed. commandQueue.push(JSON.stringify(command)); - - if (bridgeMode === jsToNativeModes.WK_WEBVIEW_BINDING) { - window.webkit.messageHandlers.cordova.postMessage(command); - } else { - // If we're in the context of a stringByEvaluatingJavaScriptFromString call, - // then the queue will be flushed when it returns; no need for a poke. - // 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. - if (!isInContextOfEvalJs && commandQueue.length == 1) { - pokeNative(); - } + + // If we're in the context of a stringByEvaluatingJavaScriptFromString call, + // then the queue will be flushed when it returns; no need for a poke. + // 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. + if (!isInContextOfEvalJs && commandQueue.length == 1) { + pokeNative(); } } -function pokeNative() { - switch (bridgeMode) { - case jsToNativeModes.XHR_NO_PAYLOAD: - case jsToNativeModes.XHR_WITH_PAYLOAD: - case jsToNativeModes.XHR_OPTIONAL_PAYLOAD: - pokeNativeViaXhr(); - break; - default: // iframe-based. - pokeNativeViaIframe(); - } +// CB-10530 +function proxyChanged() { + var cexec = cordovaExec(); + + return (execProxy !== cexec && // proxy objects are different + iOSExec !== cexec // proxy object is not the current iOSExec + ); } -function pokeNativeViaXhr() { - // This prevents sending an XHR when there is already one being sent. - // This should happen only in rare circumstances (refer to unit tests). - if (execXhr && execXhr.readyState != 4) { - execXhr = null; - } - // Re-using the XHR improves exec() performance by about 10%. - execXhr = execXhr || new XMLHttpRequest(); - // Changing this to a GET will make the XHR reach the URIProtocol on 4.2. - // For some reason it still doesn't work though... - // Add a timestamp to the query param to prevent caching. - execXhr.open('HEAD', "/!gap_exec?" + (+new Date()), true); - if (!vcHeaderValue) { - vcHeaderValue = /.*\((.*)\)$/.exec(navigator.userAgent)[1]; - } - execXhr.setRequestHeader('vc', vcHeaderValue); - execXhr.setRequestHeader('rc', ++requestCount); - if (shouldBundleCommandJson()) { - execXhr.setRequestHeader('cmds', iOSExec.nativeFetchMessages()); +// CB-10106 +function handleBridgeChange() { + if (proxyChanged()) { + var commandString = commandQueue.shift(); + while(commandString) { + var command = JSON.parse(commandString); + var callbackId = command[0]; + var service = command[1]; + var action = command[2]; + var actionArgs = command[3]; + var callbacks = cordova.callbacks[callbackId] || {}; + + execProxy(callbacks.success, callbacks.fail, service, action, actionArgs); + + commandString = commandQueue.shift(); + }; + return true; } - execXhr.send(null); + + return false; } -function pokeNativeViaIframe() { +function pokeNative() { // CB-5488 - Don't attempt to create iframe before document.body is available. if (!document.body) { - setTimeout(pokeNativeViaIframe); + setTimeout(pokeNative); return; } - 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) - if (!execHashIframe) { - execHashIframe = document.createElement('iframe'); - execHashIframe.style.display = 'none'; - 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. - hashToggle = hashToggle ^ 3; - var hashValue = '%0' + hashToggle; - if (bridgeMode === jsToNativeModes.IFRAME_HASH_WITH_PAYLOAD) { - hashValue += iOSExec.nativeFetchMessages(); - } - execHashIframe.contentWindow.location.hash = hashValue; + + // Check if they've removed it from the DOM, and put it back if so. + if (execIframe && execIframe.contentWindow) { + execIframe.contentWindow.location = 'gap://ready'; } else { - // Check if they've removed it from the DOM, and put it back if so. - if (execIframe && execIframe.contentWindow) { - execIframe.contentWindow.location = 'gap://ready'; - } else { - 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). + execIframe = document.createElement('iframe'); + execIframe.style.display = 'none'; + execIframe.src = 'gap://ready'; + document.body.appendChild(execIframe); } -} - -iOSExec.jsToNativeModes = jsToNativeModes; - -iOSExec.setJsToNativeBridgeMode = function(mode) { - // Remove the iFrame since it may be no longer required, and its existence - // can trigger browser bugs. - // https://issues.apache.org/jira/browse/CB-593 - if (execIframe) { - if (execIframe.parentNode) { - execIframe.parentNode.removeChild(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) { + // CB-10106 - flush the queue on bridge change + if (!handleBridgeChange()) { + pokeNative(); + } } - execIframe = null; - } - bridgeMode = mode; -}; + }, 50); // Making this > 0 improves performance (marginally) in the normal case (where it doesn't fire). +} iOSExec.nativeFetchMessages = function() { // Stop listing for window detatch once native side confirms poke. @@ -301,11 +213,14 @@ iOSExec.nativeFetchMessages = function() { return json; }; -iOSExec.nativeCallback = function(callbackId, status, message, keepCallback) { +iOSExec.nativeCallback = function(callbackId, status, message, keepCallback, debug) { return iOSExec.nativeEvalAndFetch(function() { var success = status === 0 || status === 1; var args = convertMessageToArgsNativeToJs(message); - cordova.callbackFromNative(callbackId, success, status, args, keepCallback); + function nc2() { + cordova.callbackFromNative(callbackId, success, status, args, keepCallback); + } + setTimeout(nc2, 0); }); }; @@ -320,4 +235,28 @@ iOSExec.nativeEvalAndFetch = function(func) { } }; -module.exports = iOSExec; +// Proxy the exec for bridge changes. See CB-10106 + +function cordovaExec() { + var cexec = require('cordova/exec'); + var cexec_valid = (typeof cexec.nativeFetchMessages === 'function') && (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function'); + return (cexec_valid && execProxy !== cexec)? cexec : iOSExec; +} + +function execProxy() { + cordovaExec().apply(null, arguments); +}; + +execProxy.nativeFetchMessages = function() { + return cordovaExec().nativeFetchMessages.apply(null, arguments); +}; + +execProxy.nativeEvalAndFetch = function() { + return cordovaExec().nativeEvalAndFetch.apply(null, arguments); +}; + +execProxy.nativeCallback = function() { + return cordovaExec().nativeCallback.apply(null, arguments); +}; + +module.exports = execProxy; diff --git a/StoneIsland/platforms/ios/www/cordova-js-src/platform.js b/StoneIsland/platforms/ios/www/cordova-js-src/platform.js index 36529ba5..36529ba5 100755..100644 --- a/StoneIsland/platforms/ios/www/cordova-js-src/platform.js +++ b/StoneIsland/platforms/ios/www/cordova-js-src/platform.js diff --git a/StoneIsland/platforms/ios/www/cordova.js b/StoneIsland/platforms/ios/www/cordova.js index 46ab90b7..9dce1f9f 100755..100644 --- a/StoneIsland/platforms/ios/www/cordova.js +++ b/StoneIsland/platforms/ios/www/cordova.js @@ -1,5 +1,5 @@ // Platform: ios -// 49a8db57fa070d20ea7b304a53ffec3d7250c5af +// f28234fbc27c578b9a335f1dabfa2d1b96bfc03d /* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file @@ -19,7 +19,7 @@ under the License. */ ;(function() { -var PLATFORM_VERSION_BUILD_LABEL = '3.9.2'; +var PLATFORM_VERSION_BUILD_LABEL = '4.3.0'; // file: src/scripts/require.js /*jshint -W079 */ @@ -697,8 +697,13 @@ var Channel = function(type, sticky) { } }; -function forceFunction(f) { - if (typeof f != 'function') throw "Function required as first argument!"; +function checkSubscriptionArgument(argument) { + if (typeof argument !== "function" && typeof argument.handleEvent !== "function") { + throw new Error( + "Must provide a function or an EventListener object " + + "implementing the handleEvent interface." + ); + } } /** @@ -708,28 +713,39 @@ function forceFunction(f) { * and a guid that can be used to stop subscribing to the channel. * Returns the guid. */ -Channel.prototype.subscribe = function(f, c) { - // need a function to call - forceFunction(f); +Channel.prototype.subscribe = function(eventListenerOrFunction, eventListener) { + checkSubscriptionArgument(eventListenerOrFunction); + var handleEvent, guid; + + if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") { + // Received an EventListener object implementing the handleEvent interface + handleEvent = eventListenerOrFunction.handleEvent; + eventListener = eventListenerOrFunction; + } else { + // Received a function to handle event + handleEvent = eventListenerOrFunction; + } + if (this.state == 2) { - f.apply(c || this, this.fireArgs); + handleEvent.apply(eventListener || this, this.fireArgs); return; } - var func = f, - guid = f.observer_guid; - if (typeof c == "object") { func = utils.close(c, f); } + guid = eventListenerOrFunction.observer_guid; + if (typeof eventListener === "object") { + handleEvent = utils.close(eventListener, handleEvent); + } if (!guid) { - // first time any channel has seen this subscriber + // First time any channel has seen this subscriber guid = '' + nextGuid++; } - func.observer_guid = guid; - f.observer_guid = guid; + handleEvent.observer_guid = guid; + eventListenerOrFunction.observer_guid = guid; // Don't add the same handler more than once. if (!this.handlers[guid]) { - this.handlers[guid] = func; + this.handlers[guid] = handleEvent; this.numHandlers++; if (this.numHandlers == 1) { this.onHasSubscribersChange && this.onHasSubscribersChange(); @@ -740,12 +756,20 @@ Channel.prototype.subscribe = function(f, c) { /** * Unsubscribes the function with the given guid from the channel. */ -Channel.prototype.unsubscribe = function(f) { - // need a function to unsubscribe - forceFunction(f); +Channel.prototype.unsubscribe = function(eventListenerOrFunction) { + checkSubscriptionArgument(eventListenerOrFunction); + var handleEvent, guid, handler; + + if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") { + // Received an EventListener object implementing the handleEvent interface + handleEvent = eventListenerOrFunction.handleEvent; + } else { + // Received a function to handle event + handleEvent = eventListenerOrFunction; + } - var guid = f.observer_guid, - handler = this.handlers[guid]; + guid = handleEvent.observer_guid; + handler = this.handlers[guid]; if (handler) { delete this.handlers[guid]; this.numHandlers--; @@ -817,58 +841,23 @@ module.exports = channel; }); -// file: e:/cordova/cordova-ios/cordova-js-src/exec.js +// file: /Users/shazron/Documents/git/apache/cordova-ios/cordova-js-src/exec.js define("cordova/exec", function(require, exports, module) { +/*global require, module, atob, document */ + /** * Creates a gap bridge iframe used to notify the native code about queued * commands. */ var cordova = require('cordova'), - channel = require('cordova/channel'), utils = require('cordova/utils'), base64 = require('cordova/base64'), - // XHR mode does not work on iOS 4.2. - // XHR mode's main advantage is working around a bug in -webkit-scroll, which - // doesn't exist only on iOS 5.x devices. - // IFRAME_NAV is the fastest. - // IFRAME_HASH could be made to enable synchronous bridge calls if we wanted this feature. - jsToNativeModes = { - IFRAME_NAV: 0, // Default. Uses a new iframe for each poke. - // XHR bridge appears to be flaky sometimes: CB-3900, CB-3359, CB-5457, CB-4970, CB-4998, CB-5134 - XHR_NO_PAYLOAD: 1, // About the same speed as IFRAME_NAV. Performance not about the same as IFRAME_NAV, but more variable. - XHR_WITH_PAYLOAD: 2, // Flakey, and not as performant - XHR_OPTIONAL_PAYLOAD: 3, // Flakey, and not as performant - 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, // Slower than no payload. Maybe since it has to be URI encoded / decoded. - WK_WEBVIEW_BINDING: 6 // Only way that works for WKWebView :) - }, - bridgeMode, execIframe, - execHashIframe, - hashToggle = 1, - execXhr, - requestCount = 0, - vcHeaderValue = null, commandQueue = [], // Contains pending JS->Native messages. isInContextOfEvalJs = 0, failSafeTimerId = 0; -function shouldBundleCommandJson() { - if (bridgeMode === jsToNativeModes.XHR_WITH_PAYLOAD) { - return true; - } - if (bridgeMode === jsToNativeModes.XHR_OPTIONAL_PAYLOAD) { - var payloadLength = 0; - for (var i = 0; i < commandQueue.length; ++i) { - payloadLength += commandQueue[i].length; - } - // The value here was determined using the benchmark within CordovaLibApp on an iPad 3. - return payloadLength < 4500; - } - return false; -} - function massageArgsJsToNative(args) { if (!args || utils.typeName(args) != 'Array') { return args; @@ -919,17 +908,10 @@ function convertMessageToArgsNativeToJs(message) { } function iOSExec() { - if (bridgeMode === undefined) { - bridgeMode = jsToNativeModes.IFRAME_NAV; - } - - if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.cordova && window.webkit.messageHandlers.cordova.postMessage) { - bridgeMode = jsToNativeModes.WK_WEBVIEW_BINDING; - } - var successCallback, failCallback, service, action, actionArgs, splitCommand; + var successCallback, failCallback, service, action, actionArgs; var callbackId = null; - if (typeof arguments[0] !== "string") { + if (typeof arguments[0] !== 'string') { // FORMAT ONE successCallback = arguments[0]; failCallback = arguments[1]; @@ -943,18 +925,9 @@ function iOSExec() { // an invalid callbackId and passes it even if no callbacks were given. callbackId = 'INVALID'; } else { - // FORMAT TWO, REMOVED - try { - splitCommand = arguments[0].split("."); - action = splitCommand.pop(); - service = splitCommand.join("."); - actionArgs = Array.prototype.splice.call(arguments, 1); - - console.log('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + - "cordova.exec(null, null, \"" + service + "\", \"" + action + "\"," + JSON.stringify(actionArgs) + ");" - ); - return; - } catch (e) {} + throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + + 'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);' + ); } // If actionArgs is not provided, default to an empty array @@ -976,116 +949,79 @@ function iOSExec() { // effectively clone the command arguments in case they are mutated before // the command is executed. commandQueue.push(JSON.stringify(command)); - - if (bridgeMode === jsToNativeModes.WK_WEBVIEW_BINDING) { - window.webkit.messageHandlers.cordova.postMessage(command); - } else { - // If we're in the context of a stringByEvaluatingJavaScriptFromString call, - // then the queue will be flushed when it returns; no need for a poke. - // 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. - if (!isInContextOfEvalJs && commandQueue.length == 1) { - pokeNative(); - } + + // If we're in the context of a stringByEvaluatingJavaScriptFromString call, + // then the queue will be flushed when it returns; no need for a poke. + // 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. + if (!isInContextOfEvalJs && commandQueue.length == 1) { + pokeNative(); } } -function pokeNative() { - switch (bridgeMode) { - case jsToNativeModes.XHR_NO_PAYLOAD: - case jsToNativeModes.XHR_WITH_PAYLOAD: - case jsToNativeModes.XHR_OPTIONAL_PAYLOAD: - pokeNativeViaXhr(); - break; - default: // iframe-based. - pokeNativeViaIframe(); - } +// CB-10530 +function proxyChanged() { + var cexec = cordovaExec(); + + return (execProxy !== cexec && // proxy objects are different + iOSExec !== cexec // proxy object is not the current iOSExec + ); } -function pokeNativeViaXhr() { - // This prevents sending an XHR when there is already one being sent. - // This should happen only in rare circumstances (refer to unit tests). - if (execXhr && execXhr.readyState != 4) { - execXhr = null; - } - // Re-using the XHR improves exec() performance by about 10%. - execXhr = execXhr || new XMLHttpRequest(); - // Changing this to a GET will make the XHR reach the URIProtocol on 4.2. - // For some reason it still doesn't work though... - // Add a timestamp to the query param to prevent caching. - execXhr.open('HEAD', "/!gap_exec?" + (+new Date()), true); - if (!vcHeaderValue) { - vcHeaderValue = /.*\((.*)\)$/.exec(navigator.userAgent)[1]; - } - execXhr.setRequestHeader('vc', vcHeaderValue); - execXhr.setRequestHeader('rc', ++requestCount); - if (shouldBundleCommandJson()) { - execXhr.setRequestHeader('cmds', iOSExec.nativeFetchMessages()); +// CB-10106 +function handleBridgeChange() { + if (proxyChanged()) { + var commandString = commandQueue.shift(); + while(commandString) { + var command = JSON.parse(commandString); + var callbackId = command[0]; + var service = command[1]; + var action = command[2]; + var actionArgs = command[3]; + var callbacks = cordova.callbacks[callbackId] || {}; + + execProxy(callbacks.success, callbacks.fail, service, action, actionArgs); + + commandString = commandQueue.shift(); + }; + return true; } - execXhr.send(null); + + return false; } -function pokeNativeViaIframe() { +function pokeNative() { // CB-5488 - Don't attempt to create iframe before document.body is available. if (!document.body) { - setTimeout(pokeNativeViaIframe); + setTimeout(pokeNative); return; } - 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) - if (!execHashIframe) { - execHashIframe = document.createElement('iframe'); - execHashIframe.style.display = 'none'; - 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. - hashToggle = hashToggle ^ 3; - var hashValue = '%0' + hashToggle; - if (bridgeMode === jsToNativeModes.IFRAME_HASH_WITH_PAYLOAD) { - hashValue += iOSExec.nativeFetchMessages(); - } - execHashIframe.contentWindow.location.hash = hashValue; + + // Check if they've removed it from the DOM, and put it back if so. + if (execIframe && execIframe.contentWindow) { + execIframe.contentWindow.location = 'gap://ready'; } else { - // Check if they've removed it from the DOM, and put it back if so. - if (execIframe && execIframe.contentWindow) { - execIframe.contentWindow.location = 'gap://ready'; - } else { - 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). + execIframe = document.createElement('iframe'); + execIframe.style.display = 'none'; + execIframe.src = 'gap://ready'; + document.body.appendChild(execIframe); } -} - -iOSExec.jsToNativeModes = jsToNativeModes; - -iOSExec.setJsToNativeBridgeMode = function(mode) { - // Remove the iFrame since it may be no longer required, and its existence - // can trigger browser bugs. - // https://issues.apache.org/jira/browse/CB-593 - if (execIframe) { - if (execIframe.parentNode) { - execIframe.parentNode.removeChild(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) { + // CB-10106 - flush the queue on bridge change + if (!handleBridgeChange()) { + pokeNative(); + } } - execIframe = null; - } - bridgeMode = mode; -}; + }, 50); // Making this > 0 improves performance (marginally) in the normal case (where it doesn't fire). +} iOSExec.nativeFetchMessages = function() { // Stop listing for window detatch once native side confirms poke. @@ -1102,11 +1038,14 @@ iOSExec.nativeFetchMessages = function() { return json; }; -iOSExec.nativeCallback = function(callbackId, status, message, keepCallback) { +iOSExec.nativeCallback = function(callbackId, status, message, keepCallback, debug) { return iOSExec.nativeEvalAndFetch(function() { var success = status === 0 || status === 1; var args = convertMessageToArgsNativeToJs(message); - cordova.callbackFromNative(callbackId, success, status, args, keepCallback); + function nc2() { + cordova.callbackFromNative(callbackId, success, status, args, keepCallback); + } + setTimeout(nc2, 0); }); }; @@ -1121,7 +1060,31 @@ iOSExec.nativeEvalAndFetch = function(func) { } }; -module.exports = iOSExec; +// Proxy the exec for bridge changes. See CB-10106 + +function cordovaExec() { + var cexec = require('cordova/exec'); + var cexec_valid = (typeof cexec.nativeFetchMessages === 'function') && (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function'); + return (cexec_valid && execProxy !== cexec)? cexec : iOSExec; +} + +function execProxy() { + cordovaExec().apply(null, arguments); +}; + +execProxy.nativeFetchMessages = function() { + return cordovaExec().nativeFetchMessages.apply(null, arguments); +}; + +execProxy.nativeEvalAndFetch = function() { + return cordovaExec().nativeEvalAndFetch.apply(null, arguments); +}; + +execProxy.nativeCallback = function() { + return cordovaExec().nativeCallback.apply(null, arguments); +}; + +module.exports = execProxy; }); @@ -1606,7 +1569,7 @@ exports.reset(); }); -// file: e:/cordova/cordova-ios/cordova-js-src/platform.js +// file: /Users/shazron/Documents/git/apache/cordova-ios/cordova-js-src/platform.js define("cordova/platform", function(require, exports, module) { module.exports = { @@ -1888,7 +1851,10 @@ utils.clone = function(obj) { retVal = {}; for(i in obj){ - if(!(i in retVal) || retVal[i] != obj[i]) { + // https://issues.apache.org/jira/browse/CB-11522 'unknown' type may be returned in + // custom protocol activation case on Windows Phone 8.1 causing "No such interface supported" exception + // on cloning. + if((!(i in retVal) || retVal[i] != obj[i]) && typeof obj[i] != 'undefined' && typeof obj[i] != 'unknown') { retVal[i] = utils.clone(obj[i]); } } diff --git a/StoneIsland/platforms/ios/www/cordova_plugins.js b/StoneIsland/platforms/ios/www/cordova_plugins.js index ba2c072d..c17b360b 100755..100644 --- a/StoneIsland/platforms/ios/www/cordova_plugins.js +++ b/StoneIsland/platforms/ios/www/cordova_plugins.js @@ -1,88 +1,105 @@ cordova.define('cordova/plugin_list', function(require, exports, module) { module.exports = [ { - "file": "plugins/com.ionic.keyboard/www/keyboard.js", "id": "com.ionic.keyboard.keyboard", + "file": "plugins/com.ionic.keyboard/www/keyboard.js", "pluginId": "com.ionic.keyboard", "clobbers": [ "cordova.plugins.Keyboard" ] }, { - "file": "plugins/cordova-plugin-console/www/logger.js", + "id": "com.parse.cordova.core.pushplugin.ParsePlugin", + "file": "plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js", + "pluginId": "com.parse.cordova.core.pushplugin", + "clobbers": [ + "window.parsePlugin" + ] + }, + { "id": "cordova-plugin-console.logger", + "file": "plugins/cordova-plugin-console/www/logger.js", "pluginId": "cordova-plugin-console", "clobbers": [ "cordova.logger" ] }, { - "file": "plugins/cordova-plugin-console/www/console-via-logger.js", "id": "cordova-plugin-console.console", + "file": "plugins/cordova-plugin-console/www/console-via-logger.js", "pluginId": "cordova-plugin-console", "clobbers": [ "console" ] }, { - "file": "plugins/cordova-plugin-customurlscheme/www/ios/LaunchMyApp.js", "id": "cordova-plugin-customurlscheme.LaunchMyApp", + "file": "plugins/cordova-plugin-customurlscheme/www/ios/LaunchMyApp.js", "pluginId": "cordova-plugin-customurlscheme", "clobbers": [ "window.plugins.launchmyapp" ] }, { - "file": "plugins/cordova-plugin-device/www/device.js", "id": "cordova-plugin-device.device", + "file": "plugins/cordova-plugin-device/www/device.js", "pluginId": "cordova-plugin-device", "clobbers": [ "device" ] }, { - "file": "plugins/cordova-plugin-dialogs/www/notification.js", "id": "cordova-plugin-dialogs.notification", + "file": "plugins/cordova-plugin-dialogs/www/notification.js", "pluginId": "cordova-plugin-dialogs", "merges": [ "navigator.notification" ] }, { - "file": "plugins/cordova-plugin-geolocation/www/Coordinates.js", "id": "cordova-plugin-geolocation.Coordinates", + "file": "plugins/cordova-plugin-geolocation/www/Coordinates.js", "pluginId": "cordova-plugin-geolocation", "clobbers": [ "Coordinates" ] }, { - "file": "plugins/cordova-plugin-geolocation/www/PositionError.js", "id": "cordova-plugin-geolocation.PositionError", + "file": "plugins/cordova-plugin-geolocation/www/PositionError.js", "pluginId": "cordova-plugin-geolocation", "clobbers": [ "PositionError" ] }, { - "file": "plugins/cordova-plugin-geolocation/www/Position.js", "id": "cordova-plugin-geolocation.Position", + "file": "plugins/cordova-plugin-geolocation/www/Position.js", "pluginId": "cordova-plugin-geolocation", "clobbers": [ "Position" ] }, { - "file": "plugins/cordova-plugin-geolocation/www/geolocation.js", "id": "cordova-plugin-geolocation.geolocation", + "file": "plugins/cordova-plugin-geolocation/www/geolocation.js", "pluginId": "cordova-plugin-geolocation", "clobbers": [ "navigator.geolocation" ] }, { - "file": "plugins/cordova-plugin-network-information/www/network.js", + "id": "cordova-plugin-inappbrowser.inappbrowser", + "file": "plugins/cordova-plugin-inappbrowser/www/inappbrowser.js", + "pluginId": "cordova-plugin-inappbrowser", + "clobbers": [ + "cordova.InAppBrowser.open", + "window.open" + ] + }, + { "id": "cordova-plugin-network-information.network", + "file": "plugins/cordova-plugin-network-information/www/network.js", "pluginId": "cordova-plugin-network-information", "clobbers": [ "navigator.connection", @@ -90,71 +107,54 @@ module.exports = [ ] }, { - "file": "plugins/cordova-plugin-network-information/www/Connection.js", "id": "cordova-plugin-network-information.Connection", + "file": "plugins/cordova-plugin-network-information/www/Connection.js", "pluginId": "cordova-plugin-network-information", "clobbers": [ "Connection" ] }, { - "file": "plugins/cordova-plugin-splashscreen/www/splashscreen.js", "id": "cordova-plugin-splashscreen.SplashScreen", + "file": "plugins/cordova-plugin-splashscreen/www/splashscreen.js", "pluginId": "cordova-plugin-splashscreen", "clobbers": [ "navigator.splashscreen" ] }, { - "file": "plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js", "id": "cordova-plugin-x-socialsharing.SocialSharing", + "file": "plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js", "pluginId": "cordova-plugin-x-socialsharing", "clobbers": [ "window.plugins.socialsharing" ] }, { - "file": "plugins/phonegap-plugin-push/www/push.js", "id": "phonegap-plugin-push.PushNotification", + "file": "plugins/phonegap-plugin-push/www/push.js", "pluginId": "phonegap-plugin-push", "clobbers": [ "PushNotification" ] - }, - { - "file": "plugins/cordova-plugin-inappbrowser/www/inappbrowser.js", - "id": "cordova-plugin-inappbrowser.inappbrowser", - "pluginId": "cordova-plugin-inappbrowser", - "clobbers": [ - "cordova.InAppBrowser.open", - "window.open" - ] - }, - { - "file": "plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js", - "id": "com.parse.cordova.core.pushplugin.ParsePlugin", - "pluginId": "com.parse.cordova.core.pushplugin", - "clobbers": [ - "window.parsePlugin" - ] } ]; module.exports.metadata = // TOP OF METADATA { "com.ionic.keyboard": "1.0.4", + "com.parse.cordova.core.pushplugin": "0.1.0", "cordova-plugin-console": "1.0.1", "cordova-plugin-customurlscheme": "4.0.0", "cordova-plugin-device": "1.0.1", "cordova-plugin-dialogs": "1.1.1", "cordova-plugin-geolocation": "1.0.1", + "cordova-plugin-inappbrowser": "1.1.0", "cordova-plugin-network-information": "1.0.1", - "cordova-plugin-splashscreen": "2.1.0", + "cordova-plugin-splashscreen": "3.0.0", "cordova-plugin-whitelist": "1.0.0", "cordova-plugin-x-socialsharing": "5.0.7", - "phonegap-plugin-push": "1.4.4", - "cordova-plugin-inappbrowser": "1.1.0", - "com.parse.cordova.core.pushplugin": "0.1.0" -} + "phonegap-plugin-push": "1.4.4" +}; // BOTTOM OF METADATA });
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/css/products.css b/StoneIsland/platforms/ios/www/css/products.css index 85e9f3b5..e067e05a 100755 --- a/StoneIsland/platforms/ios/www/css/products.css +++ b/StoneIsland/platforms/ios/www/css/products.css @@ -58,6 +58,14 @@ background-repeat: no-repeat; } +.gallery .item iframe { + width: 100%; + height: 100%; + border: 0; + padding: 0; + margin: 0; +} + .search #search { display: block } #search { display: none; diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js index dd88839c..1657d295 100755 --- a/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js +++ b/StoneIsland/platforms/ios/www/js/lib/blogs/HubView.js @@ -51,7 +51,7 @@ var HubView = ScrollableView.extend({ append: function(row){ // id date subtitle body link store image[uri caption] // console.log(row) - console.log(moment(row.date)) + // console.log(moment(row.date)) var t = this.template.replace(/{{id}}/g, row.id) .replace(/{{date}}/, moment(row.date).format("MM.DD.YYYY")) .replace(/{{title}}/, row.title) @@ -170,4 +170,4 @@ var HubLoader = (function(){ setTimeout(HubLoader.load, 20) } return HubLoader -})()
\ No newline at end of file +})() diff --git a/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js b/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js index 06146bad..b9a7755f 100755 --- a/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js +++ b/StoneIsland/platforms/ios/www/js/lib/products/CollectionView.js @@ -98,6 +98,7 @@ var CollectionView = ScrollableView.extend({ console.log("IS SINGLE PRODUCT") var item = data.SearchResponseFull.Results.Items[0] var url = sdk.image(item['DefaultCode10'], '13_f') + console.log(url) var img = new Image () img.src = url } diff --git a/StoneIsland/platforms/ios/www/js/lib/products/GalleryView.js b/StoneIsland/platforms/ios/www/js/lib/products/GalleryView.js index 02193f14..1428aca9 100755 --- a/StoneIsland/platforms/ios/www/js/lib/products/GalleryView.js +++ b/StoneIsland/platforms/ios/www/js/lib/products/GalleryView.js @@ -60,6 +60,6 @@ var GalleryView = View.extend({ }) -var YOOX_IMAGE_STYLE_ORDER = "ZZZ d f".split(" ") +var YOOX_IMAGE_STYLE_ORDER = "ZZZ f r d e a b c g l".split(" ") -function sort_image_styles (b,a){ return (YOOX_IMAGE_STYLE_ORDER.indexOf(a)) - (YOOX_IMAGE_STYLE_ORDER.indexOf(b)) }
\ No newline at end of file +function sort_image_styles (b,a){ return (YOOX_IMAGE_STYLE_ORDER.indexOf(b)) - (YOOX_IMAGE_STYLE_ORDER.indexOf(a)) }
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js b/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js index a97cba23..cfb39f20 100755 --- a/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js +++ b/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js @@ -118,7 +118,8 @@ var ProductView = ScrollableView.extend({ var title = name_partz.join(' ') var type = title_case( data['MicroCategory'] ) var price = "$" + data['DiscountedPrice'] + ".00" - var body = descriptions['EditorialDescription'].replace(/<br>/g, "<br><br>").replace(/(<br>)+$/, "") + var body = descriptions['Details'] + "<br>" + descriptions['EditorialDescription'] + body = body.replace(/<br>/g, "<br><br>").replace(/(<br>)+$/, "") var default_color_id = this.populate_selectors(data, details) @@ -476,4 +477,4 @@ ModelFabric: "631520081CC-6315-81" ModelNames: "20081 DATA DRIP PIN" Neckline: "Claudine or round collar" -*/
\ No newline at end of file +*/ diff --git a/StoneIsland/platforms/ios/www/plugins/com.ionic.keyboard/www/keyboard.js b/StoneIsland/platforms/ios/www/plugins/com.ionic.keyboard/www/keyboard.js index 7d30ba59..ad09ae2d 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/com.ionic.keyboard/www/keyboard.js +++ b/StoneIsland/platforms/ios/www/plugins/com.ionic.keyboard/www/keyboard.js @@ -1,4 +1,5 @@ -cordova.define("com.ionic.keyboard.keyboard", function(require, exports, module) { +cordova.define("com.ionic.keyboard.keyboard", function(require, exports, module) { + var argscheck = require('cordova/argscheck'), utils = require('cordova/utils'), exec = require('cordova/exec'); diff --git a/StoneIsland/platforms/ios/www/plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js b/StoneIsland/platforms/ios/www/plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js index e732f80d..983c4764 100644 --- a/StoneIsland/platforms/ios/www/plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js +++ b/StoneIsland/platforms/ios/www/plugins/com.parse.cordova.core.pushplugin/www/cdv-plugin-parse.js @@ -1,4 +1,5 @@ -cordova.define("com.parse.cordova.core.pushplugin.ParsePlugin", function(require, exports, module) { var parsePlugin = { +cordova.define("com.parse.cordova.core.pushplugin.ParsePlugin", function(require, exports, module) { +var parsePlugin = { registerCallback: function(ecb, successCallback, errorCallback) { cordova.exec( diff --git a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-console/www/console-via-logger.js b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-console/www/console-via-logger.js index 0ce8cea8..f7de4b64 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-console/www/console-via-logger.js +++ b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-console/www/console-via-logger.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-console.console", function(require, exports, module) { /* +cordova.define("cordova-plugin-console.console", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-console/www/logger.js b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-console/www/logger.js index 7a9a75d3..dd42c01d 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-console/www/logger.js +++ b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-console/www/logger.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-console.logger", function(require, exports, module) { /* +cordova.define("cordova-plugin-console.logger", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-customurlscheme/www/ios/LaunchMyApp.js b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-customurlscheme/www/ios/LaunchMyApp.js index 3568c73f..72fee9e3 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-customurlscheme/www/ios/LaunchMyApp.js +++ b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-customurlscheme/www/ios/LaunchMyApp.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-customurlscheme.LaunchMyApp", function(require, exports, module) { "use strict"; +cordova.define("cordova-plugin-customurlscheme.LaunchMyApp", function(require, exports, module) { +"use strict"; /* Q: Why an empty file? diff --git a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-device/www/device.js b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-device/www/device.js index 023bafd2..775c123f 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-device/www/device.js +++ b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-device/www/device.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-device.device", function(require, exports, module) { /* +cordova.define("cordova-plugin-device.device", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-dialogs/www/notification.js b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-dialogs/www/notification.js index ea97eefb..adc5c077 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-dialogs/www/notification.js +++ b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-dialogs/www/notification.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-dialogs.notification", function(require, exports, module) { /* +cordova.define("cordova-plugin-dialogs.notification", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-geolocation/www/Coordinates.js b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-geolocation/www/Coordinates.js index f7255659..4a995077 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-geolocation/www/Coordinates.js +++ b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-geolocation/www/Coordinates.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-geolocation.Coordinates", function(require, exports, module) { /* +cordova.define("cordova-plugin-geolocation.Coordinates", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-geolocation/www/Position.js b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-geolocation/www/Position.js index 206bf8b4..116abb4f 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-geolocation/www/Position.js +++ b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-geolocation/www/Position.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-geolocation.Position", function(require, exports, module) { /* +cordova.define("cordova-plugin-geolocation.Position", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-geolocation/www/PositionError.js b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-geolocation/www/PositionError.js index 11ffe491..c335381e 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-geolocation/www/PositionError.js +++ b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-geolocation/www/PositionError.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-geolocation.PositionError", function(require, exports, module) { /* +cordova.define("cordova-plugin-geolocation.PositionError", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-geolocation/www/geolocation.js b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-geolocation/www/geolocation.js index ec9bb6e8..37bdaabb 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-geolocation/www/geolocation.js +++ b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-geolocation/www/geolocation.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-geolocation.geolocation", function(require, exports, module) { /* +cordova.define("cordova-plugin-geolocation.geolocation", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js index 6c7a844a..b18a2ba7 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js +++ b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-inappbrowser/www/inappbrowser.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-inappbrowser.inappbrowser", function(require, exports, module) { /* +cordova.define("cordova-plugin-inappbrowser.inappbrowser", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-network-information/www/Connection.js b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-network-information/www/Connection.js index 1450e953..5f7279c5 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-network-information/www/Connection.js +++ b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-network-information/www/Connection.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-network-information.Connection", function(require, exports, module) { /* +cordova.define("cordova-plugin-network-information.Connection", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-network-information/www/network.js b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-network-information/www/network.js index bfac2e3f..770e6ba5 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-network-information/www/network.js +++ b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-network-information/www/network.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-network-information.network", function(require, exports, module) { /* +cordova.define("cordova-plugin-network-information.network", function(require, exports, module) { +/* * 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 diff --git a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-splashscreen/www/splashscreen.js b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-splashscreen/www/splashscreen.js index 0e6a10af..5beaa5fd 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-splashscreen/www/splashscreen.js +++ b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-splashscreen/www/splashscreen.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-splashscreen.SplashScreen", function(require, exports, module) { /* +cordova.define("cordova-plugin-splashscreen.SplashScreen", function(require, exports, module) { +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js index aa82acf6..2e1295cd 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js +++ b/StoneIsland/platforms/ios/www/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js @@ -1,4 +1,5 @@ -cordova.define("cordova-plugin-x-socialsharing.SocialSharing", function(require, exports, module) { var cordova = require('cordova'); +cordova.define("cordova-plugin-x-socialsharing.SocialSharing", function(require, exports, module) { +var cordova = require('cordova'); function SocialSharing() { } diff --git a/StoneIsland/platforms/ios/www/plugins/phonegap-plugin-push/www/push.js b/StoneIsland/platforms/ios/www/plugins/phonegap-plugin-push/www/push.js index 7aa30fd7..ea60bc9f 100755..100644 --- a/StoneIsland/platforms/ios/www/plugins/phonegap-plugin-push/www/push.js +++ b/StoneIsland/platforms/ios/www/plugins/phonegap-plugin-push/www/push.js @@ -1,4 +1,5 @@ -cordova.define("phonegap-plugin-push.PushNotification", function(require, exports, module) { /* global cordova:false */ +cordova.define("phonegap-plugin-push.PushNotification", function(require, exports, module) { +/* global cordova:false */ /*! * Module dependencies. diff --git a/StoneIsland/platforms/platforms.json b/StoneIsland/platforms/platforms.json index 29f3305d..6121031d 100755 --- a/StoneIsland/platforms/platforms.json +++ b/StoneIsland/platforms/platforms.json @@ -1,4 +1,4 @@ { - "ios": "3.9.2", - "android": "4.1.1" + "android": "4.1.1", + "ios": "4.3.0" }
\ No newline at end of file diff --git a/StoneIsland/plugins/ios.json b/StoneIsland/plugins/ios.json index 7bb9ef16..fdcc6cfc 100755..100644 --- a/StoneIsland/plugins/ios.json +++ b/StoneIsland/plugins/ios.json @@ -10,6 +10,9 @@ "com.ionic.keyboard": { "PACKAGE_NAME": "us.okfoc.stoneisland" }, + "com.parse.cordova.core.pushplugin": { + "PACKAGE_NAME": "us.okfoc.stoneisland" + }, "cordova-plugin-console": { "PACKAGE_NAME": "us.okfoc.stoneisland" }, @@ -26,6 +29,9 @@ "cordova-plugin-geolocation": { "PACKAGE_NAME": "us.okfoc.stoneisland" }, + "cordova-plugin-inappbrowser": { + "PACKAGE_NAME": "us.okfoc.stoneisland" + }, "cordova-plugin-network-information": { "PACKAGE_NAME": "us.okfoc.stoneisland" }, @@ -40,12 +46,6 @@ }, "phonegap-plugin-push": { "PACKAGE_NAME": "us.okfoc.stoneisland" - }, - "cordova-plugin-inappbrowser": { - "PACKAGE_NAME": "us.okfoc.stoneisland" - }, - "com.parse.cordova.core.pushplugin": { - "PACKAGE_NAME": "us.okfoc.stoneisland" } }, "dependent_plugins": {} diff --git a/StoneIsland/www/css/products.css b/StoneIsland/www/css/products.css index 85e9f3b5..e067e05a 100755 --- a/StoneIsland/www/css/products.css +++ b/StoneIsland/www/css/products.css @@ -58,6 +58,14 @@ background-repeat: no-repeat; } +.gallery .item iframe { + width: 100%; + height: 100%; + border: 0; + padding: 0; + margin: 0; +} + .search #search { display: block } #search { display: none; diff --git a/StoneIsland/www/js/lib/blogs/HubView.js b/StoneIsland/www/js/lib/blogs/HubView.js index dd88839c..1657d295 100755 --- a/StoneIsland/www/js/lib/blogs/HubView.js +++ b/StoneIsland/www/js/lib/blogs/HubView.js @@ -51,7 +51,7 @@ var HubView = ScrollableView.extend({ append: function(row){ // id date subtitle body link store image[uri caption] // console.log(row) - console.log(moment(row.date)) + // console.log(moment(row.date)) var t = this.template.replace(/{{id}}/g, row.id) .replace(/{{date}}/, moment(row.date).format("MM.DD.YYYY")) .replace(/{{title}}/, row.title) @@ -170,4 +170,4 @@ var HubLoader = (function(){ setTimeout(HubLoader.load, 20) } return HubLoader -})()
\ No newline at end of file +})() diff --git a/StoneIsland/www/js/lib/products/CollectionView.js b/StoneIsland/www/js/lib/products/CollectionView.js index 06146bad..b9a7755f 100755 --- a/StoneIsland/www/js/lib/products/CollectionView.js +++ b/StoneIsland/www/js/lib/products/CollectionView.js @@ -98,6 +98,7 @@ var CollectionView = ScrollableView.extend({ console.log("IS SINGLE PRODUCT") var item = data.SearchResponseFull.Results.Items[0] var url = sdk.image(item['DefaultCode10'], '13_f') + console.log(url) var img = new Image () img.src = url } diff --git a/StoneIsland/www/js/lib/products/GalleryView.js b/StoneIsland/www/js/lib/products/GalleryView.js index 02193f14..1428aca9 100755 --- a/StoneIsland/www/js/lib/products/GalleryView.js +++ b/StoneIsland/www/js/lib/products/GalleryView.js @@ -60,6 +60,6 @@ var GalleryView = View.extend({ }) -var YOOX_IMAGE_STYLE_ORDER = "ZZZ d f".split(" ") +var YOOX_IMAGE_STYLE_ORDER = "ZZZ f r d e a b c g l".split(" ") -function sort_image_styles (b,a){ return (YOOX_IMAGE_STYLE_ORDER.indexOf(a)) - (YOOX_IMAGE_STYLE_ORDER.indexOf(b)) }
\ No newline at end of file +function sort_image_styles (b,a){ return (YOOX_IMAGE_STYLE_ORDER.indexOf(b)) - (YOOX_IMAGE_STYLE_ORDER.indexOf(a)) }
\ No newline at end of file diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js index a97cba23..cfb39f20 100755 --- a/StoneIsland/www/js/lib/products/ProductView.js +++ b/StoneIsland/www/js/lib/products/ProductView.js @@ -118,7 +118,8 @@ var ProductView = ScrollableView.extend({ var title = name_partz.join(' ') var type = title_case( data['MicroCategory'] ) var price = "$" + data['DiscountedPrice'] + ".00" - var body = descriptions['EditorialDescription'].replace(/<br>/g, "<br><br>").replace(/(<br>)+$/, "") + var body = descriptions['Details'] + "<br>" + descriptions['EditorialDescription'] + body = body.replace(/<br>/g, "<br><br>").replace(/(<br>)+$/, "") var default_color_id = this.populate_selectors(data, details) @@ -476,4 +477,4 @@ ModelFabric: "631520081CC-6315-81" ModelNames: "20081 DATA DRIP PIN" Neckline: "Claudine or round collar" -*/
\ No newline at end of file +*/ diff --git a/test/test/01-product.js b/test/test/01-product.js index e45081cd..18ce9aa1 100755 --- a/test/test/01-product.js +++ b/test/test/01-product.js @@ -11,11 +11,13 @@ describe('product', function(){ describe('#collection()', function(){ it('returns a collection', function(done){ promise(sdk.product.collection).then(function(data){ +console.log(data) assert(data.Header.StatusCode == 200) assert(data.SearchResponseFull.Results.Items.length > 0) test_item = data.SearchResponseFull.Results.Items[0] done() }).error(function(error){ + console.log(error) done() }) }) @@ -24,9 +26,13 @@ describe('product', function(){ describe('#item()', function(){ it('returns an item', function(done){ promise(sdk.product.item, { code: test_item['Code8'] }).then(function(data){ +console.log(data) assert(data.Header.StatusCode == 200) assert('Item' in data) done() + }).error(function(error){ + console.log(error) + done() }) }) }) |
