cordova-plugin-appice 2.0.8 → 2.0.10

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.
Files changed (31) hide show
  1. package/README.md +120 -122
  2. package/package.json +45 -27
  3. package/plugin.xml +168 -103
  4. package/scripts/BeforeAndroidBuilt.js +160 -126
  5. package/scripts/BeforeIosBuilt.js +38 -38
  6. package/scripts/androidAfterPluginAdd.js +159 -159
  7. package/scripts/androidAfterPluginRm.js +195 -195
  8. package/scripts/iOSAfterPluginAdd.js +98 -98
  9. package/scripts/iOSAfterPluginRm.js +73 -74
  10. package/src/android/AppICEMFPPush.java +177 -0
  11. package/{libcordova/src/main/java/com/appice/cordova → src/android}/AppICEPlugin.java +405 -489
  12. package/{libcordova/src/main/java/com/appice/cordova → src/android}/CampaignCampsReceiver.java +8 -9
  13. package/{libcordova/src/main/java/com/appice/cordova → src/android}/NotificationEventService.java +16 -7
  14. package/src/build.gradle +16 -14
  15. package/src/firebase/modified/android/FirebasePluginMessagingService.java +356 -356
  16. package/src/firebase/modified/ios/AppDelegate+FirebasePlugin.m +529 -529
  17. package/src/firebase/original/android/FirebasePluginMessagingService.java +348 -348
  18. package/src/firebase/original/ios/AppDelegate+FirebasePlugin.m +519 -519
  19. package/src/ios/AppDelegate+AppICEPlugin.h +8 -8
  20. package/src/ios/AppDelegate+AppICEPlugin.m +278 -191
  21. package/src/ios/AppICEPlugin.h +93 -90
  22. package/src/ios/AppICEPlugin.m +1161 -1062
  23. package/www/AppICE.js +289 -284
  24. package/libcordova/android-release-aar.gradle +0 -63
  25. package/libcordova/build.gradle +0 -50
  26. package/libcordova/cordova.jar +0 -0
  27. package/libcordova/proguard-rules.pro +0 -21
  28. package/libcordova/src/main/AndroidManifest.xml +0 -24
  29. package/libcordova/src/main/res/values/strings.xml +0 -3
  30. package/src/firebase/modified/modified.iml +0 -11
  31. package/src/firebase/original/original.iml +0 -11
@@ -1,159 +1,159 @@
1
- module.exports = function(context) {
2
- var fs =require ('fs');
3
- var path = require('path');
4
- var shell = require('shelljs');
5
-
6
- var platformRoot = path.join(context.opts.projectRoot, 'platforms/android');
7
- var pluginsFirebaseRoot = path.join(context.opts.projectRoot, 'plugins/cordova-plugin-firebasex');
8
- var pluginsAppiceRoot = path.join(context.opts.projectRoot, 'plugins/cordova-plugin-appice');
9
-
10
- const cordovaCommon = context.requireCordovaModule('cordova-common');
11
- const appConfig = new cordovaCommon.ConfigParser('config.xml');
12
-
13
- var APPICE_FIREBASE_UPDATE = appConfig.getPlatformPreference("APPICE_FIREBASE_UPDATE", "android");
14
- var APPICE_APPLICATIONCLASS_INCLUDE= appConfig.getPlatformPreference("APPICE_APPLICATIONCLASS_INCLUDE", "android");
15
- var MFP_PUSH=appConfig.getPlatformPreference("MFP_PUSH", "android");
16
- var SSL_PINNING=appConfig.getPlatformPreference("SSL_PINNING", "android");
17
- var project_properties=path.join(platformRoot,'project.properties');
18
-
19
- console.log("platformPreference : "+APPICE_FIREBASE_UPDATE);
20
- if(APPICE_FIREBASE_UPDATE === "true"){
21
- console.log("else true APPICE_FIREBASE_UPDATE : "+APPICE_FIREBASE_UPDATE);
22
- var firebaseFile1 = path.join(platformRoot, '/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java');
23
- if (fs.existsSync(firebaseFile1)) {
24
- try {
25
- shell.rm('-Rf', firebaseFile1);
26
- } catch(err) {
27
- }
28
- }
29
-
30
- var modifiedFile1 = path.join(pluginsAppiceRoot, '/src/firebase/modified/android/FirebasePluginMessagingService.java');
31
- try {
32
- shell.cp('-f', modifiedFile1, firebaseFile1);
33
- } catch(err) {
34
- }
35
- var firebaseFile2 = path.join(pluginsFirebaseRoot, '/src/android/FirebasePluginMessagingService.java');
36
- if (fs.existsSync(firebaseFile2)) {
37
- try {
38
- shell.rm('-Rf', firebaseFile2);
39
- } catch(err) {
40
- }
41
- }
42
- try {
43
- shell.cp('-f', modifiedFile1, firebaseFile2);
44
- } catch(err) {
45
- }
46
- }
47
- //////
48
- var platformwww1 = path.join(platformRoot, '/platform_www/plugins/cordova-plugin-appice/www/AppICE.js');
49
- var platformwww2 = path.join(pluginsAppiceRoot, '/www/AppICE.js');
50
- if (fs.existsSync(platformwww1)) {
51
- try {
52
- shell.rm('-Rf', platformwww1);
53
- } catch(err) {
54
- }
55
- }
56
- try {
57
- shell.cp('-f', platformwww2, platformwww1);
58
- } catch(err) {
59
- }
60
- ////
61
-
62
- if(APPICE_APPLICATIONCLASS_INCLUDE === "true"){
63
- var manifestFile = path.join(platformRoot, 'AndroidManifest.xml');
64
- if (fs.existsSync(manifestFile)) {
65
- try {
66
- fs.readFile(manifestFile, 'utf8', function (err,data) {
67
- if (err) {
68
- throw new Error('Unable to find AndroidManifest.xml: ' + err);
69
- }
70
- var appClass = 'semusi.activitysdk.ContextApplication';
71
- if (data.indexOf(appClass) == -1) {
72
- var result = data.replace(/<application/g, '<application android:name="' + appClass + '"');
73
- fs.writeFile(manifestFile, result, 'utf8', function (err) {
74
- if (err) {
75
- throw new Error('Unable to write into AndroidManifest.xml: ' + err);
76
- }
77
- });
78
- }
79
- });
80
- } catch(err) {
81
- }
82
- }
83
- else {
84
- var manifestFileNew = path.join(platformRoot, '/app/src/main/AndroidManifest.xml');
85
- if (fs.existsSync(manifestFileNew)) {
86
- try {
87
- fs.readFile(manifestFileNew, 'utf8', function (err,data) {
88
- if (err) {
89
- throw new Error('Unable to find AndroidManifest.xml: ' + err);
90
- }
91
- var appClass = 'semusi.activitysdk.ContextApplication';
92
- if (data.indexOf(appClass) == -1) {
93
- var result = data.replace(/<application/g, '<application android:name="' + appClass + '"');
94
- fs.writeFile(manifestFileNew, result, 'utf8', function (err) {
95
- if (err) {
96
- throw new Error('Unable to write into AndroidManifest.xml: ' + err);
97
- }
98
- });
99
- }
100
- });
101
- } catch(err) {
102
- }
103
- }
104
- }
105
- }
106
-
107
-
108
- if(SSL_PINNING === "true"){
109
- var manifestFileNew_ = path.join(platformRoot, '/app/src/main/AndroidManifest.xml');
110
- if(fs.existsSync(manifestFileNew_)){
111
- try{
112
- fs.readFile(manifestFileNew_, 'utf8', function (err,data_) {
113
- if (err) {
114
- throw new Error('Unable to find AndroidManifest.xml: ' + err);
115
- }
116
-
117
- var SSL_PINNING_meta = '\n<meta-data android:name="APPICE_SSL_PINNING" android:value="1" />';
118
- if (data_.indexOf(SSL_PINNING_meta) == -1) {
119
- var result_ = data_.replace('</application>',SSL_PINNING_meta+'\n</application>');
120
- fs.writeFile(manifestFileNew_, result_, 'utf8', function (err) {
121
- if (err) {
122
- throw new Error('Unable to write into AndroidManifest.xml: ' + err);
123
- }
124
- });
125
-
126
- }
127
- });
128
- }
129
- catch(err) {
130
- }
131
- }else{
132
- var manifestFileNewRoot_ = path.join(platformRoot, 'AndroidManifest.xml');
133
- if(fs.existsSync(manifestFileNewRoot_)){
134
- try{
135
- fs.readFile(manifestFileNewRoot_, 'utf8', function (err,data_) {
136
- if (err) {
137
- throw new Error('Unable to find AndroidManifest.xml: ' + err);
138
- }
139
- ///for SSL pinning
140
- var SSL_PINNING_meta = '<meta-data android:name="APPICE_SSL_PINNING" android:value="1" />';
141
- if (data_.indexOf(SSL_PINNING_meta) == -1) {
142
- var result_ = data_.replace('</application>',SSL_PINNING_meta+'</application>');
143
- fs.writeFile(manifestFileNewRoot_, result_, 'utf8', function (err) {
144
- if (err) {
145
- throw new Error('Unable to write into AndroidManifest.xml: ' + err);
146
- }
147
- });
148
-
149
- }
150
- });
151
- }
152
- catch(err) {
153
- }
154
- }
155
- }
156
- }
157
-
158
-
159
- }
1
+ module.exports = function (context) {
2
+ var fs = require('fs');
3
+ var path = require('path');
4
+ var shell = require('shelljs');
5
+
6
+ var platformRoot = path.join(context.opts.projectRoot, 'platforms/android');
7
+ var pluginsFirebaseRoot = path.join(context.opts.projectRoot, 'plugins/cordova-plugin-firebasex');
8
+ var pluginsAppiceRoot = path.join(context.opts.projectRoot, 'plugins/cordova-plugin-appice');
9
+
10
+ const cordovaCommon = context.requireCordovaModule('cordova-common');
11
+ const appConfig = new cordovaCommon.ConfigParser('config.xml');
12
+
13
+ var APPICE_FIREBASE_UPDATE = appConfig.getPlatformPreference("APPICE_FIREBASE_UPDATE", "android");
14
+ var APPICE_APPLICATIONCLASS_INCLUDE = appConfig.getPlatformPreference("APPICE_APPLICATIONCLASS_INCLUDE", "android");
15
+ var MFP_PUSH = appConfig.getPlatformPreference("MFP_PUSH", "android");
16
+ var SSL_PINNING = appConfig.getPlatformPreference("SSL_PINNING", "android");
17
+ var project_properties = path.join(platformRoot, 'project.properties');
18
+
19
+ console.log("platformPreference : " + APPICE_FIREBASE_UPDATE);
20
+ if (APPICE_FIREBASE_UPDATE === "true") {
21
+ console.log("else true APPICE_FIREBASE_UPDATE : " + APPICE_FIREBASE_UPDATE);
22
+ var firebaseFile1 = path.join(platformRoot, '/app/src/main/java/org/apache/cordova/firebase/FirebasePluginMessagingService.java');
23
+ if (fs.existsSync(firebaseFile1)) {
24
+ try {
25
+ shell.rm('-Rf', firebaseFile1);
26
+ } catch (err) {
27
+ }
28
+ }
29
+
30
+ var modifiedFile1 = path.join(pluginsAppiceRoot, '/src/firebase/modified/android/FirebasePluginMessagingService.java');
31
+ try {
32
+ shell.cp('-f', modifiedFile1, firebaseFile1);
33
+ } catch (err) {
34
+ }
35
+ var firebaseFile2 = path.join(pluginsFirebaseRoot, '/src/android/FirebasePluginMessagingService.java');
36
+ if (fs.existsSync(firebaseFile2)) {
37
+ try {
38
+ shell.rm('-Rf', firebaseFile2);
39
+ } catch (err) {
40
+ }
41
+ }
42
+ try {
43
+ shell.cp('-f', modifiedFile1, firebaseFile2);
44
+ } catch (err) {
45
+ }
46
+ }
47
+ //////
48
+ var platformwww1 = path.join(platformRoot, '/platform_www/plugins/cordova-plugin-appice/www/AppICE.js');
49
+ var platformwww2 = path.join(pluginsAppiceRoot, '/www/AppICE.js');
50
+ if (fs.existsSync(platformwww1)) {
51
+ try {
52
+ shell.rm('-Rf', platformwww1);
53
+ } catch (err) {
54
+ }
55
+ }
56
+ try {
57
+ shell.cp('-f', platformwww2, platformwww1);
58
+ } catch (err) {
59
+ }
60
+ ////
61
+
62
+ if (APPICE_APPLICATIONCLASS_INCLUDE === "true") {
63
+ var manifestFile = path.join(platformRoot, 'AndroidManifest.xml');
64
+ if (fs.existsSync(manifestFile)) {
65
+ try {
66
+ fs.readFile(manifestFile, 'utf8', function (err, data) {
67
+ if (err) {
68
+ throw new Error('Unable to find AndroidManifest.xml: ' + err);
69
+ }
70
+ var appClass = 'semusi.activitysdk.ContextApplication';
71
+ if (data.indexOf(appClass) == -1) {
72
+ var result = data.replace(/<application/g, '<application android:name="' + appClass + '"');
73
+ fs.writeFile(manifestFile, result, 'utf8', function (err) {
74
+ if (err) {
75
+ throw new Error('Unable to write into AndroidManifest.xml: ' + err);
76
+ }
77
+ });
78
+ }
79
+ });
80
+ } catch (err) {
81
+ }
82
+ }
83
+ else {
84
+ var manifestFileNew = path.join(platformRoot, '/app/src/main/AndroidManifest.xml');
85
+ if (fs.existsSync(manifestFileNew)) {
86
+ try {
87
+ fs.readFile(manifestFileNew, 'utf8', function (err, data) {
88
+ if (err) {
89
+ throw new Error('Unable to find AndroidManifest.xml: ' + err);
90
+ }
91
+ var appClass = 'semusi.activitysdk.ContextApplication';
92
+ if (data.indexOf(appClass) == -1) {
93
+ var result = data.replace(/<application/g, '<application android:name="' + appClass + '"');
94
+ fs.writeFile(manifestFileNew, result, 'utf8', function (err) {
95
+ if (err) {
96
+ throw new Error('Unable to write into AndroidManifest.xml: ' + err);
97
+ }
98
+ });
99
+ }
100
+ });
101
+ } catch (err) {
102
+ }
103
+ }
104
+ }
105
+ }
106
+
107
+
108
+ if (SSL_PINNING === "true") {
109
+ var manifestFileNew_ = path.join(platformRoot, '/app/src/main/AndroidManifest.xml');
110
+ if (fs.existsSync(manifestFileNew_)) {
111
+ try {
112
+ fs.readFile(manifestFileNew_, 'utf8', function (err, data_) {
113
+ if (err) {
114
+ throw new Error('Unable to find AndroidManifest.xml: ' + err);
115
+ }
116
+
117
+ var SSL_PINNING_meta = '\n<meta-data android:name="APPICE_SSL_PINNING" android:value="1" />';
118
+ if (data_.indexOf(SSL_PINNING_meta) == -1) {
119
+ var result_ = data_.replace('</application>', SSL_PINNING_meta + '\n</application>');
120
+ fs.writeFile(manifestFileNew_, result_, 'utf8', function (err) {
121
+ if (err) {
122
+ throw new Error('Unable to write into AndroidManifest.xml: ' + err);
123
+ }
124
+ });
125
+
126
+ }
127
+ });
128
+ }
129
+ catch (err) {
130
+ }
131
+ } else {
132
+ var manifestFileNewRoot_ = path.join(platformRoot, 'AndroidManifest.xml');
133
+ if (fs.existsSync(manifestFileNewRoot_)) {
134
+ try {
135
+ fs.readFile(manifestFileNewRoot_, 'utf8', function (err, data_) {
136
+ if (err) {
137
+ throw new Error('Unable to find AndroidManifest.xml: ' + err);
138
+ }
139
+ ///for SSL pinning
140
+ var SSL_PINNING_meta = '<meta-data android:name="APPICE_SSL_PINNING" android:value="1" />';
141
+ if (data_.indexOf(SSL_PINNING_meta) == -1) {
142
+ var result_ = data_.replace('</application>', SSL_PINNING_meta + '</application>');
143
+ fs.writeFile(manifestFileNewRoot_, result_, 'utf8', function (err) {
144
+ if (err) {
145
+ throw new Error('Unable to write into AndroidManifest.xml: ' + err);
146
+ }
147
+ });
148
+
149
+ }
150
+ });
151
+ }
152
+ catch (err) {
153
+ }
154
+ }
155
+ }
156
+ }
157
+
158
+
159
+ }