signal-desktop/ts/util/isConversationSMSOnly.ts

32 lines
673 B
TypeScript
Raw Normal View History

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2023-08-16 22:54:39 +02:00
import type { ServiceIdString } from '../types/ServiceId';
export type MinimalConversationType = Readonly<{
type?: string;
e164?: string;
2023-08-16 22:54:39 +02:00
serviceId?: ServiceIdString;
discoveredUnregisteredAt?: number;
}>;
export function isConversationSMSOnly(
conversation: MinimalConversationType
): boolean {
2023-08-16 22:54:39 +02:00
const { e164, serviceId, type } = conversation;
// `direct` for redux, `private` for models and the database
if (type !== 'direct' && type !== 'private') {
return false;
}
if (serviceId) {
return false;
}
if (!e164) {
return false;
}
return true;
}