react-native-netmera 1.3.6 → 1.4.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/.idea/{netmera-sdk-react-native.iml → NetmeraSDKReactNative.iml} +0 -0
- package/.idea/modules.xml +1 -1
- package/README.md +277 -188
- package/RNNetmera.podspec +8 -6
- package/android/.gradle/4.10.1/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/4.10.1/fileHashes/fileHashes.lock +0 -0
- package/android/.idea/gradle.xml +0 -2
- package/android/build/generated/source/buildConfig/debug/com/netmera/reactnativesdk/BuildConfig.java +0 -2
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +1 -1
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +16 -0
- package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +2 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +3610 -384
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +1 -1
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +1 -1
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +1 -1
- package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/incremental/packageDebugResources/merger.xml +1 -1
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmera.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraCategoryObject.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraConfiguration$Builder.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraConfiguration.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$10.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$3.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$4.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$5.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$6.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$7.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$8.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule$9.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraModule.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraPushBroadcastReceiver.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraPushHeadlessService.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraUtil$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/com/netmera/reactnativesdk/RNNetmeraUtil.class +0 -0
- package/android/build/intermediates/library_manifest/debug/AndroidManifest.xml +1 -1
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +6 -6
- package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +16 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +2710 -12
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +31 -31
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build.gradle +5 -3
- package/android/local.properties +2 -2
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmera.java +2 -6
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraConfiguration.java +0 -12
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraModule.java +116 -5
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraPushBroadcastReceiver.java +13 -5
- package/android/src/main/java/com/netmera/reactnativesdk/RNNetmeraUtil.java +52 -4
- package/index.js +19 -320
- package/ios/RNNetmera.h +2 -2
- package/ios/RNNetmera.m +64 -2
- package/ios/RNNetmeraUtils.h +4 -0
- package/ios/RNNetmeraUtils.m +38 -0
- package/package.json +1 -1
- package/src/Netmera.js +223 -0
- package/src/NetmeraInbox.js +95 -0
- package/src/NetmeraUser.js +92 -0
- package/.idea/misc.xml +0 -7
- package/android/build/.transforms/07da1e78aa5e2a23e865850e1fa31195/classes/classes.dex +0 -0
- package/android/build/.transforms/07da1e78aa5e2a23e865850e1fa31195.bin +0 -1
- package/android/build/.transforms/1cc655d17744898d5287444bc3b54ccd/classes/classes.dex +0 -0
- package/android/build/.transforms/1cc655d17744898d5287444bc3b54ccd.bin +0 -1
- package/android/build/.transforms/1d7e2a596c5a01e1599ed8d99d8fed25/classes/classes.dex +0 -0
- package/android/build/.transforms/1d7e2a596c5a01e1599ed8d99d8fed25.bin +0 -1
- package/android/build/.transforms/61070ab087fd3e8aaad4987d1cd9aeb2/classes/classes.dex +0 -0
- package/android/build/.transforms/61070ab087fd3e8aaad4987d1cd9aeb2.bin +0 -1
- package/android/build/.transforms/6bd284ae922673d08694a1221c01809c/classes/classes.dex +0 -0
- package/android/build/.transforms/6bd284ae922673d08694a1221c01809c.bin +0 -1
- package/android/build/.transforms/a8f21d984467d686c5d11cdc3f508ab2/classes/classes.dex +0 -0
- package/android/build/.transforms/a8f21d984467d686c5d11cdc3f508ab2.bin +0 -1
- package/android/build/.transforms/ae3b3ad311ea4fe5b0c3652f1d5b8a07/classes/classes.dex +0 -0
- package/android/build/.transforms/ae3b3ad311ea4fe5b0c3652f1d5b8a07.bin +0 -1
- package/android/build/.transforms/cc45f1af54894b49e3ec8f6b5a05a8d7/classes/classes.dex +0 -0
- package/android/build/.transforms/cc45f1af54894b49e3ec8f6b5a05a8d7.bin +0 -1
- package/android/build/.transforms/f58e3ec11746c18253c1a7a566c2609f/classes/classes.dex +0 -0
- package/android/build/.transforms/f58e3ec11746c18253c1a7a566c2609f.bin +0 -1
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output.json +0 -27
- package/android/build/intermediates/compile_only_not_namespaced_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/incremental/debug-mergeNativeLibs/merge-state +0 -0
- package/android/build/intermediates/merged_manifests/debug/output.json +0 -27
- package/ios/RNNetmera.xcodeproj/xcuserdata/ensarbayhan.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
package/index.js
CHANGED
|
@@ -1,320 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
static get PUSH_OBJECT_STATUS_DELETED() {
|
|
23
|
-
return 4
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
static get PUSH_OBJECT_STATUS_ALL() {
|
|
27
|
-
return 7
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static initBroadcastReceiver(onPushRegister,
|
|
31
|
-
onPushReceive,
|
|
32
|
-
onPushOpen,
|
|
33
|
-
onPushDismiss,
|
|
34
|
-
onPushButtonClicked) {
|
|
35
|
-
if (onPushRegister) {
|
|
36
|
-
if (Platform.OS === 'android') {
|
|
37
|
-
AppRegistry.registerHeadlessTask("onPushRegister", () => onPushRegister);
|
|
38
|
-
} else {
|
|
39
|
-
netmeraRCTEventEmitter.addListener("onPushRegister", onPushRegister)
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (onPushReceive) {
|
|
43
|
-
if (Platform.OS === 'android') {
|
|
44
|
-
AppRegistry.registerHeadlessTask("onPushReceive", () => onPushReceive);
|
|
45
|
-
} else {
|
|
46
|
-
netmeraRCTEventEmitter.addListener("onPushReceive", onPushReceive)
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (onPushOpen) {
|
|
50
|
-
if (Platform.OS === 'android') {
|
|
51
|
-
AppRegistry.registerHeadlessTask("onPushOpen", () => onPushOpen);
|
|
52
|
-
} else {
|
|
53
|
-
netmeraRCTEventEmitter.addListener("onPushOpen", onPushOpen)
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (onPushDismiss) {
|
|
57
|
-
if (Platform.OS === 'android') {
|
|
58
|
-
AppRegistry.registerHeadlessTask("onPushDismiss", () => onPushDismiss);
|
|
59
|
-
} else {
|
|
60
|
-
netmeraRCTEventEmitter.addListener("onPushDismiss", onPushDismiss)
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (onPushButtonClicked) {
|
|
64
|
-
if (Platform.OS === 'android') {
|
|
65
|
-
AppRegistry.registerHeadlessTask("onPushButtonClicked", () => onPushButtonClicked);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
static async currentExternalId(): Promise<string> {
|
|
71
|
-
return RNNetmera.currentExternalId()
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
static logging(enabled: boolean) {
|
|
75
|
-
RNNetmera.logging(enabled)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
static setBaseUrl(baseUrl: string) {
|
|
79
|
-
RNNetmera.setBaseUrl(baseUrl)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
static requestPushNotificationAuthorization() {
|
|
83
|
-
if (Platform.OS === "ios") {
|
|
84
|
-
RNNetmera.requestPushNotificationAuthorization()
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
static requestPermissionsForLocation() {
|
|
89
|
-
RNNetmera.requestPermissionsForLocation()
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
static setNetmeraMaxActiveRegions(maxActiveRegions: number) {
|
|
93
|
-
RNNetmera.setNetmeraMaxActiveRegions(maxActiveRegions)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
static enablePopupPresentation() {
|
|
97
|
-
RNNetmera.enablePopupPresentation()
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
static disablePopupPresentation() {
|
|
101
|
-
RNNetmera.disablePopupPresentation()
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
static async isPushEnabled(): Promise<boolean> {
|
|
105
|
-
return RNNetmera.isPushEnabled()
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
static enablePush() {
|
|
109
|
-
RNNetmera.enablePush()
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
static disablePush() {
|
|
113
|
-
RNNetmera.disablePush()
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
static turnOffSendingEventAndUserUpdate(turnOff: boolean) {
|
|
117
|
-
if (Platform.OS === 'android') {
|
|
118
|
-
RNNetmera.turnOffSendingEventAndUserUpdate(turnOff)
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
static fetchInbox(netmeraInboxFilter: NetmeraInboxFilter): Promise<Array<NetmeraPushInbox>> {
|
|
123
|
-
return RNNetmera.fetchInbox(netmeraInboxFilter)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
static fetchNextPage(): Promise<Array<NetmeraPushInbox>> {
|
|
127
|
-
return RNNetmera.fetchNextPage();
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
static countForStatus(status = this.PUSH_OBJECT_STATUS_UNREAD) {
|
|
131
|
-
return RNNetmera.countForStatus(status)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
static inboxUpdateStatus(fromIndex: number, toIndex: number, status: number = this.PUSH_OBJECT_STATUS_UNREAD) {
|
|
135
|
-
return RNNetmera.inboxUpdateStatus(fromIndex, toIndex, status)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
static fetchCategory(categoryFilter: NetmeraCategoryFilter): Promise<Array<NetmeraCategory>> {
|
|
139
|
-
return RNNetmera.fetchCategory(categoryFilter)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
static fetchNextCategoryPage(): Promise<Array<NetmeraCategory>> {
|
|
143
|
-
return RNNetmera.fetchNextCategoryPage();
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
static sendEvent(event) {
|
|
147
|
-
RNNetmera.sendEvent(event)
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
static updateUser(user: NetmeraUser) {
|
|
151
|
-
RNNetmera.updateUser(user)
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
static updateAll(inboxStatus: number) {
|
|
155
|
-
return RNNetmera.updateAll(inboxStatus)
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
static handlePushObject(pushId: string) {
|
|
159
|
-
RNNetmera.handlePushObject(pushId)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
static handleInteractiveAction(pushId: string) {
|
|
163
|
-
RNNetmera.handleInteractiveAction(pushId)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
static setApiKey(apiKey: string) {
|
|
167
|
-
RNNetmera.setApiKey(apiKey)
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
static handleLastMessage(categoryName: string) {
|
|
171
|
-
RNNetmera.handleLastMessage(categoryName)
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
static updateStatusByCategories(fromIndex: number, toIndex: number, status: number = this.PUSH_OBJECT_STATUS_UNREAD) {
|
|
175
|
-
return RNNetmera.updateStatusByCategories(fromIndex, toIndex, status)
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
class NetmeraUser {
|
|
181
|
-
|
|
182
|
-
static get GENDER_MALE() {
|
|
183
|
-
return 0
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
static get GENDER_FEMALE() {
|
|
187
|
-
return 1
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
static get GENDER_NOT_SPECIFIED() {
|
|
191
|
-
return 2
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
static get MARITAL_STATUS_SINGLE() {
|
|
195
|
-
return 0
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
static get MARITAL_STATUS_MARRIED() {
|
|
199
|
-
return 1
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
static get MARITAL_STATUS_NOT_SPECIFIED() {
|
|
203
|
-
return 2
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
constructor() {
|
|
207
|
-
this.userId = null;
|
|
208
|
-
this.msisdn = null;
|
|
209
|
-
this.email = null
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
set name(value) {
|
|
213
|
-
this.pa = value
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
set surname(value) {
|
|
217
|
-
this.pb = value
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
set externalSegments(value) {
|
|
221
|
-
this.pc = value
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
set gender(value) {
|
|
225
|
-
this.pd = value
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
set dateOfBirth(value) {
|
|
229
|
-
this.pe = value
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
set maritalStatus(value) {
|
|
233
|
-
this.pf = value
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
set childCount(value) {
|
|
237
|
-
this.pg = value
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
set country(value) {
|
|
241
|
-
this.ph = value
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
set state(value) {
|
|
245
|
-
this.pi = value
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
set city(value) {
|
|
249
|
-
this.pj = value
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
set district(value) {
|
|
253
|
-
this.pk = value
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
set occupation(value) {
|
|
257
|
-
this.pl = value
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
set industry(value) {
|
|
261
|
-
this.pm = value
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
set favoriteTeam(value) {
|
|
265
|
-
this.pn = value
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
set language(value) {
|
|
269
|
-
this.po = value
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
class NetmeraInboxFilter {
|
|
274
|
-
constructor() {
|
|
275
|
-
this.pageSize = undefined;
|
|
276
|
-
this.status = undefined;
|
|
277
|
-
this.categories = undefined;
|
|
278
|
-
this.includeExpiredObjects = undefined;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
class NetmeraCategoryFilter {
|
|
283
|
-
constructor() {
|
|
284
|
-
this.pageSize = undefined;
|
|
285
|
-
this.status = undefined;
|
|
286
|
-
this.includeExpiredObjects = false;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
class NetmeraPushInbox {
|
|
291
|
-
title: string
|
|
292
|
-
subtitle: string
|
|
293
|
-
body: string
|
|
294
|
-
pushType: number
|
|
295
|
-
pushId: string
|
|
296
|
-
pushInstanceId: string
|
|
297
|
-
sendDate: string
|
|
298
|
-
inboxStatus: number
|
|
299
|
-
deepLink: string
|
|
300
|
-
webPage: string
|
|
301
|
-
externalId: string
|
|
302
|
-
customJson: any
|
|
303
|
-
pushAction: string
|
|
304
|
-
carousel: any
|
|
305
|
-
mediaAttachmentURL: string
|
|
306
|
-
category: string
|
|
307
|
-
categories: any
|
|
308
|
-
interactiveActions: string
|
|
309
|
-
expireTime: string
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
class NetmeraCategory {
|
|
313
|
-
categoryName: string
|
|
314
|
-
lastMessage: NetmeraPushInbox
|
|
315
|
-
readCount: number
|
|
316
|
-
deletedCount: number
|
|
317
|
-
unreadCount: number
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
module.exports = {Netmera, NetmeraUser, NetmeraInboxFilter, NetmeraCategoryFilter, NetmeraPushInbox, NetmeraCategory};
|
|
1
|
+
import Netmera from "./src/Netmera";
|
|
2
|
+
import NetmeraUser from "./src/NetmeraUser";
|
|
3
|
+
import {
|
|
4
|
+
NetmeraCategory,
|
|
5
|
+
NetmeraCategoryFilter,
|
|
6
|
+
NetmeraInboxFilter,
|
|
7
|
+
NetmeraPushInbox,
|
|
8
|
+
NMInboxStatus
|
|
9
|
+
} from "./src/NetmeraInbox";
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
Netmera,
|
|
13
|
+
NetmeraUser,
|
|
14
|
+
NetmeraInboxFilter,
|
|
15
|
+
NetmeraCategoryFilter,
|
|
16
|
+
NetmeraPushInbox,
|
|
17
|
+
NetmeraCategory,
|
|
18
|
+
NMInboxStatus,
|
|
19
|
+
};
|
package/ios/RNNetmera.h
CHANGED
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
+(void)setPushDelegate:(nonnull NSObject<NetmeraPushDelegate> *)delegate;
|
|
26
26
|
+(void)requestPushNotificationAuthorization;
|
|
27
27
|
|
|
28
|
-
@property (nonatomic, strong) NetmeraInbox *netmeraInbox;
|
|
29
|
-
@property (nonatomic, strong) NetmeraInboxCategory *netmeraInboxCategory;
|
|
28
|
+
@property (nonatomic, strong) NetmeraInbox * _Nullable netmeraInbox;
|
|
29
|
+
@property (nonatomic, strong) NetmeraInboxCategory * _Nullable netmeraInboxCategory;
|
|
30
30
|
|
|
31
31
|
@end
|
|
32
32
|
|
package/ios/RNNetmera.m
CHANGED
|
@@ -23,7 +23,14 @@ NSString *const ERROR_CODE_NULL_CATEGORY = @"2020";
|
|
|
23
23
|
NSString *const ERROR_MESSAGE_NULL_CATEGORY = @"Must call fetchCategory method first";
|
|
24
24
|
NSString *const ERROR_CODE_INVALID_PUSH_OBJECT = @"2021";
|
|
25
25
|
NSString *const ERROR_MESSAGE_INVALID_PUSH_OBJECT = @"Received NetmeraPushObject was not valid.";
|
|
26
|
-
|
|
26
|
+
NSString *const ERROR_CODE_NULL_INBOX_STATUS = @"2022";
|
|
27
|
+
NSString *const ERROR_MESSAGE_NULL_INBOX_STATUS = @"Inbox status can't be null.";
|
|
28
|
+
NSString *const ERROR_CODE_INBOX_STATUS = @"2023";
|
|
29
|
+
NSString *const ERROR_MESSAGE_INBOX_STATUS = @"Error occurred while fetching inbox count for status";
|
|
30
|
+
NSString *const ERROR_CODE_GET_CATEGORY_PREFERENCE = @"2024";
|
|
31
|
+
NSString *const ERROR_MESSAGE_GET_CATEGORY_PREFERENCE = @"Error occurred while fetching user category preference list.";
|
|
32
|
+
NSString *const ERROR_CODE_SET_CATEGORY_PREFERENCE = @"2025";
|
|
33
|
+
NSString *const ERROR_MESSAGE_SET_CATEGORY_PREFERENCE = @"Error occurred while setting user category preference list.";
|
|
27
34
|
|
|
28
35
|
@implementation RNNetmera
|
|
29
36
|
|
|
@@ -39,7 +46,7 @@ NSString *const ERROR_MESSAGE_INVALID_PUSH_OBJECT = @"Received NetmeraPushObject
|
|
|
39
46
|
|
|
40
47
|
+ (void)setNetmeraHeaders {
|
|
41
48
|
[Netmera setFramework:@"react"];
|
|
42
|
-
[Netmera setFrameworkVersion:@"1.
|
|
49
|
+
[Netmera setFrameworkVersion:@"1.4.2"];
|
|
43
50
|
}
|
|
44
51
|
|
|
45
52
|
+ (void)setPushDelegate:(NSObject<NetmeraPushDelegate> *)delegate {
|
|
@@ -349,4 +356,59 @@ RCT_EXPORT_METHOD(updateAll:(NSInteger)inboxStatus
|
|
|
349
356
|
}
|
|
350
357
|
}
|
|
351
358
|
|
|
359
|
+
RCT_EXPORT_METHOD(getInboxCountForStatus:(NSDictionary *) filterDictionary
|
|
360
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
361
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
NetmeraInboxCountFilter *filter = [[NetmeraInboxCountFilter alloc] init];
|
|
365
|
+
|
|
366
|
+
if (filterDictionary[@"status"]) {
|
|
367
|
+
filter.status = [[RNNetmeraUtils shared] getInboxStatus:[filterDictionary[@"status"] integerValue]];
|
|
368
|
+
} else {
|
|
369
|
+
reject(ERROR_CODE_NULL_INBOX_STATUS, ERROR_MESSAGE_NULL_INBOX_STATUS, nil);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
if (filterDictionary[@"includeExpiredObjects"]) {
|
|
373
|
+
filter.shouldIncludeExpiredObjects = filterDictionary[@"includeExpiredObjects"];
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
if (filterDictionary[@"categories"]) {
|
|
377
|
+
filter.categories = filterDictionary[@"categories"];
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
[Netmera fetchInboxCountWithFilter: filter completion:^(NetmeraInboxCountResponse * _Nullable response, NSError * _Nullable error) {
|
|
381
|
+
if (error != nil) {
|
|
382
|
+
reject(ERROR_CODE_INBOX_STATUS, ERROR_MESSAGE_INBOX_STATUS, nil);
|
|
383
|
+
} else {
|
|
384
|
+
resolve([[RNNetmeraUtils shared] parseInboxCountForStatusToMap: response]);
|
|
385
|
+
}
|
|
386
|
+
}];
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
RCT_EXPORT_METHOD(getUserCategoryPreferenceList: (RCTPromiseResolveBlock)resolve
|
|
390
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
391
|
+
|
|
392
|
+
[Netmera getUserCategoryPreferenceListWithCompletion:^(NSArray<NetmeraUserCategoryPreference *> * _Nullable categories, NSError * _Nullable error) {
|
|
393
|
+
if (error != nil) {
|
|
394
|
+
reject(ERROR_CODE_GET_CATEGORY_PREFERENCE, ERROR_MESSAGE_GET_CATEGORY_PREFERENCE, nil);
|
|
395
|
+
} else {
|
|
396
|
+
resolve([[RNNetmeraUtils shared] parseUserCategoryPreferenceListToMap: categories]);
|
|
397
|
+
}
|
|
398
|
+
}];
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
RCT_EXPORT_METHOD(setUserCategoryPreference: (int) categoryId
|
|
402
|
+
categoryEnabled: (BOOL) categoryEnabled
|
|
403
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
404
|
+
rejecter: (RCTPromiseRejectBlock)reject) {
|
|
405
|
+
[Netmera setUserCategoryPreferenceWithCategoryId:categoryId categoryEnabled:categoryEnabled completion:^(NSError * _Nullable error) {
|
|
406
|
+
if (error != nil) {
|
|
407
|
+
reject(ERROR_CODE_SET_CATEGORY_PREFERENCE, ERROR_MESSAGE_SET_CATEGORY_PREFERENCE, nil);
|
|
408
|
+
} else {
|
|
409
|
+
resolve(@(YES));
|
|
410
|
+
}
|
|
411
|
+
}];
|
|
412
|
+
}
|
|
413
|
+
|
|
352
414
|
@end
|
package/ios/RNNetmeraUtils.h
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
//
|
|
8
8
|
|
|
9
9
|
#import <NetmeraCore/NetmeraPushObject.h>
|
|
10
|
+
#import <Netmera/Netmera.h>
|
|
10
11
|
|
|
11
12
|
NS_ASSUME_NONNULL_BEGIN
|
|
12
13
|
|
|
@@ -15,6 +16,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
15
16
|
+(RNNetmeraUtils *)shared;
|
|
16
17
|
|
|
17
18
|
-(NSDictionary *)dictionaryFromPushObject:(NetmeraPushObject *)pushObject;
|
|
19
|
+
-(NetmeraInboxStatus)getInboxStatus:(NSUInteger) code;
|
|
20
|
+
-(NSDictionary *)parseInboxCountForStatusToMap:(NetmeraInboxCountResponse *) response;
|
|
21
|
+
-(NSMutableArray *) parseUserCategoryPreferenceListToMap:(NSArray<NetmeraUserCategoryPreference *> *) preferences;
|
|
18
22
|
|
|
19
23
|
@end
|
|
20
24
|
|
package/ios/RNNetmeraUtils.m
CHANGED
|
@@ -73,4 +73,42 @@ static RNNetmeraUtils *utils;
|
|
|
73
73
|
return data;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
|
|
77
|
+
-(NetmeraInboxStatus) getInboxStatus:(NSUInteger) code {
|
|
78
|
+
switch (code) {
|
|
79
|
+
case NetmeraInboxStatusDeleted:
|
|
80
|
+
return NetmeraInboxStatusDeleted;
|
|
81
|
+
break;
|
|
82
|
+
case NetmeraInboxStatusRead:
|
|
83
|
+
return NetmeraInboxStatusRead;
|
|
84
|
+
break;
|
|
85
|
+
case NetmeraInboxStatusUnread:
|
|
86
|
+
return NetmeraInboxStatusUnread;
|
|
87
|
+
break;
|
|
88
|
+
case NetmeraInboxStatusAll:
|
|
89
|
+
default:
|
|
90
|
+
return NetmeraInboxStatusAll;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
-(NSDictionary *) parseInboxCountForStatusToMap:(NetmeraInboxCountResponse*) response {
|
|
95
|
+
NSMutableDictionary *data = [NSMutableDictionary dictionary];
|
|
96
|
+
data[@"7"] = [NSNumber numberWithInteger:[response countForStatus: NetmeraInboxStatusAll]];
|
|
97
|
+
data[@"1"] = [NSNumber numberWithInteger:[response countForStatus: NetmeraInboxStatusRead]];
|
|
98
|
+
data[@"2"] = [NSNumber numberWithInteger:[response countForStatus: NetmeraInboxStatusUnread]];
|
|
99
|
+
data[@"4"] = [NSNumber numberWithInteger:[response countForStatus: NetmeraInboxStatusDeleted]];
|
|
100
|
+
return data;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
-(NSMutableArray *) parseUserCategoryPreferenceListToMap:(NSArray<NetmeraUserCategoryPreference *> *) preferences {
|
|
104
|
+
NSMutableArray *array = [[NSMutableArray alloc]init];
|
|
105
|
+
for (NetmeraUserCategoryPreference *preference in preferences) {
|
|
106
|
+
NSMutableDictionary *data = [NSMutableDictionary dictionary];
|
|
107
|
+
data[@"categoryId"] = [NSNumber numberWithInteger:preference.categoryId];
|
|
108
|
+
data[@"categoryName"] = preference.categoryName;
|
|
109
|
+
data[@"optInStatus"] = [NSNumber numberWithBool: preference.categoryEnabled];
|
|
110
|
+
[array addObject:data];
|
|
111
|
+
}
|
|
112
|
+
return array;
|
|
113
|
+
}
|
|
76
114
|
@end
|