Show a warning prompt when closing main window #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #9 by showing a warning prompt when the user tries to close the window:
The main thing I'm worried about with this change is translation -- this message is hard-coded. But I don't think there's currently any way to access translations in the Snap! app, and implementing something like that would be out of the scope of this PR.
Note - this prompt shows up no matter how the window is closed - even if it's from pressing Ctrl-C at the command line. This makes development a little more involved (since you have to click "close" each time you reload). Snap! (in the browser) doesn't seem to have a condition for whether or not to warn before closing (it always warns), so we can't make use of anything like that. And Electron doesn't seem to tell us whether the event came from pressing quit or Ctrl-C - so I don't see any obvious way to make it not prompt on Ctrl-C.