summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2019-05-13 16:48:19 -0700
committerJason Wray <jason@mapbox.com>2019-05-13 16:48:19 -0700
commitae42028d65a50e48c460482a51f222fb9e6940f0 (patch)
tree775892594dba10e0295a2343f38bfd795b105d62
parent6e2889db8ecb39c6a4358598e20757dfe00c40fb (diff)
downloadqtlocation-mapboxgl-upstream/friedbunny-skus-again-again.tar.gz
-rw-r--r--platform/darwin/src/MGLAccountManager.m8
-rw-r--r--platform/ios/src/MGLMapboxEvents.m2
-rw-r--r--platform/ios/vendor/mapbox-accounts-ios/MBXSKUToken.h22
-rw-r--r--platform/ios/vendor/mapbox-accounts-ios/libmbxaccounts.abin68592 -> 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
index efe06835ec..fe50dea105 100644
--- a/platform/ios/vendor/mapbox-accounts-ios/libmbxaccounts.a
+++ b/platform/ios/vendor/mapbox-accounts-ios/libmbxaccounts.a
Binary files differ