Skip to content

Commit

Permalink
set user.place
Browse files Browse the repository at this point in the history
  • Loading branch information
nickpatrick committed Dec 12, 2017
1 parent 481b00c commit d31d5a2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
11 changes: 10 additions & 1 deletion android/src/main/java/com/onradar/react/RNRadarUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,22 @@ static WritableMap mapForUser(RadarUser user) {
WritableArray geofencesArr = Arguments.createArray();
for (RadarGeofence geofence : user.getGeofences()) {
WritableMap geofenceMap = RNRadarUtils.mapForGeofence(geofence);
geofencesArr.pushMap(geofenceMap);
if (geofenceMap != null) {
geofencesArr.pushMap(geofenceMap);
}
}
map.putArray("geofences", geofencesArr);
WritableMap insightsMap = RNRadarUtils.mapForUserInsights(user.getInsights());
if (insightsMap != null) {
map.putMap("insights", insightsMap);
}
RadarPlace place = user.getPlace();
if (place != null) {
WritableMap placeMap = RNRadarUtils.mapForPlace(place);
if (placeMap != null) {
map.putMap("place", placeMap);
}
}
return map;
}

Expand Down
4 changes: 4 additions & 0 deletions ios/RNRadarUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ + (NSDictionary *)dictionaryForUser:(RadarUser *)user {
[dict setValue:geofencesArr forKey:@"geofences"];
NSDictionary *insightsDict = [RNRadarUtils dictionaryForUserInsights:user.insights];
[dict setValue:insightsDict forKey:@"insights"];
if (user.place) {
NSDictionary *placeDict = [RNRadarUtils dictionaryForPlace:user.place];
[dict setValue:placeDict forKey:@"place"];
}
return dict;
}

Expand Down
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 location platform for mobile apps",
"homepage": "https://www.onradar.com",
"license": "Apache-2.0",
"version": "1.0.13",
"version": "1.0.14",
"main": "js/index.js",
"dependencies": {},
"peerDependencies": {
Expand Down

0 comments on commit d31d5a2

Please sign in to comment.