indigitall-capacitor-plugin 2.0.5 → 2.1.0
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/IndigitallCapacitorPlugin.podspec +1 -1
- package/README.md +4 -4
- package/android/build.gradle +3 -3
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/java/com/indigitall/capacitor/IndigitallCpPlugin.java +12 -12
- package/android/src/main/java/com/indigitall/capacitor/IndigitallInAppPlugin.java +104 -46
- package/android/src/main/java/com/indigitall/capacitor/implementations/CustomerCp.java +7 -7
- package/android/src/main/java/com/indigitall/capacitor/implementations/InAppCp.java +52 -13
- package/android/src/main/java/com/indigitall/capacitor/implementations/IndigitallCp.java +18 -18
- package/android/src/main/java/com/indigitall/capacitor/models/CpIndigitallHiddenActivity.java +3 -3
- package/android/src/main/java/com/indigitall/capacitor/models/CpPushNotification.java +12 -7
- package/android/src/main/java/com/indigitall/capacitor/services/IndigitallFirebaseMessagingService.java +3 -3
- package/android/src/main/java/com/indigitall/capacitor/utils/CpIndigitallUtils.java +4 -4
- package/android/src/main/java/com/indigitall/capacitor/utils/IndigitallInAppParse.java +49 -32
- package/android/src/main/java/com/indigitall/capacitor/utils/IndigitallParse.java +15 -82
- package/dist/docs.json +2 -2
- package/dist/esm/InApp.js +290 -85
- package/dist/esm/InApp.js.map +1 -1
- package/dist/esm/Push.js +3 -3
- package/dist/esm/Push.js.map +1 -1
- package/dist/esm/callbacks/callbacksType.d.ts +3 -1
- package/dist/esm/callbacks/callbacksType.js.map +1 -1
- package/dist/esm/definitions/customerDefinitions.d.ts +2 -2
- package/dist/esm/definitions/customerDefinitions.js.map +1 -1
- package/dist/esm/definitions/inAppDefinitions.d.ts +13 -3
- package/dist/esm/definitions/inAppDefinitions.js.map +1 -1
- package/dist/esm/definitions/pushDefinitions.d.ts +2 -2
- package/dist/esm/definitions/pushDefinitions.js.map +1 -1
- package/dist/esm/models/InInApp.d.ts +1 -1
- package/dist/esm/models/InInApp.js.map +1 -1
- package/dist/esm/models/InInbox.d.ts +1 -1
- package/dist/esm/models/InInbox.js.map +1 -1
- package/dist/esm/params/customerParams.d.ts +1 -1
- package/dist/esm/params/customerParams.js.map +1 -1
- package/dist/plugin.cjs.js +292 -88
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +292 -88
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/IndigitallCpPlugin.swift +1 -1
- package/ios/Plugin/implementations/CustomerCp.swift +1 -3
- package/ios/Plugin/implementations/InAppCp.swift +7 -24
- package/ios/Plugin/implementations/InboxCp.swift +9 -9
- package/ios/Plugin/implementations/IndigitallCp.swift +2 -2
- package/ios/Plugin/utils/IndigitallParse.h +1 -2
- package/ios/Plugin/utils/IndigitallParse.m +41 -21
- package/package.json +5 -5
|
@@ -13,6 +13,6 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
14
|
s.ios.deployment_target = '12.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
|
-
s.dependency 'indigitall-ios', '~>
|
|
16
|
+
s.dependency 'indigitall-ios', '~> 6.2.0'
|
|
17
17
|
s.swift_version = '5.1'
|
|
18
18
|
end
|
package/README.md
CHANGED
|
@@ -238,12 +238,12 @@ isIndigitallPushNotification(params: { notification: any; }) => Promise<any>
|
|
|
238
238
|
### logIn(...)
|
|
239
239
|
|
|
240
240
|
```typescript
|
|
241
|
-
logIn(param: {
|
|
241
|
+
logIn(param: { externalCode: string; }) => Promise<any>
|
|
242
242
|
```
|
|
243
243
|
|
|
244
|
-
| Param | Type
|
|
245
|
-
| ----------- |
|
|
246
|
-
| **`param`** | <code>{
|
|
244
|
+
| Param | Type |
|
|
245
|
+
| ----------- | -------------------------------------- |
|
|
246
|
+
| **`param`** | <code>{ externalCode: string; }</code> |
|
|
247
247
|
|
|
248
248
|
**Returns:** <code>Promise<any></code>
|
|
249
249
|
|
package/android/build.gradle
CHANGED
|
@@ -19,10 +19,10 @@ apply plugin: 'com.android.library'
|
|
|
19
19
|
|
|
20
20
|
android {
|
|
21
21
|
namespace "com.indigitall.capacitor"
|
|
22
|
-
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
22
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
|
|
23
23
|
defaultConfig {
|
|
24
24
|
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
|
|
25
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
|
|
26
26
|
versionCode 1
|
|
27
27
|
versionName "1.0"
|
|
28
28
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -56,7 +56,7 @@ dependencies {
|
|
|
56
56
|
testImplementation "junit:junit:$junitVersion"
|
|
57
57
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
58
58
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
59
|
-
implementation('com.indigitall:android:5.
|
|
59
|
+
implementation('com.indigitall:android:5.4.+'){
|
|
60
60
|
exclude group: "com.indigitall", module: "android-hms"
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
</queries>
|
|
15
15
|
<application
|
|
16
16
|
android:allowBackup="true">
|
|
17
|
-
<service android:name="com.indigitall.android.services.StatisticService" />
|
|
18
|
-
<receiver android:name="com.indigitall.android.receivers.BootReceiver"
|
|
17
|
+
<service android:name="com.indigitall.android.push.services.StatisticService" />
|
|
18
|
+
<receiver android:name="com.indigitall.android.push.receivers.BootReceiver"
|
|
19
19
|
android:exported="false">
|
|
20
20
|
<intent-filter>
|
|
21
21
|
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
|
@@ -18,18 +18,18 @@ import com.getcapacitor.PluginCall;
|
|
|
18
18
|
import com.getcapacitor.PluginMethod;
|
|
19
19
|
import com.getcapacitor.PluginResult;
|
|
20
20
|
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
21
|
-
import com.indigitall.android.callbacks.DeviceCallback;
|
|
22
|
-
import com.indigitall.android.callbacks.EventCallback;
|
|
23
|
-
import com.indigitall.android.callbacks.InitCallBack;
|
|
24
|
-
import com.indigitall.android.callbacks.PushTokenCallback;
|
|
25
|
-
import com.indigitall.android.callbacks.TopicsCallback;
|
|
21
|
+
import com.indigitall.android.push.callbacks.DeviceCallback;
|
|
22
|
+
import com.indigitall.android.push.callbacks.EventCallback;
|
|
23
|
+
import com.indigitall.android.push.callbacks.InitCallBack;
|
|
24
|
+
import com.indigitall.android.push.callbacks.PushTokenCallback;
|
|
25
|
+
import com.indigitall.android.push.callbacks.TopicsCallback;
|
|
26
26
|
import com.indigitall.android.commons.models.ErrorModel;
|
|
27
|
-
import com.indigitall.android.models.Device;
|
|
28
|
-
import com.indigitall.android.models.Permission;
|
|
29
|
-
import com.indigitall.android.models.Push;
|
|
30
|
-
import com.indigitall.android.models.PushErrorModel;
|
|
31
|
-
import com.indigitall.android.models.Topic;
|
|
32
|
-
import com.indigitall.android.utils.FirebaseUtils;
|
|
27
|
+
import com.indigitall.android.push.models.Device;
|
|
28
|
+
import com.indigitall.android.push.models.Permission;
|
|
29
|
+
import com.indigitall.android.push.models.Push;
|
|
30
|
+
import com.indigitall.android.push.models.PushErrorModel;
|
|
31
|
+
import com.indigitall.android.push.models.Topic;
|
|
32
|
+
import com.indigitall.android.push.utils.FirebaseUtils;
|
|
33
33
|
import com.indigitall.capacitor.interfaces.IndigitallFirebaseInterface;
|
|
34
34
|
import com.indigitall.capacitor.utils.CpPreferenceUtils;
|
|
35
35
|
import com.indigitall.capacitor.utils.IndigitallParse;
|
|
@@ -407,7 +407,7 @@ public class IndigitallCpPlugin extends Plugin implements IndigitallFirebaseInte
|
|
|
407
407
|
|
|
408
408
|
@PluginMethod
|
|
409
409
|
public void logIn(PluginCall call) {
|
|
410
|
-
String EXTERNAL_ID = "
|
|
410
|
+
String EXTERNAL_ID = "externalCode";
|
|
411
411
|
String externalId = call.getString(EXTERNAL_ID);
|
|
412
412
|
IndigitallCp.logIn(getContext(), externalId, new DeviceCallback(getContext()) {
|
|
413
413
|
@Override
|
|
@@ -3,6 +3,10 @@ package com.indigitall.capacitor;
|
|
|
3
3
|
import android.util.Log;
|
|
4
4
|
import android.webkit.WebView;
|
|
5
5
|
|
|
6
|
+
import androidx.annotation.NonNull;
|
|
7
|
+
import androidx.annotation.Nullable;
|
|
8
|
+
|
|
9
|
+
import com.getcapacitor.JSArray;
|
|
6
10
|
import com.getcapacitor.JSObject;
|
|
7
11
|
import com.getcapacitor.Plugin;
|
|
8
12
|
import com.getcapacitor.PluginCall;
|
|
@@ -14,22 +18,29 @@ import com.indigitall.android.inapp.InAppIndigitall;
|
|
|
14
18
|
import com.indigitall.android.inapp.callbacks.GetInAppCallback;
|
|
15
19
|
import com.indigitall.android.inapp.callbacks.InAppCallback;
|
|
16
20
|
import com.indigitall.android.inapp.callbacks.InAppTopicCallback;
|
|
21
|
+
import com.indigitall.android.inapp.callbacks.InAppTopicListCallback;
|
|
17
22
|
import com.indigitall.android.inapp.callbacks.ShowInAppCallback;
|
|
18
23
|
import com.indigitall.android.inapp.models.InApp;
|
|
19
24
|
import com.indigitall.android.inapp.models.InAppErrorModel;
|
|
25
|
+
import com.indigitall.android.inapp.models.InAppTopic;
|
|
20
26
|
import com.indigitall.capacitor.implementations.InAppCp;
|
|
21
27
|
import com.indigitall.capacitor.utils.IndigitallInAppParse;
|
|
22
28
|
|
|
29
|
+
import org.json.JSONArray;
|
|
23
30
|
import org.json.JSONException;
|
|
24
31
|
import org.json.JSONObject;
|
|
25
32
|
|
|
33
|
+
import java.util.ArrayList;
|
|
34
|
+
|
|
26
35
|
@CapacitorPlugin(name = "InAppCp")
|
|
27
36
|
public class IndigitallInAppPlugin extends Plugin {
|
|
28
37
|
private final String IN_APP = "inApp";
|
|
29
38
|
private final String IN_APP_SCHEMA = "inAppSchemaCode";
|
|
30
39
|
private final String TOPICS = "topics";
|
|
31
40
|
private final String PARAMS = "params";
|
|
32
|
-
private final String PKN = "
|
|
41
|
+
private final String PKN = "packageNam";
|
|
42
|
+
|
|
43
|
+
private final String FORM = "form";
|
|
33
44
|
|
|
34
45
|
@PluginMethod
|
|
35
46
|
public void getPackageName(PluginCall call) {
|
|
@@ -62,51 +73,18 @@ public class IndigitallInAppPlugin extends Plugin {
|
|
|
62
73
|
public void inAppWasShown(PluginCall call) throws JSONException {
|
|
63
74
|
JSObject ret = new JSObject();
|
|
64
75
|
String MAP_INAPP_CODE = "inAppSchemaCode";
|
|
65
|
-
InAppCp.inAppWasShown(getContext(), call.getObject(PARAMS), new
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
@Override
|
|
78
|
-
public void onFail(ErrorModel errorModel) {
|
|
79
|
-
call.reject(IndigitallInAppParse.jsonFromErrorModel(errorModel).toString());
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
@Override
|
|
86
|
-
public void didShowManyTimes(InApp inApp, InAppErrorModel inAppErrorModel) {
|
|
87
|
-
call.reject(IndigitallInAppParse.jsonFromInAppShowError(inApp, inAppErrorModel).toString());
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
@Override
|
|
91
|
-
public void didFound(InApp inApp) {
|
|
92
|
-
ret.put(IN_APP, IndigitallInAppParse.jsonFromInApp(inApp));
|
|
93
|
-
call.resolve(ret);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
@Override
|
|
97
|
-
public void didExpired(InApp inApp, InAppErrorModel inAppErrorModel) {
|
|
98
|
-
call.reject(IndigitallInAppParse.jsonFromInAppShowError(inApp, inAppErrorModel).toString());
|
|
99
|
-
}
|
|
76
|
+
InAppCp.inAppWasShown(getContext(), call.getObject(PARAMS), new InAppCallback(getContext()) {
|
|
77
|
+
@Override
|
|
78
|
+
public void onSuccess(InApp inApp) {
|
|
79
|
+
ret.put(IN_APP, IndigitallInAppParse.jsonFromInApp(inApp));
|
|
80
|
+
call.resolve(ret);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@Override
|
|
84
|
+
public void onError(int i, String s, String s1) {
|
|
85
|
+
call.reject(s);
|
|
86
|
+
}
|
|
100
87
|
|
|
101
|
-
@Override
|
|
102
|
-
public void didDismissForever(InApp inApp, InAppErrorModel inAppErrorModel) {
|
|
103
|
-
call.reject(IndigitallInAppParse.jsonFromInAppShowError(inApp, inAppErrorModel).toString());
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
@Override
|
|
107
|
-
public void didClickOut(InApp inApp, InAppErrorModel inAppErrorModel) {
|
|
108
|
-
call.reject(IndigitallInAppParse.jsonFromInAppShowError(inApp, inAppErrorModel).toString());
|
|
109
|
-
}
|
|
110
88
|
});
|
|
111
89
|
}
|
|
112
90
|
|
|
@@ -140,7 +118,7 @@ public class IndigitallInAppPlugin extends Plugin {
|
|
|
140
118
|
}
|
|
141
119
|
}
|
|
142
120
|
|
|
143
|
-
|
|
121
|
+
|
|
144
122
|
@PluginMethod
|
|
145
123
|
public void addNewInAppToDismissForever(PluginCall call) {
|
|
146
124
|
try {
|
|
@@ -218,8 +196,88 @@ public class IndigitallInAppPlugin extends Plugin {
|
|
|
218
196
|
public void onSuccess(InApp inApp) {
|
|
219
197
|
//ret.put(ACTION, "onSuccess");
|
|
220
198
|
}
|
|
199
|
+
|
|
200
|
+
@Override
|
|
201
|
+
public void didFormError(InApp inApp, ArrayList<InAppErrorModel> arrayList) {
|
|
202
|
+
ret.put(ACTION, "didFormError");
|
|
203
|
+
call.resolve(ret);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
@Override
|
|
207
|
+
public void didFormSubmit(InApp inApp) {
|
|
208
|
+
ret.put(ACTION, "didFormSubmit");
|
|
209
|
+
call.resolve(ret);
|
|
210
|
+
}
|
|
221
211
|
});
|
|
222
212
|
}
|
|
223
213
|
|
|
214
|
+
@PluginMethod
|
|
215
|
+
public void topicList(PluginCall call) throws JSONException {
|
|
216
|
+
JSObject ret = new JSObject();
|
|
217
|
+
InAppCp.topicsList(getContext(), new BaseCallback() {
|
|
218
|
+
@Override
|
|
219
|
+
public void onSuccess(JSONObject jsonObject) {
|
|
220
|
+
ret.put(TOPICS, jsonObject);
|
|
221
|
+
call.resolve(ret);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@Override
|
|
225
|
+
public void onFail(@NonNull ErrorModel errorModel) {
|
|
226
|
+
call.reject(IndigitallInAppParse.jsonFromErrorModel(errorModel).toString());
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@PluginMethod
|
|
233
|
+
public void topicsSubscribe(PluginCall call) throws JSONException {
|
|
234
|
+
JSObject ret = new JSObject();
|
|
235
|
+
JSArray array = call.getArray(TOPICS);
|
|
236
|
+
String[] topicsList = new String[array.length()];
|
|
237
|
+
for (int i = 0; i < array.length(); i++) {
|
|
238
|
+
topicsList[i] = array.getString(i);
|
|
239
|
+
}
|
|
240
|
+
InAppCp.topicsSubscribe(getContext(), topicsList, new InAppTopicCallback() {
|
|
241
|
+
@Override
|
|
242
|
+
public void onSuccess(@NonNull String s) {
|
|
243
|
+
ret.put(TOPICS, s);
|
|
244
|
+
call.resolve(ret);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
@Override
|
|
248
|
+
public void onError(@NonNull InAppErrorModel inAppErrorModel) {
|
|
249
|
+
call.reject(IndigitallInAppParse.jsonFromErrorModel(inAppErrorModel).toString());
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
@PluginMethod
|
|
255
|
+
public void topicsUnsubscribe(PluginCall call) throws JSONException {
|
|
256
|
+
JSObject ret = new JSObject();
|
|
257
|
+
JSArray array = call.getArray(TOPICS);
|
|
258
|
+
String[] topicsList = new String[array.length()];
|
|
259
|
+
for (int i = 0; i < array.length(); i++) {
|
|
260
|
+
topicsList[i] = array.getString(i);
|
|
261
|
+
}
|
|
262
|
+
InAppCp.topicsUnsubscribe(getContext(), topicsList, new InAppTopicCallback() {
|
|
263
|
+
@Override
|
|
264
|
+
public void onSuccess(@NonNull String s) {
|
|
265
|
+
ret.put(TOPICS, s);
|
|
266
|
+
call.resolve(ret);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
@Override
|
|
270
|
+
public void onError(@NonNull InAppErrorModel inAppErrorModel) {
|
|
271
|
+
call.reject(IndigitallInAppParse.jsonFromErrorModel(inAppErrorModel).toString());
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
@PluginMethod
|
|
277
|
+
public void formSubmit(PluginCall call) throws JSONException {
|
|
278
|
+
JSONArray array = call.getArray(FORM);
|
|
279
|
+
InAppCp.formSubmit(getContext(), array.getJSONObject(0), array, call);
|
|
280
|
+
}
|
|
281
|
+
|
|
224
282
|
}
|
|
225
283
|
|
|
@@ -5,13 +5,13 @@ import android.content.Context;
|
|
|
5
5
|
import com.getcapacitor.JSArray;
|
|
6
6
|
import com.getcapacitor.JSObject;
|
|
7
7
|
import com.indigitall.android.Indigitall;
|
|
8
|
-
import com.indigitall.android.callbacks.DeviceCallback;
|
|
8
|
+
import com.indigitall.android.push.callbacks.DeviceCallback;
|
|
9
9
|
import com.indigitall.android.commons.models.Channel;
|
|
10
10
|
import com.indigitall.android.commons.models.ErrorModel;
|
|
11
11
|
import com.indigitall.android.customer.CustomerIndigitall;
|
|
12
12
|
import com.indigitall.android.customer.callbacks.CustomerCallback;
|
|
13
13
|
import com.indigitall.android.customer.callbacks.CustomerFieldCallback;
|
|
14
|
-
import com.indigitall.android.models.Device;
|
|
14
|
+
import com.indigitall.android.push.models.Device;
|
|
15
15
|
import com.indigitall.capacitor.utils.IndigitallParse;
|
|
16
16
|
|
|
17
17
|
import org.json.JSONArray;
|
|
@@ -51,7 +51,7 @@ public class CustomerCp {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
public static void link(Context context, JSObject params, final CustomerCallback callback) throws JSONException{
|
|
54
|
-
String JSON_EXTERNAL_ID = "
|
|
54
|
+
String JSON_EXTERNAL_ID = "externalCode";
|
|
55
55
|
String JSON_CHANNEL = "channel";
|
|
56
56
|
String externalId = null;
|
|
57
57
|
Channel channel = Channel.PUSH;
|
|
@@ -61,10 +61,10 @@ public class CustomerCp {
|
|
|
61
61
|
channel = IndigitallParse.parseChannel(Objects.requireNonNull(params.getString(JSON_CHANNEL)));
|
|
62
62
|
}
|
|
63
63
|
Channel finalChannel = channel;
|
|
64
|
-
Indigitall.logIn(context, externalId, new DeviceCallback(context) {
|
|
64
|
+
Indigitall.INSTANCE.logIn(context, externalId, new DeviceCallback(context) {
|
|
65
65
|
@Override
|
|
66
66
|
public void onSuccess(Device device) {
|
|
67
|
-
CustomerIndigitall.INSTANCE.
|
|
67
|
+
CustomerIndigitall.INSTANCE.link(context, finalChannel, callback);
|
|
68
68
|
}
|
|
69
69
|
@Override
|
|
70
70
|
public void onFail(ErrorModel error) { callback.onFail(error); }
|
|
@@ -78,10 +78,10 @@ public class CustomerCp {
|
|
|
78
78
|
channel = IndigitallParse.parseChannel(Objects.requireNonNull(params.getString(JSON_CHANNEL)));
|
|
79
79
|
}
|
|
80
80
|
Channel finalChannel = channel;
|
|
81
|
-
Indigitall.logOut(context, new DeviceCallback(context) {
|
|
81
|
+
Indigitall.INSTANCE.logOut(context, new DeviceCallback(context) {
|
|
82
82
|
@Override
|
|
83
83
|
public void onSuccess(Device device) {
|
|
84
|
-
CustomerIndigitall.INSTANCE.
|
|
84
|
+
CustomerIndigitall.INSTANCE.unlink(context, finalChannel, callback);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
@Override
|
|
@@ -9,11 +9,13 @@ import android.view.View;
|
|
|
9
9
|
import android.widget.ImageButton;
|
|
10
10
|
|
|
11
11
|
import com.getcapacitor.JSObject;
|
|
12
|
+
import com.getcapacitor.PluginCall;
|
|
12
13
|
import com.indigitall.android.commons.callbacks.BaseCallback;
|
|
13
14
|
import com.indigitall.android.commons.models.LogLevel;
|
|
14
15
|
import com.indigitall.android.inapp.InAppConfiguration;
|
|
15
16
|
import com.indigitall.android.inapp.InAppIndigitall;
|
|
16
17
|
import com.indigitall.android.inapp.Utils.EventUtils;
|
|
18
|
+
import com.indigitall.android.inapp.Utils.InAppFormUtils;
|
|
17
19
|
import com.indigitall.android.inapp.Utils.InAppUtils;
|
|
18
20
|
import com.indigitall.android.inapp.Utils.PopUpUtils;
|
|
19
21
|
import com.indigitall.android.inapp.Utils.ServiceUtils;
|
|
@@ -24,39 +26,43 @@ import com.indigitall.android.inapp.callbacks.InAppTopicCallback;
|
|
|
24
26
|
import com.indigitall.android.inapp.callbacks.ShowInAppCallback;
|
|
25
27
|
import com.indigitall.android.inapp.models.InApp;
|
|
26
28
|
import com.indigitall.android.inapp.models.InAppAction;
|
|
29
|
+
import com.indigitall.android.inapp.models.InAppErrorModel;
|
|
30
|
+
import com.indigitall.android.inapp.models.InAppForm;
|
|
31
|
+
import com.indigitall.capacitor.utils.IndigitallInAppParse;
|
|
27
32
|
|
|
33
|
+
import org.json.JSONArray;
|
|
28
34
|
import org.json.JSONException;
|
|
29
35
|
import org.json.JSONObject;
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
import java.util.ArrayList;
|
|
32
38
|
|
|
39
|
+
public class InAppCp {
|
|
40
|
+
private static final String IN_APP = "inApp";
|
|
33
41
|
public static void inAppGet(Context context, String inAppSchemaCode, InAppCallback callback) {
|
|
34
42
|
InAppIndigitall.inAppGet(context, inAppSchemaCode, callback);
|
|
35
43
|
}
|
|
36
44
|
|
|
37
|
-
public static void inAppWasShown(Context context, JSObject params,
|
|
45
|
+
public static void inAppWasShown(Context context, JSObject params, InAppCallback callback) throws JSONException {
|
|
38
46
|
String MAP_INAPP_CODE = "inAppSchemaCode";
|
|
39
47
|
String MAP_DOMAIN_INAPP = "domainInApp";
|
|
40
48
|
String MAP_APPKEY = "appKey";
|
|
41
49
|
|
|
42
50
|
String inAppCode = null;
|
|
43
51
|
String appKey = "";
|
|
44
|
-
String domainInApp = "https://device-api.indigitall.com/v2/
|
|
52
|
+
String domainInApp = "https://device-api.indigitall.com/v2/";
|
|
45
53
|
|
|
46
54
|
if (params.has(MAP_INAPP_CODE)) inAppCode = params.getString(MAP_INAPP_CODE);
|
|
47
55
|
if (params.has(MAP_APPKEY)) appKey = params.getString(MAP_APPKEY);
|
|
48
|
-
if (params.has(MAP_DOMAIN_INAPP)) domainInApp = params.getString(MAP_DOMAIN_INAPP)
|
|
56
|
+
if (params.has(MAP_DOMAIN_INAPP)) domainInApp = params.getString(MAP_DOMAIN_INAPP);
|
|
49
57
|
InAppConfiguration.Builder inAppConfiguration = new InAppConfiguration.Builder(appKey);
|
|
50
58
|
inAppConfiguration.setUrlInAppApi(domainInApp);
|
|
51
59
|
inAppConfiguration.setLogDebug(LogLevel.DEBUG);
|
|
52
60
|
InAppConfiguration config = inAppConfiguration.build();
|
|
53
|
-
|
|
54
|
-
config.updateConfiguration(context);
|
|
55
|
-
ShowInAppUtils.INSTANCE.inAppWasGot(context, inAppCode, callback);
|
|
61
|
+
InAppIndigitall.showCustomInApp(context, config, inAppCode, callback);
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
public static void addNewInAppClick(Context context, JSONObject json) throws JSONException {
|
|
59
|
-
InApp inApp = new InApp(json);
|
|
65
|
+
InApp inApp = new InApp(context, json);
|
|
60
66
|
if (inApp.getProperties() != null && inApp.getProperties().getAction() != null) {
|
|
61
67
|
Intent intent = inApp.getProperties().getAction().getIntent(context);
|
|
62
68
|
boolean isAppAction = inApp.getProperties().getAction().getType() == InAppAction.Type.APP;
|
|
@@ -65,7 +71,7 @@ public class InAppCp {
|
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
public static void addNewInAppToDismissForever(Context context, JSONObject json) throws JSONException {
|
|
68
|
-
InApp inApp = new InApp(json);
|
|
74
|
+
InApp inApp = new InApp(context, json);
|
|
69
75
|
PopUpUtils.INSTANCE.addNewInAppToDismissForever(context, inApp);
|
|
70
76
|
}
|
|
71
77
|
|
|
@@ -81,11 +87,11 @@ public class InAppCp {
|
|
|
81
87
|
ImageButton imageCloseButton = null;
|
|
82
88
|
String imageCloseButtonName;
|
|
83
89
|
String appKey = "";
|
|
84
|
-
String domainInApp = "https://device-api.indigitall.com/v2
|
|
90
|
+
String domainInApp = "https://device-api.indigitall.com/v2";
|
|
85
91
|
|
|
86
92
|
if (params.has(MAP_INAPP_CODE)) inAppCode = params.getString(MAP_INAPP_CODE);
|
|
87
93
|
if (params.has(MAP_APPKEY)) appKey = params.getString(MAP_APPKEY);
|
|
88
|
-
if (params.has(MAP_DOMAIN_INAPP)) domainInApp = params.getString(MAP_DOMAIN_INAPP)
|
|
94
|
+
if (params.has(MAP_DOMAIN_INAPP)) domainInApp = params.getString(MAP_DOMAIN_INAPP);
|
|
89
95
|
if (params.has(MAP_INAPP_IMAGE_CLOSE_BUTTON)) {
|
|
90
96
|
imageCloseButtonName = params.getString(MAP_INAPP_IMAGE_CLOSE_BUTTON);
|
|
91
97
|
imageCloseButton = new ImageButton(context);
|
|
@@ -113,12 +119,12 @@ public class InAppCp {
|
|
|
113
119
|
}
|
|
114
120
|
|
|
115
121
|
public static void eventPrintInAppRequest(Context context, JSONObject json) throws JSONException {
|
|
116
|
-
InApp inApp = new InApp(json);
|
|
122
|
+
InApp inApp = new InApp(context, json);
|
|
117
123
|
EventUtils.INSTANCE.sendEventPrint(context, inApp);
|
|
118
124
|
}
|
|
119
125
|
|
|
120
126
|
public static void eventClickInAppRequest(Context context, JSONObject json) throws JSONException {
|
|
121
|
-
InApp inApp = new InApp(json);
|
|
127
|
+
InApp inApp = new InApp(context, json);
|
|
122
128
|
EventUtils.INSTANCE.sendEventClick(context, inApp);
|
|
123
129
|
}
|
|
124
130
|
|
|
@@ -133,4 +139,37 @@ public class InAppCp {
|
|
|
133
139
|
public static void topicsUnsubscribe(Context context, String[] topics, InAppTopicCallback callback) {
|
|
134
140
|
InAppIndigitall.topicsUnsubscribe(context, topics, callback);
|
|
135
141
|
}
|
|
142
|
+
|
|
143
|
+
public static void formSubmit(Context context, JSONObject json, JSONArray params, PluginCall call) throws JSONException {
|
|
144
|
+
InAppForm inAppForm = null;
|
|
145
|
+
String jsonFormat = null;
|
|
146
|
+
String jsonCustomer = null;
|
|
147
|
+
InApp inApp = new InApp(context, json);
|
|
148
|
+
if(params.get(1) != null && params.get(1) instanceof String) {
|
|
149
|
+
inAppForm = new InAppForm(new JSONObject(params.getString(1)));
|
|
150
|
+
}
|
|
151
|
+
if(params.get(2) != null && params.get(2) instanceof String) {
|
|
152
|
+
jsonFormat = params.getString(2);
|
|
153
|
+
}
|
|
154
|
+
if(params.get(3) != null && params.get(3) instanceof String) {
|
|
155
|
+
jsonCustomer = params.getString(3);
|
|
156
|
+
}
|
|
157
|
+
if (inAppForm != null && jsonFormat != null) {
|
|
158
|
+
ArrayList<InAppErrorModel> errorList = InAppFormUtils.INSTANCE.checkFieldsForm(inAppForm, new JSONObject(jsonFormat));
|
|
159
|
+
if (errorList.isEmpty()) {
|
|
160
|
+
EventUtils.INSTANCE.sendEventForm(context, inApp, new JSONObject(jsonFormat));
|
|
161
|
+
JSObject ret = new JSObject();
|
|
162
|
+
ret.put(IN_APP, IndigitallInAppParse.jsonFromInApp(inApp));
|
|
163
|
+
call.resolve(ret);
|
|
164
|
+
} else {
|
|
165
|
+
call.reject(String.valueOf(errorList));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (jsonCustomer != null) {
|
|
169
|
+
JSONObject myjson = new JSONObject(jsonCustomer);
|
|
170
|
+
if (myjson.length() > 0) {
|
|
171
|
+
EventUtils.INSTANCE.sendEventFormToCustomer(context, myjson);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
136
175
|
}
|
|
@@ -5,15 +5,15 @@ import android.content.Intent;
|
|
|
5
5
|
import android.os.Bundle;
|
|
6
6
|
|
|
7
7
|
import com.getcapacitor.PluginCall;
|
|
8
|
-
import com.indigitall.android.Configuration;
|
|
8
|
+
import com.indigitall.android.push.Configuration;
|
|
9
9
|
import com.indigitall.android.Indigitall;
|
|
10
|
-
import com.indigitall.android.callbacks.DeviceCallback;
|
|
11
|
-
import com.indigitall.android.callbacks.EventCallback;
|
|
12
|
-
import com.indigitall.android.callbacks.InitCallBack;
|
|
13
|
-
import com.indigitall.android.callbacks.PushTokenCallback;
|
|
14
|
-
import com.indigitall.android.callbacks.TopicsCallback;
|
|
15
|
-
import com.indigitall.android.models.Push;
|
|
16
|
-
import com.indigitall.android.utils.ServiceUtils;
|
|
10
|
+
import com.indigitall.android.push.callbacks.DeviceCallback;
|
|
11
|
+
import com.indigitall.android.push.callbacks.EventCallback;
|
|
12
|
+
import com.indigitall.android.push.callbacks.InitCallBack;
|
|
13
|
+
import com.indigitall.android.push.callbacks.PushTokenCallback;
|
|
14
|
+
import com.indigitall.android.push.callbacks.TopicsCallback;
|
|
15
|
+
import com.indigitall.android.push.models.Push;
|
|
16
|
+
import com.indigitall.android.push.utils.ServiceUtils;
|
|
17
17
|
import com.indigitall.capacitor.utils.IndigitallParse;
|
|
18
18
|
|
|
19
19
|
import org.json.JSONException;
|
|
@@ -68,32 +68,32 @@ public class IndigitallCp {
|
|
|
68
68
|
.setUrlDeviceApi(urlDeviceApi)
|
|
69
69
|
.setUrlInboxApi(urlInboxApi)
|
|
70
70
|
.build();
|
|
71
|
-
Indigitall.init(context,config, callback);
|
|
71
|
+
Indigitall.INSTANCE.init(context,config, callback);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
public static void deviceGet(Context context, DeviceCallback callback) {
|
|
76
|
-
Indigitall.deviceGet(context, callback);
|
|
76
|
+
Indigitall.INSTANCE.deviceGet(context, callback);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
public static void deviceEnable(Context context, DeviceCallback callback) {
|
|
80
|
-
Indigitall.deviceEnable(context, callback);
|
|
80
|
+
Indigitall.INSTANCE.deviceEnable(context, callback);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
public static void deviceDisable(Context context, DeviceCallback callback) {
|
|
84
|
-
Indigitall.deviceDisable(context, callback);
|
|
84
|
+
Indigitall.INSTANCE.deviceDisable(context, callback);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
public static void topicsList(Context context, TopicsCallback callback) {
|
|
88
|
-
Indigitall.topicsList(context, callback);
|
|
88
|
+
Indigitall.INSTANCE.topicsList(context, callback);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
public static void topicsSubscribe(Context context, String[] topics, TopicsCallback callback) {
|
|
92
|
-
Indigitall.topicsSubscribe(context, topics, callback);
|
|
92
|
+
Indigitall.INSTANCE.topicsSubscribe(context, topics, callback);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
public static void topicsUnsubscribe(Context context, String[] topics, TopicsCallback callback) {
|
|
96
|
-
Indigitall.topicsUnsubscribe(context, topics, callback);
|
|
96
|
+
Indigitall.INSTANCE.topicsUnsubscribe(context, topics, callback);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
public static void sendCustomEvent(Context context, JSONObject json, EventCallback callback) throws JSONException {
|
|
@@ -103,7 +103,7 @@ public class IndigitallCp {
|
|
|
103
103
|
JSONObject eventCustomData = null;
|
|
104
104
|
if (json.has(JSON_EVENT)) eventCustom = json.getString(JSON_EVENT);
|
|
105
105
|
if (json.has(JSON_EVENT_DATA)) eventCustomData = new JSONObject(json.getString(JSON_EVENT_DATA));
|
|
106
|
-
Indigitall.sendCustomEvent(context, eventCustom, eventCustomData, callback);
|
|
106
|
+
Indigitall.INSTANCE.sendCustomEvent(context, eventCustom, eventCustomData, callback);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
public static JSONObject getPush(Context context, Intent intent) throws JSONException {
|
|
@@ -144,10 +144,10 @@ public class IndigitallCp {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
public static void logIn(Context context, String externalId, DeviceCallback callback) {
|
|
147
|
-
Indigitall.logIn(context, externalId, callback);
|
|
147
|
+
Indigitall.INSTANCE.logIn(context, externalId, callback);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
public static void logOut(Context context, DeviceCallback callback) {
|
|
151
|
-
Indigitall.logOut(context, callback);
|
|
151
|
+
Indigitall.INSTANCE.logOut(context, callback);
|
|
152
152
|
}
|
|
153
153
|
}
|
package/android/src/main/java/com/indigitall/capacitor/models/CpIndigitallHiddenActivity.java
CHANGED
|
@@ -8,8 +8,8 @@ import android.util.Log;
|
|
|
8
8
|
|
|
9
9
|
import androidx.annotation.Nullable;
|
|
10
10
|
|
|
11
|
-
import com.indigitall.android.HiddenActivity;
|
|
12
|
-
import com.indigitall.android.models.Push;
|
|
11
|
+
import com.indigitall.android.push.HiddenActivity;
|
|
12
|
+
import com.indigitall.android.push.models.Push;
|
|
13
13
|
import com.indigitall.capacitor.IndigitallCpPlugin;
|
|
14
14
|
import com.indigitall.capacitor.utils.CpPreferenceUtils;
|
|
15
15
|
|
|
@@ -48,4 +48,4 @@ public class CpIndigitallHiddenActivity extends HiddenActivity {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
}
|
|
51
|
-
}
|
|
51
|
+
}
|
|
@@ -3,9 +3,12 @@ package com.indigitall.capacitor.models;
|
|
|
3
3
|
import android.app.PendingIntent;
|
|
4
4
|
import android.content.Context;
|
|
5
5
|
|
|
6
|
+
import androidx.annotation.Nullable;
|
|
7
|
+
|
|
6
8
|
import com.indigitall.android.commons.models.CorePushAction;
|
|
7
|
-
import com.indigitall.android.models.Push;
|
|
8
|
-
import com.indigitall.android.models.
|
|
9
|
+
import com.indigitall.android.push.models.Push;
|
|
10
|
+
import com.indigitall.android.push.models.PushAction;
|
|
11
|
+
import com.indigitall.android.push.models.PushNotification;
|
|
9
12
|
import com.indigitall.capacitor.utils.CpIndigitallUtils;
|
|
10
13
|
|
|
11
14
|
public class CpPushNotification extends PushNotification {
|
|
@@ -22,9 +25,11 @@ public class CpPushNotification extends PushNotification {
|
|
|
22
25
|
super.showNotification(context);
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
@Nullable
|
|
29
|
+
@Override
|
|
30
|
+
public PendingIntent getIntent(@Nullable PushAction pushAction, int clickedButton) {
|
|
31
|
+
return CpIndigitallUtils.getIntent(context, push, pushAction, clickedButton);
|
|
32
|
+
}
|
|
33
|
+
|
|
29
34
|
|
|
30
|
-
}
|
|
35
|
+
}
|
|
@@ -5,9 +5,9 @@ import android.util.Log;
|
|
|
5
5
|
|
|
6
6
|
import com.getcapacitor.PluginCall;
|
|
7
7
|
import com.google.firebase.messaging.RemoteMessage;
|
|
8
|
-
import com.indigitall.android.models.Push;
|
|
9
|
-
import com.indigitall.android.services.FirebaseMessagingService;
|
|
10
|
-
import com.indigitall.android.utils.FirebaseUtils;
|
|
8
|
+
import com.indigitall.android.push.models.Push;
|
|
9
|
+
import com.indigitall.android.push.services.FirebaseMessagingService;
|
|
10
|
+
import com.indigitall.android.push.utils.FirebaseUtils;
|
|
11
11
|
import com.indigitall.capacitor.IndigitallCpPlugin;
|
|
12
12
|
import com.indigitall.capacitor.implementations.IndigitallCp;
|
|
13
13
|
import com.indigitall.capacitor.models.CpPushNotification;
|
|
@@ -8,10 +8,10 @@ import android.content.Intent;
|
|
|
8
8
|
import com.indigitall.android.commons.models.CorePush;
|
|
9
9
|
import com.indigitall.android.commons.models.CorePushAction;
|
|
10
10
|
import com.indigitall.android.commons.utils.IntentUtils;
|
|
11
|
-
import com.indigitall.android.models.Push;
|
|
12
|
-
import com.indigitall.android.models.PushAction;
|
|
13
|
-
import com.indigitall.android.services.StatisticService;
|
|
14
|
-
import com.indigitall.android.utils.PushPreferenceUtils;
|
|
11
|
+
import com.indigitall.android.push.models.Push;
|
|
12
|
+
import com.indigitall.android.push.models.PushAction;
|
|
13
|
+
import com.indigitall.android.push.services.StatisticService;
|
|
14
|
+
import com.indigitall.android.push.utils.PushPreferenceUtils;
|
|
15
15
|
import com.indigitall.capacitor.models.CpIndigitallHiddenActivity;
|
|
16
16
|
|
|
17
17
|
public class CpIndigitallUtils {
|