@woosmap/react-native-plugin-geofencing 0.1.25 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/reactnativeplugingeofencing/AbstractPushHelper.java +7 -0
- package/android/src/main/java/com/reactnativeplugingeofencing/AirshipPushHelper.java +157 -0
- package/android/src/main/java/com/reactnativeplugingeofencing/PluginGeofencingModule.java +4 -0
- package/android/src/main/java/com/reactnativeplugingeofencing/WoosRegionReadyListener.java +8 -1
- package/android/src/main/java/com/reactnativeplugingeofencing/WoosmapMessageAndKey.java +1 -0
- package/android/src/main/java/com/reactnativeplugingeofencing/WoosmapUtil.java +17 -0
- package/ios/AirshipEvents.swift +48 -12
- package/ios/PluginGeofencing.swift +64 -54
- package/ios/WoosmapGeofenceService.swift +14 -13
- package/lib/commonjs/index.js +333 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/internal/Airship.js +30 -0
- package/lib/commonjs/internal/Airship.js.map +1 -0
- package/lib/commonjs/internal/Location.js +45 -0
- package/lib/commonjs/internal/Location.js.map +1 -0
- package/lib/commonjs/internal/MarketingCloud.js +30 -0
- package/lib/commonjs/internal/MarketingCloud.js.map +1 -0
- package/lib/commonjs/internal/Poi.js +82 -0
- package/lib/commonjs/internal/Poi.js.map +1 -0
- package/lib/commonjs/internal/Region.js +57 -0
- package/lib/commonjs/internal/Region.js.map +1 -0
- package/lib/commonjs/internal/Visit.js +41 -0
- package/lib/commonjs/internal/Visit.js.map +1 -0
- package/lib/commonjs/internal/Zoi.js +77 -0
- package/lib/commonjs/internal/Zoi.js.map +1 -0
- package/lib/commonjs/internal/nativeInterface.js +14 -0
- package/lib/commonjs/internal/nativeInterface.js.map +1 -0
- package/lib/commonjs/internal/types.js +2 -0
- package/lib/commonjs/internal/types.js.map +1 -0
- package/{src/index.tsx → lib/module/index.js} +73 -123
- package/lib/module/index.js.map +1 -0
- package/lib/module/internal/Airship.js +28 -0
- package/lib/module/internal/Airship.js.map +1 -0
- package/lib/module/internal/Location.js +38 -0
- package/lib/module/internal/Location.js.map +1 -0
- package/lib/module/internal/MarketingCloud.js +28 -0
- package/lib/module/internal/MarketingCloud.js.map +1 -0
- package/lib/module/internal/Poi.js +75 -0
- package/lib/module/internal/Poi.js.map +1 -0
- package/lib/module/internal/Region.js +50 -0
- package/lib/module/internal/Region.js.map +1 -0
- package/lib/module/internal/Visit.js +39 -0
- package/lib/module/internal/Visit.js.map +1 -0
- package/{src/internal/Zoi.tsx → lib/module/internal/Zoi.js} +24 -56
- package/lib/module/internal/Zoi.js.map +1 -0
- package/{src/internal/nativeInterface.tsx → lib/module/internal/nativeInterface.js} +1 -2
- package/lib/module/internal/nativeInterface.js.map +1 -0
- package/lib/module/internal/types.js +2 -0
- package/lib/module/internal/types.js.map +1 -0
- package/lib/typescript/__tests__/index.test.d.ts +0 -0
- package/lib/typescript/index.d.ts +156 -0
- package/lib/typescript/internal/Airship.d.ts +18 -0
- package/lib/typescript/internal/Location.d.ts +26 -0
- package/lib/typescript/internal/MarketingCloud.d.ts +18 -0
- package/lib/typescript/internal/Poi.d.ts +50 -0
- package/lib/typescript/internal/Region.d.ts +34 -0
- package/lib/typescript/internal/Visit.d.ts +25 -0
- package/lib/typescript/internal/Zoi.d.ts +49 -0
- package/lib/typescript/internal/nativeInterface.d.ts +2 -0
- package/{src/internal/types.tsx → lib/typescript/internal/types.d.ts} +5 -7
- package/package.json +144 -1
- package/react-native-plugin-geofencing.podspec +8 -1
- package/src/__tests__/index.test.tsx +0 -1
- package/src/internal/Airship.tsx +0 -24
- package/src/internal/Location.tsx +0 -46
- package/src/internal/MarketingCloud.tsx +0 -24
- package/src/internal/Poi.tsx +0 -107
- package/src/internal/Region.tsx +0 -66
- package/src/internal/Visit.tsx +0 -49
|
@@ -63,7 +63,7 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
//MARK: Private method
|
|
66
|
-
private func
|
|
66
|
+
private func showWoosmapError(_ msg: String) -> NSError {
|
|
67
67
|
var result: [String: Any] = [:]
|
|
68
68
|
result["message"] = msg
|
|
69
69
|
let resultError: NSError = NSError(domain: WoosmapGeofenceMessage.plugin_errorDomain, code: WoosmapGeofenceMessage.plugin_errorcode,userInfo: result)
|
|
@@ -79,35 +79,45 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
79
79
|
@objc(initialize:withResolver:withRejecter:)
|
|
80
80
|
func initialize(command: NSDictionary, resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void{
|
|
81
81
|
|
|
82
|
-
guard let
|
|
82
|
+
guard let initParameters = command as? [String: Any] else {
|
|
83
83
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
84
84
|
WoosmapGeofenceMessage.plugin_parsingFailed,
|
|
85
|
-
|
|
85
|
+
showWoosmapError(WoosmapGeofenceMessage.plugin_parsingFailed))
|
|
86
86
|
return
|
|
87
87
|
}
|
|
88
|
-
var
|
|
88
|
+
var isCallUnsuccessful = false
|
|
89
89
|
var privateKeyWoosmapAPI = ""
|
|
90
|
+
var isAirshipCallbackEnable: Bool = false
|
|
90
91
|
|
|
91
|
-
if let keyWoosmapAPI =
|
|
92
|
+
if let keyWoosmapAPI = initParameters["privateKeyWoosmapAPI"] as? String {
|
|
92
93
|
privateKeyWoosmapAPI = keyWoosmapAPI
|
|
93
94
|
}
|
|
95
|
+
#if canImport(AirshipKit)
|
|
96
|
+
if let keyAirshipPush = initParameters["enableAirshipConnector"] as? Bool {
|
|
97
|
+
isAirshipCallbackEnable = keyAirshipPush
|
|
98
|
+
}
|
|
99
|
+
#endif
|
|
94
100
|
|
|
95
|
-
if let trackingProfile =
|
|
101
|
+
if let trackingProfile = initParameters["trackingProfile"] as? String {
|
|
96
102
|
if ConfigurationProfile(rawValue: trackingProfile) != nil {
|
|
97
|
-
WoosmapGeofenceService.setup(woosmapKey: privateKeyWoosmapAPI,
|
|
103
|
+
WoosmapGeofenceService.setup(woosmapKey: privateKeyWoosmapAPI,
|
|
104
|
+
configurationProfile: trackingProfile,
|
|
105
|
+
airshipTrackingEnable: isAirshipCallbackEnable)
|
|
98
106
|
|
|
99
107
|
} else {
|
|
100
|
-
|
|
108
|
+
isCallUnsuccessful = true
|
|
101
109
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
102
110
|
WoosmapGeofenceMessage.invalidProfile,
|
|
103
|
-
|
|
111
|
+
showWoosmapError(WoosmapGeofenceMessage.invalidProfile))
|
|
104
112
|
|
|
105
113
|
}
|
|
106
114
|
|
|
107
115
|
} else {
|
|
108
|
-
WoosmapGeofenceService.setup(woosmapKey: privateKeyWoosmapAPI,
|
|
116
|
+
WoosmapGeofenceService.setup(woosmapKey: privateKeyWoosmapAPI,
|
|
117
|
+
configurationProfile: "",
|
|
118
|
+
airshipTrackingEnable: isAirshipCallbackEnable)
|
|
109
119
|
}
|
|
110
|
-
if(
|
|
120
|
+
if(isCallUnsuccessful == false){
|
|
111
121
|
resolve(WoosmapGeofenceMessage.initialize)
|
|
112
122
|
}
|
|
113
123
|
}
|
|
@@ -151,21 +161,21 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
151
161
|
} catch let error as WoosGeofenceError {
|
|
152
162
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
153
163
|
error.localizedDescription,
|
|
154
|
-
|
|
164
|
+
showWoosmapError(error.localizedDescription))
|
|
155
165
|
} catch {
|
|
156
166
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
157
167
|
error.localizedDescription,
|
|
158
|
-
|
|
168
|
+
showWoosmapError(error.localizedDescription))
|
|
159
169
|
}
|
|
160
170
|
} else {
|
|
161
171
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
162
172
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
163
|
-
|
|
173
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
164
174
|
}
|
|
165
175
|
} else {
|
|
166
176
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
167
177
|
WoosmapGeofenceMessage.invalidWoosmapKey,
|
|
168
|
-
|
|
178
|
+
showWoosmapError(WoosmapGeofenceMessage.invalidWoosmapKey))
|
|
169
179
|
}
|
|
170
180
|
}
|
|
171
181
|
|
|
@@ -180,21 +190,21 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
180
190
|
} catch let error as WoosGeofenceError {
|
|
181
191
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
182
192
|
error.localizedDescription,
|
|
183
|
-
|
|
193
|
+
showWoosmapError(error.localizedDescription))
|
|
184
194
|
} catch {
|
|
185
195
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
186
196
|
error.localizedDescription,
|
|
187
|
-
|
|
197
|
+
showWoosmapError(error.localizedDescription))
|
|
188
198
|
}
|
|
189
199
|
} else {
|
|
190
200
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
191
201
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
192
|
-
|
|
202
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
193
203
|
}
|
|
194
204
|
} else {
|
|
195
205
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
196
206
|
WoosmapGeofenceMessage.invalidWoosmapKey,
|
|
197
|
-
|
|
207
|
+
showWoosmapError(WoosmapGeofenceMessage.invalidWoosmapKey))
|
|
198
208
|
}
|
|
199
209
|
}
|
|
200
210
|
|
|
@@ -215,7 +225,7 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
215
225
|
else{
|
|
216
226
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
217
227
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
218
|
-
|
|
228
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
219
229
|
}
|
|
220
230
|
}
|
|
221
231
|
|
|
@@ -325,7 +335,7 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
325
335
|
} else {
|
|
326
336
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
327
337
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
328
|
-
|
|
338
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
329
339
|
}
|
|
330
340
|
|
|
331
341
|
}
|
|
@@ -384,7 +394,7 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
384
394
|
} else {
|
|
385
395
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
386
396
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
387
|
-
|
|
397
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
388
398
|
}
|
|
389
399
|
|
|
390
400
|
}
|
|
@@ -467,11 +477,11 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
467
477
|
if lat == 0 || lng == 0 {
|
|
468
478
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
469
479
|
WoosmapGeofenceMessage.invalidLocation,
|
|
470
|
-
|
|
480
|
+
showWoosmapError(WoosmapGeofenceMessage.invalidLocation))
|
|
471
481
|
} else if !(regiontype == "circle" || regiontype == "isochrone") {
|
|
472
482
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
473
483
|
WoosmapGeofenceMessage.invalidRegionType,
|
|
474
|
-
|
|
484
|
+
showWoosmapError(WoosmapGeofenceMessage.invalidRegionType))
|
|
475
485
|
} else {
|
|
476
486
|
let coordinate: CLLocationCoordinate2D = CLLocationCoordinate2D.init(latitude: lat, longitude: lng)
|
|
477
487
|
|
|
@@ -485,19 +495,19 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
485
495
|
else{
|
|
486
496
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
487
497
|
WoosmapGeofenceMessage.regionInfoDuplicateID,
|
|
488
|
-
|
|
498
|
+
showWoosmapError(WoosmapGeofenceMessage.regionInfoDuplicateID))
|
|
489
499
|
}
|
|
490
500
|
}
|
|
491
501
|
} else {
|
|
492
502
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
493
503
|
WoosmapGeofenceMessage.regionInfoEmptyOrNull,
|
|
494
|
-
|
|
504
|
+
showWoosmapError(WoosmapGeofenceMessage.regionInfoEmptyOrNull))
|
|
495
505
|
}
|
|
496
506
|
|
|
497
507
|
} else {
|
|
498
508
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
499
509
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
500
|
-
|
|
510
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
501
511
|
}
|
|
502
512
|
}
|
|
503
513
|
|
|
@@ -516,21 +526,21 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
516
526
|
} catch let error as WoosGeofenceError {
|
|
517
527
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
518
528
|
error.localizedDescription,
|
|
519
|
-
|
|
529
|
+
showWoosmapError(error.localizedDescription))
|
|
520
530
|
} catch {
|
|
521
531
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
522
532
|
error.localizedDescription,
|
|
523
|
-
|
|
533
|
+
showWoosmapError(error.localizedDescription))
|
|
524
534
|
}
|
|
525
535
|
} else {
|
|
526
536
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
527
537
|
WoosmapGeofenceMessage.invalidSFMCCredentials,
|
|
528
|
-
|
|
538
|
+
showWoosmapError(WoosmapGeofenceMessage.invalidSFMCCredentials))
|
|
529
539
|
}
|
|
530
540
|
} else {
|
|
531
541
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
532
542
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
533
|
-
|
|
543
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
534
544
|
}
|
|
535
545
|
}
|
|
536
546
|
|
|
@@ -560,12 +570,12 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
560
570
|
} else {
|
|
561
571
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
562
572
|
WoosmapGeofenceMessage.invalidPOIRadius,
|
|
563
|
-
|
|
573
|
+
showWoosmapError(WoosmapGeofenceMessage.invalidPOIRadius))
|
|
564
574
|
}
|
|
565
575
|
} else {
|
|
566
576
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
567
577
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
568
|
-
|
|
578
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
569
579
|
}
|
|
570
580
|
}
|
|
571
581
|
|
|
@@ -586,7 +596,7 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
586
596
|
} else {
|
|
587
597
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
588
598
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
589
|
-
|
|
599
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
590
600
|
}
|
|
591
601
|
}
|
|
592
602
|
|
|
@@ -605,19 +615,19 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
605
615
|
else{
|
|
606
616
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
607
617
|
WoosmapGeofenceMessage.notfound_regionid,
|
|
608
|
-
|
|
618
|
+
showWoosmapError(WoosmapGeofenceMessage.notfound_regionid))
|
|
609
619
|
}
|
|
610
620
|
}
|
|
611
621
|
else{
|
|
612
622
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
613
623
|
WoosmapGeofenceMessage.required_regionid,
|
|
614
|
-
|
|
624
|
+
showWoosmapError(WoosmapGeofenceMessage.required_regionid))
|
|
615
625
|
}
|
|
616
626
|
|
|
617
627
|
} else {
|
|
618
628
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
619
629
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
620
|
-
|
|
630
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
621
631
|
}
|
|
622
632
|
}
|
|
623
633
|
|
|
@@ -633,7 +643,7 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
633
643
|
} else {
|
|
634
644
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
635
645
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
636
|
-
|
|
646
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
637
647
|
}
|
|
638
648
|
}
|
|
639
649
|
|
|
@@ -653,23 +663,23 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
653
663
|
catch let error as WoosGeofenceError {
|
|
654
664
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
655
665
|
error.localizedDescription,
|
|
656
|
-
|
|
666
|
+
showWoosmapError(error.localizedDescription))
|
|
657
667
|
} catch {
|
|
658
668
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
659
669
|
error.localizedDescription,
|
|
660
|
-
|
|
670
|
+
showWoosmapError(error.localizedDescription))
|
|
661
671
|
}
|
|
662
672
|
}
|
|
663
673
|
else{
|
|
664
674
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
665
675
|
WoosmapGeofenceMessage.required_regionid,
|
|
666
|
-
|
|
676
|
+
showWoosmapError(WoosmapGeofenceMessage.required_regionid))
|
|
667
677
|
}
|
|
668
678
|
|
|
669
679
|
} else {
|
|
670
680
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
671
681
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
672
|
-
|
|
682
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
673
683
|
}
|
|
674
684
|
}
|
|
675
685
|
|
|
@@ -690,7 +700,7 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
690
700
|
} else {
|
|
691
701
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
692
702
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
693
|
-
|
|
703
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
694
704
|
}
|
|
695
705
|
}
|
|
696
706
|
|
|
@@ -709,19 +719,19 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
709
719
|
else{
|
|
710
720
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
711
721
|
WoosmapGeofenceMessage.notfound_locationid,
|
|
712
|
-
|
|
722
|
+
showWoosmapError(WoosmapGeofenceMessage.notfound_locationid))
|
|
713
723
|
}
|
|
714
724
|
}
|
|
715
725
|
else{
|
|
716
726
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
717
727
|
WoosmapGeofenceMessage.required_regionid,
|
|
718
|
-
|
|
728
|
+
showWoosmapError(WoosmapGeofenceMessage.required_regionid))
|
|
719
729
|
}
|
|
720
730
|
|
|
721
731
|
} else {
|
|
722
732
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
723
733
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
724
|
-
|
|
734
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
725
735
|
}
|
|
726
736
|
}
|
|
727
737
|
|
|
@@ -741,7 +751,7 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
741
751
|
} else {
|
|
742
752
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
743
753
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
744
|
-
|
|
754
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
745
755
|
}
|
|
746
756
|
}
|
|
747
757
|
|
|
@@ -760,19 +770,19 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
760
770
|
else{
|
|
761
771
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
762
772
|
WoosmapGeofenceMessage.notfound_poiid,
|
|
763
|
-
|
|
773
|
+
showWoosmapError(WoosmapGeofenceMessage.notfound_poiid))
|
|
764
774
|
}
|
|
765
775
|
}
|
|
766
776
|
else{
|
|
767
777
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
768
778
|
WoosmapGeofenceMessage.required_poiid,
|
|
769
|
-
|
|
779
|
+
showWoosmapError(WoosmapGeofenceMessage.required_poiid))
|
|
770
780
|
}
|
|
771
781
|
|
|
772
782
|
} else {
|
|
773
783
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
774
784
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
775
|
-
|
|
785
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
776
786
|
}
|
|
777
787
|
}
|
|
778
788
|
|
|
@@ -788,7 +798,7 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
788
798
|
} else {
|
|
789
799
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
790
800
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
791
|
-
|
|
801
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
792
802
|
}
|
|
793
803
|
}
|
|
794
804
|
|
|
@@ -804,7 +814,7 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
804
814
|
} else {
|
|
805
815
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
806
816
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
807
|
-
|
|
817
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
808
818
|
}
|
|
809
819
|
}
|
|
810
820
|
|
|
@@ -826,7 +836,7 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
826
836
|
if let functionError = Error{
|
|
827
837
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
828
838
|
functionError.localizedDescription,
|
|
829
|
-
self.
|
|
839
|
+
self.showWoosmapError(functionError.localizedDescription))
|
|
830
840
|
}
|
|
831
841
|
else{
|
|
832
842
|
if(Value){
|
|
@@ -837,7 +847,7 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
837
847
|
} else {
|
|
838
848
|
reject(WoosmapGeofenceMessage.plugin_errorDomain,
|
|
839
849
|
WoosmapGeofenceMessage.woosemapNotInitialized,
|
|
840
|
-
|
|
850
|
+
showWoosmapError(WoosmapGeofenceMessage.woosemapNotInitialized))
|
|
841
851
|
}
|
|
842
852
|
}
|
|
843
853
|
|
|
@@ -9,9 +9,6 @@ import Foundation
|
|
|
9
9
|
import UIKit
|
|
10
10
|
import CoreLocation
|
|
11
11
|
import WoosmapGeofencing
|
|
12
|
-
#if canImport(AirshipCore)
|
|
13
|
-
import AirshipCore
|
|
14
|
-
#endif
|
|
15
12
|
|
|
16
13
|
/// Geofence services
|
|
17
14
|
@objc(WoosmapGeofenceService) public class WoosmapGeofenceService: NSObject {
|
|
@@ -27,6 +24,7 @@ import AirshipCore
|
|
|
27
24
|
private static var _shared: WoosmapGeofenceService?
|
|
28
25
|
private var woosmapKey: String = ""
|
|
29
26
|
private var defaultProfile: String = ""
|
|
27
|
+
private var enableAirshipCallback: Bool = false
|
|
30
28
|
private let dataLocation = DataLocation()
|
|
31
29
|
private let dataPOI = DataPOI()
|
|
32
30
|
private let dataDistance = DataDistance()
|
|
@@ -130,6 +128,7 @@ import AirshipCore
|
|
|
130
128
|
let defaults = UserDefaults.standard
|
|
131
129
|
let woosmapKey = defaults.string(forKey: "WoosmapGeofenceService.woosmap") ?? ""
|
|
132
130
|
let defaultProfile = defaults.string(forKey: "WoosmapGeofenceService.profile") ?? ""
|
|
131
|
+
self.enableAirshipCallback = defaults.bool(forKey: "WoosmapGeofenceService.AirshipCallbackEnable")
|
|
133
132
|
self.woosmapKey = woosmapKey
|
|
134
133
|
self.defaultProfile = defaultProfile
|
|
135
134
|
|
|
@@ -147,15 +146,17 @@ import AirshipCore
|
|
|
147
146
|
/// - Parameters:
|
|
148
147
|
/// - woosmapKey: key use for woosmap service
|
|
149
148
|
/// - configurationProfile: configuration profile
|
|
150
|
-
|
|
149
|
+
/// - airshipEnable: To enable airship callback
|
|
150
|
+
private init(_ woosmapKey: String, _ configurationProfile: String, _ airshipEnable: Bool = false) {
|
|
151
151
|
super.init()
|
|
152
152
|
self.woosmapKey = woosmapKey
|
|
153
153
|
self.defaultProfile = configurationProfile
|
|
154
|
-
|
|
155
|
-
// Save it on
|
|
154
|
+
self.enableAirshipCallback = airshipEnable
|
|
155
|
+
// Save it on preferences
|
|
156
156
|
let defaults = UserDefaults.standard
|
|
157
157
|
defaults.set(woosmapKey, forKey: "WoosmapGeofenceService.woosmap")
|
|
158
158
|
defaults.set(configurationProfile, forKey: "WoosmapGeofenceService.profile")
|
|
159
|
+
defaults.set(airshipEnable, forKey: "WoosmapGeofenceService.AirshipCallbackEnable")
|
|
159
160
|
|
|
160
161
|
defaults.register(defaults: ["TrackingEnable": true,
|
|
161
162
|
"ModeHighfrequencyLocation": false,
|
|
@@ -169,11 +170,11 @@ import AirshipCore
|
|
|
169
170
|
/// - Parameters:
|
|
170
171
|
/// - woosmapKey: key use for woosmap service
|
|
171
172
|
/// - configurationProfile: configuration profile
|
|
172
|
-
@objc public static func setup(woosmapKey: String, configurationProfile: String) {
|
|
173
|
+
@objc public static func setup(woosmapKey: String, configurationProfile: String,airshipTrackingEnable: Bool = false) {
|
|
173
174
|
let group = DispatchGroup()
|
|
174
175
|
group.enter()
|
|
175
176
|
DispatchQueue.main.async {
|
|
176
|
-
_shared = WoosmapGeofenceService.init( woosmapKey, configurationProfile)
|
|
177
|
+
_shared = WoosmapGeofenceService.init( woosmapKey, configurationProfile,airshipTrackingEnable)
|
|
177
178
|
group.leave()
|
|
178
179
|
}
|
|
179
180
|
group.wait()
|
|
@@ -254,11 +255,11 @@ import AirshipCore
|
|
|
254
255
|
|
|
255
256
|
// Enable Visit and set delegate of protocol Visit
|
|
256
257
|
WoosmapGeofencing.shared.getLocationService().visitDelegate = dataVisit
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
258
|
+
if(self.enableAirshipCallback){
|
|
259
|
+
// Set delagate for Airship Cloud
|
|
260
|
+
WoosmapGeofencing.shared.getLocationService().airshipEventsDelegate = airshipEvents
|
|
261
|
+
}
|
|
262
|
+
|
|
262
263
|
// Set delagate for Marketing Cloud
|
|
263
264
|
WoosmapGeofencing.shared.getLocationService().marketingCloudEventsDelegate = marketingCloudEvents
|
|
264
265
|
if defaultPOIRadius != "" {
|