diff options
Diffstat (limited to 'platform/ios')
-rw-r--r-- | platform/ios/MGLAccountManager.m | 8 | ||||
-rw-r--r-- | platform/ios/MGLMapboxEvents.m | 5 |
2 files changed, 8 insertions, 5 deletions
diff --git a/platform/ios/MGLAccountManager.m b/platform/ios/MGLAccountManager.m index 2f246b7d91..03a90c31b9 100644 --- a/platform/ios/MGLAccountManager.m +++ b/platform/ios/MGLAccountManager.m @@ -15,13 +15,15 @@ @implementation MGLAccountManager + (void)load { - // Read initial configuration from Info.plist. - NSBundle *bundle = [NSBundle bundleForClass:self]; - self.accessToken = [bundle objectForInfoDictionaryKey:@"MGLMapboxAccessToken"]; + // Read the initial configuration from Info.plist. The shown-in-app setting + // preempts the Settings bundle check in -[MGLMapboxEvents init] triggered + // by setting the access token. + NSBundle *bundle = [NSBundle mainBundle]; NSNumber *shownInAppNumber = [bundle objectForInfoDictionaryKey:@"MGLMapboxMetricsEnabledSettingShownInApp"]; if (shownInAppNumber) { [MGLAccountManager sharedManager].mapboxMetricsEnabledSettingShownInApp = [shownInAppNumber boolValue]; } + self.accessToken = [bundle objectForInfoDictionaryKey:@"MGLMapboxAccessToken"]; } // Can be called from any thread. diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m index a0e771ad07..1079899ced 100644 --- a/platform/ios/MGLMapboxEvents.m +++ b/platform/ios/MGLMapboxEvents.m @@ -177,7 +177,7 @@ const NSTimeInterval MGLFlushInterval = 60; + (void)initialize { if (self == [MGLMapboxEvents class]) { - NSBundle *bundle = [NSBundle bundleForClass:self]; + NSBundle *bundle = [NSBundle mainBundle]; NSNumber *accountTypeNumber = [bundle objectForInfoDictionaryKey:@"MGLMapboxAccountType"]; [[NSUserDefaults standardUserDefaults] registerDefaults:@{ @"MGLMapboxAccountType": accountTypeNumber ? accountTypeNumber : @0, @@ -198,7 +198,8 @@ const NSTimeInterval MGLFlushInterval = 60; self = [super init]; if (self) { - if (! [MGLAccountManager mapboxMetricsEnabledSettingShownInApp]) { + if (! [MGLAccountManager mapboxMetricsEnabledSettingShownInApp] && + [[NSUserDefaults standardUserDefaults] integerForKey:@"MGLMapboxAccountType"] == 0) { // Opt Out is not configured in UI, so check for Settings.bundle // Put Settings bundle into memory id defaultEnabledValue; |