indigitall-capacitor-plugin 2.13.1 → 2.14.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/android/build.gradle +3 -3
- package/android/src/main/java/com/indigitall/capacitor/IndigitallCpPlugin.java +1 -1
- package/android/src/main/java/com/indigitall/capacitor/IndigitallLAPlugin.java +156 -0
- package/android/src/main/java/com/indigitall/capacitor/implementations/CustomerCp.java +9 -9
- package/android/src/main/java/com/indigitall/capacitor/implementations/InAppCp.java +21 -14
- package/android/src/main/java/com/indigitall/capacitor/implementations/InboxCp.java +1 -1
- package/android/src/main/java/com/indigitall/capacitor/implementations/IndigitallCp.java +12 -12
- package/android/src/main/java/com/indigitall/capacitor/implementations/LiveActivityCp.java +51 -0
- package/android/src/main/java/com/indigitall/capacitor/inapp/CpInAppIndigitall.java +9 -9
- package/android/src/main/java/com/indigitall/capacitor/inapp/CpInAppPopUp.java +6 -6
- package/android/src/main/java/com/indigitall/capacitor/inapp/IndigitallInAppPlugin.java +12 -3
- package/android/src/main/java/com/indigitall/capacitor/inapp/interfaces/WebCpInAppInterface.java +3 -3
- package/android/src/main/java/com/indigitall/capacitor/services/IndigitallFirebaseMessagingService.java +1 -1
- package/android/src/main/java/com/indigitall/capacitor/utils/IndigitallLAParse.java +95 -0
- package/android/src/main/java/com/indigitall/capacitor/utils/IndigitallParse.java +5 -3
- package/dist/esm/InApp.js +23 -17
- package/dist/esm/InApp.js.map +1 -1
- package/dist/esm/Push.js +1 -1
- package/dist/esm/Push.js.map +1 -1
- package/dist/esm/callbacks/callbacksType.d.ts +2 -1
- package/dist/esm/callbacks/callbacksType.js.map +1 -1
- package/dist/esm/models/InDevice.d.ts +9 -0
- package/dist/esm/models/InDevice.js.map +1 -1
- package/dist/plugin.cjs.js +24 -18
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +24 -18
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/IndigitallCpLAPlugin.swift +90 -0
- package/ios/Plugin/IndigitallInAppPlugin.swift +1 -2
- package/ios/Plugin/implementations/InAppCp.swift +12 -2
- package/ios/Plugin/implementations/LiveActivityCp.swift +63 -0
- package/ios/Plugin/interfaces/IndigitallLAPlugin.h +17 -0
- package/ios/Plugin/interfaces/IndigitallLAPlugin.m +19 -0
- package/ios/Plugin/utils/IndigitallLAParse.h +20 -0
- package/ios/Plugin/utils/IndigitallLAParse.m +52 -0
- package/package.json +3 -3
|
@@ -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', '~> 6.
|
|
16
|
+
s.dependency 'indigitall-ios', '~> 6.16.0'
|
|
17
17
|
s.swift_version = '5.1'
|
|
18
18
|
end
|
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 : 35
|
|
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 : 35
|
|
26
26
|
versionCode 1
|
|
27
27
|
versionName "1.0"
|
|
28
28
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
@@ -57,7 +57,7 @@ dependencies {
|
|
|
57
57
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
58
58
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
59
59
|
implementation("androidx.cardview:cardview:1.0.0")
|
|
60
|
-
implementation('com.indigitall:android:5.
|
|
60
|
+
implementation('com.indigitall:android:5.21.+'){
|
|
61
61
|
exclude group: "com.indigitall", module: "android-hms"
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -368,7 +368,7 @@ public class IndigitallCpPlugin extends Plugin implements IndigitallFirebaseInte
|
|
|
368
368
|
notificationCall.resolve(ret);
|
|
369
369
|
}
|
|
370
370
|
} else {
|
|
371
|
-
FirebaseUtils.
|
|
371
|
+
FirebaseUtils.showNotification(getContext(), messageJson);
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
package com.indigitall.capacitor;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import androidx.annotation.Nullable;
|
|
5
|
+
|
|
6
|
+
import com.getcapacitor.JSArray;
|
|
7
|
+
import com.getcapacitor.JSObject;
|
|
8
|
+
import com.getcapacitor.Plugin;
|
|
9
|
+
import com.getcapacitor.PluginCall;
|
|
10
|
+
import com.getcapacitor.PluginMethod;
|
|
11
|
+
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
12
|
+
import com.indigitall.android.liveactivity.callbacks.LACallback;
|
|
13
|
+
import com.indigitall.android.liveactivity.callbacks.LADeviceCallback;
|
|
14
|
+
import com.indigitall.android.liveactivity.models.LADevice;
|
|
15
|
+
import com.indigitall.android.liveactivity.models.LiveActivity;
|
|
16
|
+
import com.indigitall.capacitor.implementations.LiveActivityCp;
|
|
17
|
+
import com.indigitall.capacitor.utils.IndigitallLAParse;
|
|
18
|
+
import com.indigitall.capacitor.utils.IndigitallParse;
|
|
19
|
+
|
|
20
|
+
import org.json.JSONException;
|
|
21
|
+
|
|
22
|
+
import java.util.ArrayList;
|
|
23
|
+
|
|
24
|
+
@CapacitorPlugin(name = "LiveActivityCp")
|
|
25
|
+
public class IndigitallLAPlugin extends Plugin {
|
|
26
|
+
private final String DEVICE = "device";
|
|
27
|
+
private final String TOPICS = "topics";
|
|
28
|
+
private final String LIVE_ACTIVITIES_LIST = "liveActivities";
|
|
29
|
+
|
|
30
|
+
private final String TAG = "[IND]IndigitallLAPlugin";
|
|
31
|
+
|
|
32
|
+
@PluginMethod
|
|
33
|
+
public void logIn(PluginCall call) {
|
|
34
|
+
LiveActivityCp.logIn(getContext(),
|
|
35
|
+
call.getString("externalCode"),
|
|
36
|
+
new LADeviceCallback(getContext()) {
|
|
37
|
+
@Override
|
|
38
|
+
public void onSuccess(@NonNull LADevice laDevice) {
|
|
39
|
+
JSObject ret = new JSObject();
|
|
40
|
+
ret.put(DEVICE, IndigitallLAParse.lADeviceToMap(laDevice));
|
|
41
|
+
call.resolve(ret);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Override
|
|
45
|
+
public void onError(@Nullable Integer integer, @Nullable String s, @Nullable String s1) {
|
|
46
|
+
call.reject(s);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@PluginMethod
|
|
52
|
+
public void logOut(PluginCall call) {
|
|
53
|
+
LiveActivityCp.logOut(getContext(),
|
|
54
|
+
new LADeviceCallback(getContext()) {
|
|
55
|
+
@Override
|
|
56
|
+
public void onSuccess(@NonNull LADevice laDevice) {
|
|
57
|
+
JSObject ret = new JSObject();
|
|
58
|
+
ret.put(DEVICE, IndigitallLAParse.lADeviceToMap(laDevice));
|
|
59
|
+
call.resolve(ret);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@Override
|
|
63
|
+
public void onError(@Nullable Integer integer, @Nullable String s, @Nullable String s1) {
|
|
64
|
+
call.reject(s);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@PluginMethod
|
|
70
|
+
public void getListLiveActivities(PluginCall call) {
|
|
71
|
+
LiveActivityCp.getListLiveActivities(
|
|
72
|
+
getContext(), new LACallback() {
|
|
73
|
+
@Override
|
|
74
|
+
public void onSuccess(@NonNull ArrayList<LiveActivity> arrayList) {
|
|
75
|
+
JSObject ret = new JSObject();
|
|
76
|
+
ret.put(LIVE_ACTIVITIES_LIST, IndigitallLAParse.liveActivityListToMap(arrayList));
|
|
77
|
+
call.resolve(ret);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@Override
|
|
81
|
+
public void onError(@Nullable Integer integer, @Nullable String s, @Nullable String s1) {
|
|
82
|
+
call.reject(s);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@PluginMethod
|
|
88
|
+
public void topicList(PluginCall call) {
|
|
89
|
+
LiveActivityCp.topicList(getContext(), new com.indigitall.android.liveactivity.callbacks.LATopicCallback(getContext()) {
|
|
90
|
+
@Override
|
|
91
|
+
public void onSuccess(@NonNull ArrayList<String> topics) {
|
|
92
|
+
JSObject ret = new JSObject();
|
|
93
|
+
ret.put(TOPICS, IndigitallLAParse.topicToMap(topics));
|
|
94
|
+
call.resolve(ret);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@Override
|
|
98
|
+
public void onError(@Nullable Integer integer, @Nullable String s, @Nullable String s1) {
|
|
99
|
+
call.reject(s);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@PluginMethod
|
|
105
|
+
public void topicSubscribe(PluginCall call) {
|
|
106
|
+
JSArray array = call.getArray(TOPICS);
|
|
107
|
+
ArrayList<String> topicsList = new ArrayList<String>(array.length());
|
|
108
|
+
for (int i = 0; i < array.length(); i++) {
|
|
109
|
+
try {
|
|
110
|
+
topicsList.add(array.getString(i));
|
|
111
|
+
} catch (JSONException e) {
|
|
112
|
+
android.util.Log.e(TAG, "topicSubscribe Error parsing topic: " + e.getMessage());
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
LiveActivityCp.topicSubscribe(getContext(), topicsList, new com.indigitall.android.liveactivity.callbacks.LATopicCallback(getContext()) {
|
|
116
|
+
@Override
|
|
117
|
+
public void onSuccess(@NonNull ArrayList<String> topics) {
|
|
118
|
+
JSObject ret = new JSObject();
|
|
119
|
+
ret.put(TOPICS, IndigitallLAParse.topicToMap(topics));
|
|
120
|
+
call.resolve(ret);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@Override
|
|
124
|
+
public void onError(@Nullable Integer integer, @Nullable String s, @Nullable String s1) {
|
|
125
|
+
call.reject(s);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@PluginMethod
|
|
131
|
+
public void topicUnsubscribe(PluginCall call) {
|
|
132
|
+
JSArray array = call.getArray(TOPICS);
|
|
133
|
+
ArrayList<String> topicsList = new ArrayList<String>(array.length());
|
|
134
|
+
for (int i = 0; i < array.length(); i++) {
|
|
135
|
+
try {
|
|
136
|
+
topicsList.add(array.getString(i));
|
|
137
|
+
} catch (JSONException e) {
|
|
138
|
+
android.util.Log.e(TAG, "topicUnsubscribe Error parsing topic: " + e.getMessage());
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
LiveActivityCp.topicUnsubscribe(getContext(), topicsList, new com.indigitall.android.liveactivity.callbacks.LATopicCallback(getContext()) {
|
|
142
|
+
@Override
|
|
143
|
+
public void onSuccess(@NonNull ArrayList<String> topics) {
|
|
144
|
+
JSObject ret = new JSObject();
|
|
145
|
+
ret.put(TOPICS, IndigitallLAParse.topicToMap(topics));
|
|
146
|
+
call.resolve(ret);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@Override
|
|
150
|
+
public void onError(@Nullable Integer integer, @Nullable String s, @Nullable String s1) {
|
|
151
|
+
call.reject(s);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
}
|
|
@@ -24,12 +24,12 @@ import java.util.Objects;
|
|
|
24
24
|
public class CustomerCp {
|
|
25
25
|
|
|
26
26
|
public static void getCustomer(Context context, CustomerCallback callback){
|
|
27
|
-
CustomerIndigitall.
|
|
27
|
+
CustomerIndigitall.getCustomer(context, callback);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
public static void getCustomerInformation(Context context, JSArray params, final CustomerFieldCallback callback){
|
|
31
31
|
ArrayList<String> fieldNames = IndigitallParse.parseArrayList(params);
|
|
32
|
-
CustomerIndigitall.
|
|
32
|
+
CustomerIndigitall.getCustomerInformation(context, fieldNames, callback);
|
|
33
33
|
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -40,18 +40,18 @@ public class CustomerCp {
|
|
|
40
40
|
if (params.has("value")) value = params.getString("value");
|
|
41
41
|
if (key != null && value != null) {
|
|
42
42
|
json.put(key, value);
|
|
43
|
-
CustomerIndigitall.
|
|
43
|
+
CustomerIndigitall.updateValueToCustomerFields(context, json, callback);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
public static void deleteValuesFromCustomerFields(Context context, JSONArray params, final CustomerCallback callback) {
|
|
49
49
|
ArrayList<String> fieldNames = IndigitallParse.parseArrayList(params);
|
|
50
|
-
CustomerIndigitall.
|
|
50
|
+
CustomerIndigitall.deleteValuesFromCustomerFields(context, fieldNames, callback);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
public static void sendCustomEvent(Context context, String eventCode, JSONObject customData, final CustomerCallback callback) {
|
|
54
|
-
CustomerIndigitall.
|
|
54
|
+
CustomerIndigitall.sendCustomEvent(context, eventCode, customData, callback);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
public static void link(Context context, JSObject params, final CustomerCallback callback) throws JSONException{
|
|
@@ -65,10 +65,10 @@ public class CustomerCp {
|
|
|
65
65
|
channel = IndigitallParse.parseChannel(Objects.requireNonNull(params.getString(JSON_CHANNEL)));
|
|
66
66
|
}
|
|
67
67
|
Channel finalChannel = channel;
|
|
68
|
-
Indigitall.
|
|
68
|
+
Indigitall.logIn(context, externalId, new DeviceCallback(context) {
|
|
69
69
|
@Override
|
|
70
70
|
public void onSuccess(Device device) {
|
|
71
|
-
CustomerIndigitall.
|
|
71
|
+
CustomerIndigitall.link(context, finalChannel, callback);
|
|
72
72
|
}
|
|
73
73
|
@Override
|
|
74
74
|
public void onFail(ErrorModel error) { callback.onFail(error); }
|
|
@@ -82,10 +82,10 @@ public class CustomerCp {
|
|
|
82
82
|
channel = IndigitallParse.parseChannel(Objects.requireNonNull(params.getString(JSON_CHANNEL)));
|
|
83
83
|
}
|
|
84
84
|
Channel finalChannel = channel;
|
|
85
|
-
Indigitall.
|
|
85
|
+
Indigitall.logOut(context, new DeviceCallback(context) {
|
|
86
86
|
@Override
|
|
87
87
|
public void onSuccess(Device device) {
|
|
88
|
-
CustomerIndigitall.
|
|
88
|
+
CustomerIndigitall.unlink(context, finalChannel, callback);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
@Override
|
|
@@ -24,6 +24,8 @@ import com.indigitall.android.inapp.callbacks.GetInAppCallback;
|
|
|
24
24
|
import com.indigitall.android.inapp.callbacks.InAppCallback;
|
|
25
25
|
import com.indigitall.android.inapp.callbacks.InAppTopicCallback;
|
|
26
26
|
import com.indigitall.android.inapp.callbacks.ShowInAppCallback;
|
|
27
|
+
import com.indigitall.android.inapp.dao.InAppDatabase;
|
|
28
|
+
import com.indigitall.android.inapp.dao.inApp.InAppDao;
|
|
27
29
|
import com.indigitall.android.inapp.models.InApp;
|
|
28
30
|
import com.indigitall.android.inapp.models.InAppAction;
|
|
29
31
|
import com.indigitall.android.inapp.models.InAppErrorModel;
|
|
@@ -67,22 +69,27 @@ public class InAppCp {
|
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
public static void addNewInAppClick(Context context, JSONObject json) throws JSONException {
|
|
70
|
-
InApp
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
InApp inAppFromClick = new InApp(context, json);
|
|
73
|
+
InAppDatabase mDb = new InAppDatabase(context).open();
|
|
74
|
+
InApp inAppFromDB = null;
|
|
75
|
+
if (mDb.getMInAppDao() != null) inAppFromDB = mDb.getMInAppDao().searchInAppWithInAppIdAndSchema(inAppFromClick.getInAppId(), inAppFromClick.getSchema().getCode());
|
|
76
|
+
if (inAppFromClick.getProperties() != null && inAppFromClick.getProperties().getAction() != null) {
|
|
77
|
+
Intent intent = inAppFromClick.getProperties().getAction().getIntent(context);
|
|
78
|
+
boolean isAppAction = inAppFromClick.getProperties().getAction().getType() == InAppAction.Type.APP;
|
|
74
79
|
if (isAppAction && CpPreferenceUtils.isNotAction(context)) {
|
|
75
|
-
EventUtils.
|
|
76
|
-
|
|
80
|
+
EventUtils.sendEventClick(context, inAppFromClick);
|
|
81
|
+
InApp inApp = inAppFromClick;
|
|
82
|
+
if (inAppFromDB != null) inApp = inAppFromDB;
|
|
83
|
+
ShowInAppUtils.addNewInAppClick(context, inApp);
|
|
77
84
|
} else {
|
|
78
|
-
InAppUtils.
|
|
85
|
+
InAppUtils.inAppWasClicked(context, inAppFromClick, inAppFromClick.getProperties().getAction(), intent, isAppAction);
|
|
79
86
|
}
|
|
80
87
|
}
|
|
81
88
|
}
|
|
82
89
|
|
|
83
90
|
public static void addNewInAppToDismissForever(Context context, JSONObject json) throws JSONException {
|
|
84
91
|
InApp inApp = new InApp(context, json);
|
|
85
|
-
PopUpUtils.
|
|
92
|
+
PopUpUtils.addNewInAppToDismissForever(context, inApp);
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
public static void showPopUp(Context context, JSONObject params, Activity activity, CpShowInAppCallback callback) throws JSONException {
|
|
@@ -120,7 +127,7 @@ public class InAppCp {
|
|
|
120
127
|
inAppConfiguration.setUrlInAppApi(domainInApp);
|
|
121
128
|
inAppConfiguration.setClosePopupWhenClicked(closePopupWhenClicked);
|
|
122
129
|
InAppConfiguration config = inAppConfiguration.build();
|
|
123
|
-
ServiceUtils.
|
|
130
|
+
ServiceUtils.registerServices(context, config);
|
|
124
131
|
config.updateConfiguration(context);
|
|
125
132
|
|
|
126
133
|
CpInAppIndigitall.showPopUp(
|
|
@@ -137,12 +144,12 @@ public class InAppCp {
|
|
|
137
144
|
|
|
138
145
|
public static void eventPrintInAppRequest(Context context, JSONObject json) throws JSONException {
|
|
139
146
|
InApp inApp = new InApp(context, json);
|
|
140
|
-
EventUtils.
|
|
147
|
+
EventUtils.sendEventPrint(context, inApp);
|
|
141
148
|
}
|
|
142
149
|
|
|
143
150
|
public static void eventClickInAppRequest(Context context, JSONObject json) throws JSONException {
|
|
144
151
|
InApp inApp = new InApp(context, json);
|
|
145
|
-
EventUtils.
|
|
152
|
+
EventUtils.sendEventClick(context, inApp);
|
|
146
153
|
}
|
|
147
154
|
|
|
148
155
|
public static void topicsList(Context context, BaseCallback callback) {
|
|
@@ -176,9 +183,9 @@ public class InAppCp {
|
|
|
176
183
|
jsonCustomer = params.getString(3);
|
|
177
184
|
}
|
|
178
185
|
if (inAppForm != null && jsonFormat != null) {
|
|
179
|
-
ArrayList<InAppErrorModel> errorList = InAppFormUtils.
|
|
186
|
+
ArrayList<InAppErrorModel> errorList = InAppFormUtils.checkFieldsForm(inAppForm, new JSONObject(jsonFormat));
|
|
180
187
|
if (errorList.isEmpty()) {
|
|
181
|
-
EventUtils.
|
|
188
|
+
EventUtils.sendEventForm(context, inApp, new JSONObject(jsonFormat));
|
|
182
189
|
JSObject ret = new JSObject();
|
|
183
190
|
ret.put(IN_APP, IndigitallInAppParse.jsonFromInApp(inApp));
|
|
184
191
|
call.resolve(ret);
|
|
@@ -189,7 +196,7 @@ public class InAppCp {
|
|
|
189
196
|
if (jsonCustomer != null) {
|
|
190
197
|
JSONObject myjson = new JSONObject(jsonCustomer);
|
|
191
198
|
if (myjson.length() > 0) {
|
|
192
|
-
EventUtils.
|
|
199
|
+
EventUtils.sendEventFormToCustomer(context, myjson);
|
|
193
200
|
}
|
|
194
201
|
}
|
|
195
202
|
}
|
|
@@ -73,7 +73,7 @@ public class InboxCp implements InboxAuthListener {
|
|
|
73
73
|
if (status != null) {
|
|
74
74
|
if (myInbox != null) myInbox.massiveEditNotificationsWithInitialStatus(context, sendingIdList, getStatus(initialStatus), getStatus(status), callback);
|
|
75
75
|
}else{
|
|
76
|
-
callback.onFail(ErrorUtils.
|
|
76
|
+
callback.onFail(ErrorUtils.showError(3004,"No status params"));
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -160,32 +160,32 @@ public class IndigitallCp {
|
|
|
160
160
|
.setTimeoutRequestsInMilliseconds(timeoutRequestsInMilliseconds)
|
|
161
161
|
.setBackgroundRequestsDisabled(backgroundRequestsDisabled)
|
|
162
162
|
.build();
|
|
163
|
-
Indigitall.
|
|
163
|
+
Indigitall.init(context,config, callback);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
public static void deviceGet(Context context, DeviceCallback callback) {
|
|
168
|
-
Indigitall.
|
|
168
|
+
Indigitall.deviceGet(context, callback);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
public static void deviceEnable(Context context, DeviceCallback callback) {
|
|
172
|
-
Indigitall.
|
|
172
|
+
Indigitall.deviceEnable(context, callback);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
public static void deviceDisable(Context context, DeviceCallback callback) {
|
|
176
|
-
Indigitall.
|
|
176
|
+
Indigitall.deviceDisable(context, callback);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
public static void topicsList(Context context, TopicsCallback callback) {
|
|
180
|
-
Indigitall.
|
|
180
|
+
Indigitall.topicsList(context, callback);
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
public static void topicsSubscribe(Context context, String[] topics, TopicsCallback callback) {
|
|
184
|
-
Indigitall.
|
|
184
|
+
Indigitall.topicsSubscribe(context, topics, callback);
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
public static void topicsUnsubscribe(Context context, String[] topics, TopicsCallback callback) {
|
|
188
|
-
Indigitall.
|
|
188
|
+
Indigitall.topicsUnsubscribe(context, topics, callback);
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
public static void sendCustomEvent(Context context, JSONObject json, EventCallback callback) throws JSONException {
|
|
@@ -195,7 +195,7 @@ public class IndigitallCp {
|
|
|
195
195
|
JSONObject eventCustomData = null;
|
|
196
196
|
if (json.has(JSON_EVENT)) eventCustom = json.getString(JSON_EVENT);
|
|
197
197
|
if (json.has(JSON_EVENT_DATA)) eventCustomData = new JSONObject(json.getString(JSON_EVENT_DATA));
|
|
198
|
-
Indigitall.
|
|
198
|
+
Indigitall.sendCustomEvent(context, eventCustom, eventCustomData, callback);
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
public static JSONObject getPush(Context context, Intent intent) throws JSONException {
|
|
@@ -223,7 +223,7 @@ public class IndigitallCp {
|
|
|
223
223
|
Push push = new Push(json);
|
|
224
224
|
call.setKeepAlive(true);
|
|
225
225
|
JSObject ret = new JSObject();
|
|
226
|
-
ret.put("state", PushServiceUtils.
|
|
226
|
+
ret.put("state", PushServiceUtils.isPushSecure(context, push));
|
|
227
227
|
call.resolve(ret);
|
|
228
228
|
} catch (Exception ex) {
|
|
229
229
|
call.reject("Error isPushSecure:" + ex.getLocalizedMessage());
|
|
@@ -248,14 +248,14 @@ public class IndigitallCp {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
public static void logIn(Context context, String externalId, DeviceCallback callback) {
|
|
251
|
-
Indigitall.
|
|
251
|
+
Indigitall.logIn(context, externalId, callback);
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
public static void logOut(Context context, DeviceCallback callback) {
|
|
255
|
-
Indigitall.
|
|
255
|
+
Indigitall.logOut(context, callback);
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
public static void onRequestPermissionsResult(Context context, int requestCode, String[] permissions, int[] grantResults) {
|
|
259
|
-
Indigitall.
|
|
259
|
+
Indigitall.onRequestPermissionsResult(context, requestCode, permissions, grantResults);
|
|
260
260
|
}
|
|
261
261
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
package com.indigitall.capacitor.implementations;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
|
|
5
|
+
import com.indigitall.android.liveactivity.IndigitallLA;
|
|
6
|
+
import com.indigitall.android.liveactivity.callbacks.LACallback;
|
|
7
|
+
import com.indigitall.android.liveactivity.callbacks.LADeviceCallback;
|
|
8
|
+
import com.indigitall.android.liveactivity.callbacks.LATopicCallback;
|
|
9
|
+
|
|
10
|
+
import org.json.JSONArray;
|
|
11
|
+
|
|
12
|
+
import java.util.ArrayList;
|
|
13
|
+
|
|
14
|
+
public class LiveActivityCp {
|
|
15
|
+
|
|
16
|
+
public static void logIn(Context context,
|
|
17
|
+
String externalCode,
|
|
18
|
+
LADeviceCallback callback
|
|
19
|
+
) {
|
|
20
|
+
IndigitallLA.login(context, externalCode, callback);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static void logOut(Context context,
|
|
24
|
+
LADeviceCallback callback
|
|
25
|
+
) {
|
|
26
|
+
IndigitallLA.logOut(context, callback);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public static void getListLiveActivities(Context context,
|
|
30
|
+
LACallback callback
|
|
31
|
+
) {
|
|
32
|
+
IndigitallLA.getListLiveActivities(context, callback);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public static void topicList(Context context,
|
|
36
|
+
LATopicCallback callback) {
|
|
37
|
+
IndigitallLA.topicList(context, callback);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public static void topicSubscribe(Context context,
|
|
41
|
+
ArrayList<String> topics,
|
|
42
|
+
LATopicCallback callback) {
|
|
43
|
+
IndigitallLA.subscribeToTopic(context, topics, callback);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public static void topicUnsubscribe(Context context,
|
|
47
|
+
ArrayList<String> topics,
|
|
48
|
+
LATopicCallback callback) {
|
|
49
|
+
IndigitallLA.unsubscribeToTopic(context, topics, callback);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -55,11 +55,11 @@ public class CpInAppIndigitall {
|
|
|
55
55
|
InAppClient.getApplicationWithInAppChannel(context, new InAppApplicationRequest(context), new InAppApplicationCallback(context, TAG) {
|
|
56
56
|
@Override
|
|
57
57
|
public void onSuccess(@NonNull InAppApplication inAppApplication) {
|
|
58
|
-
if (InAppAudienceUtils.
|
|
58
|
+
if (InAppAudienceUtils.isAudienceCacheFinish(context)) {
|
|
59
59
|
InAppClient.getAudiences(new InAppAudiencesRequest(context), new InAppAudienceCallback(context) {
|
|
60
60
|
@Override
|
|
61
61
|
public void onSuccess(@NonNull InAppAudience audience) {
|
|
62
|
-
InAppAudienceUtils.
|
|
62
|
+
InAppAudienceUtils.saveAudienceCache(context, inAppApplication.getAudienceDeviceTtl());
|
|
63
63
|
inAppValidations(context, view, inAppCode, closeIcon, closeIconDisabled, show);
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -89,8 +89,8 @@ public class CpInAppIndigitall {
|
|
|
89
89
|
ImageButton closeIcon,
|
|
90
90
|
boolean closeIconDisabled,
|
|
91
91
|
CpShowInAppCallback show) {
|
|
92
|
-
if (InAppValidations.
|
|
93
|
-
ShowInAppUtils.
|
|
92
|
+
if (InAppValidations.isValidFormatRequest(context)) {
|
|
93
|
+
ShowInAppUtils.inAppWithFilters(
|
|
94
94
|
context,
|
|
95
95
|
inAppCode,
|
|
96
96
|
view,
|
|
@@ -156,7 +156,7 @@ public class CpInAppIndigitall {
|
|
|
156
156
|
InAppIndigitall.inAppGet(context, inAppCode, new InAppCallback(context) {
|
|
157
157
|
@Override
|
|
158
158
|
public void onSuccess(InApp inApp) {
|
|
159
|
-
InApp newInApp = ShowInAppUtils.
|
|
159
|
+
InApp newInApp = ShowInAppUtils.addNewInApp(context, inApp);
|
|
160
160
|
showPopUp(
|
|
161
161
|
context,
|
|
162
162
|
view,
|
|
@@ -228,15 +228,15 @@ public class CpInAppIndigitall {
|
|
|
228
228
|
hole.addJavascriptInterface(new WebCpInAppInterface(context, inApp, popupWindow, show), INDIGITALL_INTERFACE);
|
|
229
229
|
hole.loadDataWithBaseURL(
|
|
230
230
|
null,
|
|
231
|
-
htmlFinal + InAppConstants.
|
|
232
|
-
InAppConstants.
|
|
233
|
-
InAppConstants.
|
|
231
|
+
htmlFinal + InAppConstants.SCRIPT,
|
|
232
|
+
InAppConstants.MIME_TYPE_INFO,
|
|
233
|
+
InAppConstants.UTF8,
|
|
234
234
|
null
|
|
235
235
|
);
|
|
236
236
|
}catch (Exception ex) {
|
|
237
237
|
ex.printStackTrace();
|
|
238
238
|
} finally {
|
|
239
|
-
EventUtils.
|
|
239
|
+
EventUtils.sendEventPrint(context, inApp);
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
});
|
|
@@ -111,7 +111,7 @@ public class CpInAppPopUp {
|
|
|
111
111
|
@Override
|
|
112
112
|
public void onClick(View v) {
|
|
113
113
|
if (inApp.getProperties().getDismissForever()) {
|
|
114
|
-
PopUpUtils.
|
|
114
|
+
PopUpUtils.addNewInAppToDismissForever(context, inApp);
|
|
115
115
|
}
|
|
116
116
|
if (show != null) show.didClosed();
|
|
117
117
|
popupWindow.dismiss();
|
|
@@ -122,9 +122,9 @@ public class CpInAppPopUp {
|
|
|
122
122
|
if (show != null) show.onSuccess(inApp);
|
|
123
123
|
|
|
124
124
|
float density = context.getResources().getDisplayMetrics().density;
|
|
125
|
-
float width = PopUpUtils.
|
|
126
|
-
float height = PopUpUtils.
|
|
127
|
-
double aspectRadio = PopUpUtils.
|
|
125
|
+
float width = PopUpUtils.changeToDP(context, inApp.getSchema().getWidth()*density);
|
|
126
|
+
float height = PopUpUtils.changeToDP(context,inApp.getSchema().getHeight()*density);
|
|
127
|
+
double aspectRadio = PopUpUtils.scalePopUp(width, height);
|
|
128
128
|
popupWindow.setWidth((int)(width*aspectRadio));
|
|
129
129
|
popupWindow.setHeight((int)(height*aspectRadio));
|
|
130
130
|
|
|
@@ -171,7 +171,7 @@ public class CpInAppPopUp {
|
|
|
171
171
|
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
|
172
172
|
@Override
|
|
173
173
|
public void run() {
|
|
174
|
-
if (InAppPreferenceUtils.
|
|
174
|
+
if (InAppPreferenceUtils.getClosePopupWhenClicked(context)) popupWindow.dismiss();
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
177
|
if (show != null) show.didClicked(inApp, action);
|
|
@@ -182,7 +182,7 @@ public class CpInAppPopUp {
|
|
|
182
182
|
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
|
183
183
|
@Override
|
|
184
184
|
public void run() {
|
|
185
|
-
if (InAppPreferenceUtils.
|
|
185
|
+
if (InAppPreferenceUtils.getClosePopupWhenClicked(context)) popupWindow.dismiss();
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
188
|
if (show != null) show.didClicked();
|
|
@@ -83,11 +83,20 @@ public class IndigitallInAppPlugin extends Plugin {
|
|
|
83
83
|
call.resolve(ret);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
@Override
|
|
87
|
+
public void onFail(ErrorModel errorModel) {
|
|
88
|
+
super.onFail(errorModel);
|
|
89
|
+
String code = "2100";
|
|
90
|
+
if (errorModel.getErrorCode().getErrorId() != null) {
|
|
91
|
+
code = errorModel.getErrorCode().getErrorId().toString();
|
|
92
|
+
}
|
|
93
|
+
call.reject(errorModel.getErrorMessage().getErrorMessage(), code);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@Override
|
|
87
97
|
public void onError(int i, String s, String s1) {
|
|
88
|
-
|
|
98
|
+
call.reject(s, String.valueOf(i));
|
|
89
99
|
}
|
|
90
|
-
|
|
91
100
|
});
|
|
92
101
|
}
|
|
93
102
|
|
package/android/src/main/java/com/indigitall/capacitor/inapp/interfaces/WebCpInAppInterface.java
CHANGED
|
@@ -39,14 +39,14 @@ public class WebCpInAppInterface {
|
|
|
39
39
|
boolean isAppAction = action.getType() == CoreAction.Type.APP;
|
|
40
40
|
if (CpPreferenceUtils.isNotAction(context) && isAppAction) {
|
|
41
41
|
inApp.getProperties().setAction(action);
|
|
42
|
-
ShowInAppUtils.
|
|
43
|
-
EventUtils.
|
|
42
|
+
ShowInAppUtils.addNewInAppClick(context, inApp);
|
|
43
|
+
EventUtils.sendEventClick(context, inApp);
|
|
44
44
|
if (show != null) {
|
|
45
45
|
show.didClicked(popupWindow, inApp, action);
|
|
46
46
|
show.didClicked(inApp, action);
|
|
47
47
|
}
|
|
48
48
|
} else {
|
|
49
|
-
if (InAppUtils.
|
|
49
|
+
if (InAppUtils.inAppWasClicked(context, inApp, action, intentAction, isAppAction)) {
|
|
50
50
|
if (show != null) show.didClicked(popupWindow, inApp, action);
|
|
51
51
|
} else {
|
|
52
52
|
if (show != null) show.onFail(String.valueOf(inApp.getInAppId()), null, "WebCDVInAppInterface inAppWasClicked error");
|