-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add configuration profile options (#43)
* Port Radius Profile Configuration (#36) * Switch to @available for version checking This requires Xcode 9.x. * Port Radius Profile Configuration - Creates new class MMEEventsService to manage the creation and distribution of MMEEventsConfiguration objects/configurations. - Expands MMEEventsConfiguration to include a variable hibernation radius configuration and potentially additional configurations in the future. A user may access the variable radius by setting both "MMEEventsProfile" (with the appropriate key "VariableGeofence") and "MMEGeofenceRadius" with a desired radius (within a range we've set) in the applications plist. If "MMEEventsProfile" is set in plist without choosing a radius then a median radius will be the default. - Modifies MMELocationManager and MMEEventsManager to use MMEEventsService configuration - Adds and repairs cedar tests * Fix bug with geofence creation related to custom profile geofence were being created too often when the profile was set to a wide geofence radius. * Update symbols * Fix nullable singleton * Follow bracket convention * Fix race condition in cedar test "created" NSDate was causing a failure some of the time when the date time was off by a second. * Remove hard-coded date string
- Loading branch information
Showing
11 changed files
with
175 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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
8 changes: 8 additions & 0 deletions
8
MapboxMobileEvents.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains 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,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains 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 |
---|---|---|
@@ -1,11 +1,14 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <CoreLocation/CoreLocation.h> | ||
|
||
@interface MMEEventsConfiguration : NSObject | ||
|
||
@property (nonatomic) NSUInteger eventFlushCountThreshold; | ||
@property (nonatomic) NSUInteger eventFlushSecondsThreshold; | ||
@property (nonatomic) NSTimeInterval instanceIdentifierRotationTimeInterval; | ||
@property (nonatomic) CLLocationDistance locationManagerHibernationRadius; | ||
|
||
+ (instancetype)defaultEventsConfiguration; | ||
+ (instancetype)eventsConfigurationWithVariableRadius:(CLLocationDistance)radius; | ||
|
||
@end |
This file contains 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 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 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,15 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <CoreLocation/CoreLocation.h> | ||
#import "MMEEventsConfiguration.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface MMEEventsService : NSObject | ||
|
||
@property (nonatomic) MMEEventsConfiguration *configuration; | ||
|
||
+ (instancetype)sharedService; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains 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,36 @@ | ||
#import "MMEEventsService.h" | ||
|
||
NSString *const kMMEEventsProfile = @"MMEEventsProfile"; | ||
NSString *const kMMERadiusSize = @"MMEGeofenceRadius"; | ||
|
||
static NSString *const kConfigHibernationRadiusVariableKey = @"VariableGeofence"; | ||
|
||
@implementation MMEEventsService | ||
|
||
- (instancetype) init { | ||
self = [super init]; | ||
if (self) { | ||
self.configuration = [self configurationFromKey:[[NSBundle mainBundle] objectForInfoDictionaryKey:kMMEEventsProfile]]; | ||
} | ||
return self; | ||
} | ||
|
||
+ (instancetype)sharedService { | ||
static dispatch_once_t onceToken; | ||
static MMEEventsService *_sharedService; | ||
dispatch_once(&onceToken, ^{ | ||
_sharedService = [[self alloc] init]; | ||
}); | ||
return _sharedService; | ||
} | ||
|
||
- (MMEEventsConfiguration *)configurationFromKey:(NSString *)key { | ||
if ([key isEqualToString:kConfigHibernationRadiusVariableKey]) { | ||
return [MMEEventsConfiguration eventsConfigurationWithVariableRadius:[[[NSBundle mainBundle] objectForInfoDictionaryKey:kMMERadiusSize] doubleValue]]; | ||
} else { | ||
return [MMEEventsConfiguration defaultEventsConfiguration]; | ||
} | ||
return nil; | ||
} | ||
|
||
@end |
This file contains 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 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
Oops, something went wrong.