Add some types to window and window.Signal
This commit is contained in:
parent
bba50c8427
commit
9f6e9ba47d
2 changed files with 44 additions and 43 deletions
|
@ -1424,7 +1424,10 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
}
|
}
|
||||||
const contacts = this.get('contact');
|
const contacts = this.get('contact');
|
||||||
if (contacts && contacts.length) {
|
if (contacts && contacts.length) {
|
||||||
return { text: Contact.getName(contacts[0]), emoji: '👤' };
|
return {
|
||||||
|
text: Contact.getName(contacts[0]) || window.i18n('unknownContact'),
|
||||||
|
emoji: '👤',
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body) {
|
if (body) {
|
||||||
|
|
82
ts/window.d.ts
vendored
82
ts/window.d.ts
vendored
|
@ -5,8 +5,11 @@
|
||||||
|
|
||||||
import * as Backbone from 'backbone';
|
import * as Backbone from 'backbone';
|
||||||
import * as Underscore from 'underscore';
|
import * as Underscore from 'underscore';
|
||||||
|
import moment from 'moment';
|
||||||
|
import PQueue from 'p-queue/dist';
|
||||||
import { Ref } from 'react';
|
import { Ref } from 'react';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
|
import { imageToBlurHash } from './util/imageToBlurHash';
|
||||||
import * as LinkPreviews from '../js/modules/link_previews.d';
|
import * as LinkPreviews from '../js/modules/link_previews.d';
|
||||||
import * as Util from './util';
|
import * as Util from './util';
|
||||||
import {
|
import {
|
||||||
|
@ -25,9 +28,14 @@ import { CallingClass } from './services/calling';
|
||||||
import * as Groups from './groups';
|
import * as Groups from './groups';
|
||||||
import * as Crypto from './Crypto';
|
import * as Crypto from './Crypto';
|
||||||
import * as RemoteConfig from './RemoteConfig';
|
import * as RemoteConfig from './RemoteConfig';
|
||||||
|
import * as OS from './OS';
|
||||||
import * as zkgroup from './util/zkgroup';
|
import * as zkgroup from './util/zkgroup';
|
||||||
import { LocalizerType, BodyRangesType, BodyRangeType } from './types/Util';
|
import { LocalizerType, BodyRangesType, BodyRangeType } from './types/Util';
|
||||||
|
import * as Attachment from './types/Attachment';
|
||||||
import { ColorType } from './types/Colors';
|
import { ColorType } from './types/Colors';
|
||||||
|
import * as MIME from './types/MIME';
|
||||||
|
import * as Contact from './types/Contact';
|
||||||
|
import * as Errors from '../js/modules/types/errors';
|
||||||
import { ConversationController } from './ConversationController';
|
import { ConversationController } from './ConversationController';
|
||||||
import { ReduxActions } from './state/types';
|
import { ReduxActions } from './state/types';
|
||||||
import { createStore } from './state/createStore';
|
import { createStore } from './state/createStore';
|
||||||
|
@ -58,16 +66,24 @@ import { SendOptionsType } from './textsecure/SendMessage';
|
||||||
import AccountManager from './textsecure/AccountManager';
|
import AccountManager from './textsecure/AccountManager';
|
||||||
import Data from './sql/Client';
|
import Data from './sql/Client';
|
||||||
import { UserMessage } from './types/Message';
|
import { UserMessage } from './types/Message';
|
||||||
import PQueue from 'p-queue/dist';
|
|
||||||
import { PhoneNumberFormat } from 'google-libphonenumber';
|
import { PhoneNumberFormat } from 'google-libphonenumber';
|
||||||
import { MessageModel } from './models/messages';
|
import { MessageModel } from './models/messages';
|
||||||
import { ConversationModel } from './models/conversations';
|
import { ConversationModel } from './models/conversations';
|
||||||
import { combineNames } from './util';
|
import { combineNames } from './util';
|
||||||
import { BatcherType } from './util/batcher';
|
import { BatcherType } from './util/batcher';
|
||||||
|
import { AttachmentList } from './components/conversation/AttachmentList';
|
||||||
|
import { CaptionEditor } from './components/CaptionEditor';
|
||||||
import { ConfirmationModal } from './components/ConfirmationModal';
|
import { ConfirmationModal } from './components/ConfirmationModal';
|
||||||
import { ErrorModal } from './components/ErrorModal';
|
import { ContactDetail } from './components/conversation/ContactDetail';
|
||||||
import { ProgressModal } from './components/ProgressModal';
|
|
||||||
import { ContactModal } from './components/conversation/ContactModal';
|
import { ContactModal } from './components/conversation/ContactModal';
|
||||||
|
import { ErrorModal } from './components/ErrorModal';
|
||||||
|
import { Lightbox } from './components/Lightbox';
|
||||||
|
import { LightboxGallery } from './components/LightboxGallery';
|
||||||
|
import { MediaGallery } from './components/conversation/media-gallery/MediaGallery';
|
||||||
|
import { MessageDetail } from './components/conversation/MessageDetail';
|
||||||
|
import { ProgressModal } from './components/ProgressModal';
|
||||||
|
import { Quote } from './components/conversation/Quote';
|
||||||
|
import { StagedLinkPreview } from './components/conversation/StagedLinkPreview';
|
||||||
|
|
||||||
export { Long } from 'long';
|
export { Long } from 'long';
|
||||||
|
|
||||||
|
@ -93,12 +109,12 @@ declare global {
|
||||||
_: typeof Underscore;
|
_: typeof Underscore;
|
||||||
$: typeof jQuery;
|
$: typeof jQuery;
|
||||||
|
|
||||||
moment: any;
|
moment: typeof moment;
|
||||||
imageToBlurHash: any;
|
imageToBlurHash: typeof imageToBlurHash;
|
||||||
autoOrientImage: any;
|
autoOrientImage: any;
|
||||||
dataURLToBlobSync: any;
|
dataURLToBlobSync: any;
|
||||||
loadImage: any;
|
loadImage: any;
|
||||||
isBehindProxy: any;
|
isBehindProxy: () => boolean;
|
||||||
|
|
||||||
PQueue: typeof PQueue;
|
PQueue: typeof PQueue;
|
||||||
PQueueType: PQueue;
|
PQueueType: PQueue;
|
||||||
|
@ -159,7 +175,7 @@ declare global {
|
||||||
error: LoggerType;
|
error: LoggerType;
|
||||||
};
|
};
|
||||||
nodeSetImmediate: typeof setImmediate;
|
nodeSetImmediate: typeof setImmediate;
|
||||||
normalizeUuids: (obj: any, paths: Array<string>, context: string) => any;
|
normalizeUuids: (obj: any, paths: Array<string>, context: string) => void;
|
||||||
owsDesktopApp: WhatIsThis;
|
owsDesktopApp: WhatIsThis;
|
||||||
platform: string;
|
platform: string;
|
||||||
preloadedImages: Array<WhatIsThis>;
|
preloadedImages: Array<WhatIsThis>;
|
||||||
|
@ -321,26 +337,12 @@ declare global {
|
||||||
) => WhatIsThis;
|
) => WhatIsThis;
|
||||||
|
|
||||||
isVoiceMessage: (attachments: unknown) => boolean;
|
isVoiceMessage: (attachments: unknown) => boolean;
|
||||||
isImage: (attachments: unknown) => boolean;
|
isImage: typeof Attachment.isImage;
|
||||||
isVideo: (attachments: unknown) => boolean;
|
isVideo: typeof Attachment.isVideo;
|
||||||
isAudio: (attachments: unknown) => boolean;
|
isAudio: typeof Attachment.isAudio;
|
||||||
};
|
|
||||||
MIME: {
|
|
||||||
IMAGE_GIF: unknown;
|
|
||||||
isImage: any;
|
|
||||||
isJPEG: any;
|
|
||||||
};
|
|
||||||
Contact: {
|
|
||||||
avatar?: { avatar?: unknown };
|
|
||||||
number: Array<{ value: string }>;
|
|
||||||
signalAccount: unknown;
|
|
||||||
|
|
||||||
contactSelector: (
|
|
||||||
contact: typeof window.Signal.Types.Contact,
|
|
||||||
options: unknown
|
|
||||||
) => typeof window.Signal.Types.Contact;
|
|
||||||
getName: (contact: typeof window.Signal.Types.Contact) => string;
|
|
||||||
};
|
};
|
||||||
|
MIME: typeof MIME;
|
||||||
|
Contact: typeof Contact;
|
||||||
Conversation: {
|
Conversation: {
|
||||||
computeHash: (data: string) => Promise<string>;
|
computeHash: (data: string) => Promise<string>;
|
||||||
deleteExternalFiles: (
|
deleteExternalFiles: (
|
||||||
|
@ -372,9 +374,7 @@ declare global {
|
||||||
e164: string;
|
e164: string;
|
||||||
error: string;
|
error: string;
|
||||||
};
|
};
|
||||||
Errors: {
|
Errors: typeof Errors;
|
||||||
toLogFormat(error: Error): void;
|
|
||||||
};
|
|
||||||
Message: {
|
Message: {
|
||||||
CURRENT_SCHEMA_VERSION: number;
|
CURRENT_SCHEMA_VERSION: number;
|
||||||
VERSION_NEEDED_FOR_DISPLAY: number;
|
VERSION_NEEDED_FOR_DISPLAY: number;
|
||||||
|
@ -410,23 +410,21 @@ declare global {
|
||||||
renderChange: (change: unknown, things: unknown) => Array<string>;
|
renderChange: (change: unknown, things: unknown) => Array<string>;
|
||||||
};
|
};
|
||||||
Components: {
|
Components: {
|
||||||
AttachmentList: any;
|
AttachmentList: typeof AttachmentList;
|
||||||
CaptionEditor: any;
|
CaptionEditor: typeof CaptionEditor;
|
||||||
ConfirmationModal: typeof ConfirmationModal;
|
ConfirmationModal: typeof ConfirmationModal;
|
||||||
ContactDetail: any;
|
ContactDetail: typeof ContactDetail;
|
||||||
ErrorModal: typeof ErrorModal;
|
|
||||||
ContactModal: typeof ContactModal;
|
ContactModal: typeof ContactModal;
|
||||||
Lightbox: any;
|
ErrorModal: typeof ErrorModal;
|
||||||
LightboxGallery: any;
|
Lightbox: typeof Lightbox;
|
||||||
MediaGallery: any;
|
LightboxGallery: typeof LightboxGallery;
|
||||||
MessageDetail: any;
|
MediaGallery: typeof MediaGallery;
|
||||||
|
MessageDetail: typeof MessageDetail;
|
||||||
ProgressModal: typeof ProgressModal;
|
ProgressModal: typeof ProgressModal;
|
||||||
Quote: any;
|
Quote: typeof Quote;
|
||||||
StagedLinkPreview: any;
|
StagedLinkPreview: typeof StagedLinkPreview;
|
||||||
};
|
|
||||||
OS: {
|
|
||||||
isLinux: () => boolean;
|
|
||||||
};
|
};
|
||||||
|
OS: typeof OS;
|
||||||
Workflow: {
|
Workflow: {
|
||||||
IdleDetector: WhatIsThis;
|
IdleDetector: WhatIsThis;
|
||||||
MessageDataMigrator: WhatIsThis;
|
MessageDataMigrator: WhatIsThis;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue