TM-SGNL-iOS/SignalServiceKit/Messages/Attachments/V2/AttachmentManager/AttachmentManagerMock.swift
TeleMessage developers dde0620daf initial commit
2025-05-03 12:28:28 -07:00

70 lines
1.8 KiB
Swift

//
// Copyright 2024 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
//
import Foundation
#if TESTABLE_BUILD
open class AttachmentManagerMock: AttachmentManager {
open func createAttachmentPointers(
from protos: [OwnedAttachmentPointerProto],
tx: DBWriteTransaction
) throws {
// Do nothing
}
open func createAttachmentPointers(
from backupProtos: [OwnedAttachmentBackupPointerProto],
uploadEra: String,
tx: DBWriteTransaction
) -> [OwnedAttachmentBackupPointerProto.CreationError] {
// Do nothing
return []
}
open func createAttachmentStreams(
consuming dataSources: [OwnedAttachmentDataSource],
tx: DBWriteTransaction
) throws {
// Do nothing
}
open func quotedReplyAttachmentInfo(
originalMessage: TSMessage,
tx: DBReadTransaction
) -> QuotedAttachmentInfo? {
return nil
}
open func createQuotedReplyMessageThumbnailBuilder(
from dataSource: QuotedReplyAttachmentDataSource,
tx: DBWriteTransaction
) -> OwnedAttachmentBuilder<QuotedAttachmentInfo> {
return .withoutFinalizer(.init(
info: .stub(
withOriginalAttachmentMimeType: dataSource.originalAttachmentMimeType,
originalAttachmentSourceFilename: dataSource.originalAttachmentSourceFilename
),
renderingFlag: dataSource.renderingFlag
))
}
open func removeAttachment(
reference: AttachmentReference,
tx: DBWriteTransaction
) throws {
// Do nothing
}
open func removeAllAttachments(
from owners: [AttachmentReference.OwnerId],
tx: DBWriteTransaction
) throws {
// Do nothing
}
}
#endif