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

gitify-app / gitify / 12858133048

19 Jan 2025 11:28PM UTC coverage: 87.165% (+0.001%) from 87.164%
12858133048

push

github

web-flow
refactor: namespaced events (#1738)

Signed-off-by: Adam Setch <adam.setch@outlook.com>

595 of 665 branches covered (89.47%)

Branch coverage included in aggregate %.

19 of 35 new or added lines in 6 files covered. (54.29%)

1619 of 1875 relevant lines covered (86.35%)

24.52 hits per line

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

32.26
/src/main/utils.ts
1
import fs from 'node:fs';
2✔
2
import os from 'node:os';
2✔
3
import path from 'node:path';
2✔
4
import { dialog, shell } from 'electron';
2✔
5
import log from 'electron-log';
2✔
6
import type { Menubar } from 'menubar';
7

8
import { namespacedEvent } from '../shared/events';
2✔
9
import { logError, logInfo } from '../shared/logger';
2✔
10

11
export function takeScreenshot(mb: Menubar) {
2✔
12
  const date = new Date();
×
13
  const dateStr = date.toISOString().replace(/:/g, '-');
×
14

15
  const capturedPicFilePath = `${os.homedir()}/${dateStr}-gitify-screenshot.png`;
×
16
  mb.window.capturePage().then((img) => {
×
17
    fs.writeFile(capturedPicFilePath, img.toPNG(), () =>
×
18
      logInfo('takeScreenshot', `Screenshot saved ${capturedPicFilePath}`),
×
19
    );
20
  });
21
}
22

23
export function resetApp(mb: Menubar) {
2✔
24
  const cancelButtonId = 0;
×
25
  const resetButtonId = 1;
×
26

27
  const response = dialog.showMessageBoxSync(mb.window, {
×
28
    type: 'warning',
29
    title: 'Reset Gitify',
30
    message:
31
      'Are you sure you want to reset Gitify? You will be logged out of all accounts',
32
    buttons: ['Cancel', 'Reset'],
33
    defaultId: cancelButtonId,
34
    cancelId: cancelButtonId,
35
  });
36

37
  if (response === resetButtonId) {
×
NEW
38
    mb.window.webContents.send(namespacedEvent('reset-app'));
×
39
    mb.app.quit();
×
40
  }
41
}
42

43
export function openLogsDirectory() {
2✔
44
  const logDirectory = path.dirname(log.transports.file?.getFile()?.path);
×
45

46
  if (!logDirectory) {
×
47
    logError(
×
48
      'openLogsDirectory',
49
      'Could not find log directory!',
50
      new Error('Directory not found'),
51
    );
52
    return;
×
53
  }
54

55
  shell.openPath(logDirectory);
×
56
}
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