moved isPlatform util to common/platform

This commit is contained in:
Abhinav 2023-01-30 19:28:15 +05:30
parent e0dd061259
commit 41e784aa6f
7 changed files with 16 additions and 16 deletions

View file

@ -12,7 +12,7 @@ import {
import fetch from 'node-fetch';
import { logErrorSentry } from './sentry';
import ElectronLog from 'electron-log';
import { isPlatform } from '../utils/main';
import { isPlatform } from '../utils/common/platform';
const FIVE_MIN_IN_MICROSECOND = 5 * 60 * 1000;
const ONE_DAY_IN_MICROSECOND = 1 * 24 * 60 * 60 * 1000;

View file

@ -1,4 +1,4 @@
import { isPlatform } from '../utils/main';
import { isPlatform } from '../utils/common/platform';
import { AutoLauncherClient } from '../types/autoLauncher';
import linuxAutoLauncher from './autoLauncherClients/linuxAutoLauncher';
import macAndWindowsAutoLauncher from './autoLauncherClients/macAndWindowsAutoLauncher';

View file

@ -0,0 +1,11 @@
export function isPlatform(platform: 'mac' | 'windows' | 'linux') {
if (process.platform === 'darwin') {
return platform === 'mac';
} else if (process.platform === 'win32') {
return platform === 'windows';
} else if (process.platform === 'linux') {
return platform === 'linux';
} else {
return false;
}
}

View file

@ -3,7 +3,7 @@ import * as path from 'path';
import { isDev } from './common';
import { isAppQuitting } from '../main';
import { PROD_HOST_URL } from '../config';
import { isPlatform } from './main';
import { isPlatform } from './common/platform';
import { getHideDockIconPreference } from '../services/userPreference';
import autoLauncher from '../services/autoLauncher';

View file

@ -11,6 +11,7 @@ import { getHideDockIconPreference } from '../services/userPreference';
import { setupAutoUpdater } from '../services/appUpdater';
import ElectronLog from 'electron-log';
import os from 'os';
import { isPlatform } from './common/platform';
export function handleUpdates(mainWindow: BrowserWindow) {
if (!isDev) {
@ -84,18 +85,6 @@ export function setupNextElectronServe() {
});
}
export function isPlatform(platform: 'mac' | 'windows' | 'linux') {
if (process.platform === 'darwin') {
return platform === 'mac';
} else if (process.platform === 'win32') {
return platform === 'windows';
} else if (process.platform === 'linux') {
return platform === 'linux';
} else {
return false;
}
}
export async function handleDockIconHideOnAutoLaunch() {
const shouldHideDockIcon = getHideDockIconPreference();
const wasAutoLaunched = await autoLauncher.wasAutoLaunched();

View file

@ -11,7 +11,7 @@ import {
} from '../services/userPreference';
import { setIsAppQuitting } from '../main';
import autoLauncher from '../services/autoLauncher';
import { isPlatform } from './main';
import { isPlatform } from './common/platform';
import ElectronLog from 'electron-log';
export function buildContextMenu(