indigitall-capacitor-plugin 2.0.0 → 2.0.2
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 +38 -0
- package/android/build.gradle +1 -1
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/indigitall/capacitor/IndigitallCpPlugin.java +62 -1
- package/android/src/main/java/com/indigitall/capacitor/interfaces/IndigitallFirebaseInterface.java +2 -0
- package/android/src/main/java/com/indigitall/capacitor/models/CpIndigitallHiddenActivity.java +50 -0
- package/android/src/main/java/com/indigitall/capacitor/models/CpPushNotification.java +30 -0
- package/android/src/main/java/com/indigitall/capacitor/services/IndigitallFirebaseMessagingService.java +7 -1
- package/android/src/main/java/com/indigitall/capacitor/utils/CpIndigitallUtils.java +49 -0
- package/android/src/main/java/com/indigitall/capacitor/utils/CpPreferenceUtils.java +70 -0
- package/dist/docs.json +36 -0
- package/dist/esm/Push.js +15 -1
- package/dist/esm/Push.js.map +1 -1
- package/dist/esm/definitions/pushDefinitions.d.ts +8 -0
- package/dist/esm/definitions/pushDefinitions.js.map +1 -1
- package/dist/plugin.cjs.js +15 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +15 -1
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/IndigitallCpPlugin.swift +67 -5
- package/ios/Plugin/handlers/IndigitallNotificationHandler.swift +4 -2
- package/ios/Plugin/interfaces/IndigitallCpPlugin.m +3 -0
- package/ios/Plugin/utils/CpINDefaults.h +23 -0
- package/ios/Plugin/utils/CpINDefaults.m +52 -0
- package/package.json +7 -7
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
13
|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
-
s.ios.deployment_target = '
|
|
14
|
+
s.ios.deployment_target = '12.0'
|
|
15
15
|
s.dependency 'Capacitor'
|
|
16
16
|
s.dependency 'indigitall-ios', '~> 5.1.0'
|
|
17
17
|
s.swift_version = '5.1'
|
package/README.md
CHANGED
|
@@ -22,6 +22,9 @@ npx cap sync
|
|
|
22
22
|
* [`topicsUnsubscribe(...)`](#topicsunsubscribe)
|
|
23
23
|
* [`sendCustomEvent(...)`](#sendcustomevent)
|
|
24
24
|
* [`getPush()`](#getpush)
|
|
25
|
+
* [`onIndigitallGetPush()`](#onindigitallgetpush)
|
|
26
|
+
* [`clearViewUrl()`](#clearviewurl)
|
|
27
|
+
* [`setDefaultViewUrl(...)`](#setdefaultviewurl)
|
|
25
28
|
* [`onMessageReceived(...)`](#onmessagereceived)
|
|
26
29
|
* [`getToken()`](#gettoken)
|
|
27
30
|
* [`isIndigitallPushNotification(...)`](#isindigitallpushnotification)
|
|
@@ -148,6 +151,41 @@ getPush() => Promise<any>
|
|
|
148
151
|
--------------------
|
|
149
152
|
|
|
150
153
|
|
|
154
|
+
### onIndigitallGetPush()
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
onIndigitallGetPush() => Promise<any>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Returns:** <code>Promise<any></code>
|
|
161
|
+
|
|
162
|
+
--------------------
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
### clearViewUrl()
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
clearViewUrl() => void
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
--------------------
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
### setDefaultViewUrl(...)
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
setDefaultViewUrl(params: { defaultView: string; }) => unknown
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
| Param | Type |
|
|
181
|
+
| ------------ | ------------------------------------- |
|
|
182
|
+
| **`params`** | <code>{ defaultView: string; }</code> |
|
|
183
|
+
|
|
184
|
+
**Returns:** <code>unknown</code>
|
|
185
|
+
|
|
186
|
+
--------------------
|
|
187
|
+
|
|
188
|
+
|
|
151
189
|
### onMessageReceived(...)
|
|
152
190
|
|
|
153
191
|
```typescript
|
package/android/build.gradle
CHANGED
|
@@ -55,7 +55,7 @@ dependencies {
|
|
|
55
55
|
testImplementation "junit:junit:$junitVersion"
|
|
56
56
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
57
57
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
58
|
-
implementation('com.indigitall:android:5.
|
|
58
|
+
implementation('com.indigitall:android:5.2.+'){
|
|
59
59
|
exclude group: "com.indigitall", module: "android-hms"
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
</intent-filter>
|
|
24
24
|
</receiver>
|
|
25
25
|
<activity
|
|
26
|
-
android:name="
|
|
26
|
+
android:name=".models.CpIndigitallHiddenActivity"
|
|
27
27
|
android:label="@string/app_name_sdk"
|
|
28
28
|
android:screenOrientation="portrait"
|
|
29
29
|
android:configChanges="orientation|keyboardHidden"
|
|
@@ -3,6 +3,7 @@ package com.indigitall.capacitor;
|
|
|
3
3
|
import android.Manifest;
|
|
4
4
|
import android.content.Context;
|
|
5
5
|
import android.content.pm.PackageManager;
|
|
6
|
+
import android.net.Uri;
|
|
6
7
|
import android.os.Build;
|
|
7
8
|
|
|
8
9
|
import androidx.annotation.NonNull;
|
|
@@ -22,10 +23,12 @@ import com.indigitall.android.callbacks.TopicsCallback;
|
|
|
22
23
|
import com.indigitall.android.commons.models.ErrorModel;
|
|
23
24
|
import com.indigitall.android.models.Device;
|
|
24
25
|
import com.indigitall.android.models.Permission;
|
|
26
|
+
import com.indigitall.android.models.Push;
|
|
25
27
|
import com.indigitall.android.models.PushErrorModel;
|
|
26
28
|
import com.indigitall.android.models.Topic;
|
|
27
29
|
import com.indigitall.android.utils.FirebaseUtils;
|
|
28
30
|
import com.indigitall.capacitor.interfaces.IndigitallFirebaseInterface;
|
|
31
|
+
import com.indigitall.capacitor.utils.CpPreferenceUtils;
|
|
29
32
|
import com.indigitall.capacitor.utils.IndigitallParse;
|
|
30
33
|
import com.indigitall.capacitor.implementations.IndigitallCp;
|
|
31
34
|
|
|
@@ -41,9 +44,11 @@ public class IndigitallCpPlugin extends Plugin implements IndigitallFirebaseInte
|
|
|
41
44
|
private final String TOPICS = "topics";
|
|
42
45
|
private final String TOKEN = "token";
|
|
43
46
|
private final String NOTIFICATION = "notification";
|
|
47
|
+
private final String PUSH = "push";
|
|
44
48
|
|
|
45
49
|
public static PluginCall notificationCall;
|
|
46
50
|
public static IndigitallFirebaseInterface indigitallInterface;
|
|
51
|
+
public static PluginCall getPushCallback;
|
|
47
52
|
|
|
48
53
|
@PluginMethod
|
|
49
54
|
public void initialize(PluginCall call) {
|
|
@@ -228,10 +233,66 @@ public class IndigitallCpPlugin extends Plugin implements IndigitallFirebaseInte
|
|
|
228
233
|
});
|
|
229
234
|
}
|
|
230
235
|
|
|
236
|
+
@PluginMethod
|
|
237
|
+
public void setDefaultViewUrl(PluginCall call) {
|
|
238
|
+
try{
|
|
239
|
+
String defaultView = call.getString("defaultView");
|
|
240
|
+
CpPreferenceUtils.setPushUrl(getContext(), defaultView);
|
|
241
|
+
CpPreferenceUtils.setNativePushUrl(getContext(), "");
|
|
242
|
+
} catch (Exception ex) {
|
|
243
|
+
ex.printStackTrace();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
@PluginMethod
|
|
248
|
+
public void clearViewUrl() {
|
|
249
|
+
CpPreferenceUtils.setPushUrl(getContext(), "");
|
|
250
|
+
CpPreferenceUtils.setNativePushUrl(getContext(), "");
|
|
251
|
+
}
|
|
252
|
+
6
|
|
253
|
+
@PluginMethod
|
|
254
|
+
public void onIndigitallGetPush(PluginCall call) throws JSONException {
|
|
255
|
+
onIndigitallGetPush(call, null);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
@Override
|
|
259
|
+
public void onIndigitallGetPush(PluginCall call, JSONObject json) throws JSONException {
|
|
260
|
+
if (json != null) {
|
|
261
|
+
if (bridge != null) {
|
|
262
|
+
String url = CpPreferenceUtils.getPushUrl(getContext());
|
|
263
|
+
String urlNative = CpPreferenceUtils.getNativePushUrl(getContext());
|
|
264
|
+
if (urlNative != null && !urlNative.equals("") && !urlNative.equals(bridge.getLocalUrl())){
|
|
265
|
+
bridge.launchIntent(Uri.parse(urlNative));
|
|
266
|
+
} else if (url != null && !url.equals("")) {
|
|
267
|
+
String completeUrl = bridge.getLocalUrl()+"/"+url;
|
|
268
|
+
//if (!completeUrl.equals(bridge.getLocalUrl())) {
|
|
269
|
+
bridge.launchIntent(Uri.parse(completeUrl));
|
|
270
|
+
//}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
} else {
|
|
274
|
+
getPushCallback = call;
|
|
275
|
+
indigitallInterface = this;
|
|
276
|
+
String url = bridge.getLocalUrl();
|
|
277
|
+
String urlGetPushMethod = CpPreferenceUtils.getPushUrl(getContext());
|
|
278
|
+
if (urlGetPushMethod == null || urlGetPushMethod.equals("")) {
|
|
279
|
+
CpPreferenceUtils.setNativePushUrl(getContext(), url);
|
|
280
|
+
}
|
|
281
|
+
JSObject ret = new JSObject();
|
|
282
|
+
if (CpPreferenceUtils.getPushString(getContext()) != null &&
|
|
283
|
+
!CpPreferenceUtils.getPushString(getContext()).equals("")) {
|
|
284
|
+
Push push = new Push(getContext(), CpPreferenceUtils.getPushString(getContext()));
|
|
285
|
+
ret.put(PUSH, IndigitallParse.jsonFromPush(push));
|
|
286
|
+
CpPreferenceUtils.setPushString(getContext(), "");
|
|
287
|
+
}
|
|
288
|
+
call.setKeepAlive(true);
|
|
289
|
+
getPushCallback.resolve(ret);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
231
293
|
@PluginMethod
|
|
232
294
|
public void getPush(PluginCall call) throws JSONException {
|
|
233
295
|
JSObject ret = new JSObject();
|
|
234
|
-
String PUSH = "push";
|
|
235
296
|
ret.put(PUSH, IndigitallCp.getPush(getContext(), getActivity().getIntent()));
|
|
236
297
|
call.resolve(ret);
|
|
237
298
|
}
|
package/android/src/main/java/com/indigitall/capacitor/interfaces/IndigitallFirebaseInterface.java
CHANGED
|
@@ -5,8 +5,10 @@ import android.content.Context;
|
|
|
5
5
|
import com.getcapacitor.JSObject;
|
|
6
6
|
import com.getcapacitor.PluginCall;
|
|
7
7
|
|
|
8
|
+
import org.json.JSONException;
|
|
8
9
|
import org.json.JSONObject;
|
|
9
10
|
|
|
10
11
|
public abstract interface IndigitallFirebaseInterface {
|
|
11
12
|
public abstract void onMessageReceived(JSONObject messageJson);
|
|
13
|
+
public abstract void onIndigitallGetPush(PluginCall call, JSONObject json) throws JSONException;
|
|
12
14
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
package com.indigitall.capacitor.models;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.content.Intent;
|
|
5
|
+
import android.content.pm.PackageManager;
|
|
6
|
+
import android.os.Bundle;
|
|
7
|
+
|
|
8
|
+
import androidx.annotation.Nullable;
|
|
9
|
+
|
|
10
|
+
import com.indigitall.android.HiddenActivity;
|
|
11
|
+
import com.indigitall.android.models.Push;
|
|
12
|
+
import com.indigitall.capacitor.IndigitallCpPlugin;
|
|
13
|
+
import com.indigitall.capacitor.utils.CpPreferenceUtils;
|
|
14
|
+
|
|
15
|
+
import org.json.JSONObject;
|
|
16
|
+
|
|
17
|
+
public class CpIndigitallHiddenActivity extends HiddenActivity {
|
|
18
|
+
@Override
|
|
19
|
+
protected void onCreate(@Nullable Bundle bundle) {
|
|
20
|
+
super.onCreate(bundle);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@Override
|
|
24
|
+
protected void onHandleIntentAction(Intent intentAction) {
|
|
25
|
+
try{
|
|
26
|
+
if (IndigitallCpPlugin.indigitallInterface != null && IndigitallCpPlugin.getPushCallback != null) {
|
|
27
|
+
if (intentAction.hasExtra(Push.EXTRA_PUSH)) {
|
|
28
|
+
JSONObject json = new JSONObject(intentAction.getStringExtra(Push.EXTRA_PUSH));
|
|
29
|
+
IndigitallCpPlugin.indigitallInterface.onIndigitallGetPush(null, json);
|
|
30
|
+
Context context = getApplicationContext();
|
|
31
|
+
PackageManager manager = context.getPackageManager();
|
|
32
|
+
|
|
33
|
+
Intent i = manager.getLaunchIntentForPackage(getPackageName());
|
|
34
|
+
if (i != null) {
|
|
35
|
+
i.addCategory(Intent.CATEGORY_LAUNCHER);
|
|
36
|
+
}
|
|
37
|
+
context.startActivity(i);
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
if (intentAction.hasExtra(Push.EXTRA_PUSH)) {
|
|
41
|
+
CpPreferenceUtils.setPushString(getApplicationContext(), intentAction.getStringExtra(Push.EXTRA_PUSH));
|
|
42
|
+
}
|
|
43
|
+
super.onHandleIntentAction(intentAction);
|
|
44
|
+
}
|
|
45
|
+
} catch (Exception ex) {
|
|
46
|
+
ex.printStackTrace();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
package com.indigitall.capacitor.models;
|
|
2
|
+
|
|
3
|
+
import android.app.PendingIntent;
|
|
4
|
+
import android.content.Context;
|
|
5
|
+
|
|
6
|
+
import com.indigitall.android.commons.models.CorePushAction;
|
|
7
|
+
import com.indigitall.android.models.Push;
|
|
8
|
+
import com.indigitall.android.models.PushNotification;
|
|
9
|
+
import com.indigitall.capacitor.utils.CpIndigitallUtils;
|
|
10
|
+
|
|
11
|
+
public class CpPushNotification extends PushNotification {
|
|
12
|
+
Push push;
|
|
13
|
+
Context context;
|
|
14
|
+
public CpPushNotification(Push push) {
|
|
15
|
+
super(push);
|
|
16
|
+
this.push = push;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@Override
|
|
20
|
+
public void showNotification(Context context) {
|
|
21
|
+
this.context = context;
|
|
22
|
+
super.showNotification(context);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@Override
|
|
26
|
+
public PendingIntent getIntent(CorePushAction action, int clickedButton) {
|
|
27
|
+
return CpIndigitallUtils.getIntent(context, push, action, clickedButton);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
package com.indigitall.capacitor.services;
|
|
2
2
|
|
|
3
|
+
import android.content.Context;
|
|
3
4
|
import android.util.Log;
|
|
4
5
|
|
|
5
6
|
import com.getcapacitor.PluginCall;
|
|
6
7
|
import com.google.firebase.messaging.RemoteMessage;
|
|
8
|
+
import com.indigitall.android.models.Push;
|
|
7
9
|
import com.indigitall.android.services.FirebaseMessagingService;
|
|
8
10
|
import com.indigitall.android.utils.FirebaseUtils;
|
|
9
11
|
import com.indigitall.capacitor.IndigitallCpPlugin;
|
|
10
12
|
import com.indigitall.capacitor.implementations.IndigitallCp;
|
|
13
|
+
import com.indigitall.capacitor.models.CpPushNotification;
|
|
11
14
|
|
|
12
15
|
import org.json.JSONObject;
|
|
13
16
|
import java.util.Map;
|
|
@@ -30,5 +33,8 @@ public class IndigitallFirebaseMessagingService extends FirebaseMessagingService
|
|
|
30
33
|
super.onNewToken(s);
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
@Override
|
|
37
|
+
protected void showNotification(Context context, Push push) {
|
|
38
|
+
new CpPushNotification(push).showNotification(context);
|
|
39
|
+
}
|
|
34
40
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
package com.indigitall.capacitor.utils;
|
|
2
|
+
|
|
3
|
+
import android.app.PendingIntent;
|
|
4
|
+
import android.app.TaskStackBuilder;
|
|
5
|
+
import android.content.Context;
|
|
6
|
+
import android.content.Intent;
|
|
7
|
+
|
|
8
|
+
import com.indigitall.android.commons.models.CorePush;
|
|
9
|
+
import com.indigitall.android.commons.models.CorePushAction;
|
|
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;
|
|
15
|
+
import com.indigitall.capacitor.models.CpIndigitallHiddenActivity;
|
|
16
|
+
|
|
17
|
+
public class CpIndigitallUtils {
|
|
18
|
+
public static PendingIntent getIntent(Context context, CorePush push, CorePushAction action, int clickedButton) {
|
|
19
|
+
try{
|
|
20
|
+
Intent intent = action.getIntent(context);
|
|
21
|
+
if (intent != null) {
|
|
22
|
+
if (action.getType() == PushAction.Type.APP) {
|
|
23
|
+
intent.putExtra(Push.EXTRA_PUSH, push.toString());
|
|
24
|
+
}
|
|
25
|
+
Intent indigitallIntent = new Intent(context, CpIndigitallHiddenActivity.class);
|
|
26
|
+
indigitallIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
27
|
+
indigitallIntent.putExtra(StatisticService.EXTRA_APP_KEY, PushPreferenceUtils.getAppKey(context));
|
|
28
|
+
indigitallIntent.putExtra(StatisticService.EXTRA_PUSH_ID, push.getId());
|
|
29
|
+
indigitallIntent.putExtra(StatisticService.EXTRA_CLICKED_BUTTON, clickedButton);
|
|
30
|
+
indigitallIntent.putExtra(StatisticService.EXTRA_INTENT_ACTION, intent);
|
|
31
|
+
indigitallIntent.putExtra(Push.EXTRA_PUSH, push.toString());
|
|
32
|
+
if (action.getTopics() != null && action.getTopics().length>0){
|
|
33
|
+
indigitallIntent.putExtra(StatisticService.EXTRA_ACTION_TOPICS, action.topicsToString());
|
|
34
|
+
}
|
|
35
|
+
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
|
|
36
|
+
stackBuilder.addNextIntentWithParentStack(indigitallIntent);
|
|
37
|
+
if (action.isDestroy()){
|
|
38
|
+
return stackBuilder.getPendingIntent((push.getId() * 10) + clickedButton,
|
|
39
|
+
IntentUtils.getPendingIntentFlags(PendingIntent.FLAG_UPDATE_CURRENT));
|
|
40
|
+
}else{
|
|
41
|
+
return PendingIntent.getActivity(context, 0, new Intent(), IntentUtils.getPendingIntentFlags(0));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}catch(Exception e){
|
|
45
|
+
e.printStackTrace();
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
package com.indigitall.capacitor.utils;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.content.SharedPreferences;
|
|
5
|
+
|
|
6
|
+
public class CpPreferenceUtils {
|
|
7
|
+
|
|
8
|
+
private static final String SHARED_PREFERENCES_NAME = "IndigitallCordovaPreferences";
|
|
9
|
+
private static final String SHARED_PREFERENCES_URL_KEY = SHARED_PREFERENCES_NAME + ".getPushKey";
|
|
10
|
+
private static final String SHARED_PREFERENCES_NATIVE_URL_KEY = SHARED_PREFERENCES_NAME + ".getNativePushKey";
|
|
11
|
+
private static final String SHARED_PREFERENCES_PUSH_STRING = SHARED_PREFERENCES_NAME + ".getPushString";
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
private static boolean savePreferences(Context context, Object param, String key) {
|
|
15
|
+
SharedPreferences pref = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
|
16
|
+
SharedPreferences.Editor editor = null;
|
|
17
|
+
if (pref != null) editor = pref.edit();
|
|
18
|
+
if (editor != null) {
|
|
19
|
+
if (param instanceof String) {
|
|
20
|
+
return editor.putString (key,(String)param).commit();
|
|
21
|
+
} else if (param instanceof Boolean) {
|
|
22
|
+
return editor.putBoolean(key,(Boolean)param).commit();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private static String getSharedPreferencesString(Context context, String key) {
|
|
30
|
+
if (context != null){
|
|
31
|
+
SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
|
32
|
+
if (prefs != null) return prefs.getString(key, null);
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private static Boolean getSharedPreferencesBoolean(Context context, String key) {
|
|
38
|
+
if (context != null){
|
|
39
|
+
SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
|
40
|
+
if (prefs != null) return prefs.getBoolean(key, false);
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public static String getPushUrl(Context context) {
|
|
46
|
+
return getSharedPreferencesString(context, SHARED_PREFERENCES_URL_KEY);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public static void setPushUrl(Context context, String value) {
|
|
50
|
+
savePreferences(context, value, SHARED_PREFERENCES_URL_KEY);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public static String getNativePushUrl(Context context) {
|
|
54
|
+
return getSharedPreferencesString(context, SHARED_PREFERENCES_NATIVE_URL_KEY);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public static void setNativePushUrl(Context context, String value) {
|
|
58
|
+
savePreferences(context, value, SHARED_PREFERENCES_NATIVE_URL_KEY);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public static String getPushString(Context context) {
|
|
62
|
+
return getSharedPreferencesString(context, SHARED_PREFERENCES_PUSH_STRING);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public static void setPushString(Context context, String value) {
|
|
66
|
+
savePreferences(context, value, SHARED_PREFERENCES_PUSH_STRING);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
package/dist/docs.json
CHANGED
|
@@ -119,6 +119,42 @@
|
|
|
119
119
|
"complexTypes": [],
|
|
120
120
|
"slug": "getpush"
|
|
121
121
|
},
|
|
122
|
+
{
|
|
123
|
+
"name": "onIndigitallGetPush",
|
|
124
|
+
"signature": "() => Promise<any>",
|
|
125
|
+
"parameters": [],
|
|
126
|
+
"returns": "Promise<any>",
|
|
127
|
+
"tags": [],
|
|
128
|
+
"docs": "",
|
|
129
|
+
"complexTypes": [],
|
|
130
|
+
"slug": "onindigitallgetpush"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "clearViewUrl",
|
|
134
|
+
"signature": "() => void",
|
|
135
|
+
"parameters": [],
|
|
136
|
+
"returns": "void",
|
|
137
|
+
"tags": [],
|
|
138
|
+
"docs": "",
|
|
139
|
+
"complexTypes": [],
|
|
140
|
+
"slug": "clearviewurl"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "setDefaultViewUrl",
|
|
144
|
+
"signature": "(params: { defaultView: string; }) => unknown",
|
|
145
|
+
"parameters": [
|
|
146
|
+
{
|
|
147
|
+
"name": "params",
|
|
148
|
+
"docs": "",
|
|
149
|
+
"type": "{ defaultView: string; }"
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"returns": "unknown",
|
|
153
|
+
"tags": [],
|
|
154
|
+
"docs": "",
|
|
155
|
+
"complexTypes": [],
|
|
156
|
+
"slug": "setdefaultviewurl"
|
|
157
|
+
},
|
|
122
158
|
{
|
|
123
159
|
"name": "onMessageReceived",
|
|
124
160
|
"signature": "(onSuccess: OnMessageReceivedSuccessType) => OnMessageReceivedSuccessType",
|
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: '2.0.
|
|
8
|
+
productVersion: '2.0.2',
|
|
9
9
|
productName: 'capacitor',
|
|
10
10
|
});
|
|
11
11
|
IndigitallCp.initialize({ config }).then(onInit => {
|
|
@@ -87,6 +87,20 @@ const Indigitall = {
|
|
|
87
87
|
onError(error);
|
|
88
88
|
});
|
|
89
89
|
},
|
|
90
|
+
onIndigitallGetPush: (onSuccess, onError) => {
|
|
91
|
+
IndigitallCp.onIndigitallGetPush().then(response => {
|
|
92
|
+
onSuccess(response.push);
|
|
93
|
+
}).catch(error => {
|
|
94
|
+
if (onError)
|
|
95
|
+
onError(error);
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
clearViewUrl: () => {
|
|
99
|
+
IndigitallCp.clearViewUrl();
|
|
100
|
+
},
|
|
101
|
+
setDefaultViewUrl: (defaultView) => {
|
|
102
|
+
IndigitallCp.setDefaultViewUrl({ defaultView });
|
|
103
|
+
},
|
|
90
104
|
// onMessageReceived: (
|
|
91
105
|
// onSuccess: OnMessageReceivedSuccessType,
|
|
92
106
|
// onError?: OnErrorCallbackType) => {
|
package/dist/esm/Push.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,MAAM,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,oB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,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: '2.0.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 }"]}
|
|
1
|
+
{"version":3,"file":"Push.js","sourceRoot":"","sources":["../../src/Push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,i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AAC,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: '2.0.2',\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 onIndigitallGetPush: (\n onSuccess: OnPushSuccessType,\n onError?: OnErrorCallbackType) => {\n IndigitallCp.onIndigitallGetPush().then(response => {\n onSuccess(response.push);\n }).catch(error => {\n if (onError)\n onError(error);\n });\n },\n clearViewUrl: () => {\n IndigitallCp.clearViewUrl();\n }, \n setDefaultViewUrl: (defaultView: string) => {\n IndigitallCp.setDefaultViewUrl({defaultView});\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 }\n\n"]}
|
|
@@ -18,6 +18,11 @@ export interface IndigitallCpPlugin {
|
|
|
18
18
|
customEvent: any;
|
|
19
19
|
}): Promise<void>;
|
|
20
20
|
getPush(): Promise<any>;
|
|
21
|
+
onIndigitallGetPush(): Promise<any>;
|
|
22
|
+
clearViewUrl(): void;
|
|
23
|
+
setDefaultViewUrl(params: {
|
|
24
|
+
defaultView: string;
|
|
25
|
+
}): unknown;
|
|
21
26
|
onMessageReceived(onSuccess: OnMessageReceivedSuccessType): OnMessageReceivedSuccessType;
|
|
22
27
|
getToken(): Promise<any>;
|
|
23
28
|
isIndigitallPushNotification(params: {
|
|
@@ -38,6 +43,9 @@ export interface IndigitallPlugin {
|
|
|
38
43
|
topicsUnsubscribe: (topics: string[], onSuccess?: OnTopicSuccessType, onError?: OnErrorCallbackType) => void;
|
|
39
44
|
sendCustomEvent: (customEvent: EventParams, onSuccess?: () => void, onError?: OnErrorCallbackType) => void;
|
|
40
45
|
getPush: (onSuccess: OnPushSuccessType, onError?: OnErrorCallbackType) => void;
|
|
46
|
+
onIndigitallGetPush: (onSuccess: OnPushSuccessType, onError?: OnErrorCallbackType) => void;
|
|
47
|
+
clearViewUrl: () => void;
|
|
48
|
+
setDefaultViewUrl: (defaultView: string) => void;
|
|
41
49
|
onMessageReceived: (onSuccess: OnMessageReceivedSuccessType) => void;
|
|
42
50
|
getToken: (onSuccess: OnTokenSuccessType, onError?: OnErrorCallbackType) => void;
|
|
43
51
|
isIndigitallPushNotification: (notification: any, onSuccess: () => void, onError?: OnErrorCallbackType) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pushDefinitions.js","sourceRoot":"","sources":["../../../src/definitions/pushDefinitions.ts"],"names":[],"mappings":"","sourcesContent":["\nimport type {\n OnIndigitallInitializedType,\n OnDeviceSuccessType,\n OnPushSuccessType,\n OnTopicSuccessType,\n OnErrorCallbackType,\n //OnInAppCallbackType,\n OnMessageReceivedSuccessType,\n OnTokenSuccessType,\n } from '../callbacks/callbacksType';\n import type { \n InitParams,\n EventParams } from '../params/pushParams';\n\n \nexport interface IndigitallCpPlugin {\n initialize(params: { config: any }): Promise<any>; \n deviceGet(): Promise<any>;\n deviceEnable(): Promise<any>;\n deviceDisable(): Promise<any>;\n topicsList(): Promise<any>;\n topicsSubscribe(params: { topics: string[] }): Promise<any>;\n topicsUnsubscribe(params: { topics: string[] }): Promise<any>;\n sendCustomEvent(params: { customEvent: any}): Promise<void>;\n getPush(): Promise<any>;\n
|
|
1
|
+
{"version":3,"file":"pushDefinitions.js","sourceRoot":"","sources":["../../../src/definitions/pushDefinitions.ts"],"names":[],"mappings":"","sourcesContent":["\nimport type {\n OnIndigitallInitializedType,\n OnDeviceSuccessType,\n OnPushSuccessType,\n OnTopicSuccessType,\n OnErrorCallbackType,\n //OnInAppCallbackType,\n OnMessageReceivedSuccessType,\n OnTokenSuccessType,\n } from '../callbacks/callbacksType';\n import type { \n InitParams,\n EventParams } from '../params/pushParams';\n\n \nexport interface IndigitallCpPlugin { \n initialize(params: { config: any }): Promise<any>; \n deviceGet(): Promise<any>;\n deviceEnable(): Promise<any>;\n deviceDisable(): Promise<any>;\n topicsList(): Promise<any>;\n topicsSubscribe(params: { topics: string[] }): Promise<any>;\n topicsUnsubscribe(params: { topics: string[] }): Promise<any>;\n sendCustomEvent(params: { customEvent: any}): Promise<void>;\n getPush(): Promise<any>;\n onIndigitallGetPush(): Promise<any>;\n clearViewUrl(): void;\n setDefaultViewUrl(params: { defaultView: string}): unknown;\n onMessageReceived(onSuccess: OnMessageReceivedSuccessType): OnMessageReceivedSuccessType;\n getToken(): Promise<any>;\n isIndigitallPushNotification(params: {notification: any}): Promise<any>;\n logIn(param: { externalId: string }): Promise<any>;\n logOut(): Promise<any>;\n }\n \n export interface IndigitallPlugin {\n init: (\n config: InitParams,\n onIndigitallInitializedType?: OnIndigitallInitializedType,\n onError?: OnErrorCallbackType\n ) => void;\n deviceGet: (\n onSuccess: OnDeviceSuccessType,\n onError?: OnErrorCallbackType\n ) => void;\n deviceEnable: (\n onSuccess?: OnDeviceSuccessType,\n onError?: OnErrorCallbackType\n ) => void;\n deviceDisable: (\n onSuccess?: OnDeviceSuccessType,\n onError?: OnErrorCallbackType\n ) => void;\n topicsList: (\n onSuccess?: OnTopicSuccessType,\n onError?: OnErrorCallbackType\n ) => void;\n topicsSubscribe: (\n topics: string[], \n onSuccess?: OnTopicSuccessType,\n onError?: OnErrorCallbackType\n ) => void;\n topicsUnsubscribe: (\n topics: string[], \n onSuccess?: OnTopicSuccessType,\n onError?: OnErrorCallbackType\n ) => void;\n sendCustomEvent: (\n customEvent: EventParams,\n onSuccess?: () => void,\n onError?: OnErrorCallbackType\n ) => void;\n getPush: (\n onSuccess: OnPushSuccessType,\n onError?: OnErrorCallbackType\n ) => void;\n onIndigitallGetPush: (\n onSuccess: OnPushSuccessType,\n onError?: OnErrorCallbackType\n ) => void;\n clearViewUrl: () => void;\n setDefaultViewUrl: (\n defaultView: string,\n ) => void;\n onMessageReceived: (\n onSuccess: OnMessageReceivedSuccessType\n ) => void;\n getToken: (\n onSuccess: OnTokenSuccessType,\n onError?: OnErrorCallbackType\n ) => void;\n isIndigitallPushNotification: (\n notification: any,\n onSuccess: () => void,\n onError?: OnErrorCallbackType\n ) => void;\n\n logIn: (\n externalId: string,\n onSuccess?: OnDeviceSuccessType,\n onError?: OnErrorCallbackType\n ) => void;\n logOut: (\n onSuccess?: OnDeviceSuccessType,\n onError?: OnErrorCallbackType\n ) => void;\n }"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -10,7 +10,7 @@ const IndigitallCp = core.registerPlugin('IndigitallCp', {
|
|
|
10
10
|
const Indigitall = {
|
|
11
11
|
init: (config, onIndigitallInitializedType, onError) => {
|
|
12
12
|
Object.assign(config, {
|
|
13
|
-
productVersion: '2.0.
|
|
13
|
+
productVersion: '2.0.2',
|
|
14
14
|
productName: 'capacitor',
|
|
15
15
|
});
|
|
16
16
|
IndigitallCp.initialize({ config }).then(onInit => {
|
|
@@ -92,6 +92,20 @@ const Indigitall = {
|
|
|
92
92
|
onError(error);
|
|
93
93
|
});
|
|
94
94
|
},
|
|
95
|
+
onIndigitallGetPush: (onSuccess, onError) => {
|
|
96
|
+
IndigitallCp.onIndigitallGetPush().then(response => {
|
|
97
|
+
onSuccess(response.push);
|
|
98
|
+
}).catch(error => {
|
|
99
|
+
if (onError)
|
|
100
|
+
onError(error);
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
clearViewUrl: () => {
|
|
104
|
+
IndigitallCp.clearViewUrl();
|
|
105
|
+
},
|
|
106
|
+
setDefaultViewUrl: (defaultView) => {
|
|
107
|
+
IndigitallCp.setDefaultViewUrl({ defaultView });
|
|
108
|
+
},
|
|
95
109
|
// onMessageReceived: (
|
|
96
110
|
// onSuccess: OnMessageReceivedSuccessType,
|
|
97
111
|
// onError?: OnErrorCallbackType) => {
|