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

Desktop: Add type 'info' and 'OK' button to update dialog when version up-to-date #1148

Merged
merged 3 commits into from Feb 24, 2019

Conversation

Projects
None yet
3 participants
@matsest
Copy link
Contributor

matsest commented Jan 25, 2019

This removes a minor issue (not found Issues) where the text in the check for update messagebox is automatically selected. It adds a 'OK' button and makes the messagebox consistent with other boxes (type 'info'). This is only for the dialog when the version is up-to-date.

  • Tested on Linux (Ubuntu 18.04 running under Unity)

Issue

Current behavior when pressing check for update:
screenshot from 2019-01-25 12-37-22

Text is automatically selected in lack of a button. ESC must be pressed to exit the window.

Fix

With this PR:
screenshot from 2019-01-25 12-36-57

OK is automatically selected, icon is shown. ESC or Enter (for 'OK') can be pressed to exit the window.

@matsest

This comment has been minimized.

Copy link
Contributor Author

matsest commented Jan 25, 2019

Should probably be tested on Mac/Windows as well.

In Windows the dialog already looks like this:

screenshot from 2019-01-25 13-10-25

due to

buttons String - Array of texts for buttons. On Windows, an empty array will result in one button labeled "OK". (Electron docs)

@tessus

This comment has been minimized.

Copy link
Collaborator

tessus commented Jan 26, 2019

On macOS it looks like this:

image

I don't know, if I want to have an info icon shown instead of the Joplin icon.

@matsest

This comment has been minimized.

Copy link
Contributor Author

matsest commented Jan 26, 2019

I'm not sure.. I guess this use of default values makes this happen for both Mac and Windows in different ways.

As long as you state the type (for the logo) and buttons explicitly, it should anyways look similar on all platforms :) I don't have any strong feelings about using the info icon or Joplin icon for this. If you want the Joplin Icon I guess I can change the type line to using the same icon as in the About Joplin-window:

icon: 'build/icons/32x32.png',

Note: The 'info' type was copied from the dialog when an update is available, so IIRC this dialog also shows an info icon.

@tessus tessus added the desktop label Jan 29, 2019

@laurent22

This comment has been minimized.

Copy link
Owner

laurent22 commented Feb 14, 2019

What's the standard for message boxes on Linux? Maybe if the Electron team didn't put the OK button is because it's more normal on Linux not to have one?

In any case, if we make this change, we should probably change showMessageBox so that it applies to all message boxes and not just this one. I prefer not to have icons either, because for some reasons they look quite ugly on all platforms (that's why I wasn't using any).

@matsest

This comment has been minimized.

Copy link
Contributor Author

matsest commented Feb 14, 2019

Based on the documentation for Electron I thought that it automatically added 'OK' to Windows, but it indeed seems like this default action happens for MacOS as well - but not for Linux (as shown in my initial screenshot). There's not a coherent standard for Linux AFAIK, it's likely different in different distros and graphical environments. But not having a button does not look good and does not cohere with the general design in the application IMO.

To suppress the default icon action, adding icon: "none" should be sufficient?

When I took another look at the code I see that using showmessagebox directly is not recommended:

// Don't use this directly - call one of the showXxxxxxxMessageBox() instead
showMessageBox_(window, options) {
const {dialog} = require('electron');

so perhaps showInfoMessageBox from bridge.js should be used instead?
showInfoMessageBox(message, options = {}) {
const result = this.showMessageBox_(this.window(), Object.assign({}, {
type: 'info',
message: message,
buttons: [_('OK')],
}, options));
return result === 0;
}

It's only in checkForUpdates.js this is used directly, so if changes would to be made on other boxes they should be changed in the definitions in bridge.js instead.

@laurent22

This comment has been minimized.

Copy link
Owner

laurent22 commented Feb 24, 2019

Thanks @matsest, I think this is fine. I might be difficult to use functions from bridge from that script, so let's keep that way.

@laurent22 laurent22 merged commit 1e0c4cc into laurent22:master Feb 24, 2019

1 check passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details

laurent22 added a commit that referenced this pull request Feb 24, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.