cordova-plugin-appice 2.0.4 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/example/config.xml +59 -0
- package/example/package.json +39 -0
- package/example/res/ai_android.pem +40 -0
- package/example/www/css/index.css +117 -0
- package/example/www/img/cordova_logo.png +0 -0
- package/example/www/img/logo.png +0 -0
- package/example/www/index.html +62 -0
- package/example/www/js/index.js +102 -0
- package/libcordova/android-release-aar.gradle +63 -0
- package/libcordova/build.gradle +50 -0
- package/libcordova/cordova.jar +0 -0
- package/libcordova/proguard-rules.pro +21 -0
- package/libcordova/src/main/AndroidManifest.xml +24 -0
- package/libcordova/src/main/java/com/appice/cordova/AppICEPlugin.java +969 -0
- package/libcordova/src/main/java/com/appice/cordova/CampaignCampsReceiver.java +95 -0
- package/libcordova/src/main/java/com/appice/cordova/NotificationEventService.java +55 -0
- package/libcordova/src/main/res/values/strings.xml +3 -0
- package/package.json +2 -2
- package/plugin.xml +5 -6
- package/scripts/BeforeAndroidBuilt.js +2 -7
- package/src/firebase/modified/modified.iml +11 -0
- package/src/firebase/original/original.iml +11 -0
- package/src/ios/AppICEPlugin.h +1 -0
- package/src/ios/AppICEPlugin.m +19 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
package com.appice.cordova;
|
|
2
|
+
|
|
3
|
+
import android.content.BroadcastReceiver;
|
|
4
|
+
import android.content.Context;
|
|
5
|
+
import android.content.Intent;
|
|
6
|
+
import android.net.Uri;
|
|
7
|
+
import android.os.Bundle;
|
|
8
|
+
|
|
9
|
+
import org.json.JSONException;
|
|
10
|
+
import org.json.JSONObject;
|
|
11
|
+
|
|
12
|
+
import java.net.URLDecoder;
|
|
13
|
+
import java.util.HashMap;
|
|
14
|
+
import java.util.Iterator;
|
|
15
|
+
import java.util.Set;
|
|
16
|
+
|
|
17
|
+
import semusi.activitysdk.ContextSdk;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Created by aman on 14/03/16.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
public class CampaignCampsReceiver extends BroadcastReceiver {
|
|
24
|
+
|
|
25
|
+
@Override
|
|
26
|
+
public void onReceive(Context context, Intent intent) {
|
|
27
|
+
try {
|
|
28
|
+
sendCallback(intent.getExtras(), context);
|
|
29
|
+
} catch (Throwable e) {
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public void sendCallback(Bundle extra, Context context) {
|
|
34
|
+
try {
|
|
35
|
+
// value of user click on campaign
|
|
36
|
+
String tap = extra.getString("tap");
|
|
37
|
+
// value of clicked is True/False based upon user click or not
|
|
38
|
+
String url = extra.getString("url");
|
|
39
|
+
String cdata = extra.getString("cdata");
|
|
40
|
+
String pushCallback = extra.getString("ai_content");
|
|
41
|
+
|
|
42
|
+
JSONObject json = new JSONObject();
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
// gather deeplink data
|
|
46
|
+
if (url != null && url.length() > 0) {
|
|
47
|
+
HashMap<String, Object> deeplinkData = ContextSdk.gatherDeepLinkData(Uri.parse(url));
|
|
48
|
+
Set<String> keys = deeplinkData.keySet();
|
|
49
|
+
for (String key : keys) {
|
|
50
|
+
try {
|
|
51
|
+
json.put(key, deeplinkData.get(key));
|
|
52
|
+
} catch (Throwable e) {
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
} catch (Throwable e) {
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Gather extra data from json object root
|
|
60
|
+
try {
|
|
61
|
+
if (cdata != null && cdata.length() > 0) {
|
|
62
|
+
JSONObject croot = new JSONObject(cdata);
|
|
63
|
+
if (croot != null && croot.length() > 0) {
|
|
64
|
+
Iterator<String> it = croot.keys();
|
|
65
|
+
while (it.hasNext()) {
|
|
66
|
+
String key = it.next();
|
|
67
|
+
Object obj = croot.get(key);
|
|
68
|
+
if (obj.getClass().equals(String.class))
|
|
69
|
+
json.put(key, URLDecoder.decode((String) obj, "UTF-8"));
|
|
70
|
+
else
|
|
71
|
+
json.put(key, obj);
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} catch (Throwable e) {
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
json.put("tap", tap);
|
|
80
|
+
json.put("ai_content", pushCallback);
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
if (url != null && url.length() > 0) {
|
|
84
|
+
Uri path = Uri.parse(url);
|
|
85
|
+
json.put("host", path.getHost());
|
|
86
|
+
json.put("path", path.getPath());
|
|
87
|
+
}
|
|
88
|
+
} catch (Throwable e) {
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
AppICEPlugin.sendNotification(json, context);
|
|
92
|
+
} catch (Throwable e) {
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
package com.appice.cordova;
|
|
2
|
+
|
|
3
|
+
import android.app.job.JobParameters;
|
|
4
|
+
import android.app.job.JobService;
|
|
5
|
+
import android.os.Build;
|
|
6
|
+
import android.os.Bundle;
|
|
7
|
+
import android.os.PersistableBundle;
|
|
8
|
+
|
|
9
|
+
import java.util.Timer;
|
|
10
|
+
import java.util.TimerTask;
|
|
11
|
+
|
|
12
|
+
public class NotificationEventService extends JobService {
|
|
13
|
+
|
|
14
|
+
@Override
|
|
15
|
+
public boolean onStartJob(JobParameters params) {
|
|
16
|
+
if (params != null) {
|
|
17
|
+
PersistableBundle bundle = params.getExtras();
|
|
18
|
+
if (bundle != null) {
|
|
19
|
+
final Bundle bundle1 = toBundle(bundle);
|
|
20
|
+
if (bundle1 != null) {
|
|
21
|
+
new Timer("AppICE-NotifService-Timer").schedule(new TimerTask() {
|
|
22
|
+
@Override
|
|
23
|
+
public void run() {
|
|
24
|
+
CampaignCampsReceiver rc = new CampaignCampsReceiver();
|
|
25
|
+
rc.sendCallback(bundle1, getApplicationContext());
|
|
26
|
+
}
|
|
27
|
+
}, 2 * 1000);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public static Bundle toBundle(PersistableBundle persistableBundle) {
|
|
36
|
+
try {
|
|
37
|
+
if (persistableBundle == null) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
Bundle bundle = new Bundle();
|
|
41
|
+
if (Build.VERSION.SDK_INT >= 21)
|
|
42
|
+
bundle.putAll(persistableBundle);
|
|
43
|
+
return bundle;
|
|
44
|
+
} catch (Throwable e) {
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@Override
|
|
51
|
+
public boolean onStopJob(JobParameters params) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cordova-plugin-appice",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.07",
|
|
4
4
|
"description": "AppICE Plugin for Cordova/PhoneGap",
|
|
5
5
|
"cordova": {
|
|
6
6
|
"id": "cordova-plugin-appice",
|
|
@@ -24,4 +24,4 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"shelljs": "^0.8.4"
|
|
26
26
|
}
|
|
27
|
-
}
|
|
27
|
+
}
|
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-appice" version="2.0.
|
|
2
|
+
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-appice" version="2.0.07">
|
|
3
3
|
<name>AppICE</name>
|
|
4
4
|
<description>AppICE Plugin for Cordova/PhoneGap</description>
|
|
5
5
|
<license>Commercial</license>
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
|
|
40
40
|
<podspec>
|
|
41
41
|
<pods>
|
|
42
|
-
|
|
42
|
+
|
|
43
|
+
<pod name="AppICE-IOS-SDK" spec="1.7.59" />
|
|
43
44
|
</pods>
|
|
44
45
|
</podspec>
|
|
45
46
|
|
|
@@ -113,11 +114,9 @@
|
|
|
113
114
|
<framework src="com.google.firebase:firebase-iid:20.0.0" />
|
|
114
115
|
<framework src="com.google.firebase:firebase-messaging:20.0.0" />
|
|
115
116
|
<framework src="com.google.firebase:firebase-core:16.0.9" />
|
|
116
|
-
<framework src="com.android.support:support-v4:+" />
|
|
117
|
-
<framework src="com.gitlab.grp_appice.src_android_appice-sdk:cordova:2.5.36-rc" />
|
|
117
|
+
<framework src="com.android.support:support-v4:+" />
|
|
118
118
|
<framework src="src/build.gradle" custom="true" type="gradleReference" />
|
|
119
|
-
<framework src="
|
|
120
|
-
|
|
119
|
+
<framework src="appice.io.android:sdk:2.5.63"/>
|
|
121
120
|
|
|
122
121
|
<!--to add modified firebasex files,includes appice classin
|
|
123
122
|
manifest,when SSL pinning enabled adds tag to manifest -->
|
|
@@ -76,12 +76,7 @@ const appName = appConfig.name();
|
|
|
76
76
|
if (err) {
|
|
77
77
|
throw new Error('Unable to find project_properties: ' + err);
|
|
78
78
|
}
|
|
79
|
-
var modifiedBuildGradle = data ;
|
|
80
|
-
var libmfp_prop='cordova.system.library.13=appice.io.android:libmfp:1.0.0'
|
|
81
|
-
//+ '\nimplementation appice.io.android:libmfp:+"';
|
|
82
|
-
if (data.indexOf(libmfp_prop) == -1) {
|
|
83
|
-
fs.appendFileSync(project_properties,'\n'+libmfp_prop);
|
|
84
|
-
}
|
|
79
|
+
var modifiedBuildGradle = data ;
|
|
85
80
|
});
|
|
86
81
|
}
|
|
87
82
|
catch(err) {
|
|
@@ -114,4 +109,4 @@ const appName = appConfig.name();
|
|
|
114
109
|
|
|
115
110
|
|
|
116
111
|
}
|
|
117
|
-
|
|
112
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="JAVA_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
+
<exclude-output />
|
|
5
|
+
<content url="file://$MODULE_DIR$">
|
|
6
|
+
<sourceFolder url="file://$MODULE_DIR$/android" isTestSource="false" packagePrefix="org.apache.cordova.firebase" />
|
|
7
|
+
</content>
|
|
8
|
+
<orderEntry type="inheritedJdk" />
|
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
+
</component>
|
|
11
|
+
</module>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="JAVA_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
+
<exclude-output />
|
|
5
|
+
<content url="file://$MODULE_DIR$">
|
|
6
|
+
<sourceFolder url="file://$MODULE_DIR$/android" isTestSource="false" packagePrefix="org.apache.cordova.firebase" />
|
|
7
|
+
</content>
|
|
8
|
+
<orderEntry type="inheritedJdk" />
|
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
+
</component>
|
|
11
|
+
</module>
|
package/src/ios/AppICEPlugin.h
CHANGED
|
@@ -81,6 +81,7 @@ static NSString* const AIHandleActionNotification = @"AIHandleActionNotification
|
|
|
81
81
|
-(void)setSmallIcon:(CDVInvokedUrlCommand *)command;
|
|
82
82
|
-(void)setSessionTimeout:(CDVInvokedUrlCommand *)command;
|
|
83
83
|
-(void)getSessionTimeout:(CDVInvokedUrlCommand *)command;
|
|
84
|
+
-(void)setUserId:(CDVInvokedUrlCommand *)command;
|
|
84
85
|
|
|
85
86
|
-(void)onHandleRemoteUNotification:(NSDictionary *)userInfo;
|
|
86
87
|
-(void)onHandleNotificationUResponse:(NSDictionary *)userInfo;
|
package/src/ios/AppICEPlugin.m
CHANGED
|
@@ -760,6 +760,25 @@ static NSInteger const kNotificationStackSize = 10;
|
|
|
760
760
|
}];
|
|
761
761
|
}
|
|
762
762
|
|
|
763
|
+
-(void)setUserId:(CDVInvokedUrlCommand *)command {
|
|
764
|
+
[self.commandDelegate runInBackground:^{
|
|
765
|
+
@try {
|
|
766
|
+
NSObject *eventObj = [command argumentAtIndex:0];
|
|
767
|
+
NSArray *userIdArray = [eventObj valueForKey:@"userID"];
|
|
768
|
+
NSLog(@"Appice setuserid %@",userIdArray);
|
|
769
|
+
if ( userIdArray != nil) {
|
|
770
|
+
[[appICE sharedInstance] setUserId:userIdArray];
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
774
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
775
|
+
} @catch(NSException *e) {
|
|
776
|
+
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
|
|
777
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
|
|
778
|
+
}
|
|
779
|
+
}];
|
|
780
|
+
}
|
|
781
|
+
|
|
763
782
|
-(void)getUser:(CDVInvokedUrlCommand *)command {
|
|
764
783
|
[self.commandDelegate runInBackground:^{
|
|
765
784
|
@try {
|