added a feature flag for share pos + updated the SDK (#4312)
This commit is contained in:
@@ -8771,7 +8771,7 @@
|
||||
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
|
||||
requirement = {
|
||||
kind = exactVersion;
|
||||
version = 25.07.04;
|
||||
version = 25.07.10;
|
||||
};
|
||||
};
|
||||
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
|
||||
|
||||
@@ -95,8 +95,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/onevcat/Kingfisher",
|
||||
"state" : {
|
||||
"revision" : "7deda23bbdca612076c5c315003d8638a08ed0f1",
|
||||
"version" : "8.3.2"
|
||||
"revision" : "010a06c4387cea2d13606222b6c08e0454e6dd2d",
|
||||
"version" : "8.3.3"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -158,8 +158,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
|
||||
"state" : {
|
||||
"revision" : "9ca4d9e3b6fc15f1decf024a7474b368525ef52a",
|
||||
"version" : "25.7.4"
|
||||
"revision" : "91d7262dfdea3eec2e6a6fff5ab303ca953dd90b",
|
||||
"version" : "25.7.10"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -266,8 +266,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
|
||||
"state" : {
|
||||
"revision" : "1be8144023c367c5de701a6313ed29a3a10bf59b",
|
||||
"version" : "1.18.3"
|
||||
"revision" : "37230a37e83f1b7023be08e1b1a2603fcb1567fb",
|
||||
"version" : "1.18.4"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -57,6 +57,7 @@ final class AppSettings {
|
||||
case knockingEnabled
|
||||
case threadsEnabled
|
||||
case developerOptionsEnabled
|
||||
case sharePosEnabled
|
||||
|
||||
// Doug's tweaks 🔧
|
||||
case hideUnreadMessagesBadge
|
||||
@@ -346,6 +347,9 @@ final class AppSettings {
|
||||
@UserPreference(key: UserDefaultsKeys.threadsEnabled, defaultValue: isDevelopmentBuild, storageType: .userDefaults(store))
|
||||
var developerOptionsEnabled
|
||||
|
||||
@UserPreference(key: UserDefaultsKeys.sharePosEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||
var sharePosEnabled
|
||||
|
||||
#endif
|
||||
|
||||
// MARK: - Shared
|
||||
|
||||
@@ -18125,9 +18125,9 @@ open class RoomListServiceSDKMock: MatrixRustSDK.RoomListService, @unchecked Sen
|
||||
}
|
||||
open var subscribeToRoomsRoomIdsReceivedRoomIds: [String]?
|
||||
open var subscribeToRoomsRoomIdsReceivedInvocations: [[String]] = []
|
||||
open var subscribeToRoomsRoomIdsClosure: (([String]) throws -> Void)?
|
||||
open var subscribeToRoomsRoomIdsClosure: (([String]) async throws -> Void)?
|
||||
|
||||
open override func subscribeToRooms(roomIds: [String]) throws {
|
||||
open override func subscribeToRooms(roomIds: [String]) async throws {
|
||||
if let error = subscribeToRoomsRoomIdsThrowableError {
|
||||
throw error
|
||||
}
|
||||
@@ -18136,7 +18136,7 @@ open class RoomListServiceSDKMock: MatrixRustSDK.RoomListService, @unchecked Sen
|
||||
DispatchQueue.main.async {
|
||||
self.subscribeToRoomsRoomIdsReceivedInvocations.append(roomIds)
|
||||
}
|
||||
try subscribeToRoomsRoomIdsClosure?(roomIds)
|
||||
try await subscribeToRoomsRoomIdsClosure?(roomIds)
|
||||
}
|
||||
|
||||
//MARK: - syncIndicator
|
||||
@@ -21663,6 +21663,77 @@ open class SyncServiceBuilderSDKMock: MatrixRustSDK.SyncServiceBuilder, @uncheck
|
||||
return withOfflineModeReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - withSharePos
|
||||
|
||||
var withSharePosEnableUnderlyingCallsCount = 0
|
||||
open var withSharePosEnableCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return withSharePosEnableUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = withSharePosEnableUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
withSharePosEnableUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
withSharePosEnableUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var withSharePosEnableCalled: Bool {
|
||||
return withSharePosEnableCallsCount > 0
|
||||
}
|
||||
open var withSharePosEnableReceivedEnable: Bool?
|
||||
open var withSharePosEnableReceivedInvocations: [Bool] = []
|
||||
|
||||
var withSharePosEnableUnderlyingReturnValue: SyncServiceBuilder!
|
||||
open var withSharePosEnableReturnValue: SyncServiceBuilder! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return withSharePosEnableUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: SyncServiceBuilder? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = withSharePosEnableUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
withSharePosEnableUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
withSharePosEnableUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var withSharePosEnableClosure: ((Bool) -> SyncServiceBuilder)?
|
||||
|
||||
open override func withSharePos(enable: Bool) -> SyncServiceBuilder {
|
||||
withSharePosEnableCallsCount += 1
|
||||
withSharePosEnableReceivedEnable = enable
|
||||
DispatchQueue.main.async {
|
||||
self.withSharePosEnableReceivedInvocations.append(enable)
|
||||
}
|
||||
if let withSharePosEnableClosure = withSharePosEnableClosure {
|
||||
return withSharePosEnableClosure(enable)
|
||||
} else {
|
||||
return withSharePosEnableReturnValue
|
||||
}
|
||||
}
|
||||
}
|
||||
open class TaskHandleSDKMock: MatrixRustSDK.TaskHandle, @unchecked Sendable {
|
||||
init() {
|
||||
|
||||
@@ -47,6 +47,7 @@ protocol DeveloperOptionsProtocol: AnyObject {
|
||||
var knockingEnabled: Bool { get set }
|
||||
var threadsEnabled: Bool { get set }
|
||||
var hideQuietNotificationAlerts: Bool { get set }
|
||||
var sharePosEnabled: Bool { get set }
|
||||
}
|
||||
|
||||
extension AppSettings: DeveloperOptionsProtocol { }
|
||||
|
||||
@@ -59,6 +59,13 @@ struct DeveloperOptionsScreen: View {
|
||||
}
|
||||
}
|
||||
|
||||
Section("Sync") {
|
||||
Toggle(isOn: $context.sharePosEnabled) {
|
||||
Text("Share pos")
|
||||
Text("Keep the sliding sync pos to make initial syncs faster. Requires an app restart to take effect. Might make the sync unstable.")
|
||||
}
|
||||
}
|
||||
|
||||
Section {
|
||||
Toggle(isOn: $context.enableOnlySignedDeviceIsolationMode) {
|
||||
Text("Exclude insecure devices when sending/receiving messages")
|
||||
|
||||
@@ -1182,6 +1182,7 @@ private struct ClientProxyServices {
|
||||
let syncService = try await client
|
||||
.syncService()
|
||||
.withCrossProcessLock()
|
||||
.withSharePos(enable: appSettings.sharePosEnabled)
|
||||
.finish()
|
||||
|
||||
let roomListService = syncService.roomListService()
|
||||
|
||||
@@ -110,7 +110,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
||||
subscribedForUpdates = true
|
||||
|
||||
do {
|
||||
try roomListService.subscribeToRooms(roomIds: [id])
|
||||
try await roomListService.subscribeToRooms(roomIds: [id])
|
||||
} catch {
|
||||
MXLog.error("Failed subscribing to room with error: \(error)")
|
||||
}
|
||||
@@ -173,7 +173,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
||||
|
||||
func threadTimeline(eventID: String) async -> Result<TimelineProxyProtocol, RoomProxyError> {
|
||||
do {
|
||||
let sdkTimeline = try await room.timelineWithConfiguration(configuration: .init(focus: .thread(rootEventId: eventID, numEvents: 20),
|
||||
let sdkTimeline = try await room.timelineWithConfiguration(configuration: .init(focus: .thread(rootEventId: eventID),
|
||||
filter: .all,
|
||||
internalIdPrefix: UUID().uuidString,
|
||||
dateDividerMode: .daily,
|
||||
@@ -197,7 +197,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
||||
let rustFocus: MatrixRustSDK.TimelineFocus = switch focus {
|
||||
case .live: .live(hideThreadedEvents: false)
|
||||
case .eventID(let eventID): .event(eventId: eventID, numContextEvents: 100, hideThreadedEvents: false)
|
||||
case .thread(let eventID): .thread(rootEventId: eventID, numEvents: 20)
|
||||
case .thread(let eventID): .thread(rootEventId: eventID)
|
||||
case .pinned: .pinnedEvents(maxEventsToLoad: 100, maxConcurrentRequests: 10)
|
||||
}
|
||||
|
||||
|
||||
@@ -177,10 +177,12 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
||||
.sink { [weak self] roomIDs in
|
||||
guard let self else { return }
|
||||
|
||||
do {
|
||||
try roomListService.subscribeToRooms(roomIds: roomIDs)
|
||||
} catch {
|
||||
MXLog.error("Failed subscribing to rooms with error: \(error)")
|
||||
Task { [weak self] in
|
||||
do {
|
||||
try await self?.roomListService.subscribeToRooms(roomIds: roomIDs)
|
||||
} catch {
|
||||
MXLog.error("Failed subscribing to rooms with error: \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
@@ -65,7 +65,7 @@ packages:
|
||||
# Element/Matrix dependencies
|
||||
MatrixRustSDK:
|
||||
url: https://github.com/element-hq/matrix-rust-components-swift
|
||||
exactVersion: 25.07.04
|
||||
exactVersion: 25.07.10
|
||||
# path: ../matrix-rust-sdk
|
||||
Compound:
|
||||
url: https://github.com/element-hq/compound-ios
|
||||
|
||||
Reference in New Issue
Block a user