iOS:success to debug js
This commit is contained in:
parent
103a87df0b
commit
1d6a2d8828
@ -48,7 +48,7 @@ - (void)onLog:(DoricLogType)type message:(NSString *)message {
|
|||||||
typeString = @"ERROR";
|
typeString = @"ERROR";
|
||||||
}
|
}
|
||||||
|
|
||||||
[DoricDev.instance.wsClient sendToServer:@"EXCEPTION"
|
[DoricDev.instance.wsClient sendToServer:@"LOG"
|
||||||
payload:@{
|
payload:@{
|
||||||
@"type": typeString,
|
@"type": typeString,
|
||||||
@"message": message
|
@"message": message
|
||||||
|
@ -78,7 +78,7 @@ - (void)injectGlobalJSObject:(NSString *)name obj:(id)obj {
|
|||||||
[self.wsClient sendToDebugger:@"injectGlobalJSObject" payload:@{
|
[self.wsClient sendToDebugger:@"injectGlobalJSObject" payload:@{
|
||||||
@"name": name,
|
@"name": name,
|
||||||
@"type": @(DoricJSRemoteArgTypeNumber),
|
@"type": @(DoricJSRemoteArgTypeNumber),
|
||||||
@"value": obj,
|
@"value": [NSString stringWithFormat:@"%@", obj],
|
||||||
}];
|
}];
|
||||||
} else if ([obj isKindOfClass:NSString.class]) {
|
} else if ([obj isKindOfClass:NSString.class]) {
|
||||||
[self.wsClient sendToDebugger:@"injectGlobalJSObject" payload:@{
|
[self.wsClient sendToDebugger:@"injectGlobalJSObject" payload:@{
|
||||||
@ -90,13 +90,13 @@ - (void)injectGlobalJSObject:(NSString *)name obj:(id)obj {
|
|||||||
[self.wsClient sendToDebugger:@"injectGlobalJSObject" payload:@{
|
[self.wsClient sendToDebugger:@"injectGlobalJSObject" payload:@{
|
||||||
@"name": name,
|
@"name": name,
|
||||||
@"type": @(DoricJSRemoteArgTypeObject),
|
@"type": @(DoricJSRemoteArgTypeObject),
|
||||||
@"value": obj,
|
@"value": [NSString dc_convertToJsonWithDic:obj],
|
||||||
}];
|
}];
|
||||||
} else if ([obj isKindOfClass:NSArray.class]) {
|
} else if ([obj isKindOfClass:NSArray.class]) {
|
||||||
[self.wsClient sendToDebugger:@"injectGlobalJSObject" payload:@{
|
[self.wsClient sendToDebugger:@"injectGlobalJSObject" payload:@{
|
||||||
@"name": name,
|
@"name": name,
|
||||||
@"type": @(DoricJSRemoteArgTypeArray),
|
@"type": @(DoricJSRemoteArgTypeArray),
|
||||||
@"value": obj,
|
@"value": [NSString dc_convertToJsonWithDic:obj],
|
||||||
}];
|
}];
|
||||||
} else if (obj == nil) {
|
} else if (obj == nil) {
|
||||||
[self.wsClient sendToDebugger:@"injectGlobalJSObject" payload:@{
|
[self.wsClient sendToDebugger:@"injectGlobalJSObject" payload:@{
|
||||||
@ -160,22 +160,20 @@ - (BOOL)interceptType:(NSString *)type command:(NSString *)cmd payload:(NSDictio
|
|||||||
NSString *name = payload[@"name"];
|
NSString *name = payload[@"name"];
|
||||||
NSArray *argsArr = payload[@"arguments"];
|
NSArray *argsArr = payload[@"arguments"];
|
||||||
id tmpBlk = self.blockMDic[name];
|
id tmpBlk = self.blockMDic[name];
|
||||||
id result;
|
|
||||||
if (argsArr.count == 0) {
|
if (argsArr.count == 0) {
|
||||||
result = ((Block0) tmpBlk)();
|
((Block0) tmpBlk)();
|
||||||
} else if (argsArr.count == 1) {
|
} else if (argsArr.count == 1) {
|
||||||
result = ((Block1) tmpBlk)(argsArr[0]);
|
((Block1) tmpBlk)(argsArr[0]);
|
||||||
} else if (argsArr.count == 2) {
|
} else if (argsArr.count == 2) {
|
||||||
result = ((Block2) tmpBlk)(argsArr[0], argsArr[1]);
|
((Block2) tmpBlk)(argsArr[0], argsArr[1]);
|
||||||
} else if (argsArr.count == 3) {
|
} else if (argsArr.count == 3) {
|
||||||
result = ((Block3) tmpBlk)(argsArr[0], argsArr[1], argsArr[2]);
|
((Block3) tmpBlk)(argsArr[0], argsArr[1], argsArr[2]);
|
||||||
} else if (argsArr.count == 4) {
|
} else if (argsArr.count == 4) {
|
||||||
result = ((Block4) tmpBlk)(argsArr[0], argsArr[1], argsArr[2], argsArr[3]);
|
((Block4) tmpBlk)(argsArr[0], argsArr[1], argsArr[2], argsArr[3]);
|
||||||
} else if (argsArr.count == 5) {
|
} else if (argsArr.count == 5) {
|
||||||
result = ((Block5) tmpBlk)(argsArr[0], argsArr[1], argsArr[2], argsArr[3], argsArr[4]);
|
((Block5) tmpBlk)(argsArr[0], argsArr[1], argsArr[2], argsArr[3], argsArr[4]);
|
||||||
} else {
|
} else {
|
||||||
DoricLog(@"error:args to more than 5. args:%@", argsArr);
|
DoricLog(@"error:args to more than 5. args:%@", argsArr);
|
||||||
result = nil;
|
|
||||||
}
|
}
|
||||||
} else if ([cmd isEqualToString:@"invokeMethod"]) {
|
} else if ([cmd isEqualToString:@"invokeMethod"]) {
|
||||||
@try {
|
@try {
|
||||||
|
@ -62,7 +62,7 @@ - (instancetype)init {
|
|||||||
if (TARGET_OS_SIMULATOR == 1) {
|
if (TARGET_OS_SIMULATOR == 1) {
|
||||||
platform = [NSProcessInfo new].environment[@"SIMULATOR_MODEL_IDENTIFIER"];
|
platform = [NSProcessInfo new].environment[@"SIMULATOR_MODEL_IDENTIFIER"];
|
||||||
}
|
}
|
||||||
|
|
||||||
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||||
CGFloat screenWidth;
|
CGFloat screenWidth;
|
||||||
CGFloat screenHeight;
|
CGFloat screenHeight;
|
||||||
@ -73,7 +73,7 @@ - (instancetype)init {
|
|||||||
screenWidth = [[UIScreen mainScreen] bounds].size.height;
|
screenWidth = [[UIScreen mainScreen] bounds].size.height;
|
||||||
screenHeight = [[UIScreen mainScreen] bounds].size.width;
|
screenHeight = [[UIScreen mainScreen] bounds].size.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
_innerEnvironmentDictionary = @{
|
_innerEnvironmentDictionary = @{
|
||||||
@"platform": @"iOS",
|
@"platform": @"iOS",
|
||||||
@"platformVersion": [[UIDevice currentDevice] systemVersion],
|
@"platformVersion": [[UIDevice currentDevice] systemVersion],
|
||||||
|
Reference in New Issue
Block a user