@blueconic/blueconic-react-native 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/BlueConicReactNative.podspec +23 -23
  2. package/CHANGELOG.md +88 -75
  3. package/LICENSE +3 -3
  4. package/README.md +484 -511
  5. package/android/build.gradle +38 -41
  6. package/android/gradle/wrapper/gradle-wrapper.properties +6 -6
  7. package/android/gradlew +172 -172
  8. package/android/local.properties +8 -8
  9. package/android/src/main/AndroidManifest.xml +5 -5
  10. package/android/src/main/java/com/blueconic/blueconicreactnative/BlueConicClientModule.java +870 -857
  11. package/android/src/main/java/com/blueconic/blueconicreactnative/BlueConicClientModuleHelper.java +17 -17
  12. package/android/src/main/java/com/blueconic/blueconicreactnative/BlueConicClientPackage.java +29 -29
  13. package/android/src/main/java/com/blueconic/blueconicreactnative/BlueConicInteraction.java +68 -68
  14. package/index.js +6 -6
  15. package/ios/BlueConicClient-Bridging-Header.h +6 -6
  16. package/ios/BlueConicClient.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -7
  17. package/ios/BlueConicClient.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
  18. package/ios/BlueConicClient.xcodeproj/xcuserdata/youri.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
  19. package/ios/BlueConicClientModule.m +74 -72
  20. package/ios/BlueConicClientModule.swift +516 -506
  21. package/ios/BlueConicInteraction.swift +63 -63
  22. package/package.json +18 -18
  23. package/android/.idea/gradle.xml +0 -17
  24. package/android/.idea/misc.xml +0 -9
  25. package/android/.idea/modules/android.iml +0 -18
  26. package/android/.idea/modules.xml +0 -8
  27. package/android/.idea/vcs.xml +0 -6
  28. package/android/.idea/workspace.xml +0 -57
@@ -1,506 +1,516 @@
1
- import UIKit
2
- import BlueConicClient
3
-
4
- /**
5
- The BlueConicClientModule class represents the Native (iOS) module that implements the BlueConic functionality
6
- required by the JavaScript.
7
- */
8
- @objc(BlueConicClientModule)
9
- class BlueConicClientModule: RCTEventEmitter {
10
- private static var moduleInstance: BlueConicClientModule?
11
- private static var hasListeners: Bool?
12
-
13
- /**
14
- The initializer of the BlueConicClientModule. Here we get the BlueConicClient and EventManager instances
15
- and store these in the blueConicClient and eventManager variables, respectively.
16
- */
17
- override init() {
18
- super.init()
19
- BlueConicClientModule.moduleInstance = self
20
- // Dummy references needed to avoid tree-shaking
21
- let _ = BlueConicInteraction.self
22
- getBlueConicClientInstance().registerPluginClass(BlueConicInteraction.self, className: "BlueConicClient.BlueConicInteraction")
23
- }
24
-
25
- /**
26
- Required by React Native to suppress warnings when overriding the init().
27
- */
28
- @objc override static func requiresMainQueueSetup() -> Bool {
29
- return false
30
- }
31
-
32
-
33
- // MARK: GETTERS
34
- /**
35
- Gets the ID of the BlueConic profile. The value is passed to the provided callback function as a String.
36
- - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
37
- Native Modules to pass values back to the JavaScript.
38
- */
39
- @objc func getProfileId(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
40
- resolve([self.getBlueConicClientInstance().getProfileId() ?? ""])
41
- }
42
-
43
-
44
- /**
45
- Gets the values of the specified profile property. The values are passed to the provided callback function
46
- as separate Strings.
47
- - parameter property: The profile property for which to get the values.
48
- - parameter callback: The callback function to handle the obtained values. Callbacks are necessary in
49
- Native Modules to pass values back to the JavaScript.
50
- */
51
- @objc func getProfileValue(_ property: String, withResolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
52
- resolve([self.getBlueConicClientInstance().getProfileValue(property)])
53
- }
54
-
55
-
56
- /**
57
- Gets the values of the specified profile property. The values are passed to the provided callback function
58
- as separate Strings.
59
- - parameter property: The profile property for which to get the values.
60
- - parameter callback: The callback function to handle the obtained values. Callbacks are necessary in
61
- Native Modules to pass values back to the JavaScript.
62
- */
63
- @objc func getProfileValues(_ property: String, withResolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
64
- resolve(self.getBlueConicClientInstance().getProfileValues(property))
65
- }
66
-
67
-
68
- /**
69
- Gets the ID of the BlueConic profile. The value is passed to the provided callback function as a String.
70
- - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
71
- Native Modules to pass values back to the JavaScript.
72
- */
73
- @objc func getProfileIdWithCallback(_ callback: RCTResponseSenderBlock) -> Void {
74
- callback([self.getBlueConicClientInstance().getProfileId() ?? ""])
75
- }
76
-
77
- /**
78
- Gets the values of the specified profile property. The values are passed to the provided callback function
79
- as separate Strings.
80
- - parameter property: The profile property for which to get the values.
81
- - parameter callback: The callback function to handle the obtained values. Callbacks are necessary in
82
- Native Modules to pass values back to the JavaScript.
83
- */
84
- @objc func getProfileValueWithCallback(_ property: String, withCallback callback: RCTResponseSenderBlock) -> Void {
85
- callback([self.getBlueConicClientInstance().getProfileValue(property)])
86
- }
87
-
88
-
89
- /**
90
- Gets the values of the specified profile property. The values are passed to the provided callback function
91
- as separate Strings.
92
- - parameter property: The profile property for which to get the values.
93
- - parameter callback: The callback function to handle the obtained values. Callbacks are necessary in
94
- Native Modules to pass values back to the JavaScript.
95
- */
96
- @objc func getProfileValuesWithCallback(_ property: String, withCallback callback: RCTResponseSenderBlock) -> Void {
97
- callback(self.getBlueConicClientInstance().getProfileValues(property))
98
- }
99
-
100
- /**
101
- Gets the privacy legislation of the BlueConic profile. The value is passed to the provided callback function as a String.
102
- - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
103
- Native Modules to pass values back to the JavaScript.
104
- */
105
- @objc func getPrivacyLegislation(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
106
- resolve([self.getBlueConicClientInstance().getPrivacyLegislation() ?? ""])
107
- }
108
-
109
- /**
110
- Gets the privacy legislation of the BlueConic profile. The value is passed to the provided callback function as a String.
111
- - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
112
- Native Modules to pass values back to the JavaScript.
113
- */
114
- @objc func getPrivacyLegislationWithCallback(_ callback: RCTResponseSenderBlock) -> Void {
115
- callback([self.getBlueConicClientInstance().getPrivacyLegislation() ?? ""])
116
- }
117
-
118
- /**
119
- Gets the Consented Objectives of the BlueConic profile. The value is passed to the provided callback function as seperated Strings.
120
- - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
121
- Native Modules to pass values back to the JavaScript.
122
- */
123
- @objc func getConsentedObjectives(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
124
- resolve(self.getBlueConicClientInstance().getConsentedObjectives())
125
- }
126
-
127
- /**
128
- Gets the Consented Objectives of the BlueConic profile. The value is passed to the provided callback function as seperated Strings.
129
- - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
130
- Native Modules to pass values back to the JavaScript.
131
- */
132
- @objc func getConsentedObjectivesWithCallback(_ callback: RCTResponseSenderBlock) -> Void {
133
- callback(self.getBlueConicClientInstance().getConsentedObjectives())
134
- }
135
-
136
- /**
137
- Gets the Refused Objectives of the BlueConic profile. The value is passed to the provided callback function as seperated Strings.
138
- - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
139
- Native Modules to pass values back to the JavaScript.
140
- */
141
- @objc func getRefusedObjectives(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
142
- resolve(self.getBlueConicClientInstance().getRefusedObjectives())
143
- }
144
-
145
- /**
146
- Gets the Refused Objectives of the BlueConic profile. The value is passed to the provided callback function as seperated Strings.
147
- - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
148
- Native Modules to pass values back to the JavaScript.
149
- */
150
- @objc func getRefusedObjectivesWithCallback(_ callback: RCTResponseSenderBlock) -> Void {
151
- callback(self.getBlueConicClientInstance().getRefusedObjectives())
152
- }
153
-
154
- /**
155
- Gets all segments of the BlueConic profile. The values/ segments are retrieved when registering PAGEVIEW events
156
- First register a page view event before retrieving the newest segments
157
- - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
158
- Native Modules to pass values back to the JavaScript.
159
- */
160
- @objc func getSegments(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
161
- resolve(self.getFormattedSegments())
162
- }
163
-
164
- /**
165
- Gets all segments of the BlueConic profile. The values/ segments are retrieved when registering PAGEVIEW events
166
- First register a page view event before retrieving the newest segments
167
- - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
168
- Native Modules to pass values back to the JavaScript.
169
- */
170
- @objc func getSegmentsWithCallback(_ callback: RCTResponseSenderBlock) -> Void {
171
- callback(self.getFormattedSegments())
172
- }
173
-
174
-
175
- // MARK: ADDERS
176
- /**
177
- Adds the given values to the specified profile property.
178
- - parameter property: The profile property to which to add the values.
179
- - parameter values: An Array containing Strings to be added to the profile property.
180
- */
181
- @objc func addProfileValue(_ property: String, withValue value: String) -> Void {
182
- self.getBlueConicClientInstance().addProfileValue(property, value: value)
183
- }
184
-
185
- /**
186
- Adds the given values to the specified profile property.
187
- - parameter property: The profile property to which to add the values.
188
- - parameter values: An Array containing Strings to be added to the profile property.
189
- */
190
- @objc func addProfileValues(_ property: String, withValues values: [String]) -> Void {
191
- self.getBlueConicClientInstance().addProfileValues(property, values: values)
192
- }
193
-
194
- /**
195
- Adds an objective to the consented objectives list.
196
- - parameter objectiveId: The ID of the objective to add to consented objectives.
197
- */
198
- @objc func addConsentedObjective(_ objectiveId: String) -> Void {
199
- self.getBlueConicClientInstance().addConsentedObjective(objectiveId)
200
- }
201
-
202
- /**
203
- Adds objective to th refused objectives list
204
- - parameter objectiveId: The ID of the objective to add to refused objectives.
205
- */
206
- @objc func addRefusedObjective(_ objectiveId: String) -> Void {
207
- self.getBlueConicClientInstance().addRefusedObjective(objectiveId)
208
- }
209
-
210
- // MARK: SETTERS
211
- /**
212
- Sets the given values for the specified profile property.
213
- - parameter property: The profile property for which to set the values.
214
- - parameter values: An Array containing Strings to be set as the new values for the profile property.
215
- */
216
- @objc func setProfileValue(_ property: String, withValue value: String) -> Void {
217
- self.getBlueConicClientInstance().setProfileValue(property, value: value)
218
- }
219
-
220
- /**
221
- Sets the given values for the specified profile property.
222
- - parameter property: The profile property for which to set the values.
223
- - parameter values: An Array containing Strings to be set as the new values for the profile property.
224
- */
225
- @objc func setProfileValues(_ property: String, withValues values: [String]) -> Void {
226
- self.getBlueConicClientInstance().setProfileValues(property, values: values)
227
- }
228
-
229
- /**
230
- Sets the privacy legislation.
231
- - parameter privacyLegislation: The privacy legislation.
232
- */
233
- @objc func setPrivacyLegislation(_ privacyLegislation: String) -> Void {
234
- self.getBlueConicClientInstance().setPrivacyLegislation(privacyLegislation)
235
- }
236
-
237
- /**
238
- Sets the given objectives for consented objectives.
239
- - parameter objectiveIds: An Array containing Strings to be set as the new objective IDs for the consented objectives list.
240
- */
241
- @objc func setConsentedObjectives(_ objectiveIds: [String]) -> Void {
242
- self.getBlueConicClientInstance().setConsentedObjectives(objectiveIds)
243
- }
244
-
245
- /**
246
- Sets the given objectives for refused objectives.
247
- - parameter objectiveIds: An Array containing Strings to be set as the new objective IDs for the consented objectives list.
248
- */
249
- @objc func setRefusedObjectives(_ objectiveIds: [String]) -> Void {
250
- self.getBlueConicClientInstance().setRefusedObjectives(objectiveIds)
251
- }
252
-
253
- // MARK: PUBLIC BLUECONIC FUNCTIONS
254
-
255
- /**
256
- Calls the createEvent method of the BlueConicClient to register a PAGEVIEW event. This must be called
257
- on every screen change as it triggers the BlueConic SDK to load all plugins (i.e. listeners, dialoges)
258
- for the screen.
259
- - parameter screenName: The name of the screen.
260
- */
261
- @objc func createEvent(_ eventName: String, withProperties properties: [String: String]) -> Void {
262
- self.getBlueConicClientInstance().createEvent(eventName, properties: properties)
263
- }
264
- @objc func createEventSync(_ eventName: String, withProperties properties: [String: String], withResolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
265
- self.getBlueConicClientInstance().createEvent(eventName, properties: properties, completion: {
266
- resolve([])
267
- })
268
- }
269
- @objc func createEventSyncWithCallback(_ eventName: String, withProperties properties: [String: String], withCallback callback: @escaping RCTResponseSenderBlock) -> Void {
270
- self.getBlueConicClientInstance().createEvent(eventName, properties: properties, completion: {
271
- callback([])
272
- })
273
- }
274
-
275
- /**
276
- Calls the updateProfile method of the BlueConicClient to sync/ update the profile properties from the Mobile app with the BlueConic server.
277
- */
278
- @objc func updateProfile() -> Void {
279
- self.getBlueConicClientInstance().updateProfile()
280
- }
281
- @objc func updateProfileSync(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
282
- self.getBlueConicClientInstance().updateProfile(completion: {
283
- resolve([])
284
- })
285
- }
286
- @objc func updateProfileSyncWithCallback(_ callback: @escaping RCTResponseSenderBlock) -> Void {
287
- self.getBlueConicClientInstance().updateProfile(completion: {
288
- callback([])
289
- })
290
- }
291
-
292
- /**
293
- Set the locale for the interactions.
294
- Define multiple-languages in a interaction, and select a locale to return the correct variants for this locale
295
- - parameter locale: The current locale of the app.
296
- */
297
- @objc func setLocale(_ locale: String) -> Void {
298
- self.getBlueConicClientInstance().setLocale(locale)
299
- }
300
-
301
- /**
302
- Set enabled.
303
- Define to enable and disable the BlueConicClient
304
- To prevent or re-activate tracking data
305
- - parameter isEnabled: to enable or disable the BlueConicClient.
306
- */
307
- @objc func setEnabled(_ isEnabled: Bool) -> Void {
308
- self.getBlueConicClientInstance().setEnabled(isEnabled)
309
- }
310
-
311
- /**
312
- Return is BlueConicClient enabled. The value is passed to the provided callback function as seperated Strings.
313
- - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
314
- Native Modules to pass values back to the JavaScript.
315
- */
316
- @objc func isEnabled(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
317
- resolve([self.getBlueConicClientInstance().isEnabled()])
318
- }
319
-
320
- /**
321
- Return is BlueConicClient enabled. The value is passed to the provided callback function as seperated Strings.
322
- - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
323
- Native Modules to pass values back to the JavaScript.
324
- */
325
- @objc func isEnabledWithCallback(_ callback: RCTResponseSenderBlock) -> Void {
326
- callback([self.getBlueConicClientInstance().isEnabled()])
327
- }
328
-
329
- /**
330
- Return if the profile is in the segment based on the segment id. The value is passed to the provided callback function as seperated Strings.
331
- as separate Strings.
332
- - parameter segmentId: The ID of the segment.
333
- - parameter callback: The callback function to handle the obtained values. Callbacks are necessary in
334
- Native Modules to pass values back to the JavaScript.
335
- */
336
- @objc func hasSegment(_ segmentId: String, withResolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
337
- resolve([self.getBlueConicClientInstance().hasSegment(segmentId)])
338
- }
339
- /**
340
- Return if the profile is in the segment based on the segment id. The value is passed to the provided callback function as seperated Strings.
341
- as separate Strings.
342
- - parameter segmentId: The ID of the segment.
343
- - parameter callback: The callback function to handle the obtained values. Callbacks are necessary in
344
- Native Modules to pass values back to the JavaScript.
345
- */
346
- @objc func hasSegmentWithCallback(_ segmentId: String, withCallback callback: RCTResponseSenderBlock) -> Void {
347
- callback([self.getBlueConicClientInstance().hasSegment(segmentId)])
348
- }
349
-
350
-
351
- // MARK: REGISTERS
352
- /**
353
- Calls the createEvent method of the BlueConicClient to register a PAGEVIEW event. This must be called
354
- on every screen change as it triggers the BlueConic SDK to load all plugins (i.e. listeners, dialoges)
355
- for the screen.
356
- - parameter screenName: The name of the screen.
357
- */
358
- @objc func registerPageView(_ screenName: String) -> Void {
359
- self.getBlueConicClientInstance().createEvent("PAGEVIEW", properties: ["screenName": screenName])
360
- }
361
- @objc func registerPageViewSync(_ screenName: String, withResolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
362
- self.getBlueConicClientInstance().createEvent("PAGEVIEW", properties: ["screenName": screenName], completion: {
363
- resolve([])
364
- })
365
- }
366
- @objc func registerPageViewSyncWithCallback(_ screenName: String, withCallback callback: @escaping RCTResponseSenderBlock) -> Void {
367
- self.getBlueConicClientInstance().createEvent("PAGEVIEW", properties: ["screenName": screenName], completion: {
368
- callback([])
369
- })
370
- }
371
-
372
- /**
373
- Creates a ClickEvent for the given selector and publishes the event to BlueConic using the EventManager.
374
- - parameter selector: The selector to identify the clicked component.
375
- */
376
- @objc func registerClickEvent(_ selector: String) -> Void {
377
- getBlueConicEventManager().publish(ClickEvent(selector: selector))
378
- }
379
-
380
- /**
381
- Creates a ClickEvent with the given selector and context, and publishes the event to BlueConic using the EventManager.
382
- - parameter selector: The selector to identify the clicked component.
383
- - parameter values: The values to pass to BlueConic as the context of the event.
384
- */
385
- @objc func registerClickEventWithContext(_ selector: String, withValues values: [String]) -> Void {
386
- getBlueConicEventManager().publish(ClickEvent(selector: selector, context: values))
387
- }
388
- /**
389
- Creates an UpdateValuesEvent for the given selector and value, and publishes the event using the EventManager.
390
- - parameter selector: The selector to identify the component with updated values.
391
- - parameter value: The value to be passed on to BlueConic.
392
- */
393
- @objc func registerUpdateValuesEvent(_ selector: String, withValue value: String) -> Void {
394
- getBlueConicEventManager().publish(UpdateValuesEvent(selector: selector, values: [value]))
395
- }
396
-
397
- /**
398
- Creates an AdvancedEvent with the given name and values, and publishes the event using the EventManager.
399
- - parameter name: The name to identify the event.
400
- - parameter values: The values to pass to BlueConic as context of the event.
401
- */
402
- @objc func registerAdvancedEvent(_ name: String, withValues values: [String]) -> Void {
403
- getBlueConicEventManager().publish(AdvancedEvent(eventName: name, context: values))
404
- }
405
-
406
-
407
- /**
408
- Empty method. This method exists purely because we expose a method named destroyPlugins in the Android
409
- Native Module. Exposing this empty method in iOS allows the user to call destroyPlugins in the JavaScript
410
- without making a distinction for iOS and Android.
411
- */
412
- @objc func destroyPlugins() -> Void {
413
-
414
- }
415
-
416
- /**
417
- Sends an event to the BlueConic server, indicating that a certain interaction was viewed, clicked, or converted for.
418
- - parameter eventType: The event type to register for the interaction. Possible events are "VIEW", "CLICK" or "CONVERSION".
419
- - parameter interactionId: The unique identifier of the interaction.
420
- */
421
- @objc func registerDialogueEvent(_ eventType: String, withInteractionId interactionId: String) -> Void {
422
- self.getBlueConicClientInstance().createEvent(eventType, properties: ["interactionId": interactionId])
423
- }
424
-
425
-
426
- /**
427
- Returns the current BlueConicClient instance
428
- - returns: The BlueConicClient instance
429
- */
430
- private func getBlueConicClientInstance() -> BlueConicClient {
431
- return BlueConicClient.getInstance()
432
- }
433
-
434
- /**
435
- Returns the current BlueConicEventManager instance
436
- - returns: The BlueConicEventManager instance
437
- */
438
- private func getBlueConicEventManager() -> BlueConicEventManager {
439
- return BlueConicEventFactory.getInstance()
440
- }
441
-
442
- /**
443
- Return the segments in a list of dictionaries.
444
- - returns: The list of Segments as a dictionary
445
- */
446
- private func getFormattedSegments() -> [[String: String]] {
447
- let segments = self.getBlueConicClientInstance().getSegments()
448
- var result = [[String: String]]()
449
-
450
- for segment in segments {
451
- let item = [
452
- "id": segment.getId(),
453
- "name": segment.getName()
454
- ]
455
- result.append(item)
456
- }
457
- return result
458
- }
459
-
460
- /**
461
- Static method that is called by the BlueConicInteraction when it receives the parameters of the dialogue,
462
- and when the dialogue is destroyed by the BlueConic SDK. An event is published to which the JavaScript of the app
463
- should subscribe.
464
- - parameter properties: The properties of the dialogue as received from BlueConic.
465
- */
466
- static func publishDialogueEvent(_ properties: Dictionary<String, Any>, eventName: String) -> Void {
467
- if hasListeners ?? false {
468
- moduleInstance?.sendEvent(withName: eventName, body: properties)
469
- }
470
- }
471
-
472
- /**
473
- Private helper function to obtain the parameter value as configured in BlueConic.
474
- - parameter values: The array of values
475
- - returns: The string value of the specified parameter.
476
- */
477
- private static func getParameterValue(_ values: [String]) -> String {
478
- if values.count > 0 && values[0] != "" {
479
- return values[0]
480
- } else {
481
- return ""
482
- }
483
- }
484
-
485
- /**
486
- Method that lists the events that may be published by this Native Module.
487
- - returns: An array of event names that may be published to the JavaScript.
488
- */
489
- override func supportedEvents() -> [String]! {
490
- return ["onBlueConicPluginLoad", "onBlueConicPluginDestroyed"]
491
- }
492
-
493
- /**
494
- Method that is called when the JavaScript adds a listener to the NativeEventEmitter of this Native Module.
495
- */
496
- override func startObserving() {
497
- BlueConicClientModule.hasListeners = true
498
- }
499
-
500
- /**
501
- Method that is called when the JavaScript removes a listener of the NativeEventEmitter of this Native Module.
502
- */
503
- override func stopObserving() {
504
- BlueConicClientModule.hasListeners = false
505
- }
506
- }
1
+ import UIKit
2
+ import BlueConicClient
3
+
4
+ /**
5
+ The BlueConicClientModule class represents the Native (iOS) module that implements the BlueConic functionality
6
+ required by the JavaScript.
7
+ */
8
+ @objc(BlueConicClientModule)
9
+ class BlueConicClientModule: RCTEventEmitter {
10
+ private static var moduleInstance: BlueConicClientModule?
11
+ private static var hasListeners: Bool?
12
+
13
+ /**
14
+ The initializer of the BlueConicClientModule. Here we get the BlueConicClient and EventManager instances
15
+ and store these in the blueConicClient and eventManager variables, respectively.
16
+ */
17
+ override init() {
18
+ super.init()
19
+ BlueConicClientModule.moduleInstance = self
20
+ // Dummy references needed to avoid tree-shaking
21
+ let _ = BlueConicInteraction.self
22
+ getBlueConicClientInstance().registerPluginClass(BlueConicInteraction.self, className: "BlueConicClient.BlueConicInteraction")
23
+ }
24
+
25
+ /**
26
+ Required by React Native to suppress warnings when overriding the init().
27
+ */
28
+ @objc override static func requiresMainQueueSetup() -> Bool {
29
+ return false
30
+ }
31
+
32
+
33
+ // MARK: GETTERS
34
+ /**
35
+ Gets the ID of the BlueConic profile. The value is passed to the provided callback function as a String.
36
+ - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
37
+ Native Modules to pass values back to the JavaScript.
38
+ */
39
+ @objc func getProfileId(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
40
+ resolve([self.getBlueConicClientInstance().getProfileId() ?? ""])
41
+ }
42
+
43
+
44
+ /**
45
+ Gets the values of the specified profile property. The values are passed to the provided callback function
46
+ as separate Strings.
47
+ - parameter property: The profile property for which to get the values.
48
+ - parameter callback: The callback function to handle the obtained values. Callbacks are necessary in
49
+ Native Modules to pass values back to the JavaScript.
50
+ */
51
+ @objc func getProfileValue(_ property: String, withResolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
52
+ resolve([self.getBlueConicClientInstance().getProfileValue(property)])
53
+ }
54
+
55
+
56
+ /**
57
+ Gets the values of the specified profile property. The values are passed to the provided callback function
58
+ as separate Strings.
59
+ - parameter property: The profile property for which to get the values.
60
+ - parameter callback: The callback function to handle the obtained values. Callbacks are necessary in
61
+ Native Modules to pass values back to the JavaScript.
62
+ */
63
+ @objc func getProfileValues(_ property: String, withResolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
64
+ resolve(self.getBlueConicClientInstance().getProfileValues(property))
65
+ }
66
+
67
+
68
+ /**
69
+ Gets the ID of the BlueConic profile. The value is passed to the provided callback function as a String.
70
+ - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
71
+ Native Modules to pass values back to the JavaScript.
72
+ */
73
+ @objc func getProfileIdWithCallback(_ callback: RCTResponseSenderBlock) -> Void {
74
+ callback([self.getBlueConicClientInstance().getProfileId() ?? ""])
75
+ }
76
+
77
+ /**
78
+ Gets the values of the specified profile property. The values are passed to the provided callback function
79
+ as separate Strings.
80
+ - parameter property: The profile property for which to get the values.
81
+ - parameter callback: The callback function to handle the obtained values. Callbacks are necessary in
82
+ Native Modules to pass values back to the JavaScript.
83
+ */
84
+ @objc func getProfileValueWithCallback(_ property: String, withCallback callback: RCTResponseSenderBlock) -> Void {
85
+ callback([self.getBlueConicClientInstance().getProfileValue(property)])
86
+ }
87
+
88
+
89
+ /**
90
+ Gets the values of the specified profile property. The values are passed to the provided callback function
91
+ as separate Strings.
92
+ - parameter property: The profile property for which to get the values.
93
+ - parameter callback: The callback function to handle the obtained values. Callbacks are necessary in
94
+ Native Modules to pass values back to the JavaScript.
95
+ */
96
+ @objc func getProfileValuesWithCallback(_ property: String, withCallback callback: RCTResponseSenderBlock) -> Void {
97
+ callback(self.getBlueConicClientInstance().getProfileValues(property))
98
+ }
99
+
100
+ /**
101
+ Gets the privacy legislation of the BlueConic profile. The value is passed to the provided callback function as a String.
102
+ - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
103
+ Native Modules to pass values back to the JavaScript.
104
+ */
105
+ @objc func getPrivacyLegislation(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
106
+ resolve([self.getBlueConicClientInstance().getPrivacyLegislation() ?? ""])
107
+ }
108
+
109
+ /**
110
+ Gets the privacy legislation of the BlueConic profile. The value is passed to the provided callback function as a String.
111
+ - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
112
+ Native Modules to pass values back to the JavaScript.
113
+ */
114
+ @objc func getPrivacyLegislationWithCallback(_ callback: RCTResponseSenderBlock) -> Void {
115
+ callback([self.getBlueConicClientInstance().getPrivacyLegislation() ?? ""])
116
+ }
117
+
118
+ /**
119
+ Gets the Consented Objectives of the BlueConic profile. The value is passed to the provided callback function as seperated Strings.
120
+ - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
121
+ Native Modules to pass values back to the JavaScript.
122
+ */
123
+ @objc func getConsentedObjectives(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
124
+ resolve(self.getBlueConicClientInstance().getConsentedObjectives())
125
+ }
126
+
127
+ /**
128
+ Gets the Consented Objectives of the BlueConic profile. The value is passed to the provided callback function as seperated Strings.
129
+ - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
130
+ Native Modules to pass values back to the JavaScript.
131
+ */
132
+ @objc func getConsentedObjectivesWithCallback(_ callback: RCTResponseSenderBlock) -> Void {
133
+ callback(self.getBlueConicClientInstance().getConsentedObjectives())
134
+ }
135
+
136
+ /**
137
+ Gets the Refused Objectives of the BlueConic profile. The value is passed to the provided callback function as seperated Strings.
138
+ - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
139
+ Native Modules to pass values back to the JavaScript.
140
+ */
141
+ @objc func getRefusedObjectives(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
142
+ resolve(self.getBlueConicClientInstance().getRefusedObjectives())
143
+ }
144
+
145
+ /**
146
+ Gets the Refused Objectives of the BlueConic profile. The value is passed to the provided callback function as seperated Strings.
147
+ - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
148
+ Native Modules to pass values back to the JavaScript.
149
+ */
150
+ @objc func getRefusedObjectivesWithCallback(_ callback: RCTResponseSenderBlock) -> Void {
151
+ callback(self.getBlueConicClientInstance().getRefusedObjectives())
152
+ }
153
+
154
+ /**
155
+ Gets all segments of the BlueConic profile. The values/ segments are retrieved when registering PAGEVIEW events
156
+ First register a page view event before retrieving the newest segments
157
+ - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
158
+ Native Modules to pass values back to the JavaScript.
159
+ */
160
+ @objc func getSegments(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
161
+ resolve(self.getFormattedSegments())
162
+ }
163
+
164
+ /**
165
+ Gets all segments of the BlueConic profile. The values/ segments are retrieved when registering PAGEVIEW events
166
+ First register a page view event before retrieving the newest segments
167
+ - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
168
+ Native Modules to pass values back to the JavaScript.
169
+ */
170
+ @objc func getSegmentsWithCallback(_ callback: RCTResponseSenderBlock) -> Void {
171
+ callback(self.getFormattedSegments())
172
+ }
173
+
174
+
175
+ // MARK: ADDERS
176
+ /**
177
+ Adds the given values to the specified profile property.
178
+ - parameter property: The profile property to which to add the values.
179
+ - parameter values: An Array containing Strings to be added to the profile property.
180
+ */
181
+ @objc func addProfileValue(_ property: String, withValue value: String) -> Void {
182
+ self.getBlueConicClientInstance().addProfileValue(property, value: value)
183
+ }
184
+
185
+ /**
186
+ Adds the given values to the specified profile property.
187
+ - parameter property: The profile property to which to add the values.
188
+ - parameter values: An Array containing Strings to be added to the profile property.
189
+ */
190
+ @objc func addProfileValues(_ property: String, withValues values: [String]) -> Void {
191
+ self.getBlueConicClientInstance().addProfileValues(property, values: values)
192
+ }
193
+
194
+ /**
195
+ Adds an objective to the consented objectives list.
196
+ - parameter objectiveId: The ID of the objective to add to consented objectives.
197
+ */
198
+ @objc func addConsentedObjective(_ objectiveId: String) -> Void {
199
+ self.getBlueConicClientInstance().addConsentedObjective(objectiveId)
200
+ }
201
+
202
+ /**
203
+ Adds objective to th refused objectives list
204
+ - parameter objectiveId: The ID of the objective to add to refused objectives.
205
+ */
206
+ @objc func addRefusedObjective(_ objectiveId: String) -> Void {
207
+ self.getBlueConicClientInstance().addRefusedObjective(objectiveId)
208
+ }
209
+
210
+ // MARK: SETTERS
211
+ /**
212
+ Sets the given values for the specified profile property.
213
+ - parameter property: The profile property for which to set the values.
214
+ - parameter values: An Array containing Strings to be set as the new values for the profile property.
215
+ */
216
+ @objc func setProfileValue(_ property: String, withValue value: String) -> Void {
217
+ self.getBlueConicClientInstance().setProfileValue(property, value: value)
218
+ }
219
+
220
+ /**
221
+ Sets the given values for the specified profile property.
222
+ - parameter property: The profile property for which to set the values.
223
+ - parameter values: An Array containing Strings to be set as the new values for the profile property.
224
+ */
225
+ @objc func setProfileValues(_ property: String, withValues values: [String]) -> Void {
226
+ self.getBlueConicClientInstance().setProfileValues(property, values: values)
227
+ }
228
+
229
+ // MARK: INCREMENT
230
+ /**
231
+ Increments the given values to the specified profile property.
232
+ - parameter property: The profile property to which to increment the values.
233
+ - parameter values: An Array containing Strings to be incremented to the profile property.
234
+ */
235
+ @objc func incrementProfileValue(_ property: String, withValue value: String) -> Void {
236
+ self.getBlueConicClientInstance().incrementProfileValue(property, value: value)
237
+ }
238
+
239
+ /**
240
+ Sets the privacy legislation.
241
+ - parameter privacyLegislation: The privacy legislation.
242
+ */
243
+ @objc func setPrivacyLegislation(_ privacyLegislation: String) -> Void {
244
+ self.getBlueConicClientInstance().setPrivacyLegislation(privacyLegislation)
245
+ }
246
+
247
+ /**
248
+ Sets the given objectives for consented objectives.
249
+ - parameter objectiveIds: An Array containing Strings to be set as the new objective IDs for the consented objectives list.
250
+ */
251
+ @objc func setConsentedObjectives(_ objectiveIds: [String]) -> Void {
252
+ self.getBlueConicClientInstance().setConsentedObjectives(objectiveIds)
253
+ }
254
+
255
+ /**
256
+ Sets the given objectives for refused objectives.
257
+ - parameter objectiveIds: An Array containing Strings to be set as the new objective IDs for the consented objectives list.
258
+ */
259
+ @objc func setRefusedObjectives(_ objectiveIds: [String]) -> Void {
260
+ self.getBlueConicClientInstance().setRefusedObjectives(objectiveIds)
261
+ }
262
+
263
+ // MARK: PUBLIC BLUECONIC FUNCTIONS
264
+
265
+ /**
266
+ Calls the createEvent method of the BlueConicClient to register a PAGEVIEW event. This must be called
267
+ on every screen change as it triggers the BlueConic SDK to load all plugins (i.e. listeners, dialoges)
268
+ for the screen.
269
+ - parameter screenName: The name of the screen.
270
+ */
271
+ @objc func createEvent(_ eventName: String, withProperties properties: [String: String]) -> Void {
272
+ self.getBlueConicClientInstance().createEvent(eventName, properties: properties)
273
+ }
274
+ @objc func createEventSync(_ eventName: String, withProperties properties: [String: String], withResolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
275
+ self.getBlueConicClientInstance().createEvent(eventName, properties: properties, completion: {
276
+ resolve([])
277
+ })
278
+ }
279
+ @objc func createEventSyncWithCallback(_ eventName: String, withProperties properties: [String: String], withCallback callback: @escaping RCTResponseSenderBlock) -> Void {
280
+ self.getBlueConicClientInstance().createEvent(eventName, properties: properties, completion: {
281
+ callback([])
282
+ })
283
+ }
284
+
285
+ /**
286
+ Calls the updateProfile method of the BlueConicClient to sync/ update the profile properties from the Mobile app with the BlueConic server.
287
+ */
288
+ @objc func updateProfile() -> Void {
289
+ self.getBlueConicClientInstance().updateProfile()
290
+ }
291
+ @objc func updateProfileSync(_ resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
292
+ self.getBlueConicClientInstance().updateProfile(completion: {
293
+ resolve([])
294
+ })
295
+ }
296
+ @objc func updateProfileSyncWithCallback(_ callback: @escaping RCTResponseSenderBlock) -> Void {
297
+ self.getBlueConicClientInstance().updateProfile(completion: {
298
+ callback([])
299
+ })
300
+ }
301
+
302
+ /**
303
+ Set the locale for the interactions.
304
+ Define multiple-languages in a interaction, and select a locale to return the correct variants for this locale
305
+ - parameter locale: The current locale of the app.
306
+ */
307
+ @objc func setLocale(_ locale: String) -> Void {
308
+ self.getBlueConicClientInstance().setLocale(locale)
309
+ }
310
+
311
+ /**
312
+ Set enabled.
313
+ Define to enable and disable the BlueConicClient
314
+ To prevent or re-activate tracking data
315
+ - parameter isEnabled: to enable or disable the BlueConicClient.
316
+ */
317
+ @objc func setEnabled(_ isEnabled: Bool) -> Void {
318
+ self.getBlueConicClientInstance().setEnabled(isEnabled)
319
+ }
320
+
321
+ /**
322
+ Return is BlueConicClient enabled. The value is passed to the provided callback function as seperated Strings.
323
+ - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
324
+ Native Modules to pass values back to the JavaScript.
325
+ */
326
+ @objc func isEnabled(_ resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
327
+ resolve([self.getBlueConicClientInstance().isEnabled()])
328
+ }
329
+
330
+ /**
331
+ Return is BlueConicClient enabled. The value is passed to the provided callback function as seperated Strings.
332
+ - parameter callback: The callback function to handle the obtained value. Callbacks are necessary in
333
+ Native Modules to pass values back to the JavaScript.
334
+ */
335
+ @objc func isEnabledWithCallback(_ callback: RCTResponseSenderBlock) -> Void {
336
+ callback([self.getBlueConicClientInstance().isEnabled()])
337
+ }
338
+
339
+ /**
340
+ Return if the profile is in the segment based on the segment id. The value is passed to the provided callback function as seperated Strings.
341
+ as separate Strings.
342
+ - parameter segmentId: The ID of the segment.
343
+ - parameter callback: The callback function to handle the obtained values. Callbacks are necessary in
344
+ Native Modules to pass values back to the JavaScript.
345
+ */
346
+ @objc func hasSegment(_ segmentId: String, withResolver resolve: RCTPromiseResolveBlock, rejecter reject: RCTPromiseRejectBlock) -> Void {
347
+ resolve([self.getBlueConicClientInstance().hasSegment(segmentId)])
348
+ }
349
+ /**
350
+ Return if the profile is in the segment based on the segment id. The value is passed to the provided callback function as seperated Strings.
351
+ as separate Strings.
352
+ - parameter segmentId: The ID of the segment.
353
+ - parameter callback: The callback function to handle the obtained values. Callbacks are necessary in
354
+ Native Modules to pass values back to the JavaScript.
355
+ */
356
+ @objc func hasSegmentWithCallback(_ segmentId: String, withCallback callback: RCTResponseSenderBlock) -> Void {
357
+ callback([self.getBlueConicClientInstance().hasSegment(segmentId)])
358
+ }
359
+
360
+
361
+ // MARK: REGISTERS
362
+ /**
363
+ Calls the createEvent method of the BlueConicClient to register a PAGEVIEW event. This must be called
364
+ on every screen change as it triggers the BlueConic SDK to load all plugins (i.e. listeners, dialoges)
365
+ for the screen.
366
+ - parameter screenName: The name of the screen.
367
+ */
368
+ @objc func registerPageView(_ screenName: String) -> Void {
369
+ self.getBlueConicClientInstance().createEvent("PAGEVIEW", properties: ["screenName": screenName])
370
+ }
371
+ @objc func registerPageViewSync(_ screenName: String, withResolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
372
+ self.getBlueConicClientInstance().createEvent("PAGEVIEW", properties: ["screenName": screenName], completion: {
373
+ resolve([])
374
+ })
375
+ }
376
+ @objc func registerPageViewSyncWithCallback(_ screenName: String, withCallback callback: @escaping RCTResponseSenderBlock) -> Void {
377
+ self.getBlueConicClientInstance().createEvent("PAGEVIEW", properties: ["screenName": screenName], completion: {
378
+ callback([])
379
+ })
380
+ }
381
+
382
+ /**
383
+ Creates a ClickEvent for the given selector and publishes the event to BlueConic using the EventManager.
384
+ - parameter selector: The selector to identify the clicked component.
385
+ */
386
+ @objc func registerClickEvent(_ selector: String) -> Void {
387
+ getBlueConicEventManager().publish(ClickEvent(selector: selector))
388
+ }
389
+
390
+ /**
391
+ Creates a ClickEvent with the given selector and context, and publishes the event to BlueConic using the EventManager.
392
+ - parameter selector: The selector to identify the clicked component.
393
+ - parameter values: The values to pass to BlueConic as the context of the event.
394
+ */
395
+ @objc func registerClickEventWithContext(_ selector: String, withValues values: [String]) -> Void {
396
+ getBlueConicEventManager().publish(ClickEvent(selector: selector, context: values))
397
+ }
398
+ /**
399
+ Creates an UpdateValuesEvent for the given selector and value, and publishes the event using the EventManager.
400
+ - parameter selector: The selector to identify the component with updated values.
401
+ - parameter value: The value to be passed on to BlueConic.
402
+ */
403
+ @objc func registerUpdateValuesEvent(_ selector: String, withValue value: String) -> Void {
404
+ getBlueConicEventManager().publish(UpdateValuesEvent(selector: selector, values: [value]))
405
+ }
406
+
407
+ /**
408
+ Creates an AdvancedEvent with the given name and values, and publishes the event using the EventManager.
409
+ - parameter name: The name to identify the event.
410
+ - parameter values: The values to pass to BlueConic as context of the event.
411
+ */
412
+ @objc func registerAdvancedEvent(_ name: String, withValues values: [String]) -> Void {
413
+ getBlueConicEventManager().publish(AdvancedEvent(eventName: name, context: values))
414
+ }
415
+
416
+
417
+ /**
418
+ Empty method. This method exists purely because we expose a method named destroyPlugins in the Android
419
+ Native Module. Exposing this empty method in iOS allows the user to call destroyPlugins in the JavaScript
420
+ without making a distinction for iOS and Android.
421
+ */
422
+ @objc func destroyPlugins() -> Void {
423
+
424
+ }
425
+
426
+ /**
427
+ Sends an event to the BlueConic server, indicating that a certain interaction was viewed, clicked, or converted for.
428
+ - parameter eventType: The event type to register for the interaction. Possible events are "VIEW", "CLICK" or "CONVERSION".
429
+ - parameter interactionId: The unique identifier of the interaction.
430
+ */
431
+ @objc func registerDialogueEvent(_ eventType: String, withInteractionId interactionId: String) -> Void {
432
+ self.getBlueConicClientInstance().createEvent(eventType, properties: ["interactionId": interactionId])
433
+ }
434
+
435
+
436
+ /**
437
+ Returns the current BlueConicClient instance
438
+ - returns: The BlueConicClient instance
439
+ */
440
+ private func getBlueConicClientInstance() -> BlueConicClient {
441
+ return BlueConicClient.getInstance()
442
+ }
443
+
444
+ /**
445
+ Returns the current BlueConicEventManager instance
446
+ - returns: The BlueConicEventManager instance
447
+ */
448
+ private func getBlueConicEventManager() -> BlueConicEventManager {
449
+ return BlueConicEventFactory.getInstance()
450
+ }
451
+
452
+ /**
453
+ Return the segments in a list of dictionaries.
454
+ - returns: The list of Segments as a dictionary
455
+ */
456
+ private func getFormattedSegments() -> [[String: String]] {
457
+ let segments = self.getBlueConicClientInstance().getSegments()
458
+ var result = [[String: String]]()
459
+
460
+ for segment in segments {
461
+ let item = [
462
+ "id": segment.getId(),
463
+ "name": segment.getName()
464
+ ]
465
+ result.append(item)
466
+ }
467
+ return result
468
+ }
469
+
470
+ /**
471
+ Static method that is called by the BlueConicInteraction when it receives the parameters of the dialogue,
472
+ and when the dialogue is destroyed by the BlueConic SDK. An event is published to which the JavaScript of the app
473
+ should subscribe.
474
+ - parameter properties: The properties of the dialogue as received from BlueConic.
475
+ */
476
+ static func publishDialogueEvent(_ properties: Dictionary<String, Any>, eventName: String) -> Void {
477
+ if hasListeners ?? false {
478
+ moduleInstance?.sendEvent(withName: eventName, body: properties)
479
+ }
480
+ }
481
+
482
+ /**
483
+ Private helper function to obtain the parameter value as configured in BlueConic.
484
+ - parameter values: The array of values
485
+ - returns: The string value of the specified parameter.
486
+ */
487
+ private static func getParameterValue(_ values: [String]) -> String {
488
+ if values.count > 0 && values[0] != "" {
489
+ return values[0]
490
+ } else {
491
+ return ""
492
+ }
493
+ }
494
+
495
+ /**
496
+ Method that lists the events that may be published by this Native Module.
497
+ - returns: An array of event names that may be published to the JavaScript.
498
+ */
499
+ override func supportedEvents() -> [String]! {
500
+ return ["onBlueConicPluginLoad", "onBlueConicPluginDestroyed"]
501
+ }
502
+
503
+ /**
504
+ Method that is called when the JavaScript adds a listener to the NativeEventEmitter of this Native Module.
505
+ */
506
+ override func startObserving() {
507
+ BlueConicClientModule.hasListeners = true
508
+ }
509
+
510
+ /**
511
+ Method that is called when the JavaScript removes a listener of the NativeEventEmitter of this Native Module.
512
+ */
513
+ override func stopObserving() {
514
+ BlueConicClientModule.hasListeners = false
515
+ }
516
+ }