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

gitify-app / gitify / 12857889163

19 Jan 2025 10:53PM UTC coverage: 87.169% (-0.2%) from 87.327%
12857889163

Pull #1737

github

web-flow
Merge db015b4b1 into 477658fe8
Pull Request #1737: feat: linux check for updates

595 of 665 branches covered (89.47%)

Branch coverage included in aggregate %.

4 of 7 new or added lines in 2 files covered. (57.14%)

1613 of 1868 relevant lines covered (86.35%)

24.31 hits per line

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

0.0
/src/main/first-run.ts
1
import fs from 'node:fs';
×
2
import path from 'node:path';
×
3
import { app, dialog } from 'electron';
×
4

5
import { logError } from '../shared/logger';
×
6
import { isMacOS } from '../shared/platform';
×
7

8
export async function onFirstRunMaybe() {
×
9
  if (isFirstRun()) {
×
10
    await promptMoveToApplicationsFolder();
×
11
  }
12
}
13

14
// Ask user if the app should be moved to the applications folder.
15
async function promptMoveToApplicationsFolder() {
16
  if (!isMacOS()) return;
×
17

18
  const isDevMode = !!process.defaultApp;
×
19
  if (isDevMode || app.isInApplicationsFolder()) return;
×
20

21
  const { response } = await dialog.showMessageBox({
×
22
    type: 'question',
23
    buttons: ['Move to Applications Folder', 'Do Not Move'],
24
    defaultId: 0,
25
    message: 'Move to Applications Folder?',
26
  });
27

28
  if (response === 0) {
×
29
    app.moveToApplicationsFolder();
×
30
  }
31
}
32

33
const getConfigPath = () => {
×
34
  const userDataPath = app.getPath('userData');
×
35
  return path.join(userDataPath, 'FirstRun', 'gitify-first-run');
×
36
};
37

38
// Whether or not the app is being run for the first time.
39
function isFirstRun() {
40
  const configPath = getConfigPath();
×
41

42
  try {
×
43
    if (fs.existsSync(configPath)) {
×
44
      return false;
×
45
    }
46

47
    const firstRunFolder = path.dirname(configPath);
×
48
    if (!fs.existsSync(firstRunFolder)) {
×
49
      fs.mkdirSync(firstRunFolder);
×
50
    }
51

52
    fs.writeFileSync(configPath, '');
×
53
  } catch (err) {
54
    logError('isFirstRun', 'Unable to write firstRun file', err);
×
55
  }
56

57
  return true;
×
58
}
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

© 2025 Coveralls, Inc