mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-06-15 21:21:45 +00:00
Fix UI problems when a pairing error occurs in the background
This commit is contained in:
@@ -64,39 +64,37 @@ static NSMutableSet* hostList;
|
|||||||
[self->_pairAlert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) {
|
[self->_pairAlert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) {
|
||||||
self->_pairAlert = nil;
|
self->_pairAlert = nil;
|
||||||
[self->_discMan startDiscovery];
|
[self->_discMan startDiscovery];
|
||||||
[self hideLoadingFrame: nil];
|
[self hideLoadingFrame: ^{
|
||||||
|
[self showHostSelectionView];
|
||||||
|
}];
|
||||||
}]];
|
}]];
|
||||||
[[self activeViewController] presentViewController:self->_pairAlert animated:YES completion:nil];
|
[[self activeViewController] presentViewController:self->_pairAlert animated:YES completion:nil];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)displayFailureDialog:(NSString *)message {
|
- (void)displayPairingFailureDialog:(NSString *)message {
|
||||||
UIAlertController* failedDialog = [UIAlertController alertControllerWithTitle:@"Pairing Failed"
|
UIAlertController* failedDialog = [UIAlertController alertControllerWithTitle:@"Pairing Failed"
|
||||||
message:message
|
message:message
|
||||||
preferredStyle:UIAlertControllerStyleAlert];
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
[Utils addHelpOptionToDialog:failedDialog];
|
[Utils addHelpOptionToDialog:failedDialog];
|
||||||
[failedDialog addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]];
|
[failedDialog addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]];
|
||||||
|
|
||||||
|
[_discMan startDiscovery];
|
||||||
|
|
||||||
[self hideLoadingFrame: ^{
|
[self hideLoadingFrame: ^{
|
||||||
|
[self showHostSelectionView];
|
||||||
[[self activeViewController] presentViewController:failedDialog animated:YES completion:nil];
|
[[self activeViewController] presentViewController:failedDialog animated:YES completion:nil];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[_discMan startDiscovery];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)pairFailed:(NSString *)message {
|
- (void)pairFailed:(NSString *)message {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
if (self->_pairAlert != nil) {
|
if (self->_pairAlert != nil) {
|
||||||
[self->_pairAlert dismissViewControllerAnimated:YES completion:^{
|
[self->_pairAlert dismissViewControllerAnimated:YES completion:^{
|
||||||
[self displayFailureDialog:message];
|
[self displayPairingFailureDialog:message];
|
||||||
}];
|
}];
|
||||||
self->_pairAlert = nil;
|
self->_pairAlert = nil;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
[self displayFailureDialog:message];
|
|
||||||
}
|
|
||||||
|
|
||||||
[self->_discMan startDiscovery];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,10 +168,10 @@ static NSMutableSet* hostList;
|
|||||||
[Utils addHelpOptionToDialog:applistAlert];
|
[Utils addHelpOptionToDialog:applistAlert];
|
||||||
[applistAlert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]];
|
[applistAlert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]];
|
||||||
[self hideLoadingFrame: ^{
|
[self hideLoadingFrame: ^{
|
||||||
|
[self showHostSelectionView];
|
||||||
[[self activeViewController] presentViewController:applistAlert animated:YES completion:nil];
|
[[self activeViewController] presentViewController:applistAlert animated:YES completion:nil];
|
||||||
}];
|
}];
|
||||||
host.state = StateOffline;
|
host.state = StateOffline;
|
||||||
[self showHostSelectionView];
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
@@ -346,13 +344,13 @@ static NSMutableSet* hostList;
|
|||||||
// Only display an alert if this was the result of a real
|
// Only display an alert if this was the result of a real
|
||||||
// user action, not just passively entering the foreground again
|
// user action, not just passively entering the foreground again
|
||||||
[self hideLoadingFrame: ^{
|
[self hideLoadingFrame: ^{
|
||||||
|
[self showHostSelectionView];
|
||||||
if (view != nil) {
|
if (view != nil) {
|
||||||
[[self activeViewController] presentViewController:applistAlert animated:YES completion:nil];
|
[[self activeViewController] presentViewController:applistAlert animated:YES completion:nil];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
host.state = StateOffline;
|
host.state = StateOffline;
|
||||||
[self showHostSelectionView];
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Update the host object with this data
|
// Update the host object with this data
|
||||||
|
|||||||
Reference in New Issue
Block a user