moved isPlatform util to common/platform
This commit is contained in:
parent
e0dd061259
commit
41e784aa6f
|
@ -12,7 +12,7 @@ import {
|
||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { logErrorSentry } from './sentry';
|
import { logErrorSentry } from './sentry';
|
||||||
import ElectronLog from 'electron-log';
|
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 FIVE_MIN_IN_MICROSECOND = 5 * 60 * 1000;
|
||||||
const ONE_DAY_IN_MICROSECOND = 1 * 24 * 60 * 60 * 1000;
|
const ONE_DAY_IN_MICROSECOND = 1 * 24 * 60 * 60 * 1000;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { isPlatform } from '../utils/main';
|
import { isPlatform } from '../utils/common/platform';
|
||||||
import { AutoLauncherClient } from '../types/autoLauncher';
|
import { AutoLauncherClient } from '../types/autoLauncher';
|
||||||
import linuxAutoLauncher from './autoLauncherClients/linuxAutoLauncher';
|
import linuxAutoLauncher from './autoLauncherClients/linuxAutoLauncher';
|
||||||
import macAndWindowsAutoLauncher from './autoLauncherClients/macAndWindowsAutoLauncher';
|
import macAndWindowsAutoLauncher from './autoLauncherClients/macAndWindowsAutoLauncher';
|
||||||
|
|
11
src/utils/common/platform.ts
Normal file
11
src/utils/common/platform.ts
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ import * as path from 'path';
|
||||||
import { isDev } from './common';
|
import { isDev } from './common';
|
||||||
import { isAppQuitting } from '../main';
|
import { isAppQuitting } from '../main';
|
||||||
import { PROD_HOST_URL } from '../config';
|
import { PROD_HOST_URL } from '../config';
|
||||||
import { isPlatform } from './main';
|
import { isPlatform } from './common/platform';
|
||||||
import { getHideDockIconPreference } from '../services/userPreference';
|
import { getHideDockIconPreference } from '../services/userPreference';
|
||||||
import autoLauncher from '../services/autoLauncher';
|
import autoLauncher from '../services/autoLauncher';
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { getHideDockIconPreference } from '../services/userPreference';
|
||||||
import { setupAutoUpdater } from '../services/appUpdater';
|
import { setupAutoUpdater } from '../services/appUpdater';
|
||||||
import ElectronLog from 'electron-log';
|
import ElectronLog from 'electron-log';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
import { isPlatform } from './common/platform';
|
||||||
|
|
||||||
export function handleUpdates(mainWindow: BrowserWindow) {
|
export function handleUpdates(mainWindow: BrowserWindow) {
|
||||||
if (!isDev) {
|
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() {
|
export async function handleDockIconHideOnAutoLaunch() {
|
||||||
const shouldHideDockIcon = getHideDockIconPreference();
|
const shouldHideDockIcon = getHideDockIconPreference();
|
||||||
const wasAutoLaunched = await autoLauncher.wasAutoLaunched();
|
const wasAutoLaunched = await autoLauncher.wasAutoLaunched();
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
} from '../services/userPreference';
|
} from '../services/userPreference';
|
||||||
import { setIsAppQuitting } from '../main';
|
import { setIsAppQuitting } from '../main';
|
||||||
import autoLauncher from '../services/autoLauncher';
|
import autoLauncher from '../services/autoLauncher';
|
||||||
import { isPlatform } from './main';
|
import { isPlatform } from './common/platform';
|
||||||
import ElectronLog from 'electron-log';
|
import ElectronLog from 'electron-log';
|
||||||
|
|
||||||
export function buildContextMenu(
|
export function buildContextMenu(
|
||||||
|
|
Loading…
Reference in a new issue