Don't attempt to pair on entry to foreground if we've become unpaired

This commit is contained in:
Cameron Gutman 2018-05-31 01:53:09 -07:00
parent 63297c8483
commit 132a1fc410

View File

@ -317,13 +317,22 @@ static NSMutableSet* hostList;
if ([[serverInfoResp getStringTag:@"PairStatus"] isEqualToString:@"1"]) { if ([[serverInfoResp getStringTag:@"PairStatus"] isEqualToString:@"1"]) {
Log(LOG_I, @"Already Paired"); Log(LOG_I, @"Already Paired");
[self alreadyPaired]; [self alreadyPaired];
} else { }
// Only pair when this was the result of explicit user action
else if (view != nil) {
Log(LOG_I, @"Trying to pair"); Log(LOG_I, @"Trying to pair");
// Polling the server while pairing causes the server to screw up // Polling the server while pairing causes the server to screw up
[self->_discMan stopDiscoveryBlocking]; [self->_discMan stopDiscoveryBlocking];
PairManager* pMan = [[PairManager alloc] initWithManager:hMan andCert:self->_cert callback:self]; PairManager* pMan = [[PairManager alloc] initWithManager:hMan andCert:self->_cert callback:self];
[self->_opQueue addOperation:pMan]; [self->_opQueue addOperation:pMan];
} }
else {
// Not user action, so just return to host screen
dispatch_async(dispatch_get_main_queue(), ^{
[self hideLoadingFrame];
[self showHostSelectionView];
});
}
} }
}); });
} }