Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions ios/RNRadar.m
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,21 @@ - (void)didUpdateToken:(RadarVerifiedLocationToken *)token {
}];
}

RCT_EXPORT_METHOD(doIndoorSurvey:(NSString *)placeLabel forLength:(int)surveyLengthSeconds resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
__block RCTPromiseResolveBlock resolver = resolve;
__block RCTPromiseRejectBlock rejecter = reject;

RadarIndoorsSurveyCompletionHandler completionHandler = ^(NSString * _Nullable response) {
NSMutableDictionary *dict = [NSMutableDictionary new];
[dict setObject:response forKey:@"response"];
resolver(dict);
resolver = nil;
rejecter = nil;
};

[Radar doIndoorSurvey:placeLabel forLength:surveyLengthSeconds completionHandler:completionHandler];
}

RCT_EXPORT_METHOD(logConversion:(NSDictionary *)optionsDict resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
if (optionsDict == nil) {
if (reject) {
Expand Down
1 change: 1 addition & 0 deletions src/@types/RadarNativeInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export interface RadarNativeInterface {
ipGeocode: () => Promise<RadarIPGeocodeCallback>;
getDistance: (option: RadarGetDistanceOptions) => Promise<RadarRouteCallback>;
getMatrix: (option: RadarGetMatrixOptions) => Promise<RadarRouteMatrix>;
doIndoorSurvey: (placeLabel: string, lengthSeconds: number) => Promise<Record<string, any>>;
logConversion: (
options: RadarLogConversionOptions
) => Promise<RadarLogConversionCallback>;
Expand Down
4 changes: 4 additions & 0 deletions src/index.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ const getDistance = (
const getMatrix = (options: RadarGetMatrixOptions): Promise<RadarRouteMatrix> =>
NativeModules.RNRadar.getMatrix(options);

const doIndoorSurvey = (placeLabel: string, lengthSeconds: number): Promise<Record<string, any>> =>
NativeModules.RNRadar.doIndoorSurvey(placeLabel, lengthSeconds);

const logConversion = (
options: RadarLogConversionOptions
): Promise<RadarLogConversionCallback> =>
Expand Down Expand Up @@ -287,6 +290,7 @@ const Radar: RadarNativeInterface = {
ipGeocode,
getDistance,
getMatrix,
doIndoorSurvey,
logConversion,
sendEvent,
on,
Expand Down