Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] Return to Home Screen after a guest powers off #2279

Closed
conath opened this issue Jan 22, 2021 · 1 comment
Closed

[iOS] Return to Home Screen after a guest powers off #2279

conath opened this issue Jan 22, 2021 · 1 comment
Labels
enhancement New feature or request interface Design, UX/UI issues

Comments

@conath
Copy link
Contributor

conath commented Jan 22, 2021

Whenever a guest VM is powered off in UTM on iOS, the app exits to the home screen. This impractical for several reasons:

  • it looks to the user as if UTM has crashed when it has in fact exited without error
  • need to relaunch the app every time to test different VM configuration
  • limits use of UTM in Split View because UTM exiting causes iPadOS to go back to the home screen
  • the app still appears in the app switcher despite it actually not running anymore (least important point)

The very first of these points can be addressed by calling [UIApplication suspend] instead of exit(0). This results in a graceful animation to the Home Screen. UTM may then call exit(0) when in the background.

Code example from StackOverflow:

-(void)doExit
{
        // animate to home screen
        UIApplication *app = [UIApplication sharedApplication];
        [app performSelector:@selector(suspend)];

        // wait 2 seconds while app is going background
        [NSThread sleepForTimeInterval:2.0];

        // exit app when app is in background
        exit(0);
    }
}

Resolving the issue entirely, meaning returning to the VM list after the VM powers down, seems more challenging to implement. Currently when a VM is started, a new ViewController takes over the key UIWindow and (as far as I can tell) no reference is kept to the VM list view.

So to implement going back either a NavigationController of sorts must be introduced to be able to navigate back, or the VM list view must be re-created after the VM powers down and a new UIWindow created that shows the list.

@osy
Copy link
Contributor

osy commented Jan 24, 2021

Due to #6 there's no way to start a second VM in the same address space. But I can try to implement the graceful exit.

@osy osy added enhancement New feature or request interface Design, UX/UI issues labels Jan 24, 2021
@osy osy changed the title [iOS] Return to VM List after a guest powers off [iOS] Return to Home Screen after a guest powers off Jan 24, 2021
@osy osy closed this as completed in f1c783a Jan 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request interface Design, UX/UI issues
Projects
None yet
Development

No branches or pull requests

2 participants