diff options
author | Jason Wray <jason@mapbox.com> | 2019-05-13 16:48:19 -0700 |
---|---|---|
committer | Jason Wray <jason@mapbox.com> | 2019-05-13 16:48:19 -0700 |
commit | ae42028d65a50e48c460482a51f222fb9e6940f0 (patch) | |
tree | 775892594dba10e0295a2343f38bfd795b105d62 /platform | |
parent | 6e2889db8ecb39c6a4358598e20757dfe00c40fb (diff) | |
download | qtlocation-mapboxgl-upstream/friedbunny-skus-again-again.tar.gz |
WIP for nav SKU changesupstream/friedbunny-skus-again-again
Diffstat (limited to 'platform')
-rw-r--r-- | platform/darwin/src/MGLAccountManager.m | 8 | ||||
-rw-r--r-- | platform/ios/src/MGLMapboxEvents.m | 2 | ||||
-rw-r--r-- | platform/ios/vendor/mapbox-accounts-ios/MBXSKUToken.h | 22 | ||||
-rw-r--r-- | platform/ios/vendor/mapbox-accounts-ios/libmbxaccounts.a | bin | 68592 -> 77808 bytes |
4 files changed, 25 insertions, 7 deletions
diff --git a/platform/darwin/src/MGLAccountManager.m b/platform/darwin/src/MGLAccountManager.m index bc3e9d2369..83c9d60fbb 100644 --- a/platform/darwin/src/MGLAccountManager.m +++ b/platform/darwin/src/MGLAccountManager.m @@ -42,7 +42,7 @@ static const NSTimeInterval MGLAccountManagerSKUTokenLifespan = 3600; } #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR - self.skuToken = MBXSKUToken.mapsToken; + self.skuToken = [MBXSKUToken tokenForSKUID:MBXAccountsSKUIDMaps type:MBXAccountsSKUTypeUser]; #endif } @@ -108,7 +108,11 @@ static const NSTimeInterval MGLAccountManagerSKUTokenLifespan = 3600; } + (NSString *)skuToken { - return [MGLAccountManager.sharedManager isSKUTokenExpired] ? MBXSKUToken.mapsToken : MGLAccountManager.sharedManager.skuToken; + if ([MGLAccountManager.sharedManager isSKUTokenExpired]) { + return [MBXSKUToken tokenForSKUID:MBXAccountsSKUIDMaps type:MBXAccountsSKUTypeUser]; + } else { + return MGLAccountManager.sharedManager.skuToken; + } } - (BOOL)isSKUTokenExpired { diff --git a/platform/ios/src/MGLMapboxEvents.m b/platform/ios/src/MGLMapboxEvents.m index dc6391df07..d5814dab46 100644 --- a/platform/ios/src/MGLMapboxEvents.m +++ b/platform/ios/src/MGLMapboxEvents.m @@ -145,7 +145,7 @@ static NSString * const MGLVariableGeofence = @"VariableGeofence"; [[MGLMapboxEvents sharedInstance] eventsManager].baseURL = [MGLMapboxEvents sharedInstance].baseURL; } - [[self sharedInstance] eventsManager].skuId = MBXAccountsMapsSKUIDMaps; + [[self sharedInstance] eventsManager].skuId = MBXAccountsSKUIDMaps; [self flush]; }); diff --git a/platform/ios/vendor/mapbox-accounts-ios/MBXSKUToken.h b/platform/ios/vendor/mapbox-accounts-ios/MBXSKUToken.h index e83ffd2288..7dd42b47b5 100644 --- a/platform/ios/vendor/mapbox-accounts-ios/MBXSKUToken.h +++ b/platform/ios/vendor/mapbox-accounts-ios/MBXSKUToken.h @@ -2,13 +2,27 @@ NS_ASSUME_NONNULL_BEGIN -extern NSString *const MBXAccountsMapsSKUIDMaps; -extern NSString *const MBXAccountsNavigationSKUIDMaps; +typedef NS_ENUM(NSInteger, MBXAccountsSKUID) { + MBXAccountsSKUIDMaps, + MBXAccountsSKUIDNavigation +}; + +typedef NS_ENUM(NSInteger, MBXAccountsSKUType) { + MBXAccountsSKUTypeUser, + MBXAccountsSKUTypeSession +}; @interface MBXSKUToken : NSObject -@property (class, nonatomic, readonly) NSString *mapsToken; -@property (class, nonatomic, readonly) NSString *navigationToken; +/** + Generates a token for the given identifier and type. + + @param skuId The sku identifier, e.g. maps or navigation. + @param type The type of token, e.g. user or session. + + @return A SKU token for use with API requests. + */ ++ (NSString *)tokenForSKUID:(MBXAccountsSKUID)skuId type:(MBXAccountsSKUType)type; @end diff --git a/platform/ios/vendor/mapbox-accounts-ios/libmbxaccounts.a b/platform/ios/vendor/mapbox-accounts-ios/libmbxaccounts.a Binary files differindex efe06835ec..fe50dea105 100644 --- a/platform/ios/vendor/mapbox-accounts-ios/libmbxaccounts.a +++ b/platform/ios/vendor/mapbox-accounts-ios/libmbxaccounts.a |