Fixed chrome debug persistence + crash

Reviewed By: @tadeuzagallo

Differential Revision: D2443181
This commit is contained in:
Nick Lockwood 2015-09-15 11:11:28 -07:00 committed by facebook-github-bot-4
parent 07e6039b70
commit b450e36ef8
2 changed files with 13 additions and 19 deletions

View File

@ -176,11 +176,6 @@ RCT_EXPORT_MODULE()
name:RCTJavaScriptDidLoadNotification
object:nil];
[notificationCenter addObserver:self
selector:@selector(jsLoaded:)
name:RCTJavaScriptDidFailToLoadNotification
object:nil];
_defaults = [NSUserDefaults standardUserDefaults];
_settings = [[NSMutableDictionary alloc] initWithDictionary:[_defaults objectForKey:RCTDevMenuSettingsKey]];
_extraMenuItems = [NSMutableArray new];
@ -271,6 +266,8 @@ RCT_EXPORT_MODULE()
*/
- (void)updateSettings:(NSDictionary *)settings
{
[_settings setDictionary:settings];
// Fire handlers for items whose values have changed
for (RCTDevMenuItem *item in _extraMenuItems) {
if (item.key) {
@ -282,11 +279,6 @@ RCT_EXPORT_MODULE()
}
}
if ([settings isEqualToDictionary:_settings]) {
return;
}
[_settings setDictionary:settings];
self.shakeToShow = [_settings[@"shakeToShow"] ?: @YES boolValue];
self.profilingEnabled = [_settings[@"profilingEnabled"] ?: @NO boolValue];
self.liveReloadEnabled = [_settings[@"liveReloadEnabled"] ?: @NO boolValue];

View File

@ -17,7 +17,6 @@
#if RCT_DEBUG
@interface RCTRedBoxWindow : UIWindow <UITableViewDelegate, UITableViewDataSource>
@end
@implementation RCTRedBoxWindow
@ -77,13 +76,6 @@
reloadButton.frame = CGRectMake(buttonWidth, self.bounds.size.height - buttonHeight, buttonWidth, buttonHeight);
[rootView addSubview:dismissButton];
[rootView addSubview:reloadButton];
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self
selector:@selector(dismiss)
name:RCTReloadNotification
object:nil];
}
return self;
}
@ -261,6 +253,9 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
@end
@interface RCTRedBox () <RCTInvalidating>
@end
@implementation RCTRedBox
{
RCTRedBoxWindow *_window;
@ -309,7 +304,14 @@ RCT_EXPORT_MODULE()
- (void)dismiss
{
[_window dismiss];
dispatch_async(dispatch_get_main_queue(), ^{
[_window dismiss];
});
}
- (void)invalidate
{
[self dismiss];
}
@end