2020-03-25 14:53:28 +01:00
|
|
|
/*
|
2021-01-13 16:39:18 +01:00
|
|
|
Copyright 2020, 2021 New Vector Ltd
|
2020-03-25 14:53:28 +01:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2020-04-19 13:10:17 +02:00
|
|
|
import "matrix-react-sdk/src/@types/global"; // load matrix-react-sdk's type extensions first
|
2021-06-30 14:28:31 +02:00
|
|
|
import type { Renderer } from "react-dom";
|
2021-10-15 17:04:34 +02:00
|
|
|
import type { logger } from "matrix-js-sdk/src/logger";
|
2020-04-05 01:05:59 +02:00
|
|
|
|
2021-01-13 16:39:18 +01:00
|
|
|
type ElectronChannel =
|
|
|
|
"app_onAction" |
|
|
|
|
"before-quit" |
|
|
|
|
"check_updates" |
|
|
|
|
"install_update" |
|
|
|
|
"ipcCall" |
|
|
|
|
"ipcReply" |
|
|
|
|
"loudNotification" |
|
|
|
|
"preferences" |
|
|
|
|
"seshat" |
|
|
|
|
"seshatReply" |
|
|
|
|
"setBadgeCount" |
|
|
|
|
"update-downloaded" |
|
|
|
|
"userDownloadCompleted" |
|
2021-12-21 16:34:57 +01:00
|
|
|
"userDownloadAction";
|
2021-01-13 16:39:18 +01:00
|
|
|
|
2020-04-05 01:55:36 +02:00
|
|
|
declare global {
|
|
|
|
interface Window {
|
|
|
|
mxSendRageshake: (text: string, withLogs?: boolean) => void;
|
2021-10-15 17:04:34 +02:00
|
|
|
matrixLogger: typeof logger;
|
2020-04-22 14:41:29 +02:00
|
|
|
matrixChat: ReturnType<Renderer>;
|
2020-04-08 17:31:58 +02:00
|
|
|
|
|
|
|
// electron-only
|
2021-02-08 16:12:30 +01:00
|
|
|
electron?: Electron;
|
2020-05-13 06:19:08 +02:00
|
|
|
|
|
|
|
// opera-only
|
2021-02-08 16:12:30 +01:00
|
|
|
opera?: any;
|
2020-05-13 06:19:08 +02:00
|
|
|
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/API/InstallTrigger
|
|
|
|
InstallTrigger: any;
|
2020-04-05 01:55:36 +02:00
|
|
|
}
|
2020-06-02 17:58:05 +02:00
|
|
|
|
2021-02-08 16:12:30 +01:00
|
|
|
interface Electron {
|
|
|
|
on(channel: ElectronChannel, listener: (event: Event, ...args: any[]) => void): void;
|
|
|
|
send(channel: ElectronChannel, ...args: any[]): void;
|
|
|
|
}
|
|
|
|
|
2020-06-02 17:58:05 +02:00
|
|
|
interface Navigator {
|
|
|
|
// PWA badging extensions https://w3c.github.io/badging/
|
|
|
|
setAppBadge?(count: number): Promise<void>;
|
|
|
|
clearAppBadge?(): Promise<void>;
|
|
|
|
}
|
2020-03-25 14:53:28 +01:00
|
|
|
}
|
2020-05-20 20:56:54 +02:00
|
|
|
|
|
|
|
// add method which is missing from the node typing
|
|
|
|
declare module "url" {
|
|
|
|
interface Url {
|
|
|
|
format(): string;
|
|
|
|
}
|
|
|
|
}
|