mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-11 13:59:13 +00:00
parent
dff18d7851
commit
4a03c4f715
@ -5283,7 +5283,7 @@
|
||||
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
|
||||
requirement = {
|
||||
kind = exactVersion;
|
||||
version = "1.0.98-alpha";
|
||||
version = "1.0.99-alpha";
|
||||
};
|
||||
};
|
||||
96495DD8554E2F39D3954354 /* XCRemoteSwiftPackageReference "posthog-ios" */ = {
|
||||
|
@ -111,8 +111,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
|
||||
"state" : {
|
||||
"revision" : "985708733af7d2db1684f90f0a954854ca3a83ad",
|
||||
"version" : "1.0.98-alpha"
|
||||
"revision" : "3e2beb52294aa5dd87203cdcb3ac685f1a022c6b",
|
||||
"version" : "1.0.99-alpha"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -110,20 +110,27 @@ class ClientProxy: ClientProxyProtocol {
|
||||
}
|
||||
|
||||
var isSyncing: Bool {
|
||||
roomListService?.isSyncing() ?? false
|
||||
isStartingSync || roomListService?.isSyncing() ?? false
|
||||
}
|
||||
|
||||
/// Ensure we don't call start sync whilst awaiting a previous call.
|
||||
private var isStartingSync = false
|
||||
|
||||
func startSync() {
|
||||
MXLog.info("Starting sync")
|
||||
guard !isSyncing else {
|
||||
return
|
||||
}
|
||||
guard !isSyncing else { return }
|
||||
|
||||
MXLog.info("Starting sync")
|
||||
isStartingSync = true
|
||||
|
||||
Task {
|
||||
do {
|
||||
try appService?.start()
|
||||
try await appService?.start()
|
||||
} catch {
|
||||
MXLog.error("Failed starting app service with error: \(error)")
|
||||
}
|
||||
|
||||
isStartingSync = false
|
||||
}
|
||||
}
|
||||
|
||||
func pauseSync() {
|
||||
@ -352,9 +359,21 @@ class ClientProxy: ClientProxyProtocol {
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private func restartSync() {
|
||||
pauseSync()
|
||||
startSync()
|
||||
private func restartSync(delay: Duration = .zero) {
|
||||
isStartingSync = true
|
||||
|
||||
Task {
|
||||
try await Task.sleep(for: delay)
|
||||
|
||||
do {
|
||||
MXLog.info("Restart the app service.")
|
||||
try await self.appService?.start()
|
||||
} catch {
|
||||
MXLog.error("Failed restarting app service after error.")
|
||||
}
|
||||
|
||||
self.isStartingSync = false
|
||||
}
|
||||
}
|
||||
|
||||
private func loadUserAvatarURLFromCache() {
|
||||
@ -378,7 +397,7 @@ class ClientProxy: ClientProxyProtocol {
|
||||
}
|
||||
|
||||
do {
|
||||
let appService = try client
|
||||
let appService = try await client
|
||||
.app()
|
||||
.withEncryptionSync(withCrossProcessLock: appSettings.isEncryptionSyncEnabled,
|
||||
appIdentifier: "MainApp")
|
||||
@ -410,10 +429,10 @@ class ClientProxy: ClientProxyProtocol {
|
||||
guard let self else { return }
|
||||
MXLog.info("Received app service update: \(state)")
|
||||
switch state {
|
||||
case .error:
|
||||
restartSync()
|
||||
case .terminated, .running:
|
||||
case .running, .terminated:
|
||||
break
|
||||
case .error:
|
||||
restartSync(delay: .seconds(1))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ include:
|
||||
packages:
|
||||
MatrixRustSDK:
|
||||
url: https://github.com/matrix-org/matrix-rust-components-swift
|
||||
exactVersion: 1.0.98-alpha
|
||||
exactVersion: 1.0.99-alpha
|
||||
# path: ../matrix-rust-sdk
|
||||
DesignKit:
|
||||
path: DesignKit
|
||||
|
Loading…
x
Reference in New Issue
Block a user