fix(tray): Do not show count on Mac OS X when 0. Fixes #1233

This commit is contained in:
Ben Gotow 2016-02-08 10:31:13 -08:00
parent ff42f06b92
commit 399f83bccc

View file

@ -71,10 +71,17 @@ class TrayStore extends NylasStore {
const imgHandlers = {
'darwin': ()=> {
const img = new Image();
var canvas = null;
// toDataUrl always returns the @1x image data, so the assets/darwin/
// contains an "@2x" image /without/ the @2x extension
img.src = this._baseIcon.toDataURL();
const canvas = canvasWithSystemTrayIconAndText(img, this._unreadString);
if (this._unreadString === '0') {
canvas = canvasWithSystemTrayIconAndText(img, '');
} else {
canvas = canvasWithSystemTrayIconAndText(img, this._unreadString);
}
const pngData = NativeImage.createFromDataURL(canvas.toDataURL()).toPng();
// creating from a buffer allows us to specify that the image is @2x