@woosmap/react-native-plugin-geofencing 0.1.20 → 0.1.23
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 +5 -1
- package/android/src/main/java/com/reactnativeplugingeofencing/PluginGeofencingModule.java +1 -1
- package/android/src/main/java/com/reactnativeplugingeofencing/WoosRegionReadyListener.java +3 -3
- package/android/src/main/java/com/reactnativeplugingeofencing/WoosmapTask.java +4 -4
- package/android/src/main/java/com/reactnativeplugingeofencing/WoosmapUtil.java +4 -4
- package/ios/DataLocation.swift +1 -1
- package/ios/PluginGeofencing.swift +1 -0
- package/ios/WoosmapGeofenceService.swift +12 -7
- package/package.json +1 -1
- package/react-native-plugin-geofencing.podspec +1 -1
- package/src/internal/Region.tsx +7 -2
package/android/build.gradle
CHANGED
|
@@ -51,12 +51,16 @@ repositories {
|
|
|
51
51
|
google()
|
|
52
52
|
mavenCentral()
|
|
53
53
|
jcenter()
|
|
54
|
+
maven { url 'https://jitpack.io' }
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
dependencies {
|
|
57
58
|
//noinspection GradleDynamicVersion
|
|
58
59
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
59
|
-
implementation
|
|
60
|
+
implementation 'com.google.android.gms:play-services-location:18.0.0'
|
|
61
|
+
implementation 'com.google.code.gson:gson:2.8.8'
|
|
62
|
+
implementation "com.github.woosmap:geofencing-core-android-sdk:core_geofence_2.1"
|
|
63
|
+
implementation("com.webgeoservices.woosmapgeofencing:woosmap-mobile-sdk:3.0.1")
|
|
60
64
|
implementation 'com.google.android.gms:play-services-maps:17.0.0'
|
|
61
65
|
implementation 'androidx.room:room-runtime:2.2.4'
|
|
62
66
|
annotationProcessor 'androidx.room:room-compiler:2.2.4'
|
|
@@ -25,7 +25,7 @@ import com.facebook.react.modules.core.PermissionAwareActivity;
|
|
|
25
25
|
import com.facebook.react.modules.core.PermissionListener;
|
|
26
26
|
import com.webgeoservices.woosmapgeofencing.Woosmap;
|
|
27
27
|
import com.webgeoservices.woosmapgeofencing.WoosmapSettings;
|
|
28
|
-
import com.webgeoservices.
|
|
28
|
+
import com.webgeoservices.woosmapgeofencingcore.database.Region;
|
|
29
29
|
|
|
30
30
|
import java.lang.reflect.Array;
|
|
31
31
|
import java.util.ArrayList;
|
|
@@ -8,8 +8,8 @@ import com.facebook.react.ReactNativeHost;
|
|
|
8
8
|
import com.facebook.react.bridge.ReactContext;
|
|
9
9
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
10
10
|
import com.webgeoservices.woosmapgeofencing.Woosmap;
|
|
11
|
-
import com.webgeoservices.
|
|
12
|
-
import com.webgeoservices.
|
|
11
|
+
import com.webgeoservices.woosmapgeofencingcore.database.Region;
|
|
12
|
+
import com.webgeoservices.woosmapgeofencingcore.database.RegionLog;
|
|
13
13
|
|
|
14
14
|
/***
|
|
15
15
|
* Implements Woosmap Region callbacks
|
|
@@ -41,6 +41,6 @@ public class WoosRegionReadyListener implements Woosmap.RegionReadyListener,Woos
|
|
|
41
41
|
|
|
42
42
|
@Override
|
|
43
43
|
public void RegionReadyCallback(Region region) {
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -13,10 +13,10 @@ import com.facebook.react.bridge.WritableArray;
|
|
|
13
13
|
import com.facebook.react.bridge.WritableNativeArray;
|
|
14
14
|
import com.google.android.gms.maps.model.LatLng;
|
|
15
15
|
import com.webgeoservices.woosmapgeofencing.Woosmap;
|
|
16
|
-
import com.webgeoservices.
|
|
17
|
-
import com.webgeoservices.
|
|
18
|
-
import com.webgeoservices.
|
|
19
|
-
import com.webgeoservices.
|
|
16
|
+
import com.webgeoservices.woosmapgeofencingcore.database.MovingPosition;
|
|
17
|
+
import com.webgeoservices.woosmapgeofencingcore.database.POI;
|
|
18
|
+
import com.webgeoservices.woosmapgeofencingcore.database.Region;
|
|
19
|
+
import com.webgeoservices.woosmapgeofencingcore.database.WoosmapDb;
|
|
20
20
|
|
|
21
21
|
import org.json.JSONObject;
|
|
22
22
|
|
|
@@ -9,10 +9,10 @@ import com.facebook.react.bridge.WritableArray;
|
|
|
9
9
|
import com.facebook.react.bridge.WritableMap;
|
|
10
10
|
import com.facebook.react.bridge.WritableNativeArray;
|
|
11
11
|
import com.facebook.react.bridge.WritableNativeMap;
|
|
12
|
-
import com.webgeoservices.
|
|
13
|
-
import com.webgeoservices.
|
|
14
|
-
import com.webgeoservices.
|
|
15
|
-
import com.webgeoservices.
|
|
12
|
+
import com.webgeoservices.woosmapgeofencingcore.database.MovingPosition;
|
|
13
|
+
import com.webgeoservices.woosmapgeofencingcore.database.POI;
|
|
14
|
+
import com.webgeoservices.woosmapgeofencingcore.database.Region;
|
|
15
|
+
import com.webgeoservices.woosmapgeofencingcore.database.RegionLog;
|
|
16
16
|
|
|
17
17
|
import org.json.JSONArray;
|
|
18
18
|
import org.json.JSONException;
|
package/ios/DataLocation.swift
CHANGED
|
@@ -38,7 +38,7 @@ public class DataLocation: LocationServiceDelegate {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
public func readLocations(id:String) -> Location? {
|
|
41
|
-
return Locations.
|
|
41
|
+
return Locations.getLocationFromId(id: id)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
public func eraseLocations() {
|
|
@@ -963,6 +963,7 @@ class PluginGeofencing: RCTEventEmitter {
|
|
|
963
963
|
result["radius"] = woosdata.radius
|
|
964
964
|
result["frompositiondetection"] = woosdata.fromPositionDetection
|
|
965
965
|
result["eventname"] = woosdata.eventName
|
|
966
|
+
result["spenttime"] = woosdata.spentTime
|
|
966
967
|
return result
|
|
967
968
|
}
|
|
968
969
|
|
|
@@ -104,13 +104,17 @@ import AirshipCore
|
|
|
104
104
|
|
|
105
105
|
/// This callback received when application become active
|
|
106
106
|
@objc func appDidBecomeActive() {
|
|
107
|
-
|
|
107
|
+
DispatchQueue.main.async {
|
|
108
|
+
WoosmapGeofencing.shared.didBecomeActive()
|
|
109
|
+
}
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
/// This callback recived when application enter in background mode
|
|
111
113
|
@objc func appDidEnterBackground() {
|
|
112
114
|
if CLLocationManager.authorizationStatus() != .notDetermined {
|
|
113
|
-
|
|
115
|
+
DispatchQueue.main.async {
|
|
116
|
+
WoosmapGeofencing.shared.startMonitoringInBackground()
|
|
117
|
+
}
|
|
114
118
|
}
|
|
115
119
|
}
|
|
116
120
|
|
|
@@ -403,7 +407,7 @@ import AirshipCore
|
|
|
403
407
|
if let locationService = WoosmapGeofencing.shared.locationService{
|
|
404
408
|
if let customRegion = locationService.locationManager?.monitoredRegions{
|
|
405
409
|
customRegion.forEach { item in
|
|
406
|
-
if(locationService.getRegionType(identifier: item.identifier) ==
|
|
410
|
+
if(locationService.getRegionType(identifier: item.identifier) == RegionType.custom){
|
|
407
411
|
let customRegion = Region()
|
|
408
412
|
customRegion.identifier = item.identifier
|
|
409
413
|
if let circleRegion = item as? CLCircularRegion{
|
|
@@ -426,7 +430,8 @@ import AirshipCore
|
|
|
426
430
|
/// - Returns: Region
|
|
427
431
|
public func getRegions(id:String) -> Region? {
|
|
428
432
|
if let locationService = WoosmapGeofencing.shared.locationService{
|
|
429
|
-
|
|
433
|
+
let regiontype = locationService.getRegionType(identifier: id)
|
|
434
|
+
if( regiontype == RegionType.custom){
|
|
430
435
|
if let customRegions = locationService.locationManager?.monitoredRegions{
|
|
431
436
|
if let watchRegion = customRegions.first(where: { item in
|
|
432
437
|
return item.identifier == id
|
|
@@ -492,12 +497,12 @@ import AirshipCore
|
|
|
492
497
|
|
|
493
498
|
/// Delete all ZOI regions
|
|
494
499
|
public func deleteAllZoiRegion() {
|
|
495
|
-
WoosmapGeofencing.shared.locationService.removeRegions(type:
|
|
500
|
+
WoosmapGeofencing.shared.locationService.removeRegions(type: RegionType.custom)
|
|
496
501
|
}
|
|
497
502
|
|
|
498
503
|
/// Delete all POI regions
|
|
499
504
|
public func deleteAllPoiRegion() {
|
|
500
|
-
WoosmapGeofencing.shared.locationService.removeRegions(type:
|
|
505
|
+
WoosmapGeofencing.shared.locationService.removeRegions(type: RegionType.poi)
|
|
501
506
|
}
|
|
502
507
|
|
|
503
508
|
/// Delete regions by id
|
|
@@ -517,7 +522,7 @@ import AirshipCore
|
|
|
517
522
|
/// Delete all regions
|
|
518
523
|
public func deleteAllRegion() {
|
|
519
524
|
DataRegion().eraseRegions()
|
|
520
|
-
WoosmapGeofencing.shared.locationService.removeRegions(type:
|
|
525
|
+
WoosmapGeofencing.shared.locationService.removeRegions(type: RegionType.none)
|
|
521
526
|
}
|
|
522
527
|
|
|
523
528
|
@objc static public func mockdata() {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@woosmap/react-native-plugin-geofencing","version":"0.1.
|
|
1
|
+
{"name":"@woosmap/react-native-plugin-geofencing","version":"0.1.23","description":"This react-native plugin extends the functionality offered by the Woosmap Geofencing Mobile SDKs. Find more about the Woosmap Geofencing SDK","main":"lib/commonjs/index","module":"lib/module/index","types":"lib/typescript/index.d.ts","react-native":"src/index","source":"src/index","files":["src","lib","android","ios","cpp","react-native-plugin-geofencing.podspec"],"scripts":{"test":"jest","typescript":"tsc --noEmit","lint":"eslint \"**/*.{js,ts,tsx}\"","prepare":"bob build","release":"release-it","example":"yarn --cwd example","pods":"cd example && pod-install --quiet","bootstrap":"yarn example && yarn && yarn pods"},"keywords":["react-native","ios","android","woosmap"],"repository":"https://github.com/Woosmap/woosmap-geofencing-react-native-plugin","author":"WGS Indoor <28100769+sameerdhulap@users.noreply.github.com> (https://github.com/sameerdhulap)","license":"MIT","bugs":{"url":"https://github.com/Woosmap/woosmap-geofencing-react-native-plugin/issues"},"homepage":"https://github.com/Woosmap/woosmap-geofencing-react-native-plugin#readme","publishConfig":{"registry":"https://registry.npmjs.org/"},"devDependencies":{"@commitlint/config-conventional":"^11.0.0","@react-native-community/eslint-config":"^2.0.0","@release-it/conventional-changelog":"^2.0.0","@types/jest":"^26.0.0","@types/react":"^16.9.19","@types/react-native":"0.62.13","commitlint":"^11.0.0","eslint":"^7.2.0","eslint-config-prettier":"^7.0.0","eslint-plugin-prettier":"^3.1.3","husky":"^6.0.0","jest":"^26.0.1","pod-install":"^0.1.0","prettier":"^2.0.5","react":"16.13.1","react-native":"^0.68.1","react-native-builder-bob":"^0.18.0","release-it":"^14.2.2","typescript":"^4.1.3"},"peerDependencies":{"react":"*","react-native":"*"},"jest":{"preset":"react-native","modulePathIgnorePatterns":["<rootDir>/example/node_modules","<rootDir>/lib/"]},"commitlint":{"extends":["@commitlint/config-conventional"]},"release-it":{"git":{"commitMessage":"chore: release ${version}","tagName":"v${version}"},"npm":{"publish":true},"github":{"release":true},"plugins":{"@release-it/conventional-changelog":{"preset":"angular"}}},"eslintConfig":{"root":true,"extends":["@react-native-community","prettier"],"rules":{"prettier/prettier":["error",{"quoteProps":"consistent","singleQuote":true,"tabWidth":2,"trailingComma":"es5","useTabs":false}]}},"eslintIgnore":["node_modules/","lib/"],"prettier":{"quoteProps":"consistent","singleQuote":true,"tabWidth":2,"trailingComma":"es5","useTabs":false},"react-native-builder-bob":{"source":"src","output":"lib","targets":["commonjs","module",["typescript",{"project":"tsconfig.build.json"}]]},"dependencies":{"react-native-uuid":"^2.0.1"}}
|
package/src/internal/Region.tsx
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* @param {number} radius The radius of the region in meters.
|
|
11
11
|
* @param {boolean} frompositiondetection Determines whether the user's current position is inside the region.
|
|
12
12
|
* @param {string} eventName Describe cause of region event, Entry or Exit.
|
|
13
|
+
* @param {number} spenttime Number of seconds the user spent in region in case of event name Exit.
|
|
13
14
|
*/
|
|
14
15
|
class Region {
|
|
15
16
|
Date: number;
|
|
@@ -20,6 +21,7 @@ class Region {
|
|
|
20
21
|
Radius: number;
|
|
21
22
|
Frompositiondetection: boolean;
|
|
22
23
|
Eventname: string;
|
|
24
|
+
SpentTime: number;
|
|
23
25
|
constructor(
|
|
24
26
|
date: number,
|
|
25
27
|
didenter: boolean,
|
|
@@ -28,7 +30,8 @@ class Region {
|
|
|
28
30
|
longitude: number,
|
|
29
31
|
radius: number,
|
|
30
32
|
frompositiondetection: boolean,
|
|
31
|
-
eventname: string
|
|
33
|
+
eventname: string,
|
|
34
|
+
spenttime: number
|
|
32
35
|
) {
|
|
33
36
|
this.Date = date;
|
|
34
37
|
this.Didenter = didenter;
|
|
@@ -38,6 +41,7 @@ class Region {
|
|
|
38
41
|
this.Radius = radius;
|
|
39
42
|
this.Frompositiondetection = frompositiondetection;
|
|
40
43
|
this.Eventname = eventname;
|
|
44
|
+
this.SpentTime = spenttime;
|
|
41
45
|
}
|
|
42
46
|
/**
|
|
43
47
|
* Converts json object to an object of type Region.
|
|
@@ -54,7 +58,8 @@ class Region {
|
|
|
54
58
|
json.longitude,
|
|
55
59
|
json.radius,
|
|
56
60
|
json.frompositiondetection,
|
|
57
|
-
json.eventname
|
|
61
|
+
json.eventname,
|
|
62
|
+
json.spenttime
|
|
58
63
|
);
|
|
59
64
|
}
|
|
60
65
|
}
|