mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-17 09:06:26 +00:00
Use a default to override Chrome debugging setting
This is done in a way that does not override the persistent user defaults. You set this default when launching the app by supplying `-RealmReactEnableChromeDebugging YES/NO` launch arguments.
This commit is contained in:
parent
56ad4faa19
commit
6a8fa75a37
@ -19,8 +19,30 @@
|
||||
#import "AppDelegate.h"
|
||||
#import "RCTRootView.h"
|
||||
|
||||
static NSString * const RealmReactEnableChromeDebuggingKey = @"RealmReactEnableChromeDebugging";
|
||||
static NSString * const RCTDevMenuKey = @"RCTDevMenu";
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
// Check if this default is explicitly set, otherwise just leave the settings as is.
|
||||
if ([defaults objectForKey:RealmReactEnableChromeDebuggingKey]) {
|
||||
NSMutableDictionary *settings = [([defaults dictionaryForKey:RCTDevMenuKey] ?: @{}) mutableCopy];
|
||||
NSMutableDictionary *domain = [[defaults volatileDomainForName:NSArgumentDomain] mutableCopy];
|
||||
|
||||
settings[@"executorClass"] = [defaults boolForKey:RealmReactEnableChromeDebuggingKey] ? @"RCTWebSocketExecutor" : @"RCTContextExecutor";
|
||||
domain[RCTDevMenuKey] = settings;
|
||||
|
||||
// Re-register the arguments domain (highest precedent and volatile) with our new overridden settings.
|
||||
[defaults removeVolatileDomainForName:NSArgumentDomain];
|
||||
[defaults setVolatileDomain:domain forName:NSArgumentDomain];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
NSURL *jsCodeLocation;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user