From cbef953ce39c5892adf0f468de5b065f23e6ac54 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Wed, 15 May 2019 14:35:18 -0700 Subject: [ios] Update to libmbxaccounts 0.0.5 --- platform/darwin/src/MGLAccountManager.m | 4 ++-- platform/ios/src/MGLMapboxEvents.m | 2 +- .../ios/vendor/mapbox-accounts-ios/MBXSKUToken.h | 21 +++++++++++++++++---- .../vendor/mapbox-accounts-ios/libmbxaccounts.a | Bin 68592 -> 74248 bytes 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/platform/darwin/src/MGLAccountManager.m b/platform/darwin/src/MGLAccountManager.m index edcfbbcdf0..da2b99c9ac 100644 --- a/platform/darwin/src/MGLAccountManager.m +++ b/platform/darwin/src/MGLAccountManager.m @@ -50,7 +50,7 @@ static BOOL _MGLAccountsSDKEnabled; } if (self.isAccountsSDKEnabled) { - self.skuToken = MBXSKUToken.mapsToken; + self.skuToken = [MBXSKUToken tokenForSKUID:MBXAccountsSKUIDMaps type:MBXAccountsSKUTypeUser]; } #endif @@ -131,7 +131,7 @@ static BOOL _MGLAccountsSDKEnabled; + (NSString *)skuToken { if (MGLAccountManager.isAccountsSDKEnabled) { return [MGLAccountManager.sharedManager isSKUTokenExpired] ? - MBXSKUToken.mapsToken : + [MBXSKUToken tokenForSKUID:MBXAccountsSKUIDMaps type:MBXAccountsSKUTypeUser] : MGLAccountManager.sharedManager.skuToken; } else { diff --git a/platform/ios/src/MGLMapboxEvents.m b/platform/ios/src/MGLMapboxEvents.m index bb16f77f98..337929c7ec 100644 --- a/platform/ios/src/MGLMapboxEvents.m +++ b/platform/ios/src/MGLMapboxEvents.m @@ -146,7 +146,7 @@ static NSString * const MGLVariableGeofence = @"VariableGeofence"; } if (MGLAccountManager.isAccountsSDKEnabled) { - [[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..8a02d9641c 100644 --- a/platform/ios/vendor/mapbox-accounts-ios/MBXSKUToken.h +++ b/platform/ios/vendor/mapbox-accounts-ios/MBXSKUToken.h @@ -2,13 +2,26 @@ NS_ASSUME_NONNULL_BEGIN -extern NSString *const MBXAccountsMapsSKUIDMaps; -extern NSString *const MBXAccountsNavigationSKUIDMaps; +typedef NSString *MBXAccountsSKUID NS_TYPED_ENUM; +FOUNDATION_EXTERN const MBXAccountsSKUID MBXAccountsSKUIDMaps; +FOUNDATION_EXTERN const MBXAccountsSKUID 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 NS_SWIFT_NAME(token(for:type:)); @end diff --git a/platform/ios/vendor/mapbox-accounts-ios/libmbxaccounts.a b/platform/ios/vendor/mapbox-accounts-ios/libmbxaccounts.a index efe06835ec..b57e17d47f 100644 Binary files a/platform/ios/vendor/mapbox-accounts-ios/libmbxaccounts.a and b/platform/ios/vendor/mapbox-accounts-ios/libmbxaccounts.a differ -- cgit v1.2.1