Fixes storybook
This commit is contained in:
parent
4fa614e1d6
commit
4a5da95c1d
11 changed files with 19 additions and 30 deletions
|
@ -28,7 +28,7 @@ import { sleep } from './util/sleep';
|
||||||
import { isNotNil } from './util/isNotNil';
|
import { isNotNil } from './util/isNotNil';
|
||||||
import { MINUTE, SECOND } from './util/durations';
|
import { MINUTE, SECOND } from './util/durations';
|
||||||
import { getUuidsForE164s } from './util/getUuidsForE164s';
|
import { getUuidsForE164s } from './util/getUuidsForE164s';
|
||||||
import { SIGNAL_ACI, SIGNAL_AVATAR_PATH } from './types/Conversation';
|
import { SIGNAL_ACI, SIGNAL_AVATAR_PATH } from './types/SignalConversation';
|
||||||
|
|
||||||
type ConvoMatchType =
|
type ConvoMatchType =
|
||||||
| {
|
| {
|
||||||
|
@ -409,8 +409,8 @@ export class ConversationController {
|
||||||
return conversation;
|
return conversation;
|
||||||
}
|
}
|
||||||
|
|
||||||
getOrCreateSignalConversation(): ConversationModel {
|
async getOrCreateSignalConversation(): Promise<ConversationModel> {
|
||||||
const conversation = this.getOrCreate(SIGNAL_ACI, 'private', {
|
const conversation = await this.getOrCreateAndWait(SIGNAL_ACI, 'private', {
|
||||||
muteExpiresAt: Number.MAX_SAFE_INTEGER,
|
muteExpiresAt: Number.MAX_SAFE_INTEGER,
|
||||||
profileAvatar: { path: SIGNAL_AVATAR_PATH },
|
profileAvatar: { path: SIGNAL_AVATAR_PATH },
|
||||||
profileName: 'Signal',
|
profileName: 'Signal',
|
||||||
|
@ -422,28 +422,12 @@ export class ConversationController {
|
||||||
return conversation;
|
return conversation;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSignalConversationId(): string {
|
|
||||||
if (this._signalConversationId) {
|
|
||||||
return this._signalConversationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
let conversation = this.get(SIGNAL_ACI);
|
|
||||||
|
|
||||||
if (!conversation) {
|
|
||||||
conversation = this.getOrCreateSignalConversation();
|
|
||||||
}
|
|
||||||
|
|
||||||
this._signalConversationId = conversation.id;
|
|
||||||
|
|
||||||
return conversation.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
isSignalConversation(uuidOrId: string): boolean {
|
isSignalConversation(uuidOrId: string): boolean {
|
||||||
if (uuidOrId === SIGNAL_ACI) {
|
if (uuidOrId === SIGNAL_ACI) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.getSignalConversationId() === uuidOrId;
|
return this._signalConversationId === uuidOrId;
|
||||||
}
|
}
|
||||||
|
|
||||||
areWePrimaryDevice(): boolean {
|
areWePrimaryDevice(): boolean {
|
||||||
|
|
|
@ -1021,6 +1021,7 @@ export async function startApp(): Promise<void> {
|
||||||
await window.ConversationController.load();
|
await window.ConversationController.load();
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
window.ConversationController.getOrCreateSignalConversation(),
|
||||||
Stickers.load(),
|
Stickers.load(),
|
||||||
loadRecentEmojis(),
|
loadRecentEmojis(),
|
||||||
loadInitialBadgesState(),
|
loadInitialBadgesState(),
|
||||||
|
|
|
@ -25,7 +25,7 @@ import { getBadgeImageFileLocalPath } from '../badges/getBadgeImageFileLocalPath
|
||||||
import { getInitials } from '../util/getInitials';
|
import { getInitials } from '../util/getInitials';
|
||||||
import { isBadgeVisible } from '../badges/isBadgeVisible';
|
import { isBadgeVisible } from '../badges/isBadgeVisible';
|
||||||
import { shouldBlurAvatar } from '../util/shouldBlurAvatar';
|
import { shouldBlurAvatar } from '../util/shouldBlurAvatar';
|
||||||
import { SIGNAL_AVATAR_PATH } from '../types/Conversation';
|
import { SIGNAL_AVATAR_PATH } from '../types/SignalConversation';
|
||||||
|
|
||||||
export enum AvatarBlur {
|
export enum AvatarBlur {
|
||||||
NoBlur,
|
NoBlur,
|
||||||
|
|
|
@ -11,7 +11,7 @@ import type { ViewUserStoriesActionCreatorType } from '../state/ducks/stories';
|
||||||
import { Avatar, AvatarSize } from './Avatar';
|
import { Avatar, AvatarSize } from './Avatar';
|
||||||
import { ConfirmationDialog } from './ConfirmationDialog';
|
import { ConfirmationDialog } from './ConfirmationDialog';
|
||||||
import { ContextMenu } from './ContextMenu';
|
import { ContextMenu } from './ContextMenu';
|
||||||
import { SIGNAL_ACI } from '../types/Conversation';
|
import { SIGNAL_ACI } from '../types/SignalConversation';
|
||||||
import { StoryViewTargetType, HasStories } from '../types/Stories';
|
import { StoryViewTargetType, HasStories } from '../types/Stories';
|
||||||
|
|
||||||
import { MessageTimestamp } from './conversation/MessageTimestamp';
|
import { MessageTimestamp } from './conversation/MessageTimestamp';
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { isNotNil } from '../util/isNotNil';
|
||||||
import { strictAssert } from '../util/assert';
|
import { strictAssert } from '../util/assert';
|
||||||
import { dropNull } from '../util/dropNull';
|
import { dropNull } from '../util/dropNull';
|
||||||
import { isGroup } from '../util/whatTypeOfConversation';
|
import { isGroup } from '../util/whatTypeOfConversation';
|
||||||
import { SIGNAL_ACI } from '../types/Conversation';
|
import { SIGNAL_ACI } from '../types/SignalConversation';
|
||||||
|
|
||||||
let storyData:
|
let storyData:
|
||||||
| Array<
|
| Array<
|
||||||
|
|
|
@ -20,7 +20,7 @@ import type { StoryViewTargetType, StoryViewType } from '../../types/Stories';
|
||||||
import type { SyncType } from '../../jobs/helpers/syncHelpers';
|
import type { SyncType } from '../../jobs/helpers/syncHelpers';
|
||||||
import type { UUIDStringType } from '../../types/UUID';
|
import type { UUIDStringType } from '../../types/UUID';
|
||||||
import * as log from '../../logging/log';
|
import * as log from '../../logging/log';
|
||||||
import { SIGNAL_ACI } from '../../types/Conversation';
|
import { SIGNAL_ACI } from '../../types/SignalConversation';
|
||||||
import dataInterface from '../../sql/Client';
|
import dataInterface from '../../sql/Client';
|
||||||
import { ReadStatus } from '../../messages/MessageReadStatus';
|
import { ReadStatus } from '../../messages/MessageReadStatus';
|
||||||
import { SafetyNumberChangeSource } from '../../components/SafetyNumberChangeDialog';
|
import { SafetyNumberChangeSource } from '../../components/SafetyNumberChangeDialog';
|
||||||
|
|
|
@ -38,7 +38,7 @@ import { getStoriesEnabled } from './items';
|
||||||
import { calculateExpirationTimestamp } from '../../util/expirationTimer';
|
import { calculateExpirationTimestamp } from '../../util/expirationTimer';
|
||||||
import { getMessageIdForLogging } from '../../util/idForLogging';
|
import { getMessageIdForLogging } from '../../util/idForLogging';
|
||||||
import * as log from '../../logging/log';
|
import * as log from '../../logging/log';
|
||||||
import { SIGNAL_ACI } from '../../types/Conversation';
|
import { SIGNAL_ACI } from '../../types/SignalConversation';
|
||||||
|
|
||||||
export const getStoriesState = (state: StateType): StoriesStateType =>
|
export const getStoriesState = (state: StateType): StoriesStateType =>
|
||||||
state.stories;
|
state.stories;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { ConversationAttributesType } from '../model-types.d';
|
import type { ConversationAttributesType } from '../model-types.d';
|
||||||
import { UUID } from './UUID';
|
|
||||||
import { computeHash } from '../Crypto';
|
import { computeHash } from '../Crypto';
|
||||||
|
|
||||||
export type BuildAvatarUpdaterOptions = Readonly<{
|
export type BuildAvatarUpdaterOptions = Readonly<{
|
||||||
|
@ -88,6 +87,3 @@ export async function deleteExternalFiles(
|
||||||
await deleteAttachmentData(profileAvatar.path);
|
await deleteAttachmentData(profileAvatar.path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SIGNAL_ACI = UUID.cast('11111111-1111-4111-8111-111111111111');
|
|
||||||
export const SIGNAL_AVATAR_PATH = 'images/icon_256.png';
|
|
||||||
|
|
7
ts/types/SignalConversation.ts
Normal file
7
ts/types/SignalConversation.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
import { UUID } from './UUID';
|
||||||
|
|
||||||
|
export const SIGNAL_ACI = UUID.cast('11111111-1111-4111-8111-111111111111');
|
||||||
|
export const SIGNAL_AVATAR_PATH = 'images/icon_256.png';
|
|
@ -92,6 +92,7 @@ async function continueDownloadingOnboardingStory(): Promise<void> {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
log.info('downloadOnboardingStory: getting signal conversation');
|
||||||
const signalConversation =
|
const signalConversation =
|
||||||
await window.ConversationController.getOrCreateSignalConversation();
|
await window.ConversationController.getOrCreateSignalConversation();
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright 2022 Signal Messenger, LLC
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import { SIGNAL_ACI } from '../types/Conversation';
|
import { SIGNAL_ACI } from '../types/SignalConversation';
|
||||||
|
|
||||||
export function isSignalConversation(conversation: {
|
export function isSignalConversation(conversation: {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
Loading…
Reference in a new issue