feat:add debug option:start debugging
This commit is contained in:
@@ -61,6 +61,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)stopDebugging:(BOOL)resume;
|
||||
|
||||
- (void)requestDebugging:(DoricContext *)context;
|
||||
|
||||
- (BOOL)isReloadingContext:(DoricContext *)context;
|
||||
|
||||
- (void)reload:(NSString *)source script:(NSString *)script;
|
||||
|
@@ -227,6 +227,12 @@ - (void)stopDebugging:(BOOL)resume {
|
||||
});
|
||||
}
|
||||
|
||||
- (void)requestDebugging:(DoricContext *)context {
|
||||
[self.wsClient sendToServer:@"DEBUG" payload:@{
|
||||
@"source": context.source
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)sendDevCommand:(NSString *)command payload:(NSDictionary *)payload {
|
||||
[self.wsClient sendToServer:command payload:payload];
|
||||
}
|
||||
|
@@ -105,11 +105,18 @@ - (void)onClick {
|
||||
}];
|
||||
[alertController addAction:cancel];
|
||||
[alertController addAction:viewSource];
|
||||
if ([self.doricContext.driver isKindOfClass:DoricDebugDriver.class]) {
|
||||
UIAlertAction *stopDebugging = [UIAlertAction actionWithTitle:@"Stop debugging" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_) {
|
||||
[DoricDev.instance stopDebugging:YES];
|
||||
}];
|
||||
[alertController addAction:stopDebugging];
|
||||
if (DoricDev.instance.isInDevMode) {
|
||||
if ([self.doricContext.driver isKindOfClass:DoricDebugDriver.class]) {
|
||||
UIAlertAction *stopDebugging = [UIAlertAction actionWithTitle:@"Stop debugging" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_) {
|
||||
[DoricDev.instance stopDebugging:YES];
|
||||
}];
|
||||
[alertController addAction:stopDebugging];
|
||||
} else {
|
||||
UIAlertAction *startDebugging = [UIAlertAction actionWithTitle:@"Start debugging" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_) {
|
||||
[DoricDev.instance requestDebugging:self.doricContext];
|
||||
}];
|
||||
[alertController addAction:startDebugging];
|
||||
}
|
||||
}
|
||||
|
||||
[self.vc presentViewController:alertController animated:true completion:nil];
|
||||
|
Reference in New Issue
Block a user