• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gitify-app / gitify / 13089003509

01 Feb 2025 01:17PM UTC coverage: 87.495% (-0.3%) from 87.75%
13089003509

Pull #1800

github

web-flow
Merge 220ccfa29 into db1ba7308
Pull Request #1800: feat: encrypt tokens using safe storage api

639 of 713 branches covered (89.62%)

Branch coverage included in aggregate %.

12 of 22 new or added lines in 5 files covered. (54.55%)

1 existing line in 1 file now uncovered.

1698 of 1958 relevant lines covered (86.72%)

25.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

52.94
/src/main/menu.ts
1
import { Menu, MenuItem, shell } from 'electron';
2✔
2
import { autoUpdater } from 'electron-updater';
2✔
3
import type { Menubar } from 'menubar';
4

5
import { APPLICATION } from '../shared/constants';
2✔
6
import { isMacOS, isWindows } from '../shared/platform';
2✔
7
import { openLogsDirectory, resetApp, takeScreenshot } from './utils';
2✔
8

9
export default class MenuBuilder {
2✔
10
  private readonly checkForUpdatesMenuItem: MenuItem;
11
  private readonly noUpdateAvailableMenuItem: MenuItem;
12
  private readonly updateAvailableMenuItem: MenuItem;
13
  private readonly updateReadyForInstallMenuItem: MenuItem;
14

15
  menubar: Menubar;
16

17
  constructor(menubar: Menubar) {
18
    this.menubar = menubar;
20✔
19

20
    this.checkForUpdatesMenuItem = new MenuItem({
20✔
21
      label: 'Check for updates',
22
      enabled: true,
23
      click: () => {
24
        if (isMacOS() || isWindows()) {
×
25
          autoUpdater.checkForUpdatesAndNotify();
×
26
        } else {
27
          shell.openExternal(APPLICATION.WEBSITE);
×
28
        }
29
      },
30
    });
31

32
    this.noUpdateAvailableMenuItem = new MenuItem({
20✔
33
      label: 'No updates available',
34
      enabled: false,
35
      visible: false,
36
    });
37

38
    this.updateAvailableMenuItem = new MenuItem({
20✔
39
      label: 'An update is available',
40
      enabled: false,
41
      visible: false,
42
    });
43

44
    this.updateReadyForInstallMenuItem = new MenuItem({
20✔
45
      label: 'Restart to install update',
46
      enabled: true,
47
      visible: false,
48
      click: () => {
49
        autoUpdater.quitAndInstall();
×
50
      },
51
    });
52
  }
53

54
  buildMenu(): Menu {
55
    const contextMenu = Menu.buildFromTemplate([
2✔
56
      this.checkForUpdatesMenuItem,
57
      this.noUpdateAvailableMenuItem,
58
      this.updateAvailableMenuItem,
59
      this.updateReadyForInstallMenuItem,
60
      { type: 'separator' },
61
      {
62
        label: 'Developer',
63
        submenu: [
64
          {
65
            role: 'reload',
66
            accelerator: 'CommandOrControl+R',
67
          },
68
          {
69
            role: 'toggleDevTools',
70
            accelerator: isMacOS() ? 'Alt+Cmd+I' : 'Ctrl+Shift+I',
1!
71
          },
72
          {
73
            label: 'Take Screenshot',
74
            accelerator: 'CommandOrControl+S',
75
            click: () => takeScreenshot(this.menubar),
×
76
          },
77
          {
78
            label: 'View Application Logs',
79
            click: () => openLogsDirectory(),
×
80
          },
81
          {
82
            label: `Reset ${APPLICATION.NAME}`,
83
            click: () => {
84
              resetApp(this.menubar);
×
85
            },
86
          },
87
        ],
88
      },
89
      { type: 'separator' },
90
      {
91
        label: `Quit ${APPLICATION.NAME}`,
92
        accelerator: 'CommandOrControl+Q',
93
        click: () => {
94
          this.menubar.app.quit();
×
95
        },
96
      },
97
    ]);
98

99
    return contextMenu;
2✔
100
  }
101

102
  setCheckForUpdatesMenuEnabled(enabled: boolean) {
103
    this.checkForUpdatesMenuItem.enabled = enabled;
4✔
104
  }
105

106
  setNoUpdateAvailableMenuVisibility(isVisible: boolean) {
107
    this.noUpdateAvailableMenuItem.visible = isVisible;
4✔
108
  }
109

110
  setUpdateAvailableMenuVisibility(isVisible: boolean) {
111
    this.updateAvailableMenuItem.visible = isVisible;
4✔
112
  }
113

114
  setUpdateReadyForInstallMenuVisibility(isVisible: boolean) {
115
    this.updateReadyForInstallMenuItem.visible = isVisible;
4✔
116
  }
117

118
  isUpdateAvailable() {
119
    return (
×
120
      this.updateAvailableMenuItem.visible ||
×
121
      this.updateReadyForInstallMenuItem.visible
122
    );
123
  }
124
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc