mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Use local room list sorting from Rust. (#2978)
* Switch to the new local room list sorting API * Get rid of the RoomSummary enum, replace it by the inner RoomSummaryDetails * And finally, rename RoomSummaryDetails to RoomSummary * Fix a bunch of warnings * Small tidy up post rebase/review. - Remove unused invalidated property. - Rename some RoomSummary instances to summary instead of details. - Fix tests with missing roomListItem's. * Update snapshots --------- Co-authored-by: Doug <douglase@element.io>
This commit is contained in:
@@ -14022,13 +14022,13 @@ open class RoomListSDKMock: MatrixRustSDK.RoomList {
|
||||
open var entriesListenerReceivedListener: RoomListEntriesListener?
|
||||
open var entriesListenerReceivedInvocations: [RoomListEntriesListener] = []
|
||||
|
||||
var entriesListenerUnderlyingReturnValue: RoomListEntriesResult!
|
||||
open var entriesListenerReturnValue: RoomListEntriesResult! {
|
||||
var entriesListenerUnderlyingReturnValue: TaskHandle!
|
||||
open var entriesListenerReturnValue: TaskHandle! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return entriesListenerUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: RoomListEntriesResult? = nil
|
||||
var returnValue: TaskHandle? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = entriesListenerUnderlyingReturnValue
|
||||
}
|
||||
@@ -14046,9 +14046,9 @@ open class RoomListSDKMock: MatrixRustSDK.RoomList {
|
||||
}
|
||||
}
|
||||
}
|
||||
open var entriesListenerClosure: ((RoomListEntriesListener) -> RoomListEntriesResult)?
|
||||
open var entriesListenerClosure: ((RoomListEntriesListener) -> TaskHandle)?
|
||||
|
||||
open override func entries(listener: RoomListEntriesListener) -> RoomListEntriesResult {
|
||||
open override func entries(listener: RoomListEntriesListener) -> TaskHandle {
|
||||
entriesListenerCallsCount += 1
|
||||
entriesListenerReceivedListener = listener
|
||||
DispatchQueue.main.async {
|
||||
@@ -14436,6 +14436,147 @@ open class RoomListDynamicEntriesControllerSDKMock: MatrixRustSDK.RoomListDynami
|
||||
}
|
||||
}
|
||||
}
|
||||
open class RoomListEntriesWithDynamicAdaptersResultSDKMock: MatrixRustSDK.RoomListEntriesWithDynamicAdaptersResult {
|
||||
init() {
|
||||
super.init(noPointer: .init())
|
||||
}
|
||||
|
||||
public required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
|
||||
fatalError("init(unsafeFromRawPointer:) has not been implemented")
|
||||
}
|
||||
|
||||
fileprivate var pointer: UnsafeMutableRawPointer!
|
||||
|
||||
//MARK: - controller
|
||||
|
||||
var controllerUnderlyingCallsCount = 0
|
||||
open var controllerCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return controllerUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = controllerUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
controllerUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
controllerUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var controllerCalled: Bool {
|
||||
return controllerCallsCount > 0
|
||||
}
|
||||
|
||||
var controllerUnderlyingReturnValue: RoomListDynamicEntriesController!
|
||||
open var controllerReturnValue: RoomListDynamicEntriesController! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return controllerUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: RoomListDynamicEntriesController? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = controllerUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
controllerUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
controllerUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var controllerClosure: (() -> RoomListDynamicEntriesController)?
|
||||
|
||||
open override func controller() -> RoomListDynamicEntriesController {
|
||||
controllerCallsCount += 1
|
||||
if let controllerClosure = controllerClosure {
|
||||
return controllerClosure()
|
||||
} else {
|
||||
return controllerReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - entriesStream
|
||||
|
||||
var entriesStreamUnderlyingCallsCount = 0
|
||||
open var entriesStreamCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return entriesStreamUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = entriesStreamUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
entriesStreamUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
entriesStreamUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var entriesStreamCalled: Bool {
|
||||
return entriesStreamCallsCount > 0
|
||||
}
|
||||
|
||||
var entriesStreamUnderlyingReturnValue: TaskHandle!
|
||||
open var entriesStreamReturnValue: TaskHandle! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return entriesStreamUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: TaskHandle? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = entriesStreamUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
entriesStreamUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
entriesStreamUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var entriesStreamClosure: (() -> TaskHandle)?
|
||||
|
||||
open override func entriesStream() -> TaskHandle {
|
||||
entriesStreamCallsCount += 1
|
||||
if let entriesStreamClosure = entriesStreamClosure {
|
||||
return entriesStreamClosure()
|
||||
} else {
|
||||
return entriesStreamReturnValue
|
||||
}
|
||||
}
|
||||
}
|
||||
open class RoomListItemSDKMock: MatrixRustSDK.RoomListItem {
|
||||
init() {
|
||||
super.init(noPointer: .init())
|
||||
@@ -15309,52 +15450,6 @@ open class RoomListServiceSDKMock: MatrixRustSDK.RoomListService {
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - applyInput
|
||||
|
||||
open var applyInputInputThrowableError: Error?
|
||||
var applyInputInputUnderlyingCallsCount = 0
|
||||
open var applyInputInputCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return applyInputInputUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = applyInputInputUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
applyInputInputUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
applyInputInputUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var applyInputInputCalled: Bool {
|
||||
return applyInputInputCallsCount > 0
|
||||
}
|
||||
open var applyInputInputReceivedInput: RoomListInput?
|
||||
open var applyInputInputReceivedInvocations: [RoomListInput] = []
|
||||
open var applyInputInputClosure: ((RoomListInput) async throws -> Void)?
|
||||
|
||||
open override func applyInput(input: RoomListInput) async throws {
|
||||
if let error = applyInputInputThrowableError {
|
||||
throw error
|
||||
}
|
||||
applyInputInputCallsCount += 1
|
||||
applyInputInputReceivedInput = input
|
||||
DispatchQueue.main.async {
|
||||
self.applyInputInputReceivedInvocations.append(input)
|
||||
}
|
||||
try await applyInputInputClosure?(input)
|
||||
}
|
||||
|
||||
//MARK: - room
|
||||
|
||||
open var roomRoomIdThrowableError: Error?
|
||||
|
||||
Reference in New Issue
Block a user