indigitall-capacitor-plugin 1.2.0 → 1.3.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/README.md CHANGED
@@ -22,8 +22,13 @@ npx cap sync
22
22
  * [`topicsUnsubscribe(...)`](#topicsunsubscribe)
23
23
  * [`sendCustomEvent(...)`](#sendcustomevent)
24
24
  * [`getPush()`](#getpush)
25
+ * [`onMessageReceived(...)`](#onmessagereceived)
26
+ * [`getToken()`](#gettoken)
27
+ * [`isIndigitallPushNotification(...)`](#isindigitallpushnotification)
25
28
  * [`logIn(...)`](#login)
26
29
  * [`logOut()`](#logout)
30
+ * [Interfaces](#interfaces)
31
+ * [Type Aliases](#type-aliases)
27
32
 
28
33
  </docgen-index>
29
34
 
@@ -143,6 +148,47 @@ getPush() => Promise<any>
143
148
  --------------------
144
149
 
145
150
 
151
+ ### onMessageReceived(...)
152
+
153
+ ```typescript
154
+ onMessageReceived(onSuccess: OnMessageReceivedSuccessType) => OnMessageReceivedSuccessType
155
+ ```
156
+
157
+ | Param | Type |
158
+ | --------------- | ------------------------------------------------------------------------------------- |
159
+ | **`onSuccess`** | <code><a href="#onmessagereceivedsuccesstype">OnMessageReceivedSuccessType</a></code> |
160
+
161
+ **Returns:** <code><a href="#onmessagereceivedsuccesstype">OnMessageReceivedSuccessType</a></code>
162
+
163
+ --------------------
164
+
165
+
166
+ ### getToken()
167
+
168
+ ```typescript
169
+ getToken() => Promise<any>
170
+ ```
171
+
172
+ **Returns:** <code>Promise&lt;any&gt;</code>
173
+
174
+ --------------------
175
+
176
+
177
+ ### isIndigitallPushNotification(...)
178
+
179
+ ```typescript
180
+ isIndigitallPushNotification(params: { notification: any; }) => Promise<any>
181
+ ```
182
+
183
+ | Param | Type |
184
+ | ------------ | ----------------------------------- |
185
+ | **`params`** | <code>{ notification: any; }</code> |
186
+
187
+ **Returns:** <code>Promise&lt;any&gt;</code>
188
+
189
+ --------------------
190
+
191
+
146
192
  ### logIn(...)
147
193
 
148
194
  ```typescript
@@ -168,4 +214,26 @@ logOut() => Promise<any>
168
214
 
169
215
  --------------------
170
216
 
217
+
218
+ ### Interfaces
219
+
220
+
221
+ #### JSON
222
+
223
+ An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (<a href="#json">JSON</a>) format.
224
+
225
+ | Method | Signature | Description |
226
+ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
227
+ | **parse** | (text: string, reviver?: ((this: any, key: string, value: any) =&gt; any) \| undefined) =&gt; any | Converts a JavaScript Object Notation (<a href="#json">JSON</a>) string into an object. |
228
+ | **stringify** | (value: any, replacer?: ((this: any, key: string, value: any) =&gt; any) \| undefined, space?: string \| number \| undefined) =&gt; string | Converts a JavaScript value to a JavaScript Object Notation (<a href="#json">JSON</a>) string. |
229
+ | **stringify** | (value: any, replacer?: (string \| number)[] \| null \| undefined, space?: string \| number \| undefined) =&gt; string | Converts a JavaScript value to a JavaScript Object Notation (<a href="#json">JSON</a>) string. |
230
+
231
+
232
+ ### Type Aliases
233
+
234
+
235
+ #### OnMessageReceivedSuccessType
236
+
237
+ <code>(json: <a href="#json">JSON</a>): void</code>
238
+
171
239
  </docgen-api>
@@ -52,6 +52,7 @@ dependencies {
52
52
  implementation fileTree(dir: 'libs', include: ['*.jar'])
53
53
  implementation project(':capacitor-android')
54
54
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
55
+ implementation 'com.google.firebase:firebase-messaging:23.0.2'
55
56
  testImplementation "junit:junit:$junitVersion"
56
57
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
57
58
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
@@ -31,7 +31,7 @@
31
31
  android:excludeFromRecents="true">
32
32
  </activity>
33
33
 
34
- <service android:name="com.indigitall.android.services.FirebaseMessagingService"
34
+ <service android:name=".services.IndigitallFirebaseMessagingService"
35
35
  android:exported="false">
36
36
  <intent-filter>
37
37
  <action android:name="com.google.firebase.MESSAGING_EVENT" />
@@ -1,6 +1,7 @@
1
1
  package com.indigitall.capacitor;
2
2
 
3
3
  import android.Manifest;
4
+ import android.content.Context;
4
5
  import android.content.pm.PackageManager;
5
6
  import android.os.Build;
6
7
 
@@ -11,24 +12,39 @@ import com.getcapacitor.JSObject;
11
12
  import com.getcapacitor.Plugin;
12
13
  import com.getcapacitor.PluginCall;
13
14
  import com.getcapacitor.PluginMethod;
15
+ import com.getcapacitor.PluginResult;
14
16
  import com.getcapacitor.annotation.CapacitorPlugin;
15
17
  import com.indigitall.android.callbacks.DeviceCallback;
16
18
  import com.indigitall.android.callbacks.EventCallback;
17
19
  import com.indigitall.android.callbacks.InitCallBack;
20
+ import com.indigitall.android.callbacks.PushTokenCallback;
18
21
  import com.indigitall.android.callbacks.TopicsCallback;
22
+ import com.indigitall.android.commons.callbacks.BaseCallback;
19
23
  import com.indigitall.android.commons.models.Error;
24
+ import com.indigitall.android.commons.models.Push;
20
25
  import com.indigitall.android.models.Device;
21
26
  import com.indigitall.android.models.Permission;
22
27
  import com.indigitall.android.models.Topic;
28
+ import com.indigitall.android.utils.FirebaseUtils;
29
+ import com.indigitall.capacitor.interfaces.IndigitallFirebaseInterface;
23
30
  import com.indigitall.capacitor.utils.IndigitallParse;
24
31
  import com.indigitall.capacitor.implementations.IndigitallCp;
25
32
 
33
+ import org.json.JSONArray;
26
34
  import org.json.JSONException;
35
+ import org.json.JSONObject;
36
+
37
+ import javax.security.auth.callback.Callback;
27
38
 
28
39
  @CapacitorPlugin(name = "IndigitallCp")
29
- public class IndigitallCpPlugin extends Plugin {
40
+ public class IndigitallCpPlugin extends Plugin implements IndigitallFirebaseInterface {
30
41
  private final String DEVICE = "device";
31
42
  private final String TOPICS = "topics";
43
+ private final String TOKEN = "token";
44
+ private final String NOTIFICATION = "notification";
45
+
46
+ public static PluginCall notificationCall;
47
+ public static IndigitallFirebaseInterface indigitallInterface;
32
48
 
33
49
  @PluginMethod
34
50
  public void initialize(PluginCall call) {
@@ -42,7 +58,7 @@ public class IndigitallCpPlugin extends Plugin {
42
58
  requestLocation = obj.getBoolean(JSON_REQUEST_LOCATION);
43
59
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
44
60
  if (getActivity().checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) !=
45
- PackageManager.PERMISSION_GRANTED ){
61
+ PackageManager.PERMISSION_GRANTED) {
46
62
 
47
63
  }
48
64
  }
@@ -225,6 +241,56 @@ public class IndigitallCpPlugin extends Plugin {
225
241
  call.resolve(ret);
226
242
  }
227
243
 
244
+ @PluginMethod(returnType = PluginMethod.RETURN_CALLBACK)
245
+ public void onMessageReceived(PluginCall call) {
246
+ call.setKeepAlive(true);
247
+ notificationCall = call;
248
+ indigitallInterface = this;
249
+ }
250
+
251
+ @Override
252
+ public void onMessageReceived(JSONObject messageJson) {
253
+ if (messageJson != null) {
254
+ if (notificationCall != null) {
255
+ try {
256
+ notificationCall.resolve(new JSObject(messageJson.toString()));
257
+ }catch (JSONException exception) {
258
+ JSObject ret = new JSObject();
259
+ ret.put(NOTIFICATION, messageJson);
260
+ notificationCall.resolve(ret);
261
+ }
262
+ } else {
263
+ FirebaseUtils.INSTANCE.showNotification(getContext(), messageJson);
264
+ }
265
+ }
266
+ }
267
+
268
+
269
+ @PluginMethod
270
+ public void getToken(PluginCall call) {
271
+ IndigitallCp.getToken(getContext(), new PushTokenCallback() {
272
+ @Override
273
+ public void onSuccess(String s) {
274
+ JSObject ret = new JSObject();
275
+ ret.put(TOKEN, s);
276
+ call.resolve(ret);
277
+ }
278
+
279
+ @Override
280
+ public void onError(Error error) {
281
+ call.reject(error.getErrorMessage());
282
+ }
283
+ });
284
+ }
285
+
286
+ @PluginMethod
287
+ public void isIndigitallPushNotification(PluginCall call) throws JSONException {
288
+ JSObject obj = call.getObject(NOTIFICATION);
289
+ if (obj != null){
290
+ IndigitallCp.isIndigitallPushNotification(getContext(), obj, call);
291
+ }
292
+ }
293
+
228
294
  @PluginMethod
229
295
  public void logIn(PluginCall call) {
230
296
  String EXTERNAL_ID = "externalId";
@@ -260,4 +326,6 @@ public class IndigitallCpPlugin extends Plugin {
260
326
  }
261
327
  });
262
328
  }
329
+
330
+
263
331
  }
@@ -4,13 +4,18 @@ import android.content.Context;
4
4
  import android.content.Intent;
5
5
  import android.os.Bundle;
6
6
 
7
+ import com.getcapacitor.PluginCall;
7
8
  import com.indigitall.android.Configuration;
8
9
  import com.indigitall.android.Indigitall;
9
10
  import com.indigitall.android.callbacks.DeviceCallback;
10
11
  import com.indigitall.android.callbacks.EventCallback;
11
12
  import com.indigitall.android.callbacks.InitCallBack;
13
+ import com.indigitall.android.callbacks.PushTokenCallback;
12
14
  import com.indigitall.android.callbacks.TopicsCallback;
15
+ import com.indigitall.android.commons.models.Error;
16
+ import com.indigitall.android.commons.models.ErrorCode;
13
17
  import com.indigitall.android.commons.models.Push;
18
+ import com.indigitall.android.utils.ServiceUtils;
14
19
  import com.indigitall.capacitor.utils.IndigitallParse;
15
20
 
16
21
  import org.json.JSONException;
@@ -120,6 +125,27 @@ public class IndigitallCp {
120
125
  return null;
121
126
  }
122
127
 
128
+ public static void getToken(Context context, PushTokenCallback callback) {
129
+ ServiceUtils.getPushToken(context, callback);
130
+ }
131
+
132
+ public static void isIndigitallPushNotification(Context context, JSONObject json, PluginCall call) throws JSONException {
133
+ boolean isIndigitallPush = false;
134
+ if (json != null) {
135
+ Push push = new Push(context, json);
136
+ if (push != null && push.getAppKey() != null) {
137
+ isIndigitallPush = true;
138
+ }
139
+ }
140
+ if (isIndigitallPush) {
141
+ call.setKeepAlive(true);
142
+ call.resolve();
143
+ } else {
144
+ call.reject("Not a Indigitall Push");
145
+ }
146
+
147
+ }
148
+
123
149
  public static void logIn(Context context, String externalId, DeviceCallback callback) {
124
150
  Indigitall.logIn(context, externalId, callback);
125
151
  }
@@ -0,0 +1,12 @@
1
+ package com.indigitall.capacitor.interfaces;
2
+
3
+ import android.content.Context;
4
+
5
+ import com.getcapacitor.JSObject;
6
+ import com.getcapacitor.PluginCall;
7
+
8
+ import org.json.JSONObject;
9
+
10
+ public abstract interface IndigitallFirebaseInterface {
11
+ public abstract void onMessageReceived(JSONObject messageJson);
12
+ }
@@ -0,0 +1,34 @@
1
+ package com.indigitall.capacitor.services;
2
+
3
+ import android.util.Log;
4
+
5
+ import com.getcapacitor.PluginCall;
6
+ import com.google.firebase.messaging.RemoteMessage;
7
+ import com.indigitall.android.services.FirebaseMessagingService;
8
+ import com.indigitall.android.utils.FirebaseUtils;
9
+ import com.indigitall.capacitor.IndigitallCpPlugin;
10
+ import com.indigitall.capacitor.implementations.IndigitallCp;
11
+
12
+ import org.json.JSONObject;
13
+ import java.util.Map;
14
+
15
+ public class IndigitallFirebaseMessagingService extends FirebaseMessagingService{
16
+
17
+ @Override
18
+ public void onMessageReceived(RemoteMessage remoteMessage) {
19
+ super.onMessageReceived(remoteMessage);
20
+ Map<String, String> data = remoteMessage.getData();
21
+ JSONObject jsonObject = new JSONObject(data);
22
+ if (IndigitallCpPlugin.indigitallInterface != null) {
23
+ IndigitallCpPlugin.indigitallInterface.onMessageReceived(jsonObject);
24
+ }
25
+ }
26
+
27
+ @Override
28
+ public void onNewToken(String s) {
29
+ FirebaseUtils.INSTANCE.setPushToken(this);
30
+ super.onNewToken(s);
31
+ }
32
+
33
+
34
+ }
package/dist/docs.json CHANGED
@@ -119,6 +119,50 @@
119
119
  "complexTypes": [],
120
120
  "slug": "getpush"
121
121
  },
122
+ {
123
+ "name": "onMessageReceived",
124
+ "signature": "(onSuccess: OnMessageReceivedSuccessType) => OnMessageReceivedSuccessType",
125
+ "parameters": [
126
+ {
127
+ "name": "onSuccess",
128
+ "docs": "",
129
+ "type": "OnMessageReceivedSuccessType"
130
+ }
131
+ ],
132
+ "returns": "OnMessageReceivedSuccessType",
133
+ "tags": [],
134
+ "docs": "",
135
+ "complexTypes": [
136
+ "OnMessageReceivedSuccessType"
137
+ ],
138
+ "slug": "onmessagereceived"
139
+ },
140
+ {
141
+ "name": "getToken",
142
+ "signature": "() => Promise<any>",
143
+ "parameters": [],
144
+ "returns": "Promise<any>",
145
+ "tags": [],
146
+ "docs": "",
147
+ "complexTypes": [],
148
+ "slug": "gettoken"
149
+ },
150
+ {
151
+ "name": "isIndigitallPushNotification",
152
+ "signature": "(params: { notification: any; }) => Promise<any>",
153
+ "parameters": [
154
+ {
155
+ "name": "params",
156
+ "docs": "",
157
+ "type": "{ notification: any; }"
158
+ }
159
+ ],
160
+ "returns": "Promise<any>",
161
+ "tags": [],
162
+ "docs": "",
163
+ "complexTypes": [],
164
+ "slug": "isindigitallpushnotification"
165
+ },
122
166
  {
123
167
  "name": "logIn",
124
168
  "signature": "(param: { externalId: string; }) => Promise<any>",
@@ -148,8 +192,140 @@
148
192
  ],
149
193
  "properties": []
150
194
  },
151
- "interfaces": [],
195
+ "interfaces": [
196
+ {
197
+ "name": "JSON",
198
+ "slug": "json",
199
+ "docs": "An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.",
200
+ "tags": [],
201
+ "methods": [
202
+ {
203
+ "name": "parse",
204
+ "signature": "(text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any",
205
+ "parameters": [
206
+ {
207
+ "name": "text",
208
+ "docs": "A valid JSON string.",
209
+ "type": "string"
210
+ },
211
+ {
212
+ "name": "reviver",
213
+ "docs": "A function that transforms the results. This function is called for each member of the object.\r\nIf a member contains nested objects, the nested objects are transformed before the parent object is.",
214
+ "type": "((this: any, key: string, value: any) => any) | undefined"
215
+ }
216
+ ],
217
+ "returns": "any",
218
+ "tags": [
219
+ {
220
+ "name": "param",
221
+ "text": "text A valid JSON string."
222
+ },
223
+ {
224
+ "name": "param",
225
+ "text": "reviver A function that transforms the results. This function is called for each member of the object.\r\nIf a member contains nested objects, the nested objects are transformed before the parent object is."
226
+ }
227
+ ],
228
+ "docs": "Converts a JavaScript Object Notation (JSON) string into an object.",
229
+ "complexTypes": [],
230
+ "slug": "parse"
231
+ },
232
+ {
233
+ "name": "stringify",
234
+ "signature": "(value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined) => string",
235
+ "parameters": [
236
+ {
237
+ "name": "value",
238
+ "docs": "A JavaScript value, usually an object or array, to be converted.",
239
+ "type": "any"
240
+ },
241
+ {
242
+ "name": "replacer",
243
+ "docs": "A function that transforms the results.",
244
+ "type": "((this: any, key: string, value: any) => any) | undefined"
245
+ },
246
+ {
247
+ "name": "space",
248
+ "docs": "Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.",
249
+ "type": "string | number | undefined"
250
+ }
251
+ ],
252
+ "returns": "string",
253
+ "tags": [
254
+ {
255
+ "name": "param",
256
+ "text": "value A JavaScript value, usually an object or array, to be converted."
257
+ },
258
+ {
259
+ "name": "param",
260
+ "text": "replacer A function that transforms the results."
261
+ },
262
+ {
263
+ "name": "param",
264
+ "text": "space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read."
265
+ }
266
+ ],
267
+ "docs": "Converts a JavaScript value to a JavaScript Object Notation (JSON) string.",
268
+ "complexTypes": [],
269
+ "slug": "stringify"
270
+ },
271
+ {
272
+ "name": "stringify",
273
+ "signature": "(value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined) => string",
274
+ "parameters": [
275
+ {
276
+ "name": "value",
277
+ "docs": "A JavaScript value, usually an object or array, to be converted.",
278
+ "type": "any"
279
+ },
280
+ {
281
+ "name": "replacer",
282
+ "docs": "An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified.",
283
+ "type": "(string | number)[] | null | undefined"
284
+ },
285
+ {
286
+ "name": "space",
287
+ "docs": "Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.",
288
+ "type": "string | number | undefined"
289
+ }
290
+ ],
291
+ "returns": "string",
292
+ "tags": [
293
+ {
294
+ "name": "param",
295
+ "text": "value A JavaScript value, usually an object or array, to be converted."
296
+ },
297
+ {
298
+ "name": "param",
299
+ "text": "replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified."
300
+ },
301
+ {
302
+ "name": "param",
303
+ "text": "space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read."
304
+ }
305
+ ],
306
+ "docs": "Converts a JavaScript value to a JavaScript Object Notation (JSON) string.",
307
+ "complexTypes": [],
308
+ "slug": "stringify"
309
+ }
310
+ ],
311
+ "properties": []
312
+ }
313
+ ],
152
314
  "enums": [],
153
- "typeAliases": [],
315
+ "typeAliases": [
316
+ {
317
+ "name": "OnMessageReceivedSuccessType",
318
+ "slug": "onmessagereceivedsuccesstype",
319
+ "docs": "",
320
+ "types": [
321
+ {
322
+ "text": "(json: JSON): void",
323
+ "complexTypes": [
324
+ "JSON"
325
+ ]
326
+ }
327
+ ]
328
+ }
329
+ ],
154
330
  "pluginConfigs": []
155
331
  }
package/dist/esm/Push.js CHANGED
@@ -5,7 +5,7 @@ const IndigitallCp = registerPlugin('IndigitallCp', {
5
5
  const Indigitall = {
6
6
  init: (config, onIndigitallInitializedType, onError) => {
7
7
  Object.assign(config, {
8
- productVersion: '1.2.0',
8
+ productVersion: '1.3.0',
9
9
  productName: 'capacitor',
10
10
  });
11
11
  IndigitallCp.initialize({ config }).then(onInit => {
@@ -87,6 +87,35 @@ const Indigitall = {
87
87
  onError(error);
88
88
  });
89
89
  },
90
+ // onMessageReceived: (
91
+ // onSuccess: OnMessageReceivedSuccessType,
92
+ // onError?: OnErrorCallbackType) => {
93
+ // IndigitallCp.onMessageReceived().then(response => {
94
+ // onSuccess(response.notification);
95
+ // }).catch(error => {
96
+ // if (onError)
97
+ // onError(error);
98
+ // });
99
+ // },
100
+ onMessageReceived: (onSuccess) => {
101
+ IndigitallCp.onMessageReceived(onSuccess);
102
+ },
103
+ getToken: (onSuccess, onError) => {
104
+ IndigitallCp.getToken().then(response => {
105
+ onSuccess(response.token);
106
+ }).catch(error => {
107
+ if (onError)
108
+ onError(error);
109
+ });
110
+ },
111
+ isIndigitallPushNotification: (notification, onSuccess, onError) => {
112
+ IndigitallCp.isIndigitallPushNotification({ notification }).then(() => {
113
+ onSuccess();
114
+ }).catch(error => {
115
+ if (onError)
116
+ onError(error);
117
+ });
118
+ },
90
119
  logIn: (externalId, onSuccess, onError) => {
91
120
  IndigitallCp.logIn({ externalId }).then(response => {
92
121
  if (onSuccess)
@@ -104,7 +133,7 @@ const Indigitall = {
104
133
  if (onError)
105
134
  onError(error);
106
135
  });
107
- }
136
+ },
108
137
  };
109
138
  export { Indigitall };
110
139
  //# sourceMappingURL=Push.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Push.js","sourceRoot":"","sources":["../../src/Push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAkBjD,MAAM,YAAY,GAAG,cAAc,CAAqB,cAAc,EAAE;AACpE,gEAAgE;CACjE,CAAC,CAAC;AAEH,MAAM,UAAU,GAAqB;IACjC,IAAI,EAAE,CACF,MAAkB,EAClB,2BAAyD,EACzD,OAA6B,EAC/B,EAAE;QACA,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;YACpB,cAAc,EAAE,OAAO;YACvB,WAAW,EAAE,WAAW;SACzB,CAAC,CAAA;QACF,YAAY,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YAC9C,IAAI,2BAA2B;gBAC3B,2BAA2B,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC;QAC9G,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACb,IAAI,OAAO;gBACP,OAAO,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;IACD,SAAS,EAAE,CACP,SAA8B,EAC9B,OAA6B,EAAE,EAAE;QACjC,YAAY,CAAC,SAAS,EAAE,CAAC,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AI,CAAC,QAAQ,CAAC,EAAE;YACnC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;QAC5B,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACb,IAAI,OAAO;gBAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC,CAAC,CAAA;IACR,CAAC;IACD,KAAK,EAAE,CACL,UAAkB,EAClB,SAA+B,EAC/B,OAA6B,EAAE,EAAE;QAC7B,YAAY,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAC/C,IAAI,SAAS;gBAAE,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;QAC7C,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACb,IAAI,OAAO;gBAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC,CAAC,CAAA;IACR,CAAC;IACD,MAAM,EAAE,CACJ,SAA+B,EAC/B,OAA6B,EAAE,EAAE;QAC/B,YAAY,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAClC,IAAI,SAAS;gBAAE,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;QAC7C,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACd,IAAI,OAAO;gBAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAA;IACR,CAAC;CACJ,CAAA;AAED,OAAO,EAAE,UAAU,EAAE,CAAA","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { \n OnIndigitallInitializedType, \n OnDeviceSuccessType,\n OnTopicSuccessType,\n OnPushSuccessType,\n OnErrorCallbackType \n } from './callbacks/callbacksType';\nimport type { \n IndigitallCpPlugin, \n IndigitallPlugin\n } from './definitions/pushDefinitions';\nimport type {\n EventParams,\n InitParams,\n } from './params/pushParams';\n\nconst IndigitallCp = registerPlugin<IndigitallCpPlugin>('IndigitallCp', {\n //web: () => import('./web').then(m => new m.IndigitallCpWeb()),\n });\n\n const Indigitall: IndigitallPlugin = {\n init: (\n config: InitParams,\n onIndigitallInitializedType?: OnIndigitallInitializedType,\n onError?: OnErrorCallbackType\n ) => {\n Object.assign(config, {\n productVersion: '1.2.0',\n productName: 'capacitor',\n })\n IndigitallCp.initialize({ config }).then(onInit => {\n if (onIndigitallInitializedType)\n onIndigitallInitializedType(onInit[\"device\"], onInit[\"pushPermission\"], onInit[\"locationPermission\"]);\n }).catch(error => {\n if (onError)\n onError(error);\n });\n },\n deviceGet: (\n onSuccess: OnDeviceSuccessType, \n onError?: OnErrorCallbackType) => {\n IndigitallCp.deviceGet().then(response => {\n onSuccess(response.device)\n }).catch(error => {\n if (onError) onError(error);\n })\n },\n deviceEnable: (\n onSuccess?: OnDeviceSuccessType, \n onError?: OnErrorCallbackType) => {\n IndigitallCp.deviceEnable().then(response => {\n if (onSuccess) onSuccess(response.device)\n }).catch(error => {\n if (onError) onError(error);\n })\n },\n deviceDisable: (\n onSuccess?: OnDeviceSuccessType, \n onError?: OnErrorCallbackType) => {\n IndigitallCp.deviceDisable().then(response => {\n if (onSuccess) onSuccess(response.device)\n }).catch(error => {\n if (onError) onError(error);\n })\n },\n topicsList: (\n onSuccess?: OnTopicSuccessType, \n onError?: OnErrorCallbackType) => {\n IndigitallCp.topicsList().then(response => {\n if (onSuccess) onSuccess(response.topics);\n }).catch(error => {\n if (onError) onError(error);\n })\n },\n topicsSubscribe: (\n topics: string[], \n onSuccess?: OnTopicSuccessType, \n onError?: OnErrorCallbackType) => {\n IndigitallCp.topicsSubscribe({ topics }).then(response => {\n if (onSuccess) onSuccess(response.topics)\n }).catch(error => {\n if (onError) onError(error);\n })\n },\n topicsUnsubscribe: (\n topics: string[], \n onSuccess?: OnTopicSuccessType, \n onError?: OnErrorCallbackType) => {\n IndigitallCp.topicsUnsubscribe({ topics }).then(response => {\n if (onSuccess) onSuccess(response.topics)\n }).catch(error => {\n if (onError) onError(error);\n })\n },\n sendCustomEvent: (\n customEvent: EventParams,\n onSuccess?: () => void, \n onError?: OnErrorCallbackType) => {\n const myCustomEvent = { customEvent }\n IndigitallCp.sendCustomEvent(myCustomEvent).then(() => {\n if (onSuccess) onSuccess();\n }).catch(error => {\n if (onError) onError(error);\n }) \n },\n getPush: (\n onSuccess: OnPushSuccessType, \n onError?: OnErrorCallbackType) => {\n IndigitallCp.getPush().then(response => {\n onSuccess(response.push)\n }).catch(error => {\n if (onError) onError(error);\n })\n },\n logIn: (\n externalId: string, \n onSuccess?: OnDeviceSuccessType, \n onError?: OnErrorCallbackType) => {\n IndigitallCp.logIn({ externalId }).then(response => {\n if (onSuccess) onSuccess(response.device)\n }).catch(error => {\n if (onError) onError(error);\n })\n },\n logOut: (\n onSuccess?: OnDeviceSuccessType, \n onError?: OnErrorCallbackType) => {\n IndigitallCp.logOut().then(response => {\n if (onSuccess) onSuccess(response.device)\n }).catch(error => {\n if (onError) onError(error);\n })\n }\n }\n\n export { Indigitall }"]}
1
+ {"version":3,"file":"Push.js","sourceRoot":"","sources":["../../src/Push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAoBjD,MAAM,YAAY,GAAG,cAAc,CAAqB,cAAc,EAAE;AACpE,gEAAgE;CACjE,CAAC,CAAC;AAEH,MAAM,UAAU,GAAqB;IACjC,IAAI,EAAE,CACF,MAAkB,EAClB,2BAAyD,EACzD,OAA6B,EAC/B,EAAE;QACA,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;YACpB,cAAc,EAAE,OAAO;YACvB,WAAW,EAAE,WAAW;SACzB,CAAC,CAAA;QACF,YAAY,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YAC9C,IAAI,2BAA2B;gBAC3B,2BAA2B,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,M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AAE,CAAC;QAChB,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACb,IAAI,OAAO;gBACP,OAAO,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;IACD,KAAK,EAAE,CACH,UAAkB,EAClB,SAA+B,EAC/B,OAA6B,EAAE,EAAE;QACjC,YAAY,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAC/C,IAAI,SAAS;gBACT,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACb,IAAI,OAAO;gBACP,OAAO,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;IACD,MAAM,EAAE,CACJ,SAA+B,EAC/B,OAA6B,EAAE,EAAE;QACjC,YAAY,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAClC,IAAI,SAAS;gBACT,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACb,IAAI,OAAO;gBACP,OAAO,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AAED,OAAO,EAAE,UAAU,EAAE,CAAA","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { \n OnIndigitallInitializedType, \n OnDeviceSuccessType,\n OnTopicSuccessType,\n OnPushSuccessType,\n OnErrorCallbackType,\n OnMessageReceivedSuccessType,\n OnTokenSuccessType,\n } from './callbacks/callbacksType';\nimport type { \n IndigitallCpPlugin, \n IndigitallPlugin\n } from './definitions/pushDefinitions';\nimport type {\n EventParams,\n InitParams,\n } from './params/pushParams';\n\nconst IndigitallCp = registerPlugin<IndigitallCpPlugin>('IndigitallCp', {\n //web: () => import('./web').then(m => new m.IndigitallCpWeb()),\n });\n\n const Indigitall: IndigitallPlugin = {\n init: (\n config: InitParams,\n onIndigitallInitializedType?: OnIndigitallInitializedType,\n onError?: OnErrorCallbackType\n ) => {\n Object.assign(config, {\n productVersion: '1.3.0',\n productName: 'capacitor',\n })\n IndigitallCp.initialize({ config }).then(onInit => {\n if (onIndigitallInitializedType)\n onIndigitallInitializedType(onInit[\"device\"], onInit[\"pushPermission\"], onInit[\"locationPermission\"]);\n }).catch(error => {\n if (onError)\n onError(error);\n });\n },\n deviceGet: (\n onSuccess: OnDeviceSuccessType,\n onError?: OnErrorCallbackType) => {\n IndigitallCp.deviceGet().then(response => {\n onSuccess(response.device);\n }).catch(error => {\n if (onError)\n onError(error);\n });\n },\n deviceEnable: (\n onSuccess?: OnDeviceSuccessType,\n onError?: OnErrorCallbackType) => {\n IndigitallCp.deviceEnable().then(response => {\n if (onSuccess)\n onSuccess(response.device);\n }).catch(error => {\n if (onError)\n onError(error);\n });\n },\n deviceDisable: (\n onSuccess?: OnDeviceSuccessType,\n onError?: OnErrorCallbackType) => {\n IndigitallCp.deviceDisable().then(response => {\n if (onSuccess)\n onSuccess(response.device);\n }).catch(error => {\n if (onError)\n onError(error);\n });\n },\n topicsList: (\n onSuccess?: OnTopicSuccessType,\n onError?: OnErrorCallbackType) => {\n IndigitallCp.topicsList().then(response => {\n if (onSuccess)\n onSuccess(response.topics);\n }).catch(error => {\n if (onError)\n onError(error);\n });\n },\n topicsSubscribe: (\n topics: string[],\n onSuccess?: OnTopicSuccessType,\n onError?: OnErrorCallbackType) => {\n IndigitallCp.topicsSubscribe({ topics }).then(response => {\n if (onSuccess)\n onSuccess(response.topics);\n }).catch(error => {\n if (onError)\n onError(error);\n });\n },\n topicsUnsubscribe: (\n topics: string[],\n onSuccess?: OnTopicSuccessType,\n onError?: OnErrorCallbackType) => {\n IndigitallCp.topicsUnsubscribe({ topics }).then(response => {\n if (onSuccess)\n onSuccess(response.topics);\n }).catch(error => {\n if (onError)\n onError(error);\n });\n },\n sendCustomEvent: (\n customEvent: EventParams,\n onSuccess?: () => void,\n onError?: OnErrorCallbackType) => {\n const myCustomEvent = { customEvent };\n IndigitallCp.sendCustomEvent(myCustomEvent).then(() => {\n if (onSuccess)\n onSuccess();\n }).catch(error => {\n if (onError)\n onError(error);\n });\n },\n getPush: (\n onSuccess: OnPushSuccessType,\n onError?: OnErrorCallbackType) => {\n IndigitallCp.getPush().then(response => {\n onSuccess(response.push);\n }).catch(error => {\n if (onError)\n onError(error);\n });\n },\n // onMessageReceived: (\n // onSuccess: OnMessageReceivedSuccessType,\n // onError?: OnErrorCallbackType) => {\n // IndigitallCp.onMessageReceived().then(response => {\n // onSuccess(response.notification);\n // }).catch(error => {\n // if (onError)\n // onError(error);\n // });\n // },\n onMessageReceived: (\n onSuccess: OnMessageReceivedSuccessType) => {\n IndigitallCp.onMessageReceived(onSuccess);\n },\n getToken: (\n onSuccess: OnTokenSuccessType,\n onError?: OnErrorCallbackType) => {\n IndigitallCp.getToken().then(response => {\n onSuccess(response.token);\n }).catch(error => {\n if (onError)\n onError(error);\n });\n },\n isIndigitallPushNotification: (\n notification: any,\n onSuccess: () => void,\n onError?: OnErrorCallbackType) => {\n IndigitallCp.isIndigitallPushNotification({ notification }).then(() => {\n onSuccess();\n }).catch(error => {\n if (onError)\n onError(error);\n });\n },\n logIn: (\n externalId: string,\n onSuccess?: OnDeviceSuccessType,\n onError?: OnErrorCallbackType) => {\n IndigitallCp.logIn({ externalId }).then(response => {\n if (onSuccess)\n onSuccess(response.device);\n }).catch(error => {\n if (onError)\n onError(error);\n });\n },\n logOut: (\n onSuccess?: OnDeviceSuccessType,\n onError?: OnErrorCallbackType) => {\n IndigitallCp.logOut().then(response => {\n if (onSuccess)\n onSuccess(response.device);\n }).catch(error => {\n if (onError)\n onError(error);\n });\n },\n }\n\n export { Indigitall }"]}
@@ -9,6 +9,8 @@ declare type ErrorCallback = {
9
9
  export declare type OnIndigitallInitializedType = (device: Device, pushPermission: number, locationPermission: number) => void;
10
10
  export declare type OnErrorCallbackType = (error: ErrorCallback) => void;
11
11
  export declare type OnDeviceSuccessType = (device: Device) => void;
12
+ export declare type OnMessageReceivedSuccessType = (json: JSON) => void;
13
+ export declare type OnTokenSuccessType = (token: string) => void;
12
14
  export declare type OnPushSuccessType = (push: Push) => void;
13
15
  export declare type OnTopicSuccessType = (topic: [Topic]) => void;
14
16
  export declare type OnInAppCallbackType = (inApp: InApp) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"callbacksType.js","sourceRoot":"","sources":["../../../src/callbacks/callbacksType.ts"],"names":[],"mappings":"","sourcesContent":["import type { Customer, CustomerField } from '../models/InCustomer';\nimport type {\n Device, \n Topic\n} from '../models/InDevice';\nimport type { InApp } from '../models/InInApp';\nimport type { Inbox, InboxNotifications, MessageCount } from '../models/InInbox';\nimport type { Push } from '../models/InPush';\n\ntype ErrorCallback = {\n message: string;\n};\n\n//INIT\nexport type OnIndigitallInitializedType = ( \n device: Device,\n pushPermission: number,\n locationPermission: number\n ) => void;\n export type OnErrorCallbackType = (error: ErrorCallback) => void;\n export type OnDeviceSuccessType = (device: Device) => void;\n export type OnPushSuccessType = (push: Push) => void;\n export type OnTopicSuccessType = (topic: [Topic]) => void;\n\n//IN APP\nexport type OnInAppCallbackType = (\n inApp: InApp\n ) => void;\n\nexport type OnErrorMultipleInAppCallbackType = (error: ErrorCallback, viewId: string) => void;\n//INBOX\nexport type OnInboxSuccessType = (inbox: Inbox) => void;\nexport type OnInboxNotificationSuccessType = (\n inboxNotification: InboxNotifications\n) => void;\nexport type OnInboxMessageCountSuccessType = (\n messageCount: MessageCount\n) => void;\n\n//CUSTOMER\nexport type OnCustomerSuccessType = (customer: Customer) => void;\nexport type OnCustomerFieldSuccessType = (\n customerField: [CustomerField]\n) => void;\n"]}
1
+ {"version":3,"file":"callbacksType.js","sourceRoot":"","sources":["../../../src/callbacks/callbacksType.ts"],"names":[],"mappings":"","sourcesContent":["import type { Customer, CustomerField } from '../models/InCustomer';\nimport type {\n Device, \n Topic \n} from '../models/InDevice';\nimport type { InApp } from '../models/InInApp';\nimport type { Inbox, InboxNotifications, MessageCount } from '../models/InInbox';\nimport type { Push } from '../models/InPush';\n\ntype ErrorCallback = {\n message: string;\n};\n\n//INIT\nexport type OnIndigitallInitializedType = ( \n device: Device,\n pushPermission: number,\n locationPermission: number\n ) => void;\nexport type OnErrorCallbackType = (error: ErrorCallback) => void;\nexport type OnDeviceSuccessType = (device: Device) => void;\nexport type OnMessageReceivedSuccessType = (json: JSON) => void;\nexport type OnTokenSuccessType = (token: string) => void;\nexport type OnPushSuccessType = (push: Push) => void;\nexport type OnTopicSuccessType = (topic: [Topic]) => void;\n\n//IN APP\nexport type OnInAppCallbackType = (\n inApp: InApp\n ) => void;\n\nexport type OnErrorMultipleInAppCallbackType = (error: ErrorCallback, viewId: string) => void;\n//INBOX\nexport type OnInboxSuccessType = (inbox: Inbox) => void;\nexport type OnInboxNotificationSuccessType = (\n inboxNotification: InboxNotifications\n) => void;\nexport type OnInboxMessageCountSuccessType = (\n messageCount: MessageCount\n) => void;\n\n//CUSTOMER\nexport type OnCustomerSuccessType = (customer: Customer) => void;\nexport type OnCustomerFieldSuccessType = (\n customerField: [CustomerField]\n) => void;\n"]}
@@ -1,4 +1,4 @@
1
- import type { OnIndigitallInitializedType, OnDeviceSuccessType, OnPushSuccessType, OnTopicSuccessType, OnErrorCallbackType } from '../callbacks/callbacksType';
1
+ import type { OnIndigitallInitializedType, OnDeviceSuccessType, OnPushSuccessType, OnTopicSuccessType, OnErrorCallbackType, OnMessageReceivedSuccessType, OnTokenSuccessType } from '../callbacks/callbacksType';
2
2
  import type { InitParams, EventParams } from '../params/pushParams';
3
3
  export interface IndigitallCpPlugin {
4
4
  initialize(params: {
@@ -18,6 +18,11 @@ export interface IndigitallCpPlugin {
18
18
  customEvent: any;
19
19
  }): Promise<void>;
20
20
  getPush(): Promise<any>;
21
+ onMessageReceived(onSuccess: OnMessageReceivedSuccessType): OnMessageReceivedSuccessType;
22
+ getToken(): Promise<any>;
23
+ isIndigitallPushNotification(params: {
24
+ notification: any;
25
+ }): Promise<any>;
21
26
  logIn(param: {
22
27
  externalId: string;
23
28
  }): Promise<any>;
@@ -33,6 +38,9 @@ export interface IndigitallPlugin {
33
38
  topicsUnsubscribe: (topics: string[], onSuccess?: OnTopicSuccessType, onError?: OnErrorCallbackType) => void;
34
39
  sendCustomEvent: (customEvent: EventParams, onSuccess?: () => void, onError?: OnErrorCallbackType) => void;
35
40
  getPush: (onSuccess: OnPushSuccessType, onError?: OnErrorCallbackType) => void;
41
+ onMessageReceived: (onSuccess: OnMessageReceivedSuccessType) => void;
42
+ getToken: (onSuccess: OnTokenSuccessType, onError?: OnErrorCallbackType) => void;
43
+ isIndigitallPushNotification: (notification: any, onSuccess: () => void, onError?: OnErrorCallbackType) => void;
36
44
  logIn: (externalId: string, onSuccess?: OnDeviceSuccessType, onError?: OnErrorCallbackType) => void;
37
45
  logOut: (onSuccess?: OnDeviceSuccessType, onError?: OnErrorCallbackType) => void;
38
46
  }