Commit 594ca1b9 authored by Jennie Shi's avatar Jennie Shi

集成插件前的封板

parent 0adc555a
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<widget id="com.xcmg.app.dev" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <widget id="com.xcmg.app" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>徐工金服UAT</name> <name>徐工金服</name>
<description> <description>
正式环境版 正式环境版
</description> </description>
...@@ -110,4 +110,5 @@ ...@@ -110,4 +110,5 @@
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" /> <plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" /> <plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<engine name="android" spec="~6.2.0" /> <engine name="android" spec="~6.2.0" />
<engine name="ios" spec="~4.5.5" />
</widget> </widget>
...@@ -2730,6 +2730,300 @@ ...@@ -2730,6 +2730,300 @@
} }
} }
}, },
"cordova-ios": {
"version": "4.5.5",
"resolved": "https://registry.npm.taobao.org/cordova-ios/download/cordova-ios-4.5.5.tgz",
"integrity": "sha1-r3PasGUOqKOP/w54Y/3l/HutdTw=",
"requires": {
"abbrev": "*",
"ansi": "*",
"balanced-match": "*",
"base64-js": "1.2.0",
"big-integer": "*",
"bplist-creator": "*",
"bplist-parser": "*",
"brace-expansion": "*",
"concat-map": "*",
"cordova-common": "2.2.5",
"cordova-registry-mapper": "*",
"elementtree": "0.1.6",
"glob": "5.0.15",
"inflight": "*",
"inherits": "*",
"ios-sim": "6.1.3",
"minimatch": "*",
"nopt": "3.0.6",
"once": "*",
"path-is-absolute": "*",
"plist": "2.1.0",
"q": "1.5.1",
"sax": "0.3.5",
"shelljs": "0.5.3",
"simctl": "*",
"simple-plist": "0.2.1",
"stream-buffers": "2.2.0",
"tail": "0.4.0",
"underscore": "*",
"unorm": "*",
"uuid": "3.0.1",
"wrappy": "*",
"xcode": "0.9.3",
"xml-escape": "1.1.0",
"xmlbuilder": "8.2.2",
"xmldom": "*"
},
"dependencies": {
"abbrev": {
"version": "1.1.1",
"bundled": true
},
"ansi": {
"version": "0.3.1",
"bundled": true
},
"balanced-match": {
"version": "1.0.0",
"bundled": true
},
"base64-js": {
"version": "1.2.0",
"bundled": true
},
"big-integer": {
"version": "1.6.32",
"bundled": true
},
"bplist-creator": {
"version": "0.0.7",
"bundled": true,
"requires": {
"stream-buffers": "~2.2.0"
}
},
"bplist-parser": {
"version": "0.1.1",
"bundled": true,
"requires": {
"big-integer": "^1.6.7"
}
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"concat-map": {
"version": "0.0.1",
"bundled": true
},
"cordova-common": {
"version": "2.2.5",
"bundled": true,
"requires": {
"ansi": "^0.3.1",
"bplist-parser": "^0.1.0",
"cordova-registry-mapper": "^1.1.8",
"elementtree": "0.1.6",
"glob": "^5.0.13",
"minimatch": "^3.0.0",
"plist": "^2.1.0",
"q": "^1.4.1",
"shelljs": "^0.5.3",
"underscore": "^1.8.3",
"unorm": "^1.3.3"
}
},
"cordova-registry-mapper": {
"version": "1.1.15",
"bundled": true
},
"elementtree": {
"version": "0.1.6",
"bundled": true,
"requires": {
"sax": "0.3.5"
}
},
"glob": {
"version": "5.0.15",
"bundled": true,
"requires": {
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "2 || 3",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"inflight": {
"version": "1.0.6",
"bundled": true,
"requires": {
"once": "^1.3.0",
"wrappy": "1"
}
},
"inherits": {
"version": "2.0.3",
"bundled": true
},
"ios-sim": {
"version": "6.1.3",
"bundled": true,
"requires": {
"bplist-parser": "^0.0.6",
"nopt": "1.0.9",
"plist": "^2.1.0",
"simctl": "^1.1.1"
},
"dependencies": {
"bplist-parser": {
"version": "0.0.6",
"bundled": true
},
"nopt": {
"version": "1.0.9",
"bundled": true,
"requires": {
"abbrev": "1"
}
}
}
},
"minimatch": {
"version": "3.0.4",
"bundled": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"nopt": {
"version": "3.0.6",
"bundled": true,
"requires": {
"abbrev": "1"
}
},
"once": {
"version": "1.4.0",
"bundled": true,
"requires": {
"wrappy": "1"
}
},
"path-is-absolute": {
"version": "1.0.1",
"bundled": true
},
"plist": {
"version": "2.1.0",
"bundled": true,
"requires": {
"base64-js": "1.2.0",
"xmlbuilder": "8.2.2",
"xmldom": "0.1.x"
}
},
"q": {
"version": "1.5.1",
"bundled": true
},
"sax": {
"version": "0.3.5",
"bundled": true
},
"shelljs": {
"version": "0.5.3",
"bundled": true
},
"simctl": {
"version": "1.1.1",
"bundled": true,
"requires": {
"shelljs": "^0.2.6",
"tail": "^0.4.0"
},
"dependencies": {
"shelljs": {
"version": "0.2.6",
"bundled": true
}
}
},
"simple-plist": {
"version": "0.2.1",
"bundled": true,
"requires": {
"bplist-creator": "0.0.7",
"bplist-parser": "0.1.1",
"plist": "2.0.1"
},
"dependencies": {
"base64-js": {
"version": "1.1.2",
"bundled": true
},
"plist": {
"version": "2.0.1",
"bundled": true,
"requires": {
"base64-js": "1.1.2",
"xmlbuilder": "8.2.2",
"xmldom": "0.1.x"
}
}
}
},
"stream-buffers": {
"version": "2.2.0",
"bundled": true
},
"tail": {
"version": "0.4.0",
"bundled": true
},
"underscore": {
"version": "1.9.1",
"bundled": true
},
"unorm": {
"version": "1.4.1",
"bundled": true
},
"uuid": {
"version": "3.0.1",
"bundled": true
},
"wrappy": {
"version": "1.0.2",
"bundled": true
},
"xcode": {
"version": "0.9.3",
"bundled": true,
"requires": {
"pegjs": "^0.10.0",
"simple-plist": "^0.2.1",
"uuid": "3.0.1"
}
},
"xml-escape": {
"version": "1.1.0",
"bundled": true
},
"xmlbuilder": {
"version": "8.2.2",
"bundled": true
},
"xmldom": {
"version": "0.1.27",
"bundled": true
}
}
},
"core-js": { "core-js": {
"version": "2.6.11", "version": "2.6.11",
"resolved": "https://registry.npm.taobao.org/core-js/download/core-js-2.6.11.tgz", "resolved": "https://registry.npm.taobao.org/core-js/download/core-js-2.6.11.tgz",
...@@ -8211,6 +8505,11 @@ ...@@ -8211,6 +8505,11 @@
"worker-loader": "^2.0.0" "worker-loader": "^2.0.0"
} }
}, },
"pegjs": {
"version": "0.10.0",
"resolved": "https://registry.npm.taobao.org/pegjs/download/pegjs-0.10.0.tgz",
"integrity": "sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0="
},
"performance-now": { "performance-now": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npm.taobao.org/performance-now/download/performance-now-0.2.0.tgz", "resolved": "https://registry.npm.taobao.org/performance-now/download/performance-now-0.2.0.tgz",
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
"autosize": "^3.0.20", "autosize": "^3.0.20",
"better-scroll": "^1.10.3", "better-scroll": "^1.10.3",
"cordova-android": "^6.2.0", "cordova-android": "^6.2.0",
"cordova-ios": "^4.5.5",
"cordova-plugin-device": "2.0.2", "cordova-plugin-device": "2.0.2",
"cordova-plugin-splashscreen": "5.0.2", "cordova-plugin-splashscreen": "5.0.2",
"cordova-plugin-statusbar": "2.4.2", "cordova-plugin-statusbar": "2.4.2",
...@@ -107,7 +108,8 @@ ...@@ -107,7 +108,8 @@
], ],
"cordova": { "cordova": {
"platforms": [ "platforms": [
"android" "android",
"ios"
], ],
"plugins": { "plugins": {
"cordova-plugin-whitelist": {}, "cordova-plugin-whitelist": {},
......
...@@ -36,26 +36,17 @@ ...@@ -36,26 +36,17 @@
"bugs": { "bugs": {
"url": "https://github.com/apache/cordova-plugin-compat/issues" "url": "https://github.com/apache/cordova-plugin-compat/issues"
}, },
<<<<<<< HEAD
=======
"bundleDependencies": false,
>>>>>>> jeshi
"cordova": { "cordova": {
"id": "cordova-plugin-compat", "id": "cordova-plugin-compat",
"platforms": [ "platforms": [
"android" "android"
] ]
}, },
<<<<<<< HEAD
"keywords": [ "keywords": [
"ecosystem:cordova", "ecosystem:cordova",
"ecosystem:phonegap", "ecosystem:phonegap",
"cordova-android" "cordova-android"
], ],
=======
"deprecated": false,
"description": "[DEPRECATED] This repo is for remaining backwards compatible with previous versions of Cordova.",
>>>>>>> jeshi
"engines": { "engines": {
"cordovaDependencies": { "cordovaDependencies": {
"<1.2.0": { "<1.2.0": {
...@@ -67,22 +58,6 @@ ...@@ -67,22 +58,6 @@
} }
} }
}, },
<<<<<<< HEAD
"author": "Apache Software Foundation", "author": "Apache Software Foundation",
"license": "Apache-2.0" "license": "Apache-2.0"
=======
"homepage": "http://github.com/apache/cordova-plugin-compat#readme",
"keywords": [
"ecosystem:cordova",
"ecosystem:phonegap",
"cordova-android"
],
"license": "Apache-2.0",
"name": "cordova-plugin-compat",
"repository": {
"type": "git",
"url": "git://github.com/apache/cordova-plugin-compat.git"
},
"version": "1.2.0"
>>>>>>> jeshi
} }
...@@ -23,12 +23,5 @@ ...@@ -23,12 +23,5 @@
@interface CDVWKWebViewEngine : CDVPlugin <CDVWebViewEngineProtocol, WKScriptMessageHandler, WKNavigationDelegate> @interface CDVWKWebViewEngine : CDVPlugin <CDVWebViewEngineProtocol, WKScriptMessageHandler, WKNavigationDelegate>
@property (nonatomic, strong, readonly) id <WKUIDelegate> uiDelegate; @property (nonatomic, strong, readonly) id <WKUIDelegate> uiDelegate;
<<<<<<< HEAD
=======
@property (nonatomic, strong) NSString * basePath;
-(void)setServerBasePath:(CDVInvokedUrlCommand*)command;
-(void)getServerBasePath:(CDVInvokedUrlCommand*)command;
>>>>>>> jeshi
@end @end
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#import "CDVWKWebViewEngine.h" #import "CDVWKWebViewEngine.h"
#import "CDVWKWebViewUIDelegate.h" #import "CDVWKWebViewUIDelegate.h"
#import "CDVWKProcessPoolFactory.h" #import "CDVWKProcessPoolFactory.h"
<<<<<<< HEAD
#import "GCDWebServer.h" #import "GCDWebServer.h"
#import "GCDWebServerPrivate.h" #import "GCDWebServerPrivate.h"
...@@ -34,20 +33,10 @@ ...@@ -34,20 +33,10 @@
#define CDV_IONIC_STOP_SCROLL @"stopScroll" #define CDV_IONIC_STOP_SCROLL @"stopScroll"
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
=======
#import "IONAssetHandler.h"
#define CDV_BRIDGE_NAME @"cordova"
#define CDV_IONIC_STOP_SCROLL @"stopScroll"
#define CDV_SERVER_PATH @"serverBasePath"
#define LAST_BINARY_VERSION_CODE @"lastBinaryVersionCode"
#define LAST_BINARY_VERSION_NAME @"lastBinaryVersionName"
>>>>>>> jeshi
@implementation UIScrollView (BugIOS11) @implementation UIScrollView (BugIOS11)
+ (void)load { + (void)load {
<<<<<<< HEAD
if (@available(iOS 11.0, *)) { if (@available(iOS 11.0, *)) {
static dispatch_once_t onceToken; static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{ dispatch_once(&onceToken, ^{
...@@ -74,39 +63,12 @@ ...@@ -74,39 +63,12 @@
} }
}); });
} }
=======
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Class class = [self class];
SEL originalSelector = @selector(init);
SEL swizzledSelector = @selector(xxx_init);
Method originalMethod = class_getInstanceMethod(class, originalSelector);
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
BOOL didAddMethod =
class_addMethod(class,
originalSelector,
method_getImplementation(swizzledMethod),
method_getTypeEncoding(swizzledMethod));
if (didAddMethod) {
class_replaceMethod(class,
swizzledSelector,
method_getImplementation(originalMethod),
method_getTypeEncoding(originalMethod));
} else {
method_exchangeImplementations(originalMethod, swizzledMethod);
}
});
>>>>>>> jeshi
} }
#pragma mark - Method Swizzling #pragma mark - Method Swizzling
- (id)xxx_init { - (id)xxx_init {
id a = [self xxx_init]; id a = [self xxx_init];
<<<<<<< HEAD
if (@available(iOS 11.0, *)) { if (@available(iOS 11.0, *)) {
NSArray *stack = [NSThread callStackSymbols]; NSArray *stack = [NSThread callStackSymbols];
for(NSString *trace in stack) { for(NSString *trace in stack) {
...@@ -114,13 +76,6 @@ ...@@ -114,13 +76,6 @@
[a setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever]; [a setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
break; break;
} }
=======
NSArray *stack = [NSThread callStackSymbols];
for(NSString *trace in stack) {
if([trace containsString:@"WebKit"]) {
[a setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
break;
>>>>>>> jeshi
} }
} }
return a; return a;
...@@ -128,11 +83,8 @@ ...@@ -128,11 +83,8 @@
@end @end
<<<<<<< HEAD
#endif #endif
=======
>>>>>>> jeshi
@interface CDVWKWeakScriptMessageHandler : NSObject <WKScriptMessageHandler> @interface CDVWKWeakScriptMessageHandler : NSObject <WKScriptMessageHandler>
...@@ -148,25 +100,11 @@ ...@@ -148,25 +100,11 @@
@property (nonatomic, strong, readwrite) UIView* engineWebView; @property (nonatomic, strong, readwrite) UIView* engineWebView;
@property (nonatomic, strong, readwrite) id <WKUIDelegate> uiDelegate; @property (nonatomic, strong, readwrite) id <WKUIDelegate> uiDelegate;
@property (nonatomic, weak) id <WKScriptMessageHandler> weakScriptMessageHandler; @property (nonatomic, weak) id <WKScriptMessageHandler> weakScriptMessageHandler;
<<<<<<< HEAD
@property (nonatomic, strong) GCDWebServer *webServer; @property (nonatomic, strong) GCDWebServer *webServer;
@property (nonatomic, readwrite) CGRect frame; @property (nonatomic, readwrite) CGRect frame;
@property (nonatomic, readwrite) NSString *CDV_LOCAL_SERVER; @property (nonatomic, readwrite) NSString *CDV_LOCAL_SERVER;
@end @end
=======
@property (nonatomic, readwrite) CGRect frame;
@property (nonatomic, strong) NSString *userAgentCreds;
@property (nonatomic, strong) IONAssetHandler * handler;
@property (nonatomic, readwrite) NSString *CDV_LOCAL_SERVER;
@end
// expose private configuration value required for background operation
@interface WKWebViewConfiguration ()
@end
>>>>>>> jeshi
// see forwardingTargetForSelector: selector comment for the reason for this pragma // see forwardingTargetForSelector: selector comment for the reason for this pragma
...@@ -176,11 +114,6 @@ ...@@ -176,11 +114,6 @@
@synthesize engineWebView = _engineWebView; @synthesize engineWebView = _engineWebView;
<<<<<<< HEAD
=======
NSTimer *timer;
>>>>>>> jeshi
- (instancetype)initWithFrame:(CGRect)frame - (instancetype)initWithFrame:(CGRect)frame
{ {
self = [super init]; self = [super init];
...@@ -188,7 +121,6 @@ NSTimer *timer; ...@@ -188,7 +121,6 @@ NSTimer *timer;
if (NSClassFromString(@"WKWebView") == nil) { if (NSClassFromString(@"WKWebView") == nil) {
return nil; return nil;
} }
<<<<<<< HEAD
if(!IsAtLeastiOSVersion(@"9.0")) { if(!IsAtLeastiOSVersion(@"9.0")) {
return nil; return nil;
} }
...@@ -196,8 +128,6 @@ NSTimer *timer; ...@@ -196,8 +128,6 @@ NSTimer *timer;
//Set default Server String //Set default Server String
self.CDV_LOCAL_SERVER = @"http://localhost:8080"; self.CDV_LOCAL_SERVER = @"http://localhost:8080";
=======
>>>>>>> jeshi
// add to keyWindow to ensure it is 'active' // add to keyWindow to ensure it is 'active'
[UIApplication.sharedApplication.keyWindow addSubview:self.engineWebView]; [UIApplication.sharedApplication.keyWindow addSubview:self.engineWebView];
...@@ -205,7 +135,6 @@ NSTimer *timer; ...@@ -205,7 +135,6 @@ NSTimer *timer;
} }
return self; return self;
} }
<<<<<<< HEAD
- (void)initWebServer:(NSDictionary*)settings - (void)initWebServer:(NSDictionary*)settings
{ {
[GCDWebServer setLogLevel: kGCDWebServerLoggingLevel_Warning]; [GCDWebServer setLogLevel: kGCDWebServerLoggingLevel_Warning];
...@@ -222,50 +151,12 @@ NSTimer *timer; ...@@ -222,50 +151,12 @@ NSTimer *timer;
}; };
[self.webServer startWithOptions:options error:nil]; [self.webServer startWithOptions:options error:nil];
=======
-(NSString *) getStartPath {
NSString * wwwPath = [[NSBundle mainBundle] pathForResource:@"www" ofType: nil];
NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
NSString * persistedPath = [userDefaults objectForKey:CDV_SERVER_PATH];
if (![self isDeployDisabled] && ![self isNewBinary] && persistedPath && ![persistedPath isEqualToString:@""]) {
NSString *libPath = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString * cordovaDataDirectory = [libPath stringByAppendingPathComponent:@"NoCloud"];
NSString * snapshots = [cordovaDataDirectory stringByAppendingPathComponent:@"ionic_built_snapshots"];
wwwPath = [snapshots stringByAppendingPathComponent:[persistedPath lastPathComponent]];
}
self.basePath = wwwPath;
return wwwPath;
}
-(BOOL) isNewBinary
{
NSString * versionCode = [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"];
NSString * versionName = [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"];
NSUserDefaults * prefs = [NSUserDefaults standardUserDefaults];
NSString * lastVersionCode = [prefs stringForKey:LAST_BINARY_VERSION_CODE];
NSString * lastVersionName = [prefs stringForKey:LAST_BINARY_VERSION_NAME];
if (![versionCode isEqualToString:lastVersionCode] || ![versionName isEqualToString:lastVersionName]) {
[prefs setObject:versionCode forKey:LAST_BINARY_VERSION_CODE];
[prefs setObject:versionName forKey:LAST_BINARY_VERSION_NAME];
[prefs setObject:@"" forKey:CDV_SERVER_PATH];
[prefs synchronize];
return YES;
}
return NO;
}
-(BOOL) isDeployDisabled {
return [[self.commandDelegate.settings objectForKey:[@"DisableDeploy" lowercaseString]] boolValue];
>>>>>>> jeshi
} }
- (WKWebViewConfiguration*) createConfigurationFromSettings:(NSDictionary*)settings - (WKWebViewConfiguration*) createConfigurationFromSettings:(NSDictionary*)settings
{ {
WKWebViewConfiguration* configuration = [[WKWebViewConfiguration alloc] init]; WKWebViewConfiguration* configuration = [[WKWebViewConfiguration alloc] init];
configuration.processPool = [[CDVWKProcessPoolFactory sharedFactory] sharedProcessPool]; configuration.processPool = [[CDVWKProcessPoolFactory sharedFactory] sharedProcessPool];
<<<<<<< HEAD
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
if(@available(iOS 10.0, *)) { if(@available(iOS 10.0, *)) {
configuration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone; configuration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
...@@ -275,36 +166,10 @@ NSTimer *timer; ...@@ -275,36 +166,10 @@ NSTimer *timer;
#else #else
configuration.mediaPlaybackRequiresUserAction = YES; configuration.mediaPlaybackRequiresUserAction = YES;
#endif #endif
=======
configuration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
>>>>>>> jeshi
if (settings == nil) { if (settings == nil) {
return configuration; return configuration;
} }
<<<<<<< HEAD
=======
if(![settings cordovaBoolSettingForKey:@"WKSuspendInBackground" defaultValue:YES]){
NSString* _BGStatus;
if (@available(iOS 12.2, *)) {
// do stuff for iOS 12.2 and newer
NSLog(@"iOS 12.2+ detected");
NSString* str = @"YWx3YXlzUnVuc0F0Rm9yZWdyb3VuZFByaW9yaXR5";
NSData* data = [[NSData alloc] initWithBase64EncodedString:str options:0];
_BGStatus = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
} else {
// do stuff for iOS 12.1 and older
NSLog(@"iOS Below 12.2 detected");
NSString* str = @"X2Fsd2F5c1J1bnNBdEZvcmVncm91bmRQcmlvcml0eQ==";
NSData* data = [[NSData alloc] initWithBase64EncodedString:str options:0];
_BGStatus = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
}
[configuration setValue:[NSNumber numberWithBool:YES]
forKey:_BGStatus];
}
>>>>>>> jeshi
configuration.allowsInlineMediaPlayback = [settings cordovaBoolSettingForKey:@"AllowInlineMediaPlayback" defaultValue:YES]; configuration.allowsInlineMediaPlayback = [settings cordovaBoolSettingForKey:@"AllowInlineMediaPlayback" defaultValue:YES];
configuration.suppressesIncrementalRendering = [settings cordovaBoolSettingForKey:@"SuppressesIncrementalRendering" defaultValue:NO]; configuration.suppressesIncrementalRendering = [settings cordovaBoolSettingForKey:@"SuppressesIncrementalRendering" defaultValue:NO];
configuration.allowsAirPlayForMediaPlayback = [settings cordovaBoolSettingForKey:@"MediaPlaybackAllowsAirPlay" defaultValue:YES]; configuration.allowsAirPlayForMediaPlayback = [settings cordovaBoolSettingForKey:@"MediaPlaybackAllowsAirPlay" defaultValue:YES];
...@@ -315,19 +180,7 @@ NSTimer *timer; ...@@ -315,19 +180,7 @@ NSTimer *timer;
{ {
// viewController would be available now. we attempt to set all possible delegates to it, by default // viewController would be available now. we attempt to set all possible delegates to it, by default
NSDictionary* settings = self.commandDelegate.settings; NSDictionary* settings = self.commandDelegate.settings;
<<<<<<< HEAD
[self initWebServer:settings]; [self initWebServer:settings];
=======
NSString *bind = [settings cordovaSettingForKey:@"Hostname"];
if(bind == nil){
bind = @"localhost";
}
NSString *scheme = [settings cordovaSettingForKey:@"iosScheme"];
if(scheme == nil || [scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"] || [scheme isEqualToString:@"file"]){
scheme = @"ionic";
}
self.CDV_LOCAL_SERVER = [NSString stringWithFormat:@"%@://%@", scheme, bind];
>>>>>>> jeshi
self.uiDelegate = [[CDVWKWebViewUIDelegate alloc] initWithTitle:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]]; self.uiDelegate = [[CDVWKWebViewUIDelegate alloc] initWithTitle:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]];
...@@ -368,37 +221,23 @@ NSTimer *timer; ...@@ -368,37 +221,23 @@ NSTimer *timer;
WKWebViewConfiguration* configuration = [self createConfigurationFromSettings:settings]; WKWebViewConfiguration* configuration = [self createConfigurationFromSettings:settings];
configuration.userContentController = userContentController; configuration.userContentController = userContentController;
<<<<<<< HEAD
=======
self.handler = [[IONAssetHandler alloc] initWithBasePath:[self getStartPath] andScheme:scheme];
[configuration setURLSchemeHandler:self.handler forURLScheme:scheme];
>>>>>>> jeshi
// re-create WKWebView, since we need to update configuration // re-create WKWebView, since we need to update configuration
// remove from keyWindow before recreating // remove from keyWindow before recreating
[self.engineWebView removeFromSuperview]; [self.engineWebView removeFromSuperview];
WKWebView* wkWebView = [[WKWebView alloc] initWithFrame:self.frame configuration:configuration]; WKWebView* wkWebView = [[WKWebView alloc] initWithFrame:self.frame configuration:configuration];
<<<<<<< HEAD
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
if (@available(iOS 11.0, *)) { if (@available(iOS 11.0, *)) {
[wkWebView.scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever]; [wkWebView.scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
} }
#endif #endif
=======
[wkWebView.scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
>>>>>>> jeshi
wkWebView.UIDelegate = self.uiDelegate; wkWebView.UIDelegate = self.uiDelegate;
self.engineWebView = wkWebView; self.engineWebView = wkWebView;
// add to keyWindow to ensure it is 'active' // add to keyWindow to ensure it is 'active'
[UIApplication.sharedApplication.keyWindow addSubview:self.engineWebView]; [UIApplication.sharedApplication.keyWindow addSubview:self.engineWebView];
<<<<<<< HEAD
if (IsAtLeastiOSVersion(@"9.0") && [self.viewController isKindOfClass:[CDVViewController class]]) { if (IsAtLeastiOSVersion(@"9.0") && [self.viewController isKindOfClass:[CDVViewController class]]) {
=======
if ([self.viewController isKindOfClass:[CDVViewController class]]) {
>>>>>>> jeshi
wkWebView.customUserAgent = ((CDVViewController*) self.viewController).userAgent; wkWebView.customUserAgent = ((CDVViewController*) self.viewController).userAgent;
} }
...@@ -416,17 +255,9 @@ NSTimer *timer; ...@@ -416,17 +255,9 @@ NSTimer *timer;
[wkWebView.configuration.userContentController addScriptMessageHandler:(id < WKScriptMessageHandler >)self.viewController name:CDV_BRIDGE_NAME]; [wkWebView.configuration.userContentController addScriptMessageHandler:(id < WKScriptMessageHandler >)self.viewController name:CDV_BRIDGE_NAME];
} }
<<<<<<< HEAD
//if (![settings cordovaBoolSettingForKey:@"KeyboardDisplayRequiresUserAction" defaultValue:NO]) { //if (![settings cordovaBoolSettingForKey:@"KeyboardDisplayRequiresUserAction" defaultValue:NO]) {
[self keyboardDisplayDoesNotRequireUserAction]; [self keyboardDisplayDoesNotRequireUserAction];
//} //}
=======
[self keyboardDisplayDoesNotRequireUserAction];
if ([settings cordovaBoolSettingForKey:@"KeyboardAppearanceDark" defaultValue:NO]) {
[self setKeyboardAppearanceDark];
}
>>>>>>> jeshi
[self updateSettings:settings]; [self updateSettings:settings];
...@@ -437,48 +268,18 @@ NSTimer *timer; ...@@ -437,48 +268,18 @@ NSTimer *timer;
selector:@selector(onAppWillEnterForeground:) selector:@selector(onAppWillEnterForeground:)
name:UIApplicationWillEnterForegroundNotification object:nil]; name:UIApplicationWillEnterForegroundNotification object:nil];
<<<<<<< HEAD
NSLog(@"Using Ionic WKWebView"); NSLog(@"Using Ionic WKWebView");
[self addURLObserver]; [self addURLObserver];
=======
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(keyboardWillHide)
name:UIKeyboardWillHideNotification object:nil];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(keyboardWillShow)
name:UIKeyboardWillShowNotification object:nil];
NSLog(@"Using Ionic WKWebView");
>>>>>>> jeshi
} }
// https://github.com/Telerik-Verified-Plugins/WKWebView/commit/04e8296adeb61f289f9c698045c19b62d080c7e3#L609-L620 // https://github.com/Telerik-Verified-Plugins/WKWebView/commit/04e8296adeb61f289f9c698045c19b62d080c7e3#L609-L620
- (void) keyboardDisplayDoesNotRequireUserAction { - (void) keyboardDisplayDoesNotRequireUserAction {
Class class = NSClassFromString(@"WKContentView"); Class class = NSClassFromString(@"WKContentView");
NSOperatingSystemVersion iOS_11_3_0 = (NSOperatingSystemVersion){11, 3, 0}; NSOperatingSystemVersion iOS_11_3_0 = (NSOperatingSystemVersion){11, 3, 0};
<<<<<<< HEAD
if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion: iOS_11_3_0]) { if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion: iOS_11_3_0]) {
SEL selector = sel_getUid("_startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:"); SEL selector = sel_getUid("_startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:");
=======
NSOperatingSystemVersion iOS_12_2_0 = (NSOperatingSystemVersion){12, 2, 0};
NSOperatingSystemVersion iOS_13_0_0 = (NSOperatingSystemVersion){13, 0, 0};
char * methodSignature = "_startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:";
if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion: iOS_13_0_0]) {
methodSignature = "_elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:";
} else if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion: iOS_12_2_0]) {
methodSignature = "_elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:";
}
if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion: iOS_11_3_0]) {
SEL selector = sel_getUid(methodSignature);
>>>>>>> jeshi
Method method = class_getInstanceMethod(class, selector); Method method = class_getInstanceMethod(class, selector);
IMP original = method_getImplementation(method); IMP original = method_getImplementation(method);
IMP override = imp_implementationWithBlock(^void(id me, void* arg0, BOOL arg1, BOOL arg2, BOOL arg3, id arg4) { IMP override = imp_implementationWithBlock(^void(id me, void* arg0, BOOL arg1, BOOL arg2, BOOL arg3, id arg4) {
...@@ -496,7 +297,6 @@ NSTimer *timer; ...@@ -496,7 +297,6 @@ NSTimer *timer;
} }
} }
<<<<<<< HEAD
- (void)onReset - (void)onReset
{ {
[self addURLObserver]; [self addURLObserver];
...@@ -530,57 +330,6 @@ static void * KVOContext = &KVOContext; ...@@ -530,57 +330,6 @@ static void * KVOContext = &KVOContext;
} }
} }
=======
- (void)setKeyboardAppearanceDark
{
IMP darkImp = imp_implementationWithBlock(^(id _s) {
return UIKeyboardAppearanceDark;
});
for (NSString* classString in @[@"WKContentView", @"UITextInputTraits"]) {
Class c = NSClassFromString(classString);
Method m = class_getInstanceMethod(c, @selector(keyboardAppearance));
if (m != NULL) {
method_setImplementation(m, darkImp);
} else {
class_addMethod(c, @selector(keyboardAppearance), darkImp, "l@:");
}
}
}
- (void)onAppWillEnterForeground:(NSNotification *)notification {
if ([self shouldReloadWebView]) {
NSLog(@"%@", @"CDVWKWebViewEngine reloading!");
[(WKWebView*)_engineWebView reload];
}
}
-(void)keyboardWillHide
{
if (@available(iOS 12.0, *)) {
timer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(keyboardDisplacementFix) userInfo:nil repeats:false];
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
}
}
-(void)keyboardWillShow
{
if (timer != nil) {
[timer invalidate];
}
}
-(void)keyboardDisplacementFix
{
// https://stackoverflow.com/a/9637807/824966
[UIView animateWithDuration:.25 animations:^{
self.webView.scrollView.contentOffset = CGPointMake(0, 0);
}];
}
>>>>>>> jeshi
- (BOOL)shouldReloadWebView - (BOOL)shouldReloadWebView
{ {
WKWebView* wkWebView = (WKWebView*)_engineWebView; WKWebView* wkWebView = (WKWebView*)_engineWebView;
...@@ -608,16 +357,7 @@ static void * KVOContext = &KVOContext; ...@@ -608,16 +357,7 @@ static void * KVOContext = &KVOContext;
- (id)loadRequest:(NSURLRequest *)request - (id)loadRequest:(NSURLRequest *)request
{ {
if (request.URL.fileURL) { if (request.URL.fileURL) {
<<<<<<< HEAD
NSURL *url = [[NSURL URLWithString:self.CDV_LOCAL_SERVER] URLByAppendingPathComponent:request.URL.path]; NSURL *url = [[NSURL URLWithString:self.CDV_LOCAL_SERVER] URLByAppendingPathComponent:request.URL.path];
=======
NSURL* startURL = [NSURL URLWithString:((CDVViewController *)self.viewController).startPage];
NSString* startFilePath = [self.commandDelegate pathForResource:[startURL path]];
NSURL *url = [[NSURL URLWithString:self.CDV_LOCAL_SERVER] URLByAppendingPathComponent:request.URL.path];
if ([request.URL.path isEqualToString:startFilePath]) {
url = [NSURL URLWithString:self.CDV_LOCAL_SERVER];
}
>>>>>>> jeshi
if(request.URL.query) { if(request.URL.query) {
url = [NSURL URLWithString:[@"?" stringByAppendingString:request.URL.query] relativeToURL:url]; url = [NSURL URLWithString:[@"?" stringByAppendingString:request.URL.query] relativeToURL:url];
} }
...@@ -730,10 +470,6 @@ static void * KVOContext = &KVOContext; ...@@ -730,10 +470,6 @@ static void * KVOContext = &KVOContext;
NSLog(@"CDVWKWebViewEngine: WK plugin can not be loaded: %@", error); NSLog(@"CDVWKWebViewEngine: WK plugin can not be loaded: %@", error);
return nil; return nil;
} }
<<<<<<< HEAD
=======
source = [source stringByAppendingString:[NSString stringWithFormat:@"window.WEBVIEW_SERVER_URL = '%@';", self.CDV_LOCAL_SERVER]];
>>>>>>> jeshi
return [[WKUserScript alloc] initWithSource:source return [[WKUserScript alloc] initWithSource:source
injectionTime:WKUserScriptInjectionTimeAtDocumentStart injectionTime:WKUserScriptInjectionTimeAtDocumentStart
...@@ -884,14 +620,6 @@ static void * KVOContext = &KVOContext; ...@@ -884,14 +620,6 @@ static void * KVOContext = &KVOContext;
NSLog(@"%@", [errorUrl absoluteString]); NSLog(@"%@", [errorUrl absoluteString]);
[theWebView loadRequest:[NSURLRequest requestWithURL:errorUrl]]; [theWebView loadRequest:[NSURLRequest requestWithURL:errorUrl]];
} }
<<<<<<< HEAD
=======
#ifdef DEBUG
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"] message:message preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil) style:UIAlertActionStyleDefault handler:nil]];
[vc presentViewController:alertController animated:YES completion:nil];
#endif
>>>>>>> jeshi
} }
- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView - (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView
...@@ -909,10 +637,6 @@ static void * KVOContext = &KVOContext; ...@@ -909,10 +637,6 @@ static void * KVOContext = &KVOContext;
return NO; return NO;
} }
<<<<<<< HEAD
=======
>>>>>>> jeshi
- (void) webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction*)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler - (void) webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction*)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
{ {
NSURL* url = [navigationAction.request URL]; NSURL* url = [navigationAction.request URL];
...@@ -951,22 +675,14 @@ static void * KVOContext = &KVOContext; ...@@ -951,22 +675,14 @@ static void * KVOContext = &KVOContext;
} }
} }
<<<<<<< HEAD
=======
>>>>>>> jeshi
if (shouldAllowRequest) { if (shouldAllowRequest) {
NSString *scheme = url.scheme; NSString *scheme = url.scheme;
if ([scheme isEqualToString:@"tel"] || if ([scheme isEqualToString:@"tel"] ||
[scheme isEqualToString:@"mailto"] || [scheme isEqualToString:@"mailto"] ||
[scheme isEqualToString:@"facetime"] || [scheme isEqualToString:@"facetime"] ||
[scheme isEqualToString:@"sms"] || [scheme isEqualToString:@"sms"] ||
<<<<<<< HEAD
[scheme isEqualToString:@"maps"] || [scheme isEqualToString:@"maps"] ||
[scheme isEqualToString:@"itms-services"]) { [scheme isEqualToString:@"itms-services"]) {
=======
[scheme isEqualToString:@"maps"]) {
>>>>>>> jeshi
[[UIApplication sharedApplication] openURL:url]; [[UIApplication sharedApplication] openURL:url];
decisionHandler(WKNavigationActionPolicyCancel); decisionHandler(WKNavigationActionPolicyCancel);
} else { } else {
...@@ -977,31 +693,6 @@ static void * KVOContext = &KVOContext; ...@@ -977,31 +693,6 @@ static void * KVOContext = &KVOContext;
} }
} }
<<<<<<< HEAD
=======
-(void)getServerBasePath:(CDVInvokedUrlCommand*)command
{
[self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:self.basePath] callbackId:command.callbackId];
}
-(void)setServerBasePath:(CDVInvokedUrlCommand*)command
{
NSString * path = [command argumentAtIndex:0];
self.basePath = path;
[self.handler setAssetPath:path];
NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.CDV_LOCAL_SERVER]];
[(WKWebView*)_engineWebView loadRequest:request];
}
-(void)persistServerBasePath:(CDVInvokedUrlCommand*)command
{
NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults setObject:[self.basePath lastPathComponent] forKey:CDV_SERVER_PATH];
[userDefaults synchronize];
}
>>>>>>> jeshi
@end @end
#pragma mark - CDVWKWeakScriptMessageHandler #pragma mark - CDVWKWeakScriptMessageHandler
...@@ -1023,7 +714,3 @@ static void * KVOContext = &KVOContext; ...@@ -1023,7 +714,3 @@ static void * KVOContext = &KVOContext;
} }
@end @end
<<<<<<< HEAD
=======
>>>>>>> jeshi
(function _wk_plugin() { (function _wk_plugin () {
// Check if we are running in WKWebView // Check if we are running in WKWebView
if (!window.webkit || !window.webkit.messageHandlers) { if (!window.webkit || !window.webkit.messageHandlers) {
return; return
} }
// Initialize Ionic // Initialize Ionic
window.Ionic = window.Ionic || {}; window.Ionic = window.Ionic || {}
function normalizeURL(url) { function normalizeURL (url) {
<<<<<<< HEAD
if (!url) { if (!url) {
return url; return url
} }
if (!url.startsWith("file://")) { if (!url.startsWith('file://')) {
return url; return url
} }
url = url.substr(7); // len("file://") == 7 url = url.substr(7) // len("file://") == 7
if (url.length == 0 || url[0] !== '/') { // ensure the new URL starts with / if (url.length == 0 || url[0] !== '/') { // ensure the new URL starts with /
url = '/' + url; url = '/' + url
} }
return 'http://localhost:8080' + url; return 'http://localhost:8080' + url
} }
if (typeof window.wkRewriteURL === 'undefined') { if (typeof window.wkRewriteURL === 'undefined') {
window.wkRewriteURL = function (url) { window.wkRewriteURL = function (url) {
console.warn('wkRewriteURL is deprecated, use normalizeURL instead'); console.warn('wkRewriteURL is deprecated, use normalizeURL instead')
return normalizeURL(url); return normalizeURL(url)
=======
console.warn('normalizeURL is deprecated, use window.Ionic.WebView.convertFileSrc');
return window.Ionic.WebView.convertFileSrc(url);
} }
if (typeof window.wkRewriteURL === 'undefined') {
window.wkRewriteURL = function (url) {
console.warn('wkRewriteURL is deprecated, use window.Ionic.WebView.convertFileSrc instead');
return window.Ionic.WebView.convertFileSrc(url);
>>>>>>> jeshi
} }
} window.Ionic.normalizeURL = normalizeURL
window.Ionic.normalizeURL = normalizeURL;
<<<<<<< HEAD var xhrPrototype = window.XMLHttpRequest.prototype
var xhrPrototype = window.XMLHttpRequest.prototype; var originalOpen = xhrPrototype.open
var originalOpen = xhrPrototype.open;
xhrPrototype.open = function _wk_open(method, url) { xhrPrototype.open = function _wk_open (method, url) {
arguments[1] = normalizeURL(url); arguments[1] = normalizeURL(url)
originalOpen.apply(this, arguments); originalOpen.apply(this, arguments)
} }
console.debug("XHR polyfill injected!"); console.debug('XHR polyfill injected!')
======= var stopScrollHandler = window.webkit.messageHandlers.stopScroll
>>>>>>> jeshi
var stopScrollHandler = window.webkit.messageHandlers.stopScroll;
if (!stopScrollHandler) { if (!stopScrollHandler) {
console.error('Can not find stopScroll handler'); console.error('Can not find stopScroll handler')
return; return
} }
var stopScrollFunc = null; var stopScrollFunc = null
var stopScroll = { var stopScroll = {
stop: function stop(callback) { stop: function stop (callback) {
if (!stopScrollFunc) { if (!stopScrollFunc) {
stopScrollFunc = callback; stopScrollFunc = callback
stopScrollHandler.postMessage(''); stopScrollHandler.postMessage('')
} }
}, },
fire: function fire() { fire: function fire () {
stopScrollFunc && stopScrollFunc(); stopScrollFunc && stopScrollFunc()
stopScrollFunc = null; stopScrollFunc = null
},
cancel: function cancel () {
stopScrollFunc = null
}, },
cancel: function cancel() {
stopScrollFunc = null;
} }
};
window.Ionic.StopScroll = stopScroll; window.Ionic.StopScroll = stopScroll
// deprecated // deprecated
window.IonicStopScroll = stopScroll; window.IonicStopScroll = stopScroll
console.debug("Ionic Stop Scroll injected!"); console.debug('Ionic Stop Scroll injected!')
})(); })()
...@@ -23,57 +23,57 @@ ...@@ -23,57 +23,57 @@
* Creates the exec bridge used to notify the native code of * Creates the exec bridge used to notify the native code of
* commands. * commands.
*/ */
var cordova = require('cordova'); var cordova = require('cordova')
var utils = require('cordova/utils'); var utils = require('cordova/utils')
var base64 = require('cordova/base64'); var base64 = require('cordova/base64')
function massageArgsJsToNative (args) { function massageArgsJsToNative (args) {
if (!args || utils.typeName(args) !== 'Array') { if (!args || utils.typeName(args) !== 'Array') {
return args; return args
} }
var ret = []; var ret = []
args.forEach(function (arg, i) { args.forEach(function (arg, i) {
if (utils.typeName(arg) === 'ArrayBuffer') { if (utils.typeName(arg) === 'ArrayBuffer') {
ret.push({ ret.push({
'CDVType': 'ArrayBuffer', 'CDVType': 'ArrayBuffer',
'data': base64.fromArrayBuffer(arg) 'data': base64.fromArrayBuffer(arg),
}); })
} else { } else {
ret.push(arg); ret.push(arg)
} }
}); })
return ret; return ret
} }
function massageMessageNativeToJs (message) { function massageMessageNativeToJs (message) {
if (message.CDVType === 'ArrayBuffer') { if (message.CDVType === 'ArrayBuffer') {
var stringToArrayBuffer = function (str) { var stringToArrayBuffer = function (str) {
var ret = new Uint8Array(str.length); var ret = new Uint8Array(str.length)
for (var i = 0; i < str.length; i++) { for (var i = 0; i < str.length; i++) {
ret[i] = str.charCodeAt(i); ret[i] = str.charCodeAt(i)
}
return ret.buffer
} }
return ret.buffer;
};
var base64ToArrayBuffer = function (b64) { var base64ToArrayBuffer = function (b64) {
return stringToArrayBuffer(atob(b64)); // eslint-disable-line no-undef return stringToArrayBuffer(atob(b64)) // eslint-disable-line no-undef
}; }
message = base64ToArrayBuffer(message.data); message = base64ToArrayBuffer(message.data)
} }
return message; return message
} }
function convertMessageToArgsNativeToJs (message) { function convertMessageToArgsNativeToJs (message) {
var args = []; var args = []
if (!message || !message.hasOwnProperty('CDVType')) { if (!message || !message.hasOwnProperty('CDVType')) {
args.push(message); args.push(message)
} else if (message.CDVType === 'MultiPart') { } else if (message.CDVType === 'MultiPart') {
message.messages.forEach(function (e) { message.messages.forEach(function (e) {
args.push(massageMessageNativeToJs(e)); args.push(massageMessageNativeToJs(e))
}); })
} else { } else {
args.push(massageMessageNativeToJs(message)); args.push(massageMessageNativeToJs(message))
} }
return args; return args
} }
var iOSExec = function () { var iOSExec = function () {
...@@ -83,98 +83,92 @@ var iOSExec = function () { ...@@ -83,98 +83,92 @@ var iOSExec = function () {
// bridgeMode = jsToNativeModes.WK_WEBVIEW_BINDING; // bridgeMode = jsToNativeModes.WK_WEBVIEW_BINDING;
// } // }
var successCallback, failCallback, service, action, actionArgs; var successCallback, failCallback, service, action, actionArgs
var callbackId = null; var callbackId = null
if (typeof arguments[0] !== 'string') { if (typeof arguments[0] !== 'string') {
// FORMAT ONE // FORMAT ONE
successCallback = arguments[0]; successCallback = arguments[0]
failCallback = arguments[1]; failCallback = arguments[1]
service = arguments[2]; service = arguments[2]
action = arguments[3]; action = arguments[3]
actionArgs = arguments[4]; actionArgs = arguments[4]
// Since we need to maintain backwards compatibility, we have to pass // Since we need to maintain backwards compatibility, we have to pass
// an invalid callbackId even if no callback was provided since plugins // an invalid callbackId even if no callback was provided since plugins
// will be expecting it. The Cordova.exec() implementation allocates // will be expecting it. The Cordova.exec() implementation allocates
// an invalid callbackId and passes it even if no callbacks were given. // an invalid callbackId and passes it even if no callbacks were given.
callbackId = 'INVALID'; callbackId = 'INVALID'
} else { } else {
throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + // eslint-disable-line throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + // eslint-disable-line
'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);'); 'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);')
} }
// If actionArgs is not provided, default to an empty array // If actionArgs is not provided, default to an empty array
actionArgs = actionArgs || []; actionArgs = actionArgs || []
// Register the callbacks and add the callbackId to the positional // Register the callbacks and add the callbackId to the positional
// arguments if given. // arguments if given.
if (successCallback || failCallback) { if (successCallback || failCallback) {
callbackId = service + cordova.callbackId++; callbackId = service + cordova.callbackId++
cordova.callbacks[callbackId] = cordova.callbacks[callbackId] =
{success: successCallback, fail: failCallback}; {success: successCallback, fail: failCallback}
} }
actionArgs = massageArgsJsToNative(actionArgs); actionArgs = massageArgsJsToNative(actionArgs)
// CB-10133 DataClone DOM Exception 25 guard (fast function remover) // CB-10133 DataClone DOM Exception 25 guard (fast function remover)
var command = [callbackId, service, action, JSON.parse(JSON.stringify(actionArgs))]; var command = [callbackId, service, action, JSON.parse(JSON.stringify(actionArgs))]
window.webkit.messageHandlers.cordova.postMessage(command); window.webkit.messageHandlers.cordova.postMessage(command)
}; }
iOSExec.nativeCallback = function (callbackId, status, message, keepCallback, debug) { iOSExec.nativeCallback = function (callbackId, status, message, keepCallback, debug) {
var success = status === 0 || status === 1; var success = status === 0 || status === 1
var args = convertMessageToArgsNativeToJs(message); var args = convertMessageToArgsNativeToJs(message)
<<<<<<< HEAD
setTimeout(function () { setTimeout(function () {
cordova.callbackFromNative(callbackId, success, status, args, keepCallback); // eslint-disable-line cordova.callbackFromNative(callbackId, success, status, args, keepCallback); // eslint-disable-line
}, 0); }, 0)
======= }
Promise.resolve().then(function () {
cordova.callbackFromNative(callbackId, success, status, args, keepCallback); // eslint-disable-line
});
>>>>>>> jeshi
};
// for backwards compatibility // for backwards compatibility
iOSExec.nativeEvalAndFetch = function (func) { iOSExec.nativeEvalAndFetch = function (func) {
try { try {
func(); func()
} catch (e) { } catch (e) {
console.log(e); console.log(e)
} }
}; }
// Proxy the exec for bridge changes. See CB-10106 // Proxy the exec for bridge changes. See CB-10106
function cordovaExec () { function cordovaExec () {
var cexec = require('cordova/exec'); var cexec = require('cordova/exec')
var cexec_valid = (typeof cexec.nativeFetchMessages === 'function') && (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function'); var cexec_valid = (typeof cexec.nativeFetchMessages === 'function') && (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function')
return (cexec_valid && execProxy !== cexec) ? cexec : iOSExec; return (cexec_valid && execProxy !== cexec) ? cexec : iOSExec
} }
function execProxy () { function execProxy () {
cordovaExec().apply(null, arguments); cordovaExec().apply(null, arguments)
} }
execProxy.nativeFetchMessages = function () { execProxy.nativeFetchMessages = function () {
return cordovaExec().nativeFetchMessages.apply(null, arguments); return cordovaExec().nativeFetchMessages.apply(null, arguments)
}; }
execProxy.nativeEvalAndFetch = function () { execProxy.nativeEvalAndFetch = function () {
return cordovaExec().nativeEvalAndFetch.apply(null, arguments); return cordovaExec().nativeEvalAndFetch.apply(null, arguments)
}; }
execProxy.nativeCallback = function () { execProxy.nativeCallback = function () {
return cordovaExec().nativeCallback.apply(null, arguments); return cordovaExec().nativeCallback.apply(null, arguments)
}; }
module.exports = execProxy; module.exports = execProxy
if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.cordova && window.webkit.messageHandlers.cordova.postMessage) { if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.cordova && window.webkit.messageHandlers.cordova.postMessage) {
// unregister the old bridge // unregister the old bridge
cordova.define.remove('cordova/exec'); cordova.define.remove('cordova/exec')
// redefine bridge to our new bridge // redefine bridge to our new bridge
cordova.define('cordova/exec', function (require, exports, module) { cordova.define('cordova/exec', function (require, exports, module) {
module.exports = execProxy; module.exports = execProxy
}); })
} }
...@@ -7,6 +7,101 @@ ...@@ -7,6 +7,101 @@
"files": {} "files": {}
}, },
"installed_plugins": { "installed_plugins": {
"IdCardPlugin": {
"PACKAGE_NAME": "com.xcmg.app"
}, },
"dependent_plugins": {} "com.handmobile.cordovaplugin.hotpatch": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-baidumaplocation": {
"ANDROID_KEY": "Y8gTWgN2GuDtvhBfiECaZiBtE6i0wQBG",
"IOS_KEY": "hhouKKwxALvC7MBZmnfwgSacHOfFOlNu",
"IOS_LOCATION_DESC": "请点击'好'以允许访问。",
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-camera": {
"CAMERA_USAGE_DESCRIPTION": "我们将在拍照模块使用您的相机",
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-datepicker": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-device": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-dialogs": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-file": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-file-transfer": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-hrms-faceidentify": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-image-picker": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-ionic-webview": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-jcore": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-media-capture": {
"CAMERA_USAGE_DESCRIPTION": " ",
"MICROPHONE_USAGE_DESCRIPTION": " ",
"PHOTOLIBRARY_USAGE_DESCRIPTION": " ",
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-network-information": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-splashscreen": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-statusbar": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-touch-id": {
"FACEID_USAGE_DESCRIPTION": " ",
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-whitelist": {
"PACKAGE_NAME": "com.xcmg.app"
},
"ionic-plugin-keyboard": {
"PACKAGE_NAME": "com.xcmg.app"
},
"jpush-phonegap-plugin": {
"APP_KEY": "bef4fd44dcf54b79b8ab27c3",
"PACKAGE_NAME": "com.xcmg.app"
}
},
"dependent_plugins": {
"cordova-plugin-3dtouch": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-compat": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-contacts": {
"CONTACTS_USAGE_DESCRIPTION": "我们将在通讯功能读取您的联系人,为你提供便捷服务",
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-fingerprint": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-themeablebrowser": {
"PACKAGE_NAME": "com.xcmg.app"
},
"cordova-plugin-x-toast": {
"PACKAGE_NAME": "com.xcmg.app"
},
"es6-promise-plugin": {
"PACKAGE_NAME": "com.xcmg.app"
}
}
} }
\ No newline at end of file
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,width=device-width,viewport-fit=cover"><meta name=format-detection content="telephone=no"><meta name=format-detection content="email=no"><meta name=apple-mobile-web-app-capable content=yes><meta name=apple-mobile-web-app-status-bar-style content=black><script type=text/javascript src=./static/vuePlatform.js></script><script type=text/javascript src=./static/prototype.js></script><script type=text/javascript src=./cordova.js></script><script type=text/javascript src="http://api.map.baidu.com/api?v=2.0&ak=Eoo0EtfjYCdAy7r8D19gZ0vMojdZpHqU"></script><title>徐工金服</title><link href=./static/css/app.d391cbe4f727fbde9a1f0c7f76c12fc8.css rel=stylesheet></head><body><div id=app-box></div><script type=text/javascript src=./static/js/manifest.6a178e8d77c32e3c385d.js></script><script type=text/javascript src=./static/js/vendor.7191c48e0b160a3ab672.js></script><script type=text/javascript src=./static/js/app.9d0d4f4694bb9d826f6b.js></script></body></html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment