Skip to content

Commit

Permalink
Set x-platform info on initialize (#293)
Browse files Browse the repository at this point in the history
* bump sdks, set xplatform

* Update RNRadarModule.java

* bump version number

---------

Co-authored-by: Kenny Hu <kenny.hu@radar.com>
  • Loading branch information
york-wei and KennyHuRadar authored Mar 1, 2024
1 parent d1cd8f7 commit 69d8d5d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
minSdkVersion 16
targetSdkVersion 31
versionCode 1
versionName '3.10.3'
versionName '3.10.4'
}
lintOptions {
abortOnError false
Expand All @@ -45,5 +45,5 @@ repositories {

dependencies {
api 'com.facebook.react:react-native:+'
api 'io.radar:sdk:3.9.4'
api 'io.radar:sdk:3.9.5'
}
6 changes: 6 additions & 0 deletions android/src/main/java/io/radar/react/RNRadarModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Build;
Expand Down Expand Up @@ -91,6 +93,10 @@ public String getName() {
@ReactMethod
public void initialize(String publishableKey, boolean fraud) {
this.fraud = fraud;
SharedPreferences.Editor editor = getReactApplicationContext().getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit();
editor.putString("x_platform_sdk_type", "ReactNative");
editor.putString("x_platform_sdk_version", "3.10.4");
editor.apply();
if (fraud) {
Radar.initialize(getReactApplicationContext(), publishableKey, receiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud);
Radar.setVerifiedReceiver(verifiedReceiver);
Expand Down
2 changes: 2 additions & 0 deletions ios/RNRadar.m
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ - (void)didUpdateToken:(NSString *)token {
}

RCT_EXPORT_METHOD(initialize:(NSString *)publishableKey fraud:(BOOL)fraud) {
[[NSUserDefaults standardUserDefaults] setObject:@"ReactNative" forKey:@"radar-xPlatformSDKType"];
[[NSUserDefaults standardUserDefaults] setObject:@"3.10.4" forKey:@"radar-xPlatformSDKVersion"];
[Radar initializeWithPublishableKey:publishableKey];
}

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.10.3",
"version": "3.10.4",
"main": "dist/src/index.js",
"files": [
"android",
Expand Down

0 comments on commit 69d8d5d

Please sign in to comment.