Don't attempt to start or resume a game if the device isn't paired

This commit is contained in:
Cameron Gutman 2014-10-23 14:53:31 -04:00
parent ae9abf2911
commit ba022da665

View File

@ -41,11 +41,20 @@
NSData* serverInfoResp = [hMan executeRequestSynchronously:[hMan newServerInfoRequest]]; NSData* serverInfoResp = [hMan executeRequestSynchronously:[hMan newServerInfoRequest]];
NSString* currentGame = [HttpManager getStringFromXML:serverInfoResp tag:@"currentgame"]; NSString* currentGame = [HttpManager getStringFromXML:serverInfoResp tag:@"currentgame"];
if (currentGame == NULL) { NSString* pairStatus = [HttpManager getStringFromXML:serverInfoResp tag:@"PairStatus"];
if (currentGame == NULL || pairStatus == NULL) {
[_callbacks launchFailed]; [_callbacks launchFailed];
return; return;
} }
else if (![currentGame isEqualToString:@"0"]) {
if (![pairStatus isEqualToString:@"1"]) {
// Not paired
// TODO: Display better error message
[_callbacks launchFailed];
return;
}
if (![currentGame isEqualToString:@"0"]) {
// App already running, resume it // App already running, resume it
if (![self resumeApp:hMan]) { if (![self resumeApp:hMan]) {
[_callbacks launchFailed]; [_callbacks launchFailed];