Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offline ramp up #404

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
27fc369
implement client side ramp up
KennyHuRadar Oct 16, 2024
9206728
fix parsing of geofences
KennyHuRadar Oct 16, 2024
e2efd53
use swift 5.0
KennyHuRadar Oct 16, 2024
429b4ed
change build definition of radar test to remove un-needed source files
KennyHuRadar Oct 17, 2024
1a38ecd
remove un-needed logging, just flacky tests
KennyHuRadar Oct 17, 2024
e84a9f0
remove logging
KennyHuRadar Oct 17, 2024
61f6b8e
update pod file
KennyHuRadar Oct 17, 2024
eb7e5d8
remove un-needed imports
KennyHuRadar Oct 17, 2024
decb2a8
update normal trackonce behaviour
KennyHuRadar Oct 17, 2024
6e54e28
clean up
KennyHuRadar Oct 17, 2024
e6e3c6a
add new swift definitions
KennyHuRadar Oct 17, 2024
65b9250
add logger to be accessible by swift
KennyHuRadar Oct 17, 2024
9142abf
add flag
KennyHuRadar Oct 17, 2024
3397fc6
put feature behind flag
KennyHuRadar Oct 17, 2024
c4e115b
bump beta version
KennyHuRadar Oct 21, 2024
e8522f3
Merge branch 'master' into kenny/off-line-ramp-up
KennyHuRadar Oct 21, 2024
d404d57
bump to right beta version
KennyHuRadar Oct 21, 2024
3fd5b00
Update RadarSettings.m
KennyHuRadar Oct 21, 2024
c2fb45d
add build settings and suppress testing on builds for now
KennyHuRadar Oct 21, 2024
4015e47
add flag to project
KennyHuRadar Oct 21, 2024
c4828b8
uncomment out the tests
KennyHuRadar Oct 21, 2024
a87cea2
clean up
KennyHuRadar Oct 21, 2024
28ce949
remove duplicate soruce and also add some logging to adding nearby ge…
KennyHuRadar Oct 21, 2024
be8c1d2
add back compile source
KennyHuRadar Oct 21, 2024
bdfcc07
add inside geofence log message for radar offline manager
KennyHuRadar Oct 21, 2024
5ac6d23
use ramp up specific json resource and improve logging in radar state
KennyHuRadar Oct 22, 2024
c5572b3
make compatible with replays
KennyHuRadar Oct 24, 2024
b6dc7fa
only call when replay is unsuccessful
KennyHuRadar Oct 24, 2024
9b4f71d
change json file for test
KennyHuRadar Oct 24, 2024
af9e4f7
change how geofenes are turned to jsons
KennyHuRadar Oct 24, 2024
f9f874c
change shape of alternative tracking options
KennyHuRadar Oct 25, 2024
aa12fd4
Merge branch 'master' into kenny/off-line-ramp-up
KennyHuRadar Oct 28, 2024
39af20d
refactor geofenceTag and tracking option extraction logic
KennyHuRadar Oct 28, 2024
25d1094
disable user script in build setting in radarSDKMotion
KennyHuRadar Oct 28, 2024
6dd7481
use xcode 16 in circle ci
KennyHuRadar Oct 28, 2024
4f277fd
use iphone 16 in ci
KennyHuRadar Oct 28, 2024
7f8c280
Merge branch 'master' into kenny/off-line-ramp-up
KennyHuRadar Oct 28, 2024
25e455d
Update RadarSDKMotion.podspec
KennyHuRadar Oct 28, 2024
fc75f16
define cocoapods version (#410)
KennyHuRadar Oct 29, 2024
f2baf95
rename
KennyHuRadar Oct 29, 2024
3785164
Merge branch 'master' into kenny/off-line-ramp-up
KennyHuRadar Oct 29, 2024
85e1abe
rename
KennyHuRadar Oct 29, 2024
761ef37
refactor updateTrackingFromConfig
KennyHuRadar Oct 30, 2024
b1cae04
Merge branch 'master' into kenny/off-line-ramp-up
KennyHuRadar Oct 30, 2024
880cbe7
rename and fix typo
KennyHuRadar Oct 30, 2024
b6f811b
increase number of geofences synced
KennyHuRadar Nov 5, 2024
999b459
Merge branch 'master' into kenny/off-line-ramp-up
KennyHuRadar Nov 11, 2024
41c7a36
Merge
lmeier Dec 30, 2024
ac5011e
3.19.7-beta.1
lmeier Dec 30, 2024
4769e5e
Fix merge
lmeier Dec 30, 2024
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
3 changes: 2 additions & 1 deletion RadarSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ Pod::Spec.new do |s|
s.author = { 'Radar Labs, Inc.' => 'support@radar.com' }
s.platform = :ios
s.source = { :git => 'https://github.com/radarlabs/radar-sdk-ios.git', :tag => s.version.to_s }
s.source_files = ["RadarSDK/*.{h,m}", "RadarSDK/Internal/*.{h,m}", "RadarSDK/Include/*.h"]
s.source_files = ["RadarSDK/*.{h,m,swift}", "RadarSDK/Internal/*.{h,m}", "RadarSDK/Include/*.h"]
s.module_name = 'RadarSDK'
s.ios.deployment_target = '10.0'
s.frameworks = 'CoreLocation'
s.requires_arc = true
s.license = { :type => 'Apache-2.0' }
s.resource_bundles = {'RadarSDK' => ['RadarSDK/PrivacyInfo.xcprivacy']}
s.swift_version = '5.0'
end
55 changes: 39 additions & 16 deletions RadarSDK.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions RadarSDK/Include/RadarTrackingOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ typedef NS_ENUM(NSInteger, RadarTrackingOptionsSyncLocations) {
+ (NSString *)stringForSyncLocations:(RadarTrackingOptionsSyncLocations)syncLocations;
+ (RadarTrackingOptionsSyncLocations)syncLocationsForString:(NSString *)str;
+ (RadarTrackingOptions *_Nullable)trackingOptionsFromDictionary:(NSDictionary *_Nonnull)dictionary;
+ (RadarTrackingOptions *_Nullable)trackingOptionsFromObject:(NSObject *_Nonnull)object;
- (NSDictionary *)dictionaryValue;

@end
Expand Down
14 changes: 7 additions & 7 deletions RadarSDK/Radar.m
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,15 @@ + (void)trackOnceWithLocation:(CLLocation *)location completionHandler:(RadarTra
beacons:nil
completionHandler:^(RadarStatus status, NSDictionary *_Nullable res, NSArray<RadarEvent *> *_Nullable events, RadarUser *_Nullable user,
NSArray<RadarGeofence *> *_Nullable nearbyGeofences, RadarConfig *_Nullable config, RadarVerifiedLocationToken *_Nullable token) {
if (status == RadarStatusSuccess && config != nil) {
if (config != nil) {
[[RadarLocationManager sharedInstance] updateTrackingFromMeta:config.meta];
}
if (completionHandler) {
[RadarUtils runOnMainThread:^{
completionHandler(status, location, events, user);
}];
}
}];
if (completionHandler) {
[RadarUtils runOnMainThread:^{
completionHandler(status, location, events, user);
}];
}
}];
}

+ (void)trackVerifiedWithCompletionHandler:(RadarTrackVerifiedCompletionHandler)completionHandler {
Expand Down
12 changes: 10 additions & 2 deletions RadarSDK/RadarAPIClient.m
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if there's a network error and replay: all is on, we should change the log level of a network error from error to info.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how deeply do we want to couple these offline server fallback behaviors with the idea of replay? Asking this as I'm already creating new flags.

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#import "RadarVerificationManager.h"
#import "RadarVerifiedLocationToken+Internal.h"
#import <os/log.h>
#import "RadarOfflineManager.h"

@implementation RadarAPIClient

Expand Down Expand Up @@ -216,6 +217,7 @@ - (void)trackWithLocation:(CLLocation *_Nonnull)location
params[@"anonymous"] = @(anonymous);
if (anonymous) {
params[@"deviceId"] = @"anonymous";
// this can be updated by offline event detection, which feels correct, not going to address right now for simplicity
params[@"geofenceIds"] = [RadarState geofenceIds];
params[@"placeId"] = [RadarState placeId];
params[@"regionIds"] = [RadarState regionIds];
Expand Down Expand Up @@ -427,9 +429,15 @@ - (void)trackWithLocation:(CLLocation *_Nonnull)location

[[RadarDelegateHolder sharedInstance] didFailWithStatus:status];

return completionHandler(status, nil, nil, nil, nil, nil, nil);
}
// this is where we need to perform the offline detection
// in essence, we want to replace what the server would had done
// we also need to update the tracking, we do this by syncing some states and ensuring that radarsetting returns the ramp up value
return [RadarOfflineManager contextualizeLocation:location completionHandler:^(RadarConfig * _Nullable config) {
return completionHandler(status, nil, nil, nil, nil, config, nil);
}];

}
// since we had a successful track, the do we need to clear anything here?
[[RadarReplayBuffer sharedInstance] clearBuffer];
[RadarState setLastFailedStoppedLocation:nil];
[Radar flushLogs];
Expand Down
4 changes: 2 additions & 2 deletions RadarSDK/RadarGeofence.m
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ - (NSDictionary *)dictionaryValue {
RadarCircleGeometry *circleGeometry = (RadarCircleGeometry *)self.geometry;
[dict setValue:@(circleGeometry.radius) forKey:@"geometryRadius"];
[dict setValue:[circleGeometry.center dictionaryValue] forKey:@"geometryCenter"];
[dict setValue:@"Circle" forKey:@"type"];
[dict setValue:@"circle" forKey:@"type"];
Copy link
Contributor Author

@KennyHuRadar KennyHuRadar Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we pass down the type as circle and polygon from the server and parse it as such, however, we were setting the dict with the capitalized version, this causes issues. We need to make sure this does not impact our cross-platform SDKs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I vaguely remember fixing this (maybe in RN, changing it to expect capitalization)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm it might be easier to just change the fromJson within the native SDK to accept both capitalized and non capitalized names of the shape to avoid introducing knock on effects downstream, this can help avoid introducing a breaking change.

} else if ([self.geometry isKindOfClass:[RadarPolygonGeometry class]]) {
RadarPolygonGeometry *polygonGeometry = (RadarPolygonGeometry *)self.geometry;
[dict setValue:@(polygonGeometry.radius) forKey:@"geometryRadius"];
Expand All @@ -237,7 +237,7 @@ - (NSDictionary *)dictionaryValue {
// Nest coordinate array; Per GeoJSON spec: for type "Polygon", the "coordinates" member must be an array of LinearRing coordinate arrays.
[dict setValue:@[[RadarGeofence arrayForGeometryCoordinates:polygonGeometry._coordinates]] forKey:@"coordinates"];
}
[dict setValue:@"Polygon" forKey:@"type"];
[dict setValue:@"polygon" forKey:@"type"];
}

return dict;
Expand Down
37 changes: 25 additions & 12 deletions RadarSDK/RadarLocationManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,8 @@ - (void)replaceSyncedGeofences:(NSArray<RadarGeofence *> *)geofences {
return;
}

[RadarState setNearbyGeofences:geofences];

RadarTrackingOptions *options = [Radar getTrackingOptions];
NSUInteger numGeofences = MIN(geofences.count, options.beacons ? 9 : 19);
NSMutableArray *requests = [NSMutableArray array];
Expand Down Expand Up @@ -585,10 +587,11 @@ - (void)replaceSyncedGeofences:(NSArray<RadarGeofence *> *)geofences {
}
}
}

[RadarNotificationHelper removePendingNotificationsWithCompletionHandler: ^{
[RadarNotificationHelper addOnPremiseNotificationRequests:requests];
}];
if (NSClassFromString(@"XCTestCase") == nil) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method is now ran in our test suite, so we need to suppress this chunk in tests as test env does not have a notification manager.

[RadarNotificationHelper removePendingNotificationsWithCompletionHandler: ^{
[RadarNotificationHelper addOnPremiseNotificationRequests:requests];
}];
}
}

- (void)removeSyncedGeofences {
Expand Down Expand Up @@ -889,8 +892,15 @@ - (void)sendLocation:(CLLocation *)location stopped:(BOOL)stopped source:(RadarL
completionHandler:^(RadarStatus status, NSDictionary *_Nullable res, NSArray<RadarEvent *> *_Nullable events, RadarUser *_Nullable user,
NSArray<RadarGeofence *> *_Nullable nearbyGeofences, RadarConfig *_Nullable config, RadarVerifiedLocationToken *_Nullable token) {
self.sending = NO;

[self updateTrackingFromMeta:config.meta];

if (config != nil) {
[self updateTrackingFromMeta:config.meta];
}

if (status != RadarStatusSuccess || !config) {
return;
}

[self replaceSyncedGeofences:nearbyGeofences];
}];
};
Expand Down Expand Up @@ -970,13 +980,16 @@ - (void)sendLocation:(CLLocation *)location stopped:(BOOL)stopped source:(RadarL
beacons:beacons
completionHandler:^(RadarStatus status, NSDictionary *_Nullable res, NSArray<RadarEvent *> *_Nullable events, RadarUser *_Nullable user,
NSArray<RadarGeofence *> *_Nullable nearbyGeofences, RadarConfig *_Nullable config, RadarVerifiedLocationToken *_Nullable token) {
self.sending = NO;
if (status != RadarStatusSuccess || !config) {
return;
}
self.sending = NO;

if (config != nil) {
[self updateTrackingFromMeta:config.meta];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should adopt the pattern of doing the check in the function that's called, like: #409

Copy link
Contributor Author

@KennyHuRadar KennyHuRadar Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems like each instance of updateTrackingFromMeta in unwrapping config, I'm changing the method to updateTrackingFromConfig and capturing the `config != nil' inside the new method.

}
if (status != RadarStatusSuccess || !config) {
return;
}

[self updateTrackingFromMeta:config.meta];
[self replaceSyncedGeofences:nearbyGeofences];
[self replaceSyncedGeofences:nearbyGeofences];
}];
}
}
Expand Down
20 changes: 20 additions & 0 deletions RadarSDK/RadarOfflineManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Header.h
// RadarSDK
//
// Created by Kenny Hu on 10/16/24.
// Copyright © 2024 Radar Labs, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import "RadarConfig.h"

NS_ASSUME_NONNULL_BEGIN

@interface RadarOfflineManager : NSObject

+ (void)contextualizeLocation:(CLLocation *)location completionHandler:(void (^)(RadarConfig *))completionHandler;

@end

NS_ASSUME_NONNULL_END
81 changes: 81 additions & 0 deletions RadarSDK/RadarOfflineManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
//
// File.swift
// RadarSDK
//
// Created by Kenny Hu on 10/16/24.
// Copyright © 2024 Radar Labs, Inc. All rights reserved.
//

import Foundation
import CoreLocation

@objc(RadarOfflineManager) class RadarOfflineManager: NSObject {
@objc public static func contextualizeLocation(_ location: CLLocation, completionHandler: @escaping (RadarConfig?) -> Void) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this function name to be quite opaque. I feel like this is more something in the vain of updateConfigFromOfflineLocation (or something in that ballpark)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intentionally kept it more vague, it was my understanding that this might become a place where stuff like client side event generation and trip updates may occur?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updateTrackingOptionsFromOfflineLocation

var newGeofenceIds = [String]()
var newGeofenceTags = [String]()
// get all the nearby geofences
let nearbyGeofences = RadarState.nearbyGeofences()
if (nearbyGeofences == nil) {
return completionHandler(nil)
}
// for each of the nearby geofences, check if the location is inside the geofence
for geofence in nearbyGeofences! {
var center: RadarCoordinate?
var radius: Double = 100

if let geometry = geofence.geometry as? RadarCircleGeometry {
center = geometry.center
radius = geometry.radius
} else if let geometry = geofence.geometry as? RadarPolygonGeometry {
center = geometry.center
radius = geometry.radius
} else {
// something went wrong with the geofence geometry
continue
}
if (isPointInsideCircle(center: center!.coordinate, radius: radius, point: location)) {
newGeofenceIds.append(geofence._id)
if (geofence.tag != nil) {
newGeofenceTags.append(geofence.tag!)
}
}
}
RadarState.setGeofenceIds(newGeofenceIds)
// if there are no rampup geofence tags, we never had ramped up so we do not need to ramp down (reason a little more about this)
let rampUpGeofenceTagsOptional = RadarSettings.sdkConfiguration()?.inGeofenceTrackingOptionsTags
if let rampUpGeofenceTags = rampUpGeofenceTagsOptional {
let inRampedUpGeofence = !Set(rampUpGeofenceTags).isDisjoint(with: Set(newGeofenceTags))
let sdkConfig = RadarSettings.sdkConfiguration()
var newTrackingOptions: RadarTrackingOptions? = nil

if inRampedUpGeofence {
// ramp up
newTrackingOptions = sdkConfig?.inGeofenceTrackingOptions
} else {
// ramp down if needed
if let onTripOptions = sdkConfig?.onTripTrackingOptions,
let _ = Radar.getTripOptions() {
newTrackingOptions = onTripOptions
} else {
newTrackingOptions = sdkConfig?.defaultTrackingOptions
}
}
if (newTrackingOptions != nil) {
let metaDict: [String: Any] = ["trackingOptions": newTrackingOptions?.dictionaryValue() as Any]
let configDict: [String: Any] = ["meta": metaDict]
if let radarConfig = RadarConfig.fromDictionary(configDict) {
completionHandler(radarConfig)
}
}
}
return completionHandler(nil)
}

private static func isPointInsideCircle(center: CLLocationCoordinate2D, radius: Double, point: CLLocation) -> Bool {
let centerLocation = CLLocation(latitude: center.latitude, longitude: center.longitude)

let distance = centerLocation.distance(from: point)

return distance <= radius
}
}
3 changes: 3 additions & 0 deletions RadarSDK/RadarSDK.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ FOUNDATION_EXPORT const unsigned char RadarSDKVersionString[];
#import "RadarUser.h"
#import "RadarVerifiedDelegate.h"
#import "RadarMotionProtocol.h"
#import "RadarConfig.h"
#import "RadarState.h"
#import "RadarSettings.h"
4 changes: 4 additions & 0 deletions RadarSDK/RadarSDKTests-Bridging-Header.h
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its auto-generated as we introduce swift into the repo, not removing as it may come in useful when we want to directly test swift stuff in the future and it is a pain to manually add back in these autogenerated files in xcode with all the obscure linking we need to do via the UI.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//

8 changes: 8 additions & 0 deletions RadarSDK/RadarSdkConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) BOOL useLocationMetadata;

@property (nonatomic, assign) BOOL useOpenedAppConversion;

@property (nonatomic, copy, nullable) RadarTrackingOptions *inGeofenceTrackingOptions;

@property (nonatomic, copy, nullable) RadarTrackingOptions *defaultTrackingOptions;

@property (nonatomic, copy, nullable) RadarTrackingOptions *onTripTrackingOptions;

@property (nonatomic, copy, nullable) NSArray<NSString *> *inGeofenceTrackingOptionsTags;
/**
Initializes a new RadarSdkConfiguration object with given value.
*/
Expand Down
37 changes: 36 additions & 1 deletion RadarSDK/RadarSdkConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,38 @@ - (instancetype)initWithDict:(NSDictionary *)dict {
if (useOpenedAppConversion && [useOpenedAppConversion isKindOfClass:[NSNumber class]]) {
_useOpenedAppConversion = [(NSNumber *)useOpenedAppConversion boolValue];
}
NSObject *inGeofenceTrackingOptionsObj = dict[@"inGeofenceTrackingOptions"];
_inGeofenceTrackingOptions = nil;
if (inGeofenceTrackingOptionsObj && [inGeofenceTrackingOptionsObj isKindOfClass:[NSDictionary class]]) {
RadarTrackingOptions *radarTrackingOptions = [RadarTrackingOptions trackingOptionsFromObject:inGeofenceTrackingOptionsObj];
if (radarTrackingOptions) {
_inGeofenceTrackingOptions = radarTrackingOptions;
}
}

NSObject *defaultTrackingOptionsObj = dict[@"defaultTrackingOptions"];
_defaultTrackingOptions = nil;
if (defaultTrackingOptionsObj && [defaultTrackingOptionsObj isKindOfClass:[NSDictionary class]]) {
RadarTrackingOptions *radarTrackingOptions = [RadarTrackingOptions trackingOptionsFromObject:defaultTrackingOptionsObj];
if (radarTrackingOptions) {
_defaultTrackingOptions = radarTrackingOptions;
}
}

NSObject *onTripTrackingOptionsObj = dict[@"onTripTrackingOptions"];
_onTripTrackingOptions = nil;
if (onTripTrackingOptionsObj && [onTripTrackingOptionsObj isKindOfClass:[NSDictionary class]]) {
RadarTrackingOptions *radarTrackingOptions = [RadarTrackingOptions trackingOptionsFromObject:onTripTrackingOptionsObj];
if (radarTrackingOptions) {
_onTripTrackingOptions = radarTrackingOptions;
}
}

Copy link
Contributor

@lmeier lmeier Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See server PR comment for an alternative struct that I think we should prefer

NSObject *inGeofenceTrackingOptionsTagsObj = dict[@"inGeofenceTrackingOptionsTags"];
_inGeofenceTrackingOptionsTags = nil;
if (inGeofenceTrackingOptionsTagsObj && [inGeofenceTrackingOptionsTagsObj isKindOfClass:[NSArray class]]) {
_inGeofenceTrackingOptionsTags = (NSArray *)inGeofenceTrackingOptionsTagsObj;
}

return self;
}
Expand All @@ -90,7 +122,10 @@ - (NSDictionary *)dictionaryValue {
dict[@"useRadarModifiedBeacon"] = @(_useRadarModifiedBeacon);
dict[@"useLocationMetadata"] = @(_useLocationMetadata);
dict[@"useOpenedAppConversion"] = @(_useOpenedAppConversion);

dict[@"inGeofenceTrackingOptions"] = [_inGeofenceTrackingOptions dictionaryValue];
dict[@"defaultTrackingOptions"] = [_defaultTrackingOptions dictionaryValue];
dict[@"onTripTrackingOptions"] = [_onTripTrackingOptions dictionaryValue];
dict[@"inGeofenceTrackingOptionsTags"] = _inGeofenceTrackingOptionsTags;
return dict;
}

Expand Down
2 changes: 2 additions & 0 deletions RadarSDK/RadarSettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ @implementation RadarSettings
static NSString *const kTrackingOptions = @"radar-trackingOptions";
static NSString *const kPreviousTrackingOptions = @"radar-previousTrackingOptions";
static NSString *const kRemoteTrackingOptions = @"radar-remoteTrackingOptions";
static NSString *const kPreviousRemoteTrackingOptions = @"radar-previousRemoteTrackingOptions";
static NSString *const kClientSdkConfiguration = @"radar-clientSdkConfiguration";
static NSString *const kSdkConfiguration = @"radar-sdkConfiguration";
static NSString *const kTripOptions = @"radar-tripOptions";
Expand Down Expand Up @@ -276,6 +277,7 @@ + (void)setBeaconUUIDs:(NSArray<NSString *> *_Nullable)beaconUUIDs {
}

+ (NSString *)host {
//return @"https://api-kenny.radar-staging.com";
NSString *host = [[NSUserDefaults standardUserDefaults] stringForKey:kHost];
return host ? host : kDefaultHost;
}
Expand Down
7 changes: 5 additions & 2 deletions RadarSDK/RadarState.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#import <CoreLocation/CoreLocation.h>
#import <Foundation/Foundation.h>
#import "RadarGeofence.h"

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -26,8 +27,8 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)setCanExit:(BOOL)canExit;
+ (CLLocation *)lastFailedStoppedLocation;
+ (void)setLastFailedStoppedLocation:(CLLocation *_Nullable)lastFailedStoppedLocation;
+ (NSArray<NSString *> *)geofenceIds;
+ (void)setGeofenceIds:(NSArray<NSString *> *_Nullable)geofenceIds;
+ (NSArray<NSString *> *)geofenceIds NS_SWIFT_NAME(geofenceIds());
+ (void)setGeofenceIds:(NSArray<NSString *> *_Nullable)geofenceIds NS_SWIFT_NAME(setGeofenceIds(_:));
+ (NSArray<NSString *> *)placeId;
+ (void)setPlaceId:(NSString *_Nullable)placeId;
+ (NSArray<NSString *> *)regionIds;
Expand All @@ -40,6 +41,8 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)setLastMotionActivityData:(NSDictionary *_Nullable)lastMotionActivityData;
+ (void)setNotificationPermissionGranted:(BOOL)granted;
+ (BOOL)notificationPermissionGranted;
+ (void)setNearbyGeofences:(NSArray<RadarGeofence *> *_Nullable)nearbyGeofences NS_SWIFT_NAME(setNearbyGeofences(_:));
+ (NSArray<RadarGeofence *> *_Nullable)nearbyGeofences NS_SWIFT_NAME(nearbyGeofences());

@end

Expand Down
Loading
Loading