mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-04-22 16:26:59 +00:00
Switch from deprecated UIAlertView to UIAlertController for pairing
This commit is contained in:
@@ -32,7 +32,7 @@
|
|||||||
DiscoveryManager* _discMan;
|
DiscoveryManager* _discMan;
|
||||||
AppAssetManager* _appManager;
|
AppAssetManager* _appManager;
|
||||||
StreamConfiguration* _streamConfig;
|
StreamConfiguration* _streamConfig;
|
||||||
UIAlertView* _pairAlert;
|
UIAlertController* _pairAlert;
|
||||||
UIScrollView* hostScrollView;
|
UIScrollView* hostScrollView;
|
||||||
int currentPosition;
|
int currentPosition;
|
||||||
}
|
}
|
||||||
@@ -41,16 +41,23 @@ static NSArray* appList;
|
|||||||
|
|
||||||
- (void)showPIN:(NSString *)PIN {
|
- (void)showPIN:(NSString *)PIN {
|
||||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||||
_pairAlert = [[UIAlertView alloc] initWithTitle:@"Pairing" message:[NSString stringWithFormat:@"Enter the following PIN on the host machine: %@", PIN]delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
|
_pairAlert = [UIAlertController alertControllerWithTitle:@"Pairing"
|
||||||
[_pairAlert show];
|
message:[NSString stringWithFormat:@"Enter the following PIN on the host machine: %@", PIN]
|
||||||
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
[_pairAlert addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDestructive handler:nil]];
|
||||||
|
[self presentViewController:_pairAlert animated:YES completion:nil];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)pairFailed:(NSString *)message {
|
- (void)pairFailed:(NSString *)message {
|
||||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||||
[_pairAlert dismissWithClickedButtonIndex:0 animated:NO];
|
[_pairAlert dismissViewControllerAnimated:YES completion:nil];
|
||||||
_pairAlert = [[UIAlertView alloc] initWithTitle:@"Pairing Failed" message:message delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
|
_pairAlert = [UIAlertController alertControllerWithTitle:@"Pairing Failed"
|
||||||
[_pairAlert show];
|
message:message
|
||||||
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
[_pairAlert addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDestructive handler:nil]];
|
||||||
|
[self presentViewController:_pairAlert animated:YES completion:nil];
|
||||||
|
|
||||||
[_discMan startDiscovery];
|
[_discMan startDiscovery];
|
||||||
[self hideLoadingFrame];
|
[self hideLoadingFrame];
|
||||||
});
|
});
|
||||||
@@ -58,9 +65,13 @@ static NSArray* appList;
|
|||||||
|
|
||||||
- (void)pairSuccessful {
|
- (void)pairSuccessful {
|
||||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||||
[_pairAlert dismissWithClickedButtonIndex:0 animated:NO];
|
[_pairAlert dismissViewControllerAnimated:YES completion:nil];
|
||||||
_pairAlert = [[UIAlertView alloc] initWithTitle:@"Pairing Succesful" message:@"Successfully paired to host" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
|
_pairAlert = [UIAlertController alertControllerWithTitle:@"Pairing Succesful"
|
||||||
[_pairAlert show];
|
message:@"Successfully paired to host"
|
||||||
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
[_pairAlert addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDestructive handler:nil]];
|
||||||
|
[self presentViewController:_pairAlert animated:YES completion:nil];
|
||||||
|
|
||||||
[_discMan startDiscovery];
|
[_discMan startDiscovery];
|
||||||
[self hideLoadingFrame];
|
[self hideLoadingFrame];
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user