signal-desktop/ts/util/isSignalConversation.ts

23 lines
597 B
TypeScript
Raw Normal View History

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