2022-01-05 17:59:59 +00:00
|
|
|
// Copyright 2020-2022 Signal Messenger, LLC
|
2020-10-30 20:34:04 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-03-31 20:03:38 +00:00
|
|
|
// Captures the globals put in place by preload.js, background.js and others
|
|
|
|
|
2022-06-13 21:39:35 +00:00
|
|
|
import type { Cancelable } from 'lodash';
|
2022-04-11 20:57:44 +00:00
|
|
|
import { Store } from 'redux';
|
2020-07-10 18:28:49 +00:00
|
|
|
import * as Backbone from 'backbone';
|
|
|
|
import * as Underscore from 'underscore';
|
2021-01-20 01:19:00 +00:00
|
|
|
import PQueue from 'p-queue/dist';
|
2021-09-22 20:59:54 +00:00
|
|
|
import { Ref } from 'react';
|
2022-06-13 21:39:35 +00:00
|
|
|
import { assert } from 'chai';
|
|
|
|
|
2021-01-20 01:19:00 +00:00
|
|
|
import { imageToBlurHash } from './util/imageToBlurHash';
|
2020-10-16 18:31:57 +00:00
|
|
|
import * as Util from './util';
|
2020-07-10 18:28:49 +00:00
|
|
|
import {
|
|
|
|
ConversationModelCollectionType,
|
|
|
|
MessageModelCollectionType,
|
|
|
|
} from './model-types.d';
|
2022-06-13 21:39:35 +00:00
|
|
|
import { textsecure } from './textsecure';
|
2021-06-15 00:09:37 +00:00
|
|
|
import { Storage } from './textsecure/Storage';
|
2021-05-06 00:09:29 +00:00
|
|
|
import {
|
|
|
|
ChallengeHandler,
|
|
|
|
IPCRequest as IPCChallengeRequest,
|
|
|
|
} from './challenge';
|
2020-04-13 17:37:29 +00:00
|
|
|
import { WebAPIConnectType } from './textsecure/WebAPI';
|
2020-09-04 18:27:12 +00:00
|
|
|
import { CallingClass } from './services/calling';
|
2020-10-06 17:06:34 +00:00
|
|
|
import * as Groups from './groups';
|
2020-04-13 17:37:29 +00:00
|
|
|
import * as Crypto from './Crypto';
|
2021-04-16 23:13:13 +00:00
|
|
|
import * as Curve from './Curve';
|
2020-09-09 23:07:58 +00:00
|
|
|
import * as RemoteConfig from './RemoteConfig';
|
2021-01-20 01:19:00 +00:00
|
|
|
import * as OS from './OS';
|
2022-06-13 21:39:35 +00:00
|
|
|
import { Environment, getEnvironment } from './environment';
|
2022-05-11 22:58:14 +00:00
|
|
|
import { LocalizerType, ThemeType } from './types/Util';
|
2021-12-07 22:41:40 +00:00
|
|
|
import type { Receipt } from './types/Receipt';
|
2020-07-10 18:28:49 +00:00
|
|
|
import { ConversationController } from './ConversationController';
|
2020-09-09 22:50:44 +00:00
|
|
|
import { ReduxActions } from './state/types';
|
2020-10-30 17:52:21 +00:00
|
|
|
import { createStore } from './state/createStore';
|
2021-06-14 19:01:00 +00:00
|
|
|
import { createApp } from './state/roots/createApp';
|
2021-05-28 16:15:17 +00:00
|
|
|
import { createChatColorPicker } from './state/roots/createChatColorPicker';
|
2021-01-29 21:19:24 +00:00
|
|
|
import { createConversationDetails } from './state/roots/createConversationDetails';
|
2021-04-27 22:35:35 +00:00
|
|
|
import { createForwardMessageModal } from './state/roots/createForwardMessageModal';
|
2021-01-29 21:19:24 +00:00
|
|
|
import { createGroupLinkManagement } from './state/roots/createGroupLinkManagement';
|
2020-12-01 16:42:35 +00:00
|
|
|
import { createGroupV1MigrationModal } from './state/roots/createGroupV1MigrationModal';
|
2021-01-29 22:16:48 +00:00
|
|
|
import { createGroupV2JoinModal } from './state/roots/createGroupV2JoinModal';
|
2021-01-29 21:19:24 +00:00
|
|
|
import { createGroupV2Permissions } from './state/roots/createGroupV2Permissions';
|
2021-03-24 22:06:12 +00:00
|
|
|
import { createMessageDetail } from './state/roots/createMessageDetail';
|
2021-08-05 12:35:33 +00:00
|
|
|
import { createConversationNotificationsSettings } from './state/roots/createConversationNotificationsSettings';
|
2021-01-29 21:19:24 +00:00
|
|
|
import { createPendingInvites } from './state/roots/createPendingInvites';
|
2020-10-30 17:52:21 +00:00
|
|
|
import { createSafetyNumberViewer } from './state/roots/createSafetyNumberViewer';
|
|
|
|
import { createShortcutGuideModal } from './state/roots/createShortcutGuideModal';
|
|
|
|
import { createStickerManager } from './state/roots/createStickerManager';
|
|
|
|
import { createStickerPreviewModal } from './state/roots/createStickerPreviewModal';
|
2021-06-14 19:01:00 +00:00
|
|
|
import * as appDuck from './state/ducks/app';
|
2020-10-30 17:52:21 +00:00
|
|
|
import * as callingDuck from './state/ducks/calling';
|
|
|
|
import * as conversationsDuck from './state/ducks/conversations';
|
|
|
|
import * as emojisDuck from './state/ducks/emojis';
|
|
|
|
import * as expirationDuck from './state/ducks/expiration';
|
|
|
|
import * as itemsDuck from './state/ducks/items';
|
2021-04-27 22:35:35 +00:00
|
|
|
import * as linkPreviewsDuck from './state/ducks/linkPreviews';
|
2020-10-30 17:52:21 +00:00
|
|
|
import * as networkDuck from './state/ducks/network';
|
|
|
|
import * as updatesDuck from './state/ducks/updates';
|
|
|
|
import * as userDuck from './state/ducks/user';
|
|
|
|
import * as searchDuck from './state/ducks/search';
|
|
|
|
import * as stickersDuck from './state/ducks/stickers';
|
|
|
|
import * as conversationsSelectors from './state/selectors/conversations';
|
|
|
|
import * as searchSelectors from './state/selectors/search';
|
2020-09-09 02:25:05 +00:00
|
|
|
import AccountManager from './textsecure/AccountManager';
|
2020-07-07 00:56:56 +00:00
|
|
|
import Data from './sql/Client';
|
2022-06-13 21:39:35 +00:00
|
|
|
import { PhoneNumber, PhoneNumberFormat } from 'google-libphonenumber';
|
2020-09-24 20:57:54 +00:00
|
|
|
import { MessageModel } from './models/messages';
|
|
|
|
import { ConversationModel } from './models/conversations';
|
|
|
|
import { BatcherType } from './util/batcher';
|
2021-01-20 01:19:00 +00:00
|
|
|
import { AttachmentList } from './components/conversation/AttachmentList';
|
2021-05-28 16:15:17 +00:00
|
|
|
import { ChatColorPicker } from './components/ChatColorPicker';
|
2021-04-27 19:29:59 +00:00
|
|
|
import { ConfirmationDialog } from './components/ConfirmationDialog';
|
2021-01-20 01:19:00 +00:00
|
|
|
import { ContactModal } from './components/conversation/ContactModal';
|
|
|
|
import { MessageDetail } from './components/conversation/MessageDetail';
|
|
|
|
import { Quote } from './components/conversation/Quote';
|
|
|
|
import { StagedLinkPreview } from './components/conversation/StagedLinkPreview';
|
2021-06-25 23:52:56 +00:00
|
|
|
import { DisappearingTimeDialog } from './components/DisappearingTimeDialog';
|
2021-04-16 23:13:13 +00:00
|
|
|
import { SignalProtocolStore } from './SignalProtocolStore';
|
2021-03-13 01:22:36 +00:00
|
|
|
import { StartupQueue } from './util/StartupQueue';
|
2021-06-09 22:28:54 +00:00
|
|
|
import { SocketStatus } from './types/SocketStatus';
|
2021-04-08 16:24:21 +00:00
|
|
|
import SyncRequest from './textsecure/SyncRequest';
|
2021-06-16 00:44:14 +00:00
|
|
|
import { MessageController } from './util/MessageController';
|
|
|
|
import { StateType } from './state/reducer';
|
2021-06-29 17:18:03 +00:00
|
|
|
import { SystemTraySetting } from './types/SystemTraySetting';
|
2021-09-10 02:38:11 +00:00
|
|
|
import { UUID } from './types/UUID';
|
|
|
|
import { Address } from './types/Address';
|
|
|
|
import { QualifiedAddress } from './types/QualifiedAddress';
|
2021-08-11 19:29:07 +00:00
|
|
|
import { CI } from './CI';
|
2022-04-11 20:57:44 +00:00
|
|
|
import { IPCEventsType } from './util/createIPCEvents';
|
2021-08-30 21:32:56 +00:00
|
|
|
import { ConversationView } from './views/conversation_view';
|
2021-10-07 23:28:47 +00:00
|
|
|
import type { SignalContextType } from './windows/context';
|
2022-06-13 21:39:35 +00:00
|
|
|
import type * as Message2 from './types/Message2';
|
|
|
|
import type { initializeMigrations } from './signal';
|
|
|
|
import { RendererConfigType } from './types/RendererConfig';
|
2020-04-13 17:37:29 +00:00
|
|
|
|
2020-09-04 01:25:19 +00:00
|
|
|
export { Long } from 'long';
|
|
|
|
|
2020-11-20 17:30:45 +00:00
|
|
|
export type WhatIsThis = any;
|
2020-09-24 20:57:54 +00:00
|
|
|
|
2021-01-04 18:47:14 +00:00
|
|
|
// Synced with the type in ts/shims/showConfirmationDialog
|
|
|
|
// we are duplicating it here because that file cannot import/export.
|
|
|
|
type ConfirmationDialogViewProps = {
|
|
|
|
cancelText?: string;
|
|
|
|
confirmStyle?: 'affirmative' | 'negative';
|
|
|
|
message: string;
|
|
|
|
okText: string;
|
2021-02-26 21:06:37 +00:00
|
|
|
reject?: (error: Error) => void;
|
2021-01-04 18:47:14 +00:00
|
|
|
resolve: () => void;
|
|
|
|
};
|
|
|
|
|
2021-09-29 20:23:06 +00:00
|
|
|
export declare class WebAudioRecorderClass {
|
|
|
|
constructor(
|
|
|
|
node: GainNode,
|
|
|
|
options: {
|
|
|
|
encoding: string;
|
|
|
|
workerDir: string;
|
|
|
|
options?: { timeLimit?: number };
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
// Callbacks
|
|
|
|
onComplete?: (recorder: WebAudioRecorderClass, blob: Blob) => unknown;
|
|
|
|
onError?: (recorder: WebAudioRecorderClass, error: Error) => unknown;
|
|
|
|
onTimeout?: () => unknown;
|
|
|
|
|
|
|
|
// Class properties
|
|
|
|
startRecording: () => unknown;
|
|
|
|
finishRecording: () => unknown;
|
|
|
|
isRecording: () => boolean;
|
|
|
|
cancelRecording: () => unknown;
|
|
|
|
worker: Worker;
|
|
|
|
}
|
|
|
|
|
2022-06-13 21:39:35 +00:00
|
|
|
export type SignalCoreType = {
|
|
|
|
Crypto: typeof Crypto;
|
|
|
|
Curve: typeof Curve;
|
|
|
|
Data: typeof Data;
|
|
|
|
Groups: typeof Groups;
|
|
|
|
RemoteConfig: typeof RemoteConfig;
|
|
|
|
Services: {
|
|
|
|
calling: CallingClass;
|
|
|
|
enableStorageService: () => void;
|
|
|
|
eraseAllStorageServiceState: (options?: {
|
|
|
|
keepUnknownFields?: boolean | undefined;
|
|
|
|
}) => Promise<void>;
|
|
|
|
initializeGroupCredentialFetcher: () => Promise<void>;
|
|
|
|
initializeNetworkObserver: (network: ReduxActions['network']) => void;
|
|
|
|
initializeUpdateListener: (updates: ReduxActions['updates']) => void;
|
|
|
|
retryPlaceholders?: Util.RetryPlaceholders;
|
|
|
|
lightSessionResetQueue?: PQueue;
|
|
|
|
runStorageServiceSyncJob: (() => void) & Cancelable;
|
|
|
|
storageServiceUploadJob: (() => void) & Cancelable;
|
|
|
|
};
|
|
|
|
Migrations: ReturnType<typeof initializeMigrations>;
|
|
|
|
Types: {
|
|
|
|
Message: typeof Message2;
|
|
|
|
UUID: typeof UUID;
|
|
|
|
Address: typeof Address;
|
|
|
|
QualifiedAddress: typeof QualifiedAddress;
|
|
|
|
};
|
|
|
|
Util: typeof Util;
|
|
|
|
Components: {
|
|
|
|
AttachmentList: typeof AttachmentList;
|
|
|
|
ChatColorPicker: typeof ChatColorPicker;
|
|
|
|
ConfirmationDialog: typeof ConfirmationDialog;
|
|
|
|
ContactModal: typeof ContactModal;
|
|
|
|
DisappearingTimeDialog: typeof DisappearingTimeDialog;
|
|
|
|
MessageDetail: typeof MessageDetail;
|
|
|
|
Quote: typeof Quote;
|
|
|
|
StagedLinkPreview: typeof StagedLinkPreview;
|
|
|
|
};
|
|
|
|
OS: typeof OS;
|
|
|
|
State: {
|
|
|
|
createStore: typeof createStore;
|
|
|
|
Roots: {
|
|
|
|
createApp: typeof createApp;
|
|
|
|
createChatColorPicker: typeof createChatColorPicker;
|
|
|
|
createConversationDetails: typeof createConversationDetails;
|
|
|
|
createForwardMessageModal: typeof createForwardMessageModal;
|
|
|
|
createGroupLinkManagement: typeof createGroupLinkManagement;
|
|
|
|
createGroupV1MigrationModal: typeof createGroupV1MigrationModal;
|
|
|
|
createGroupV2JoinModal: typeof createGroupV2JoinModal;
|
|
|
|
createGroupV2Permissions: typeof createGroupV2Permissions;
|
|
|
|
createMessageDetail: typeof createMessageDetail;
|
|
|
|
createConversationNotificationsSettings: typeof createConversationNotificationsSettings;
|
|
|
|
createPendingInvites: typeof createPendingInvites;
|
|
|
|
createSafetyNumberViewer: typeof createSafetyNumberViewer;
|
|
|
|
createShortcutGuideModal: typeof createShortcutGuideModal;
|
|
|
|
createStickerManager: typeof createStickerManager;
|
|
|
|
createStickerPreviewModal: typeof createStickerPreviewModal;
|
|
|
|
};
|
|
|
|
Ducks: {
|
|
|
|
app: typeof appDuck;
|
|
|
|
calling: typeof callingDuck;
|
|
|
|
conversations: typeof conversationsDuck;
|
|
|
|
emojis: typeof emojisDuck;
|
|
|
|
expiration: typeof expirationDuck;
|
|
|
|
items: typeof itemsDuck;
|
|
|
|
linkPreviews: typeof linkPreviewsDuck;
|
|
|
|
network: typeof networkDuck;
|
|
|
|
updates: typeof updatesDuck;
|
|
|
|
user: typeof userDuck;
|
|
|
|
search: typeof searchDuck;
|
|
|
|
stickers: typeof stickersDuck;
|
|
|
|
};
|
|
|
|
Selectors: {
|
|
|
|
conversations: typeof conversationsSelectors;
|
|
|
|
search: typeof searchSelectors;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
conversationControllerStart: () => void;
|
|
|
|
challengeHandler?: ChallengeHandler;
|
|
|
|
};
|
|
|
|
|
2020-03-31 20:03:38 +00:00
|
|
|
declare global {
|
2021-01-14 18:07:05 +00:00
|
|
|
// We want to extend `window`'s properties, so we need an interface.
|
|
|
|
// eslint-disable-next-line no-restricted-syntax
|
2020-03-31 20:03:38 +00:00
|
|
|
interface Window {
|
2022-06-13 21:39:35 +00:00
|
|
|
// Used in Sticker Creator to create proper paths to emoji images
|
|
|
|
ROOT_PATH?: string;
|
|
|
|
// Used for sticker creator localization
|
|
|
|
localeMessages: { [key: string]: { message: string } };
|
|
|
|
|
|
|
|
// Note: used in background.html, and not type-checked
|
2021-02-26 21:06:37 +00:00
|
|
|
startApp: () => void;
|
|
|
|
|
2022-06-13 21:39:35 +00:00
|
|
|
preloadStartTime: number;
|
|
|
|
preloadEndTime: number;
|
|
|
|
|
2021-09-17 18:27:53 +00:00
|
|
|
removeSetupMenuItems: () => unknown;
|
2021-11-05 08:47:32 +00:00
|
|
|
showPermissionsPopup: (
|
|
|
|
forCalling: boolean,
|
|
|
|
forCamera: boolean
|
|
|
|
) => Promise<void>;
|
2021-09-17 18:27:53 +00:00
|
|
|
|
|
|
|
FontFace: typeof FontFace;
|
2020-09-24 20:57:54 +00:00
|
|
|
_: typeof Underscore;
|
|
|
|
$: typeof jQuery;
|
|
|
|
|
2021-01-20 01:19:00 +00:00
|
|
|
imageToBlurHash: typeof imageToBlurHash;
|
2020-09-24 20:57:54 +00:00
|
|
|
loadImage: any;
|
2021-01-20 01:19:00 +00:00
|
|
|
isBehindProxy: () => boolean;
|
2021-10-27 17:54:16 +00:00
|
|
|
getAutoLaunch: () => Promise<boolean>;
|
|
|
|
setAutoLaunch: (value: boolean) => Promise<void>;
|
2020-09-24 20:57:54 +00:00
|
|
|
|
|
|
|
PQueue: typeof PQueue;
|
|
|
|
PQueueType: PQueue;
|
2021-02-26 21:06:37 +00:00
|
|
|
Mustache: {
|
|
|
|
render: (template: string, data: any, partials?: any) => string;
|
|
|
|
parse: (template: string) => void;
|
|
|
|
};
|
2021-09-29 20:23:06 +00:00
|
|
|
WebAudioRecorder: typeof WebAudioRecorderClass;
|
2020-09-24 20:57:54 +00:00
|
|
|
|
|
|
|
WhatIsThis: WhatIsThis;
|
|
|
|
|
2021-06-14 19:01:00 +00:00
|
|
|
addSetupMenuItems: () => void;
|
2021-03-05 17:57:09 +00:00
|
|
|
attachmentDownloadQueue: Array<MessageModel> | undefined;
|
2021-03-13 01:22:36 +00:00
|
|
|
startupProcessingQueue: StartupQueue | undefined;
|
2020-09-24 20:57:54 +00:00
|
|
|
baseAttachmentsPath: string;
|
|
|
|
baseStickersPath: string;
|
|
|
|
baseTempPath: string;
|
2022-06-13 21:39:35 +00:00
|
|
|
baseDraftPath: string;
|
|
|
|
closeAbout: () => void;
|
2022-01-11 20:02:46 +00:00
|
|
|
crashReports: {
|
|
|
|
getCount: () => Promise<number>;
|
|
|
|
upload: () => Promise<void>;
|
|
|
|
erase: () => Promise<void>;
|
|
|
|
};
|
2021-09-23 18:16:09 +00:00
|
|
|
drawAttention: () => void;
|
2020-09-24 20:57:54 +00:00
|
|
|
enterKeyboardMode: () => void;
|
|
|
|
enterMouseMode: () => void;
|
2021-07-23 17:23:50 +00:00
|
|
|
getAccountManager: () => AccountManager;
|
2022-06-13 21:39:35 +00:00
|
|
|
getAppInstance: () => string | undefined;
|
2021-05-03 16:38:20 +00:00
|
|
|
getBuiltInImages: () => Promise<Array<string>>;
|
2020-07-10 18:28:49 +00:00
|
|
|
getConversations: () => ConversationModelCollectionType;
|
2021-09-13 19:00:32 +00:00
|
|
|
getBuildCreation: () => number;
|
2021-02-04 19:54:03 +00:00
|
|
|
getEnvironment: typeof getEnvironment;
|
2022-06-13 21:39:35 +00:00
|
|
|
getExpiration: () => number;
|
2021-09-17 18:27:53 +00:00
|
|
|
getHostName: () => string;
|
2020-10-30 17:52:21 +00:00
|
|
|
getInteractionMode: () => 'mouse' | 'keyboard';
|
2022-06-13 21:39:35 +00:00
|
|
|
getLocale: () => string;
|
2020-06-04 18:16:19 +00:00
|
|
|
getMediaCameraPermissions: () => Promise<boolean>;
|
2020-07-10 18:28:49 +00:00
|
|
|
getMediaPermissions: () => Promise<boolean>;
|
2020-09-09 02:25:05 +00:00
|
|
|
getServerPublicParams: () => string;
|
2020-12-07 19:40:11 +00:00
|
|
|
getSfuUrl: () => string;
|
2021-06-09 22:28:54 +00:00
|
|
|
getSocketStatus: () => SocketStatus;
|
2021-04-08 17:09:54 +00:00
|
|
|
getSyncRequest: (timeoutMillis?: number) => SyncRequest;
|
2020-07-10 18:28:49 +00:00
|
|
|
getTitle: () => string;
|
2020-09-09 02:25:05 +00:00
|
|
|
waitForEmptyEventQueue: () => Promise<void>;
|
2020-09-09 22:50:44 +00:00
|
|
|
getVersion: () => string;
|
2020-06-04 18:16:19 +00:00
|
|
|
i18n: LocalizerType;
|
2020-09-24 20:57:54 +00:00
|
|
|
isActive: () => boolean;
|
2021-05-03 16:38:20 +00:00
|
|
|
isAfterVersion: (version: string, anotherVersion: string) => boolean;
|
|
|
|
isBeforeVersion: (version: string, anotherVersion: string) => boolean;
|
2021-02-01 20:01:25 +00:00
|
|
|
isFullScreen: () => boolean;
|
2022-05-11 22:58:14 +00:00
|
|
|
initialTheme?: ThemeType;
|
2022-06-13 21:39:35 +00:00
|
|
|
libphonenumberInstance: {
|
|
|
|
parse: (number: string) => PhoneNumber;
|
|
|
|
getRegionCodeForNumber: (number: PhoneNumber) => string | undefined;
|
|
|
|
format: (number: PhoneNumber, format: PhoneNumberFormat) => string;
|
2020-04-13 17:37:29 +00:00
|
|
|
};
|
2022-06-13 21:39:35 +00:00
|
|
|
libphonenumberFormat: typeof PhoneNumberFormat;
|
2020-09-24 20:57:54 +00:00
|
|
|
nodeSetImmediate: typeof setImmediate;
|
2021-02-01 20:01:25 +00:00
|
|
|
onFullScreenChange: (fullScreen: boolean) => void;
|
2020-06-04 18:16:19 +00:00
|
|
|
platform: string;
|
2020-09-24 20:57:54 +00:00
|
|
|
preloadedImages: Array<WhatIsThis>;
|
2020-09-09 22:50:44 +00:00
|
|
|
reduxActions: ReduxActions;
|
2021-06-16 00:44:14 +00:00
|
|
|
reduxStore: Store<StateType>;
|
2020-12-17 23:12:15 +00:00
|
|
|
registerForActive: (handler: () => void) => void;
|
2020-04-01 18:59:11 +00:00
|
|
|
restart: () => void;
|
2020-09-24 20:57:54 +00:00
|
|
|
setImmediate: typeof setImmediate;
|
2020-06-04 18:16:19 +00:00
|
|
|
showWindow: () => void;
|
2020-09-16 19:31:05 +00:00
|
|
|
showSettings: () => void;
|
2020-09-24 20:57:54 +00:00
|
|
|
shutdown: () => void;
|
2021-07-15 23:48:09 +00:00
|
|
|
showDebugLog: () => void;
|
2021-05-06 00:09:29 +00:00
|
|
|
sendChallengeRequest: (request: IPCChallengeRequest) => void;
|
2020-09-24 20:57:54 +00:00
|
|
|
setAutoHideMenuBar: (value: WhatIsThis) => void;
|
2020-07-10 18:28:49 +00:00
|
|
|
setBadgeCount: (count: number) => void;
|
2020-09-24 20:57:54 +00:00
|
|
|
setMenuBarVisibility: (value: WhatIsThis) => void;
|
2021-06-29 17:18:03 +00:00
|
|
|
updateSystemTraySetting: (value: SystemTraySetting) => void;
|
2021-01-04 18:47:14 +00:00
|
|
|
showConfirmationDialog: (options: ConfirmationDialogViewProps) => void;
|
2020-09-24 20:57:54 +00:00
|
|
|
showKeyboardShortcuts: () => void;
|
2021-06-15 00:09:37 +00:00
|
|
|
storage: Storage;
|
2020-09-24 20:57:54 +00:00
|
|
|
systemTheme: WhatIsThis;
|
2022-06-13 21:39:35 +00:00
|
|
|
textsecure: typeof textsecure;
|
2021-02-01 20:01:25 +00:00
|
|
|
titleBarDoubleClick: () => void;
|
2020-12-17 23:12:15 +00:00
|
|
|
unregisterForActive: (handler: () => void) => void;
|
2020-07-10 18:28:49 +00:00
|
|
|
updateTrayIcon: (count: number) => void;
|
|
|
|
Backbone: typeof Backbone;
|
2021-08-11 19:29:07 +00:00
|
|
|
CI?: CI;
|
2021-12-16 15:02:22 +00:00
|
|
|
|
2021-04-27 22:11:59 +00:00
|
|
|
Accessibility: {
|
|
|
|
reducedMotionSetting: boolean;
|
|
|
|
};
|
2022-06-13 21:39:35 +00:00
|
|
|
Signal: SignalCoreType;
|
2020-09-24 20:57:54 +00:00
|
|
|
|
2020-07-10 18:28:49 +00:00
|
|
|
ConversationController: ConversationController;
|
2021-08-18 20:08:14 +00:00
|
|
|
Events: IPCEventsType;
|
2021-06-16 00:44:14 +00:00
|
|
|
MessageController: MessageController;
|
2021-02-26 23:42:45 +00:00
|
|
|
SignalProtocolStore: typeof SignalProtocolStore;
|
2020-04-13 17:37:29 +00:00
|
|
|
WebAPI: WebAPIConnectType;
|
2020-03-31 20:03:38 +00:00
|
|
|
Whisper: WhisperType;
|
2020-06-04 18:16:19 +00:00
|
|
|
|
2020-09-24 20:57:54 +00:00
|
|
|
getServerTrustRoot: () => WhatIsThis;
|
|
|
|
readyForUpdates: () => void;
|
2021-08-03 17:05:20 +00:00
|
|
|
logAppLoadedEvent?: (options: { processedCount?: number }) => void;
|
|
|
|
logAuthenticatedConnect?: () => void;
|
2020-11-13 19:57:55 +00:00
|
|
|
|
2021-01-29 22:16:48 +00:00
|
|
|
// Runtime Flags
|
|
|
|
isShowingModal?: boolean;
|
|
|
|
|
|
|
|
// Feature Flags
|
2020-12-18 19:27:43 +00:00
|
|
|
GV2_ENABLE_SINGLE_CHANGE_PROCESSING: boolean;
|
|
|
|
GV2_ENABLE_CHANGE_PROCESSING: boolean;
|
|
|
|
GV2_ENABLE_STATE_PROCESSING: boolean;
|
2022-05-16 14:53:54 +00:00
|
|
|
GV2_ENABLE_PRE_JOIN_FETCH: boolean;
|
2021-01-12 15:44:44 +00:00
|
|
|
GV2_MIGRATION_DISABLE_ADD: boolean;
|
|
|
|
GV2_MIGRATION_DISABLE_INVITE: boolean;
|
2021-08-20 16:06:15 +00:00
|
|
|
|
2021-07-15 23:48:09 +00:00
|
|
|
RETRY_DELAY: boolean;
|
2021-09-02 15:48:53 +00:00
|
|
|
|
2021-09-17 18:27:53 +00:00
|
|
|
// Context Isolation
|
2021-10-07 23:28:47 +00:00
|
|
|
SignalContext: SignalContextType;
|
2022-06-13 21:39:35 +00:00
|
|
|
|
|
|
|
// Test only
|
|
|
|
assert: typeof assert;
|
|
|
|
// Used in test/index.html, and therefore not type-checked!
|
|
|
|
testUtilities: {
|
|
|
|
onComplete: (data: any) => void;
|
|
|
|
prepareTests: () => void;
|
|
|
|
};
|
2020-03-31 20:03:38 +00:00
|
|
|
}
|
2020-05-27 21:37:06 +00:00
|
|
|
|
2021-01-14 18:07:05 +00:00
|
|
|
// We want to extend `Error`, so we need an interface.
|
|
|
|
// eslint-disable-next-line no-restricted-syntax
|
2020-05-27 21:37:06 +00:00
|
|
|
interface Error {
|
2021-04-14 01:27:43 +00:00
|
|
|
originalError?: Event;
|
2021-07-09 19:36:10 +00:00
|
|
|
reason?: any;
|
|
|
|
stackForLog?: string;
|
2022-06-13 21:39:35 +00:00
|
|
|
|
|
|
|
// Used in sticker creator to attach messages to errors
|
|
|
|
errorMessageI18nKey?: string;
|
2020-05-27 21:37:06 +00:00
|
|
|
}
|
2021-06-15 00:09:37 +00:00
|
|
|
|
2022-02-25 23:35:53 +00:00
|
|
|
// We want to extend `Element`'s properties, so we need an interface.
|
|
|
|
// eslint-disable-next-line no-restricted-syntax
|
|
|
|
interface Element {
|
|
|
|
// WebKit-specific
|
|
|
|
scrollIntoViewIfNeeded: (bringToCenter?: boolean) => void;
|
|
|
|
}
|
|
|
|
|
2021-06-15 00:09:37 +00:00
|
|
|
// Uint8Array and ArrayBuffer are type-compatible in TypeScript's covariant
|
|
|
|
// type checker, but in reality they are not. Let's assert correct use!
|
|
|
|
interface Uint8Array {
|
|
|
|
__uint8array: never;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ArrayBuffer {
|
|
|
|
__array_buffer: never;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface SharedArrayBuffer {
|
|
|
|
__array_buffer: never;
|
|
|
|
}
|
2020-03-31 20:03:38 +00:00
|
|
|
}
|
|
|
|
|
2020-04-13 17:37:29 +00:00
|
|
|
export class CertificateValidatorType {
|
|
|
|
validate: (cerficate: any, certificateTime: number) => Promise<void>;
|
|
|
|
}
|
2020-03-31 20:03:38 +00:00
|
|
|
|
2020-06-04 18:16:19 +00:00
|
|
|
export class GumVideoCapturer {
|
|
|
|
constructor(
|
|
|
|
maxWidth: number,
|
|
|
|
maxHeight: number,
|
|
|
|
maxFramerate: number,
|
|
|
|
localPreview: Ref<HTMLVideoElement>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export class CanvasVideoRenderer {
|
|
|
|
constructor(canvas: Ref<HTMLCanvasElement>);
|
|
|
|
}
|
|
|
|
|
2020-03-31 20:03:38 +00:00
|
|
|
export type WhisperType = {
|
2021-08-30 21:32:56 +00:00
|
|
|
Conversation: typeof ConversationModel;
|
|
|
|
ConversationCollection: typeof ConversationModelCollectionType;
|
|
|
|
Message: typeof MessageModel;
|
|
|
|
MessageCollection: typeof MessageModelCollectionType;
|
|
|
|
|
|
|
|
deliveryReceiptQueue: PQueue;
|
2021-12-07 22:41:40 +00:00
|
|
|
deliveryReceiptBatcher: BatcherType<Receipt>;
|
2021-07-19 20:45:18 +00:00
|
|
|
events: Backbone.Events;
|
2021-08-30 21:32:56 +00:00
|
|
|
|
|
|
|
// Backbone views
|
|
|
|
|
|
|
|
ConversationView: typeof ConversationView;
|
|
|
|
|
|
|
|
// Note: we can no longer use 'View.extend' once we've moved to Typescript's preferred
|
|
|
|
// 'extend View' syntax. Thus, we'll need to typescriptify most of it at once.
|
|
|
|
|
2022-06-03 16:33:39 +00:00
|
|
|
InboxView: typeof Backbone.View;
|
|
|
|
View: typeof Backbone.View;
|
2020-03-31 20:03:38 +00:00
|
|
|
};
|