@selligent-marketing-cloud/selligent-react-native 2.5.0 → 2.6.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 +215 -205
- package/RNSelligent.podspec +2 -2
- package/android/build.gradle +7 -7
- package/android/libs/sdk-release.aar +0 -0
- package/android/src/main/java/com/selligent/RNSelligent.java +0 -1
- package/constants.d.ts +6 -0
- package/constants.js +14 -2
- package/index.d.ts +3 -0
- package/index.ios.js +12 -0
- package/ios/ClientSettings.h +1 -0
- package/ios/ClientSettings.m +2 -0
- package/ios/EnumMapper.h +4 -0
- package/ios/EnumMapper.m +10 -0
- package/ios/RNSelligent.m +7 -1
- package/ios/RemoteMessageDisplayType.h +5 -0
- package/ios/SMManagerSetting+ClientSettings.m +10 -4
- package/ios/include/SMBaseMessage.h +8 -12
- package/ios/include/SMBlock.h +2 -2
- package/ios/include/SMClearCache.h +0 -2
- package/ios/include/SMContentAlignment.h +1 -2
- package/ios/include/SMDeviceInfos.h +9 -7
- package/ios/include/SMDisplayMode.h +1 -2
- package/ios/include/SMEvent.h +20 -16
- package/ios/include/SMEventUser.h +0 -1
- package/ios/include/SMEventUserLogin.h +11 -16
- package/ios/include/SMEventUserLogout.h +12 -16
- package/ios/include/SMEventUserRegistration.h +12 -17
- package/ios/include/SMEventUserUnregistration.h +12 -16
- package/ios/include/SMFailure.h +1 -6
- package/ios/include/SMHelper.h +9 -5
- package/ios/include/SMInAppContentHTMLViewController.h +11 -9
- package/ios/include/SMInAppContentImageViewController.h +6 -5
- package/ios/include/SMInAppContentMessage.h +12 -12
- package/ios/include/SMInAppContentStyleOptions.h +91 -79
- package/ios/include/SMInAppContentType.h +2 -3
- package/ios/include/SMInAppContentURLViewController.h +10 -9
- package/ios/include/SMInAppContentViewController.h +3 -5
- package/ios/include/SMInAppMessage.h +22 -14
- package/ios/include/SMInAppMessageType.h +1 -5
- package/ios/include/SMInAppRefreshType.h +1 -1
- package/ios/include/SMLink.h +7 -11
- package/ios/include/SMLog.h +1 -1
- package/ios/include/SMManager+DataTransaction.h +6 -13
- package/ios/include/SMManager+InAppContent.h +20 -23
- package/ios/include/SMManager+InAppMessage.h +22 -21
- package/ios/include/SMManager+Location.h +5 -8
- package/ios/include/SMManager+Log.h +3 -14
- package/ios/include/SMManager+RemoteNotification.h +38 -34
- package/ios/include/SMManager+SMEvent.h +10 -10
- package/ios/include/SMManager+SMLink.h +44 -0
- package/ios/include/SMManager+SilentPush.h +5 -22
- package/ios/include/SMManager+StyleOptions.h +5 -8
- package/ios/include/SMManager+UserNotification.h +44 -32
- package/ios/include/SMManager+ViewController.h +45 -0
- package/ios/include/SMManager.h +11 -26
- package/ios/include/SMManagerInAppMessageDelegate.h +4 -5
- package/ios/include/SMManagerSetting+Location.h +27 -0
- package/ios/include/SMManagerSetting.h +53 -35
- package/ios/include/SMManagerSettingIAC.h +6 -17
- package/ios/include/SMManagerSettingIAM.h +7 -16
- package/ios/include/SMManagerUniversalLinksDelegate.h +23 -0
- package/ios/include/SMMessage.h +1 -3
- package/ios/include/SMNSNotification.h +2 -2
- package/ios/include/SMNotificationAnnotationData.h +4 -8
- package/ios/include/SMNotificationButtonData.h +1 -6
- package/ios/include/SMNotificationButtonType.h +1 -2
- package/ios/include/SMNotificationMessage.h +31 -0
- package/ios/include/SMRemoteMessageDisplayType.h +32 -0
- package/ios/include/SMSuccess.h +1 -4
- package/ios/{libSelligentMobile2.6.1.a → libSelligentMobile2.7.a} +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,22 +4,22 @@ This module provides an API for the usage of the Selligent SDK in React Native.
|
|
|
4
4
|
|
|
5
5
|
## Supported platforms
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
- Android
|
|
8
|
+
- iOS
|
|
9
9
|
|
|
10
10
|
> _**Important:** Since version 2.4.0 of this module we require your app to use the Android Gradle Plugin version 4.1.0 or higher in order to build on Android. This is the default Android Gradle Plugin version since React Native version 0.64.0 but can be manually increased in older versions of React Native._
|
|
11
11
|
|
|
12
12
|
## ToC
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
- [Installation](#installation)
|
|
15
|
+
- [Android Specific Installation](#android-specific-installation)
|
|
16
|
+
- [iOS Specific Installation](#ios-specific-installation)
|
|
17
|
+
- [Using the API](#using-the-api)
|
|
18
|
+
- [API Reference](#api-reference)
|
|
19
|
+
- [Methods](#methods)
|
|
20
|
+
- [Android Only/Specific Methods](#android-onlyspecific-methods)
|
|
21
|
+
- [iOS Only/Specific Methods](#ios-onlyspecific-methods)
|
|
22
|
+
- [Constants](#constants)
|
|
23
23
|
|
|
24
24
|
## Installation
|
|
25
25
|
|
|
@@ -33,10 +33,10 @@ This module provides an API for the usage of the Selligent SDK in React Native.
|
|
|
33
33
|
|
|
34
34
|
```json
|
|
35
35
|
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
"url": "someMobilePushUrl",
|
|
37
|
+
"clientId": "someClientId",
|
|
38
|
+
"privateKey": "somePrivateKey",
|
|
39
|
+
"fullyQualifiedNotificationActivityClassName": "com.some.project.MainActivity"
|
|
40
40
|
}
|
|
41
41
|
```
|
|
42
42
|
|
|
@@ -44,27 +44,27 @@ This module provides an API for the usage of the Selligent SDK in React Native.
|
|
|
44
44
|
|
|
45
45
|
**Detailed overview:**
|
|
46
46
|
|
|
47
|
-
| Property | Type
|
|
48
|
-
| ------------------------------------------- |
|
|
49
|
-
| url | string
|
|
50
|
-
| clientId | string
|
|
51
|
-
| privateKey | string
|
|
52
|
-
| clearCacheIntervalValue | enum [Selligent.ClearCacheIntervalValue](#selligentclearcacheintervalvalue)
|
|
53
|
-
| configureLocationServices | boolean
|
|
54
|
-
| inAppMessageRefreshType | enum [Selligent.InAppMessageRefreshType](#selligentinappmessagerefreshtype)
|
|
55
|
-
| addInAppMessageFromPushToInAppMessageList | boolean
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
| notificationIconColor | string
|
|
66
|
-
|
|
67
|
-
|
|
47
|
+
| Property | Type | Required | Platform |
|
|
48
|
+
| ------------------------------------------- | ------------------------------------------------------------------------------- | -------- | ------------ |
|
|
49
|
+
| url | string | Yes | Both |
|
|
50
|
+
| clientId | string | Yes | Both |
|
|
51
|
+
| privateKey | string | Yes | Both |
|
|
52
|
+
| clearCacheIntervalValue | enum [Selligent.ClearCacheIntervalValue](#selligentclearcacheintervalvalue) | No | Both |
|
|
53
|
+
| configureLocationServices | boolean | No | Both |
|
|
54
|
+
| inAppMessageRefreshType | enum [Selligent.InAppMessageRefreshType](#selligentinappmessagerefreshtype) | No | Both |
|
|
55
|
+
| addInAppMessageFromPushToInAppMessageList | boolean | No | Both |
|
|
56
|
+
| remoteMessageDisplayType | enum [Selligent.RemoteMessagesDisplayType](#selligentremotemessagesdisplaytype) | No | Both |
|
|
57
|
+
| appGroupId | string | No | iOS Only |
|
|
58
|
+
| shouldClearBadge | boolean | No | iOS Only |
|
|
59
|
+
| shouldDisplayRemoteNotification | boolean | No | iOS Only |
|
|
60
|
+
| shouldPerformBackgroundFetch | boolean | No | iOS Only |
|
|
61
|
+
| doNotListenToThePush | boolean | No | Android Only |
|
|
62
|
+
| doNotFetchTheToken | boolean | No | Android Only |
|
|
63
|
+
| loadCacheAsynchronously | boolean | No | Android Only |
|
|
64
|
+
| fullyQualifiedNotificationActivityClassName | string | No | Android Only |
|
|
65
|
+
| notificationIconColor | string | No | Android Only |
|
|
66
|
+
|
|
67
|
+
|
|
68
68
|
|
|
69
69
|
### Android Specific Installation
|
|
70
70
|
|
|
@@ -135,7 +135,7 @@ This module provides an API for the usage of the Selligent SDK in React Native.
|
|
|
135
135
|
...
|
|
136
136
|
@Override
|
|
137
137
|
protected List<ReactPackage> getPackages() {
|
|
138
|
-
|
|
138
|
+
|
|
139
139
|
List<ReactPackage> packages = new PackageList(this).getPackages();
|
|
140
140
|
// Add the following:
|
|
141
141
|
packages.add(new RNSelligentPackage());
|
|
@@ -225,7 +225,6 @@ This module provides an API for the usage of the Selligent SDK in React Native.
|
|
|
225
225
|
|
|
226
226
|
</details>
|
|
227
227
|
|
|
228
|
-
|
|
229
228
|
#### Change default push notification icons
|
|
230
229
|
|
|
231
230
|
Add the following properties to the `selligent.json` file:
|
|
@@ -237,7 +236,6 @@ Add the following properties to the `selligent.json` file:
|
|
|
237
236
|
|
|
238
237
|
> _Note: only parse the name of the icon, without the path. The icon should reside in the res/drawable folder of the Android project, as explained in [Android's official guide](https://developer.android.com/guide/topics/resources/drawable-resource#BitmapFile)._
|
|
239
238
|
|
|
240
|
-
|
|
241
239
|
### iOS Specific installation
|
|
242
240
|
|
|
243
241
|
<details>
|
|
@@ -257,17 +255,9 @@ Add the following properties to the `selligent.json` file:
|
|
|
257
255
|
|
|
258
256
|
4. Add Selligent to `Header Search Paths` in `Build Settings` of your target:
|
|
259
257
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
4. Add Selligent to `Header Search Paths` in `Build Settings` of your target:
|
|
267
|
-
|
|
268
|
-
```
|
|
269
|
-
$(SRCROOT)/../node_modules/@selligent-marketing-cloud/selligent-react-native/ios/
|
|
270
|
-
```
|
|
258
|
+
```
|
|
259
|
+
$(SRCROOT)/../node_modules/@selligent-marketing-cloud/selligent-react-native/ios/
|
|
260
|
+
```
|
|
271
261
|
|
|
272
262
|
5. Create a `Podfile` (if there isn't one already) in the `/ios` folder and add the following:
|
|
273
263
|
|
|
@@ -307,13 +297,11 @@ Add the following properties to the `selligent.json` file:
|
|
|
307
297
|
|
|
308
298
|
</details>
|
|
309
299
|
|
|
310
|
-
|
|
311
|
-
|
|
312
300
|
#### Push notifications
|
|
313
301
|
|
|
314
302
|
1. For push notifications you need to delegate some of the `AppDelegate.m` methods to the SDK:
|
|
315
303
|
|
|
316
|
-
|
|
304
|
+
```objective-c
|
|
317
305
|
#import "AppDelegate.h"
|
|
318
306
|
#import <React/RCTBundleURLProvider.h>
|
|
319
307
|
#import <React/RCTRootView.h>
|
|
@@ -374,9 +362,9 @@ Add the following properties to the `selligent.json` file:
|
|
|
374
362
|
#endif
|
|
375
363
|
|
|
376
364
|
@end
|
|
377
|
-
|
|
365
|
+
```
|
|
378
366
|
|
|
379
|
-
2. Follow section
|
|
367
|
+
2. Follow section [**Create an APNS Key**](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/master/Documentation#apns_key), of the native documentation.
|
|
380
368
|
|
|
381
369
|
3. If you want rich push notifications, follow section 6.9 **Notification Extensions** as well.
|
|
382
370
|
Make sure you add your `appGroupId` to the `selligent.json`.
|
|
@@ -384,12 +372,14 @@ Add the following properties to the `selligent.json` file:
|
|
|
384
372
|
|
|
385
373
|
#### Geolocation
|
|
386
374
|
|
|
387
|
-
For geolocation services, follow section
|
|
375
|
+
For geolocation services, follow section [**Geolocation**](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/master/Documentation#geolocation), of the native documentation. You also need to configure several permissions described [**here**](https://github.com/SelligentMarketingCloud/MobileSDK-iOS/tree/master/Documentation#permission-for-geolocation).
|
|
388
376
|
|
|
389
377
|
#### Deeplinking
|
|
378
|
+
|
|
390
379
|
You can catch the deeplinks 2 ways:
|
|
391
380
|
|
|
392
381
|
1. Native in AppDelegate.m, add the following (example code that logs the URL)
|
|
382
|
+
|
|
393
383
|
```
|
|
394
384
|
-(BOOL)application:(UIApplication*) application openURL:(NSURL*) url sourceApplication:(NSString*) sourceApplication annotation:(id) annotation
|
|
395
385
|
{
|
|
@@ -407,13 +397,13 @@ You can catch the deeplinks 2 ways:
|
|
|
407
397
|
1. Add the `Button` import statement:
|
|
408
398
|
|
|
409
399
|
```javascript
|
|
410
|
-
import {Platform, StyleSheet, Text, View, Button} from
|
|
400
|
+
import { Platform, StyleSheet, Text, View, Button } from "react-native"; // Add Button import
|
|
411
401
|
```
|
|
412
402
|
|
|
413
403
|
2. Add the `Selligent` import statement:
|
|
414
404
|
|
|
415
405
|
```javascript
|
|
416
|
-
import Selligent from
|
|
406
|
+
import Selligent from "@selligent-marketing-cloud/selligent-react-native"; // Add Selligent import
|
|
417
407
|
```
|
|
418
408
|
|
|
419
409
|
3. Add a function to call the `Selligent.getVersionLib` function:
|
|
@@ -451,139 +441,142 @@ You can catch the deeplinks 2 ways:
|
|
|
451
441
|
5. Your `App.js` file should look something like this:
|
|
452
442
|
|
|
453
443
|
```javascript
|
|
454
|
-
import React, {Component} from
|
|
455
|
-
import {Platform, StyleSheet, Text, View, Button} from
|
|
456
|
-
import Selligent from
|
|
444
|
+
import React, { Component } from "react";
|
|
445
|
+
import { Platform, StyleSheet, Text, View, Button } from "react-native"; // Add Button import
|
|
446
|
+
import Selligent from "@selligent-marketing-cloud/selligent-react-native"; // Add Selligent import
|
|
457
447
|
|
|
458
448
|
const instructions = Platform.select({
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
449
|
+
ios: "Press Cmd+R to reload,\n" + "Cmd+D or shake for dev menu",
|
|
450
|
+
android:
|
|
451
|
+
"Double tap R on your keyboard to reload,\n" +
|
|
452
|
+
"Shake or press menu button for dev menu",
|
|
463
453
|
});
|
|
464
454
|
|
|
465
455
|
type Props = {};
|
|
466
456
|
export default class App extends Component<Props> {
|
|
457
|
+
// Add example function
|
|
458
|
+
_getVersionLib() {
|
|
459
|
+
Selligent.getVersionLib((versionLib) => {
|
|
460
|
+
alert(versionLib);
|
|
461
|
+
});
|
|
462
|
+
}
|
|
467
463
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
// Add button
|
|
482
|
-
<Button
|
|
483
|
-
onPress={this._getVersionLib}
|
|
484
|
-
title='getVersionLib'
|
|
485
|
-
/>
|
|
486
|
-
</View>
|
|
487
|
-
);
|
|
488
|
-
}
|
|
464
|
+
render() {
|
|
465
|
+
return (
|
|
466
|
+
<View style={styles.container}>
|
|
467
|
+
<Text style={styles.welcome}>Welcome to React Native!</Text>
|
|
468
|
+
<Text style={styles.instructions}>
|
|
469
|
+
To get started, edit App.js
|
|
470
|
+
</Text>
|
|
471
|
+
<Text style={styles.instructions}>{instructions}</Text>
|
|
472
|
+
// Add button
|
|
473
|
+
<Button onPress={this._getVersionLib} title="getVersionLib" />
|
|
474
|
+
</View>
|
|
475
|
+
);
|
|
476
|
+
}
|
|
489
477
|
}
|
|
490
478
|
|
|
491
479
|
const styles = StyleSheet.create({
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
480
|
+
container: {
|
|
481
|
+
flex: 1,
|
|
482
|
+
justifyContent: "center",
|
|
483
|
+
alignItems: "center",
|
|
484
|
+
backgroundColor: "#F5FCFF",
|
|
485
|
+
},
|
|
486
|
+
welcome: {
|
|
487
|
+
fontSize: 20,
|
|
488
|
+
textAlign: "center",
|
|
489
|
+
margin: 10,
|
|
490
|
+
},
|
|
491
|
+
instructions: {
|
|
492
|
+
textAlign: "center",
|
|
493
|
+
color: "#333333",
|
|
494
|
+
marginBottom: 5,
|
|
495
|
+
},
|
|
508
496
|
});
|
|
509
497
|
```
|
|
510
498
|
|
|
511
499
|
## API Reference
|
|
512
500
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
501
|
+
- [Methods](#methods)
|
|
502
|
+
|
|
503
|
+
- [Selligent.getVersionLib(successCallback)](#selligentgetversionlibsuccesscallback)
|
|
504
|
+
- [getVersionLib example](#getversionlib-example)
|
|
505
|
+
- [Selligent.enableGeolocation(successCallback, errorCallback, enabled)](#selligentenablegeolocationsuccesscallback-errorcallback-enabled)
|
|
506
|
+
- [enableGeolocation example](#enablegeolocation-example)
|
|
507
|
+
- [Selligent.isGeolocationEnabled(successCallback)](#selligentisgeolocationenabledsuccesscallback)
|
|
508
|
+
- [isGeolocationEnabled example](#isgeolocationenabled-example)
|
|
509
|
+
- [Selligent.getDeviceId(successCallback)](#selligentgetdeviceidsuccesscallback)
|
|
510
|
+
- [getDeviceId example](#getdeviceid-example)
|
|
511
|
+
- [Selligent.enableNotifications(successCallback, errorCallback, enabled)](#selligentenablenotificationssuccesscallback-errorcallback-enabled)
|
|
512
|
+
- [enableNotifications example](#enablenotifications-example)
|
|
513
|
+
- [Selligent.displayLastReceivedRemotePushNotification(successCallback)](#selligentdisplaylastreceivedremotepushnotificationsuccesscallback)
|
|
514
|
+
- [displayLastReceivedRemotePushNotification example](#displaylastreceivedremotepushnotification-example)
|
|
515
|
+
- [Selligent.getLastRemotePushNotification(successCallback)](#selligentgetlastremotepushnotificationsuccesscallback)
|
|
516
|
+
- [getLastRemotePushNotification Example](#getlastremotepushnotification-example)
|
|
517
|
+
- [Selligent.enableInAppMessages(successCallback, errorCallback, enabled)](#selligentenableinappmessagessuccesscallback-errorcallback-enabled)
|
|
518
|
+
- [enableInAppMessages example](#enableinappmessages-example)
|
|
519
|
+
- [Selligent.getInAppMessages(successCallback)](#selligentgetinappmessagessuccesscallback)
|
|
520
|
+
- [getInAppMessages example](#getinappmessages-example)
|
|
521
|
+
- [Selligent.setInAppMessageAsSeen(successCallback, errorCallback, messageId)](#selligentsetinappmessageasseensuccesscallback-errorcallback-messageid)
|
|
522
|
+
- [setInAppMessageAsSeen example](#setinappmessageasseen-example)
|
|
523
|
+
- [Selligent.executeButtonAction(successCallback, errorCallback, buttonId, messageId)](#selligentexecutebuttonactionsuccesscallback-errorcallback-buttonid-messageid)
|
|
524
|
+
- [executeButtonAction example](#executeButtonAction-example)
|
|
525
|
+
- [Selligent.sendEvent(successCallback, errorCallback, event)](#selligentsendeventsuccesscallback-errorcallback-event)
|
|
526
|
+
- [sendEvent example](#sendevent-example)
|
|
527
|
+
- [Selligent.subscribeToEvents(successCallback, errorCallback, eventCallback)](#selligentsubscribetoeventssuccesscallback-errorcallback-eventcallback)
|
|
528
|
+
- [subscribeToEvents example](#subscribetoevents-example)
|
|
529
|
+
|
|
530
|
+
- [Android Only/Specific Methods](#android-onlyspecific-methods)
|
|
531
|
+
|
|
532
|
+
- [Selligent.subscribeToEvent(eventCallback, eventName)](#selligentsubscribetoeventeventcallback-eventname)
|
|
533
|
+
- [subscribeToEvent example](#subscribetoevent-example)
|
|
534
|
+
- [Selligent.areInAppMessagesEnabled(successCallback)](#selligentareinappmessagesenabledsuccesscallback)
|
|
535
|
+
- [areInAppMessagesEnabled example](#areinappmessagesenabled-example)
|
|
536
|
+
- [Selligent.enableAndroidLogging(successCallback, errorCallback, enabled)](#selligentenableandroidloggingsuccesscallback-errorcallback-enabled)
|
|
537
|
+
- [enableAndroidLogging example](#enableandroidlogging-example)
|
|
538
|
+
- [Selligent.displayMessage(successCallback, errorCallback, messageId)](#selligentdisplaymessagesuccesscallback-errorcallback-messageid)
|
|
539
|
+
- [displayMessage example](#displaymessage-example)
|
|
540
|
+
- [Selligent.areNotificationsEnabled(successCallback)](#selligentarenotificationsenabledsuccesscallback)
|
|
541
|
+
- [areNotificationsEnabled example](#arenotificationsenabled-example)
|
|
542
|
+
- [Selligent.setNotificationSmallIcon(successCallback, errorCallback, iconName)](#selligentsetnotificationsmalliconsuccesscallback-errorcallback-iconname)
|
|
543
|
+
- [setNotificationSmallIcon example](#setnotificationsmallicon-example)
|
|
544
|
+
- [Selligent.setNotificationLargeIcon(successCallback, errorCallback, iconName)](#selligentsetnotificationlargeiconsuccesscallback-errorcallback-iconname)
|
|
545
|
+
- [setNotificationLargeIcon example](#setnotificationlargeicon-example)
|
|
546
|
+
- [Selligent.setNotificationIconColor(successCallback, errorCallback, color)](#selligentsetnotificationiconcolorsuccesscallback-errorcallback-color)
|
|
547
|
+
- [setNotificationIconColor example](#setnotificationiconcolor-example)
|
|
548
|
+
- [Selligent.getGCMToken(successCallback)](#selligentgetgcmtokensuccesscallback)
|
|
549
|
+
- [getGCMToken Example](#getgcmtoken-example)
|
|
550
|
+
- [Selligent.getRemoteMessagesDisplayType(successCallback, errorCallback)](#selligentgetremotemessagesdisplaytypesuccesscallback-errorcallback)
|
|
551
|
+
- [getRemoteMessagesDisplayType Example](#getremotemessagesdisplaytype-example)
|
|
552
|
+
- [Selligent.setFirebaseToken(successCallback, errorCallback, token)](#selligentsetfirebasetokensuccesscallback--errorcallback--token)
|
|
553
|
+
- [setFirebaseToken Example](#setFirebaseToken-example)
|
|
554
|
+
|
|
555
|
+
- [iOS Only/Specific Methods](#ios-onlyspecific-methods)
|
|
556
|
+
|
|
557
|
+
- [Selligent.enableiOSLogging(successCallback, errorCallback, logLevels)](#selligentenableiosloggingsuccesscallback-errorcallback-loglevels)
|
|
558
|
+
- [enableiOSLogging example](#enableioslogging-example)
|
|
559
|
+
- [Selligent.displayNotification(successCallback, errorCallback, notificationId)](#selligentdisplaynotificationsuccesscallback-errorcallback-notificationid)
|
|
560
|
+
- [displayNotification Example](#displaynotification-example)
|
|
561
|
+
- [Selligent.registerForProvisionalRemoteNotification(successCallback)](#selligentregisterforprovisionalremotenotificationsuccesscallback)
|
|
562
|
+
- [registerForProvisionalRemoteNotification example](#registerForProvisionalRemoteNotification-example)
|
|
563
|
+
- [Selligent.registerRemoteNotificationFetchCompletionHandler(successCallback, errorCallback)](#selligentregisterremotenotificationfetchcompletionhandlersuccesscallback-errorcallback)
|
|
564
|
+
- [registerRemoteNotificationFetchCompletionHandler example](#registerremotenotificationfetchcompletionhandler-example)
|
|
565
|
+
- [Selligent.forceRemoteNotificationBackgroundFetchResult(successCallback, errorCallback, iOSBackgroundFetchResult)](#selligentforceremotenotificationbackgroundfetchresultsuccesscallback-errorcallback-iosbackgroundfetchresult)
|
|
566
|
+
- [forceRemoteNotificationBackgroundFetchResult example](#forceremotenotificationbackgroundfetchresult-example)
|
|
567
|
+
|
|
568
|
+
- [Constants](#constants)
|
|
569
|
+
- [SelligentConstants.ClearCacheIntervalValue](#selligentconstantsclearcacheintervalvalue)
|
|
570
|
+
- [SelligentConstants.InAppMessageType](#selligentconstantsinappmessagetype)
|
|
571
|
+
- [SelligentConstants.InAppMessageRefreshType](#selligentconstantsinappmessagerefreshtype)
|
|
572
|
+
- [SelligentConstants.RemoteMessagesDisplayType](#selligentconstantsremotemessagesdisplaytype)
|
|
573
|
+
- [SelligentConstants.iOSLogLevel](#selligentconstantsiosloglevel)
|
|
574
|
+
- [SelligentConstants.iOSBackgroundFetchResult](#selligentconstantsiosbackgroundfetchresult)
|
|
575
|
+
- [SelligentConstants.iOSLocationAuthorisationStatus](#selligentconstantsioslocationauthorisationstatus)
|
|
576
|
+
- [SelligentConstants.iOSLocationAuthorisationType](#selligentconstantsioslocationauthorisationtype)
|
|
577
|
+
- [SelligentConstants.EventType](#selligentconstantseventtype)
|
|
578
|
+
- [SelligentConstants.iOSNotificationButtonType](#selligentconstantsiosnotificationbuttontype)
|
|
579
|
+
- [SelligentConstants.BroadcastEventType](#selligentconstantsbroadcasteventtype)
|
|
587
580
|
|
|
588
581
|
### Methods
|
|
589
582
|
|
|
@@ -596,18 +589,16 @@ The response of the success callback is a string containing the version of the S
|
|
|
596
589
|
##### getVersionLib example
|
|
597
590
|
|
|
598
591
|
```javascript
|
|
599
|
-
Selligent.getVersionLib(
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
);
|
|
592
|
+
Selligent.getVersionLib((versionLib) => {
|
|
593
|
+
// success callback
|
|
594
|
+
alert(versionLib);
|
|
595
|
+
});
|
|
604
596
|
```
|
|
605
597
|
|
|
606
598
|
<div align="right">
|
|
607
599
|
<b><a href="#api-reference">back to API ToC</a></b>
|
|
608
600
|
</div>
|
|
609
601
|
|
|
610
|
-
|
|
611
602
|
#### Selligent.enableGeolocation(successCallback, errorCallback, enabled)
|
|
612
603
|
|
|
613
604
|
Enable or disable geolocation services.
|
|
@@ -661,11 +652,10 @@ The response of the success callback is a string containing the device id.
|
|
|
661
652
|
##### getDeviceId example
|
|
662
653
|
|
|
663
654
|
```javascript
|
|
664
|
-
Selligent.getDeviceId(
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
);
|
|
655
|
+
Selligent.getDeviceId((deviceId) => {
|
|
656
|
+
// success callback
|
|
657
|
+
alert(deviceId);
|
|
658
|
+
});
|
|
669
659
|
```
|
|
670
660
|
|
|
671
661
|
<div align="right">
|
|
@@ -791,7 +781,7 @@ The response of the success callback is an array of objects which contain the in
|
|
|
791
781
|
**Detailed overview:**
|
|
792
782
|
|
|
793
783
|
| Property | Type | Description | Platform |
|
|
794
|
-
| -------------- | ------------------------------------------------------------------------------- |
|
|
784
|
+
| -------------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------- | -------- |
|
|
795
785
|
| id | string | Id of the in app message | Both |
|
|
796
786
|
| title | string | Title of the in app message | Both |
|
|
797
787
|
| body | string | Body of the in app message | Both |
|
|
@@ -799,7 +789,7 @@ The response of the success callback is an array of objects which contain the in
|
|
|
799
789
|
| creationDate | number | Creation date of the in app message in unix time | Both |
|
|
800
790
|
| expirationDate | number | Expiration date of the in app message in unix time | Both |
|
|
801
791
|
| receptionDate | number | Reception date of the in app message in unix time | Both |
|
|
802
|
-
| hasBeenSeen | boolean | Indication if the in app message is seen | Both |
|
|
792
|
+
| hasBeenSeen | boolean | Indication if the in app message is seen | Both |
|
|
803
793
|
| buttons | array of objects | Contains the buttons that are linked to the in app message | Both |
|
|
804
794
|
|
|
805
795
|
<br />
|
|
@@ -897,12 +887,12 @@ The method accepts an `event` object which requires certain properties, dependin
|
|
|
897
887
|
| data | object | Yes if event type is custom, optional if specific | Both | N/A |
|
|
898
888
|
| shouldCache | boolean | No | iOS Only | true |
|
|
899
889
|
|
|
900
|
-
The `type` property is used to define the event as
|
|
890
|
+
The `type` property is used to define the event as _custom_ or _specific_ event, using the [EventType](#selligenteventtype) constants.
|
|
901
891
|
|
|
902
892
|
To define it as a custom event, one should use the `SelligentConstants.EventType.CUSTOM` constant. All other event types can be used to define the event as something specific.
|
|
903
893
|
|
|
904
|
-
When an event is a
|
|
905
|
-
When an event is a
|
|
894
|
+
When an event is a _specific_ event type, the `event` object requires an `email` property containing a string, and has an optional property `data` which is an object that can contain other information.
|
|
895
|
+
When an event is a _custom_ event type, the `event` object requires a `data` property containing an object which contains other information, and ignores the `email` property.
|
|
906
896
|
|
|
907
897
|
**iOS specific:**
|
|
908
898
|
|
|
@@ -1015,7 +1005,7 @@ In case of a broadcast event type _ReceivedRemoteNotification_ the detailed over
|
|
|
1015
1005
|
| pushId | string | The id of the remote push notification |
|
|
1016
1006
|
| name | string | The name attached to the push notification |
|
|
1017
1007
|
|
|
1018
|
-
In case of a broadcast event type _WillDisplayNotification_ or _WillDismissNotification_ the `data` prop is
|
|
1008
|
+
In case of a broadcast event type _WillDisplayNotification_ or _WillDismissNotification_ the `data` prop is `null`.
|
|
1019
1009
|
|
|
1020
1010
|
**Android specific:**
|
|
1021
1011
|
|
|
@@ -1157,6 +1147,7 @@ Selligent.areNotificationsEnabled(
|
|
|
1157
1147
|
Set the small icon of a notification on Android.
|
|
1158
1148
|
|
|
1159
1149
|
The method accepts an `iconName` parameter which is a string containing the name of the small icon. When the application is closed it will default back to the icons specified in `selligent.json`.
|
|
1150
|
+
|
|
1160
1151
|
> _Note: only parse the name of the icon, without the path. The icon should reside in the res/drawable folder of the Android project, as explained in [Android's official guide](https://developer.android.com/guide/topics/resources/drawable-resource#BitmapFile)._
|
|
1161
1152
|
|
|
1162
1153
|
##### setNotificationSmallIcon example
|
|
@@ -1182,6 +1173,7 @@ Selligent.setNotificationSmallIcon(
|
|
|
1182
1173
|
Set the large icon of a notification on Android.
|
|
1183
1174
|
|
|
1184
1175
|
The method accepts an `iconName` parameter which is a string containing the name of the large icon. When the application is closed it will default back to the icons specified in `selligent.json`.
|
|
1176
|
+
|
|
1185
1177
|
> _Note: only parse the name of the icon, without the path. The icon should reside in the res/drawable folder of the Android project, as explained in [Android's official guide](https://developer.android.com/guide/topics/resources/drawable-resource#BitmapFile)._
|
|
1186
1178
|
|
|
1187
1179
|
##### setNotificationLargeIcon example
|
|
@@ -1352,6 +1344,24 @@ Selligent.displayNotification(
|
|
|
1352
1344
|
<b><a href="#api-reference">back to API ToC</a></b>
|
|
1353
1345
|
</div>
|
|
1354
1346
|
|
|
1347
|
+
#### Selligent.registerForProvisionalRemoteNotification(successCallback)
|
|
1348
|
+
|
|
1349
|
+
You can decide to first ask for the Provisional push authorization (which will provide a valid push token but will not show any prompt to the user) if you want to contact users that did not decide about the Push permission yet (you can call `enableNotifications` later and it will still display the push permission prompt to the user).
|
|
1350
|
+
|
|
1351
|
+
##### registerForProvisionalRemoteNotification example
|
|
1352
|
+
|
|
1353
|
+
```javascript
|
|
1354
|
+
Selligent.registerForProvisionalRemoteNotification(
|
|
1355
|
+
() => { // success callback
|
|
1356
|
+
...
|
|
1357
|
+
}
|
|
1358
|
+
);
|
|
1359
|
+
```
|
|
1360
|
+
|
|
1361
|
+
<div align="right">
|
|
1362
|
+
<b><a href="#api-reference">back to API ToC</a></b>
|
|
1363
|
+
</div>
|
|
1364
|
+
|
|
1355
1365
|
#### Selligent.registerRemoteNotificationFetchCompletionHandler(successCallback, errorCallback)
|
|
1356
1366
|
|
|
1357
1367
|
Register a completion handler for successfully fetching remote notifications.
|
|
@@ -1422,16 +1432,16 @@ _Note: `ClearCacheIntervalValue.Android.DAY` is only used on Android and can not
|
|
|
1422
1432
|
|
|
1423
1433
|
Defines the type of the in-app messages.
|
|
1424
1434
|
|
|
1425
|
-
| Name | Type | Value | Description
|
|
1426
|
-
| -------- | ------ | ----- |
|
|
1427
|
-
| UNKNOWN | number | -2 | In App message of unknown type
|
|
1428
|
-
| HIDDEN | number | -1 | In App message of hidden type
|
|
1429
|
-
| ALERT | number | 0 |In App message of alert type |
|
|
1430
|
-
| HTML | number | 1 |In App message of html type |
|
|
1431
|
-
| URL | number | 2 |In App message of url type |
|
|
1432
|
-
| IMAGE | number | 3 |In App message of image type |
|
|
1433
|
-
| MAP | number | 4 |In App message of map type |
|
|
1434
|
-
| PASSBOOK | number | 5 |In App message of passbook type |
|
|
1435
|
+
| Name | Type | Value | Description |
|
|
1436
|
+
| -------- | ------ | ----- | ------------------------------- |
|
|
1437
|
+
| UNKNOWN | number | -2 | In App message of unknown type |
|
|
1438
|
+
| HIDDEN | number | -1 | In App message of hidden type |
|
|
1439
|
+
| ALERT | number | 0 | In App message of alert type |
|
|
1440
|
+
| HTML | number | 1 | In App message of html type |
|
|
1441
|
+
| URL | number | 2 | In App message of url type |
|
|
1442
|
+
| IMAGE | number | 3 | In App message of image type |
|
|
1443
|
+
| MAP | number | 4 | In App message of map type |
|
|
1444
|
+
| PASSBOOK | number | 5 | In App message of passbook type |
|
|
1435
1445
|
|
|
1436
1446
|
<div align="right">
|
|
1437
1447
|
<b><a href="#api-reference">back to API ToC</a></b>
|
|
@@ -1454,7 +1464,7 @@ _Note: `InAppMessageRefreshType.Android.MINUTE` is only used on Android and can
|
|
|
1454
1464
|
<b><a href="#api-reference">back to API ToC</a></b>
|
|
1455
1465
|
</div>
|
|
1456
1466
|
|
|
1457
|
-
#### SelligentConstants.
|
|
1467
|
+
#### SelligentConstants.RemoteMessagesDisplayType
|
|
1458
1468
|
|
|
1459
1469
|
Defines if and how remote messages can be displayed on Android.
|
|
1460
1470
|
|
|
@@ -1585,4 +1595,4 @@ _Notes: `BroadcastEventType.Android.RECEIVED_GCM_TOKEN` is only used on Android
|
|
|
1585
1595
|
|
|
1586
1596
|
<div align="right">
|
|
1587
1597
|
<b><a href="#api-reference">back to API ToC</a></b>
|
|
1588
|
-
</div>
|
|
1598
|
+
</div>
|