2015-03-23 20:28:42 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
2015-02-20 04:10:52 +00:00
|
|
|
|
|
|
|
#import "RCTRedBox.h"
|
|
|
|
|
2015-04-11 22:08:00 +00:00
|
|
|
#import "RCTBridge.h"
|
2015-08-04 23:18:44 +00:00
|
|
|
#import "RCTConvert.h"
|
2015-04-30 16:50:22 +00:00
|
|
|
#import "RCTDefines.h"
|
2015-02-20 04:10:52 +00:00
|
|
|
#import "RCTUtils.h"
|
|
|
|
|
2015-04-30 16:50:22 +00:00
|
|
|
#if RCT_DEBUG
|
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
@interface RCTRedBoxWindow : UIWindow <UITableViewDelegate, UITableViewDataSource>
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation RCTRedBoxWindow
|
|
|
|
{
|
|
|
|
UITableView *_stackTraceTableView;
|
2015-08-21 13:48:16 +00:00
|
|
|
NSString *_lastErrorMessage;
|
2015-02-20 04:10:52 +00:00
|
|
|
NSArray *_lastStackTrace;
|
|
|
|
}
|
|
|
|
|
2015-08-24 10:14:33 +00:00
|
|
|
- (instancetype)initWithFrame:(CGRect)frame
|
2015-02-20 04:10:52 +00:00
|
|
|
{
|
|
|
|
if ((self = [super initWithFrame:frame])) {
|
2015-08-07 13:42:34 +00:00
|
|
|
self.windowLevel = UIWindowLevelAlert + 1000;
|
2015-08-19 12:27:43 +00:00
|
|
|
self.backgroundColor = [UIColor colorWithRed:0.8 green:0 blue:0 alpha:1];
|
2015-02-20 04:10:52 +00:00
|
|
|
self.hidden = YES;
|
2015-03-01 23:33:55 +00:00
|
|
|
|
2015-08-17 14:35:34 +00:00
|
|
|
UIViewController *rootController = [UIViewController new];
|
2015-02-20 04:10:52 +00:00
|
|
|
self.rootViewController = rootController;
|
2015-08-21 13:48:16 +00:00
|
|
|
UIView *rootView = rootController.view;
|
|
|
|
rootView.backgroundColor = [UIColor clearColor];
|
2015-03-01 23:33:55 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
const CGFloat buttonHeight = 60;
|
|
|
|
|
2015-08-21 13:48:16 +00:00
|
|
|
CGRect detailsFrame = rootView.bounds;
|
2015-02-20 04:10:52 +00:00
|
|
|
detailsFrame.size.height -= buttonHeight;
|
2015-03-01 23:33:55 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
_stackTraceTableView = [[UITableView alloc] initWithFrame:detailsFrame style:UITableViewStylePlain];
|
2015-08-21 13:48:16 +00:00
|
|
|
_stackTraceTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
2015-02-20 04:10:52 +00:00
|
|
|
_stackTraceTableView.delegate = self;
|
|
|
|
_stackTraceTableView.dataSource = self;
|
|
|
|
_stackTraceTableView.backgroundColor = [UIColor clearColor];
|
2015-08-19 12:27:43 +00:00
|
|
|
_stackTraceTableView.separatorColor = [UIColor colorWithWhite:1 alpha:0.3];
|
2015-02-20 04:10:52 +00:00
|
|
|
_stackTraceTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
2015-08-21 13:48:16 +00:00
|
|
|
_stackTraceTableView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
|
|
|
|
[rootView addSubview:_stackTraceTableView];
|
2015-03-01 23:33:55 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
UIButton *dismissButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
2015-08-21 13:48:16 +00:00
|
|
|
dismissButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin;
|
2015-05-29 12:18:42 +00:00
|
|
|
dismissButton.accessibilityIdentifier = @"redbox-dismiss";
|
2015-02-20 04:10:52 +00:00
|
|
|
dismissButton.titleLabel.font = [UIFont systemFontOfSize:14];
|
|
|
|
[dismissButton setTitle:@"Dismiss (ESC)" forState:UIControlStateNormal];
|
2015-08-19 12:27:43 +00:00
|
|
|
[dismissButton setTitleColor:[UIColor colorWithWhite:1 alpha:0.5] forState:UIControlStateNormal];
|
2015-02-20 04:10:52 +00:00
|
|
|
[dismissButton setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
|
|
|
|
[dismissButton addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside];
|
2015-03-01 23:33:55 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
UIButton *reloadButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
2015-08-21 13:48:16 +00:00
|
|
|
reloadButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin;
|
2015-05-29 12:18:42 +00:00
|
|
|
reloadButton.accessibilityIdentifier = @"redbox-reload";
|
2015-02-20 04:10:52 +00:00
|
|
|
reloadButton.titleLabel.font = [UIFont systemFontOfSize:14];
|
|
|
|
[reloadButton setTitle:@"Reload JS (\u2318R)" forState:UIControlStateNormal];
|
2015-08-19 12:27:43 +00:00
|
|
|
[reloadButton setTitleColor:[UIColor colorWithWhite:1 alpha:0.5] forState:UIControlStateNormal];
|
2015-02-20 04:10:52 +00:00
|
|
|
[reloadButton setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
|
|
|
|
[reloadButton addTarget:self action:@selector(reload) forControlEvents:UIControlEventTouchUpInside];
|
2015-03-01 23:33:55 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
CGFloat buttonWidth = self.bounds.size.width / 2;
|
|
|
|
dismissButton.frame = CGRectMake(0, self.bounds.size.height - buttonHeight, buttonWidth, buttonHeight);
|
|
|
|
reloadButton.frame = CGRectMake(buttonWidth, self.bounds.size.height - buttonHeight, buttonWidth, buttonHeight);
|
2015-08-21 13:48:16 +00:00
|
|
|
[rootView addSubview:dismissButton];
|
|
|
|
[rootView addSubview:reloadButton];
|
2015-05-07 10:53:35 +00:00
|
|
|
|
|
|
|
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
|
|
|
|
|
|
|
|
[notificationCenter addObserver:self
|
|
|
|
selector:@selector(dismiss)
|
|
|
|
name:RCTReloadNotification
|
|
|
|
object:nil];
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2015-08-24 10:14:33 +00:00
|
|
|
RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder)
|
2015-06-15 14:53:45 +00:00
|
|
|
|
2015-05-07 10:53:35 +00:00
|
|
|
- (void)dealloc
|
|
|
|
{
|
2015-08-21 13:48:16 +00:00
|
|
|
_stackTraceTableView.dataSource = nil;
|
|
|
|
_stackTraceTableView.delegate = nil;
|
2015-05-07 10:53:35 +00:00
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
|
|
}
|
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
- (void)openStackFrameInEditor:(NSDictionary *)stackFrame
|
|
|
|
{
|
|
|
|
NSData *stackFrameJSON = [RCTJSONStringify(stackFrame, nil) dataUsingEncoding:NSUTF8StringEncoding];
|
2015-08-21 13:48:16 +00:00
|
|
|
NSString *postLength = [NSString stringWithFormat:@"%tu", stackFrameJSON.length];
|
2015-08-17 14:35:34 +00:00
|
|
|
NSMutableURLRequest *request = [NSMutableURLRequest new];
|
2015-08-04 23:18:44 +00:00
|
|
|
request.URL = [RCTConvert NSURL:@"http://localhost:8081/open-stack-frame"];
|
2015-02-20 04:10:52 +00:00
|
|
|
request.HTTPMethod = @"POST";
|
|
|
|
request.HTTPBody = stackFrameJSON;
|
|
|
|
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
|
|
|
|
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
|
|
|
|
|
2015-05-01 13:21:03 +00:00
|
|
|
[[[NSURLSession sharedSession] dataTaskWithRequest:request] resume];
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack showIfHidden:(BOOL)shouldShow
|
|
|
|
{
|
2015-03-18 23:01:46 +00:00
|
|
|
if ((self.hidden && shouldShow) || (!self.hidden && [_lastErrorMessage isEqualToString:message])) {
|
2015-03-17 02:36:45 +00:00
|
|
|
_lastStackTrace = stack;
|
|
|
|
_lastErrorMessage = message;
|
2015-02-25 00:33:39 +00:00
|
|
|
|
|
|
|
[_stackTraceTableView reloadData];
|
|
|
|
|
2015-03-18 23:01:46 +00:00
|
|
|
if (self.hidden) {
|
|
|
|
[_stackTraceTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]
|
|
|
|
atScrollPosition:UITableViewScrollPositionTop
|
|
|
|
animated:NO];
|
|
|
|
}
|
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
[self makeKeyAndVisible];
|
|
|
|
[self becomeFirstResponder];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)dismiss
|
|
|
|
{
|
|
|
|
self.hidden = YES;
|
2015-03-12 00:02:42 +00:00
|
|
|
[self resignFirstResponder];
|
2015-08-24 10:14:33 +00:00
|
|
|
[[UIApplication sharedApplication].delegate.window makeKeyWindow];
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)reload
|
|
|
|
{
|
2015-04-11 22:08:00 +00:00
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:RCTReloadNotification object:nil userInfo:nil];
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - TableView
|
|
|
|
|
2015-06-15 14:53:45 +00:00
|
|
|
- (NSInteger)numberOfSectionsInTableView:(__unused UITableView *)tableView
|
2015-02-20 04:10:52 +00:00
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2015-06-15 14:53:45 +00:00
|
|
|
- (NSInteger)tableView:(__unused UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
2015-02-20 04:10:52 +00:00
|
|
|
{
|
2015-08-24 10:14:33 +00:00
|
|
|
return section == 0 ? 1 : _lastStackTrace.count;
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
|
{
|
2015-08-24 10:14:33 +00:00
|
|
|
if (indexPath.section == 0) {
|
2015-02-20 04:10:52 +00:00
|
|
|
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"msg-cell"];
|
|
|
|
return [self reuseCell:cell forErrorMessage:_lastErrorMessage];
|
|
|
|
}
|
|
|
|
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
|
2015-08-24 10:14:33 +00:00
|
|
|
NSUInteger index = indexPath.row;
|
2015-02-20 04:10:52 +00:00
|
|
|
NSDictionary *stackFrame = _lastStackTrace[index];
|
|
|
|
return [self reuseCell:cell forStackFrame:stackFrame];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UITableViewCell *)reuseCell:(UITableViewCell *)cell forErrorMessage:(NSString *)message
|
|
|
|
{
|
|
|
|
if (!cell) {
|
|
|
|
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"msg-cell"];
|
2015-05-29 12:18:42 +00:00
|
|
|
cell.textLabel.accessibilityIdentifier = @"redbox-error";
|
2015-02-20 04:10:52 +00:00
|
|
|
cell.textLabel.textColor = [UIColor whiteColor];
|
|
|
|
cell.textLabel.font = [UIFont boldSystemFontOfSize:16];
|
|
|
|
cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
|
|
|
|
cell.textLabel.numberOfLines = 0;
|
|
|
|
cell.detailTextLabel.textColor = [UIColor whiteColor];
|
|
|
|
cell.backgroundColor = [UIColor clearColor];
|
|
|
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
|
|
}
|
2015-03-01 23:33:55 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
cell.textLabel.text = message;
|
2015-03-01 23:33:55 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
return cell;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UITableViewCell *)reuseCell:(UITableViewCell *)cell forStackFrame:(NSDictionary *)stackFrame
|
|
|
|
{
|
|
|
|
if (!cell) {
|
|
|
|
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
|
2015-08-19 12:27:43 +00:00
|
|
|
cell.textLabel.textColor = [UIColor colorWithWhite:1 alpha:0.9];
|
2015-02-20 04:10:52 +00:00
|
|
|
cell.textLabel.font = [UIFont fontWithName:@"Menlo-Regular" size:14];
|
2015-04-08 04:50:24 +00:00
|
|
|
cell.textLabel.numberOfLines = 2;
|
2015-08-19 12:27:43 +00:00
|
|
|
cell.detailTextLabel.textColor = [UIColor colorWithWhite:1 alpha:0.7];
|
2015-02-20 04:10:52 +00:00
|
|
|
cell.detailTextLabel.font = [UIFont fontWithName:@"Menlo-Regular" size:11];
|
|
|
|
cell.detailTextLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
|
|
|
|
cell.backgroundColor = [UIColor clearColor];
|
2015-08-17 14:35:34 +00:00
|
|
|
cell.selectedBackgroundView = [UIView new];
|
2015-08-19 12:27:43 +00:00
|
|
|
cell.selectedBackgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.2];
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
2015-03-01 23:33:55 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
cell.textLabel.text = stackFrame[@"methodName"];
|
2015-08-10 14:03:52 +00:00
|
|
|
|
2015-08-19 23:31:21 +00:00
|
|
|
NSString *fileAndLine = [stackFrame[@"file"] lastPathComponent];
|
2015-08-21 13:48:16 +00:00
|
|
|
cell.detailTextLabel.text = fileAndLine ? [fileAndLine stringByAppendingFormat:@":%@", stackFrame[@"lineNumber"]] : nil;
|
2015-02-20 04:10:52 +00:00
|
|
|
return cell;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
|
{
|
2015-08-24 10:14:33 +00:00
|
|
|
if (indexPath.section == 0) {
|
2015-02-20 04:10:52 +00:00
|
|
|
NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
|
|
|
|
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
|
2015-03-01 23:33:55 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
NSDictionary *attributes = @{NSFontAttributeName: [UIFont boldSystemFontOfSize:16],
|
|
|
|
NSParagraphStyleAttributeName: paragraphStyle};
|
|
|
|
CGRect boundingRect = [_lastErrorMessage boundingRectWithSize:CGSizeMake(tableView.frame.size.width - 30, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil];
|
|
|
|
return ceil(boundingRect.size.height) + 40;
|
|
|
|
} else {
|
2015-04-08 04:50:24 +00:00
|
|
|
return 50;
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
|
{
|
2015-08-24 10:14:33 +00:00
|
|
|
if (indexPath.section == 1) {
|
|
|
|
NSUInteger row = indexPath.row;
|
2015-02-20 04:10:52 +00:00
|
|
|
NSDictionary *stackFrame = _lastStackTrace[row];
|
|
|
|
[self openStackFrameInEditor:stackFrame];
|
|
|
|
}
|
|
|
|
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - Key commands
|
|
|
|
|
|
|
|
- (NSArray *)keyCommands
|
|
|
|
{
|
|
|
|
// NOTE: We could use RCTKeyCommands for this, but since
|
|
|
|
// we control this window, we can use the standard, non-hacky
|
|
|
|
// mechanism instead
|
2015-03-01 23:33:55 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
return @[
|
2015-03-01 23:33:55 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
// Dismiss red box
|
|
|
|
[UIKeyCommand keyCommandWithInput:UIKeyInputEscape
|
|
|
|
modifierFlags:0
|
|
|
|
action:@selector(dismiss)],
|
2015-03-01 23:33:55 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
// Reload
|
|
|
|
[UIKeyCommand keyCommandWithInput:@"r"
|
|
|
|
modifierFlags:UIKeyModifierCommand
|
|
|
|
action:@selector(reload)]
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)canBecomeFirstResponder
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation RCTRedBox
|
|
|
|
{
|
|
|
|
RCTRedBoxWindow *_window;
|
|
|
|
}
|
|
|
|
|
2015-08-19 12:27:43 +00:00
|
|
|
RCT_EXPORT_MODULE()
|
2015-06-09 21:51:25 +00:00
|
|
|
|
2015-07-14 23:11:42 +00:00
|
|
|
- (void)showError:(NSError *)error
|
|
|
|
{
|
|
|
|
[self showErrorMessage:error.localizedDescription withDetails:error.localizedFailureReason];
|
|
|
|
}
|
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
- (void)showErrorMessage:(NSString *)message
|
|
|
|
{
|
|
|
|
[self showErrorMessage:message withStack:nil showIfHidden:YES];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)showErrorMessage:(NSString *)message withDetails:(NSString *)details
|
|
|
|
{
|
|
|
|
NSString *combinedMessage = message;
|
|
|
|
if (details) {
|
|
|
|
combinedMessage = [NSString stringWithFormat:@"%@\n\n%@", message, details];
|
|
|
|
}
|
|
|
|
[self showErrorMessage:combinedMessage];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack
|
|
|
|
{
|
|
|
|
[self showErrorMessage:message withStack:stack showIfHidden:YES];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)updateErrorMessage:(NSString *)message withStack:(NSArray *)stack
|
|
|
|
{
|
|
|
|
[self showErrorMessage:message withStack:stack showIfHidden:NO];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack showIfHidden:(BOOL)shouldShow
|
|
|
|
{
|
2015-04-21 16:48:29 +00:00
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
if (!_window) {
|
2015-08-19 12:27:43 +00:00
|
|
|
_window = [[RCTRedBoxWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
2015-04-21 16:48:29 +00:00
|
|
|
}
|
|
|
|
[_window showErrorMessage:message withStack:stack showIfHidden:shouldShow];
|
|
|
|
});
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
2015-08-19 12:27:43 +00:00
|
|
|
- (void)dismiss
|
2015-03-14 01:32:38 +00:00
|
|
|
{
|
2015-08-19 12:27:43 +00:00
|
|
|
[_window dismiss];
|
2015-03-14 01:32:38 +00:00
|
|
|
}
|
|
|
|
|
2015-08-19 12:27:43 +00:00
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation RCTBridge (RCTRedBox)
|
|
|
|
|
|
|
|
- (RCTRedBox *)redBox
|
2015-02-20 04:10:52 +00:00
|
|
|
{
|
2015-08-19 12:27:43 +00:00
|
|
|
return self.modules[RCTBridgeModuleNameForClass([RCTRedBox class])];
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
2015-04-21 16:48:29 +00:00
|
|
|
|
2015-04-30 16:50:22 +00:00
|
|
|
#else // Disabled
|
|
|
|
|
|
|
|
@implementation RCTRedBox
|
|
|
|
|
2015-08-25 11:27:09 +00:00
|
|
|
+ (NSString *)moduleName { return nil; }
|
2015-07-14 23:11:42 +00:00
|
|
|
- (void)showError:(NSError *)message {}
|
2015-04-30 16:50:22 +00:00
|
|
|
- (void)showErrorMessage:(NSString *)message {}
|
|
|
|
- (void)showErrorMessage:(NSString *)message withDetails:(NSString *)details {}
|
|
|
|
- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack {}
|
|
|
|
- (void)updateErrorMessage:(NSString *)message withStack:(NSArray *)stack {}
|
|
|
|
- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack showIfHidden:(BOOL)shouldShow {}
|
|
|
|
- (void)dismiss {}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2015-08-19 12:27:43 +00:00
|
|
|
@implementation RCTBridge (RCTRedBox)
|
|
|
|
|
|
|
|
- (RCTRedBox *)redBox { return nil; }
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2015-04-21 16:48:29 +00:00
|
|
|
#endif
|