refactor: add icons package (#1078)

This commit is contained in:
Mo
2022-06-09 14:55:00 -05:00
committed by GitHub
parent e15441c8f7
commit 640e9a9c07
250 changed files with 3317 additions and 2507 deletions

View File

@@ -1,10 +1,12 @@
import { dialog, WebContents, shell } from 'electron'
import { dialog, shell, WebContents } from 'electron'
import { promises as fs } from 'fs'
import path from 'path'
import { AppMessageType, MessageType } from '../../../../test/TestIpcMessage'
import { AppState } from '../../../application'
import { MessageToWebApp } from '../../Shared/IpcMessages'
import { BackupsManagerInterface } from './BackupsManagerInterface'
import { StoreKeys } from '../Store'
import { backups as str } from '../Strings'
import { Paths } from '../Types/Paths'
import {
deleteDir,
deleteDirContents,
@@ -13,11 +15,9 @@ import {
moveFiles,
openDirectoryPicker,
} from '../Utils/FileUtils'
import { Paths } from '../Types/Paths'
import { StoreKeys } from '../Store'
import { backups as str } from '../Strings'
import { handleTestMessage, send } from '../Utils/Testing'
import { isTesting, last } from '../Utils/Utils'
import { BackupsManagerInterface } from './BackupsManagerInterface'
function log(...message: any) {
console.log('BackupsManager:', ...message)

View File

@@ -3,9 +3,9 @@ import http, { IncomingMessage, ServerResponse } from 'http'
import mime from 'mime-types'
import path from 'path'
import { URL } from 'url'
import { FileDoesNotExist } from './Utils/FileUtils'
import { Paths } from './Types/Paths'
import { extensions as str } from './Strings'
import { Paths } from './Types/Paths'
import { FileDoesNotExist } from './Utils/FileUtils'
const Protocol = 'http'

View File

@@ -1,5 +1,6 @@
import { FileBackupsDevice, FileBackupsMapping } from '@web/Application/Device/DesktopSnjsExports'
import { AppState } from 'app/application'
import { shell } from 'electron'
import { StoreKeys } from '../Store'
import {
ensureDirectoryExists,
@@ -10,7 +11,6 @@ import {
writeJSONFile,
} from '../Utils/FileUtils'
import { FileDownloader } from './FileDownloader'
import { shell } from 'electron'
export const FileBackupsConstantsV1 = {
Version: '1.0.0',

View File

@@ -1,4 +1,4 @@
import { WriteStream, createWriteStream } from 'fs'
import { createWriteStream, WriteStream } from 'fs'
import { downloadData } from './FileNetworking'
export class FileDownloader {

View File

@@ -1,5 +1,5 @@
import axios, { AxiosRequestHeaders, AxiosResponseHeaders } from 'axios'
import { WriteStream } from 'fs'
import axios, { AxiosResponseHeaders, AxiosRequestHeaders } from 'axios'
export async function downloadData(
writeStream: WriteStream,

View File

@@ -1,12 +1,12 @@
import { app, BrowserWindow, ipcMain } from 'electron'
import keytar from 'keytar'
import { isLinux } from '../Types/Platforms'
import { MessageToMainProcess } from '../../Shared/IpcMessages'
import { Store, StoreKeys } from '../Store'
import { AppName } from '../Strings'
import { keychainAccessIsUserConfigurable } from '../Types/Constants'
import { Paths, Urls } from '../Types/Paths'
import { isLinux } from '../Types/Platforms'
import { isDev, isTesting } from '../Utils/Utils'
import { MessageToMainProcess } from '../../Shared/IpcMessages'
import { Urls, Paths } from '../Types/Paths'
import { Store, StoreKeys } from '../Store'
import { KeychainInterface } from './KeychainInterface'
const ServiceName = isTesting() ? AppName + ' (Testing)' : isDev() ? AppName + ' (Development)' : AppName

View File

@@ -10,17 +10,17 @@ import {
WebContents,
} from 'electron'
import { autorun } from 'mobx'
import { autoUpdatingAvailable } from '../Types/Constants'
import { isLinux, isMac } from '../Types/Platforms'
import { Store, StoreKeys } from '../Store'
import { appMenu as str, contextMenu } from '../Strings'
import { handleTestMessage } from '../Utils/Testing'
import { TrayManager } from '../TrayManager'
import { SpellcheckerManager } from './../SpellcheckerManager'
import { BackupsManagerInterface } from './../Backups/BackupsManagerInterface'
import { MessageType } from './../../../../test/TestIpcMessage'
import { autoUpdatingAvailable } from '../Types/Constants'
import { isLinux, isMac } from '../Types/Platforms'
import { checkForUpdate, openChangelog, showUpdateInstallationDialog } from '../UpdateManager'
import { handleTestMessage } from '../Utils/Testing'
import { isDev, isTesting } from '../Utils/Utils'
import { MessageType } from './../../../../test/TestIpcMessage'
import { BackupsManagerInterface } from './../Backups/BackupsManagerInterface'
import { SpellcheckerManager } from './../SpellcheckerManager'
import { MenuManagerInterface } from './MenuManagerInterface'
export const enum MenuId {

View File

@@ -1,7 +1,10 @@
import compareVersions from 'compare-versions'
import log from 'electron-log'
import fs from 'fs'
import path from 'path'
import { MessageToWebApp } from '../../Shared/IpcMessages'
import { AppName } from '../Strings'
import { Paths } from '../Types/Paths'
import {
debouncedJSONDiskWriter,
deleteDir,
@@ -11,12 +14,9 @@ import {
FileDoesNotExist,
readJSONFile,
} from '../Utils/FileUtils'
import { downloadFile, getJSON } from './Networking'
import { Paths } from '../Types/Paths'
import { AppName } from '../Strings'
import { timeout } from '../Utils/Utils'
import log from 'electron-log'
import { Component, MappingFile, PackageManagerInterface, SyncTask, PackageInfo } from './PackageManagerInterface'
import { downloadFile, getJSON } from './Networking'
import { Component, MappingFile, PackageInfo, PackageManagerInterface, SyncTask } from './PackageManagerInterface'
function logMessage(...message: any) {
log.info('PackageManager:', ...message)

View File

@@ -4,14 +4,14 @@ import { Store, StoreKeys } from '../Store'
const path = require('path')
const rendererPath = path.join('file://', __dirname, '/renderer.js')
import { FileBackupsDevice, FileBackupsMapping } from '@web/Application/Device/DesktopSnjsExports'
import { app, BrowserWindow } from 'electron'
import { KeychainInterface } from '../Keychain/KeychainInterface'
import { BackupsManagerInterface } from '../Backups/BackupsManagerInterface'
import { PackageManagerInterface, Component } from '../Packages/PackageManagerInterface'
import { KeychainInterface } from '../Keychain/KeychainInterface'
import { MenuManagerInterface } from '../Menus/MenuManagerInterface'
import { Component, PackageManagerInterface } from '../Packages/PackageManagerInterface'
import { SearchManagerInterface } from '../Search/SearchManagerInterface'
import { RemoteDataInterface } from './DataInterface'
import { MenuManagerInterface } from '../Menus/MenuManagerInterface'
import { FileBackupsDevice, FileBackupsMapping } from '@web/Application/Device/DesktopSnjsExports'
/**
* Read https://github.com/electron/remote to understand how electron/remote works.

View File

@@ -1,6 +1,6 @@
/* eslint-disable no-inline-comments */
import { isMac } from './Types/Platforms'
import { Store, StoreKeys } from './Store'
import { isMac } from './Types/Platforms'
import { isDev } from './Utils/Utils'
export enum Language {

View File

@@ -1,11 +1,11 @@
import fs from 'fs'
import path from 'path'
import { MessageType } from '../../../test/TestIpcMessage'
import { Language } from './SpellcheckerManager'
import { ensureIsBoolean, isTesting, isDev, isBoolean } from './Utils/Utils'
import { FileDoesNotExist } from './Utils/FileUtils'
import { BackupsDirectoryName } from './Backups/BackupsManager'
import { Language } from './SpellcheckerManager'
import { FileDoesNotExist } from './Utils/FileUtils'
import { handleTestMessage } from './Utils/Testing'
import { ensureIsBoolean, isBoolean, isDev, isTesting } from './Utils/Utils'
const app = process.type === 'browser' ? require('electron').app : require('@electron/remote').app

View File

@@ -1,6 +1,6 @@
import { Strings } from './types'
import { createEnglishStrings } from './english'
import { isDev } from '../Utils/Utils'
import { createEnglishStrings } from './english'
import { Strings } from './types'
export function createFrenchStrings(): Strings {
const fallback = createEnglishStrings()

View File

@@ -1,7 +1,7 @@
import { isDev } from '../Utils/Utils'
import { createEnglishStrings } from './english'
import { createFrenchStrings } from './french'
import { Strings } from './types'
import { isDev } from '../Utils/Utils'
let strings: Strings

View File

@@ -1,8 +1,8 @@
import { Menu, Tray } from 'electron'
import path from 'path'
import { isLinux, isWindows } from './Types/Platforms'
import { Store, StoreKeys } from './Store'
import { AppName, tray as str } from './Strings'
import { isLinux, isWindows } from './Types/Platforms'
import { isDev } from './Utils/Utils'
const icon = path.join(__dirname, '/icon/Icon-256x256.png')

View File

@@ -1,8 +1,8 @@
import path from 'path'
import index from '../../../index.html'
import grantLinuxPasswordsAccess from '../../../grantLinuxPasswordsAccess.html'
import decryptScript from 'decrypt/dist/decrypt.html'
import { app } from 'electron'
import path from 'path'
import grantLinuxPasswordsAccess from '../../../grantLinuxPasswordsAccess.html'
import index from '../../../index.html'
function url(fileName: string): string {
if ('APP_RELATIVE_PATH' in process.env) {

View File

@@ -3,12 +3,12 @@ import { BrowserWindow, dialog, shell } from 'electron'
import electronLog from 'electron-log'
import { autoUpdater } from 'electron-updater'
import { action, autorun, computed, makeObservable, observable } from 'mobx'
import { autoUpdatingAvailable } from './Types/Constants'
import { MessageType } from '../../../test/TestIpcMessage'
import { AppState } from '../../application'
import { BackupsManagerInterface } from './Backups/BackupsManagerInterface'
import { StoreKeys } from './Store'
import { updates as str } from './Strings'
import { autoUpdatingAvailable } from './Types/Constants'
import { handleTestMessage } from './Utils/Testing'
import { isTesting } from './Utils/Utils'

View File

@@ -1,9 +1,9 @@
import { dialog } from 'electron'
import fs, { PathLike } from 'fs'
import { debounce } from 'lodash'
import path from 'path'
import yauzl from 'yauzl'
import { removeFromArray } from '../Utils/Utils'
import { dialog } from 'electron'
export const FileDoesNotExist = 'ENOENT'
export const FileAlreadyExists = 'EEXIST'

View File

@@ -1,3 +1,4 @@
import { clearSensitiveDirectories } from '@standardnotes/electron-clear-data'
import { BrowserWindow, Rectangle, screen, Shell } from 'electron'
import fs from 'fs'
import { debounce } from 'lodash'
@@ -7,23 +8,22 @@ import { AppState } from '../../application'
import { MessageToWebApp } from '../Shared/IpcMessages'
import { createBackupsManager } from './Backups/BackupsManager'
import { BackupsManagerInterface } from './Backups/BackupsManagerInterface'
import { FilesBackupManager } from './FileBackups/FileBackupsManager'
import { Keychain } from './Keychain/Keychain'
import { MenuManagerInterface } from './Menus/MenuManagerInterface'
import { buildContextMenu, createMenuManager } from './Menus/Menus'
import { initializePackageManager } from './Packages/PackageManager'
import { isMac, isWindows } from './Types/Platforms'
import { RemoteBridge } from './Remote/RemoteBridge'
import { initializeSearchManager } from './Search/SearchManager'
import { createSpellcheckerManager } from './SpellcheckerManager'
import { Store, StoreKeys } from './Store'
import { handleTestMessage, send } from './Utils/Testing'
import { createTrayManager, TrayManager } from './TrayManager'
import { Paths } from './Types/Paths'
import { isMac, isWindows } from './Types/Platforms'
import { checkForUpdate, setupUpdates } from './UpdateManager'
import { handleTestMessage, send } from './Utils/Testing'
import { isTesting, lowercaseDriveLetter } from './Utils/Utils'
import { initializeZoomManager } from './ZoomManager'
import { Paths } from './Types/Paths'
import { clearSensitiveDirectories } from '@standardnotes/electron-clear-data'
import { RemoteBridge } from './Remote/RemoteBridge'
import { Keychain } from './Keychain/Keychain'
import { MenuManagerInterface } from './Menus/MenuManagerInterface'
import { FilesBackupManager } from './FileBackups/FileBackupsManager'
const WINDOW_DEFAULT_WIDTH = 1100
const WINDOW_DEFAULT_HEIGHT = 800

View File

@@ -1,5 +1,5 @@
import { Component } from '../Main/Packages/PackageManagerInterface'
import { FileBackupsDevice } from '@web/Application/Device/DesktopSnjsExports'
import { Component } from '../Main/Packages/PackageManagerInterface'
export interface CrossProcessBridge extends FileBackupsDevice {
get extServerHost(): string

View File

@@ -1,11 +1,11 @@
import {
DesktopDeviceInterface,
Environment,
FileBackupsMapping,
RawKeychainValue,
} from '@web/Application/Device/DesktopSnjsExports'
import { WebOrDesktopDevice } from '@web/Application/Device/WebOrDesktopDevice'
import { Component } from '../Main/Packages/PackageManagerInterface'
import {
RawKeychainValue,
Environment,
DesktopDeviceInterface,
FileBackupsMapping,
} from '@web/Application/Device/DesktopSnjsExports'
import { CrossProcessBridge } from './CrossProcessBridge'
const FallbackLocalStorageKey = 'keychain'

View File

@@ -1,8 +1,8 @@
import { DesktopDevice } from './DesktopDevice'
import { MessageToWebApp } from '../Shared/IpcMessages'
import { DesktopClientRequiresWebMethods } from '@web/Application/Device/DesktopSnjsExports'
import { StartApplication } from '@web/Application/Device/StartApplication'
import { MessageToWebApp } from '../Shared/IpcMessages'
import { CrossProcessBridge } from './CrossProcessBridge'
import { DesktopDevice } from './DesktopDevice'
declare const DEFAULT_SYNC_SERVER: string
declare const WEBSOCKET_URL: string