signal-desktop/ts/util/isSignalConversation.ts

19 lines
486 B
TypeScript
Raw Normal View History

2022-11-09 02:38:19 +00:00
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2022-11-09 21:11:45 +00:00
import { SIGNAL_ACI } from '../types/SignalConversation';
2023-08-16 20:54:39 +00:00
import type { ServiceIdString } from '../types/ServiceId';
2022-11-09 02:38:19 +00:00
export function isSignalConversation(conversation: {
id: string;
2023-08-16 20:54:39 +00:00
serviceId?: ServiceIdString;
2022-11-09 02:38:19 +00:00
}): boolean {
2023-08-16 20:54:39 +00:00
const { id, serviceId } = conversation;
2022-11-09 02:38:19 +00:00
2023-08-16 20:54:39 +00:00
if (serviceId) {
return serviceId === SIGNAL_ACI;
2022-11-09 02:38:19 +00:00
}
2023-08-16 20:54:39 +00:00
return window.ConversationController.isSignalConversationId(id);
2022-11-09 02:38:19 +00:00
}