Upgrade Electron to 28.1.5

Co-authored-by: Fedor Indutny <238531+indutny@users.noreply.github.com>
This commit is contained in:
Fedor Indutny 2024-01-23 16:11:12 -08:00 committed by GitHub
parent d97aa68716
commit 2bc0e4755c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 421 additions and 296 deletions

View file

@ -11,6 +11,7 @@ import type { ServiceIdString } from '../types/ServiceId';
import type { LocalizerType } from '../types/Util';
import type { ConversationType } from '../state/ducks/conversations';
import { ModalHost } from './ModalHost';
import { drop } from '../util/drop';
import * as log from '../logging/log';
import { usePrevious } from '../hooks/usePrevious';
@ -200,19 +201,27 @@ export function CallingRaisedHandsListButton({
if (raisedHandsCount > prevRaisedHandsCount) {
setIsVisible(true);
opacitySpringApi.stop();
opacitySpringApi.start({ opacity: 1 });
drop(Promise.all(opacitySpringApi.start({ opacity: 1 })));
scaleSpringApi.stop();
scaleSpringApi.start({
from: { scale: 0.99 },
to: { scale: 1 },
config: { velocity: 0.0025 },
});
drop(
Promise.all(
scaleSpringApi.start({
from: { scale: 0.99 },
to: { scale: 1 },
config: { velocity: 0.0025 },
})
)
);
} else if (raisedHandsCount === 0) {
opacitySpringApi.stop();
opacitySpringApi.start({
to: { opacity: 0 },
onRest: () => onRestAfterAnimateOut,
});
drop(
Promise.all(
opacitySpringApi.start({
to: { opacity: 0 },
onRest: () => onRestAfterAnimateOut,
})
)
);
}
}, [
raisedHandsCount,

View file

@ -641,7 +641,6 @@ export function LeftPane({
'module-left-pane--mode-compose'
)}
>
{/* eslint-enable jsx-a11y/no-static-element-interactions */}
<div className="module-left-pane__header">
{helper.getHeaderContents({
i18n,

View file

@ -26,6 +26,7 @@ import { isGIF } from '../types/Attachment';
import { useRestoreFocus } from '../hooks/useRestoreFocus';
import { usePrevious } from '../hooks/usePrevious';
import { arrow } from '../util/keyboard';
import { drop } from '../util/drop';
import { isCmdOrCtrl } from '../hooks/useKeyboardShortcuts';
export type PropsType = {
@ -327,10 +328,14 @@ export function Lightbox({
(selectedIndex === 0 ? 1 : -1) * THUMBNAIL_FULL_WIDTH,
opacity: 0,
});
thumbnailsAnimation.start({
marginInlineStart: thumbnailsMarginInlineStart,
opacity: 1,
});
drop(
Promise.all(
thumbnailsAnimation.start({
marginInlineStart: thumbnailsMarginInlineStart,
opacity: 1,
})
)
);
}, [
needsAnimation,
selectedIndex,
@ -375,11 +380,15 @@ export function Lightbox({
const posY = offsetY * ZOOM_SCALE;
const [x, y] = maxBoundsLimiter(posX, posY);
springApi.start({
scale: ZOOM_SCALE,
translateX: shouldTranslateX ? x : undefined,
translateY: shouldTranslateY ? y : undefined,
});
drop(
Promise.all(
springApi.start({
scale: ZOOM_SCALE,
translateX: shouldTranslateX ? x : undefined,
translateY: shouldTranslateY ? y : undefined,
})
)
);
},
[maxBoundsLimiter, springApi]
);
@ -414,11 +423,15 @@ export function Lightbox({
const x = dragCache.translateX + deltaX;
const y = dragCache.translateY + deltaY;
springApi.start({
scale: ZOOM_SCALE,
translateX: x,
translateY: y,
});
drop(
Promise.all(
springApi.start({
scale: ZOOM_SCALE,
translateX: x,
translateY: y,
})
)
);
},
[springApi]
);
@ -459,15 +472,19 @@ export function Lightbox({
const posY = -offsetY * ZOOM_SCALE + translateY.get();
const [x, y] = maxBoundsLimiter(posX, posY);
springApi.start({
scale: ZOOM_SCALE,
translateX: shouldTranslateX ? x : undefined,
translateY: shouldTranslateY ? y : undefined,
});
drop(
Promise.all(
springApi.start({
scale: ZOOM_SCALE,
translateX: shouldTranslateX ? x : undefined,
translateY: shouldTranslateY ? y : undefined,
})
)
);
setIsZoomed(true);
} else {
springApi.start(INITIAL_IMAGE_TRANSFORM);
drop(Promise.all(springApi.start(INITIAL_IMAGE_TRANSFORM)));
setIsZoomed(false);
}
},

View file

@ -7,6 +7,7 @@ import React, { useEffect, useState } from 'react';
import { animated, useSpring } from '@react-spring/web';
import type { LocalizerType } from '../../types/Util';
import { drop } from '../../util/drop';
import { TimelineDateHeader } from './TimelineDateHeader';
import { Spinner } from '../Spinner';
@ -57,7 +58,7 @@ export function TimelineFloatingHeader({
}
if (!isLoading && showSpinner) {
spinnerSpringRef.start();
drop(Promise.all(spinnerSpringRef.start()));
}
if (!isLoading && !showSpinner) {

View file

@ -12,6 +12,7 @@ import { Avatar } from '../Avatar';
import type { LocalizerType, ThemeType } from '../../types/Util';
import type { ConversationType } from '../../state/ducks/conversations';
import type { PreferredBadgeSelectorType } from '../../state/selectors/badges';
import { drop } from '../../util/drop';
const MAX_AVATARS_COUNT = 3;
@ -104,7 +105,11 @@ function TypingBubbleAvatar({
useEffect(() => {
springApi.stop();
springApi.start(AVATAR_ANIMATION_PROPS[visible ? 'visible' : 'hidden']);
drop(
Promise.all(
springApi.start(AVATAR_ANIMATION_PROPS[visible ? 'visible' : 'hidden'])
)
);
}, [visible, springApi]);
if (!contact) {
@ -308,12 +313,20 @@ export function TypingBubble({
setIsVisible(true);
}
typingAnimationSpringApi.stop();
typingAnimationSpringApi.start(
BUBBLE_ANIMATION_PROPS[isSomeoneTyping ? 'visible' : 'hidden']
drop(
Promise.all(
typingAnimationSpringApi.start(
BUBBLE_ANIMATION_PROPS[isSomeoneTyping ? 'visible' : 'hidden']
)
)
);
outerDivSpringApi.stop();
outerDivSpringApi.start(
OUTER_DIV_ANIMATION_PROPS[isSomeoneTyping ? 'visible' : 'hidden']
drop(
Promise.all(
outerDivSpringApi.start(
OUTER_DIV_ANIMATION_PROPS[isSomeoneTyping ? 'visible' : 'hidden']
)
)
);
}, [isSomeoneTyping, typingAnimationSpringApi, outerDivSpringApi]);

2
ts/model-types.d.ts vendored
View file

@ -266,7 +266,6 @@ export type MessageAttributesType = {
deletedForEveryoneSendStatus?: Record<string, boolean>;
deletedForEveryoneFailed?: boolean;
};
/* eslint-enable camelcase */
export type ConversationAttributesTypeType = 'private' | 'group';
@ -441,7 +440,6 @@ export type ConversationAttributesType = {
// up in that case).
unblurredAvatarPath?: string;
};
/* eslint-enable camelcase */
export type ConversationRenderInfoType = Pick<
ConversationAttributesType,

View file

@ -21,6 +21,7 @@ export class OurProfileKeyService {
resolve();
});
});
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.promisesBlockingGet = [storageReadyPromise];
this.storage = storage;

View file

@ -33,6 +33,7 @@ import type { MergeResultType } from './storageRecordOps';
import { MAX_READ_KEYS } from './storageConstants';
import type { ConversationModel } from '../models/conversations';
import { strictAssert } from '../util/assert';
import { drop } from '../util/drop';
import { dropNull } from '../util/dropNull';
import * as durations from '../util/durations';
import { BackOff } from '../util/BackOff';
@ -900,23 +901,24 @@ async function fetchManifest(
return decryptManifest(encryptedManifest);
} catch (err) {
await stopStorageServiceSync(err);
return;
}
} catch (err) {
if (err.code === 204) {
log.info('storageService.sync: no newer manifest, ok');
return;
return undefined;
}
log.error('storageService.sync: failed!', Errors.toLogFormat(err));
if (err.code === 404) {
await createNewManifest();
return;
return undefined;
}
throw err;
}
return undefined;
}
type MergeableItemType = {
@ -1605,7 +1607,7 @@ async function processRemoteRecords(
);
// Intentionally not awaiting
needProfileFetch.map(convo => convo.getProfiles());
needProfileFetch.map(convo => drop(convo.getProfiles()));
// Collect full map of previously and currently unknown records
const unknownRecords: Map<string, UnknownRecord> = new Map();

View file

@ -99,6 +99,7 @@ function _validateResponse(response: any, schema: any) {
case 'object':
case 'string':
case 'number':
// eslint-disable-next-line valid-typeof
if (typeof response[i] !== schema[i]) {
return false;
}

View file

@ -944,13 +944,17 @@ export const deleteAllExternalFiles = ({
}
if (editHistory && editHistory.length) {
await editHistory.map(edit => {
if (!edit.attachments || !edit.attachments.length) {
return;
}
return Promise.all(edit.attachments.map(deleteAttachmentData));
});
await editHistory.map(edit => deletePreviews(edit.preview, deleteOnDisk));
await Promise.all(
editHistory.map(edit => {
if (!edit.attachments || !edit.attachments.length) {
return;
}
return Promise.all(edit.attachments.map(deleteAttachmentData));
})
);
await Promise.all(
editHistory.map(edit => deletePreviews(edit.preview, deleteOnDisk))
);
}
};
};

View file

@ -181,7 +181,6 @@ export type StorageAccessType = {
signaling_key: never;
signedKeyRotationRejected: number;
};
/* eslint-enable camelcase */
export type StorageInterface = {
onready(callback: () => void): void;

View file

@ -16,6 +16,9 @@
* Most notably, if something is queued and the function is called again, we discard the
* previously queued task completely.
*/
import { drop } from './drop';
export class LatestQueue {
private isRunning: boolean;
@ -40,23 +43,25 @@ export class LatestQueue {
this.queuedTask = task;
} else {
this.isRunning = true;
task().finally(() => {
this.isRunning = false;
drop(
task().finally(() => {
this.isRunning = false;
const { queuedTask } = this;
if (queuedTask) {
this.queuedTask = undefined;
this.add(queuedTask);
} else {
try {
this.onceEmptyCallbacks.forEach(callback => {
callback();
});
} finally {
this.onceEmptyCallbacks = [];
const { queuedTask } = this;
if (queuedTask) {
this.queuedTask = undefined;
this.add(queuedTask);
} else {
try {
this.onceEmptyCallbacks.forEach(callback => {
callback();
});
} finally {
this.onceEmptyCallbacks = [];
}
}
}
});
})
);
}
}

View file

@ -3,7 +3,7 @@
import 'urlpattern-polyfill';
// We need to use the Node.js version of `URL` because chromium's `URL` doesn't
// support custom protocols correctly.
import { URL } from 'url';
import { URL as NodeURL } from 'url';
import { z } from 'zod';
import { strictAssert } from './assert';
import * as log from '../logging/log';
@ -14,7 +14,7 @@ function toUrl(input: URL | string): URL | null {
return input;
}
try {
return new URL(input);
return new NodeURL(input) as URL;
} catch {
return null;
}