Merge pull request #156 from ente-io/update-export-apis

Remove export tray functionality APIs
This commit is contained in:
Abhinav Kumar 2023-03-23 14:21:51 +05:30 committed by GitHub
commit d19378c8e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 3 additions and 95 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "ente", "name": "ente",
"productName": "ente", "productName": "ente",
"version": "1.6.23", "version": "1.6.24-alpha.2",
"private": true, "private": true,
"description": "Desktop client for ente.io", "description": "Desktop client for ente.io",
"main": "app/main.js", "main": "app/main.js",

View file

@ -1,5 +1,4 @@
import { readTextFile, writeStream } from './../services/fs'; import { readTextFile, writeStream } from './../services/fs';
import { ipcRenderer } from 'electron';
import { logError } from '../services/logging'; import { logError } from '../services/logging';
import * as fs from 'promise-fs'; import * as fs from 'promise-fs';
@ -48,25 +47,3 @@ export const getExportRecord = async (filePath: string) => {
export const setExportRecord = async (filePath: string, data: string) => { export const setExportRecord = async (filePath: string, data: string) => {
await fs.writeFile(filePath, data); 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());
};

View file

@ -4,9 +4,6 @@ import { AppUpdateInfo } from '../types';
export const sendNotification = (content: string) => { export const sendNotification = (content: string) => {
ipcRenderer.send('send-notification', content); ipcRenderer.send('send-notification', content);
}; };
export const showOnTray = (content: string) => {
ipcRenderer.send('update-tray', content);
};
export const reloadWindow = () => { export const reloadWindow = () => {
ipcRenderer.send('reload-window'); ipcRenderer.send('reload-window');
}; };

View file

@ -2,7 +2,6 @@ import {
registerUpdateEventListener, registerUpdateEventListener,
reloadWindow, reloadWindow,
sendNotification, sendNotification,
showOnTray,
updateAndRestart, updateAndRestart,
skipAppUpdate, skipAppUpdate,
muteUpdateNotification, muteUpdateNotification,
@ -33,10 +32,6 @@ import {
checkExistsAndRename, checkExistsAndRename,
saveStreamToDisk, saveStreamToDisk,
saveFileToDisk, saveFileToDisk,
registerResumeExportListener,
registerStopExportListener,
registerPauseExportListener,
registerRetryFailedExportListener,
getExportRecord, getExportRecord,
setExportRecord, setExportRecord,
exists, exists,
@ -73,12 +68,7 @@ windowObject['ElectronAPIs'] = {
selectRootDirectory, selectRootDirectory,
clearElectronStore, clearElectronStore,
sendNotification, sendNotification,
showOnTray,
reloadWindow, reloadWindow,
registerResumeExportListener,
registerStopExportListener,
registerPauseExportListener,
registerRetryFailedExportListener,
getExportRecord, getExportRecord,
setExportRecord, setExportRecord,
showUploadFilesDialog, showUploadFilesDialog,

View file

@ -9,7 +9,6 @@ import {
shell, shell,
} from 'electron'; } from 'electron';
import { createWindow } from './createWindow'; import { createWindow } from './createWindow';
import { buildContextMenu } from './menu';
import { getSentryUserID, logErrorSentry } from '../services/sentry'; import { getSentryUserID, logErrorSentry } from '../services/sentry';
import chokidar from 'chokidar'; import chokidar from 'chokidar';
import path from 'path'; 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) => { ipcMain.on('send-notification', (_, args) => {
const notification = { const notification = {
title: 'ente', title: 'ente',

View file

@ -14,60 +14,9 @@ import autoLauncher from '../services/autoLauncher';
import { isPlatform } from './common/platform'; import { isPlatform } from './common/platform';
import ElectronLog from 'electron-log'; import ElectronLog from 'electron-log';
export function buildContextMenu( export function buildContextMenu(mainWindow: BrowserWindow): Menu {
mainWindow: BrowserWindow,
args: any = {}
): Menu {
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase
const {
export_progress: exportProgress,
retry_export: retryExport,
paused,
} = args;
const contextMenu = Menu.buildFromTemplate([ 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', label: 'Open ente',
click: function () { click: function () {

2
ui

@ -1 +1 @@
Subproject commit 11259ea152b6196f4cc17690a5738aef4cd098d3 Subproject commit f31d94e2cb98fad8a8d15f03185ea1c4b60d5cf4