mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 11:58:32 +00:00
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";
|
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = exactVersion;
|
kind = exactVersion;
|
||||||
version = 25.07.04;
|
version = 25.07.10;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
|
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
|
||||||
|
|||||||
@@ -95,8 +95,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/onevcat/Kingfisher",
|
"location" : "https://github.com/onevcat/Kingfisher",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "7deda23bbdca612076c5c315003d8638a08ed0f1",
|
"revision" : "010a06c4387cea2d13606222b6c08e0454e6dd2d",
|
||||||
"version" : "8.3.2"
|
"version" : "8.3.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -158,8 +158,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
|
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "9ca4d9e3b6fc15f1decf024a7474b368525ef52a",
|
"revision" : "91d7262dfdea3eec2e6a6fff5ab303ca953dd90b",
|
||||||
"version" : "25.7.4"
|
"version" : "25.7.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -266,8 +266,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
|
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "1be8144023c367c5de701a6313ed29a3a10bf59b",
|
"revision" : "37230a37e83f1b7023be08e1b1a2603fcb1567fb",
|
||||||
"version" : "1.18.3"
|
"version" : "1.18.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ final class AppSettings {
|
|||||||
case knockingEnabled
|
case knockingEnabled
|
||||||
case threadsEnabled
|
case threadsEnabled
|
||||||
case developerOptionsEnabled
|
case developerOptionsEnabled
|
||||||
|
case sharePosEnabled
|
||||||
|
|
||||||
// Doug's tweaks 🔧
|
// Doug's tweaks 🔧
|
||||||
case hideUnreadMessagesBadge
|
case hideUnreadMessagesBadge
|
||||||
@@ -346,6 +347,9 @@ final class AppSettings {
|
|||||||
@UserPreference(key: UserDefaultsKeys.threadsEnabled, defaultValue: isDevelopmentBuild, storageType: .userDefaults(store))
|
@UserPreference(key: UserDefaultsKeys.threadsEnabled, defaultValue: isDevelopmentBuild, storageType: .userDefaults(store))
|
||||||
var developerOptionsEnabled
|
var developerOptionsEnabled
|
||||||
|
|
||||||
|
@UserPreference(key: UserDefaultsKeys.sharePosEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||||
|
var sharePosEnabled
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// MARK: - Shared
|
// MARK: - Shared
|
||||||
|
|||||||
@@ -18125,9 +18125,9 @@ open class RoomListServiceSDKMock: MatrixRustSDK.RoomListService, @unchecked Sen
|
|||||||
}
|
}
|
||||||
open var subscribeToRoomsRoomIdsReceivedRoomIds: [String]?
|
open var subscribeToRoomsRoomIdsReceivedRoomIds: [String]?
|
||||||
open var subscribeToRoomsRoomIdsReceivedInvocations: [[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 {
|
if let error = subscribeToRoomsRoomIdsThrowableError {
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
@@ -18136,7 +18136,7 @@ open class RoomListServiceSDKMock: MatrixRustSDK.RoomListService, @unchecked Sen
|
|||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.subscribeToRoomsRoomIdsReceivedInvocations.append(roomIds)
|
self.subscribeToRoomsRoomIdsReceivedInvocations.append(roomIds)
|
||||||
}
|
}
|
||||||
try subscribeToRoomsRoomIdsClosure?(roomIds)
|
try await subscribeToRoomsRoomIdsClosure?(roomIds)
|
||||||
}
|
}
|
||||||
|
|
||||||
//MARK: - syncIndicator
|
//MARK: - syncIndicator
|
||||||
@@ -21663,6 +21663,77 @@ open class SyncServiceBuilderSDKMock: MatrixRustSDK.SyncServiceBuilder, @uncheck
|
|||||||
return withOfflineModeReturnValue
|
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 {
|
open class TaskHandleSDKMock: MatrixRustSDK.TaskHandle, @unchecked Sendable {
|
||||||
init() {
|
init() {
|
||||||
|
|||||||
+1
@@ -47,6 +47,7 @@ protocol DeveloperOptionsProtocol: AnyObject {
|
|||||||
var knockingEnabled: Bool { get set }
|
var knockingEnabled: Bool { get set }
|
||||||
var threadsEnabled: Bool { get set }
|
var threadsEnabled: Bool { get set }
|
||||||
var hideQuietNotificationAlerts: Bool { get set }
|
var hideQuietNotificationAlerts: Bool { get set }
|
||||||
|
var sharePosEnabled: Bool { get set }
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AppSettings: DeveloperOptionsProtocol { }
|
extension AppSettings: DeveloperOptionsProtocol { }
|
||||||
|
|||||||
+7
@@ -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 {
|
Section {
|
||||||
Toggle(isOn: $context.enableOnlySignedDeviceIsolationMode) {
|
Toggle(isOn: $context.enableOnlySignedDeviceIsolationMode) {
|
||||||
Text("Exclude insecure devices when sending/receiving messages")
|
Text("Exclude insecure devices when sending/receiving messages")
|
||||||
|
|||||||
@@ -1182,6 +1182,7 @@ private struct ClientProxyServices {
|
|||||||
let syncService = try await client
|
let syncService = try await client
|
||||||
.syncService()
|
.syncService()
|
||||||
.withCrossProcessLock()
|
.withCrossProcessLock()
|
||||||
|
.withSharePos(enable: appSettings.sharePosEnabled)
|
||||||
.finish()
|
.finish()
|
||||||
|
|
||||||
let roomListService = syncService.roomListService()
|
let roomListService = syncService.roomListService()
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
|||||||
subscribedForUpdates = true
|
subscribedForUpdates = true
|
||||||
|
|
||||||
do {
|
do {
|
||||||
try roomListService.subscribeToRooms(roomIds: [id])
|
try await roomListService.subscribeToRooms(roomIds: [id])
|
||||||
} catch {
|
} catch {
|
||||||
MXLog.error("Failed subscribing to room with error: \(error)")
|
MXLog.error("Failed subscribing to room with error: \(error)")
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
|||||||
|
|
||||||
func threadTimeline(eventID: String) async -> Result<TimelineProxyProtocol, RoomProxyError> {
|
func threadTimeline(eventID: String) async -> Result<TimelineProxyProtocol, RoomProxyError> {
|
||||||
do {
|
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,
|
filter: .all,
|
||||||
internalIdPrefix: UUID().uuidString,
|
internalIdPrefix: UUID().uuidString,
|
||||||
dateDividerMode: .daily,
|
dateDividerMode: .daily,
|
||||||
@@ -197,7 +197,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
|||||||
let rustFocus: MatrixRustSDK.TimelineFocus = switch focus {
|
let rustFocus: MatrixRustSDK.TimelineFocus = switch focus {
|
||||||
case .live: .live(hideThreadedEvents: false)
|
case .live: .live(hideThreadedEvents: false)
|
||||||
case .eventID(let eventID): .event(eventId: eventID, numContextEvents: 100, 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)
|
case .pinned: .pinnedEvents(maxEventsToLoad: 100, maxConcurrentRequests: 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -177,10 +177,12 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
.sink { [weak self] roomIDs in
|
.sink { [weak self] roomIDs in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
do {
|
Task { [weak self] in
|
||||||
try roomListService.subscribeToRooms(roomIds: roomIDs)
|
do {
|
||||||
} catch {
|
try await self?.roomListService.subscribeToRooms(roomIds: roomIDs)
|
||||||
MXLog.error("Failed subscribing to rooms with error: \(error)")
|
} catch {
|
||||||
|
MXLog.error("Failed subscribing to rooms with error: \(error)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ packages:
|
|||||||
# Element/Matrix dependencies
|
# Element/Matrix dependencies
|
||||||
MatrixRustSDK:
|
MatrixRustSDK:
|
||||||
url: https://github.com/element-hq/matrix-rust-components-swift
|
url: https://github.com/element-hq/matrix-rust-components-swift
|
||||||
exactVersion: 25.07.04
|
exactVersion: 25.07.10
|
||||||
# path: ../matrix-rust-sdk
|
# path: ../matrix-rust-sdk
|
||||||
Compound:
|
Compound:
|
||||||
url: https://github.com/element-hq/compound-ios
|
url: https://github.com/element-hq/compound-ios
|
||||||
|
|||||||
Reference in New Issue
Block a user