Refactor: Move data-access code to Typescript w/ shared interface

This commit is contained in:
Scott Nonnenberg 2020-04-01 11:59:11 -07:00
parent 9ab54b9b83
commit 6b094e1514
35 changed files with 1695 additions and 598 deletions

View file

@ -27,26 +27,8 @@ import { Dialogs } from '../types/Dialogs';
import * as packageJson from '../../package.json';
import { getSignatureFileName } from './signature';
export type LocaleType = {
i18n: (key: string, placeholders: Array<string>) => string;
messages: {
[key: string]: {
message: string;
description?: string;
};
};
};
type LogFunction = (...args: Array<any>) => void;
export type LoggerType = {
fatal: LogFunction;
error: LogFunction;
warn: LogFunction;
info: LogFunction;
debug: LogFunction;
trace: LogFunction;
};
import { LocaleType } from '../types/I18N';
import { LoggerType } from '../types/Logging';
const writeFile = pify(writeFileCallback);
const mkdirpPromise = pify(mkdirp);

View file

@ -3,7 +3,8 @@ import { BrowserWindow } from 'electron';
import { start as startMacOS } from './macos';
import { start as startWindows } from './windows';
import { LocaleType, LoggerType } from './common';
import { LocaleType } from '../types/I18N';
import { LoggerType } from '../types/Logging';
let initialized = false;

View file

@ -15,11 +15,11 @@ import {
deleteTempDir,
downloadUpdate,
getPrintableError,
LocaleType,
LoggerType,
showCannotUpdateDialog,
showUpdateDialog,
} from './common';
import { LocaleType } from '../types/I18N';
import { LoggerType } from '../types/Logging';
import { hexToBinary, verifySignature } from './signature';
import { markShouldQuit } from '../../app/window_state';
import { Dialogs } from '../types/Dialogs';

View file

@ -12,11 +12,11 @@ import {
deleteTempDir,
downloadUpdate,
getPrintableError,
LocaleType,
LoggerType,
showCannotUpdateDialog,
showUpdateDialog,
} from './common';
import { LocaleType } from '../types/I18N';
import { LoggerType } from '../types/Logging';
import { hexToBinary, verifySignature } from './signature';
import { markShouldQuit } from '../../app/window_state';