@selligent-marketing-cloud/selligent-react-native 2.2.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 +287 -236
- package/RNSelligent.podspec +4 -4
- package/android/build.gradle +34 -26
- package/android/libs/sdk-release.aar +0 -0
- package/android/src/main/java/com/selligent/RNSelligent.java +54 -11
- package/android/src/main/java/com/selligent/SMSettingsFactory.java +1 -0
- package/android/src/main/java/com/selligent/Settings.java +16 -0
- package/constants.d.ts +103 -0
- package/constants.js +29 -1
- package/index.android.js +132 -0
- package/index.d.ts +124 -0
- package/index.ios.js +59 -15
- package/index.js +84 -2
- package/ios/ClientSettings.h +2 -0
- package/ios/ClientSettings.m +4 -0
- package/ios/EnumMapper.h +3 -6
- package/ios/EnumMapper.m +8 -24
- package/ios/RNSelligent.m +25 -13
- package/ios/RemoteMessageDisplayType.h +5 -0
- package/ios/SMManagerSetting+ClientSettings.m +20 -5
- package/ios/SelligentReactNative.xcodeproj/project.pbxproj +4 -4
- package/ios/include/SMBaseMessage.h +8 -8
- 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 +10 -8
- 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 +12 -4
- 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 +68 -31
- package/ios/include/SMManager+Location.h +7 -63
- 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 +14 -23
- package/ios/include/SMManagerInAppMessageDelegate.h +24 -0
- package/ios/include/SMManagerSetting+Location.h +27 -0
- package/ios/include/SMManagerSetting.h +63 -34
- 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 +19 -5
- 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.5.a → libSelligentMobile2.7.a} +0 -0
- package/package.json +3 -3
- package/ios/include/SMLocationAuthorisationType.h +0 -57
package/README.md
CHANGED
|
@@ -4,20 +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
|
+
|
|
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._
|
|
9
11
|
|
|
10
12
|
## ToC
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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)
|
|
21
23
|
|
|
22
24
|
## Installation
|
|
23
25
|
|
|
@@ -31,10 +33,10 @@ This module provides an API for the usage of the Selligent SDK in React Native.
|
|
|
31
33
|
|
|
32
34
|
```json
|
|
33
35
|
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
"url": "someMobilePushUrl",
|
|
37
|
+
"clientId": "someClientId",
|
|
38
|
+
"privateKey": "somePrivateKey",
|
|
39
|
+
"fullyQualifiedNotificationActivityClassName": "com.some.project.MainActivity"
|
|
38
40
|
}
|
|
39
41
|
```
|
|
40
42
|
|
|
@@ -42,25 +44,27 @@ This module provides an API for the usage of the Selligent SDK in React Native.
|
|
|
42
44
|
|
|
43
45
|
**Detailed overview:**
|
|
44
46
|
|
|
45
|
-
| Property | Type
|
|
46
|
-
| ------------------------------------------- |
|
|
47
|
-
| url | string
|
|
48
|
-
| clientId | string
|
|
49
|
-
| privateKey | string
|
|
50
|
-
| clearCacheIntervalValue | enum [Selligent.ClearCacheIntervalValue](#selligentclearcacheintervalvalue)
|
|
51
|
-
| configureLocationServices | boolean
|
|
52
|
-
| inAppMessageRefreshType | enum [Selligent.InAppMessageRefreshType](#selligentinappmessagerefreshtype)
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
63
|
-
|
|
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
|
+
|
|
64
68
|
|
|
65
69
|
### Android Specific Installation
|
|
66
70
|
|
|
@@ -131,7 +135,7 @@ This module provides an API for the usage of the Selligent SDK in React Native.
|
|
|
131
135
|
...
|
|
132
136
|
@Override
|
|
133
137
|
protected List<ReactPackage> getPackages() {
|
|
134
|
-
|
|
138
|
+
|
|
135
139
|
List<ReactPackage> packages = new PackageList(this).getPackages();
|
|
136
140
|
// Add the following:
|
|
137
141
|
packages.add(new RNSelligentPackage());
|
|
@@ -221,7 +225,6 @@ This module provides an API for the usage of the Selligent SDK in React Native.
|
|
|
221
225
|
|
|
222
226
|
</details>
|
|
223
227
|
|
|
224
|
-
|
|
225
228
|
#### Change default push notification icons
|
|
226
229
|
|
|
227
230
|
Add the following properties to the `selligent.json` file:
|
|
@@ -233,7 +236,6 @@ Add the following properties to the `selligent.json` file:
|
|
|
233
236
|
|
|
234
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)._
|
|
235
238
|
|
|
236
|
-
|
|
237
239
|
### iOS Specific installation
|
|
238
240
|
|
|
239
241
|
<details>
|
|
@@ -253,13 +255,11 @@ Add the following properties to the `selligent.json` file:
|
|
|
253
255
|
|
|
254
256
|
4. Add Selligent to `Header Search Paths` in `Build Settings` of your target:
|
|
255
257
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
258
|
+
```
|
|
259
|
+
$(SRCROOT)/../node_modules/@selligent-marketing-cloud/selligent-react-native/ios/
|
|
260
|
+
```
|
|
261
261
|
|
|
262
|
-
5. Create a
|
|
262
|
+
5. Create a `Podfile` (if there isn't one already) in the `/ios` folder and add the following:
|
|
263
263
|
|
|
264
264
|
```ruby
|
|
265
265
|
target 'REPLACEWITHYOURTARGETNAME'
|
|
@@ -297,13 +297,11 @@ Add the following properties to the `selligent.json` file:
|
|
|
297
297
|
|
|
298
298
|
</details>
|
|
299
299
|
|
|
300
|
-
|
|
301
|
-
|
|
302
300
|
#### Push notifications
|
|
303
301
|
|
|
304
302
|
1. For push notifications you need to delegate some of the `AppDelegate.m` methods to the SDK:
|
|
305
303
|
|
|
306
|
-
|
|
304
|
+
```objective-c
|
|
307
305
|
#import "AppDelegate.h"
|
|
308
306
|
#import <React/RCTBundleURLProvider.h>
|
|
309
307
|
#import <React/RCTRootView.h>
|
|
@@ -364,21 +362,24 @@ Add the following properties to the `selligent.json` file:
|
|
|
364
362
|
#endif
|
|
365
363
|
|
|
366
364
|
@end
|
|
367
|
-
|
|
365
|
+
```
|
|
368
366
|
|
|
369
|
-
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.
|
|
370
368
|
|
|
371
369
|
3. If you want rich push notifications, follow section 6.9 **Notification Extensions** as well.
|
|
372
|
-
Make sure you add your `appGroupId` to the `selligent.json`.
|
|
370
|
+
Make sure you add your `appGroupId` to the `selligent.json`.
|
|
371
|
+
> **IMPORTANT!** make sure your `appGroupId` has the following structure or it will not work: `group.{MAIN_APP_BUNDLE_ID}`
|
|
373
372
|
|
|
374
373
|
#### Geolocation
|
|
375
374
|
|
|
376
|
-
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).
|
|
377
376
|
|
|
378
377
|
#### Deeplinking
|
|
378
|
+
|
|
379
379
|
You can catch the deeplinks 2 ways:
|
|
380
380
|
|
|
381
381
|
1. Native in AppDelegate.m, add the following (example code that logs the URL)
|
|
382
|
+
|
|
382
383
|
```
|
|
383
384
|
-(BOOL)application:(UIApplication*) application openURL:(NSURL*) url sourceApplication:(NSString*) sourceApplication annotation:(id) annotation
|
|
384
385
|
{
|
|
@@ -396,13 +397,13 @@ You can catch the deeplinks 2 ways:
|
|
|
396
397
|
1. Add the `Button` import statement:
|
|
397
398
|
|
|
398
399
|
```javascript
|
|
399
|
-
import {Platform, StyleSheet, Text, View, Button} from
|
|
400
|
+
import { Platform, StyleSheet, Text, View, Button } from "react-native"; // Add Button import
|
|
400
401
|
```
|
|
401
402
|
|
|
402
403
|
2. Add the `Selligent` import statement:
|
|
403
404
|
|
|
404
405
|
```javascript
|
|
405
|
-
import Selligent from
|
|
406
|
+
import Selligent from "@selligent-marketing-cloud/selligent-react-native"; // Add Selligent import
|
|
406
407
|
```
|
|
407
408
|
|
|
408
409
|
3. Add a function to call the `Selligent.getVersionLib` function:
|
|
@@ -440,138 +441,142 @@ You can catch the deeplinks 2 ways:
|
|
|
440
441
|
5. Your `App.js` file should look something like this:
|
|
441
442
|
|
|
442
443
|
```javascript
|
|
443
|
-
import React, {Component} from
|
|
444
|
-
import {Platform, StyleSheet, Text, View, Button} from
|
|
445
|
-
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
|
|
446
447
|
|
|
447
448
|
const instructions = Platform.select({
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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",
|
|
452
453
|
});
|
|
453
454
|
|
|
454
455
|
type Props = {};
|
|
455
456
|
export default class App extends Component<Props> {
|
|
457
|
+
// Add example function
|
|
458
|
+
_getVersionLib() {
|
|
459
|
+
Selligent.getVersionLib((versionLib) => {
|
|
460
|
+
alert(versionLib);
|
|
461
|
+
});
|
|
462
|
+
}
|
|
456
463
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
// Add button
|
|
471
|
-
<Button
|
|
472
|
-
onPress={this._getVersionLib}
|
|
473
|
-
title='getVersionLib'
|
|
474
|
-
/>
|
|
475
|
-
</View>
|
|
476
|
-
);
|
|
477
|
-
}
|
|
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
|
+
}
|
|
478
477
|
}
|
|
479
478
|
|
|
480
479
|
const styles = StyleSheet.create({
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
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
|
+
},
|
|
497
496
|
});
|
|
498
497
|
```
|
|
499
498
|
|
|
500
499
|
## API Reference
|
|
501
500
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
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
|
-
|
|
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)
|
|
575
580
|
|
|
576
581
|
### Methods
|
|
577
582
|
|
|
@@ -584,11 +589,10 @@ The response of the success callback is a string containing the version of the S
|
|
|
584
589
|
##### getVersionLib example
|
|
585
590
|
|
|
586
591
|
```javascript
|
|
587
|
-
Selligent.getVersionLib(
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
);
|
|
592
|
+
Selligent.getVersionLib((versionLib) => {
|
|
593
|
+
// success callback
|
|
594
|
+
alert(versionLib);
|
|
595
|
+
});
|
|
592
596
|
```
|
|
593
597
|
|
|
594
598
|
<div align="right">
|
|
@@ -639,6 +643,25 @@ Selligent.isGeolocationEnabled(
|
|
|
639
643
|
<b><a href="#api-reference">back to API ToC</a></b>
|
|
640
644
|
</div>
|
|
641
645
|
|
|
646
|
+
#### Selligent.getDeviceId(successCallback)
|
|
647
|
+
|
|
648
|
+
Returns the device id.
|
|
649
|
+
|
|
650
|
+
The response of the success callback is a string containing the device id.
|
|
651
|
+
|
|
652
|
+
##### getDeviceId example
|
|
653
|
+
|
|
654
|
+
```javascript
|
|
655
|
+
Selligent.getDeviceId((deviceId) => {
|
|
656
|
+
// success callback
|
|
657
|
+
alert(deviceId);
|
|
658
|
+
});
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
<div align="right">
|
|
662
|
+
<b><a href="#api-reference">back to API ToC</a></b>
|
|
663
|
+
</div>
|
|
664
|
+
|
|
642
665
|
#### Selligent.enableNotifications(successCallback, errorCallback, enabled)
|
|
643
666
|
|
|
644
667
|
Enable or disable the usage of notifications.
|
|
@@ -757,16 +780,17 @@ The response of the success callback is an array of objects which contain the in
|
|
|
757
780
|
|
|
758
781
|
**Detailed overview:**
|
|
759
782
|
|
|
760
|
-
| Property
|
|
761
|
-
|
|
|
762
|
-
| id
|
|
763
|
-
| title
|
|
764
|
-
| body
|
|
765
|
-
|
|
|
766
|
-
|
|
|
767
|
-
|
|
|
768
|
-
|
|
|
769
|
-
|
|
|
783
|
+
| Property | Type | Description | Platform |
|
|
784
|
+
| -------------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------- | -------- |
|
|
785
|
+
| id | string | Id of the in app message | Both |
|
|
786
|
+
| title | string | Title of the in app message | Both |
|
|
787
|
+
| body | string | Body of the in app message | Both |
|
|
788
|
+
| type | enum [SelligentConstants.InAppMessageType](#selligentconstantsinappmessagetype) | Type of the in app message | Both |
|
|
789
|
+
| creationDate | number | Creation date of the in app message in unix time | Both |
|
|
790
|
+
| expirationDate | number | Expiration date of the in app message in unix time | Both |
|
|
791
|
+
| receptionDate | number | Reception date of the in app message in unix time | Both |
|
|
792
|
+
| hasBeenSeen | boolean | Indication if the in app message is seen | Both |
|
|
793
|
+
| buttons | array of objects | Contains the buttons that are linked to the in app message | Both |
|
|
770
794
|
|
|
771
795
|
<br />
|
|
772
796
|
|
|
@@ -774,13 +798,13 @@ The `buttons` property is an array of button-objects which contain the informati
|
|
|
774
798
|
|
|
775
799
|
<br />
|
|
776
800
|
|
|
777
|
-
| Property
|
|
778
|
-
|
|
|
779
|
-
| id
|
|
780
|
-
| label
|
|
781
|
-
| value
|
|
782
|
-
| type
|
|
783
|
-
| action
|
|
801
|
+
| Property | Type | Description | Platform |
|
|
802
|
+
| -------- | ------ | ------------------------------------------ | ------------ |
|
|
803
|
+
| id | string | Id of the button of the in app message | Both |
|
|
804
|
+
| label | string | Label of the button of the in app message | Both |
|
|
805
|
+
| value | string | Value of the button of the in app message | Both |
|
|
806
|
+
| type | number | Type of the button of the in app message | Both |
|
|
807
|
+
| action | number | Action of the button of the in app message | Android only |
|
|
784
808
|
|
|
785
809
|
<br />
|
|
786
810
|
|
|
@@ -863,12 +887,12 @@ The method accepts an `event` object which requires certain properties, dependin
|
|
|
863
887
|
| data | object | Yes if event type is custom, optional if specific | Both | N/A |
|
|
864
888
|
| shouldCache | boolean | No | iOS Only | true |
|
|
865
889
|
|
|
866
|
-
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.
|
|
867
891
|
|
|
868
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.
|
|
869
893
|
|
|
870
|
-
When an event is a
|
|
871
|
-
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.
|
|
872
896
|
|
|
873
897
|
**iOS specific:**
|
|
874
898
|
|
|
@@ -962,6 +986,12 @@ And the detailed overview for items in the `messages` array is as such:
|
|
|
962
986
|
| id | string | Id of a message |
|
|
963
987
|
| title | string | Title of a message |
|
|
964
988
|
|
|
989
|
+
In case of a broadcast event type _ReceivedDeviceId_ the detailed overview for the `data` is as such:
|
|
990
|
+
|
|
991
|
+
| Property | Type | Description |
|
|
992
|
+
| -------- | ------ | ------------- |
|
|
993
|
+
| deviceId | string | The device id |
|
|
994
|
+
|
|
965
995
|
In case of a broadcast event type _ReceivedGCMToken_ the detailed overview for the `data` is as such:
|
|
966
996
|
|
|
967
997
|
| Property | Type | Description |
|
|
@@ -975,7 +1005,7 @@ In case of a broadcast event type _ReceivedRemoteNotification_ the detailed over
|
|
|
975
1005
|
| pushId | string | The id of the remote push notification |
|
|
976
1006
|
| name | string | The name attached to the push notification |
|
|
977
1007
|
|
|
978
|
-
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`.
|
|
979
1009
|
|
|
980
1010
|
**Android specific:**
|
|
981
1011
|
|
|
@@ -1117,6 +1147,7 @@ Selligent.areNotificationsEnabled(
|
|
|
1117
1147
|
Set the small icon of a notification on Android.
|
|
1118
1148
|
|
|
1119
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
|
+
|
|
1120
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)._
|
|
1121
1152
|
|
|
1122
1153
|
##### setNotificationSmallIcon example
|
|
@@ -1142,6 +1173,7 @@ Selligent.setNotificationSmallIcon(
|
|
|
1142
1173
|
Set the large icon of a notification on Android.
|
|
1143
1174
|
|
|
1144
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
|
+
|
|
1145
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)._
|
|
1146
1178
|
|
|
1147
1179
|
##### setNotificationLargeIcon example
|
|
@@ -1162,6 +1194,32 @@ Selligent.setNotificationLargeIcon(
|
|
|
1162
1194
|
<b><a href="#api-reference">back to API ToC</a></b>
|
|
1163
1195
|
</div>
|
|
1164
1196
|
|
|
1197
|
+
#### Selligent.setNotificationIconColor(successCallback, errorCallback, color)
|
|
1198
|
+
|
|
1199
|
+
Set the icon color of a notification on Android.
|
|
1200
|
+
|
|
1201
|
+
The method accepts a `color` parameter which is a string containing the hex value of color.
|
|
1202
|
+
|
|
1203
|
+
> _The notification color can also be set by setting the notificationIconColor parameter in `selligent.json` to the hex color value_
|
|
1204
|
+
|
|
1205
|
+
##### setNotificationIconColor example
|
|
1206
|
+
|
|
1207
|
+
```javascript
|
|
1208
|
+
Selligent.setNotificationIconColor(
|
|
1209
|
+
(response) => { // success callback
|
|
1210
|
+
...
|
|
1211
|
+
},
|
|
1212
|
+
(error) => { // error callback
|
|
1213
|
+
...
|
|
1214
|
+
},
|
|
1215
|
+
"#00b8fb"
|
|
1216
|
+
);
|
|
1217
|
+
```
|
|
1218
|
+
|
|
1219
|
+
<div align="right">
|
|
1220
|
+
<b><a href="#api-reference">back to API ToC</a></b>
|
|
1221
|
+
</div>
|
|
1222
|
+
|
|
1165
1223
|
#### Selligent.getGCMToken(successCallback)
|
|
1166
1224
|
|
|
1167
1225
|
Get the GCM token being used.
|
|
@@ -1264,44 +1322,21 @@ Selligent.enableiOSLogging(
|
|
|
1264
1322
|
<b><a href="#api-reference">back to API ToC</a></b>
|
|
1265
1323
|
</div>
|
|
1266
1324
|
|
|
1267
|
-
#### Selligent.
|
|
1268
|
-
|
|
1269
|
-
Get the current status of location authorisation.
|
|
1270
|
-
|
|
1271
|
-
The response of the success callback is a number corresponding with a constant of the [Selligent.iOSLocationAuthorisationStatus](#selligentioslocationauthorisationstatus) enum.
|
|
1272
|
-
|
|
1273
|
-
##### currentAuthorisationStatus Example
|
|
1274
|
-
|
|
1275
|
-
```javascript
|
|
1276
|
-
Selligent.currentAuthorisationStatus(
|
|
1277
|
-
(response) => { // success callback
|
|
1278
|
-
...
|
|
1279
|
-
}
|
|
1280
|
-
);
|
|
1281
|
-
```
|
|
1282
|
-
|
|
1283
|
-
<div align="right">
|
|
1284
|
-
<b><a href="#api-reference">back to API ToC</a></b>
|
|
1285
|
-
</div>
|
|
1286
|
-
|
|
1287
|
-
#### Selligent.requestLocationAuthorisation(successCallback, errorCallback, iOSLocationAuthorisationType)
|
|
1288
|
-
|
|
1289
|
-
Request an authorisation of using location on a device.
|
|
1325
|
+
#### Selligent.displayNotification(successCallback, errorCallback, notificationId)
|
|
1290
1326
|
|
|
1291
|
-
|
|
1292
|
-
You can use constants of the [Selligent.iOSLocationAuthorisationType](#selligentioslocationauthorisationtype) enum to specify the authorisation request.
|
|
1327
|
+
Display a notification based on its id, which is a string that needs to be parsed in the method with the `notificationId` parameter.
|
|
1293
1328
|
|
|
1294
|
-
#####
|
|
1329
|
+
##### displayNotification Example
|
|
1295
1330
|
|
|
1296
1331
|
```javascript
|
|
1297
|
-
Selligent.
|
|
1332
|
+
Selligent.displayNotification(
|
|
1298
1333
|
(response) => { // success callback
|
|
1299
1334
|
...
|
|
1300
1335
|
},
|
|
1301
1336
|
(error) => { // error callback
|
|
1302
1337
|
...
|
|
1303
1338
|
},
|
|
1304
|
-
|
|
1339
|
+
"some notification id"
|
|
1305
1340
|
);
|
|
1306
1341
|
```
|
|
1307
1342
|
|
|
@@ -1309,21 +1344,17 @@ Selligent.requestLocationAuthorisation(
|
|
|
1309
1344
|
<b><a href="#api-reference">back to API ToC</a></b>
|
|
1310
1345
|
</div>
|
|
1311
1346
|
|
|
1312
|
-
#### Selligent.
|
|
1347
|
+
#### Selligent.registerForProvisionalRemoteNotification(successCallback)
|
|
1313
1348
|
|
|
1314
|
-
|
|
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).
|
|
1315
1350
|
|
|
1316
|
-
#####
|
|
1351
|
+
##### registerForProvisionalRemoteNotification example
|
|
1317
1352
|
|
|
1318
1353
|
```javascript
|
|
1319
|
-
Selligent.
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
(error) => { // error callback
|
|
1324
|
-
...
|
|
1325
|
-
},
|
|
1326
|
-
"some notification id"
|
|
1354
|
+
Selligent.registerForProvisionalRemoteNotification(
|
|
1355
|
+
() => { // success callback
|
|
1356
|
+
...
|
|
1357
|
+
}
|
|
1327
1358
|
);
|
|
1328
1359
|
```
|
|
1329
1360
|
|
|
@@ -1397,6 +1428,25 @@ _Note: `ClearCacheIntervalValue.Android.DAY` is only used on Android and can not
|
|
|
1397
1428
|
<b><a href="#api-reference">back to API ToC</a></b>
|
|
1398
1429
|
</div>
|
|
1399
1430
|
|
|
1431
|
+
#### SelligentConstants.InAppMessageType
|
|
1432
|
+
|
|
1433
|
+
Defines the type of the in-app messages.
|
|
1434
|
+
|
|
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 |
|
|
1445
|
+
|
|
1446
|
+
<div align="right">
|
|
1447
|
+
<b><a href="#api-reference">back to API ToC</a></b>
|
|
1448
|
+
</div>
|
|
1449
|
+
|
|
1400
1450
|
#### SelligentConstants.InAppMessageRefreshType
|
|
1401
1451
|
|
|
1402
1452
|
Defines how often the SDK must retrieve the in-app messages.
|
|
@@ -1414,7 +1464,7 @@ _Note: `InAppMessageRefreshType.Android.MINUTE` is only used on Android and can
|
|
|
1414
1464
|
<b><a href="#api-reference">back to API ToC</a></b>
|
|
1415
1465
|
</div>
|
|
1416
1466
|
|
|
1417
|
-
#### SelligentConstants.
|
|
1467
|
+
#### SelligentConstants.RemoteMessagesDisplayType
|
|
1418
1468
|
|
|
1419
1469
|
Defines if and how remote messages can be displayed on Android.
|
|
1420
1470
|
|
|
@@ -1537,6 +1587,7 @@ Defines the type of a broadcast event.
|
|
|
1537
1587
|
| RECEIVED_IN_APP_MESSAGE | string | "ReceivedInAppMessage" | An in-app message has been received |
|
|
1538
1588
|
| WILL_DISPLAY_NOTIFICATION | string | "WillDisplayNotification" | A notification will be displayed |
|
|
1539
1589
|
| WILL_DISMISS_NOTIFICATION | string | "WillDismissNotification" | A notification will be dismissed |
|
|
1590
|
+
| RECEIVED_DEVICE_ID | string | "ReceivedDeviceId" | A device id has been received |
|
|
1540
1591
|
| Android.RECEIVED_GCM_TOKEN | string | "ReceivedGCMToken" | A GCM token has been received (only on Android) |
|
|
1541
1592
|
| iOS.RECEIVED_REMOTE_NOTIFICATION | string | "ReceivedRemoteNotification" | A remote notification has been received (only on iOS) |
|
|
1542
1593
|
|
|
@@ -1544,4 +1595,4 @@ _Notes: `BroadcastEventType.Android.RECEIVED_GCM_TOKEN` is only used on Android
|
|
|
1544
1595
|
|
|
1545
1596
|
<div align="right">
|
|
1546
1597
|
<b><a href="#api-reference">back to API ToC</a></b>
|
|
1547
|
-
</div>
|
|
1598
|
+
</div>
|