diff --git a/package.json b/package.json index 11f15c4..510f2df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-webengage", - "version": "1.0.0", + "version": "1.0.1", "description": "WebEngage Plugin that integrates with WebEngage native SDKs(Android & iOS) to provide engagement capabilities for hybrid applications built with PhoneGap/Cordova", "main": "WebEngagePlugin.js", "dependencies": { @@ -25,11 +25,11 @@ "engagement", "notifications" ], - "author": "arpit@webklipper.com", + "author": "mobile@webengage.com", "license": "ISC", "engines": { - "cordovaDependencies": { - "0.0.1": { "cordova-ios": ">=4.0.0", "cordova-android": ">=4.1.0"} - } + "cordovaDependencies": { + "1.0.0": {"cordova-ios": ">=4.0.0", "cordova-android": ">=4.1.0" } + } } -} +} \ No newline at end of file diff --git a/plugin.xml b/plugin.xml index ceb7501..4821777 100644 --- a/plugin.xml +++ b/plugin.xml @@ -31,6 +31,15 @@ + + + + + + + + + diff --git a/src/ios/WebEngagePlugin.m b/src/ios/WebEngagePlugin.m index f48808f..2ea5b67 100644 --- a/src/ios/WebEngagePlugin.m +++ b/src/ios/WebEngagePlugin.m @@ -418,12 +418,7 @@ - (void)notification:(NSMutableDictionary *)inAppNotificationData + (NSString *)evaluateJavaScript:(NSString *)script onWebView:(UIView *)webView { __block NSString* resultData = [[NSString alloc] init]; - if ([webView isKindOfClass:UIWebView.class]) { - UIWebView *webview = (UIWebView*)webView; - resultData=[webview stringByEvaluatingJavaScriptFromString:script]; - } - - else if ([webView isKindOfClass:WKWebView.class]) { + if ([webView isKindOfClass:WKWebView.class]) { WKWebView *webview = (WKWebView*)webView; [webview evaluateJavaScript:script completionHandler:^(id _Nullable result, NSError * _Nullable error) { resultData=result; @@ -435,12 +430,7 @@ + (NSString *)evaluateJavaScript:(NSString *)script onWebView:(UIView *)webView + (void) evaluateJavaScript:(NSString *)script onWebView:(id)webView completionHandler:(void (^ _Nullable)(NSString * _Nullable response, NSError * _Nullable error))completionHandler { - if ([webView isKindOfClass:UIWebView.class]) { - UIWebView *webview = (UIWebView*)webView; - NSString *response = [webview stringByEvaluatingJavaScriptFromString:script]; - if (completionHandler) - completionHandler(response, nil); - } else if ([webView isKindOfClass:WKWebView.class]) { + if ([webView isKindOfClass:WKWebView.class]) { WKWebView *webview = (WKWebView*)webView; [webview evaluateJavaScript:script completionHandler:^(id result, NSError *error) { if (completionHandler) {