mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 10:15:43 +03:00
Conform to no-floating-promises (#27561)
This commit is contained in:
parent
9039e70990
commit
a0eb94704e
8 changed files with 31 additions and 31 deletions
|
@ -88,6 +88,7 @@ module.exports = {
|
||||||
"@typescript-eslint/explicit-function-return-type": "off",
|
"@typescript-eslint/explicit-function-return-type": "off",
|
||||||
"@typescript-eslint/explicit-member-accessibility": "off",
|
"@typescript-eslint/explicit-member-accessibility": "off",
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
|
"@typescript-eslint/no-floating-promises": "off",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -180,7 +180,7 @@ async function start(): Promise<void> {
|
||||||
// error handling begins here
|
// error handling begins here
|
||||||
// ##########################
|
// ##########################
|
||||||
if (!acceptBrowser) {
|
if (!acceptBrowser) {
|
||||||
await new Promise<void>((resolve) => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
logger.error("Browser is missing required features.");
|
logger.error("Browser is missing required features.");
|
||||||
// take to a different landing page to AWOOOOOGA at the user
|
// take to a different landing page to AWOOOOOGA at the user
|
||||||
showIncompatibleBrowser(() => {
|
showIncompatibleBrowser(() => {
|
||||||
|
@ -189,7 +189,7 @@ async function start(): Promise<void> {
|
||||||
}
|
}
|
||||||
logger.log("User accepts the compatibility risks.");
|
logger.log("User accepts the compatibility risks.");
|
||||||
resolve();
|
resolve();
|
||||||
});
|
}).catch(reject);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ export async function loadLanguage(): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadTheme(): Promise<void> {
|
export async function loadTheme(): Promise<void> {
|
||||||
setTheme();
|
return setTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadApp(fragParams: {}): Promise<void> {
|
export async function loadApp(fragParams: {}): Promise<void> {
|
||||||
|
|
|
@ -177,17 +177,17 @@ const setupCompleted = (async (): Promise<string | void> => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await widgetApi!.transport.reply(ev.detail, response);
|
widgetApi!.transport.reply(ev.detail, response);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
handleAction(ElementWidgetActions.JoinCall, async ({ audioInput, videoInput }) => {
|
handleAction(ElementWidgetActions.JoinCall, async ({ audioInput, videoInput }) => {
|
||||||
joinConference(audioInput as string | null, videoInput as string | null);
|
void joinConference(audioInput as string | null, videoInput as string | null);
|
||||||
});
|
});
|
||||||
handleAction(ElementWidgetActions.HangupCall, async ({ force }) => {
|
handleAction(ElementWidgetActions.HangupCall, async ({ force }) => {
|
||||||
if (force === true) {
|
if (force === true) {
|
||||||
meetApi?.dispose();
|
meetApi?.dispose();
|
||||||
notifyHangup();
|
void notifyHangup();
|
||||||
meetApi = undefined;
|
meetApi = undefined;
|
||||||
closeConference();
|
closeConference();
|
||||||
} else {
|
} else {
|
||||||
|
@ -297,7 +297,7 @@ function toggleConferenceVisibility(inConference: boolean): void {
|
||||||
|
|
||||||
function skipToJitsiSplashScreen(): void {
|
function skipToJitsiSplashScreen(): void {
|
||||||
// really just a function alias for self-documenting code
|
// really just a function alias for self-documenting code
|
||||||
joinConference();
|
void joinConference();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -500,8 +500,8 @@ const onVideoConferenceJoined = (): void => {
|
||||||
if (widgetApi) {
|
if (widgetApi) {
|
||||||
// ignored promise because we don't care if it works
|
// ignored promise because we don't care if it works
|
||||||
// noinspection JSIgnoredPromiseFromCall
|
// noinspection JSIgnoredPromiseFromCall
|
||||||
widgetApi.setAlwaysOnScreen(true);
|
void widgetApi.setAlwaysOnScreen(true);
|
||||||
widgetApi.transport.send(ElementWidgetActions.JoinCall, {});
|
void widgetApi.transport.send(ElementWidgetActions.JoinCall, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Video rooms should start in tile mode
|
// Video rooms should start in tile mode
|
||||||
|
@ -509,7 +509,7 @@ const onVideoConferenceJoined = (): void => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onVideoConferenceLeft = (): void => {
|
const onVideoConferenceLeft = (): void => {
|
||||||
notifyHangup();
|
void notifyHangup();
|
||||||
meetApi = undefined;
|
meetApi = undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -517,7 +517,7 @@ const onErrorOccurred = ({ error }: Parameters<ExternalAPIEventCallbacks["errorO
|
||||||
if (error.isFatal) {
|
if (error.isFatal) {
|
||||||
// We got disconnected. Since Jitsi Meet might send us back to the
|
// We got disconnected. Since Jitsi Meet might send us back to the
|
||||||
// prejoin screen, we're forced to act as if we hung up entirely.
|
// prejoin screen, we're forced to act as if we hung up entirely.
|
||||||
notifyHangup(error.message);
|
void notifyHangup(error.message);
|
||||||
meetApi = undefined;
|
meetApi = undefined;
|
||||||
closeConference();
|
closeConference();
|
||||||
}
|
}
|
||||||
|
@ -525,7 +525,7 @@ const onErrorOccurred = ({ error }: Parameters<ExternalAPIEventCallbacks["errorO
|
||||||
|
|
||||||
const onAudioMuteStatusChanged = ({ muted }: AudioMuteStatusChangedEvent): void => {
|
const onAudioMuteStatusChanged = ({ muted }: AudioMuteStatusChangedEvent): void => {
|
||||||
const action = muted ? ElementWidgetActions.MuteAudio : ElementWidgetActions.UnmuteAudio;
|
const action = muted ? ElementWidgetActions.MuteAudio : ElementWidgetActions.UnmuteAudio;
|
||||||
widgetApi?.transport.send(action, {});
|
void widgetApi?.transport.send(action, {});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onVideoMuteStatusChanged = ({ muted }: VideoMuteStatusChangedEvent): void => {
|
const onVideoMuteStatusChanged = ({ muted }: VideoMuteStatusChangedEvent): void => {
|
||||||
|
@ -535,15 +535,15 @@ const onVideoMuteStatusChanged = ({ muted }: VideoMuteStatusChangedEvent): void
|
||||||
// otherwise the React SDK will mistakenly think the user turned off
|
// otherwise the React SDK will mistakenly think the user turned off
|
||||||
// their video by hand
|
// their video by hand
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (meetApi) widgetApi?.transport.send(ElementWidgetActions.MuteVideo, {});
|
if (meetApi) void widgetApi?.transport.send(ElementWidgetActions.MuteVideo, {});
|
||||||
}, 200);
|
}, 200);
|
||||||
} else {
|
} else {
|
||||||
widgetApi?.transport.send(ElementWidgetActions.UnmuteVideo, {});
|
void widgetApi?.transport.send(ElementWidgetActions.UnmuteVideo, {});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateParticipants = (): void => {
|
const updateParticipants = (): void => {
|
||||||
widgetApi?.transport.send(ElementWidgetActions.CallParticipants, {
|
void widgetApi?.transport.send(ElementWidgetActions.CallParticipants, {
|
||||||
participants: meetApi?.getParticipantsInfo(),
|
participants: meetApi?.getParticipantsInfo(),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -120,4 +120,4 @@ async function initPage(): Promise<void> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initPage();
|
void initPage();
|
||||||
|
|
|
@ -167,15 +167,14 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
window.electron.on("openDesktopCapturerSourcePicker", () => {
|
window.electron.on("openDesktopCapturerSourcePicker", async () => {
|
||||||
const { finished } = Modal.createDialog(DesktopCapturerSourcePicker);
|
const { finished } = Modal.createDialog(DesktopCapturerSourcePicker);
|
||||||
finished.then(([source]) => {
|
const [source] = await finished;
|
||||||
// getDisplayMedia promise does not return if no dummy is passed here as source
|
// getDisplayMedia promise does not return if no dummy is passed here as source
|
||||||
this.ipc.call("callDisplayMediaCallback", source ?? { id: "", name: "", thumbnailURL: "" });
|
await this.ipc.call("callDisplayMediaCallback", source ?? { id: "", name: "", thumbnailURL: "" });
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.ipc.call("startSSOFlow", this.ssoID);
|
void this.ipc.call("startSSOFlow", this.ssoID);
|
||||||
|
|
||||||
BreadcrumbsStore.instance.on(UPDATE_EVENT, this.onBreadcrumbsUpdate);
|
BreadcrumbsStore.instance.on(UPDATE_EVENT, this.onBreadcrumbsUpdate);
|
||||||
}
|
}
|
||||||
|
@ -195,7 +194,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||||
),
|
),
|
||||||
initial: getInitialLetter(r.name),
|
initial: getInitialLetter(r.name),
|
||||||
}));
|
}));
|
||||||
this.ipc.call("breadcrumbs", rooms);
|
void this.ipc.call("breadcrumbs", rooms);
|
||||||
};
|
};
|
||||||
|
|
||||||
private onUpdateDownloaded = async (ev: Event, { releaseNotes, releaseName }: SquirrelUpdate): Promise<void> => {
|
private onUpdateDownloaded = async (ev: Event, { releaseNotes, releaseName }: SquirrelUpdate): Promise<void> => {
|
||||||
|
@ -261,7 +260,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||||
const handler = notification.onclick as Function;
|
const handler = notification.onclick as Function;
|
||||||
notification.onclick = (): void => {
|
notification.onclick = (): void => {
|
||||||
handler?.();
|
handler?.();
|
||||||
this.ipc.call("focusWindow");
|
void this.ipc.call("focusWindow");
|
||||||
};
|
};
|
||||||
|
|
||||||
return notification;
|
return notification;
|
||||||
|
@ -399,7 +398,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
public navigateForwardBack(back: boolean): void {
|
public navigateForwardBack(back: boolean): void {
|
||||||
this.ipc.call(back ? "navigateBack" : "navigateForward");
|
void this.ipc.call(back ? "navigateBack" : "navigateForward");
|
||||||
}
|
}
|
||||||
|
|
||||||
public overrideBrowserShortcuts(): boolean {
|
public overrideBrowserShortcuts(): boolean {
|
||||||
|
|
|
@ -113,10 +113,10 @@ export default class WebPlatform extends VectorBasePlatform {
|
||||||
// annoyingly, the latest spec says this returns a
|
// annoyingly, the latest spec says this returns a
|
||||||
// promise, but this is only supported in Chrome 46
|
// promise, but this is only supported in Chrome 46
|
||||||
// and Firefox 47, so adapt the callback API.
|
// and Firefox 47, so adapt the callback API.
|
||||||
return new Promise(function (resolve) {
|
return new Promise(function (resolve, reject) {
|
||||||
window.Notification.requestPermission((result) => {
|
window.Notification.requestPermission((result) => {
|
||||||
resolve(result);
|
resolve(result);
|
||||||
});
|
}).catch(reject);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ export default class WebPlatform extends VectorBasePlatform {
|
||||||
// Ideally, loading an old copy would be impossible with the
|
// Ideally, loading an old copy would be impossible with the
|
||||||
// cache-control: nocache HTTP header set, but Firefox doesn't always obey it :/
|
// cache-control: nocache HTTP header set, but Firefox doesn't always obey it :/
|
||||||
console.log("startUpdater, current version is " + getNormalizedAppVersion(WebPlatform.VERSION));
|
console.log("startUpdater, current version is " + getNormalizedAppVersion(WebPlatform.VERSION));
|
||||||
this.pollForUpdate((version: string, newVersion: string) => {
|
void this.pollForUpdate((version: string, newVersion: string) => {
|
||||||
const query = parseQs(location);
|
const query = parseQs(location);
|
||||||
if (query.updated) {
|
if (query.updated) {
|
||||||
console.log("Update reloaded but still on an old version, stopping");
|
console.log("Update reloaded but still on an old version, stopping");
|
||||||
|
@ -207,7 +207,7 @@ export default class WebPlatform extends VectorBasePlatform {
|
||||||
|
|
||||||
public startUpdateCheck(): void {
|
public startUpdateCheck(): void {
|
||||||
super.startUpdateCheck();
|
super.startUpdateCheck();
|
||||||
this.pollForUpdate(showUpdateToast, hideUpdateToast).then((updateState) => {
|
void this.pollForUpdate(showUpdateToast, hideUpdateToast).then((updateState) => {
|
||||||
dis.dispatch<CheckUpdatesPayload>({
|
dis.dispatch<CheckUpdatesPayload>({
|
||||||
action: Action.CheckUpdates,
|
action: Action.CheckUpdates,
|
||||||
...updateState,
|
...updateState,
|
||||||
|
|
|
@ -35,7 +35,7 @@ export function initRageshake(): Promise<void> {
|
||||||
// we manually check persistence for rageshakes ourselves
|
// we manually check persistence for rageshakes ourselves
|
||||||
const prom = rageshake.init(/*setUpPersistence=*/ false);
|
const prom = rageshake.init(/*setUpPersistence=*/ false);
|
||||||
prom.then(
|
prom.then(
|
||||||
() => {
|
async () => {
|
||||||
logger.log("Initialised rageshake.");
|
logger.log("Initialised rageshake.");
|
||||||
logger.log(
|
logger.log(
|
||||||
"To fix line numbers in Chrome: " +
|
"To fix line numbers in Chrome: " +
|
||||||
|
@ -48,7 +48,7 @@ export function initRageshake(): Promise<void> {
|
||||||
rageshake.flush();
|
rageshake.flush();
|
||||||
});
|
});
|
||||||
|
|
||||||
rageshake.cleanup();
|
await rageshake.cleanup();
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
logger.error("Failed to initialise rageshake: " + err);
|
logger.error("Failed to initialise rageshake: " + err);
|
||||||
|
|
Loading…
Reference in a new issue