-
Notifications
You must be signed in to change notification settings - Fork 30
Offline ramp up #404
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
Open
KennyHuRadar
wants to merge
54
commits into
master
Choose a base branch
from
kenny/off-line-ramp-up
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Offline ramp up #404
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
27fc369
implement client side ramp up
KennyHuRadar 9206728
fix parsing of geofences
KennyHuRadar e2efd53
use swift 5.0
KennyHuRadar 429b4ed
change build definition of radar test to remove un-needed source files
KennyHuRadar 1a38ecd
remove un-needed logging, just flacky tests
KennyHuRadar e84a9f0
remove logging
KennyHuRadar 61f6b8e
update pod file
KennyHuRadar eb7e5d8
remove un-needed imports
KennyHuRadar decb2a8
update normal trackonce behaviour
KennyHuRadar 6e54e28
clean up
KennyHuRadar e6e3c6a
add new swift definitions
KennyHuRadar 65b9250
add logger to be accessible by swift
KennyHuRadar 9142abf
add flag
KennyHuRadar 3397fc6
put feature behind flag
KennyHuRadar c4e115b
bump beta version
KennyHuRadar e8522f3
Merge branch 'master' into kenny/off-line-ramp-up
KennyHuRadar d404d57
bump to right beta version
KennyHuRadar 3fd5b00
Update RadarSettings.m
KennyHuRadar c2fb45d
add build settings and suppress testing on builds for now
KennyHuRadar 4015e47
add flag to project
KennyHuRadar c4828b8
uncomment out the tests
KennyHuRadar a87cea2
clean up
KennyHuRadar 28ce949
remove duplicate soruce and also add some logging to adding nearby ge…
KennyHuRadar be8c1d2
add back compile source
KennyHuRadar bdfcc07
add inside geofence log message for radar offline manager
KennyHuRadar 5ac6d23
use ramp up specific json resource and improve logging in radar state
KennyHuRadar c5572b3
make compatible with replays
KennyHuRadar b6dc7fa
only call when replay is unsuccessful
KennyHuRadar 9b4f71d
change json file for test
KennyHuRadar af9e4f7
change how geofenes are turned to jsons
KennyHuRadar f9f874c
change shape of alternative tracking options
KennyHuRadar aa12fd4
Merge branch 'master' into kenny/off-line-ramp-up
KennyHuRadar 39af20d
refactor geofenceTag and tracking option extraction logic
KennyHuRadar 25d1094
disable user script in build setting in radarSDKMotion
KennyHuRadar 6dd7481
use xcode 16 in circle ci
KennyHuRadar 4f277fd
use iphone 16 in ci
KennyHuRadar 7f8c280
Merge branch 'master' into kenny/off-line-ramp-up
KennyHuRadar 25e455d
Update RadarSDKMotion.podspec
KennyHuRadar fc75f16
define cocoapods version (#410)
KennyHuRadar f2baf95
rename
KennyHuRadar 3785164
Merge branch 'master' into kenny/off-line-ramp-up
KennyHuRadar 85e1abe
rename
KennyHuRadar 761ef37
refactor updateTrackingFromConfig
KennyHuRadar b1cae04
Merge branch 'master' into kenny/off-line-ramp-up
KennyHuRadar 880cbe7
rename and fix typo
KennyHuRadar b6f811b
increase number of geofences synced
KennyHuRadar 999b459
Merge branch 'master' into kenny/off-line-ramp-up
KennyHuRadar 41c7a36
Merge
lmeier ac5011e
3.19.7-beta.1
lmeier 4769e5e
Fix merge
lmeier af1a7bd
Merge branch 'master' into kenny/off-line-ramp-up
KennyHuRadar 8681189
fix xcode merge issue
KennyHuRadar 24b4d9e
Merge branch 'master' into kenny/off-line-ramp-up
KennyHuRadar c5c7725
Merge branch 'master' into kenny/off-line-ramp-up
KennyHuRadar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,12 @@ Pod::Spec.new do |s| | |
s.author = { 'Radar Labs, Inc.' => '[email protected]' } | ||
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 = '12.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 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -462,12 +462,15 @@ - (void)updateTracking:(CLLocation *)location fromInitialize:(BOOL)fromInitializ | |
}); | ||
} | ||
|
||
- (void)updateTrackingFromMeta:(RadarMeta *_Nullable)meta { | ||
if (meta) { | ||
if ([meta trackingOptions]) { | ||
- (void)updateTrackingFromConfig:(RadarConfig *_Nullable)config { | ||
if (config == nil) { | ||
return; | ||
} | ||
if (config.meta) { | ||
if ([config.meta trackingOptions]) { | ||
[[RadarLogger sharedInstance] logWithLevel:RadarLogLevelDebug | ||
message:[NSString stringWithFormat:@"Setting remote tracking options | trackingOptions = %@", meta.trackingOptions]]; | ||
[RadarSettings setRemoteTrackingOptions:[meta trackingOptions]]; | ||
message:[NSString stringWithFormat:@"Setting remote tracking options | trackingOptions = %@", config.meta.trackingOptions]]; | ||
[RadarSettings setRemoteTrackingOptions:[config.meta trackingOptions]]; | ||
} else { | ||
[RadarSettings removeRemoteTrackingOptions]; | ||
[[RadarLogger sharedInstance] logWithLevel:RadarLogLevelDebug | ||
|
@@ -523,10 +526,11 @@ - (void)replaceSyncedGeofences:(NSArray<RadarGeofence *> *)geofences { | |
return; | ||
} | ||
|
||
[RadarState setNearbyGeofences:geofences]; | ||
[self removeSyncedGeofences]; | ||
|
||
RadarTrackingOptions *options = [Radar getTrackingOptions]; | ||
NSUInteger numGeofences = MIN(geofences.count, options.beacons ? 9 : 19); | ||
NSUInteger numGeofences = MIN(MIN(geofences.count,19), options.beacons ? 9 : 19); | ||
NSMutableArray *requests = [NSMutableArray array]; | ||
|
||
for (int i = 0; i < numGeofences; i++) { | ||
|
@@ -580,10 +584,11 @@ - (void)replaceSyncedGeofences:(NSArray<RadarGeofence *> *)geofences { | |
} | ||
} | ||
} | ||
|
||
[RadarNotificationHelper removePendingNotificationsWithCompletionHandler: ^{ | ||
[RadarNotificationHelper addOnPremiseNotificationRequests:requests]; | ||
}]; | ||
if (NSClassFromString(@"XCTestCase") == nil) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 { | ||
|
@@ -884,8 +889,13 @@ - (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]; | ||
|
||
[self updateTrackingFromConfig:config]; | ||
|
||
if (status != RadarStatusSuccess || !config) { | ||
return; | ||
} | ||
|
||
[self replaceSyncedGeofences:nearbyGeofences]; | ||
}]; | ||
}; | ||
|
@@ -965,13 +975,15 @@ - (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; | ||
|
||
[self updateTrackingFromConfig:config]; | ||
|
||
if (status != RadarStatusSuccess || !config) { | ||
return; | ||
} | ||
|
||
[self updateTrackingFromMeta:config.meta]; | ||
[self replaceSyncedGeofences:nearbyGeofences]; | ||
[self replaceSyncedGeofences:nearbyGeofences]; | ||
}]; | ||
} | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)updateTrackingOptionsFromOfflineLocation:(CLLocation *)location completionHandler:(void (^)(RadarConfig *))completionHandler; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 fromerror
toinfo
.There was a problem hiding this comment.
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.