Remove Signal.Util

This commit is contained in:
Jamie Kyle 2023-04-10 20:54:43 -07:00 committed by GitHub
parent 3a069323a4
commit 76b9d07acf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 132 additions and 202 deletions

View file

@ -33,6 +33,7 @@ import { strictAssert, assertDev } from './assert';
import * as durations from './durations';
import type { DurationInSeconds } from './durations';
import { isPhoneNumberSharingEnabled } from './isPhoneNumberSharingEnabled';
import * as Registration from './registration';
import {
parseE164FromSignalDotMeHash,
parseUsernameFromSignalDotMeHash,
@ -453,7 +454,7 @@ export function createIPCEvents(
},
authorizeArtCreator: (data: AuthorizeArtCreatorDataType) => {
// We can get these events even if the user has never linked this instance.
if (!window.Signal.Util.Registration.everDone()) {
if (!Registration.everDone()) {
log.warn('authorizeArtCreator: Not registered, returning early');
return;
}
@ -481,7 +482,7 @@ export function createIPCEvents(
showStickerPack: (packId, key) => {
// We can get these events even if the user has never linked this instance.
if (!window.Signal.Util.Registration.everDone()) {
if (!Registration.everDone()) {
log.warn('showStickerPack: Not registered, returning early');
return;
}
@ -489,7 +490,7 @@ export function createIPCEvents(
},
showGroupViaLink: async hash => {
// We can get these events even if the user has never linked this instance.
if (!window.Signal.Util.Registration.everDone()) {
if (!Registration.everDone()) {
log.warn('showGroupViaLink: Not registered, returning early');
return;
}
@ -507,7 +508,7 @@ export function createIPCEvents(
}
},
async showConversationViaSignalDotMe(hash: string) {
if (!window.Signal.Util.Registration.everDone()) {
if (!Registration.everDone()) {
log.info(
'showConversationViaSignalDotMe: Not registered, returning early'
);

View file

@ -13,6 +13,7 @@ import { findAndDeleteOnboardingStoryIfExists } from './findAndDeleteOnboardingS
import { runStorageServiceSyncJob } from '../services/storage';
import { saveNewMessageBatcher } from './messageBatcher';
import { strictAssert } from './assert';
import { incrementMessageCounter } from './incrementMessageCounter';
// * Check if we've viewed onboarding story. Short circuit.
// * Run storage service sync (just in case) and check again.
@ -106,7 +107,7 @@ async function continueDownloadingOnboardingStory(): Promise<void> {
conversationId: signalConversation.id,
id: UUID.generate().toString(),
readStatus: ReadStatus.Unread,
received_at: window.Signal.Util.incrementMessageCounter(),
received_at: incrementMessageCounter(),
received_at_ms: timestamp,
seenStatus: SeenStatus.Unseen,
sent_at: timestamp,

View file

@ -39,6 +39,7 @@ import type MessageSender from '../textsecure/SendMessage';
import type { StoryDistributionListDataType } from '../state/ducks/storyDistributionLists';
import { drop } from './drop';
import { conversationJobQueue } from '../jobs/conversationJobQueue';
import { incrementMessageCounter } from './incrementMessageCounter';
const RETRY_LIMIT = 5;
@ -668,7 +669,7 @@ export function startAutomaticSessionReset(
}
const receivedAt = Date.now();
const receivedAtCounter = window.Signal.Util.incrementMessageCounter();
const receivedAtCounter = incrementMessageCounter();
drop(
conversation.queueJob('addChatSessionRefreshed', async () => {
await conversation.addChatSessionRefreshed({

View file

@ -8,6 +8,7 @@ import * as Errors from '../types/errors';
import * as log from '../logging/log';
import { ProgressModal } from '../components/ProgressModal';
import { clearTimeoutIfNecessary } from './clearTimeoutIfNecessary';
import { sleep } from './sleep';
export async function longRunningTaskWrapper<T>({
name,
@ -49,7 +50,7 @@ export async function longRunningTaskWrapper<T>({
log.info(
`longRunningTaskWrapper/${idLog}: Spinner shown for less than second, showing for another second`
);
await window.Signal.Util.sleep(ONE_SECOND);
await sleep(ONE_SECOND);
}
unmountComponentAtNode(progressNode);
progressNode = undefined;