Use single WebAPI instance across the app

This commit is contained in:
Fedor Indutny
2021-07-23 10:23:50 -07:00
committed by GitHub
parent 79633a9e7b
commit fdec47d637
19 changed files with 218 additions and 308 deletions
@@ -34,12 +34,13 @@ describe('Conversations', () => {
version: 0,
});
window.textsecure.storage.user.setNumberAndDeviceId(
ourNumber,
2,
'my device'
);
window.textsecure.storage.user.setUuidAndDeviceId(ourUuid, 2);
await window.textsecure.storage.user.setCredentials({
number: ourNumber,
uuid: ourUuid,
deviceId: 2,
deviceName: 'my device',
password: 'password',
});
await window.ConversationController.loadPromise();
await window.Signal.Data.saveConversation(conversation.attributes);
+2 -1
View File
@@ -7,6 +7,7 @@ import { setup as setupI18n } from '../../../js/modules/i18n';
import enMessages from '../../../_locales/en/messages.json';
import { SendStatus } from '../../messages/MessageSendState';
import MessageSender from '../../textsecure/SendMessage';
import { WebAPIType } from '../../textsecure/WebAPI';
import { CallbackResultType } from '../../textsecure/Types.d';
import type { StorageAccessType } from '../../types/Storage.d';
import { SignalService as Proto } from '../../protobuf';
@@ -81,7 +82,7 @@ describe('Message', () => {
oldMessageSender = window.textsecure.messaging;
window.textsecure.messaging =
oldMessageSender ?? new MessageSender('username', 'password');
oldMessageSender ?? new MessageSender({} as WebAPIType);
this.sandbox
.stub(window.textsecure.messaging, 'sendSyncMessage')
.resolves({});