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