mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-15 21:22:40 +00:00
Display a failure dialog when we fail to launch an app
This commit is contained in:
@@ -43,7 +43,9 @@
|
|||||||
[_callback showPIN:PIN];
|
[_callback showPIN:PIN];
|
||||||
|
|
||||||
NSData* pairResp = [_httpManager executeRequestSynchronously:[_httpManager newPairRequest:salt]];
|
NSData* pairResp = [_httpManager executeRequestSynchronously:[_httpManager newPairRequest:salt]];
|
||||||
if ([[HttpManager getStringFromXML:pairResp tag:@"paired"] intValue] != 1) {
|
NSString* pairedString;
|
||||||
|
pairedString = [HttpManager getStringFromXML:pairResp tag:@"paired"];
|
||||||
|
if (pairedString == NULL || ![pairedString isEqualToString:@"1"]) {
|
||||||
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
|
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
|
||||||
//TODO: better message
|
//TODO: better message
|
||||||
[_callback pairFailed:@"pairResp failed"];
|
[_callback pairFailed:@"pairResp failed"];
|
||||||
@@ -59,7 +61,8 @@
|
|||||||
NSData* encryptedChallenge = [cryptoMan aesEncrypt:randomChallenge withKey:aesKey];
|
NSData* encryptedChallenge = [cryptoMan aesEncrypt:randomChallenge withKey:aesKey];
|
||||||
|
|
||||||
NSData* challengeResp = [_httpManager executeRequestSynchronously:[_httpManager newChallengeRequest:encryptedChallenge]];
|
NSData* challengeResp = [_httpManager executeRequestSynchronously:[_httpManager newChallengeRequest:encryptedChallenge]];
|
||||||
if ([[HttpManager getStringFromXML:challengeResp tag:@"paired"] intValue] != 1) {
|
pairedString = [HttpManager getStringFromXML:challengeResp tag:@"paired"];
|
||||||
|
if (pairedString == NULL || ![pairedString isEqualToString:@"1"]) {
|
||||||
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
|
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
|
||||||
//TODO: better message
|
//TODO: better message
|
||||||
[_callback pairFailed:@"challengeResp failed"];
|
[_callback pairFailed:@"challengeResp failed"];
|
||||||
@@ -77,7 +80,8 @@
|
|||||||
NSData* challengeRespEncrypted = [cryptoMan aesEncrypt:challengeRespHash withKey:aesKey];
|
NSData* challengeRespEncrypted = [cryptoMan aesEncrypt:challengeRespHash withKey:aesKey];
|
||||||
|
|
||||||
NSData* secretResp = [_httpManager executeRequestSynchronously:[_httpManager newChallengeRespRequest:challengeRespEncrypted]];
|
NSData* secretResp = [_httpManager executeRequestSynchronously:[_httpManager newChallengeRespRequest:challengeRespEncrypted]];
|
||||||
if ([[HttpManager getStringFromXML:secretResp tag:@"paired"] intValue] != 1) {
|
pairedString = [HttpManager getStringFromXML:secretResp tag:@"paired"];
|
||||||
|
if (pairedString == NULL || ![pairedString isEqualToString:@"1"]) {
|
||||||
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
|
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
|
||||||
//TODO: better message
|
//TODO: better message
|
||||||
[_callback pairFailed:@"secretResp failed"];
|
[_callback pairFailed:@"secretResp failed"];
|
||||||
@@ -105,7 +109,8 @@
|
|||||||
|
|
||||||
NSData* clientPairingSecret = [self concatData:clientSecret with:[cryptoMan signData:clientSecret withKey:[CryptoManager readKeyFromFile]]];
|
NSData* clientPairingSecret = [self concatData:clientSecret with:[cryptoMan signData:clientSecret withKey:[CryptoManager readKeyFromFile]]];
|
||||||
NSData* clientSecretResp = [_httpManager executeRequestSynchronously:[_httpManager newClientSecretRespRequest:[Utils bytesToHex:clientPairingSecret]]];
|
NSData* clientSecretResp = [_httpManager executeRequestSynchronously:[_httpManager newClientSecretRespRequest:[Utils bytesToHex:clientPairingSecret]]];
|
||||||
if (![[HttpManager getStringFromXML:clientSecretResp tag:@"paired"] isEqual:@"1"]) {
|
pairedString = [HttpManager getStringFromXML:clientSecretResp tag:@"paired"];
|
||||||
|
if (pairedString == NULL || ![pairedString isEqualToString:@"1"]) {
|
||||||
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
|
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
|
||||||
//TODO: better message
|
//TODO: better message
|
||||||
[_callback pairFailed:@"clientSecretResp failed"];
|
[_callback pairFailed:@"clientSecretResp failed"];
|
||||||
@@ -113,7 +118,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSData* clientPairChallenge = [_httpManager executeRequestSynchronously:[_httpManager newPairChallenge]];
|
NSData* clientPairChallenge = [_httpManager executeRequestSynchronously:[_httpManager newPairChallenge]];
|
||||||
if (![[HttpManager getStringFromXML:clientPairChallenge tag:@"paired"] isEqual:@"1"]) {
|
pairedString = [HttpManager getStringFromXML:clientPairChallenge tag:@"paired"];
|
||||||
|
if (pairedString == NULL || ![pairedString isEqualToString:@"1"]) {
|
||||||
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
|
[_httpManager executeRequestSynchronously:[_httpManager newUnpairRequest]];
|
||||||
//TODO: better message
|
//TODO: better message
|
||||||
[_callback pairFailed:@"clientPairChallenge failed"];
|
[_callback pairFailed:@"clientPairChallenge failed"];
|
||||||
|
|||||||
@@ -41,12 +41,23 @@
|
|||||||
cert:cert];
|
cert:cert];
|
||||||
|
|
||||||
NSData* serverInfoResp = [hMan executeRequestSynchronously:[hMan newServerInfoRequest]];
|
NSData* serverInfoResp = [hMan executeRequestSynchronously:[hMan newServerInfoRequest]];
|
||||||
if (![[HttpManager getStringFromXML:serverInfoResp tag:@"currentgame"] isEqualToString:@"0"]) {
|
NSString* currentGame = [HttpManager getStringFromXML:serverInfoResp tag:@"currentgame"];
|
||||||
|
if (currentGame == NULL) {
|
||||||
|
[_callbacks launchFailed];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if ([currentGame isEqualToString:@"0"]) {
|
||||||
// App already running, resume it
|
// App already running, resume it
|
||||||
[self resumeApp:hMan];
|
if (![self resumeApp:hMan]) {
|
||||||
|
[_callbacks launchFailed];
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Start app
|
// Start app
|
||||||
[self launchApp:hMan];
|
if (![self launchApp:hMan]) {
|
||||||
|
[_callbacks launchFailed];
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoDecoderRenderer* renderer = [[VideoDecoderRenderer alloc]initWithView:_renderView];
|
VideoDecoderRenderer* renderer = [[VideoDecoderRenderer alloc]initWithView:_renderView];
|
||||||
|
|||||||
@@ -81,7 +81,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void) launchFailed {
|
- (void) launchFailed {
|
||||||
|
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Connection Failed"
|
||||||
|
message:@"Failed to start app"
|
||||||
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
[alert addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action){
|
||||||
|
[self performSegueWithIdentifier:@"returnToMainFrame" sender:self];
|
||||||
|
}]];
|
||||||
|
[self presentViewController:alert animated:YES completion:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) displayMessage:(char*)message {
|
- (void) displayMessage:(char*)message {
|
||||||
|
|||||||
Reference in New Issue
Block a user