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

fix: allow Tray with title only (without icon) on Mac #13851

Merged
merged 1 commit into from
Aug 30, 2018

Conversation

miniak
Copy link
Contributor

@miniak miniak commented Jul 29, 2018

Description of Change

Fixes #13202

Checklist
  • PR description included and stakeholders cc'd
  • npm test passes
  • PR title follows semantic commit guidelines
Release Notes

Notes: Allow Tray with title only (without icon) on Mac.

@miniak miniak requested review from a team July 29, 2018 16:18
@miniak miniak force-pushed the miniak/tray-title-only branch 3 times, most recently from 77ef005 to 7169f59 Compare July 29, 2018 16:49
@MarshallOfSound MarshallOfSound added semver/minor backwards-compatible functionality and removed target/3-0-x labels Jul 30, 2018
mate::Handle<NativeImage> image;
if (!args->GetNext(&image)) {
#if !defined(OS_MACOSX)
args->ThrowError("'image' must be defined");
Copy link
Member

Choose a reason for hiding this comment

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

An image must be provided as the first argument of the `Tray` constructor

docs/api/tray.md Outdated
@@ -60,9 +60,10 @@ rely on the `click` event and always attach a context menu to the tray icon.

### `new Tray(image)`

* `image` ([NativeImage](native-image.md) | String)
* `image` ([NativeImage](native-image.md) | String | null)
Copy link
Member

Choose a reason for hiding this comment

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

Although less semantic I'm not a fan of having an argument that can be null on one platform but would throw errors on another. A static type checker (typescript for example) wouldn't be able to warn you about these issues.

Can we instead recommend that uses provide nativeImage.createEmpty() if they wish to have a tray with no icon?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MarshallOfSound I will investigate that

Copy link
Member

@MarshallOfSound MarshallOfSound left a comment

Choose a reason for hiding this comment

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

feedback RE usage semantics and errors

@ckerr
Copy link
Member

ckerr commented Aug 11, 2018

@miniak, @MarshallOfSound, what is the status of this? It's been idle for ~2 wks

@MarshallOfSound
Copy link
Member

@ckerr pending on my nativeImage.createEmpty() comment

@miniak miniak force-pushed the miniak/tray-title-only branch 2 times, most recently from 8798524 to ed0495d Compare August 26, 2018 12:45
@miniak miniak changed the title feat: allow Tray with title only (without icon) on Mac fix: allow Tray with title only (without icon) on Mac Aug 26, 2018
@miniak miniak added semver/patch backwards-compatible bug fixes target/1-8-x and removed semver/minor backwards-compatible functionality target/1-8-x labels Aug 26, 2018
@miniak
Copy link
Contributor Author

miniak commented Aug 26, 2018

@MarshallOfSound you're right, it can easily be done without changing the API by handling native.createEmptyImage() properly
@ckerr please review again, thanks!

@miniak miniak self-assigned this Aug 27, 2018
@alexeykuzmin
Copy link
Contributor

@miniak Can you please resolve conflicts here?

@miniak
Copy link
Contributor Author

miniak commented Aug 28, 2018

@alexeykuzmin done

@alexeykuzmin
Copy link
Contributor

@miniak
GYP build was broken at the moment you made the rebase, can you please do it again?

Copy link
Contributor

@alexeykuzmin alexeykuzmin left a comment

Choose a reason for hiding this comment

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

A test maybe?

@miniak
Copy link
Contributor Author

miniak commented Aug 29, 2018

@alexeykuzmin it cannot be tested as it's just a visual change

tray = new Tray(nativeImage.createEmpty())
})
beforeEach(() => {
tray = new Tray(nativeImage.createEmpty())
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have a test on Mac creating a Tray without an icon?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is how you do it without the icon, it does not accept null

@miniak
Copy link
Contributor Author

miniak commented Aug 29, 2018

@MarshallOfSound can you please unblock the PR?

@miniak miniak dismissed MarshallOfSound’s stale review August 30, 2018 06:50

the reason why the PR was blocked has been addressed, cannot get a response now

@miniak
Copy link
Contributor Author

miniak commented Aug 30, 2018

@alexeykuzmin can we get it merged?

@alexeykuzmin
Copy link
Contributor

@alexeykuzmin can we get it merged?

@miniak, I don't have a permission to merge in e/e.
Even if I had it I wouldn't merge anything by other Microsofties =)

@MarshallOfSound MarshallOfSound merged commit 5a0770f into master Aug 30, 2018
@release-clerk
Copy link

release-clerk bot commented Aug 30, 2018

Release Notes Persisted

Allow Tray with title only (without icon) on Mac.

@MarshallOfSound MarshallOfSound deleted the miniak/tray-title-only branch August 30, 2018 09:17
@trop
Copy link
Contributor

trop bot commented Aug 30, 2018

An error occurred while attempting to backport this PR to "2-0-x",
you will need to perform this backport manually

@trop
Copy link
Contributor

trop bot commented Aug 30, 2018

We have automatically backported this PR to "3-0-x", please check out #14384

@trop trop bot added merged/3-0-x and removed target/3-0-x labels Aug 30, 2018
@miniak miniak mentioned this pull request Sep 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants