summaryrefslogtreecommitdiff
path: root/platform/ios/benchmark
diff options
context:
space:
mode:
authorNadia Barbosa <nadiabarbosa@me.com>2019-04-29 17:19:38 -0700
committerNadia Barbosa <captainbarbosa@users.noreply.github.com>2019-05-01 18:30:46 -0700
commit3e4afbc788424ef4d89d48f4d29204d1593f769d (patch)
treeeec17784d7f5fcad6bc83fc8ffc4ce871a81f0cc /platform/ios/benchmark
parent8b91a4a037ab84cafd40b62da0224e3baf100168 (diff)
downloadqtlocation-mapboxgl-3e4afbc788424ef4d89d48f4d29204d1593f769d.tar.gz
[iosapp] Move token setting to build script
[ios] Switch to script-based token insertion for benchmarking app [ios] Update Developing.md [iosapp, benchmark app] Look for token file outside of version-controlled directory [iosapp, benchmark app] Remove remaining code for access token checking from app delegates Feedback edits for @friedbunny
Diffstat (limited to 'platform/ios/benchmark')
-rw-r--r--platform/ios/benchmark/MBXBenchAppDelegate.h2
-rw-r--r--platform/ios/benchmark/MBXBenchAppDelegate.m15
-rw-r--r--platform/ios/benchmark/MBXBenchViewController.mm28
3 files changed, 1 insertions, 44 deletions
diff --git a/platform/ios/benchmark/MBXBenchAppDelegate.h b/platform/ios/benchmark/MBXBenchAppDelegate.h
index 6ae9cdf27c..2368ca6daf 100644
--- a/platform/ios/benchmark/MBXBenchAppDelegate.h
+++ b/platform/ios/benchmark/MBXBenchAppDelegate.h
@@ -1,7 +1,5 @@
#import <UIKit/UIKit.h>
-extern NSString * const MBXMapboxAccessTokenDefaultsKey;
-
@interface MBXBenchAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
diff --git a/platform/ios/benchmark/MBXBenchAppDelegate.m b/platform/ios/benchmark/MBXBenchAppDelegate.m
index 684c90d336..522ebb2dbc 100644
--- a/platform/ios/benchmark/MBXBenchAppDelegate.m
+++ b/platform/ios/benchmark/MBXBenchAppDelegate.m
@@ -2,25 +2,10 @@
#import "MBXBenchViewController.h"
#import <Mapbox/Mapbox.h>
-NSString * const MBXMapboxAccessTokenDefaultsKey = @"MBXMapboxAccessToken";
-
@implementation MBXBenchAppDelegate
- (BOOL)application:(UIApplication*)application
didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
- if (![MGLAccountManager accessToken]) {
- NSString *accessToken = [[NSProcessInfo processInfo] environment][@"MAPBOX_ACCESS_TOKEN"];
- if (accessToken) {
- // Store to preferences so that we can launch the app later on without having to specify
- // token.
- [[NSUserDefaults standardUserDefaults] setObject:accessToken forKey:MBXMapboxAccessTokenDefaultsKey];
- } else {
- // Try to retrieve from preferences, maybe we've stored them there previously and can reuse
- // the token.
- accessToken = [[NSUserDefaults standardUserDefaults] objectForKey:MBXMapboxAccessTokenDefaultsKey];
- }
- [MGLAccountManager setAccessToken:accessToken];
- }
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = [MBXBenchViewController new];
diff --git a/platform/ios/benchmark/MBXBenchViewController.mm b/platform/ios/benchmark/MBXBenchViewController.mm
index 84c2790d50..21e9ce2d98 100644
--- a/platform/ios/benchmark/MBXBenchViewController.mm
+++ b/platform/ios/benchmark/MBXBenchViewController.mm
@@ -53,33 +53,7 @@
{
[super viewDidAppear:animated];
- if ([MGLAccountManager accessToken].length) {
- [self startBenchmarkIteration];
- } else {
- UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Access Token" message:@"Enter your Mapbox access token to load Mapbox-hosted tiles and styles:" preferredStyle:UIAlertControllerStyleAlert];
- [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
- textField.keyboardType = UIKeyboardTypeURL;
- textField.autocorrectionType = UITextAutocorrectionTypeNo;
- textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
- }];
-
- [alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
- [self startBenchmarkIteration];
- }]];
- UIAlertAction *OKAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- UITextField *textField = alertController.textFields.firstObject;
- NSString *accessToken = textField.text;
- [[NSUserDefaults standardUserDefaults] setObject:accessToken forKey:MBXMapboxAccessTokenDefaultsKey];
- [MGLAccountManager setAccessToken:accessToken];
- [self.mapView reloadStyle:self];
-
- [self startBenchmarkIteration];
- }];
- [alertController addAction:OKAction];
- alertController.preferredAction = OKAction;
-
- [self presentViewController:alertController animated:YES completion:nil];
- }
+ [self startBenchmarkIteration];
}
size_t idx = 0;