mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
Rename files
This commit is contained in:
38
ts/util/isValidTapToView.std.ts
Normal file
38
ts/util/isValidTapToView.std.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { MessageAttributesType } from '../model-types.d.ts';
|
||||
import * as GoogleChrome from './GoogleChrome.std.js';
|
||||
|
||||
export function isValidTapToView(message: MessageAttributesType): boolean {
|
||||
const { body } = message;
|
||||
if (body) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { attachments } = message;
|
||||
if (!attachments || attachments.length !== 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const firstAttachment = attachments[0];
|
||||
if (
|
||||
!GoogleChrome.isImageTypeSupported(firstAttachment.contentType) &&
|
||||
!GoogleChrome.isVideoTypeSupported(firstAttachment.contentType)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { quote, sticker, contact, preview } = message;
|
||||
|
||||
if (
|
||||
quote ||
|
||||
sticker ||
|
||||
(contact && contact.length > 0) ||
|
||||
(preview && preview.length > 0)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user