infobip-mobile-messaging-react-native-plugin 6.0.0 → 6.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/infobip-mobile-messaging-react-native-plugin.svg)](https://www.npmjs.com/package/infobip-mobile-messaging-react-native-plugin)
4
4
 
5
- Mobile Messaging SDK is designed and developed to easily enable push notification channel in your mobile application. In almost no time of implementation you get push notification in your application and access to the features of [Infobip IP Messaging Platform](https://portal.infobip.com/push/).
5
+ Mobile Messaging SDK is designed and developed to easily enable push notification channel in your mobile application. In almost no time of implementation you get push notification in your application and access to the features of [Infobip IP Messaging Platform](https://portal.infobip.com/push/).
6
6
  The document describes library integration steps for your React Native project.
7
7
 
8
8
  * [Requirements](#requirements)
@@ -17,12 +17,12 @@ The document describes library integration steps for your React Native project.
17
17
  For iOS project:
18
18
  - Xcode and Command Line Tools (13.2.1)
19
19
  - CocoaPods (v1.11.3)
20
- - Minimum deployment target 11.0
20
+ - Minimum deployment target 12.0
21
21
 
22
22
  For Android project:
23
23
  - Android Studio (Bumblebee | 2021.1.1)
24
24
  - Gradle (v7.3.3)
25
- - Minimum API Level: 21 (Android 5.0 - [Lollipop](https://developer.android.com/about/versions/lollipop))
25
+ - Supported API Levels: 21 (Android 5.0 - [Lollipop](https://developer.android.com/about/versions/lollipop)) - 31 (Android 12.0)
26
26
 
27
27
  ## Quick start guide
28
28
 
@@ -34,54 +34,67 @@ This guide is designed to get you up and running with Mobile Messaging SDK plugi
34
34
  ```bash
35
35
  $ npm install infobip-mobile-messaging-react-native-plugin
36
36
  ```
37
+ TypeScript's definitions are included into npm package
37
38
 
38
39
  3. Configure platforms
39
40
 
40
- - **iOS**
41
- 1. Add `use_frameworks!` into `/ios/Podfile` (required for Swift frameworks such as our Mobile Messaging SDK)
42
- 2. Run `pod install` from `/ios` folder (installs Mobile Messaging native SDK)
43
- 3. Import following header `#import <MobileMessaging/MobileMessagingPluginApplicationDelegate.h>` and add `[MobileMessagingPluginApplicationDelegate install];` into `/ios/<ProjectName>/AppDelegate.m` (this is required for OS callbacks such as `didRegisterForRemoteNotifications` to be intercepted by native MobileMessaging SDK)
44
- ```objective-c
45
- ...
46
- #import <MobileMessaging/MobileMessagingPluginApplicationDelegate.h>
47
-
48
- @implementation AppDelegate
49
-
50
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
51
- {
52
- [MobileMessagingPluginApplicationDelegate install];
53
- ...
54
- }
55
- ...
56
- ```
57
- 4. Configure your project to support Push Notification as described in item 2 of [iOS integration quick start guide](https://github.com/infobip/mobile-messaging-sdk-ios#quick-start-guide)
58
- 5. [Integrate Notification Service Extension](https://github.com/infobip/mobile-messaging-sdk-ios/wiki/Notification-Service-Extension-for-Rich-Notifications-and-better-delivery-reporting-on-iOS-10) into your app in order to obtain:
59
- - more accurate processing of messages and delivery stats
60
- - support of rich notifications on the lock screen
61
- - **Android**
62
- 1. Following paths should be provided in .bash_profile
63
- ```sh
64
- export ANDROID_HOME=$HOME/Library/Android/sdk
65
- export PATH=$PATH:$ANDROID_HOME/emulator
66
- export PATH=$PATH:$ANDROID_HOME/tools
67
- export PATH=$PATH:$ANDROID_HOME/tools/bin
68
- export PATH=$PATH:$ANDROID_HOME/platform-tools
69
- ```
70
- 2. Add 'com.google.gms:google-services' to `android/build.gradle` file
71
- ```groovy
72
- buildscript {
41
+ - **iOS**
42
+ > ### Notice
43
+ > Starting from the [6.2.0](https://github.com/infobip/mobile-messaging-react-native-plugin/releases/tag/6.1.0) plugin version it's not mandatory to add `use_frameworks!` to the `Podfile`, check the [Migration guide](https://github.com/infobip/mobile-messaging-react-native-plugin/wiki/Migration-guides#migration-from-610-to-620-in-case-you-are-getting-rid-of-use_frameworks-in-the-podfile) if you want to get rid of it.
44
+ 1. Run `pod install` from `/ios` folder (installs Mobile Messaging native SDK)
45
+ 2. Import following header `#import <MobileMessaging/MobileMessagingPluginApplicationDelegate.h>` and add `[MobileMessagingPluginApplicationDelegate install];` into `/ios/<ProjectName>/AppDelegate.m` (this is required for OS callbacks such as `didRegisterForRemoteNotifications` to be intercepted by native MobileMessaging SDK)
46
+ ```objective-c
73
47
  ...
74
- dependencies {
48
+ #import <MobileMessaging/MobileMessagingPluginApplicationDelegate.h>
49
+
50
+ @implementation AppDelegate
51
+
52
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
53
+ {
54
+ [MobileMessagingPluginApplicationDelegate install];
75
55
  ...
76
- //GMS Gradle plugin
77
- classpath 'com.google.gms:google-services:4.3.10'
78
56
  }
79
- }
80
- ```
81
- And add `apply plugin: 'com.google.gms.google-services'` at the end of your `android/app/build.gradle` in order to apply [Google Services Gradle Plugin](https://developers.google.com/android/guides/google-services-plugin)
82
- 3. Add a Firebase configuration file (google-services.json) as described in <a href="https://firebase.google.com/docs/android/setup#add-config-file" target="_blank">`Firebase documentation`</a>
83
- > ### Notice:
84
- > Check <a href="https://github.com/infobip/mobile-messaging-react-native-plugin/wiki/Applying-Firebase-configuration-in-MobileMessaging-SDK">Applying Firebase configuration in MobileMessaging SDK Guide</a> for alternatives.
57
+ ...
58
+ ```
59
+ 3. Configure your project to support Push Notification as described in item 2 of [iOS integration quick start guide](https://github.com/infobip/mobile-messaging-sdk-ios#quick-start-guide)
60
+ 4. [Integrate Notification Service Extension](https://github.com/infobip/mobile-messaging-react-native-plugin/wiki/Delivery-improvements-and-rich-content-notifications#setting-up-ios-part) into your app in order to obtain:
61
+ - more accurate processing of messages and delivery stats
62
+ - support of rich notifications on the lock screen
63
+ - **Android**
64
+ 1. Following paths should be provided in .bash_profile
65
+ ```sh
66
+ export ANDROID_HOME=$HOME/Library/Android/sdk
67
+ export PATH=$PATH:$ANDROID_HOME/emulator
68
+ export PATH=$PATH:$ANDROID_HOME/tools
69
+ export PATH=$PATH:$ANDROID_HOME/tools/bin
70
+ export PATH=$PATH:$ANDROID_HOME/platform-tools
71
+ ```
72
+ 2. Add 'com.google.gms:google-services' to `android/build.gradle` file
73
+ ```groovy
74
+ buildscript {
75
+ ...
76
+ dependencies {
77
+ ...
78
+ //GMS Gradle plugin
79
+ classpath 'com.google.gms:google-services:4.3.10'
80
+ }
81
+ }
82
+ ```
83
+ And add `apply plugin: 'com.google.gms.google-services'` at the end of your `android/app/build.gradle` in order to apply [Google Services Gradle Plugin](https://developers.google.com/android/guides/google-services-plugin)
84
+
85
+ 3. Add a Firebase configuration file (google-services.json) as described in <a href="https://firebase.google.com/docs/android/setup#add-config-file" target="_blank">`Firebase documentation`</a>. Check <a href="https://github.com/infobip/mobile-messaging-react-native-plugin/wiki/Applying-Firebase-configuration-in-MobileMessaging-SDK">Applying Firebase configuration in MobileMessaging SDK Guide</a> for alternatives.
86
+
87
+ > ### Notice (check if you don't plan to use [Geofencing](https://github.com/infobip/mobile-messaging-react-native-plugin/wiki/Geofencing#android)):
88
+ > As long as Geofencing is automatically included to the plugin, it adds required geo permissions automatically. You can remove them from `/android/app/src/main/AndroidManifest.xml` by adding following:
89
+ > ```
90
+ > <manifest ... xmlns:tools="http://schemas.android.com/tools">
91
+ > ...
92
+ > <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" tools:node="remove" />
93
+ > <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" tools:node="remove" />
94
+ > <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" tools:node="remove" />
95
+ > ...
96
+ > </manifest>
97
+ > ```
85
98
 
86
99
  ## Initialization configuration
87
100
 
@@ -89,26 +102,54 @@ Initialize Mobile Messaging React Native plugin, provide application configurati
89
102
 
90
103
  ```javascript
91
104
  import { mobileMessaging } from 'infobip-mobile-messaging-react-native-plugin';
92
-
105
+
93
106
  someMethod(): void {
94
- ...
95
-
96
- mobileMessaging.init(
97
- {
98
- applicationCode: '<your app code>',
99
- ios: {
100
- notificationTypes: ['alert', 'badge', 'sound'],
101
- },
102
- },
103
- () => {
104
- console.log('MobileMessaging started');
105
- },
106
- error => {
107
- console.log('MobileMessaging error: ', error);
108
- },
109
- );
107
+ ...
108
+
109
+ mobileMessaging.init(
110
+ {
111
+ applicationCode: '<your app code>',
112
+ ios: {
113
+ notificationTypes: ['alert', 'badge', 'sound'],
114
+ },
115
+ },
116
+ () => {
117
+ console.log('MobileMessaging started');
118
+ },
119
+ error => {
120
+ console.log('MobileMessaging error: ', error);
121
+ },
122
+ );
110
123
  }
111
124
  ```
125
+ <details><summary>expand to see TypeScript code</summary>
126
+ <p>
127
+
128
+ ```typescript
129
+ import { mobileMessaging } from 'infobip-mobile-messaging-react-native-plugin';
130
+
131
+ someMethod(): void {
132
+ ...
133
+
134
+ mobileMessaging.init(
135
+ {
136
+ applicationCode: '<your app code>',
137
+ ios: {
138
+ notificationTypes: ['alert', 'badge', 'sound'],
139
+ },
140
+ },
141
+ () => {
142
+ console.log('MobileMessaging started');
143
+ },
144
+ (error: MobileMessagingError) => {
145
+ console.log('MobileMessaging error: ', error);
146
+ },
147
+ );
148
+ }
149
+ ```
150
+
151
+ </p>
152
+ </details>
112
153
 
113
154
  #### More details on SDK features and FAQ you can find on [Wiki](https://github.com/infobip/mobile-messaging-react-native-plugin/wiki)
114
155
 
@@ -22,10 +22,12 @@ class CacheManager {
22
22
 
23
23
  static class Event {
24
24
  String type;
25
+ JSONObject jsonObject;
25
26
  Object[] objects = null;
26
27
 
27
- Event(String type, Object ... objects) {
28
+ Event(String type, JSONObject object, Object ... objects) {
28
29
  this.type = type;
30
+ this.jsonObject = object;
29
31
  this.objects = objects;
30
32
  }
31
33
 
@@ -33,6 +35,7 @@ class CacheManager {
33
35
  public String toString() {
34
36
  return type;
35
37
  }
38
+
36
39
  }
37
40
 
38
41
  static void saveEvent(Context context, String event, JSONObject object, String actionId, String actionInputText) {
@@ -41,7 +44,8 @@ class CacheManager {
41
44
  }
42
45
 
43
46
  static void saveEvent(Context context, String event, int unreadMessagesCounter) {
44
- String serialized = serializer.serialize(new Event(event, unreadMessagesCounter));
47
+ //int `unreadMessagesCounter` isn't a JSONObject, so it'll go as a second argument
48
+ String serialized = serializer.serialize(new Event(event, null, unreadMessagesCounter));
45
49
  saveStringsToSet(context, EVENTS_KEY, serialized);
46
50
  }
47
51
 
@@ -2,16 +2,13 @@ package org.infobip.reactlibrary.mobilemessaging;
2
2
 
3
3
  import android.util.Log;
4
4
 
5
- import com.facebook.react.bridge.Callback;
6
5
  import com.facebook.react.bridge.ReactContext;
7
6
  import com.facebook.react.bridge.ReadableArray;
8
7
  import com.facebook.react.bridge.ReadableMap;
9
8
  import com.facebook.react.bridge.WritableArray;
10
- import com.facebook.react.bridge.WritableMap;
11
9
  import com.facebook.react.bridge.WritableNativeArray;
12
- import com.facebook.react.bridge.WritableNativeMap;
13
10
  import com.facebook.react.modules.core.DeviceEventManagerModule;
14
- import com.google.gson.JsonIOException;
11
+
15
12
  import org.infobip.reactlibrary.mobilemessaging.datamappers.ReactNativeJson;
16
13
 
17
14
  import org.json.JSONArray;
@@ -20,8 +17,13 @@ import org.json.JSONObject;
20
17
 
21
18
 
22
19
  class ReactNativeEvent {
20
+
23
21
  static void send(String eventName, ReactContext reactContext, Object... objects) {
24
- if (objects == null) {
22
+ send(eventName, reactContext, null, objects);
23
+ }
24
+
25
+ static void send(String eventName, ReactContext reactContext, JSONObject jsonObject, Object... objects) {
26
+ if (jsonObject == null && objects == null) {
25
27
  Log.d(Utils.TAG, "objects are null, so another method should be used");
26
28
  send(eventName, reactContext);
27
29
  return;
@@ -31,6 +33,11 @@ class ReactNativeEvent {
31
33
  array.pushString(eventName);
32
34
 
33
35
  try {
36
+
37
+ if (jsonObject != null) {
38
+ array.pushMap(ReactNativeJson.convertJsonToMap(jsonObject));
39
+ }
40
+
34
41
  for (Object value : objects) {
35
42
  if (value == null) {
36
43
  continue;
@@ -70,7 +70,7 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
70
70
  public void initialize() {
71
71
  super.initialize();
72
72
  for (CacheManager.Event event : CacheManager.loadEvents(reactContext)) {
73
- ReactNativeEvent.send(event.type, reactContext, event.objects);
73
+ ReactNativeEvent.send(event.type, reactContext, event.jsonObject, event.objects);
74
74
  }
75
75
  pluginInitialized = true;
76
76
  registerBroadcastReceiver();
package/index.d.ts ADDED
@@ -0,0 +1,487 @@
1
+ import { EmitterSubscription, Rationale } from "react-native";
2
+
3
+ declare namespace MobileMessagingReactNative {
4
+ export type OS = 'Android' | 'iOS';
5
+ export type Gender = 'Male' | 'Female';
6
+ export type Event = 'messageReceived' |
7
+ 'notificationTapped' |
8
+ 'tokenReceived' |
9
+ 'registrationUpdated' |
10
+ 'geofenceEntered' |
11
+ 'actionTapped' |
12
+ 'installationUpdated' |
13
+ 'userUpdated' |
14
+ 'personalized' |
15
+ 'depersonalized' |
16
+ 'inAppChat.availabilityUpdated' |
17
+ 'inAppChat.unreadMessageCounterUpdated' |
18
+ 'deeplink';
19
+
20
+ export interface Configuration {
21
+ /**
22
+ * The application code of your Application from Push Portal website
23
+ */
24
+ applicationCode: string;
25
+ geofencingEnabled?: boolean | undefined;
26
+ inAppChatEnabled?: boolean | undefined;
27
+ /**
28
+ * Message storage save callback
29
+ */
30
+ messageStorage?: CustomMessageStorage;
31
+ defaultMessageStorage?: boolean | undefined;
32
+ ios?: {
33
+ notificationTypes?: string[] | undefined;
34
+ forceCleanup?: boolean | undefined;
35
+ logging?: boolean | undefined
36
+ } | undefined;
37
+ android?: {
38
+ notificationIcon?: string; // a resource name for a status bar icon (without extension), located in 'android/src/main/res/mipmap'
39
+ multipleNotifications?: boolean;
40
+ notificationAccentColor?: string;
41
+ firebaseOptions?: {
42
+ apiKey: string;
43
+ applicationId: string;
44
+ databaseUrl?: string;
45
+ gaTrackingId?: string;
46
+ gcmSenderId?: string;
47
+ storageBucket?: string;
48
+ projectId: string;
49
+ };
50
+ } | undefined;
51
+ privacySettings?: {
52
+ applicationCodePersistingDisabled?: boolean | undefined;
53
+ userDataPersistingDisabled?: boolean | undefined;
54
+ carrierInfoSendingDisabled?: boolean | undefined;
55
+ systemInfoSendingDisabled?: boolean | undefined
56
+ } | undefined;
57
+ notificationCategories?: [
58
+ {
59
+ identifier: string | undefined;
60
+ actions?: [
61
+ {
62
+ identifier: string | undefined;
63
+ title?: string | undefined;
64
+ foreground?: boolean | undefined;
65
+ authenticationRequired?: boolean | undefined;
66
+ moRequired?: boolean | undefined;
67
+ destructive?: boolean | undefined;
68
+ icon?: string | undefined;
69
+ textInputActionButtonTitle?: string | undefined;
70
+ textInputPlaceholder?: string | undefined
71
+ }] | undefined
72
+ }] | undefined;
73
+ }
74
+
75
+ export interface UserData {
76
+ externalUserId?: string;
77
+ firstName?: string | undefined;
78
+ lastName?: string | undefined;
79
+ middleName?: string | undefined;
80
+ gender?: Gender | undefined;
81
+ birthday?: string | undefined;
82
+ phones?: string[] | undefined;
83
+ emails?: string[] | undefined;
84
+ tags?: string[] | undefined;
85
+ customAttributes?: Record<string, string | number | boolean | object[]> | undefined;
86
+ }
87
+
88
+ export interface Installation {
89
+ isPrimaryDevice?: boolean | undefined;
90
+ isPushRegistrationEnabled?: boolean | undefined;
91
+ notificationsEnabled?: boolean | undefined;
92
+ geoEnabled?: boolean | undefined;
93
+ sdkVersion?: string | undefined;
94
+ appVersion?: string | undefined;
95
+ os?: OS | undefined;
96
+ osVersion?: string;
97
+ deviceManufacturer?: string | undefined;
98
+ deviceModel?: string | undefined;
99
+ deviceSecure?: boolean | undefined;
100
+ language?: string | undefined;
101
+ deviceTimezoneId?: string | undefined;
102
+ applicationUserId?: string | undefined;
103
+ deviceName?: string | undefined;
104
+ customAttributes?: Record<string, string | number | boolean> | undefined;
105
+ }
106
+
107
+ export interface UserIdentity {
108
+ phones?: string[] | undefined;
109
+ emails?: string[] | undefined;
110
+ externalUserId?: string;
111
+ }
112
+
113
+ export interface PersonalizeContext {
114
+ userIdentity: UserIdentity;
115
+ userAttributes?: Record<string, string | number | boolean | object[]> | undefined;
116
+ forceDepersonalize?: boolean | undefined;
117
+ }
118
+
119
+ export interface GeoData {
120
+ area: GeoArea;
121
+ }
122
+
123
+ export interface GeoArea {
124
+ id: string;
125
+ center: GeoCenter;
126
+ radius: number;
127
+ title: string;
128
+ }
129
+
130
+ export interface GeoCenter {
131
+ lat: number;
132
+ lon: number;
133
+ }
134
+
135
+ export interface Message {
136
+ messageId: string;
137
+ title?: string | undefined;
138
+ body: string | undefined;
139
+ sound?: string | undefined;
140
+ silent?: string | undefined;
141
+ customPayload?: Record<string, string> | undefined;
142
+ internalData?: string | undefined;
143
+ receivedTimestamp?: number | undefined;
144
+ seenDate?: number | undefined;
145
+ contentUrl?: string | undefined;
146
+ seen?: boolean | undefined;
147
+ geo?: boolean | undefined;
148
+ originalPayload?: Record<string, string> | undefined; // iOS only
149
+ vibrate?: boolean | undefined; // Android only
150
+ icon?: string | undefined; // Android only
151
+ category?: string | undefined; // Android only
152
+ chat?: boolean | undefined;
153
+ browserUrl?: string | undefined;
154
+ deeplink?: string | undefined;
155
+ webViewUrl?: string | undefined;
156
+ inAppOpenTitle?: string | undefined;
157
+ inAppDismissTitle?: string | undefined;
158
+ }
159
+
160
+ export interface MobileMessagingError {
161
+ code: string;
162
+ description: string;
163
+ domain?: string;
164
+ }
165
+
166
+ export interface ChatConfig {
167
+ ios?: {
168
+ showModally: boolean;
169
+ } | undefined;
170
+ }
171
+
172
+ export interface DefaultMessageStorage {
173
+ find(messageId: string, callback: (message: Message) => void): void;
174
+
175
+ findAll(callback: (messages: Message[]) => void): void;
176
+
177
+ delete(messageId: string, callback: () => void): void;
178
+
179
+ deleteAll(callback: () => void): void;
180
+ }
181
+
182
+ export interface CustomMessageStorage {
183
+ /**
184
+ * Will be called by the plugin when messages are received and it's time to save them to the storage
185
+ *
186
+ * @param array of message objects to save to storage
187
+ */
188
+ save(messages: Message[]): void;
189
+
190
+ /**
191
+ * Will be called by the plugin to find a message by message id
192
+ *
193
+ * @param callback has to be called on completion with one parameter - found message object
194
+ */
195
+ find(messageId: string, callback: (message: Message) => void): void;
196
+
197
+ /**
198
+ * Will be called by the plugin to find all messages in the storage
199
+ *
200
+ * @param callback has to be called on completion with one parameter - an array of available messages
201
+ */
202
+ findAll(callback: (messages: Message[]) => void): void;
203
+
204
+ /**
205
+ * Will be called by the plugin when its time to initialize the storage
206
+ */
207
+ start(): void;
208
+
209
+ /**
210
+ * Will be called by the plugin when its time to deinitialize the storage
211
+ */
212
+ stop(): void;
213
+ }
214
+
215
+ export interface CustomEvent {
216
+ definitionId: string;
217
+ properties: Record<string, any>;
218
+ }
219
+
220
+ export interface ChatSettingsIOS {
221
+ title: string;
222
+ sendButtonColor: string;
223
+ navigationBarItemsColor: string;
224
+ navigationBarColor: string;
225
+ navigationBarTitleColor: string;
226
+ }
227
+
228
+ interface Api {
229
+
230
+ inAppChatEvents: [
231
+ "inAppChat.availabilityUpdated",
232
+ "inAppChat.unreadMessageCounterUpdated"
233
+ ];
234
+
235
+ supportedEvents: [
236
+ "messageReceived",
237
+ "notificationTapped",
238
+ "tokenReceived",
239
+ "registrationUpdated",
240
+ "geofenceEntered",
241
+ "actionTapped",
242
+ "installationUpdated",
243
+ "userUpdated",
244
+ "personalized",
245
+ "depersonalized"
246
+ ];
247
+ messageStorageEvents: [
248
+ "messageStorage.start",
249
+ "messageStorage.stop",
250
+ "messageStorage.save",
251
+ "messageStorage.find",
252
+ "messageStorage.findAll"
253
+ ];
254
+
255
+ constructor();
256
+
257
+ /**
258
+ * Starts a new Mobile Messaging session.
259
+ *
260
+ * @param config. Configuration for Mobile Messaging
261
+ * @param callback. callback
262
+ * @param onInitError. Error callback
263
+ */
264
+ init(config: Configuration,
265
+ callback: () => void,
266
+ onInitError?: (error: MobileMessagingError) => void): void;
267
+
268
+ /**
269
+ * Add subscription to event coming from MobileMessaging library.
270
+ *
271
+ * @param eventName
272
+ * @param handler will be called when event occurs
273
+ * @return subscription, to unregister from this subscription call `unsubscribe(subscription)`
274
+ */
275
+ subscribe(eventName: string,
276
+ handler: (data: any) => void
277
+ ): EmitterSubscription;
278
+
279
+ /**
280
+ * Unsubscribe from MobileMessaging library event.
281
+ * This method should be used for react-native versions >= 0.65.
282
+ */
283
+ unsubscribe(subscription: EmitterSubscription): void;
284
+
285
+ /**
286
+ * Unregister all handlers from MobileMessaging library event.
287
+ *
288
+ */
289
+ unregisterAllHandlers(eventName: string): void;
290
+
291
+ /**
292
+ * Sends an event to the server eventually, handles possible errors and do retries for you.
293
+ *
294
+ * @param eventData. An object containing event data
295
+ * {
296
+ * definitionId: "eventDefinitionId"
297
+ * properties: {
298
+ * "stringAttribute": "string",
299
+ * "numberAttribute": 1,
300
+ * "dateAttribute": "2020-02-26T09:41:57Z",
301
+ * "booleanAttribute": true
302
+ * }
303
+ * }
304
+ */
305
+ submitEvent(eventData: CustomEvent): void;
306
+
307
+ /**
308
+ * Sends an event to the server immediately.
309
+ * You have to handle possible connection or server errors, do retries yourself.
310
+ *
311
+ * @param eventData. An object containing event data
312
+ * {
313
+ * definitionId: "eventDefinitionId"
314
+ * properties: {
315
+ * "stringAttribute": "string",
316
+ * "numberAttribute": 1,
317
+ * "dateAttribute": "2020-02-26T09:41:57Z",
318
+ * "booleanAttribute": true
319
+ * }
320
+ * }
321
+ * @param callback will be called on result
322
+ * @param errorCallback will be called on error, you have to handle error and do retries yourself
323
+ */
324
+ submitEventImmediately(eventData: CustomEvent,
325
+ callback: () => void,
326
+ errorCallback: () => void): void;
327
+
328
+ /**
329
+ * Saves user data to the server.
330
+ *
331
+ * @param userData. An object containing user data
332
+ * @param callback will be called on success
333
+ * @param errorCallback will be called on error
334
+ */
335
+ saveUser(userData: UserData,
336
+ callback: (userData: UserData) => void,
337
+ errorCallback: (error: MobileMessagingError) => void): void;
338
+
339
+ /**
340
+ * Fetch user data from the server.
341
+ *
342
+ * @param callback will be called with fetched user data on success
343
+ * @param errorCallback will be called on error
344
+ */
345
+ fetchUser(callback: (userData: UserData) => void, errorCallback: (error: MobileMessagingError) => void): void;
346
+
347
+ /**
348
+ * Gets user data from the locally stored cache.
349
+ *
350
+ * @param callback will be called with fetched user data on success
351
+ * @param errorCallback will be called on error
352
+ */
353
+ getUser(callback: (userData: UserData) => void): void;
354
+
355
+ /**
356
+ * Saves installation to the server.
357
+ *
358
+ * @param installation. An object containing installation data
359
+ * @param callback will be called on success
360
+ * @param errorCallback will be called on error
361
+ */
362
+ saveInstallation(installation: Installation,
363
+ callback: (data: Installation) => void,
364
+ errorCallback: (error: MobileMessagingError) => void): void;
365
+
366
+ /**
367
+ * Fetches installation from the server.
368
+ *
369
+ * @param callback will be called on success
370
+ * @param errorCallback will be called on error
371
+ */
372
+ fetchInstallation(callback: (installation: Installation) => void, errorCallback: (error: MobileMessagingError) => void): void;
373
+
374
+ /**
375
+ * Gets locally cached installation.
376
+ *
377
+ * @param callback will be called on success
378
+ * @param errorCallback will be called on error
379
+ */
380
+ getInstallation(callback: (installation: Installation) => void): void;
381
+
382
+ /**
383
+ * Sets any installation as primary for this user.
384
+ *
385
+ * @param pushRegistrationId of an installation
386
+ * @param primary or not
387
+ * @param callback will be called on success
388
+ * @param errorCallback will be called on error
389
+ */
390
+ setInstallationAsPrimary(pushRegistrationId: string,
391
+ primary: boolean,
392
+ callback: (installation: Installation) => void,
393
+ errorCallback: (error: MobileMessagingError) => void): void;
394
+
395
+ /**
396
+ * Performs personalization of the current installation on the platform.
397
+ *
398
+ * @param context. An object containing user identity information as well as additional user attributes.
399
+ * @param callback will be called on success
400
+ * @param errorCallback will be called on error
401
+ */
402
+ personalize(context: PersonalizeContext,
403
+ callback: (personalizeContext: PersonalizeContext) => void,
404
+ errorCallback: (error: MobileMessagingError) => void): void;
405
+
406
+ /**
407
+ * Performs depersonalization of the current installation on the platform.
408
+ *
409
+ * @param callback will be called on success
410
+ * @param errorCallback will be called on error
411
+ */
412
+ depersonalize(callback: (personalizeContext: PersonalizeContext) => void,
413
+ errorCallback: (error: MobileMessagingError) => void): void;
414
+
415
+ /**
416
+ * Performs depersonalization of the installation referenced by pushRegistrationId.
417
+ *
418
+ * @param pushRegistrationId of the remote installation to depersonalize
419
+ * @param callback will be called on success
420
+ * @param errorCallback will be called on error
421
+ */
422
+ depersonalizeInstallation(pushRegistrationId: string,
423
+ callback: (installation: Installation) => void,
424
+ errorCallback: (error: MobileMessagingError) => void): void;
425
+
426
+ /**
427
+ * Mark messages as seen
428
+ *
429
+ * @param messageIds of identifiers of message to mark as seen
430
+ * @param callback will be called upon completion
431
+ * @param errorCallback will be called on error
432
+ */
433
+ markMessagesSeen(messageIds: string[],
434
+ callback: (messages: Message[]) => void,
435
+ errorCallback: (error: MobileMessagingError) => void): void;
436
+
437
+ /**
438
+ * Displays built-in error dialog so that user can resolve errors during sdk initialization.
439
+ *
440
+ * @param errorCode to display dialog for
441
+ * @param callback will be called upon completion
442
+ * @param errorCallback will be called on error
443
+ */
444
+ showDialogForError(errorCode: number,
445
+ callback: () => void,
446
+ errorCallback: (error: MobileMessagingError) => void): void;
447
+
448
+ defaultMessageStorage(): DefaultMessageStorage | undefined;
449
+
450
+ /**
451
+ * Displays chat view
452
+ * @param config
453
+ */
454
+ showChat(config?: ChatConfig): void;
455
+
456
+ /**
457
+ * Setup chat settings for iOS only
458
+ *
459
+ * @param settings
460
+ */
461
+ setupiOSChatSettings(settings: ChatSettingsIOS): void;
462
+
463
+ /**
464
+ * Returns unread in-app chat push messages counter.
465
+ * The counter increments each time the application receives in-app chat push message
466
+ * (this usually happens when chat screen is inactive or the application is in background/terminated state).
467
+ */
468
+ getMessageCounter(onResult: (counter: number) => void): void;
469
+
470
+ /**
471
+ * MobileMessaging plugin automatically resets the counter to 0 whenever user opens the in-app chat screen.
472
+ * However, use the following API in case you need to manually reset the counter.
473
+ */
474
+ resetMessageCounter(): void;
475
+
476
+ /**
477
+ * This is used for requesting Location permissions for Android
478
+ * @param rationale rationale to display if it's needed. Describing why this permissions required.
479
+ * Mobile Messaging SDK requires following permissions to be able to send geo targeted notifications, even if application is killed or on background.
480
+ * ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION, ACCESS_BACKGROUND_LOCATION
481
+ * @return
482
+ */
483
+ requestAndroidPermissions(rationale?: Rationale): Promise<boolean>;
484
+ }
485
+ }
486
+
487
+ declare var mobileMessaging: MobileMessagingReactNative.Api;
@@ -12,15 +12,15 @@ Pod::Spec.new do |s|
12
12
  s.homepage = "https://github.com/infobip/mobile-messaging-react-native-plugin"
13
13
  s.license = "MIT"
14
14
  s.authors = { "Infobip" => "Push.Support@infobip.com" }
15
- s.platforms = { :ios => "10.0" }
15
+ s.platforms = { :ios => "12.0" }
16
16
  s.source = { :git => 'https://github.com/infobip/mobile-messaging-react-native-plugin.git', :tag => s.version}
17
17
  s.swift_version = '5'
18
18
  s.source_files = "ios/**/*.{h,m,swift}"
19
19
  s.requires_arc = true
20
20
 
21
21
  s.dependency "React-Core"
22
- s.dependency "MobileMessaging/Core", "9.2.16"
23
- s.dependency "MobileMessaging/Geofencing", "9.2.16"
24
- s.dependency "MobileMessaging/InAppChat", "9.2.16"
22
+ s.dependency "MobileMessaging/Core", "10.2.1"
23
+ s.dependency "MobileMessaging/Geofencing", "10.2.1"
24
+ s.dependency "MobileMessaging/InAppChat", "10.2.1"
25
25
 
26
26
  end
package/ios/Cartfile CHANGED
@@ -1 +1 @@
1
- github "infobip/mobile-messaging-sdk-ios" "9.2.16"
1
+ github "infobip/mobile-messaging-sdk-ios" "10.2.1"
@@ -1 +1 @@
1
- github "infobip/mobile-messaging-sdk-ios" "9.2.16"
1
+ github "infobip/mobile-messaging-sdk-ios" "10.2.1"
@@ -4,3 +4,4 @@
4
4
 
5
5
  #import <React/RCTBridgeModule.h>
6
6
  #import <React/RCTEventEmitter.h>
7
+ #import <React/RCTViewManager.h>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "infobip-mobile-messaging-react-native-plugin",
3
3
  "title": "Infobip Mobile Messaging React Native Plugin",
4
- "version": "6.0.0",
4
+ "version": "6.2.1",
5
5
  "description": "Infobip Mobile Messaging React Native Plugin",
6
6
  "main": "index.js",
7
7
  "scripts": {