Fixes #2842, fixes #2841 - Adopt new message sending queue API

- automatically retry failed requests as soon as the network is availble again
- remove manual retry options
This commit is contained in:
Stefan Ceriu
2024-05-28 10:17:13 +03:00
committed by Stefan Ceriu
parent 53fc5df55b
commit 6c1647b851
28 changed files with 827 additions and 606 deletions
@@ -128,7 +128,7 @@ class RoomPollsHistoryScreenViewModelTests: XCTestCase {
value.bindings.alertInfo != nil
}
interactionHandler.endPollPollStartIDReturnValue = .failure(TimelineProxyError.failedEndingPoll)
interactionHandler.endPollPollStartIDReturnValue = .failure(SDKError.generic)
viewModel.context.send(viewAction: .end(pollStartID: "somePollID"))
try await deferred.fulfill()
@@ -155,7 +155,7 @@ class RoomPollsHistoryScreenViewModelTests: XCTestCase {
value.bindings.alertInfo != nil
}
interactionHandler.sendPollResponsePollStartIDOptionIDReturnValue = .failure(TimelineProxyError.failedSendingPollResponse)
interactionHandler.sendPollResponsePollStartIDOptionIDReturnValue = .failure(SDKError.generic)
viewModel.context.send(viewAction: .sendPollResponse(pollStartID: "somePollID", optionID: "someOptionID"))
try await deferred.fulfill()
@@ -180,3 +180,7 @@ class RoomPollsHistoryScreenViewModelTests: XCTestCase {
try await deferred.fulfill()
}
}
private enum SDKError: Error {
case generic
}
@@ -336,7 +336,6 @@ class RoomScreenViewModelTests: XCTestCase {
let roomProxy = RoomProxyMock(.init(name: ""))
let timelineProxy = TimelineProxyMock()
timelineProxy.underlyingActions = Empty(completeImmediately: false).eraseToAnyPublisher()
roomProxy.timeline = timelineProxy
let timelineController = MockRoomTimelineController()
@@ -239,7 +239,7 @@ class VoiceMessageRecorderTests: XCTestCase {
let timelineProxy = TimelineProxyMock()
let roomProxy = RoomProxyMock()
roomProxy.timeline = timelineProxy
timelineProxy.sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleReturnValue = .failure(.failedSendingMedia)
timelineProxy.sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleReturnValue = .failure(.sdkError(SDKError.generic))
guard case .failure(.failedSendingVoiceMessage) = await voiceMessageRecorder.sendVoiceMessage(inRoom: roomProxy, audioConverter: audioConverter) else {
XCTFail("An error is expected")
return
@@ -260,7 +260,7 @@ class VoiceMessageRecorderTests: XCTestCase {
let timelineProxy = TimelineProxyMock()
let roomProxy = RoomProxyMock()
roomProxy.timeline = timelineProxy
timelineProxy.sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleReturnValue = .failure(.failedSendingMedia)
timelineProxy.sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleReturnValue = .failure(.sdkError(SDKError.generic))
guard case .failure(.failedSendingVoiceMessage) = await voiceMessageRecorder.sendVoiceMessage(inRoom: roomProxy, audioConverter: audioConverter) else {
XCTFail("An error is expected")
return
@@ -283,7 +283,7 @@ class VoiceMessageRecorderTests: XCTestCase {
let timelineProxy = TimelineProxyMock()
let roomProxy = RoomProxyMock()
roomProxy.timeline = timelineProxy
timelineProxy.sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleReturnValue = .failure(.failedSendingMedia)
timelineProxy.sendVoiceMessageUrlAudioInfoWaveformProgressSubjectRequestHandleReturnValue = .failure(.sdkError(SDKError.generic))
guard case .failure(.failedSendingVoiceMessage) = await voiceMessageRecorder.sendVoiceMessage(inRoom: roomProxy, audioConverter: audioConverter) else {
XCTFail("An error is expected")
return
@@ -389,3 +389,7 @@ class VoiceMessageRecorderTests: XCTestCase {
try await deferred.fulfill()
}
}
private enum SDKError: Error {
case generic
}