From a9a0ff267f1a2c063013681bfbeb5d6ef30760a8 Mon Sep 17 00:00:00 2001 From: Nathan Azaria Date: Mon, 4 Jul 2016 10:45:38 -0700 Subject: [PATCH] Move setDefaults call to constructor. Reviewed By: javache Differential Revision: D3514703 fbshipit-source-id: 8195778b23868eae36a55edc2d5d4f148b36a12e --- React/Base/RCTBundleURLProvider.m | 24 +++++++++++-------- .../generator-ios/templates/app/AppDelegate.m | 1 - 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/React/Base/RCTBundleURLProvider.m b/React/Base/RCTBundleURLProvider.m index 7fe1741f1c..105f6a1497 100644 --- a/React/Base/RCTBundleURLProvider.m +++ b/React/Base/RCTBundleURLProvider.m @@ -32,18 +32,22 @@ static NSString *ipGuess; } #endif +- (instancetype)init +{ + self = [super init]; + if (self) { + [self setDefaults]; + } + return self; +} + - (NSDictionary *)defaults { - static NSDictionary *defaults; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - defaults = @{ - kRCTEnableLiveReloadKey: @NO, - kRCTEnableDevKey: @YES, - kRCTEnableMinificationKey: @NO, - }; - }); - return defaults; + return @{ + kRCTEnableLiveReloadKey: @NO, + kRCTEnableDevKey: @YES, + kRCTEnableMinificationKey: @NO, + }; } - (void)settingsUpdated diff --git a/local-cli/generator-ios/templates/app/AppDelegate.m b/local-cli/generator-ios/templates/app/AppDelegate.m index fac3b4fcdd..edaccd8aaf 100644 --- a/local-cli/generator-ios/templates/app/AppDelegate.m +++ b/local-cli/generator-ios/templates/app/AppDelegate.m @@ -18,7 +18,6 @@ { NSURL *jsCodeLocation; - [[RCTBundleURLProvider sharedSettings] setDefaults]; jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation