Revert "Support sending gallery messages behind a feature flag"

This reverts commit 9a61d870d6.
This commit is contained in:
Mauro Romito
2026-07-21 12:00:03 +02:00
parent 9a61d870d6
commit 762e5ad0ff
14 changed files with 39 additions and 374 deletions
@@ -190,12 +190,10 @@ final class MediaUploadPreviewScreenViewModelTests {
#expect(context.viewState.shouldDisableInteraction, "The interaction should be disabled while sending.")
#expect(userIndicatorController.submitIndicatorDelayCallsCount == 1) // Loading indicator
// Then the screen should be dismissed once the gallery has been sent in a single request.
// Then the screen should be dismissed once all of the files have been sent.
try await deferredDismiss.fulfill()
#expect(timelineProxy.sendGalleryItemInfosCaptionFormattedCaptionInReplyToEventIDCallsCount == 1)
#expect(timelineProxy.sendGalleryItemInfosCaptionFormattedCaptionInReplyToEventIDReceivedArguments?.itemInfos.count == 3)
#expect(timelineProxy.sendImageUrlThumbnailURLImageInfoCaptionRequestHandleCallsCount == 0)
#expect(timelineProxy.sendFileUrlFileInfoCaptionRequestHandleCallsCount == 0)
#expect(timelineProxy.sendImageUrlThumbnailURLImageInfoCaptionRequestHandleCallsCount == 1)
#expect(timelineProxy.sendFileUrlFileInfoCaptionRequestHandleCallsCount == 2)
#expect(userIndicatorController.submitIndicatorDelayCallsCount == 1, "Only a loading indicator should be shown.")
}
@@ -220,8 +218,8 @@ final class MediaUploadPreviewScreenViewModelTests {
@Test
func multipleFilesWithSendFailure() async throws {
// Given an upload screen with multiple media files where the gallery send fails.
setUpViewModel(urls: [fileURL, imageURL, imageURL, fileURL], expectedCaption: nil, simulateGallerySendFailure: true)
// Given an upload screen with multiple media files where one of the files will fail to send.
setUpViewModel(urls: [fileURL, imageURL, imageURL, fileURL], expectedCaption: nil, simulateImageSendFailures: true)
#expect(!context.viewState.shouldDisableInteraction)
#expect(userIndicatorController.submitIndicatorDelayCallsCount == 0)
@@ -232,10 +230,11 @@ final class MediaUploadPreviewScreenViewModelTests {
#expect(context.viewState.shouldDisableInteraction, "The interaction should be disabled while sending.")
#expect(userIndicatorController.submitIndicatorDelayCallsCount == 1) // Loading indicator
// Then the screen should still be dismissed and an error indicator surfaced.
// Then the screen should be dismissed so the user can see which files made it into the timeline.
try await deferredDismiss.fulfill()
#expect(timelineProxy.sendGalleryItemInfosCaptionFormattedCaptionInReplyToEventIDCallsCount == 1)
#expect(userIndicatorController.submitIndicatorDelayCallsCount == 2, "An error indicator should be shown.")
#expect(timelineProxy.sendImageUrlThumbnailURLImageInfoCaptionRequestHandleCallsCount == 2)
#expect(timelineProxy.sendFileUrlFileInfoCaptionRequestHandleCallsCount == 2)
#expect(userIndicatorController.submitIndicatorDelayCallsCount == 3, "Error indicators for each failure should be shown.")
}
// MARK: - Helpers
@@ -269,8 +268,7 @@ final class MediaUploadPreviewScreenViewModelTests {
private func setUpViewModel(urls: [URL],
expectedCaption: String?,
maxUploadSizeResult: Result<UInt, ClientProxyError>? = nil,
simulateGallerySendFailure: Bool = false,
galleryEnabled: Bool = true) {
simulateImageSendFailures: Bool = false) {
timelineProxy = TimelineProxyMock(.init())
timelineProxy.sendAudioUrlAudioInfoCaptionRequestHandleClosure = { [weak self] _, _, caption, _ in
self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown))
@@ -279,15 +277,12 @@ final class MediaUploadPreviewScreenViewModelTests {
self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown))
}
timelineProxy.sendImageUrlThumbnailURLImageInfoCaptionRequestHandleClosure = { [weak self] _, _, _, caption, _ in
self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown))
guard !simulateImageSendFailures else { return .failure(.sdkError(TestError.unknown)) }
return self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown))
}
timelineProxy.sendVideoUrlThumbnailURLVideoInfoCaptionRequestHandleClosure = { [weak self] _, _, _, caption, _ in
self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown))
}
timelineProxy.sendGalleryItemInfosCaptionFormattedCaptionInReplyToEventIDClosure = { [weak self] _, caption, _, _ in
guard !simulateGallerySendFailure else { return .failure(.sdkError(TestError.unknown)) }
return self?.verifyCaption(caption, expectedCaption: expectedCaption) ?? .failure(.sdkError(TestError.unknown))
}
clientProxy = ClientProxyMock(.init())
if let maxUploadSizeResult {
@@ -301,8 +296,7 @@ final class MediaUploadPreviewScreenViewModelTests {
mediaUploadingPreprocessor: MediaUploadingPreprocessor(appSettings: appSettings),
timelineController: TimelineControllerMock(.init(timelineProxy: timelineProxy)),
clientProxy: clientProxy,
userIndicatorController: userIndicatorController,
galleryEnabled: galleryEnabled)
userIndicatorController: userIndicatorController)
}
private func verifyCaption(_ caption: String?, expectedCaption: String?) -> Result<Void, TimelineProxyError> {