2022-12-05 22:56:23 +00:00
|
|
|
// Copyright 2022 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2023-08-10 16:43:33 +00:00
|
|
|
import type { ServiceIdString } from '../types/ServiceId';
|
2022-12-05 22:56:23 +00:00
|
|
|
import { strictAssert } from './assert';
|
|
|
|
|
2023-08-16 20:54:39 +00:00
|
|
|
export function startConversation(
|
|
|
|
e164: string,
|
|
|
|
serviceId: ServiceIdString
|
|
|
|
): void {
|
2022-12-05 22:56:23 +00:00
|
|
|
const conversation = window.ConversationController.lookupOrCreate({
|
|
|
|
e164,
|
2023-08-16 20:54:39 +00:00
|
|
|
serviceId,
|
2022-12-05 22:56:23 +00:00
|
|
|
reason: 'util/startConversation',
|
|
|
|
});
|
|
|
|
strictAssert(
|
|
|
|
conversation,
|
2023-08-16 20:54:39 +00:00
|
|
|
`startConversation failed given ${e164}/${serviceId} combination`
|
2022-12-05 22:56:23 +00:00
|
|
|
);
|
|
|
|
|
2022-12-14 19:05:32 +00:00
|
|
|
window.reduxActions.conversations.showConversation({
|
|
|
|
conversationId: conversation.id,
|
|
|
|
});
|
2022-12-05 22:56:23 +00:00
|
|
|
}
|