Display status messages for failed app launch

This commit is contained in:
Cameron Gutman
2014-10-23 23:41:07 -04:00
parent 47850cd658
commit 3554b40962
5 changed files with 42 additions and 10 deletions
+1 -1
View File
@@ -17,7 +17,7 @@
- (void) stageStarting:(char*)stageName;
- (void) stageComplete:(char*)stageName;
- (void) stageFailed:(char*)stageName withError:(long)errorCode;
- (void) launchFailed;
- (void) launchFailed:(NSString*)message;
- (void) displayMessage:(char*)message;
- (void) displayTransientMessage:(char*)message;
+13 -7
View File
@@ -43,27 +43,25 @@
NSString* currentGame = [HttpManager getStringFromXML:serverInfoResp tag:@"currentgame"];
NSString* pairStatus = [HttpManager getStringFromXML:serverInfoResp tag:@"PairStatus"];
if (currentGame == NULL || pairStatus == NULL) {
[_callbacks launchFailed];
[_callbacks launchFailed:@"Failed to connect to PC"];
return;
}
if (![pairStatus isEqualToString:@"1"]) {
// Not paired
// TODO: Display better error message
[_callbacks launchFailed];
[_callbacks launchFailed:@"Device not paired to PC"];
return;
}
// resumeApp and launchApp handle calling launchFailed
if (![currentGame isEqualToString:@"0"]) {
// App already running, resume it
if (![self resumeApp:hMan]) {
[_callbacks launchFailed];
return;
}
} else {
// Start app
if (![self launchApp:hMan]) {
[_callbacks launchFailed];
return;
}
}
@@ -88,7 +86,11 @@
rikey:[Utils bytesToHex:_config.riKey]
rikeyid:_config.riKeyId]];
NSString *gameSession = [HttpManager getStringFromXML:launchResp tag:@"gamesession"];
if (gameSession == NULL || [gameSession isEqualToString:@"0"]) {
if (launchResp == NULL) {
[_callbacks launchFailed:@"Failed to launch app"];
return FALSE;
} else if (gameSession == NULL || [gameSession isEqualToString:@"0"]) {
[_callbacks launchFailed:[HttpManager getStatusStringFromXML:launchResp]];
return FALSE;
}
@@ -100,7 +102,11 @@
[hMan newResumeRequestWithRiKey:[Utils bytesToHex:_config.riKey]
riKeyId:_config.riKeyId]];
NSString *resume = [HttpManager getStringFromXML:resumeResp tag:@"resume"];
if (resume == NULL || [resume isEqualToString:@"0"]) {
if (resumeResp == NULL) {
[_callbacks launchFailed:@"Failed to resume app"];
return FALSE;
} else if (resume == NULL || [resume isEqualToString:@"0"]) {
[_callbacks launchFailed:[HttpManager getStatusStringFromXML:resumeResp]];
return FALSE;
}