Launch directly to the app grid if there is exactly one PC

This commit is contained in:
Cameron Gutman
2019-11-03 15:17:27 -08:00
parent 95ce78bb00
commit ee7df54842
@@ -314,6 +314,21 @@ static NSMutableSet* hostList;
[self showLoadingFrame: ^{ [self showLoadingFrame: ^{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// Wait for the PC's status to be known
while (host.state == StateUnknown) {
sleep(1);
}
// Don't bother polling if the server is already offline
if (host.state == StateOffline) {
dispatch_async(dispatch_get_main_queue(), ^{
[self hideLoadingFrame:^{
[self showHostSelectionView];
}];
});
return;
}
HttpManager* hMan = [[HttpManager alloc] initWithHost:host.activeAddress uniqueId:self->_uniqueId serverCert:host.serverCert]; HttpManager* hMan = [[HttpManager alloc] initWithHost:host.activeAddress uniqueId:self->_uniqueId serverCert:host.serverCert];
ServerInfoResponse* serverInfoResp = [[ServerInfoResponse alloc] init]; ServerInfoResponse* serverInfoResp = [[ServerInfoResponse alloc] init];
@@ -714,8 +729,6 @@ static NSMutableSet* hostList;
{ {
[super viewDidLoad]; [super viewDidLoad];
self.title = @"Select Host";
#if !TARGET_OS_TV #if !TARGET_OS_TV
// Set the side bar button action. When it's tapped, it'll show the sidebar. // Set the side bar button action. When it's tapped, it'll show the sidebar.
[_settingsButton setTarget:self.revealViewController]; [_settingsButton setTarget:self.revealViewController];
@@ -785,7 +798,13 @@ static NSMutableSet* hostList;
[self retrieveSavedHosts]; [self retrieveSavedHosts];
_discMan = [[DiscoveryManager alloc] initWithHosts:[hostList allObjects] andCallback:self]; _discMan = [[DiscoveryManager alloc] initWithHosts:[hostList allObjects] andCallback:self];
if ([hostList count] == 1) {
[self hostClicked:[hostList anyObject] view:nil];
}
else {
self.title = @"Select Host";
[self.view addSubview:hostScrollView]; [self.view addSubview:hostScrollView];
}
} }
#if TARGET_OS_TV #if TARGET_OS_TV