Skip to content

Commit

Permalink
updated pr based on comments | split location to latitude and longitude
Browse files Browse the repository at this point in the history
  • Loading branch information
AjilJagadeesh7 committed Feb 29, 2024
1 parent e92e52a commit 91d9cbb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mparticle.react;

import android.location.Location;
import android.util.Log;

import com.facebook.react.bridge.Arguments;
Expand Down Expand Up @@ -74,8 +75,12 @@ public void setUploadInterval(int uploadInterval) {
}

@ReactMethod
public void setLocation(final android.location.Location location) {
MParticle.getInstance().setLocation(location);
public void setLocation(double latitude, double longitude) {
Location newLocation = new Location("");
newLocation.setLatitude(latitude);
newLocation.setLongitude(longitude);
MParticle.getInstance().setLocation(newLocation);

}

@ReactMethod
Expand Down
3 changes: 2 additions & 1 deletion ios/RNMParticle/RNMParticle.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ + (void)load {
[[MParticle sharedInstance] upload];
}

RCT_EXPORT_METHOD(setLocation:(CLLocation *)newLocation)
RCT_EXPORT_METHOD(setLocation:(double)latitude longitude:(double)longitude)
{
CLLocation *newLocation = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude];
[MParticle sharedInstance].location = newLocation;
}

Expand Down
4 changes: 2 additions & 2 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ const getSession = (completion) => {
NativeModules.MParticle.getSession(completion)
}

const setLocation = (location) => {
NativeModules.MParticle.setLocation(location);
const setLocation = (latitude, longitude) => {
NativeModules.MParticle.setLocation(latitude, longitude);
};

// ******** Identity ********
Expand Down

0 comments on commit 91d9cbb

Please sign in to comment.