feat:iOS simulator support devkit

This commit is contained in:
pengfei.zhou 2019-11-28 14:43:53 +08:00
parent 96649e1248
commit f0de868a34

View File

@ -53,9 +53,19 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
return cell; return cell;
} }
- (BOOL)isSimulator {
return TARGET_OS_SIMULATOR == 1;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row == 0) { if (indexPath.row == 0) {
if (self.isSimulator) {
NSString *result = @"127.0.0.1";
[[DoricDriver instance] connectDevKit:[NSString stringWithFormat:@"ws://%@:7777", result]];
ShowToast([NSString stringWithFormat:@"Connected to %@", result], BOTTOM);
} else {
[self.navigationController pushViewController:[QRScanViewController new] animated:NO]; [self.navigationController pushViewController:[QRScanViewController new] animated:NO];
}
return; return;
} }
NSString *file = self.demoFilePaths[(NSUInteger) indexPath.row]; NSString *file = self.demoFilePaths[(NSUInteger) indexPath.row];