@woosmap/react-native-plugin-geofencing 1.0.0-beta.1 → 1.0.0-beta.3

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 (41) hide show
  1. package/CHANGELOG.md +1 -2
  2. package/README.md +0 -9
  3. package/android/build.gradle +1 -1
  4. package/android/src/main/java/com/{reactnativeplugingeofencing → woosmap/reactnativeplugingeofencing}/AbstractPushHelper.java +1 -1
  5. package/android/src/main/java/com/{reactnativeplugingeofencing → woosmap/reactnativeplugingeofencing}/AirshipPushHelper.java +1 -1
  6. package/android/src/main/java/com/{reactnativeplugingeofencing → woosmap/reactnativeplugingeofencing}/WoosLocationReadyListener.java +1 -1
  7. package/android/src/main/java/com/{reactnativeplugingeofencing → woosmap/reactnativeplugingeofencing}/WoosRegionReadyListener.java +1 -1
  8. package/android/src/main/java/com/woosmap/reactnativeplugingeofencing/WoosmapGeofencingTurboModule.java +1025 -0
  9. package/android/src/main/java/com/{reactnativeplugingeofencing → woosmap/reactnativeplugingeofencing}/WoosmapGeofencingTurboPackage.java +3 -7
  10. package/android/src/main/java/com/{reactnativeplugingeofencing → woosmap/reactnativeplugingeofencing}/WoosmapMessageAndKey.java +2 -3
  11. package/android/src/main/java/com/{reactnativeplugingeofencing → woosmap/reactnativeplugingeofencing}/WoosmapTask.java +34 -128
  12. package/android/src/main/java/com/{reactnativeplugingeofencing → woosmap/reactnativeplugingeofencing}/WoosmapUtil.java +1 -1
  13. package/ios/WoosmapGeofenceMessage.swift +1 -0
  14. package/ios/WoosmapGeofencingTurbo.mm +110 -10
  15. package/ios/WoosmapGeofencingTurbo.swift +873 -11
  16. package/lib/commonjs/NativeWoosmapGeofencingTurbo.js +6 -3
  17. package/lib/commonjs/NativeWoosmapGeofencingTurbo.js.map +1 -1
  18. package/lib/commonjs/index.js +37 -131
  19. package/lib/commonjs/index.js.map +1 -1
  20. package/lib/module/NativeWoosmapGeofencingTurbo.js +6 -3
  21. package/lib/module/NativeWoosmapGeofencingTurbo.js.map +1 -1
  22. package/lib/module/index.js +37 -131
  23. package/lib/module/index.js.map +1 -1
  24. package/lib/typescript/src/NativeWoosmapGeofencingTurbo.d.ts +37 -3
  25. package/lib/typescript/src/NativeWoosmapGeofencingTurbo.d.ts.map +1 -1
  26. package/lib/typescript/src/index.d.ts +3 -3
  27. package/lib/typescript/src/index.d.ts.map +1 -1
  28. package/package.json +2 -1
  29. package/src/NativeWoosmapGeofencingTurbo.ts +109 -0
  30. package/android/src/main/java/com/reactnativeplugingeofencing/PluginGeofencingModule.java +0 -1204
  31. package/android/src/main/java/com/reactnativeplugingeofencing/PluginGeofencingPackage.java +0 -28
  32. package/android/src/main/java/com/reactnativeplugingeofencing/WoosmapGeofencingTurboModule.java +0 -185
  33. package/ios/PluginGeofencing.mm +0 -123
  34. package/ios/PluginGeofencing.swift +0 -1243
  35. package/lib/commonjs/internal/nativeInterface.js +0 -13
  36. package/lib/commonjs/internal/nativeInterface.js.map +0 -1
  37. package/lib/module/internal/nativeInterface.js +0 -9
  38. package/lib/module/internal/nativeInterface.js.map +0 -1
  39. package/lib/typescript/src/internal/nativeInterface.d.ts +0 -3
  40. package/lib/typescript/src/internal/nativeInterface.d.ts.map +0 -1
  41. /package/ios/{PluginGeofencing-Bridging-Header.h → WoosmapGeofencing-Bridging-Header.h} +0 -0
@@ -1,28 +0,0 @@
1
- package com.reactnativeplugingeofencing;
2
-
3
- import androidx.annotation.NonNull;
4
-
5
- import com.facebook.react.ReactPackage;
6
- import com.facebook.react.bridge.NativeModule;
7
- import com.facebook.react.bridge.ReactApplicationContext;
8
- import com.facebook.react.uimanager.ViewManager;
9
-
10
- import java.util.ArrayList;
11
- import java.util.Collections;
12
- import java.util.List;
13
-
14
- public class PluginGeofencingPackage implements ReactPackage {
15
- @NonNull
16
- @Override
17
- public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
18
- List<NativeModule> modules = new ArrayList<>();
19
- modules.add(new PluginGeofencingModule(reactContext));
20
- return modules;
21
- }
22
-
23
- @NonNull
24
- @Override
25
- public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
26
- return Collections.emptyList();
27
- }
28
- }
@@ -1,185 +0,0 @@
1
- package com.reactnativeplugingeofencing;
2
-
3
- import android.os.Build;
4
-
5
- import androidx.annotation.NonNull;
6
- import androidx.annotation.Nullable;
7
- import androidx.annotation.RequiresApi;
8
-
9
- import com.facebook.react.bridge.Promise;
10
- import com.facebook.react.bridge.ReactApplicationContext;
11
- import com.facebook.react.bridge.ReadableMap;
12
- import com.facebook.react.module.annotations.ReactModule;
13
- import com.woosmap.reactnativeplugingeofencing.NativeWoosmapGeofencingTurboSpec;
14
- import com.webgeoservices.woosmapgeofencing.Woosmap;
15
- import com.webgeoservices.woosmapgeofencing.WoosmapSettings;
16
- import com.webgeoservices.woosmapgeofencingcore.database.Region;
17
-
18
- /**
19
- * TurboModule implementation for the region-CRUD + key/radius slice migrated
20
- * Extends the codegen-generated
21
- * {@code NativeWoosmapGeofencingTurboSpec} abstract class.
22
- *
23
- * <p>This is a thin adapter over the shared {@link WoosmapTask} /
24
- * {@link WoosmapSettings} layer — the same layer the legacy
25
- * {@code PluginGeofencingModule} talks to — so the two modules stay
26
- * independent without duplicating business logic. The SDK singleton
27
- * ({@link Woosmap#getInstance()}) is shared, so a region added here lands in
28
- * the same store that {@code initialize()} (still on the legacy module) set up.
29
- */
30
- @ReactModule(name = WoosmapGeofencingTurboModule.NAME)
31
- public class WoosmapGeofencingTurboModule extends NativeWoosmapGeofencingTurboSpec {
32
- public static final String NAME = "WoosmapGeofencingTurbo";
33
-
34
- private final ReactApplicationContext reactContext;
35
-
36
- public WoosmapGeofencingTurboModule(ReactApplicationContext reactContext) {
37
- super(reactContext);
38
- this.reactContext = reactContext;
39
- }
40
-
41
- @Override
42
- @NonNull
43
- public String getName() {
44
- return NAME;
45
- }
46
-
47
- /**
48
- * The Woosmap SDK is a process singleton initialised by the legacy module's
49
- * {@code initialize()}. We can't see that module's private field, so we use
50
- * the singleton's presence as the readiness proxy for this sprint.
51
- */
52
- private boolean isWoosmapInitialized() {
53
- return Woosmap.getInstance() != null;
54
- }
55
-
56
- private boolean onlyContainsNumbers(String text) {
57
- try {
58
- Long.parseLong(text);
59
- return true;
60
- } catch (NumberFormatException ex) {
61
- return false;
62
- }
63
- }
64
-
65
- private boolean onlyContainsDouble(String text) {
66
- try {
67
- Double.parseDouble(text);
68
- return true;
69
- } catch (NumberFormatException ex) {
70
- return false;
71
- }
72
- }
73
-
74
- @Override
75
- public void setWoosmapApiKey(String apiKey, Promise promise) {
76
- try {
77
- if (!isWoosmapInitialized()) {
78
- promise.reject(WoosmapMessageAndKey.errorCode, WoosmapMessageAndKey.woosmapNotInitialized);
79
- return;
80
- }
81
- if (apiKey == null || apiKey.isEmpty()) {
82
- promise.reject(WoosmapMessageAndKey.errorCode, WoosmapMessageAndKey.woosmapKeyNotProvide);
83
- return;
84
- }
85
- WoosmapSettings.privateKeyWoosmapAPI = apiKey;
86
- promise.resolve(WoosmapMessageAndKey.successMessage);
87
- } catch (Exception ex) {
88
- promise.reject(WoosmapMessageAndKey.errorCode, ex.getMessage());
89
- }
90
- }
91
-
92
- @Override
93
- public void setPoiRadius(String radius, Promise promise) {
94
- try {
95
- if (!isWoosmapInitialized()) {
96
- promise.reject(WoosmapMessageAndKey.errorCode, WoosmapMessageAndKey.woosmapNotInitialized);
97
- return;
98
- }
99
- if (radius == null || radius.isEmpty()) {
100
- throw new Exception(WoosmapMessageAndKey.radiusEmptyMessage);
101
- }
102
- if (onlyContainsNumbers(radius)) {
103
- WoosmapSettings.poiRadius = Integer.parseInt(radius);
104
- } else if (onlyContainsDouble(radius)) {
105
- WoosmapSettings.poiRadius = (int) Math.round(Double.parseDouble(radius));
106
- } else {
107
- WoosmapSettings.poiRadiusNameFromResponse = radius;
108
- }
109
- promise.resolve(WoosmapMessageAndKey.successMessage);
110
- } catch (Exception ex) {
111
- promise.reject(WoosmapMessageAndKey.errorCode, ex.getMessage());
112
- }
113
- }
114
-
115
- @RequiresApi(api = Build.VERSION_CODES.N)
116
- @Override
117
- public void addRegion(ReadableMap region, Promise promise) {
118
- try {
119
- if (!isWoosmapInitialized()) {
120
- promise.reject(WoosmapMessageAndKey.errorCode, WoosmapMessageAndKey.woosmapNotInitialized);
121
- return;
122
- }
123
- if (region == null || region.toHashMap().isEmpty()) {
124
- throw new Exception(WoosmapMessageAndKey.regionInfoEmptyMessage);
125
- }
126
- Region woosRegion = new Region();
127
- woosRegion.identifier = region.getString("regionId");
128
- woosRegion.idStore = region.hasKey("idStore") ? region.getString("idStore") : "";
129
- woosRegion.lat = region.getDouble("lat");
130
- woosRegion.lng = region.getDouble("lng");
131
- woosRegion.type = region.hasKey("type") ? region.getString("type") : "";
132
- woosRegion.radius = region.getDouble("radius");
133
-
134
- WoosmapTask.getInstance(reactContext).addRegion(woosRegion, promise);
135
- } catch (Exception ex) {
136
- promise.reject(WoosmapMessageAndKey.errorCode, ex.getMessage());
137
- }
138
- }
139
-
140
- @RequiresApi(api = Build.VERSION_CODES.N)
141
- @Override
142
- public void getRegions(@Nullable String regionId, Promise promise) {
143
- try {
144
- if (!isWoosmapInitialized()) {
145
- promise.reject(WoosmapMessageAndKey.errorCode, WoosmapMessageAndKey.woosmapNotInitialized);
146
- return;
147
- }
148
- WoosmapTask.getInstance(reactContext).enqueGetRegionsAsArrayRequest(regionId, promise);
149
- } catch (Exception ex) {
150
- promise.reject(WoosmapMessageAndKey.errorCode, ex.getMessage());
151
- }
152
- }
153
-
154
- @RequiresApi(api = Build.VERSION_CODES.N)
155
- @Override
156
- public void removeRegion(String regionId, Promise promise) {
157
- try {
158
- if (!isWoosmapInitialized()) {
159
- promise.reject(WoosmapMessageAndKey.errorCode, WoosmapMessageAndKey.woosmapNotInitialized);
160
- return;
161
- }
162
- if (regionId == null || regionId.isEmpty()) {
163
- promise.reject(WoosmapMessageAndKey.errorCode, WoosmapMessageAndKey.requiredRegionid);
164
- return;
165
- }
166
- WoosmapTask.getInstance(reactContext).removeRegion(regionId, promise);
167
- } catch (Exception ex) {
168
- promise.reject(WoosmapMessageAndKey.errorCode, ex.getMessage());
169
- }
170
- }
171
-
172
- @RequiresApi(api = Build.VERSION_CODES.N)
173
- @Override
174
- public void removeAllRegions(Promise promise) {
175
- try {
176
- if (!isWoosmapInitialized()) {
177
- promise.reject(WoosmapMessageAndKey.errorCode, WoosmapMessageAndKey.woosmapNotInitialized);
178
- return;
179
- }
180
- WoosmapTask.getInstance(reactContext).removeRegion("", promise);
181
- } catch (Exception ex) {
182
- promise.reject(WoosmapMessageAndKey.errorCode, ex.getMessage());
183
- }
184
- }
185
- }
@@ -1,123 +0,0 @@
1
- #import <React/RCTBridgeModule.h>
2
-
3
- @interface RCT_EXTERN_MODULE(PluginGeofencing, NSObject)
4
-
5
- RCT_EXTERN_METHOD(initialize:(NSDictionary *)options
6
- withResolver:(RCTPromiseResolveBlock)resolve
7
- withRejecter:(RCTPromiseRejectBlock)reject)
8
-
9
- RCT_EXTERN_METHOD(setWoosmapApiKey:(NSArray *)options
10
- withResolver:(RCTPromiseResolveBlock)resolve
11
- withRejecter:(RCTPromiseRejectBlock)reject)
12
-
13
- RCT_EXTERN_METHOD(startTracking:(NSArray *)options
14
- withResolver:(RCTPromiseResolveBlock)resolve
15
- withRejecter:(RCTPromiseRejectBlock)reject)
16
-
17
- RCT_EXTERN_METHOD(stopTracking:(RCTPromiseResolveBlock)resolve
18
- withRejecter:(RCTPromiseRejectBlock)reject)
19
-
20
- RCT_EXTERN_METHOD(requestPermissions:(NSArray *)options
21
- withResolver:(RCTPromiseResolveBlock)resolve
22
- withRejecter:(RCTPromiseRejectBlock)reject)
23
-
24
- RCT_EXTERN_METHOD(getPermissionsStatus:(RCTPromiseResolveBlock)resolve
25
- withRejecter:(RCTPromiseRejectBlock)reject)
26
-
27
- RCT_EXTERN_METHOD(watchLocation:(NSString *)watchid
28
- withResolver:(RCTPromiseResolveBlock)resolve
29
- withRejecter:(RCTPromiseRejectBlock)reject)
30
-
31
- RCT_EXTERN_METHOD(clearLocationWatch:(NSString *)watchid
32
- withResolver:(RCTPromiseResolveBlock)resolve
33
- withRejecter:(RCTPromiseRejectBlock)reject)
34
-
35
- RCT_EXTERN_METHOD(clearAllLocationWatch:(RCTPromiseResolveBlock)resolve
36
- withRejecter:(RCTPromiseRejectBlock)reject)
37
-
38
-
39
- RCT_EXTERN_METHOD(watchRegions:(NSString *)watchid
40
- withResolver:(RCTPromiseResolveBlock)resolve
41
- withRejecter:(RCTPromiseRejectBlock)reject)
42
-
43
- RCT_EXTERN_METHOD(clearRegionsWatch:(NSString *)watchid
44
- withResolver:(RCTPromiseResolveBlock)resolve
45
- withRejecter:(RCTPromiseRejectBlock)reject)
46
-
47
- RCT_EXTERN_METHOD(clearAllRegionsWatch:(RCTPromiseResolveBlock)resolve
48
- withRejecter:(RCTPromiseRejectBlock)reject)
49
-
50
- RCT_EXTERN_METHOD(setSFMCCredentials:(NSDictionary *)credentials
51
- withResolver:(RCTPromiseResolveBlock)resolve
52
- withRejecter:(RCTPromiseRejectBlock)reject)
53
-
54
- RCT_EXTERN_METHOD(setPoiRadius:(NSString *)radius
55
- withResolver:(RCTPromiseResolveBlock)resolve
56
- withRejecter:(RCTPromiseRejectBlock)reject)
57
-
58
- RCT_EXTERN_METHOD(addRegion:(NSDictionary *)regioninfo
59
- withResolver:(RCTPromiseResolveBlock)resolve
60
- withRejecter:(RCTPromiseRejectBlock)reject)
61
-
62
- RCT_EXTERN_METHOD(getAllRegions:(RCTPromiseResolveBlock)resolve
63
- withRejecter:(RCTPromiseRejectBlock)reject)
64
-
65
- RCT_EXTERN_METHOD(getRegions:(NSString *)regionid
66
- withResolver:(RCTPromiseResolveBlock)resolve
67
- withRejecter:(RCTPromiseRejectBlock)reject)
68
-
69
- RCT_EXTERN_METHOD(removeAllRegions:(RCTPromiseResolveBlock)resolve
70
- withRejecter:(RCTPromiseRejectBlock)reject)
71
-
72
- RCT_EXTERN_METHOD(removeRegion:(NSString *)regionid
73
- withResolver:(RCTPromiseResolveBlock)resolve
74
- withRejecter:(RCTPromiseRejectBlock)reject)
75
-
76
- RCT_EXTERN_METHOD(getAllLocations:(RCTPromiseResolveBlock)resolve
77
- withRejecter:(RCTPromiseRejectBlock)reject)
78
-
79
- RCT_EXTERN_METHOD(getLocation:(NSString *)locationid
80
- withResolver:(RCTPromiseResolveBlock)resolve
81
- withRejecter:(RCTPromiseRejectBlock)reject)
82
-
83
- RCT_EXTERN_METHOD(removeAllLocations:(RCTPromiseResolveBlock)resolve
84
- withRejecter:(RCTPromiseRejectBlock)reject)
85
-
86
- RCT_EXTERN_METHOD(getAllPois:(RCTPromiseResolveBlock)resolve
87
- withRejecter:(RCTPromiseRejectBlock)reject)
88
-
89
- RCT_EXTERN_METHOD(getPoi:(NSString *)poiid
90
- withResolver:(RCTPromiseResolveBlock)resolve
91
- withRejecter:(RCTPromiseRejectBlock)reject)
92
-
93
- RCT_EXTERN_METHOD(removeAllPois:(RCTPromiseResolveBlock)resolve
94
- withRejecter:(RCTPromiseRejectBlock)reject)
95
-
96
- RCT_EXTERN_METHOD(startCustomTracking:(NSString *)mode
97
- source:(NSString *)source
98
- withResolver:(RCTPromiseResolveBlock)resolve
99
- withRejecter:(RCTPromiseRejectBlock)reject)
100
-
101
- RCT_EXTERN_METHOD(getAllIndoorBeacons:(RCTPromiseResolveBlock)resolve
102
- withRejecter:(RCTPromiseRejectBlock)reject)
103
-
104
- RCT_EXTERN_METHOD(getIndoorBeacons:(NSString *)venueID
105
- withResolver:(RCTPromiseResolveBlock)resolve
106
- withRejecter:(RCTPromiseRejectBlock)reject)
107
-
108
- RCT_EXTERN_METHOD(removeIndoorBeacons:(RCTPromiseResolveBlock)resolve
109
- withRejecter:(RCTPromiseRejectBlock)reject)
110
-
111
- RCT_EXTERN_METHOD(refreshPois:(RCTPromiseResolveBlock)resolve
112
- withRejecter:(RCTPromiseRejectBlock)reject)
113
-
114
- RCT_EXTERN_METHOD(setProtectedRegionSlot:(NSNumber *)slots
115
- withResolver:(RCTPromiseResolveBlock)resolve
116
- withRejecter:(RCTPromiseRejectBlock)reject)
117
-
118
- + (BOOL)requiresMainQueueSetup
119
- {
120
- return YES;
121
- }
122
-
123
- @end