Remove loading frame from Add Host dialog flow

This commit is contained in:
Cameron Gutman 2018-11-28 18:43:45 -08:00
parent f8613cdbfd
commit 336dbeed98

View File

@ -425,35 +425,31 @@ static NSMutableSet* hostList;
- (void) addHostClicked { - (void) addHostClicked {
Log(LOG_D, @"Clicked add host"); Log(LOG_D, @"Clicked add host");
[self showLoadingFrame: ^{ UIAlertController* alertController = [UIAlertController alertControllerWithTitle:@"Host Address" message:@"Please enter a hostname or IP address" preferredStyle:UIAlertControllerStyleAlert];
UIAlertController* alertController = [UIAlertController alertControllerWithTitle:@"Host Address" message:@"Please enter a hostname or IP address" preferredStyle:UIAlertControllerStyleAlert]; [alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];
[alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]]; [alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){
[alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){ NSString* hostAddress = ((UITextField*)[[alertController textFields] objectAtIndex:0]).text;
NSString* hostAddress = ((UITextField*)[[alertController textFields] objectAtIndex:0]).text; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ [self->_discMan discoverHost:hostAddress withCallback:^(TemporaryHost* host, NSString* error){
[self->_discMan discoverHost:hostAddress withCallback:^(TemporaryHost* host, NSString* error){ if (host != nil) {
if (host != nil) { dispatch_async(dispatch_get_main_queue(), ^{
dispatch_async(dispatch_get_main_queue(), ^{ @synchronized(hostList) {
@synchronized(hostList) { [hostList addObject:host];
[hostList addObject:host]; }
} [self updateHosts];
[self updateHosts]; });
}); } else {
} else { UIAlertController* hostNotFoundAlert = [UIAlertController alertControllerWithTitle:@"Add Host" message:error preferredStyle:UIAlertControllerStyleAlert];
UIAlertController* hostNotFoundAlert = [UIAlertController alertControllerWithTitle:@"Add Host" message:error preferredStyle:UIAlertControllerStyleAlert]; [Utils addHelpOptionToDialog:hostNotFoundAlert];
[Utils addHelpOptionToDialog:hostNotFoundAlert]; [hostNotFoundAlert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]];
[hostNotFoundAlert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]]; dispatch_async(dispatch_get_main_queue(), ^{
dispatch_async(dispatch_get_main_queue(), ^{ [[self activeViewController] presentViewController:hostNotFoundAlert animated:YES completion:nil];
[[self activeViewController] presentViewController:hostNotFoundAlert animated:YES completion:nil]; });
}); }
} }];});
}];}); }]];
}]]; [alertController addTextFieldWithConfigurationHandler:nil];
[alertController addTextFieldWithConfigurationHandler:nil]; [[self activeViewController] presentViewController:alertController animated:YES completion:nil];
[self hideLoadingFrame: ^{
[[self activeViewController] presentViewController:alertController animated:YES completion:nil];
}];
}];
} }
- (void) prepareToStreamApp:(TemporaryApp *)app { - (void) prepareToStreamApp:(TemporaryApp *)app {