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

Feature: Auto restore tabs if the app crashes #12005

Merged
merged 11 commits into from
Apr 16, 2023

Conversation

hishitetsu
Copy link
Member

@hishitetsu hishitetsu commented Apr 7, 2023

Resolved / Related Issues

  • Were these changes approved in an issue or discussion with the project maintainers? In order to prevent extra work, feature requests and changes to the codebase must be approved before the pull request will be reviewed. This prevents extra work for the contributors and maintainers.
    Closes Feature: Auto restore tabs if the app crashes #5993

Validation
How did you test these changes?

  • Did you build the app and test your changes?
  • Did you check for accessibility? You can use Accessibility Insights for this.
  • Did you remove any strings from the en-us resource file?
    • Did you search the solution to see if the string is still being used?
  • Did you implement any design changes to an existing feature?
    • Was this change approved?
  • Are there any other steps that were used to validate these changes?

@hishitetsu hishitetsu marked this pull request as draft April 7, 2023 07:31
@QuaintMako
Copy link
Contributor

With the current implementation, does the user's original setting is preserved after the restart?

@hishitetsu
Copy link
Member Author

It should because the current implementation is the same mechanism as when changing languages.
I'm currently working on further improvements to automatically restart the app without clicking notifications.

@hishitetsu hishitetsu marked this pull request as ready for review April 7, 2023 12:03
@hishitetsu
Copy link
Member Author

hishitetsu commented Apr 7, 2023

Automatic restart is now implemented.
When Launcher.LaunchUriAsync() is called, the method somehow doesn't return even though a new app is launched, so I use a timer to force it to end.

Notifications now doesn't launch the application when clicked in favor of automatic restart.

@hishitetsu hishitetsu marked this pull request as draft April 7, 2023 12:36
@ferrariofilippo
Copy link
Contributor

When Launcher.LaunchUriAsync() is called, the method somehow doesn't return even though a new app is launched

It might be related with #3652

@hishitetsu
Copy link
Member Author

As it is, if I get an error when I view a particular page, I get endless restarts.

It needs a little more improvement.

@hishitetsu
Copy link
Member Author

When Launcher.LaunchUriAsync() is called, the method somehow doesn't return even though a new app is launched

It might be related with #3652

But it returns normally when changing language.
Maybe the UI thread is going haywire because it is after the exception occurred.

private async void YesButton_Click(object sender, RoutedEventArgs e)
{
UserSettingsService.AppSettingsService.RestoreTabsOnStartup = true; // Tells the app to restore tabs when it's next launched
App.SaveSessionTabs(); // Saves the open tabs
await Launcher.LaunchUriAsync(new Uri("files-uwp:")); // Launches a new instance of Files
Process.GetCurrentProcess().Kill(); // Closes the current instance
}

@ferrariofilippo
Copy link
Contributor

Maybe the UI thread is going haywire because it is after the exception occurred.

Yes that might be the case

@hishitetsu hishitetsu marked this pull request as ready for review April 8, 2023 08:50
@hishitetsu
Copy link
Member Author

As it is, if I get an error when I view a particular page, I get endless restarts.

I addressed it. Now ready for review.

@QuaintMako
Copy link
Contributor

@hishitetsu may I ask you what was the process you used to provoke the crash of the app to test it myself?

@hishitetsu
Copy link
Member Author

@hishitetsu may I ask you what was the process you used to provoke the crash of the app to test it myself?

I tested that by embedding the code that throws the Exception for debugging purposes.

QuaintMako
QuaintMako previously approved these changes Apr 12, 2023
Copy link
Contributor

@QuaintMako QuaintMako left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works as expected for me.

yaira2
yaira2 previously approved these changes Apr 16, 2023
Copy link
Member

@yaira2 yaira2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yaira2 yaira2 added ready to merge Pull requests that are approved and ready to merge and removed needs - code review labels Apr 16, 2023
@yaira2 yaira2 dismissed stale reviews from QuaintMako and themself via d1953b5 April 16, 2023 19:28
yaira2
yaira2 previously approved these changes Apr 16, 2023
@yaira2 yaira2 merged commit 980ea7e into files-community:main Apr 16, 2023
@hishitetsu hishitetsu deleted the SaveSessionWhenException branch April 16, 2023 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Pull requests that are approved and ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Auto restore tabs if the app crashes
4 participants