@trycourier/courier-react-native 5.5.0 → 5.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/courierreactnative/CourierClientModule.kt +298 -303
- package/android/src/main/java/com/courierreactnative/CourierSharedModule.kt +183 -153
- package/android/src/main/java/com/courierreactnative/Utils.kt +1 -1
- package/ios/CourierReactNativeDelegate.m +1 -1
- package/ios/CourierReactNativeEventEmitter.swift +1 -1
- package/package.json +1 -1
|
@@ -15,7 +15,13 @@ import kotlinx.coroutines.Dispatchers
|
|
|
15
15
|
import kotlinx.coroutines.launch
|
|
16
16
|
import java.util.UUID
|
|
17
17
|
|
|
18
|
-
class CourierClientModule(
|
|
18
|
+
class CourierClientModule(
|
|
19
|
+
reactContext: ReactApplicationContext
|
|
20
|
+
) : ReactNativeModule(
|
|
21
|
+
tag = "Client Error",
|
|
22
|
+
name = "CourierClientModule",
|
|
23
|
+
reactContext = reactContext
|
|
24
|
+
) {
|
|
19
25
|
|
|
20
26
|
private var clients: MutableMap<String, CourierClient> = mutableMapOf()
|
|
21
27
|
|
|
@@ -31,7 +37,6 @@ class CourierClientModule(reactContext: ReactApplicationContext): ReactNativeMod
|
|
|
31
37
|
|
|
32
38
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
33
39
|
fun addClient(options: ReadableMap): String {
|
|
34
|
-
|
|
35
40
|
val userId = options.getString("userId")
|
|
36
41
|
val showLogs = if (options.hasKey("showLogs")) options.getBoolean("showLogs") else null
|
|
37
42
|
|
|
@@ -52,7 +57,6 @@ class CourierClientModule(reactContext: ReactApplicationContext): ReactNativeMod
|
|
|
52
57
|
clients[uuid] = client
|
|
53
58
|
|
|
54
59
|
return uuid
|
|
55
|
-
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
@@ -64,378 +68,369 @@ class CourierClientModule(reactContext: ReactApplicationContext): ReactNativeMod
|
|
|
64
68
|
// Tokens
|
|
65
69
|
|
|
66
70
|
@ReactMethod
|
|
67
|
-
fun putUserToken(clientId: String, token: String, provider: String, device: ReadableMap?, promise: Promise)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
fun putUserToken(clientId: String, token: String, provider: String, device: ReadableMap?, promise: Promise) {
|
|
72
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
73
|
+
val client = clients[clientId]
|
|
74
|
+
if (client == null) {
|
|
75
|
+
promise.rejectMissingClient()
|
|
76
|
+
return@launch
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (reactActivity == null) {
|
|
80
|
+
promise.rejectMissingContext()
|
|
81
|
+
return@launch
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
val courierDevice = device?.let {
|
|
85
|
+
CourierDevice(
|
|
86
|
+
appId = it.getString("appId"),
|
|
87
|
+
adId = it.getString("adId"),
|
|
88
|
+
deviceId = it.getString("deviceId"),
|
|
89
|
+
platform = it.getString("platform"),
|
|
90
|
+
manufacturer = it.getString("manufacturer"),
|
|
91
|
+
model = it.getString("model")
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
try {
|
|
96
|
+
client.tokens.putUserToken(
|
|
97
|
+
token = token,
|
|
98
|
+
provider = provider,
|
|
99
|
+
device = courierDevice ?: CourierDevice.current(reactActivity!!)
|
|
100
|
+
)
|
|
101
|
+
promise.resolve(null)
|
|
102
|
+
} catch (e: Exception) {
|
|
103
|
+
promise.apiError(e)
|
|
104
|
+
}
|
|
78
105
|
}
|
|
79
|
-
|
|
80
|
-
val courierDevice = device?.let {
|
|
81
|
-
return@let CourierDevice(
|
|
82
|
-
appId = it.getString("appId"),
|
|
83
|
-
adId = it.getString("adId"),
|
|
84
|
-
deviceId = it.getString("deviceId"),
|
|
85
|
-
platform = it.getString("platform"),
|
|
86
|
-
manufacturer = it.getString("manufacturer"),
|
|
87
|
-
model = it.getString("model")
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
try {
|
|
92
|
-
client.tokens.putUserToken(
|
|
93
|
-
token = token,
|
|
94
|
-
provider = provider,
|
|
95
|
-
device = courierDevice ?: CourierDevice.current(reactActivity!!)
|
|
96
|
-
)
|
|
97
|
-
promise.resolve(null)
|
|
98
|
-
} catch (e: Exception) {
|
|
99
|
-
promise.apiError(e)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
106
|
}
|
|
103
107
|
|
|
104
108
|
@ReactMethod
|
|
105
|
-
fun deleteUserToken(clientId: String, token: String, promise: Promise)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
promise.apiError(e)
|
|
109
|
+
fun deleteUserToken(clientId: String, token: String, promise: Promise) {
|
|
110
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
111
|
+
val client = clients[clientId]
|
|
112
|
+
if (client == null) {
|
|
113
|
+
promise.rejectMissingClient()
|
|
114
|
+
return@launch
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
client.tokens.deleteUserToken(token = token)
|
|
119
|
+
promise.resolve(null)
|
|
120
|
+
} catch (e: Exception) {
|
|
121
|
+
promise.apiError(e)
|
|
122
|
+
}
|
|
120
123
|
}
|
|
121
|
-
|
|
122
124
|
}
|
|
123
125
|
|
|
124
126
|
// Brands
|
|
125
127
|
|
|
126
128
|
@ReactMethod
|
|
127
|
-
fun getBrand(clientId: String, brandId: String, promise: Promise)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
fun getBrand(clientId: String, brandId: String, promise: Promise) {
|
|
130
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
131
|
+
val client = clients[clientId]
|
|
132
|
+
if (client == null) {
|
|
133
|
+
promise.rejectMissingClient()
|
|
134
|
+
return@launch
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
val brand = client.brands.getBrand(brandId = brandId)
|
|
139
|
+
val json = brand.toJson()
|
|
140
|
+
promise.resolve(json)
|
|
141
|
+
} catch (e: Exception) {
|
|
142
|
+
promise.apiError(e)
|
|
143
|
+
}
|
|
133
144
|
}
|
|
134
|
-
|
|
135
|
-
try {
|
|
136
|
-
val brand = client.brands.getBrand(
|
|
137
|
-
brandId = brandId
|
|
138
|
-
)
|
|
139
|
-
val json = brand.toJson()
|
|
140
|
-
promise.resolve(json)
|
|
141
|
-
} catch (e: Exception) {
|
|
142
|
-
promise.apiError(e)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
// Inbox
|
|
148
148
|
|
|
149
149
|
@ReactMethod
|
|
150
|
-
fun getMessages(clientId: String, paginationLimit: Int, startCursor: String?, promise: Promise)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
150
|
+
fun getMessages(clientId: String, paginationLimit: Int, startCursor: String?, promise: Promise) {
|
|
151
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
152
|
+
val client = clients[clientId]
|
|
153
|
+
if (client == null) {
|
|
154
|
+
promise.rejectMissingClient()
|
|
155
|
+
return@launch
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
try {
|
|
159
|
+
val res = client.inbox.getMessages(
|
|
160
|
+
paginationLimit = paginationLimit,
|
|
161
|
+
startCursor = startCursor
|
|
162
|
+
)
|
|
163
|
+
val json = res.toJson()
|
|
164
|
+
promise.resolve(json)
|
|
165
|
+
} catch (e: Exception) {
|
|
166
|
+
promise.apiError(e)
|
|
167
|
+
}
|
|
156
168
|
}
|
|
157
|
-
|
|
158
|
-
try {
|
|
159
|
-
val res = client.inbox.getMessages(
|
|
160
|
-
paginationLimit = paginationLimit,
|
|
161
|
-
startCursor = startCursor,
|
|
162
|
-
)
|
|
163
|
-
val json = res.toJson()
|
|
164
|
-
promise.resolve(json)
|
|
165
|
-
} catch (e: Exception) {
|
|
166
|
-
promise.apiError(e)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
@ReactMethod
|
|
172
|
-
fun getArchivedMessages(clientId: String, paginationLimit: Int, startCursor: String?, promise: Promise)
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
172
|
+
fun getArchivedMessages(clientId: String, paginationLimit: Int, startCursor: String?, promise: Promise) {
|
|
173
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
174
|
+
val client = clients[clientId]
|
|
175
|
+
if (client == null) {
|
|
176
|
+
promise.rejectMissingClient()
|
|
177
|
+
return@launch
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
try {
|
|
181
|
+
val res = client.inbox.getArchivedMessages(
|
|
182
|
+
paginationLimit = paginationLimit,
|
|
183
|
+
startCursor = startCursor
|
|
184
|
+
)
|
|
185
|
+
val json = res.toJson()
|
|
186
|
+
promise.resolve(json)
|
|
187
|
+
} catch (e: Exception) {
|
|
188
|
+
promise.apiError(e)
|
|
189
|
+
}
|
|
189
190
|
}
|
|
190
|
-
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
@ReactMethod
|
|
194
|
-
fun getMessageById(clientId: String, messageId: String, promise: Promise)
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
promise.apiError(e)
|
|
194
|
+
fun getMessageById(clientId: String, messageId: String, promise: Promise) {
|
|
195
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
196
|
+
val client = clients[clientId]
|
|
197
|
+
if (client == null) {
|
|
198
|
+
promise.rejectMissingClient()
|
|
199
|
+
return@launch
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
try {
|
|
203
|
+
val res = client.inbox.getMessage(messageId = messageId)
|
|
204
|
+
val json = res.toJson()
|
|
205
|
+
promise.resolve(json)
|
|
206
|
+
} catch (e: Exception) {
|
|
207
|
+
promise.apiError(e)
|
|
208
|
+
}
|
|
210
209
|
}
|
|
211
|
-
|
|
212
210
|
}
|
|
213
211
|
|
|
214
212
|
@ReactMethod
|
|
215
|
-
fun getUnreadMessageCount(clientId: String, promise: Promise)
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
213
|
+
fun getUnreadMessageCount(clientId: String, promise: Promise) {
|
|
214
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
215
|
+
val client = clients[clientId]
|
|
216
|
+
if (client == null) {
|
|
217
|
+
promise.rejectMissingClient()
|
|
218
|
+
return@launch
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
try {
|
|
222
|
+
val count = client.inbox.getUnreadMessageCount()
|
|
223
|
+
promise.resolve(count)
|
|
224
|
+
} catch (e: Exception) {
|
|
225
|
+
promise.apiError(e)
|
|
226
|
+
}
|
|
221
227
|
}
|
|
222
|
-
|
|
223
|
-
try {
|
|
224
|
-
val count = client.inbox.getUnreadMessageCount()
|
|
225
|
-
promise.resolve(count)
|
|
226
|
-
} catch (e: Exception) {
|
|
227
|
-
promise.apiError(e)
|
|
228
|
-
}
|
|
229
|
-
|
|
230
228
|
}
|
|
231
229
|
|
|
232
230
|
@ReactMethod
|
|
233
|
-
fun openMessage(clientId: String, messageId: String, promise: Promise)
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
)
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
promise.apiError(e)
|
|
231
|
+
fun openMessage(clientId: String, messageId: String, promise: Promise) {
|
|
232
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
233
|
+
val client = clients[clientId]
|
|
234
|
+
if (client == null) {
|
|
235
|
+
promise.rejectMissingClient()
|
|
236
|
+
return@launch
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
try {
|
|
240
|
+
client.inbox.open(messageId = messageId)
|
|
241
|
+
promise.resolve(null)
|
|
242
|
+
} catch (e: Exception) {
|
|
243
|
+
promise.apiError(e)
|
|
244
|
+
}
|
|
248
245
|
}
|
|
249
|
-
|
|
250
246
|
}
|
|
251
247
|
|
|
252
248
|
@ReactMethod
|
|
253
|
-
fun readMessage(clientId: String, messageId: String, promise: Promise)
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
)
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
promise.apiError(e)
|
|
249
|
+
fun readMessage(clientId: String, messageId: String, promise: Promise) {
|
|
250
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
251
|
+
val client = clients[clientId]
|
|
252
|
+
if (client == null) {
|
|
253
|
+
promise.rejectMissingClient()
|
|
254
|
+
return@launch
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
try {
|
|
258
|
+
client.inbox.read(messageId = messageId)
|
|
259
|
+
promise.resolve(null)
|
|
260
|
+
} catch (e: Exception) {
|
|
261
|
+
promise.apiError(e)
|
|
262
|
+
}
|
|
268
263
|
}
|
|
269
|
-
|
|
270
264
|
}
|
|
271
265
|
|
|
272
266
|
@ReactMethod
|
|
273
|
-
fun unreadMessage(clientId: String, messageId: String, promise: Promise)
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
267
|
+
fun unreadMessage(clientId: String, messageId: String, promise: Promise) {
|
|
268
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
269
|
+
val client = clients[clientId]
|
|
270
|
+
if (client == null) {
|
|
271
|
+
promise.rejectMissingClient()
|
|
272
|
+
return@launch
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
try {
|
|
276
|
+
client.inbox.unread(messageId = messageId)
|
|
277
|
+
promise.resolve(null)
|
|
278
|
+
} catch (e: Exception) {
|
|
279
|
+
promise.apiError(e)
|
|
280
|
+
}
|
|
279
281
|
}
|
|
280
|
-
|
|
281
|
-
try {
|
|
282
|
-
client.inbox.unread(
|
|
283
|
-
messageId = messageId,
|
|
284
|
-
)
|
|
285
|
-
promise.resolve(null)
|
|
286
|
-
} catch (e: Exception) {
|
|
287
|
-
promise.apiError(e)
|
|
288
|
-
}
|
|
289
|
-
|
|
290
282
|
}
|
|
291
283
|
|
|
292
284
|
@ReactMethod
|
|
293
|
-
fun clickMessage(clientId: String, messageId: String, trackingId: String, promise: Promise)
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
285
|
+
fun clickMessage(clientId: String, messageId: String, trackingId: String, promise: Promise) {
|
|
286
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
287
|
+
val client = clients[clientId]
|
|
288
|
+
if (client == null) {
|
|
289
|
+
promise.rejectMissingClient()
|
|
290
|
+
return@launch
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
try {
|
|
294
|
+
client.inbox.click(
|
|
295
|
+
messageId = messageId,
|
|
296
|
+
trackingId = trackingId
|
|
297
|
+
)
|
|
298
|
+
promise.resolve(null)
|
|
299
|
+
} catch (e: Exception) {
|
|
300
|
+
promise.apiError(e)
|
|
301
|
+
}
|
|
299
302
|
}
|
|
300
|
-
|
|
301
|
-
try {
|
|
302
|
-
client.inbox.click(
|
|
303
|
-
messageId = messageId,
|
|
304
|
-
trackingId = trackingId,
|
|
305
|
-
)
|
|
306
|
-
promise.resolve(null)
|
|
307
|
-
} catch (e: Exception) {
|
|
308
|
-
promise.apiError(e)
|
|
309
|
-
}
|
|
310
|
-
|
|
311
303
|
}
|
|
312
304
|
|
|
313
305
|
@ReactMethod
|
|
314
|
-
fun archiveMessage(clientId: String, messageId: String, promise: Promise)
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
)
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
promise.apiError(e)
|
|
306
|
+
fun archiveMessage(clientId: String, messageId: String, promise: Promise) {
|
|
307
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
308
|
+
val client = clients[clientId]
|
|
309
|
+
if (client == null) {
|
|
310
|
+
promise.rejectMissingClient()
|
|
311
|
+
return@launch
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
try {
|
|
315
|
+
client.inbox.archive(messageId = messageId)
|
|
316
|
+
promise.resolve(null)
|
|
317
|
+
} catch (e: Exception) {
|
|
318
|
+
promise.apiError(e)
|
|
319
|
+
}
|
|
329
320
|
}
|
|
330
|
-
|
|
331
321
|
}
|
|
332
322
|
|
|
333
323
|
@ReactMethod
|
|
334
|
-
fun readAllMessages(clientId: String, promise: Promise)
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
324
|
+
fun readAllMessages(clientId: String, promise: Promise) {
|
|
325
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
326
|
+
val client = clients[clientId]
|
|
327
|
+
if (client == null) {
|
|
328
|
+
promise.rejectMissingClient()
|
|
329
|
+
return@launch
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
try {
|
|
333
|
+
client.inbox.readAll()
|
|
334
|
+
promise.resolve(null)
|
|
335
|
+
} catch (e: Exception) {
|
|
336
|
+
promise.apiError(e)
|
|
337
|
+
}
|
|
347
338
|
}
|
|
348
|
-
|
|
349
339
|
}
|
|
350
340
|
|
|
351
341
|
// Preferences
|
|
352
342
|
|
|
353
343
|
@ReactMethod
|
|
354
|
-
fun getUserPreferences(clientId: String, paginationCursor: String?, promise: Promise)
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
344
|
+
fun getUserPreferences(clientId: String, paginationCursor: String?, promise: Promise) {
|
|
345
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
346
|
+
val client = clients[clientId]
|
|
347
|
+
if (client == null) {
|
|
348
|
+
promise.rejectMissingClient()
|
|
349
|
+
return@launch
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
try {
|
|
353
|
+
val res = client.preferences.getUserPreferences(
|
|
354
|
+
paginationCursor = paginationCursor
|
|
355
|
+
)
|
|
356
|
+
val json = res.toJson()
|
|
357
|
+
promise.resolve(json)
|
|
358
|
+
} catch (e: Exception) {
|
|
359
|
+
promise.apiError(e)
|
|
360
|
+
}
|
|
360
361
|
}
|
|
361
|
-
|
|
362
|
-
try {
|
|
363
|
-
val res = client.preferences.getUserPreferences(
|
|
364
|
-
paginationCursor = paginationCursor
|
|
365
|
-
)
|
|
366
|
-
val json = res.toJson()
|
|
367
|
-
promise.resolve(json)
|
|
368
|
-
} catch (e: Exception) {
|
|
369
|
-
promise.apiError(e)
|
|
370
|
-
}
|
|
371
|
-
|
|
372
362
|
}
|
|
373
363
|
|
|
374
364
|
@ReactMethod
|
|
375
|
-
fun getUserPreferenceTopic(clientId: String, topicId: String, promise: Promise)
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
promise.apiError(e)
|
|
365
|
+
fun getUserPreferenceTopic(clientId: String, topicId: String, promise: Promise) {
|
|
366
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
367
|
+
val client = clients[clientId]
|
|
368
|
+
if (client == null) {
|
|
369
|
+
promise.rejectMissingClient()
|
|
370
|
+
return@launch
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
try {
|
|
374
|
+
val res = client.preferences.getUserPreferenceTopic(topicId = topicId)
|
|
375
|
+
val json = res.toJson()
|
|
376
|
+
promise.resolve(json)
|
|
377
|
+
} catch (e: Exception) {
|
|
378
|
+
promise.apiError(e)
|
|
379
|
+
}
|
|
391
380
|
}
|
|
392
|
-
|
|
393
381
|
}
|
|
394
382
|
|
|
395
383
|
@ReactMethod
|
|
396
|
-
fun putUserPreferenceTopic(
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
client
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
384
|
+
fun putUserPreferenceTopic(
|
|
385
|
+
clientId: String,
|
|
386
|
+
topicId: String,
|
|
387
|
+
status: String,
|
|
388
|
+
hasCustomRouting: Boolean,
|
|
389
|
+
customRouting: ReadableArray,
|
|
390
|
+
promise: Promise
|
|
391
|
+
) {
|
|
392
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
393
|
+
val client = clients[clientId]
|
|
394
|
+
if (client == null) {
|
|
395
|
+
promise.rejectMissingClient()
|
|
396
|
+
return@launch
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
try {
|
|
400
|
+
client.preferences.putUserPreferenceTopic(
|
|
401
|
+
topicId = topicId,
|
|
402
|
+
status = CourierPreferenceStatus.fromString(status),
|
|
403
|
+
hasCustomRouting = hasCustomRouting,
|
|
404
|
+
customRouting = customRouting.toArrayList()
|
|
405
|
+
.map { CourierPreferenceChannel.fromString(it as String) }
|
|
406
|
+
)
|
|
407
|
+
promise.resolve(null)
|
|
408
|
+
} catch (e: Exception) {
|
|
409
|
+
promise.apiError(e)
|
|
410
|
+
}
|
|
414
411
|
}
|
|
415
|
-
|
|
416
412
|
}
|
|
417
413
|
|
|
418
414
|
// Tracking
|
|
419
415
|
|
|
420
416
|
@ReactMethod
|
|
421
|
-
fun postTrackingUrl(clientId: String, url: String, event: String, promise: Promise)
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
417
|
+
fun postTrackingUrl(clientId: String, url: String, event: String, promise: Promise) {
|
|
418
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
419
|
+
val client = clients[clientId]
|
|
420
|
+
if (client == null) {
|
|
421
|
+
promise.rejectMissingClient()
|
|
422
|
+
return@launch
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
try {
|
|
426
|
+
client.tracking.postTrackingUrl(
|
|
427
|
+
url = url,
|
|
428
|
+
event = CourierTrackingEvent.valueOf(event.uppercase())
|
|
429
|
+
)
|
|
430
|
+
promise.resolve(null)
|
|
431
|
+
} catch (e: Exception) {
|
|
432
|
+
promise.apiError(e)
|
|
433
|
+
}
|
|
427
434
|
}
|
|
428
|
-
|
|
429
|
-
try {
|
|
430
|
-
client.tracking.postTrackingUrl(
|
|
431
|
-
url = url,
|
|
432
|
-
event = CourierTrackingEvent.valueOf(event.uppercase()),
|
|
433
|
-
)
|
|
434
|
-
promise.resolve(null)
|
|
435
|
-
} catch (e: Exception) {
|
|
436
|
-
promise.apiError(e)
|
|
437
|
-
}
|
|
438
|
-
|
|
439
435
|
}
|
|
440
|
-
|
|
441
436
|
}
|
|
@@ -34,8 +34,13 @@ import kotlinx.coroutines.CoroutineScope
|
|
|
34
34
|
import kotlinx.coroutines.Dispatchers
|
|
35
35
|
import kotlinx.coroutines.launch
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
class CourierSharedModule(
|
|
38
|
+
reactContext: ReactApplicationContext
|
|
39
|
+
) : ReactNativeModule(
|
|
40
|
+
tag = "Shared Instance Error",
|
|
41
|
+
name = "CourierSharedModule",
|
|
42
|
+
reactContext = reactContext
|
|
43
|
+
) {
|
|
39
44
|
|
|
40
45
|
// Listeners
|
|
41
46
|
private var authenticationListeners = mutableMapOf<String, CourierAuthenticationListener>()
|
|
@@ -82,26 +87,36 @@ class CourierSharedModule(reactContext: ReactApplicationContext): ReactNativeMod
|
|
|
82
87
|
}
|
|
83
88
|
|
|
84
89
|
@ReactMethod
|
|
85
|
-
fun signIn(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
fun signIn(
|
|
91
|
+
accessToken: String,
|
|
92
|
+
clientKey: String?,
|
|
93
|
+
userId: String,
|
|
94
|
+
tenantId: String?,
|
|
95
|
+
showLogs: Boolean,
|
|
96
|
+
promise: Promise
|
|
97
|
+
) {
|
|
98
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
99
|
+
Courier.shared.signIn(
|
|
100
|
+
userId = userId,
|
|
101
|
+
tenantId = tenantId,
|
|
102
|
+
accessToken = accessToken,
|
|
103
|
+
clientKey = clientKey,
|
|
104
|
+
showLogs = showLogs
|
|
105
|
+
)
|
|
106
|
+
promise.resolve(null)
|
|
107
|
+
}
|
|
94
108
|
}
|
|
95
109
|
|
|
96
110
|
@ReactMethod
|
|
97
|
-
fun signOut(promise: Promise)
|
|
98
|
-
|
|
99
|
-
|
|
111
|
+
fun signOut(promise: Promise) {
|
|
112
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
113
|
+
Courier.shared.signOut()
|
|
114
|
+
promise.resolve(null)
|
|
115
|
+
}
|
|
100
116
|
}
|
|
101
117
|
|
|
102
118
|
@ReactMethod
|
|
103
119
|
fun addAuthenticationListener(listenerId: String, promise: Promise) {
|
|
104
|
-
|
|
105
120
|
// Create the listener
|
|
106
121
|
val listener = Courier.shared.addAuthenticationListener { userId ->
|
|
107
122
|
reactApplicationContext.sendEvent(
|
|
@@ -112,24 +127,15 @@ class CourierSharedModule(reactContext: ReactApplicationContext): ReactNativeMod
|
|
|
112
127
|
|
|
113
128
|
// Add the listener to the map
|
|
114
129
|
authenticationListeners[listenerId] = listener
|
|
115
|
-
|
|
116
130
|
promise.resolve(listenerId)
|
|
117
|
-
|
|
118
131
|
}
|
|
119
132
|
|
|
120
133
|
@ReactMethod
|
|
121
134
|
fun removeAuthenticationListener(listenerId: String, promise: Promise) {
|
|
122
|
-
|
|
123
135
|
val listener = authenticationListeners[listenerId]
|
|
124
|
-
|
|
125
|
-
// Disable the listener
|
|
126
136
|
listener?.remove()
|
|
127
|
-
|
|
128
|
-
// Remove the id from the map
|
|
129
137
|
authenticationListeners.remove(listenerId)
|
|
130
|
-
|
|
131
138
|
promise.resolve(listenerId)
|
|
132
|
-
|
|
133
139
|
}
|
|
134
140
|
|
|
135
141
|
@ReactMethod
|
|
@@ -142,28 +148,34 @@ class CourierSharedModule(reactContext: ReactApplicationContext): ReactNativeMod
|
|
|
142
148
|
// Push
|
|
143
149
|
|
|
144
150
|
@ReactMethod
|
|
145
|
-
fun getAllTokens(promise: Promise)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
151
|
+
fun getAllTokens(promise: Promise) {
|
|
152
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
153
|
+
val tokens = Courier.shared.tokens
|
|
154
|
+
val resultMap = Arguments.createMap()
|
|
155
|
+
tokens.forEach { (key, value) ->
|
|
156
|
+
resultMap.putString(key, value)
|
|
157
|
+
}
|
|
158
|
+
promise.resolve(resultMap)
|
|
150
159
|
}
|
|
151
|
-
promise.resolve(resultMap)
|
|
152
160
|
}
|
|
153
161
|
|
|
154
162
|
@ReactMethod
|
|
155
|
-
fun getToken(provider: String, promise: Promise)
|
|
156
|
-
|
|
157
|
-
|
|
163
|
+
fun getToken(provider: String, promise: Promise) {
|
|
164
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
165
|
+
val token = Courier.shared.getToken(provider)
|
|
166
|
+
promise.resolve(token)
|
|
167
|
+
}
|
|
158
168
|
}
|
|
159
169
|
|
|
160
170
|
@ReactMethod
|
|
161
|
-
fun setToken(provider: String, token: String, promise: Promise)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
171
|
+
fun setToken(provider: String, token: String, promise: Promise) {
|
|
172
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
173
|
+
try {
|
|
174
|
+
Courier.shared.setToken(provider, token)
|
|
175
|
+
promise.resolve(null)
|
|
176
|
+
} catch (e: Exception) {
|
|
177
|
+
promise.apiError(e)
|
|
178
|
+
}
|
|
167
179
|
}
|
|
168
180
|
}
|
|
169
181
|
|
|
@@ -181,62 +193,74 @@ class CourierSharedModule(reactContext: ReactApplicationContext): ReactNativeMod
|
|
|
181
193
|
}
|
|
182
194
|
|
|
183
195
|
@ReactMethod
|
|
184
|
-
fun openMessage(messageId: String, promise: Promise)
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
196
|
+
fun openMessage(messageId: String, promise: Promise) {
|
|
197
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
198
|
+
try {
|
|
199
|
+
Courier.shared.openMessage(messageId)
|
|
200
|
+
promise.resolve(null)
|
|
201
|
+
} catch (e: Exception) {
|
|
202
|
+
promise.apiError(e)
|
|
203
|
+
}
|
|
190
204
|
}
|
|
191
205
|
}
|
|
192
206
|
|
|
193
207
|
@ReactMethod
|
|
194
|
-
fun archiveMessage(messageId: String, promise: Promise)
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
208
|
+
fun archiveMessage(messageId: String, promise: Promise) {
|
|
209
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
210
|
+
try {
|
|
211
|
+
Courier.shared.archiveMessage(messageId)
|
|
212
|
+
promise.resolve(null)
|
|
213
|
+
} catch (e: Exception) {
|
|
214
|
+
promise.apiError(e)
|
|
215
|
+
}
|
|
200
216
|
}
|
|
201
217
|
}
|
|
202
218
|
|
|
203
219
|
@ReactMethod
|
|
204
|
-
fun clickMessage(messageId: String, promise: Promise)
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
220
|
+
fun clickMessage(messageId: String, promise: Promise) {
|
|
221
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
222
|
+
try {
|
|
223
|
+
Courier.shared.clickMessage(messageId)
|
|
224
|
+
promise.resolve(null)
|
|
225
|
+
} catch (e: Exception) {
|
|
226
|
+
promise.apiError(e)
|
|
227
|
+
}
|
|
210
228
|
}
|
|
211
229
|
}
|
|
212
230
|
|
|
213
231
|
@ReactMethod
|
|
214
|
-
fun readMessage(messageId: String, promise: Promise)
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
232
|
+
fun readMessage(messageId: String, promise: Promise) {
|
|
233
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
234
|
+
try {
|
|
235
|
+
Courier.shared.readMessage(messageId)
|
|
236
|
+
promise.resolve(null)
|
|
237
|
+
} catch (e: Exception) {
|
|
238
|
+
promise.apiError(e)
|
|
239
|
+
}
|
|
220
240
|
}
|
|
221
241
|
}
|
|
222
242
|
|
|
223
243
|
@ReactMethod
|
|
224
|
-
fun unreadMessage(messageId: String, promise: Promise)
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
244
|
+
fun unreadMessage(messageId: String, promise: Promise) {
|
|
245
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
246
|
+
try {
|
|
247
|
+
Courier.shared.unreadMessage(messageId)
|
|
248
|
+
promise.resolve(null)
|
|
249
|
+
} catch (e: Exception) {
|
|
250
|
+
promise.apiError(e)
|
|
251
|
+
}
|
|
230
252
|
}
|
|
231
253
|
}
|
|
232
254
|
|
|
233
255
|
@ReactMethod
|
|
234
|
-
fun readAllInboxMessages(promise: Promise)
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
256
|
+
fun readAllInboxMessages(promise: Promise) {
|
|
257
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
258
|
+
try {
|
|
259
|
+
Courier.shared.readAllInboxMessages()
|
|
260
|
+
promise.resolve(null)
|
|
261
|
+
} catch (e: Exception) {
|
|
262
|
+
promise.apiError(e)
|
|
263
|
+
}
|
|
240
264
|
}
|
|
241
265
|
}
|
|
242
266
|
|
|
@@ -251,76 +275,77 @@ class CourierSharedModule(reactContext: ReactApplicationContext): ReactNativeMod
|
|
|
251
275
|
pageAddedId: String,
|
|
252
276
|
messageEventId: String,
|
|
253
277
|
promise: Promise
|
|
254
|
-
)
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
278
|
+
) {
|
|
279
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
280
|
+
val listener = Courier.shared.addInboxListener(
|
|
281
|
+
onLoading = { isRefresh ->
|
|
282
|
+
reactApplicationContext.sendEvent(
|
|
283
|
+
eventName = loadingId,
|
|
284
|
+
value = isRefresh
|
|
285
|
+
)
|
|
286
|
+
},
|
|
287
|
+
onError = { e ->
|
|
288
|
+
reactApplicationContext.sendEvent(
|
|
289
|
+
eventName = errorId,
|
|
290
|
+
value = e.message ?: "Courier Inbox Error"
|
|
291
|
+
)
|
|
292
|
+
},
|
|
293
|
+
onUnreadCountChanged = { unreadCount ->
|
|
294
|
+
reactApplicationContext.sendEvent(
|
|
295
|
+
eventName = unreadCountId,
|
|
296
|
+
value = unreadCount
|
|
297
|
+
)
|
|
298
|
+
},
|
|
299
|
+
onTotalCountChanged = { totalCount, feed ->
|
|
300
|
+
val json = Arguments.createMap().apply {
|
|
301
|
+
putString("feed", if (feed == InboxMessageFeed.FEED) "feed" else "archive")
|
|
302
|
+
putInt("totalCount", totalCount)
|
|
303
|
+
}
|
|
304
|
+
reactApplicationContext.sendEvent(
|
|
305
|
+
eventName = totalCountId,
|
|
306
|
+
value = json
|
|
307
|
+
)
|
|
308
|
+
},
|
|
309
|
+
onMessagesChanged = { messages, canPaginate, feed ->
|
|
310
|
+
val json = Arguments.createMap().apply {
|
|
311
|
+
putString("feed", if (feed == InboxMessageFeed.FEED) "feed" else "archive")
|
|
312
|
+
putArray("messages", messages.map { it.toJson() }.toWritableArray())
|
|
313
|
+
putBoolean("canPaginate", canPaginate)
|
|
314
|
+
}
|
|
315
|
+
reactApplicationContext.sendEvent(
|
|
316
|
+
eventName = messagesChangedId,
|
|
317
|
+
value = json
|
|
318
|
+
)
|
|
319
|
+
},
|
|
320
|
+
onPageAdded = { messages, canPaginate, isFirstPage, feed ->
|
|
321
|
+
val json = Arguments.createMap().apply {
|
|
322
|
+
putString("feed", if (feed == InboxMessageFeed.FEED) "feed" else "archive")
|
|
323
|
+
putArray("messages", messages.map { it.toJson() }.toWritableArray())
|
|
324
|
+
putBoolean("canPaginate", canPaginate)
|
|
325
|
+
putBoolean("isFirstPage", isFirstPage)
|
|
326
|
+
}
|
|
327
|
+
reactApplicationContext.sendEvent(
|
|
328
|
+
eventName = pageAddedId,
|
|
329
|
+
value = json
|
|
330
|
+
)
|
|
331
|
+
},
|
|
332
|
+
onMessageEvent = { message, index, feed, event ->
|
|
333
|
+
val json = Arguments.createMap().apply {
|
|
334
|
+
putString("feed", if (feed == InboxMessageFeed.FEED) "feed" else "archive")
|
|
335
|
+
putInt("index", index)
|
|
336
|
+
putString("event", event.value)
|
|
337
|
+
putString("message", message.toJson())
|
|
338
|
+
}
|
|
339
|
+
reactApplicationContext.sendEvent(
|
|
340
|
+
eventName = messageEventId,
|
|
341
|
+
value = json
|
|
342
|
+
)
|
|
289
343
|
}
|
|
290
|
-
|
|
291
|
-
eventName = messagesChangedId,
|
|
292
|
-
value = json
|
|
293
|
-
)
|
|
294
|
-
},
|
|
295
|
-
onPageAdded = { messages, canPaginate, isFirstPage, feed ->
|
|
296
|
-
val json = Arguments.createMap().apply {
|
|
297
|
-
putString("feed", if (feed == InboxMessageFeed.FEED) "feed" else "archive")
|
|
298
|
-
putArray("messages", messages.map { it.toJson() }.toWritableArray())
|
|
299
|
-
putBoolean("canPaginate", canPaginate)
|
|
300
|
-
putBoolean("isFirstPage", isFirstPage)
|
|
301
|
-
}
|
|
302
|
-
reactApplicationContext.sendEvent(
|
|
303
|
-
eventName = pageAddedId,
|
|
304
|
-
value = json
|
|
305
|
-
)
|
|
306
|
-
},
|
|
307
|
-
onMessageEvent = { message, index, feed, event ->
|
|
308
|
-
val json = Arguments.createMap().apply {
|
|
309
|
-
putString("feed", if (feed == InboxMessageFeed.FEED) "feed" else "archive")
|
|
310
|
-
putInt("index", index)
|
|
311
|
-
putString("event", event.value)
|
|
312
|
-
putString("message", message.toJson())
|
|
313
|
-
}
|
|
314
|
-
reactApplicationContext.sendEvent(
|
|
315
|
-
eventName = messageEventId,
|
|
316
|
-
value = json
|
|
317
|
-
)
|
|
318
|
-
}
|
|
319
|
-
)
|
|
320
|
-
|
|
321
|
-
inboxListeners[listenerId] = listener
|
|
344
|
+
)
|
|
322
345
|
|
|
323
|
-
|
|
346
|
+
inboxListeners[listenerId] = listener
|
|
347
|
+
promise.resolve(listenerId)
|
|
348
|
+
}
|
|
324
349
|
}
|
|
325
350
|
|
|
326
351
|
private fun InboxMessageSet.toJson(): WritableMap? {
|
|
@@ -347,19 +372,24 @@ class CourierSharedModule(reactContext: ReactApplicationContext): ReactNativeMod
|
|
|
347
372
|
}
|
|
348
373
|
|
|
349
374
|
@ReactMethod
|
|
350
|
-
fun refreshInbox(promise: Promise)
|
|
351
|
-
|
|
352
|
-
|
|
375
|
+
fun refreshInbox(promise: Promise) {
|
|
376
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
377
|
+
Courier.shared.refreshInbox()
|
|
378
|
+
promise.resolve(null)
|
|
379
|
+
}
|
|
353
380
|
}
|
|
354
381
|
|
|
355
382
|
@ReactMethod
|
|
356
|
-
fun fetchNextPageOfMessages(
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
383
|
+
fun fetchNextPageOfMessages(inboxMessageFeed: String, promise: Promise) {
|
|
384
|
+
CoroutineScope(Dispatchers.Main).launch {
|
|
385
|
+
try {
|
|
386
|
+
val messageSet = Courier.shared.fetchNextInboxPage(
|
|
387
|
+
if (inboxMessageFeed == "archived") InboxMessageFeed.ARCHIVE else InboxMessageFeed.FEED
|
|
388
|
+
)
|
|
389
|
+
promise.resolve(messageSet?.toJson())
|
|
390
|
+
} catch (e: Exception) {
|
|
391
|
+
promise.apiError(e)
|
|
392
|
+
}
|
|
362
393
|
}
|
|
363
394
|
}
|
|
364
|
-
|
|
365
395
|
}
|
|
@@ -15,7 +15,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
|
15
15
|
import com.google.gson.GsonBuilder
|
|
16
16
|
|
|
17
17
|
internal object Utils {
|
|
18
|
-
val COURIER_AGENT = CourierAgent.ReactNativeAndroid(version = "5.5.
|
|
18
|
+
val COURIER_AGENT = CourierAgent.ReactNativeAndroid(version = "5.5.2")
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
internal fun ReactContext.sendEvent(eventName: String, value: Any?) {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
if (self) {
|
|
27
27
|
|
|
28
28
|
// Set the user agent
|
|
29
|
-
Courier.agent = [CourierAgent reactNativeIOS:@"5.5.
|
|
29
|
+
Courier.agent = [CourierAgent reactNativeIOS:@"5.5.2"];
|
|
30
30
|
|
|
31
31
|
// Register for remote notifications
|
|
32
32
|
UIApplication *app = [UIApplication sharedApplication];
|
|
@@ -14,7 +14,7 @@ internal class CourierReactNativeEventEmitter: RCTEventEmitter {
|
|
|
14
14
|
|
|
15
15
|
// Set the user agent
|
|
16
16
|
// Used to know the platform performing requests
|
|
17
|
-
Courier.agent = CourierAgent.reactNativeIOS("5.5.
|
|
17
|
+
Courier.agent = CourierAgent.reactNativeIOS("5.5.2")
|
|
18
18
|
|
|
19
19
|
}
|
|
20
20
|
|