Skip to content

Commit

Permalink
Merge pull request #3 from foursquare/rojas/4.0.0-final-updates
Browse files Browse the repository at this point in the history
4.0.0 final updates
  • Loading branch information
marchinram authored Apr 18, 2023
2 parents 28e76a4 + 95f8f8d commit e270236
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 25 deletions.
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ repositories {
}
google()
maven {
url 'https://foursquare.jfrog.io/artifactory/libs-earlyaccess/'
url 'https://foursquare.jfrog.io/artifactory/libs-release/'
}
}

dependencies {
implementation 'com.facebook.react:react-native:+'
api 'com.foursquare:movementsdk:4.0.0-beta2'
api 'com.foursquare:movementsdk-debugging:4.0.0-beta2'
api 'com.foursquare:movementsdk:4.0.0'
api 'com.foursquare:movementsdk-debugging:4.0.0'
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ internal object Utils {
}

private fun geofenceEventJson(geofenceEvent: GeofenceEvent) = Arguments.createMap().apply {
putString("id", geofenceEvent.id)
putString("geofenceId", geofenceEvent.id)
putString("name", geofenceEvent.name)
geofenceEvent.venue?.let {
geofenceEvent.venue
Expand Down
2 changes: 1 addition & 1 deletion ios/FSQCategory+JSON.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ @implementation FSQCategory (JSON)

- (NSDictionary *)json {
NSMutableDictionary *jsonDict = [NSMutableDictionary dictionary];
jsonDict[@"id"] = self.foursquareID;
jsonDict[@"id"] = self.categoryId;
jsonDict[@"name"] = self.name;

if (self.pluralName) {
Expand Down
2 changes: 1 addition & 1 deletion ios/FSQChain+JSON.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ @implementation FSQChain (JSON)

- (NSDictionary *)json {
NSMutableDictionary *jsonDict = [NSMutableDictionary dictionary];
jsonDict[@"id"] = self.foursquareID;
jsonDict[@"id"] = self.id;
jsonDict[@"name"] = self.name;
return jsonDict;
}
Expand Down
8 changes: 4 additions & 4 deletions ios/FSQGeofenceEvent+JSON.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ @implementation FSQGeofenceEvent (JSON)

- (NSDictionary *)json {
NSMutableDictionary *jsonDict = [NSMutableDictionary dictionary];
jsonDict[@"id"] = self.geofenceID;
jsonDict[@"geofenceId"] = self.geofenceId;
jsonDict[@"name"] = self.name;

if (self.venue != nil) {
FSQVenue *venue = self.venue;
jsonDict[@"venueId"] = venue.foursquareID;
jsonDict[@"venueId"] = venue.venueId;
jsonDict[@"venue"] = [self.venue json];
}

if (self.partnerVenueID) {
jsonDict[@"partnerVenueId"] = self.partnerVenueID;
if (self.partnerVenueId) {
jsonDict[@"partnerVenueId"] = self.partnerVenueId;
}

jsonDict[@"location"] = [self.location json];
Expand Down
4 changes: 2 additions & 2 deletions ios/FSQVenue+JSON.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ @implementation FSQVenue (JSON)
- (NSDictionary *)json {
NSMutableDictionary *jsonDict = [NSMutableDictionary dictionary];

jsonDict[@"id"] = self.foursquareID;
jsonDict[@"id"] = self.venueId;
jsonDict[@"name"] = self.name;

if (self.locationInformation) {
Expand Down Expand Up @@ -58,7 +58,7 @@ - (NSDictionary *)json {
NSMutableArray *hierarchyArray = [NSMutableArray array];
for (FSQVenue *venueParent in self.hierarchy) {
NSMutableDictionary *venueParentDict = [NSMutableDictionary dictionary];
venueParentDict[@"id"] = venueParent.foursquareID;
venueParentDict[@"id"] = venueParent.venueId;
venueParentDict[@"name"] = venueParent.name;
venueParentDict[@"categories"] = [FSQVenue categoriesArrayJson:venueParent.categories];
}
Expand Down
22 changes: 12 additions & 10 deletions ios/RNMovementSdk.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ - (dispatch_queue_t)methodQueue
RCT_REMAP_METHOD(getInstallId,
getInstallIdWithResolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject) {
resolve([FSQMovementSdkManager sharedManager].installId);
resolve([FSQMovementSdkManager shared].installId);
}

RCT_EXPORT_METHOD(start) {
[[FSQMovementSdkManager sharedManager] start];
[[FSQMovementSdkManager shared] start];
}

RCT_EXPORT_METHOD(stop) {
[[FSQMovementSdkManager sharedManager] stop];
[[FSQMovementSdkManager shared] stop];
}

RCT_REMAP_METHOD(getCurrentLocation,
getCurrentLocationWithResolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject) {
[[FSQMovementSdkManager sharedManager] getCurrentLocationWithCompletion:^(FSQCurrentLocation * _Nullable currentLocation, NSError * _Nullable error) {
[[FSQMovementSdkManager shared] getCurrentLocationWithCompletion:^(FSQCurrentLocation * _Nullable currentLocation, NSError * _Nullable error) {
if (error) {
reject(@"get_current_location", error.localizedDescription, error);
return;
Expand All @@ -42,29 +42,31 @@ - (dispatch_queue_t)methodQueue

RCT_EXPORT_METHOD(fireTestVisit:(double)latitude longitude:(double)longitude) {
CLLocation *location = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude];
[[FSQMovementSdkManager sharedManager].visitTester fireTestVisit:location];
[[FSQMovementSdkManager shared].visitTester fireTestVisitWithLocation:location];
}

RCT_EXPORT_METHOD(showDebugScreen) {
[FSQMovementSdkManager sharedManager].debugLogsEnabled = YES;
[FSQMovementSdkManager shared].isDebugLogsEnabled = YES;
UIViewController *viewController = [UIApplication sharedApplication].keyWindow.rootViewController;
[[FSQMovementSdkManager sharedManager] presentDebugViewController:viewController];
if (@available(iOS 14.0, *)) {
[[FSQMovementSdkManager shared] presentDebugViewControllerWithParentViewController:viewController];
}
}

RCT_REMAP_METHOD(isEnabled,
isEnabledWithResolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject) {
resolve(@([[FSQMovementSdkManager sharedManager] isEnabled]));
resolve(@([[FSQMovementSdkManager shared] isEnabled]));
}

RCT_REMAP_METHOD(userInfo,
userInfoWithResolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject) {
resolve((NSDictionary *)[FSQMovementSdkManager sharedManager].userInfo.source);
resolve((NSDictionary *)[FSQMovementSdkManager shared].userInfo.source);
}

RCT_EXPORT_METHOD(setUserInfo:(NSDictionary *)userInfo persisted:(BOOL)persisted) {
[[FSQMovementSdkManager sharedManager] setUserInfo:[RCTConvert FSQUserInfo:userInfo] persisted:persisted];
[[FSQMovementSdkManager shared] setUserInfo:[RCTConvert FSQUserInfo:userInfo] persisted:persisted];
}

@end
Expand Down
2 changes: 1 addition & 1 deletion movement-sdk-react-native.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Pod::Spec.new do |s|
s.source_files = "ios/**/*.{h,m,mm,swift}"

s.dependency "React-Core"
s.dependency 'MovementSdk', '= 4.0.0-beta1'
s.dependency 'MovementSdk', '= 4.0.0'

# Don't install the dependencies when we run `pod install` in the old architecture.
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@foursquare/movement-sdk-react-native",
"homepage": "https://enterprise.foursquare.com/products/pilgrim",
"version": "4.0.0-beta2",
"version": "4.0.0",
"description": "React native wrapper for the Movement SDK",
"main": "src/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface Location {
* An object representing an interaction with one or more registered geofence radii.
*/
export interface GeofenceEvent {
id: string
geofenceId: string
name: string
venueId?: string
venue?: Venue
Expand Down

0 comments on commit e270236

Please sign in to comment.