Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32615309
D9721.1767456695.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D9721.1767456695.diff
View Options
diff --git a/desktop/src/auto-update.js b/desktop/src/auto-update.js
--- a/desktop/src/auto-update.js
+++ b/desktop/src/auto-update.js
@@ -3,15 +3,15 @@
// eslint-disable-next-line import/extensions
import { app, ipcMain, autoUpdater } from 'electron/main';
-const getUpdateUrl = version =>
+const getUpdateURL = (version: string) =>
`https://electron-update.commtechnologies.org/update/${process.platform}/${version}`;
export function initAutoUpdate(): void {
- autoUpdater.setFeedURL({ url: getUpdateUrl(app.getVersion()) });
+ autoUpdater.setFeedURL({ url: getUpdateURL(app.getVersion()) });
// Check for new updates every 10 minutes
const updateIntervalMs = 10 * 60_000;
- let currentTimeout = null;
+ let currentTimeout: ?TimeoutID = null;
const scheduleCheckForUpdates = () => {
if (!currentTimeout) {
currentTimeout = setTimeout(() => {
diff --git a/desktop/src/handle-squirrel-event.js b/desktop/src/handle-squirrel-event.js
--- a/desktop/src/handle-squirrel-event.js
+++ b/desktop/src/handle-squirrel-event.js
@@ -16,7 +16,7 @@
const updateExe = path.resolve(process.execPath, '..', '..', 'Update.exe');
const commExeName = path.basename(process.execPath);
- const spawnUpdate = args => {
+ const spawnUpdate = (args: string[]) => {
return spawn(updateExe, args, { detached: true }).on('close', app.quit);
};
diff --git a/desktop/src/main.js b/desktop/src/main.js
--- a/desktop/src/main.js
+++ b/desktop/src/main.js
@@ -1,5 +1,6 @@
// @flow
+import type { Event, MenuItemConstructorOptions } from 'electron';
import {
app,
BrowserWindow,
@@ -32,7 +33,7 @@
let mainWindow = null;
const setApplicationMenu = () => {
- let mainMenu = [];
+ let mainMenu: MenuItemConstructorOptions[] = [];
if (isMac) {
mainMenu = [
{
@@ -157,7 +158,11 @@
};
ipcMain.on('double-click-top-bar', doubleClickTopBar);
- const updateDownloaded = (event, releaseNotes, releaseName) => {
+ const updateDownloaded = (
+ event: Event,
+ releaseNotes?: string,
+ releaseName: string,
+ ) => {
win.webContents.send('on-new-version-available', releaseName);
};
autoUpdater.on('update-downloaded', updateDownloaded);
diff --git a/desktop/src/preload.js b/desktop/src/preload.js
--- a/desktop/src/preload.js
+++ b/desktop/src/preload.js
@@ -1,5 +1,6 @@
// @flow
+import type { IpcRendererEvent } from 'electron';
// eslint-disable-next-line import/extensions
import { contextBridge, ipcRenderer } from 'electron/renderer';
@@ -7,7 +8,8 @@
const bridge: ElectronBridge = {
onNavigate: callback => {
- const withEvent = (event, ...args) => callback(...args);
+ const withEvent = (event: IpcRendererEvent, ...args: $ReadOnlyArray<any>) =>
+ callback(...args);
ipcRenderer.on('on-navigate', withEvent);
return () => ipcRenderer.removeListener('on-navigate', withEvent);
},
@@ -16,7 +18,8 @@
setBadge: value => ipcRenderer.send('set-badge', value),
version: ipcRenderer.sendSync('get-version'),
onNewVersionAvailable: callback => {
- const withEvent = (event, ...args) => callback(...args);
+ const withEvent = (event: IpcRendererEvent, ...args: $ReadOnlyArray<any>) =>
+ callback(...args);
ipcRenderer.on('on-new-version-available', withEvent);
return () =>
ipcRenderer.removeListener('on-new-version-available', withEvent);
@@ -24,13 +27,15 @@
updateToNewVersion: () => ipcRenderer.send('update-to-new-version'),
platform: { win32: 'windows', darwin: 'macos' }[process.platform],
onDeviceTokenRegistered: callback => {
- const withEvent = (event, ...args) => callback(...args);
+ const withEvent = (event: IpcRendererEvent, ...args: $ReadOnlyArray<any>) =>
+ callback(...args);
ipcRenderer.on('on-device-token-registered', withEvent);
return () =>
ipcRenderer.removeListener('on-device-token-registered', withEvent);
},
onNotificationClicked: callback => {
- const withEvent = (event, ...args) => callback(...args);
+ const withEvent = (event: IpcRendererEvent, ...args: $ReadOnlyArray<any>) =>
+ callback(...args);
ipcRenderer.on('on-notification-clicked', withEvent);
return () =>
ipcRenderer.removeListener('on-notification-clicked', withEvent);
diff --git a/desktop/src/push-notifications.js b/desktop/src/push-notifications.js
--- a/desktop/src/push-notifications.js
+++ b/desktop/src/push-notifications.js
@@ -1,5 +1,9 @@
// @flow
+import type {
+ PushNotificationManager as PushNotificationManagerType,
+ PushNotificationReceivedEventArgs,
+} from '@commapp/windowspush';
// eslint-disable-next-line import/extensions
import { app, pushNotifications, Notification } from 'electron/main';
import EventEmitter from 'events';
@@ -20,7 +24,10 @@
windowsPushNotificationManager = PushNotificationManager.default;
- const handleEvent = (manager, event) => {
+ const handleEvent = (
+ manager: PushNotificationManagerType,
+ event: PushNotificationReceivedEventArgs,
+ ) => {
const byteArray = [];
for (let i = 0; i < event.payload.length; i++) {
byteArray.push(event.payload[i]);
@@ -62,7 +69,7 @@
}
} else if (process.platform === 'win32' && windowsPushNotificationManager) {
try {
- const token = await new Promise((resolvePromise, reject) => {
+ const token = await new Promise<string>((resolvePromise, reject) => {
windowsPushNotificationManager.createChannelAsync(
'f09f4211-a998-40c1-a515-689e3faecb62',
(error, result) => {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 3, 4:11 PM (8 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5889676
Default Alt Text
D9721.1767456695.diff (5 KB)
Attached To
Mode
D9721: [Flow202][desktop][skip-ci] Fix Flow issues in desktop codebase
Attached
Detach File
Event Timeline
Log In to Comment