diff --git a/android/build.gradle b/android/build.gradle index abc11f43..2f01e914 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -45,6 +45,5 @@ repositories { dependencies { api 'com.facebook.react:react-native:+' - api 'io.radar:sdk:3.18.6' + api 'io.radar:sdk:3.18.8-beta.1' } - diff --git a/android/src/main/java/io/radar/react/RNRadarModule.java b/android/src/main/java/io/radar/react/RNRadarModule.java index 5ed94b93..02b50655 100644 --- a/android/src/main/java/io/radar/react/RNRadarModule.java +++ b/android/src/main/java/io/radar/react/RNRadarModule.java @@ -448,6 +448,16 @@ public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarVerifie Radar.getVerifiedLocationToken(trackCallback); } + @ReactMethod + public void startVerifyServer() { + Radar.startVerifyServer(); + } + + @ReactMethod + public void stopVerifyServer() { + Radar.stopVerifyServer(); + } + @ReactMethod public void startTrackingEfficient() { Radar.startTracking(RadarTrackingOptions.EFFICIENT); diff --git a/example/App.tsx b/example/App.tsx index e69ef0ce..86186598 100644 --- a/example/App.tsx +++ b/example/App.tsx @@ -564,6 +564,20 @@ export default function App() { }} /> + { + Radar.startVerifyServer(); + }} + /> + + { + Radar.stopVerifyServer(); + }} + /> + { diff --git a/example/app.json b/example/app.json index 101959ab..f1dc72a7 100644 --- a/example/app.json +++ b/example/app.json @@ -16,7 +16,7 @@ ], "ios": { "supportsTablet": true, - "bundleIdentifier": "com.radar.example", + "bundleIdentifier": "com.radar.example" }, "android": { "adaptiveIcon": { @@ -38,7 +38,8 @@ "androidFraud": true, "androidBackgroundPermission": true, "androidFineLocationPermission": true, - "addRadarSDKMotion": true + "addRadarSDKMotion": false, + "addRadarSDKVerify": true } ], [ diff --git a/example/package-lock.json b/example/package-lock.json index c1599cd0..f78d7698 100644 --- a/example/package-lock.json +++ b/example/package-lock.json @@ -26,8 +26,7 @@ } }, "..": { - "version": "3.18.3", - "extraneous": true, + "version": "3.19.0-beta.1", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.21.0", @@ -5269,14 +5268,6 @@ "node": ">=8" } }, - "node_modules/@react-native-community/netinfo": { - "version": "7.1.12", - "resolved": "https://registry.npmjs.org/@react-native-community/netinfo/-/netinfo-7.1.12.tgz", - "integrity": "sha512-fkCRkOgzfdD0sr8JTasDgm716l8bJPkCNjXIyllG8K+UyixVa68lroQmgW9pewE5G5p43I9MWPtGZR/kVowBzg==", - "peerDependencies": { - "react-native": ">=0.59" - } - }, "node_modules/@react-native/assets-registry": { "version": "0.74.87", "resolved": "https://registry.npmjs.org/@react-native/assets-registry/-/assets-registry-0.74.87.tgz", @@ -12043,11 +12034,6 @@ "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz", "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==" }, - "node_modules/radar-sdk-js": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/radar-sdk-js/-/radar-sdk-js-3.7.1.tgz", - "integrity": "sha512-yhuvEfyOeOEZpPf9XGOaC/TZlf3iib6iCcvZnwHR+fRV6r5f4/BIEO9xcEiU0WF/sl7pA22Vx4KXi8vsfBrstg==" - }, "node_modules/range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", @@ -12203,27 +12189,8 @@ } }, "node_modules/react-native-radar": { - "version": "3.18.3", - "resolved": "file:..", - "dependencies": { - "@babel/runtime": "^7.21.0", - "@react-native-community/netinfo": "^7.1.3", - "radar-sdk-js": "^3.7.1" - }, - "peerDependencies": { - "@maplibre/maplibre-react-native": ">=9.0.1 || >=10.0.0-alpha", - "expo": ">=43.0.5", - "react": ">= 16.8.6", - "react-native": ">= 0.60.0" - }, - "peerDependenciesMeta": { - "@maplibre/maplibre-react-native": { - "optional": true - }, - "expo": { - "optional": true - } - } + "resolved": "..", + "link": true }, "node_modules/react-native-web": { "version": "0.19.13", @@ -18067,12 +18034,6 @@ "joi": "^17.2.1" } }, - "@react-native-community/netinfo": { - "version": "7.1.12", - "resolved": "https://registry.npmjs.org/@react-native-community/netinfo/-/netinfo-7.1.12.tgz", - "integrity": "sha512-fkCRkOgzfdD0sr8JTasDgm716l8bJPkCNjXIyllG8K+UyixVa68lroQmgW9pewE5G5p43I9MWPtGZR/kVowBzg==", - "requires": {} - }, "@react-native/assets-registry": { "version": "0.74.87", "resolved": "https://registry.npmjs.org/@react-native/assets-registry/-/assets-registry-0.74.87.tgz", @@ -23012,11 +22973,6 @@ "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz", "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==" }, - "radar-sdk-js": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/radar-sdk-js/-/radar-sdk-js-3.7.1.tgz", - "integrity": "sha512-yhuvEfyOeOEZpPf9XGOaC/TZlf3iib6iCcvZnwHR+fRV6r5f4/BIEO9xcEiU0WF/sl7pA22Vx4KXi8vsfBrstg==" - }, "range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", @@ -23201,11 +23157,35 @@ } }, "react-native-radar": { - "version": "3.18.3", + "version": "file:..", "requires": { + "@babel/core": "^7.2.2", + "@babel/preset-env": "^7.2.3", + "@babel/preset-react": "^7.0.0", + "@babel/register": "^7.0.0", "@babel/runtime": "^7.21.0", "@react-native-community/netinfo": "^7.1.3", - "radar-sdk-js": "^3.7.1" + "babel-core": "^7.0.0-bridge.0", + "babel-eslint": "^10.0.1", + "babel-jest": "^23.4.2", + "braces": ">=2.3.2", + "eslint": "^5.6.1", + "eslint-config-airbnb": "^17.1.0", + "eslint-plugin-import": "^2.14.0", + "eslint-plugin-jest": "^22.1.2", + "eslint-plugin-jsx-a11y": "^6.1.1", + "eslint-plugin-react": "^7.11.1", + "expo": "^51.0.0", + "expo-module-scripts": "^3.5.2", + "jest": "^29.7.0", + "jest-junit": "^16.0.0", + "logkitty": ">=0.7.1", + "metro-react-native-babel-preset": "^0.51.1", + "npm-run-all": "^4.1.5", + "radar-sdk-js": "^3.7.1", + "react": "^18.2.0", + "react-native": "^0.74.5", + "typescript": "^5.3.3" } }, "react-native-web": { diff --git a/ios/RNRadar.m b/ios/RNRadar.m index db457d98..7c347daf 100644 --- a/ios/RNRadar.m +++ b/ios/RNRadar.m @@ -357,6 +357,14 @@ - (void)didUpdateToken:(RadarVerifiedLocationToken *)token { [Radar getVerifiedLocationToken:completionHandler]; } +RCT_EXPORT_METHOD(startVerifyServer) { + [Radar startVerifyServer]; +} + +RCT_EXPORT_METHOD(stopVerifyServer) { + [Radar stopVerifyServer]; +} + RCT_EXPORT_METHOD(startTrackingEfficient) { [Radar startTrackingWithOptions:RadarTrackingOptions.presetEfficient]; } diff --git a/package-lock.json b/package-lock.json index 5fb1b03e..695a4c9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "react-native-radar", - "version": "3.18.5", + "version": "3.19.0-beta.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "react-native-radar", - "version": "3.18.5", + "version": "3.19.0-beta.2", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.21.0", diff --git a/package.json b/package.json index 8176fc8f..4672044f 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "React Native module for Radar, the leading geofencing and location tracking platform", "homepage": "https://radar.com", "license": "Apache-2.0", - "version": "3.18.5", + "version": "3.19.0-beta.2", "main": "dist/index.js", "files": [ "/android", diff --git a/plugin/src/types.ts b/plugin/src/types.ts index 083b011e..54ac0628 100644 --- a/plugin/src/types.ts +++ b/plugin/src/types.ts @@ -8,4 +8,5 @@ export interface RadarPluginProps { androidFineLocationPermission?: boolean; addRadarSDKMotion?: boolean; iosNSMotionUsageDescription?: string; + addRadarSDKVerify?: boolean; } \ No newline at end of file diff --git a/plugin/src/withRadarAndroid.ts b/plugin/src/withRadarAndroid.ts index c3638125..552e3508 100644 --- a/plugin/src/withRadarAndroid.ts +++ b/plugin/src/withRadarAndroid.ts @@ -59,6 +59,7 @@ export const withRadarAndroid = ( localhost + 10.0.2.2 @@ -82,7 +83,8 @@ export const withRadarAndroid = ( if (config.modResults.language === "groovy") { config.modResults.contents = modifyAppBuildGradle( config.modResults.contents, - args.androidFraud ?? false + args.androidFraud ?? false, + args.addRadarSDKVerify ?? false ); } else { throw new Error( @@ -150,9 +152,10 @@ async function setCustomConfigAsync( return androidManifest; } -function modifyAppBuildGradle(buildGradle: string, androidFraud: boolean) { +function modifyAppBuildGradle(buildGradle: string, androidFraud: boolean, addRadarSDKVerify: boolean) { let hasLocationService = false; let hasPlayIntegrity = false; + let hasNanoHTTPD = false; if ( buildGradle.includes( 'com.google.android.gms:play-services-location:21.0.1"' @@ -165,6 +168,10 @@ function modifyAppBuildGradle(buildGradle: string, androidFraud: boolean) { hasPlayIntegrity = true; } + if (buildGradle.includes('org.nanohttpd:nanohttpd:2.3.1"')) { + hasNanoHTTPD = true; + } + const pattern = /^dependencies {/m; if (!buildGradle.match(pattern)) { @@ -184,6 +191,10 @@ function modifyAppBuildGradle(buildGradle: string, androidFraud: boolean) { replacementString += "\n\n" + ' implementation "com.google.android.play:integrity:1.2.0"'; } + if (addRadarSDKVerify && !hasNanoHTTPD) { + replacementString += + "\n\n" + ' implementation "org.nanohttpd:nanohttpd:2.3.1"'; + } return buildGradle.replace( pattern, diff --git a/plugin/src/withRadarIOS.ts b/plugin/src/withRadarIOS.ts index b12d6aa5..81f85b70 100644 --- a/plugin/src/withRadarIOS.ts +++ b/plugin/src/withRadarIOS.ts @@ -74,6 +74,36 @@ export const withRadarIOS: ConfigPlugin = (config, args) => { }, ]); } + if (args.addRadarSDKVerify) { + config = withDangerousMod(config, [ + 'ios', + async config => { + const filePath = path.join(config.modRequest.platformProjectRoot, 'Podfile'); + const contents = await fs.readFile(filePath, 'utf-8'); + + // Check if the pod declaration already exists + if (contents.indexOf("pod 'RadarSDK/Verify', '3.19.2-beta.9'") === -1) { + // Find the target block + const targetRegex = /target '(\w+)' do/g; + const match = targetRegex.exec(contents); + if (match) { + const targetStartIndex = match.index; + const targetEndIndex = contents.indexOf('end', targetStartIndex) + 3; + + // Insert the pod declaration within the target block + const targetBlock = contents.substring(targetStartIndex, targetEndIndex); + const updatedTargetBlock = targetBlock.replace(/(target '(\w+)' do)/, `$1\n pod 'RadarSDK/Verify', '3.19.2-beta.9'\n pod 'CocoaAsyncSocket', :modular_headers => true\n pod 'HTTPParserC', :modular_headers => true`); + const newContents = contents.replace(targetBlock, updatedTargetBlock); + + // Write the updated contents back to the Podfile + await fs.writeFile(filePath, newContents); + } + } + + return config; + }, + ]); + } return config; }; \ No newline at end of file diff --git a/react-native-radar.podspec b/react-native-radar.podspec index 522653c7..b325cf15 100644 --- a/react-native-radar.podspec +++ b/react-native-radar.podspec @@ -12,8 +12,8 @@ Pod::Spec.new do |s| s.summary = package[:description] s.source = { git: package[:repository][:url] } s.source_files = "ios/*.{h,m}" - s.platform = :ios, "10.0" + s.platform = :ios, "12.0" s.dependency "React" - s.dependency "RadarSDK", "~> 3.18.5" + s.dependency "RadarSDK", "~> 3.19.2-beta.9" end diff --git a/react-native-radar.podspec.template b/react-native-radar.podspec.template index 4eb46fe0..dc5cb547 100644 --- a/react-native-radar.podspec.template +++ b/react-native-radar.podspec.template @@ -12,7 +12,7 @@ Pod::Spec.new do |s| s.summary = package[:description] s.source = { git: package[:repository][:url] } s.source_files = "ios/*.{h,m}" - s.platform = :ios, "10.0" + s.platform = :ios, "12.0" s.dependency "React" s.dependency "RadarSDK", "~> {{ version }}" diff --git a/src/@types/RadarNativeInterface.ts b/src/@types/RadarNativeInterface.ts index 1d3b2dde..a4088ce7 100644 --- a/src/@types/RadarNativeInterface.ts +++ b/src/@types/RadarNativeInterface.ts @@ -60,6 +60,8 @@ export interface RadarNativeInterface { ) => Promise; trackVerified: (options?: RadarTrackVerifiedOptions) => Promise; getVerifiedLocationToken: () => Promise; + startVerifyServer: () => void; + stopVerifyServer: () => void; startTrackingEfficient: () => void; startTrackingResponsive: () => void; startTrackingContinuous: () => void; diff --git a/src/index.native.ts b/src/index.native.ts index b3eb9abb..85f01d53 100644 --- a/src/index.native.ts +++ b/src/index.native.ts @@ -118,6 +118,12 @@ const trackVerified = ( const getVerifiedLocationToken = (): Promise => NativeModules.RNRadar.getVerifiedLocationToken(); +const startVerifyServer = (): void => + NativeModules.RNRadar.startVerifyServer(); + +const stopVerifyServer = (): void => + NativeModules.RNRadar.stopVerifyServer(); + const startTrackingEfficient = (): void => NativeModules.RNRadar.startTrackingEfficient(); @@ -263,6 +269,8 @@ const Radar: RadarNativeInterface = { trackOnce, trackVerified, getVerifiedLocationToken, + startVerifyServer, + stopVerifyServer, startTrackingEfficient, startTrackingResponsive, startTrackingContinuous, diff --git a/src/index.web.js b/src/index.web.js index a105976b..de3d7993 100644 --- a/src/index.web.js +++ b/src/index.web.js @@ -123,6 +123,14 @@ const getVerifiedLocationToken = () => { return new Promise((resolve, reject) => { reject("getVerifiedLocationToken() is not implemented on web") }); }; +const startVerifyServer = () => { + if (throws) throw new Error("startVerifyServer() is not implemented on web"); +}; + +const stopVerifyServer = () => { + if (throws) throw new Error("stopVerifyServer() is not implemented on web"); +}; + const startTrackingEfficient = () => { if (throws) throw new Error("startTrackingEfficient() is not implemented on web"); }; @@ -481,6 +489,8 @@ const Radar = { trackOnce, trackVerified, getVerifiedLocationToken, + startVerifyServer, + stopVerifyServer, startTrackingEfficient, startTrackingResponsive, startTrackingContinuous,