mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
- automatically retry failed requests as soon as the network is availble again - remove manual retry options
This commit is contained in:
committed by
Stefan Ceriu
parent
53fc5df55b
commit
6c1647b851
@@ -45,6 +45,9 @@ class ClientProxy: ClientProxyProtocol {
|
||||
// periphery:ignore - required for instance retention in the rust codebase
|
||||
private var verificationStateListenerTaskHandle: TaskHandle?
|
||||
|
||||
// periphery:ignore - required for instance retention in the rust codebase
|
||||
private var sendingQueueListenerTaskHandle: TaskHandle?
|
||||
|
||||
private var delegateHandle: TaskHandle?
|
||||
|
||||
// These following summary providers both operate on the same allRooms() list but
|
||||
@@ -161,6 +164,17 @@ class ClientProxy: ClientProxyProtocol {
|
||||
verificationStateListenerTaskHandle = client.encryption().verificationStateListener(listener: VerificationStateListenerProxy { [weak self] verificationState in
|
||||
self?.updateVerificationState(verificationState)
|
||||
})
|
||||
|
||||
sendingQueueListenerTaskHandle = client.subscribeToSendingQueueStatus(listener: SendingQueueStatusListenerProxy { [weak self] enabled in
|
||||
guard let self else { return }
|
||||
|
||||
MXLog.error("Sending queue status changed to enabled: \(enabled)")
|
||||
|
||||
if enabled == false,
|
||||
networkMonitor.reachabilityPublisher.value == .reachable {
|
||||
setSendingQueueEnabled(true)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private func updateVerificationState(_ verificationState: VerificationState) {
|
||||
@@ -578,6 +592,11 @@ class ClientProxy: ClientProxyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func setSendingQueueEnabled(_ enabled: Bool) {
|
||||
MXLog.info("Setting sending queue to enabled: \(enabled)")
|
||||
client.enableSendingQueue(enable: enabled)
|
||||
}
|
||||
|
||||
// MARK: Ignored users
|
||||
|
||||
func ignoreUser(_ userID: String) async -> Result<Void, ClientProxyError> {
|
||||
@@ -784,7 +803,7 @@ class ClientProxy: ClientProxyProtocol {
|
||||
if roomListItem?.isTimelineInitialized() == false {
|
||||
try await roomListItem?.initTimeline(eventTypeFilter: eventFilters, internalIdPrefix: nil)
|
||||
}
|
||||
let fullRoom = try await roomListItem?.fullRoom()
|
||||
let fullRoom = try roomListItem?.fullRoom()
|
||||
|
||||
return (roomListItem, fullRoom)
|
||||
} catch {
|
||||
@@ -920,6 +939,18 @@ private class IgnoredUsersListenerProxy: IgnoredUsersListener {
|
||||
}
|
||||
}
|
||||
|
||||
private class SendingQueueStatusListenerProxy: SendingQueueStatusListener {
|
||||
private let onUpdateClosure: (Bool) -> Void
|
||||
|
||||
init(onUpdateClosure: @escaping (Bool) -> Void) {
|
||||
self.onUpdateClosure = onUpdateClosure
|
||||
}
|
||||
|
||||
func onUpdate(newValue: Bool) {
|
||||
onUpdateClosure(newValue)
|
||||
}
|
||||
}
|
||||
|
||||
private extension RoomPreviewDetails {
|
||||
init(_ roomPreview: RoomPreview) {
|
||||
self = RoomPreviewDetails(roomID: roomPreview.roomId,
|
||||
|
||||
Reference in New Issue
Block a user