mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
SDA API calls logging (#1295)
* API calls logging improvement * Electron update
This commit is contained in:
parent
fb2c866483
commit
a1ac758e9b
16
package-lock.json
generated
16
package-lock.json
generated
@ -5936,9 +5936,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"electron": {
|
"electron": {
|
||||||
"version": "14.1.1",
|
"version": "14.2.1",
|
||||||
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-14.1.1.tgz",
|
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-14.2.1.tgz",
|
||||||
"integrity": "sha1-ZDcm/h/UrXf7s6dbIRAF7QE1dIU=",
|
"integrity": "sha1-7ouc+owErU2UVtqlu6xWLCwlF6E=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@electron/get": "^1.0.1",
|
"@electron/get": "^1.0.1",
|
||||||
@ -5947,9 +5947,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "14.17.19",
|
"version": "14.17.33",
|
||||||
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/@types/node/-/node-14.17.19.tgz",
|
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/@types/node/-/node-14.17.33.tgz",
|
||||||
"integrity": "sha1-c0HprBtddI16PdwEM27VNqb5HDE=",
|
"integrity": "sha1-AR7ijjjceu4b4DLOrfYzKgqxWxI=",
|
||||||
"dev": true
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -15158,8 +15158,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"screen-snippet": {
|
"screen-snippet": {
|
||||||
"version": "git+ssh://git@github.com/symphonyoss/ScreenSnippet2.git#889aedbd3ecf16320a387967aaee0e7ca992d717",
|
"version": "git+https://github.com/symphonyoss/ScreenSnippet2.git#63071f24d6539598cef436daadf659c6d3fa3661",
|
||||||
"from": "screen-snippet@git+https://github.com/symphonyoss/ScreenSnippet2.git#v2.4.0",
|
"from": "git+https://github.com/symphonyoss/ScreenSnippet2.git#9.2.2",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"semver": {
|
"semver": {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
"compile:project": "gulp build",
|
"compile:project": "gulp build",
|
||||||
"compile:spec": "tsc -p tsconfig.spec.json",
|
"compile:spec": "tsc -p tsconfig.spec.json",
|
||||||
"compile:robot": "npm rebuild --build-from-source robotjs",
|
"compile:robot": "npm rebuild --build-from-source robotjs",
|
||||||
"dev": "npm run prebuild && cross-env ELECTRON_DEV=true electron .",
|
"dev": "gulp build && npm run browserify && cross-env ELECTRON_DEV=true electron .",
|
||||||
"demo": "run-os",
|
"demo": "run-os",
|
||||||
"demo:win32": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file:///src/demo/index.html",
|
"demo:win32": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file:///src/demo/index.html",
|
||||||
"demo:darwin": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file://$(pwd)/src/demo/index.html",
|
"demo:darwin": "npm run prebuild && cross-env ELECTRON_DEV=true electron . --url=file://$(pwd)/src/demo/index.html",
|
||||||
@ -126,7 +126,7 @@
|
|||||||
"browserify": "16.5.1",
|
"browserify": "16.5.1",
|
||||||
"cross-env": "5.2.0",
|
"cross-env": "5.2.0",
|
||||||
"del": "3.0.0",
|
"del": "3.0.0",
|
||||||
"electron": "14.1.1",
|
"electron": "14.2.1",
|
||||||
"electron-builder": "22.7.0",
|
"electron-builder": "22.7.0",
|
||||||
"electron-builder-squirrel-windows": "20.38.3",
|
"electron-builder-squirrel-windows": "20.38.3",
|
||||||
"electron-icon-maker": "0.0.4",
|
"electron-icon-maker": "0.0.4",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { app, powerMonitor } from 'electron';
|
import { app, powerMonitor, WebContents } from 'electron';
|
||||||
import Timer = NodeJS.Timer;
|
import Timer = NodeJS.Timer;
|
||||||
|
|
||||||
import { logger } from '../common/logger';
|
import { logger } from '../common/logger';
|
||||||
@ -6,7 +6,7 @@ import { windowHandler } from './window-handler';
|
|||||||
|
|
||||||
class ActivityDetection {
|
class ActivityDetection {
|
||||||
private idleThreshold: number;
|
private idleThreshold: number;
|
||||||
private window: Electron.WebContents | null;
|
private window: WebContents | null;
|
||||||
private timer: Timer | undefined;
|
private timer: Timer | undefined;
|
||||||
private queryInterval: NodeJS.Timer | undefined;
|
private queryInterval: NodeJS.Timer | undefined;
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ class ActivityDetection {
|
|||||||
* @param idleThreshold {number}
|
* @param idleThreshold {number}
|
||||||
*/
|
*/
|
||||||
public setWindowAndThreshold(
|
public setWindowAndThreshold(
|
||||||
window: Electron.WebContents,
|
window: WebContents,
|
||||||
idleThreshold: number,
|
idleThreshold: number,
|
||||||
): void {
|
): void {
|
||||||
this.window = window;
|
this.window = window;
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
|
import { WebContents } from 'electron';
|
||||||
|
|
||||||
export interface IAnalyticsData {
|
export interface IAnalyticsData {
|
||||||
element: AnalyticsElements;
|
element: AnalyticsElements;
|
||||||
action_type?: MenuActionTypes | ScreenSnippetActionTypes | ToastNotificationActionTypes;
|
action_type?:
|
||||||
|
| MenuActionTypes
|
||||||
|
| ScreenSnippetActionTypes
|
||||||
|
| ToastNotificationActionTypes;
|
||||||
action_result?: AnalyticsActions;
|
action_result?: AnalyticsActions;
|
||||||
extra_data?: object;
|
extra_data?: object;
|
||||||
}
|
}
|
||||||
@ -56,15 +61,15 @@ const MAX_EVENT_QUEUE_LENGTH = 50;
|
|||||||
const analyticsCallback = 'analytics-callback';
|
const analyticsCallback = 'analytics-callback';
|
||||||
|
|
||||||
class Analytics {
|
class Analytics {
|
||||||
private preloadWindow: Electron.webContents | undefined;
|
private preloadWindow: WebContents | undefined;
|
||||||
private analyticsEventQueue: IAnalyticsData[] = [];
|
private analyticsEventQueue: IAnalyticsData[] = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores the reference to the preload window
|
* Stores the reference to the preload window
|
||||||
*
|
*
|
||||||
* @param webContents {Electron.webContents}
|
* @param webContents {WeContents}
|
||||||
*/
|
*/
|
||||||
public registerPreloadWindow(webContents: Electron.webContents): void {
|
public registerPreloadWindow(webContents: WebContents): void {
|
||||||
this.preloadWindow = webContents;
|
this.preloadWindow = webContents;
|
||||||
|
|
||||||
if (!(this.preloadWindow && !this.preloadWindow.isDestroyed())) {
|
if (!(this.preloadWindow && !this.preloadWindow.isDestroyed())) {
|
||||||
|
@ -110,6 +110,7 @@ class CrashHandler {
|
|||||||
`crash-handler: Renderer process crash event processed with data ${JSON.stringify(
|
`crash-handler: Renderer process crash event processed with data ${JSON.stringify(
|
||||||
eventData,
|
eventData,
|
||||||
)}`,
|
)}`,
|
||||||
|
details,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { BrowserWindow, dialog, shell } from 'electron';
|
import { BrowserWindow, dialog, shell, WebContents } from 'electron';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { i18n } from '../common/i18n';
|
import { i18n } from '../common/i18n';
|
||||||
import { logger } from '../common/logger';
|
import { logger } from '../common/logger';
|
||||||
@ -35,14 +35,14 @@ class DownloadHandler {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private window!: Electron.WebContents | null;
|
private window!: WebContents | null;
|
||||||
private items: IDownloadItem[] = [];
|
private items: IDownloadItem[] = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the window for the download handler
|
* Sets the window for the download handler
|
||||||
* @param window Window object
|
* @param window Window object
|
||||||
*/
|
*/
|
||||||
public setWindow(window: Electron.WebContents): void {
|
public setWindow(window: WebContents): void {
|
||||||
this.window = window;
|
this.window = window;
|
||||||
logger.info(`download-handler: Initialized download handler`);
|
logger.info(`download-handler: Initialized download handler`);
|
||||||
}
|
}
|
||||||
|
@ -83,10 +83,7 @@ ipcMain.on(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.info(
|
logApiCallParams(arg);
|
||||||
`main-api-handler: API call received - ${arg.cmd} - Properties:`,
|
|
||||||
arg,
|
|
||||||
);
|
|
||||||
switch (arg.cmd) {
|
switch (arg.cmd) {
|
||||||
case apiCmds.isOnline:
|
case apiCmds.isOnline:
|
||||||
if (typeof arg.isOnline === 'boolean') {
|
if (typeof arg.isOnline === 'boolean') {
|
||||||
@ -440,3 +437,82 @@ ipcMain.handle(
|
|||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log API call parameters.
|
||||||
|
*/
|
||||||
|
const logApiCallParams = (arg: any) => {
|
||||||
|
const apiCmd = arg.cmd;
|
||||||
|
switch (apiCmd) {
|
||||||
|
case apiCmds.showNotification:
|
||||||
|
const title = 'hidden';
|
||||||
|
const body = 'hidden';
|
||||||
|
const notificationDetails: INotificationData = {
|
||||||
|
...arg.notificationOpts,
|
||||||
|
title,
|
||||||
|
body,
|
||||||
|
};
|
||||||
|
logger.info(
|
||||||
|
`main-api-handler: - ${apiCmd} - Properties: ${JSON.stringify(
|
||||||
|
notificationDetails,
|
||||||
|
null,
|
||||||
|
2,
|
||||||
|
)}`,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case apiCmds.badgeDataUrl:
|
||||||
|
const dataUrl = 'hidden';
|
||||||
|
const badgeDataUrlDetails = {
|
||||||
|
...arg,
|
||||||
|
dataUrl,
|
||||||
|
};
|
||||||
|
logger.info(
|
||||||
|
`main-api-handler: - ${apiCmd} - Properties: ${JSON.stringify(
|
||||||
|
badgeDataUrlDetails,
|
||||||
|
null,
|
||||||
|
2,
|
||||||
|
)}`,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case apiCmds.openScreenPickerWindow:
|
||||||
|
const sources = arg.sources.map((source: any) => {
|
||||||
|
return {
|
||||||
|
name: source.name,
|
||||||
|
id: source.id,
|
||||||
|
thumbnail: 'hidden',
|
||||||
|
display_id: source.display_id,
|
||||||
|
appIcon: source.appIcon,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const openScreenPickerDetails = {
|
||||||
|
...arg,
|
||||||
|
sources,
|
||||||
|
};
|
||||||
|
logger.info(
|
||||||
|
`main-api-handler: - ${apiCmd} - Properties: ${JSON.stringify(
|
||||||
|
openScreenPickerDetails,
|
||||||
|
null,
|
||||||
|
2,
|
||||||
|
)}`,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case apiCmds.isMisspelled:
|
||||||
|
logger.verbose(
|
||||||
|
`main-api-handler: - ${apiCmd} - Properties: ${JSON.stringify(
|
||||||
|
arg,
|
||||||
|
null,
|
||||||
|
2,
|
||||||
|
)}`,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
logger.info(
|
||||||
|
`main-api-handler: - ${apiCmd} - Properties: ${JSON.stringify(
|
||||||
|
arg,
|
||||||
|
null,
|
||||||
|
2,
|
||||||
|
)}`,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@ -3,7 +3,7 @@ import { WebContents } from 'electron';
|
|||||||
export class MainProcessEvents {
|
export class MainProcessEvents {
|
||||||
private registeredWebContents: Map<string, Set<WebContents>> = new Map<
|
private registeredWebContents: Map<string, Set<WebContents>> = new Map<
|
||||||
string,
|
string,
|
||||||
Set<Electron.WebContents>
|
Set<WebContents>
|
||||||
>();
|
>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { WebContents } from 'electron';
|
||||||
import { apiName } from '../common/api-interface';
|
import { apiName } from '../common/api-interface';
|
||||||
import { isMac } from '../common/env';
|
import { isMac } from '../common/env';
|
||||||
import { logger } from '../common/logger';
|
import { logger } from '../common/logger';
|
||||||
@ -12,7 +13,7 @@ class ProtocolHandler {
|
|||||||
private static isValidProtocolUri = (uri: string): boolean =>
|
private static isValidProtocolUri = (uri: string): boolean =>
|
||||||
!!(uri && uri.startsWith(protocol.SymphonyProtocol));
|
!!(uri && uri.startsWith(protocol.SymphonyProtocol));
|
||||||
|
|
||||||
private preloadWebContents: Electron.WebContents | null = null;
|
private preloadWebContents: WebContents | null = null;
|
||||||
private protocolUri: string | null = null;
|
private protocolUri: string | null = null;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -22,9 +23,9 @@ class ProtocolHandler {
|
|||||||
/**
|
/**
|
||||||
* Stores the web contents of the preload
|
* Stores the web contents of the preload
|
||||||
*
|
*
|
||||||
* @param webContents {Electron.WebContents}
|
* @param webContents {WeContents}
|
||||||
*/
|
*/
|
||||||
public setPreloadWebContents(webContents: Electron.WebContents): void {
|
public setPreloadWebContents(webContents: WebContents): void {
|
||||||
this.preloadWebContents = webContents;
|
this.preloadWebContents = webContents;
|
||||||
logger.info(
|
logger.info(
|
||||||
`protocol handler: SFE is active and we have a valid protocol window with web contents!`,
|
`protocol handler: SFE is active and we have a valid protocol window with web contents!`,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as archiver from 'archiver';
|
import * as archiver from 'archiver';
|
||||||
import { app, BrowserWindow, dialog, shell } from 'electron';
|
import { app, BrowserWindow, dialog, shell, WebContents } from 'electron';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
@ -83,12 +83,12 @@ const generateArchiveForDirectory = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
let logWebContents: Electron.WebContents;
|
let logWebContents: WebContents;
|
||||||
const logTypes: string[] = [];
|
const logTypes: string[] = [];
|
||||||
const receivedLogs: ILogs[] = [];
|
const receivedLogs: ILogs[] = [];
|
||||||
|
|
||||||
export const registerLogRetriever = (
|
export const registerLogRetriever = (
|
||||||
sender: Electron.WebContents,
|
sender: WebContents,
|
||||||
logName: string,
|
logName: string,
|
||||||
): void => {
|
): void => {
|
||||||
logWebContents = sender;
|
logWebContents = sender;
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
import { app, BrowserWindow, ipcMain, nativeImage } from 'electron';
|
import {
|
||||||
|
app,
|
||||||
|
BrowserWindow,
|
||||||
|
ipcMain,
|
||||||
|
nativeImage,
|
||||||
|
WebContents,
|
||||||
|
} from 'electron';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
@ -69,9 +75,9 @@ class ScreenSnippet {
|
|||||||
* Captures a user selected portion of the monitor and returns jpeg image
|
* Captures a user selected portion of the monitor and returns jpeg image
|
||||||
* encoded in base64 format.
|
* encoded in base64 format.
|
||||||
*
|
*
|
||||||
* @param webContents {Electron.webContents}
|
* @param webContents {WeContents}
|
||||||
*/
|
*/
|
||||||
public async capture(webContents: Electron.webContents) {
|
public async capture(webContents: WebContents) {
|
||||||
const mainWindow = windowHandler.getMainWindow();
|
const mainWindow = windowHandler.getMainWindow();
|
||||||
if (mainWindow && windowExists(mainWindow) && isWindowsOS) {
|
if (mainWindow && windowExists(mainWindow) && isWindowsOS) {
|
||||||
this.shouldUpdateAlwaysOnTop = mainWindow.isAlwaysOnTop();
|
this.shouldUpdateAlwaysOnTop = mainWindow.isAlwaysOnTop();
|
||||||
@ -308,7 +314,7 @@ class ScreenSnippet {
|
|||||||
* Uploads a screen snippet
|
* Uploads a screen snippet
|
||||||
* @param webContents A browser window's web contents object
|
* @param webContents A browser window's web contents object
|
||||||
*/
|
*/
|
||||||
private uploadSnippet(webContents: Electron.webContents) {
|
private uploadSnippet(webContents: WebContents) {
|
||||||
ipcMain.once(
|
ipcMain.once(
|
||||||
'upload-snippet',
|
'upload-snippet',
|
||||||
async (
|
async (
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { app, MenuItem } from 'electron';
|
import { app, MenuItem, WebContents } from 'electron';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -47,9 +47,9 @@ export class SpellChecker {
|
|||||||
/**
|
/**
|
||||||
* Attaches context-menu event for every webContents
|
* Attaches context-menu event for every webContents
|
||||||
*
|
*
|
||||||
* @param webContents {Electron.WebContents}
|
* @param webContents {WeContents}
|
||||||
*/
|
*/
|
||||||
public attachToWebContents(webContents: Electron.WebContents): void {
|
public attachToWebContents(webContents: WebContents): void {
|
||||||
const contextMenuBuilder = new ContextMenuBuilder(
|
const contextMenuBuilder = new ContextMenuBuilder(
|
||||||
this.spellCheckHandler,
|
this.spellCheckHandler,
|
||||||
webContents,
|
webContents,
|
||||||
|
@ -3,6 +3,7 @@ import {
|
|||||||
dialog,
|
dialog,
|
||||||
PermissionRequestHandlerHandlerDetails,
|
PermissionRequestHandlerHandlerDetails,
|
||||||
systemPreferences,
|
systemPreferences,
|
||||||
|
WebContents,
|
||||||
} from 'electron';
|
} from 'electron';
|
||||||
|
|
||||||
import { apiName, IBoundsChange, KeyCodes } from '../common/api-interface';
|
import { apiName, IBoundsChange, KeyCodes } from '../common/api-interface';
|
||||||
@ -447,11 +448,9 @@ const handleMediaPermissions = async (
|
|||||||
/**
|
/**
|
||||||
* Sets permission requests for the window
|
* Sets permission requests for the window
|
||||||
*
|
*
|
||||||
* @param webContents {Electron.webContents}
|
* @param webContents {WeContents}
|
||||||
*/
|
*/
|
||||||
export const handlePermissionRequests = (
|
export const handlePermissionRequests = (webContents: WebContents): void => {
|
||||||
webContents: Electron.webContents,
|
|
||||||
): void => {
|
|
||||||
if (!webContents || !webContents.session) {
|
if (!webContents || !webContents.session) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -962,9 +962,9 @@ export class WindowHandler {
|
|||||||
/**
|
/**
|
||||||
* Checks if the window and a key has a window
|
* Checks if the window and a key has a window
|
||||||
*
|
*
|
||||||
* @param webContents {Electron.webContents}
|
* @param webContents {WeContents}
|
||||||
*/
|
*/
|
||||||
public hasView(webContents: Electron.webContents): boolean {
|
public hasView(webContents: WebContents): boolean {
|
||||||
return (
|
return (
|
||||||
webContents === this.mainView?.webContents ||
|
webContents === this.mainView?.webContents ||
|
||||||
webContents === this.titleBarView?.webContents
|
webContents === this.titleBarView?.webContents
|
||||||
@ -1370,7 +1370,7 @@ export class WindowHandler {
|
|||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
public createScreenPickerWindow(
|
public createScreenPickerWindow(
|
||||||
window: Electron.WebContents,
|
window: WebContents,
|
||||||
sources: DesktopCapturerSource[],
|
sources: DesktopCapturerSource[],
|
||||||
id: number,
|
id: number,
|
||||||
): void {
|
): void {
|
||||||
@ -1612,13 +1612,13 @@ export class WindowHandler {
|
|||||||
* Creates a screen sharing indicator whenever uses start
|
* Creates a screen sharing indicator whenever uses start
|
||||||
* sharing the screen
|
* sharing the screen
|
||||||
*
|
*
|
||||||
* @param screenSharingWebContents {Electron.webContents}
|
* @param screenSharingWebContents {WeContents}
|
||||||
* @param displayId {string} - current display id
|
* @param displayId {string} - current display id
|
||||||
* @param id {number} - postMessage request id
|
* @param id {number} - postMessage request id
|
||||||
* @param streamId {string} - MediaStream id
|
* @param streamId {string} - MediaStream id
|
||||||
*/
|
*/
|
||||||
public createScreenSharingIndicatorWindow(
|
public createScreenSharingIndicatorWindow(
|
||||||
screenSharingWebContents: Electron.webContents,
|
screenSharingWebContents: WebContents,
|
||||||
displayId: string,
|
displayId: string,
|
||||||
id: number,
|
id: number,
|
||||||
streamId: string,
|
streamId: string,
|
||||||
|
@ -322,7 +322,7 @@ export const isValidWindow = (
|
|||||||
* @return {Boolean} returns true if exists otherwise false
|
* @return {Boolean} returns true if exists otherwise false
|
||||||
* @param webContents
|
* @param webContents
|
||||||
*/
|
*/
|
||||||
export const isValidView = (webContents: Electron.webContents): boolean => {
|
export const isValidView = (webContents: WebContents): boolean => {
|
||||||
if (!checkValidWindow) {
|
if (!checkValidWindow) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -526,12 +526,12 @@ export const downloadManagerAction = async (type, filePath): Promise<void> => {
|
|||||||
*
|
*
|
||||||
* @param _event
|
* @param _event
|
||||||
* @param item {Electron.DownloadItem}
|
* @param item {Electron.DownloadItem}
|
||||||
* @param webContents {Electron.WebContents}
|
* @param webContents {WeContents}
|
||||||
*/
|
*/
|
||||||
export const handleDownloadManager = (
|
export const handleDownloadManager = (
|
||||||
_event,
|
_event,
|
||||||
item: Electron.DownloadItem,
|
item: Electron.DownloadItem,
|
||||||
webContents: Electron.WebContents,
|
webContents: WebContents,
|
||||||
) => {
|
) => {
|
||||||
// Send file path when download is complete
|
// Send file path when download is complete
|
||||||
item.once('done', (_e, state) => {
|
item.once('done', (_e, state) => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { app } from 'electron';
|
import { app, WebContents } from 'electron';
|
||||||
import electronLog, { LogLevel, transports } from 'electron-log';
|
import electronLog, { LogLevel, transports } from 'electron-log';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
@ -37,7 +37,7 @@ class Logger {
|
|||||||
private readonly desiredLogLevel?: LogLevel;
|
private readonly desiredLogLevel?: LogLevel;
|
||||||
private readonly logQueue: ILogMsg[];
|
private readonly logQueue: ILogMsg[];
|
||||||
private readonly logPath: string;
|
private readonly logPath: string;
|
||||||
private loggerWindow: Electron.WebContents | null;
|
private loggerWindow: WebContents | null;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.loggerWindow = null;
|
this.loggerWindow = null;
|
||||||
@ -158,7 +158,7 @@ class Logger {
|
|||||||
*
|
*
|
||||||
* @param window {WebContents} - renderer window
|
* @param window {WebContents} - renderer window
|
||||||
*/
|
*/
|
||||||
public setLoggerWindow(window: Electron.WebContents): void {
|
public setLoggerWindow(window: WebContents): void {
|
||||||
this.loggerWindow = window;
|
this.loggerWindow = window;
|
||||||
|
|
||||||
if (this.loggerWindow) {
|
if (this.loggerWindow) {
|
||||||
|
@ -7,10 +7,7 @@
|
|||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
"outDir": "lib",
|
"outDir": "lib",
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"lib": [
|
"lib": ["es2016", "dom"],
|
||||||
"es2016",
|
|
||||||
"dom"
|
|
||||||
],
|
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"removeComments": false,
|
"removeComments": false,
|
||||||
@ -24,14 +21,8 @@
|
|||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noImplicitThis": true,
|
"noImplicitThis": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"typeRoots": [
|
"typeRoots": ["node_modules/@types"]
|
||||||
"node_modules/@types"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"exclude": [
|
"include": ["src/**/*"],
|
||||||
"node_modules",
|
"exclude": ["node_modules", "lib", "tests", "spec"]
|
||||||
"lib",
|
|
||||||
"tests",
|
|
||||||
"spec"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user