Merge pull request #156 from ente-io/update-export-apis
Remove export tray functionality APIs
This commit is contained in:
commit
d19378c8e3
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "ente",
|
||||
"productName": "ente",
|
||||
"version": "1.6.23",
|
||||
"version": "1.6.24-alpha.2",
|
||||
"private": true,
|
||||
"description": "Desktop client for ente.io",
|
||||
"main": "app/main.js",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { readTextFile, writeStream } from './../services/fs';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { logError } from '../services/logging';
|
||||
import * as fs from 'promise-fs';
|
||||
|
||||
|
@ -48,25 +47,3 @@ export const getExportRecord = async (filePath: string) => {
|
|||
export const setExportRecord = async (filePath: string, data: string) => {
|
||||
await fs.writeFile(filePath, data);
|
||||
};
|
||||
|
||||
export const registerResumeExportListener = (resumeExport: () => void) => {
|
||||
ipcRenderer.removeAllListeners('resume-export');
|
||||
ipcRenderer.on('resume-export', () => resumeExport());
|
||||
};
|
||||
|
||||
export const registerStopExportListener = (abortExport: () => void) => {
|
||||
ipcRenderer.removeAllListeners('stop-export');
|
||||
ipcRenderer.on('stop-export', () => abortExport());
|
||||
};
|
||||
|
||||
export const registerPauseExportListener = (pauseExport: () => void) => {
|
||||
ipcRenderer.removeAllListeners('pause-export');
|
||||
ipcRenderer.on('pause-export', () => pauseExport());
|
||||
};
|
||||
|
||||
export const registerRetryFailedExportListener = (
|
||||
retryFailedExport: () => void
|
||||
) => {
|
||||
ipcRenderer.removeAllListeners('retry-export');
|
||||
ipcRenderer.on('retry-export', () => retryFailedExport());
|
||||
};
|
||||
|
|
|
@ -4,9 +4,6 @@ import { AppUpdateInfo } from '../types';
|
|||
export const sendNotification = (content: string) => {
|
||||
ipcRenderer.send('send-notification', content);
|
||||
};
|
||||
export const showOnTray = (content: string) => {
|
||||
ipcRenderer.send('update-tray', content);
|
||||
};
|
||||
export const reloadWindow = () => {
|
||||
ipcRenderer.send('reload-window');
|
||||
};
|
||||
|
|
|
@ -2,7 +2,6 @@ import {
|
|||
registerUpdateEventListener,
|
||||
reloadWindow,
|
||||
sendNotification,
|
||||
showOnTray,
|
||||
updateAndRestart,
|
||||
skipAppUpdate,
|
||||
muteUpdateNotification,
|
||||
|
@ -33,10 +32,6 @@ import {
|
|||
checkExistsAndRename,
|
||||
saveStreamToDisk,
|
||||
saveFileToDisk,
|
||||
registerResumeExportListener,
|
||||
registerStopExportListener,
|
||||
registerPauseExportListener,
|
||||
registerRetryFailedExportListener,
|
||||
getExportRecord,
|
||||
setExportRecord,
|
||||
exists,
|
||||
|
@ -73,12 +68,7 @@ windowObject['ElectronAPIs'] = {
|
|||
selectRootDirectory,
|
||||
clearElectronStore,
|
||||
sendNotification,
|
||||
showOnTray,
|
||||
reloadWindow,
|
||||
registerResumeExportListener,
|
||||
registerStopExportListener,
|
||||
registerPauseExportListener,
|
||||
registerRetryFailedExportListener,
|
||||
getExportRecord,
|
||||
setExportRecord,
|
||||
showUploadFilesDialog,
|
||||
|
|
|
@ -9,7 +9,6 @@ import {
|
|||
shell,
|
||||
} from 'electron';
|
||||
import { createWindow } from './createWindow';
|
||||
import { buildContextMenu } from './menu';
|
||||
import { getSentryUserID, logErrorSentry } from '../services/sentry';
|
||||
import chokidar from 'chokidar';
|
||||
import path from 'path';
|
||||
|
@ -41,10 +40,6 @@ export default function setupIpcComs(
|
|||
}
|
||||
});
|
||||
|
||||
ipcMain.on('update-tray', (_, args) => {
|
||||
tray.setContextMenu(buildContextMenu(mainWindow, args));
|
||||
});
|
||||
|
||||
ipcMain.on('send-notification', (_, args) => {
|
||||
const notification = {
|
||||
title: 'ente',
|
||||
|
|
|
@ -14,60 +14,9 @@ import autoLauncher from '../services/autoLauncher';
|
|||
import { isPlatform } from './common/platform';
|
||||
import ElectronLog from 'electron-log';
|
||||
|
||||
export function buildContextMenu(
|
||||
mainWindow: BrowserWindow,
|
||||
args: any = {}
|
||||
): Menu {
|
||||
export function buildContextMenu(mainWindow: BrowserWindow): Menu {
|
||||
// eslint-disable-next-line camelcase
|
||||
const {
|
||||
export_progress: exportProgress,
|
||||
retry_export: retryExport,
|
||||
paused,
|
||||
} = args;
|
||||
const contextMenu = Menu.buildFromTemplate([
|
||||
...(exportProgress
|
||||
? [
|
||||
{
|
||||
label: exportProgress,
|
||||
click: () => mainWindow.show(),
|
||||
},
|
||||
...(paused
|
||||
? [
|
||||
{
|
||||
label: 'Resume export',
|
||||
click: () =>
|
||||
mainWindow.webContents.send(
|
||||
'resume-export'
|
||||
),
|
||||
},
|
||||
]
|
||||
: [
|
||||
{
|
||||
label: 'Pause export',
|
||||
click: () =>
|
||||
mainWindow.webContents.send('pause-export'),
|
||||
},
|
||||
{
|
||||
label: 'Stop export',
|
||||
click: () =>
|
||||
mainWindow.webContents.send('stop-export'),
|
||||
},
|
||||
]),
|
||||
]
|
||||
: []),
|
||||
...(retryExport
|
||||
? [
|
||||
{
|
||||
label: 'Export failed',
|
||||
click: null,
|
||||
},
|
||||
{
|
||||
label: 'Retry export',
|
||||
click: () => mainWindow.webContents.send('retry-export'),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: 'Open ente',
|
||||
click: function () {
|
||||
|
|
2
ui
2
ui
|
@ -1 +1 @@
|
|||
Subproject commit 11259ea152b6196f4cc17690a5738aef4cd098d3
|
||||
Subproject commit f31d94e2cb98fad8a8d15f03185ea1c4b60d5cf4
|
Loading…
Reference in a new issue