diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2015-05-19 14:31:30 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2015-05-19 14:31:30 -0700 |
commit | 52670f05601e35804e79f1ee197f2042a9c94a43 (patch) | |
tree | d2ae3acecc11d9907512fbdd5f13236338f1dcea | |
parent | 90b70180c53c2945c10b9520f9e6aa5f4f697ac0 (diff) | |
download | qtlocation-mapboxgl-52670f05601e35804e79f1ee197f2042a9c94a43.tar.gz |
Cache account type user default
-rw-r--r-- | platform/darwin/http_request_nsurl.mm | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/platform/darwin/http_request_nsurl.mm b/platform/darwin/http_request_nsurl.mm index bdae9ce517..ef88469b46 100644 --- a/platform/darwin/http_request_nsurl.mm +++ b/platform/darwin/http_request_nsurl.mm @@ -91,6 +91,7 @@ public: NSURLSession *session = nil; NSString *userAgent = nil; + NSInteger accountType = 0; }; HTTPNSURLContext::HTTPNSURLContext(uv_loop_t *loop_) : HTTPContext(loop_) { @@ -107,6 +108,8 @@ HTTPNSURLContext::HTTPNSURLContext(uv_loop_t *loop_) : HTTPContext(loop_) { // Write user agent string userAgent = @"MapboxGL"; + + accountType = [[NSUserDefaults standardUserDefaults] integerForKey:@"MGLMapboxAccountType"]; } } @@ -155,7 +158,7 @@ void HTTPRequest::start() { NSURL *url = [NSURL URLWithString:@(resource.url.c_str())]; if ([url.host isEqualToString:@"mapbox.com"] || [url.host hasSuffix:@".mapbox.com"]) { - if ([[NSUserDefaults standardUserDefaults] integerForKey:@"MGLMapboxAccountType"] == 0) { + if (context->accountType == 0) { NSString *absoluteString = [url.absoluteString stringByAppendingFormat: (url.query ? @"&%@" : @"?%@"), @"events=true"]; url = [NSURL URLWithString:absoluteString]; |