iOS: support devkit change port
This commit is contained in:
parent
e638c29ac3
commit
2e7fe08764
@ -322,8 +322,14 @@ - (void)input {
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
__strong typeof(_alert) alert = _alert;
|
||||
NSString *ip = alert.textFields.lastObject.text;
|
||||
[[DoricDev instance] connectDevKit:[NSString stringWithFormat:@"ws://%@:7777", ip]];
|
||||
NSString *url = alert.textFields.lastObject.text;
|
||||
if (![url containsString:@":"]) {
|
||||
url = [NSString stringWithFormat:@"%@:7777", url];
|
||||
}
|
||||
if (![url containsString:@"://"]) {
|
||||
url = [NSString stringWithFormat:@"ws://%@", url];
|
||||
}
|
||||
[[DoricDev instance] connectDevKit:url];
|
||||
}];
|
||||
[alert addAction:okAction];
|
||||
|
||||
|
@ -101,10 +101,16 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:
|
||||
[self.session stopRunning];
|
||||
if ([metadataObjects count] >= 1) {
|
||||
AVMetadataMachineReadableCodeObject *qrObject = [metadataObjects lastObject];
|
||||
NSString *result = qrObject.stringValue;
|
||||
NSLog(@"Scan result is %@", result);
|
||||
[[DoricDev instance] connectDevKit:[NSString stringWithFormat:@"ws://%@:7777", result]];
|
||||
ShowToast([NSString stringWithFormat:@"Connected to %@", result], DoricGravityBottom);
|
||||
NSString *url = qrObject.stringValue;
|
||||
NSLog(@"Scan result is %@", url);
|
||||
if (![url containsString:@":"]) {
|
||||
url = [NSString stringWithFormat:@"%@:7777", url];
|
||||
}
|
||||
if (![url containsString:@"://"]) {
|
||||
url = [NSString stringWithFormat:@"ws://%@", url];
|
||||
}
|
||||
[[DoricDev instance] connectDevKit:url];
|
||||
ShowToast([NSString stringWithFormat:@"Connected to %@", url], DoricGravityBottom);
|
||||
[self.navigationController popViewControllerAnimated:NO];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user