mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
@@ -5283,7 +5283,7 @@
|
|||||||
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
|
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = exactVersion;
|
kind = exactVersion;
|
||||||
version = "1.0.98-alpha";
|
version = "1.0.99-alpha";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
96495DD8554E2F39D3954354 /* XCRemoteSwiftPackageReference "posthog-ios" */ = {
|
96495DD8554E2F39D3954354 /* XCRemoteSwiftPackageReference "posthog-ios" */ = {
|
||||||
|
|||||||
@@ -111,8 +111,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
|
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "985708733af7d2db1684f90f0a954854ca3a83ad",
|
"revision" : "3e2beb52294aa5dd87203cdcb3ac685f1a022c6b",
|
||||||
"version" : "1.0.98-alpha"
|
"version" : "1.0.99-alpha"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -110,19 +110,26 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isSyncing: Bool {
|
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() {
|
func startSync() {
|
||||||
MXLog.info("Starting sync")
|
guard !isSyncing else { return }
|
||||||
guard !isSyncing else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
MXLog.info("Starting sync")
|
||||||
try appService?.start()
|
isStartingSync = true
|
||||||
} catch {
|
|
||||||
MXLog.error("Failed starting app service with error: \(error)")
|
Task {
|
||||||
|
do {
|
||||||
|
try await appService?.start()
|
||||||
|
} catch {
|
||||||
|
MXLog.error("Failed starting app service with error: \(error)")
|
||||||
|
}
|
||||||
|
|
||||||
|
isStartingSync = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,9 +359,21 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
|
|
||||||
// MARK: Private
|
// MARK: Private
|
||||||
|
|
||||||
private func restartSync() {
|
private func restartSync(delay: Duration = .zero) {
|
||||||
pauseSync()
|
isStartingSync = true
|
||||||
startSync()
|
|
||||||
|
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() {
|
private func loadUserAvatarURLFromCache() {
|
||||||
@@ -378,7 +397,7 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
let appService = try client
|
let appService = try await client
|
||||||
.app()
|
.app()
|
||||||
.withEncryptionSync(withCrossProcessLock: appSettings.isEncryptionSyncEnabled,
|
.withEncryptionSync(withCrossProcessLock: appSettings.isEncryptionSyncEnabled,
|
||||||
appIdentifier: "MainApp")
|
appIdentifier: "MainApp")
|
||||||
@@ -410,10 +429,10 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
MXLog.info("Received app service update: \(state)")
|
MXLog.info("Received app service update: \(state)")
|
||||||
switch state {
|
switch state {
|
||||||
case .error:
|
case .running, .terminated:
|
||||||
restartSync()
|
|
||||||
case .terminated, .running:
|
|
||||||
break
|
break
|
||||||
|
case .error:
|
||||||
|
restartSync(delay: .seconds(1))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ include:
|
|||||||
packages:
|
packages:
|
||||||
MatrixRustSDK:
|
MatrixRustSDK:
|
||||||
url: https://github.com/matrix-org/matrix-rust-components-swift
|
url: https://github.com/matrix-org/matrix-rust-components-swift
|
||||||
exactVersion: 1.0.98-alpha
|
exactVersion: 1.0.99-alpha
|
||||||
# path: ../matrix-rust-sdk
|
# path: ../matrix-rust-sdk
|
||||||
DesignKit:
|
DesignKit:
|
||||||
path: DesignKit
|
path: DesignKit
|
||||||
|
|||||||
Reference in New Issue
Block a user