- RestoreViewController functionality uncommented ios-revival
authorantonc27 <antonc27@mail.ru>
Fri, 14 Aug 2015 02:04:46 +0200
branchios-revival
changeset 11117 0bec360580b3
parent 11116 102684240fe8
child 11118 600a5af8d61f
- RestoreViewController functionality uncommented
project_files/HedgewarsMobile/Classes/MainMenuViewController.m
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Fri Aug 14 02:02:15 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Fri Aug 14 02:04:46 2015 +0200
@@ -60,28 +60,33 @@
         [CreationChamber createFirstLaunch];
     }
 
-//    // prompt for restoring any previous game
-//    NSString *saveString = [userDefaults objectForKey:@"savedGamePath"];
-//    if (saveString != nil && [saveString isEqualToString:@""] == NO && [[userDefaults objectForKey:@"saveIsValid"] boolValue]) {
-//        if (self.restoreViewController == nil) {
-//            NSString *xibName = [@"RestoreViewController-" stringByAppendingString:(IS_IPAD() ? @"iPad" : @"iPhone")];
-//            RestoreViewController *restored = [[RestoreViewController alloc] initWithNibName:xibName bundle:nil];
-//            if ([restored respondsToSelector:@selector(setModalPresentationStyle:)])
-//                restored.modalPresentationStyle = UIModalPresentationFormSheet;
-//            self.restoreViewController = restored;
-//            [restored release];
-//        }
-//        [self performSelector:@selector(presentModalViewController:animated:) withObject:self.restoreViewController afterDelay:0.25];
-//    } else {
-//        // let's not prompt for rating when app crashed >_>
-//        [Appirater appLaunched];
-//    }
+    // prompt for restoring any previous game
+    NSString *saveString = [userDefaults objectForKey:@"savedGamePath"];
+    if (saveString != nil && [saveString isEqualToString:@""] == NO && [[userDefaults objectForKey:@"saveIsValid"] boolValue]) {
+        if (self.restoreViewController == nil) {
+            NSString *xibName = [@"RestoreViewController-" stringByAppendingString:(IS_IPAD() ? @"iPad" : @"iPhone")];
+            RestoreViewController *restored = [[RestoreViewController alloc] initWithNibName:xibName bundle:nil];
+            if ([restored respondsToSelector:@selector(setModalPresentationStyle:)])
+                restored.modalPresentationStyle = UIModalPresentationFormSheet;
+            self.restoreViewController = restored;
+            [restored release];
+        }
+        [self performSelector:@selector(presentViewController:) withObject:self.restoreViewController afterDelay:0.25];
+    } else {
+        // let's not prompt for rating when app crashed >_>
+        [Appirater appLaunched];
+    }
 
     /*
     [ServerProtocolNetwork openServerConnection];
     */
 }
 
+- (void) presentViewController:(UIViewController *)vc
+{
+    [self presentViewController:vc animated:NO completion:nil];
+}
+
 -(void) viewWillAppear:(BOOL)animated {
     [[AudioManagerController mainManager] playBackgroundMusic];
     [super viewWillAppear:animated];