SDK Bump to 1.0.74 (#1059)

* testing improvements

* code improvements and sdk bump

* improved the stencil file

* improved the build sdk function

* code improvement

* also added the tearDown
This commit is contained in:
Mauro
2023-06-09 18:27:08 +02:00
committed by GitHub
parent 3830ee0936
commit 7af09b5902
9 changed files with 128 additions and 107 deletions

View File

@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@@ -764,7 +764,7 @@
1222DB76B917EB8A55365BA5 /* target.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = target.yml; sourceTree = "<group>"; };
127A57D053CE8C87B5EFB089 /* Consumable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Consumable.swift; sourceTree = "<group>"; };
127C8472672A5BA09EF1ACF8 /* CurrentValuePublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrentValuePublisher.swift; sourceTree = "<group>"; };
1304D9191300873EADA52D6E /* IntegrationTests.xctestplan */ = {isa = PBXFileReference; path = IntegrationTests.xctestplan; sourceTree = "<group>"; };
1304D9191300873EADA52D6E /* IntegrationTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = IntegrationTests.xctestplan; sourceTree = "<group>"; };
130ED565A078F7E0B59D9D25 /* UNTextInputNotificationResponse+Creator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UNTextInputNotificationResponse+Creator.swift"; sourceTree = "<group>"; };
13802897C7AFA360EA74C0B0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
1423AB065857FA546444DB15 /* NotificationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationManager.swift; sourceTree = "<group>"; };
@@ -884,7 +884,7 @@
47111410B6E659A697D472B5 /* RoomProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomProxyProtocol.swift; sourceTree = "<group>"; };
471EB7D96AFEA8D787659686 /* EmoteRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmoteRoomTimelineView.swift; sourceTree = "<group>"; };
47873756E45B46683D97DC32 /* LegalInformationScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegalInformationScreenModels.swift; sourceTree = "<group>"; };
478BE8591BD13E908EF70C0C /* DesignKit */ = {isa = PBXFileReference; lastKnownFileType = folder; name = DesignKit; path = DesignKit; sourceTree = SOURCE_ROOT; };
478BE8591BD13E908EF70C0C /* DesignKit */ = {isa = PBXFileReference; lastKnownFileType = folder; path = DesignKit; sourceTree = SOURCE_ROOT; };
4798B3B7A1E8AE3901CEE8C6 /* FramePreferenceKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FramePreferenceKey.swift; sourceTree = "<group>"; };
47EBB5D698CE9A25BB553A2D /* Strings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Strings.swift; sourceTree = "<group>"; };
47F29139BC2A804CE5E0757E /* MediaUploadPreviewScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaUploadPreviewScreenViewModel.swift; sourceTree = "<group>"; };
@@ -896,7 +896,7 @@
4B41FABA2B0AEF4389986495 /* LoginMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginMode.swift; sourceTree = "<group>"; };
4B5046BB295AEAFA6FB81655 /* SessionVerificationScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionVerificationScreenModels.swift; sourceTree = "<group>"; };
4BD371B60E07A5324B9507EF /* AnalyticsSettingsScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsSettingsScreenCoordinator.swift; sourceTree = "<group>"; };
4CD6AC7546E8D7E5C73CEA48 /* ElementX.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = ElementX.app; sourceTree = BUILT_PRODUCTS_DIR; };
4CD6AC7546E8D7E5C73CEA48 /* ElementX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ElementX.app; sourceTree = BUILT_PRODUCTS_DIR; };
4CDDDDD9FE1A699D23A5E096 /* LoginScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginScreen.swift; sourceTree = "<group>"; };
4D6E4C37E9F0E53D3DF951AC /* HomeScreenUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenUITests.swift; sourceTree = "<group>"; };
4E2245243369B99216C7D84E /* ImageCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCache.swift; sourceTree = "<group>"; };
@@ -1038,7 +1038,7 @@
8D6094DEAAEB388E1AE118C6 /* MockRoomTimelineProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockRoomTimelineProvider.swift; sourceTree = "<group>"; };
8D8169443E5AC5FF71BFB3DB /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Localizable.strings; sourceTree = "<group>"; };
8DC2C9E0E15C79BBDA80F0A2 /* TimelineStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineStyle.swift; sourceTree = "<group>"; };
8E088F2A1B9EC529D3221931 /* UITests.xctestplan */ = {isa = PBXFileReference; path = UITests.xctestplan; sourceTree = "<group>"; };
8E088F2A1B9EC529D3221931 /* UITests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UITests.xctestplan; sourceTree = "<group>"; };
8E1BBA73B611EDEEA6E20E05 /* InvitesScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InvitesScreenModels.swift; sourceTree = "<group>"; };
8EC57A32ABC80D774CC663DB /* SettingsScreenUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsScreenUITests.swift; sourceTree = "<group>"; };
8F61A0DD8243B395499C99A2 /* InvitesScreenUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InvitesScreenUITests.swift; sourceTree = "<group>"; };
@@ -1137,7 +1137,7 @@
B43456E73F8A2D52B69B9FB9 /* TemplateScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateScreenViewModel.swift; sourceTree = "<group>"; };
B590BD4507D4F0A377FDE01A /* LoadableAvatarImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadableAvatarImage.swift; sourceTree = "<group>"; };
B5B243E7818E5E9F6A4EDC7A /* NoticeRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeRoomTimelineView.swift; sourceTree = "<group>"; };
B61C339A2FDDBD067FF6635C /* ConfettiScene.scn */ = {isa = PBXFileReference; path = ConfettiScene.scn; sourceTree = "<group>"; };
B61C339A2FDDBD067FF6635C /* ConfettiScene.scn */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; path = ConfettiScene.scn; sourceTree = "<group>"; };
B6311F21F911E23BE4DF51B4 /* ReadMarkerRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadMarkerRoomTimelineView.swift; sourceTree = "<group>"; };
B6E89E530A8E92EC44301CA1 /* Bundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bundle.swift; sourceTree = "<group>"; };
B7F0192CE2F891141A25B49F /* UITestsSignalling.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITestsSignalling.swift; sourceTree = "<group>"; };
@@ -1202,7 +1202,7 @@
CD6B0C4639E066915B5E6463 /* target.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = target.yml; sourceTree = "<group>"; };
CDB3227C7A74B734924942E9 /* RoomSummaryProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomSummaryProvider.swift; sourceTree = "<group>"; };
CEE0E6043EFCF6FD2A341861 /* TimelineReplyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineReplyView.swift; sourceTree = "<group>"; };
CEE41494C837AA403A06A5D9 /* UnitTests.xctestplan */ = {isa = PBXFileReference; path = UnitTests.xctestplan; sourceTree = "<group>"; };
CEE41494C837AA403A06A5D9 /* UnitTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UnitTests.xctestplan; sourceTree = "<group>"; };
CF48AF076424DBC1615C74AD /* AuthenticationServiceProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationServiceProxy.swift; sourceTree = "<group>"; };
D06A27D9C70E0DCC1E199163 /* OnboardingBackgroundView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingBackgroundView.swift; sourceTree = "<group>"; };
D071F86CD47582B9196C9D16 /* UserDiscoverySection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDiscoverySection.swift; sourceTree = "<group>"; };
@@ -1268,7 +1268,7 @@
ECF79FB25E2D4BD6F50CE7C9 /* RoomMembersListScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomMembersListScreenViewModel.swift; sourceTree = "<group>"; };
ED044D00F2176681CC02CD54 /* HomeScreenRoomCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeScreenRoomCell.swift; sourceTree = "<group>"; };
ED1D792EB82506A19A72C8DE /* RoomTimelineItemProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomTimelineItemProtocol.swift; sourceTree = "<group>"; };
ED482057AE39D5C6D9C5F3D8 /* message.caf */ = {isa = PBXFileReference; path = message.caf; sourceTree = "<group>"; };
ED482057AE39D5C6D9C5F3D8 /* message.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = message.caf; sourceTree = "<group>"; };
ED983D4DCA5AFA6E1ED96099 /* StateRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateRoomTimelineView.swift; sourceTree = "<group>"; };
EDAA4472821985BF868CC21C /* ServerSelectionViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerSelectionViewModelTests.swift; sourceTree = "<group>"; };
EE378083653EF0C9B5E9D580 /* EmoteRoomTimelineItemContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmoteRoomTimelineItemContent.swift; sourceTree = "<group>"; };
@@ -4852,7 +4852,7 @@
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
requirement = {
kind = exactVersion;
version = "1.0.73-alpha";
version = "1.0.74-alpha";
};
};
96495DD8554E2F39D3954354 /* XCRemoteSwiftPackageReference "posthog-ios" */ = {

View File

@@ -102,8 +102,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
"state" : {
"revision" : "849e6c5c47d0172b28d757dee0c7d203bf4b34cc",
"version" : "1.0.73-alpha"
"revision" : "97a5fcc18cc201ee97239a76c1556dcbd0ff27fa",
"version" : "1.0.74-alpha"
}
},
{

View File

@@ -207,8 +207,8 @@ class SDKClientMock: SDKClientProtocol {
throw error
}
getMediaFileMediaSourceBodyMimeTypeTempDirCallsCount += 1
getMediaFileMediaSourceBodyMimeTypeTempDirReceivedArguments = (`mediaSource`: `mediaSource`, `body`: `body`, `mimeType`: `mimeType`, `tempDir`: `tempDir`)
getMediaFileMediaSourceBodyMimeTypeTempDirReceivedInvocations.append((`mediaSource`: `mediaSource`, `body`: `body`, `mimeType`: `mimeType`, `tempDir`: `tempDir`))
getMediaFileMediaSourceBodyMimeTypeTempDirReceivedArguments = (mediaSource: mediaSource, body: body, mimeType: mimeType, tempDir: tempDir)
getMediaFileMediaSourceBodyMimeTypeTempDirReceivedInvocations.append((mediaSource: mediaSource, body: body, mimeType: mimeType, tempDir: tempDir))
if let getMediaFileMediaSourceBodyMimeTypeTempDirClosure = getMediaFileMediaSourceBodyMimeTypeTempDirClosure {
return try getMediaFileMediaSourceBodyMimeTypeTempDirClosure(`mediaSource`, `body`, `mimeType`, `tempDir`)
} else {
@@ -232,8 +232,8 @@ class SDKClientMock: SDKClientProtocol {
throw error
}
getMediaThumbnailMediaSourceWidthHeightCallsCount += 1
getMediaThumbnailMediaSourceWidthHeightReceivedArguments = (`mediaSource`: `mediaSource`, `width`: `width`, `height`: `height`)
getMediaThumbnailMediaSourceWidthHeightReceivedInvocations.append((`mediaSource`: `mediaSource`, `width`: `width`, `height`: `height`))
getMediaThumbnailMediaSourceWidthHeightReceivedArguments = (mediaSource: mediaSource, width: width, height: height)
getMediaThumbnailMediaSourceWidthHeightReceivedInvocations.append((mediaSource: mediaSource, width: width, height: height))
if let getMediaThumbnailMediaSourceWidthHeightClosure = getMediaThumbnailMediaSourceWidthHeightClosure {
return try getMediaThumbnailMediaSourceWidthHeightClosure(`mediaSource`, `width`, `height`)
} else {
@@ -257,8 +257,8 @@ class SDKClientMock: SDKClientProtocol {
throw error
}
getNotificationItemRoomIdEventIdCallsCount += 1
getNotificationItemRoomIdEventIdReceivedArguments = (`roomId`: `roomId`, `eventId`: `eventId`)
getNotificationItemRoomIdEventIdReceivedInvocations.append((`roomId`: `roomId`, `eventId`: `eventId`))
getNotificationItemRoomIdEventIdReceivedArguments = (roomId: roomId, eventId: eventId)
getNotificationItemRoomIdEventIdReceivedInvocations.append((roomId: roomId, eventId: eventId))
if let getNotificationItemRoomIdEventIdClosure = getNotificationItemRoomIdEventIdClosure {
return try getNotificationItemRoomIdEventIdClosure(`roomId`, `eventId`)
} else {
@@ -364,8 +364,8 @@ class SDKClientMock: SDKClientProtocol {
throw error
}
loginUsernamePasswordInitialDeviceNameDeviceIdCallsCount += 1
loginUsernamePasswordInitialDeviceNameDeviceIdReceivedArguments = (`username`: `username`, `password`: `password`, `initialDeviceName`: `initialDeviceName`, `deviceId`: `deviceId`)
loginUsernamePasswordInitialDeviceNameDeviceIdReceivedInvocations.append((`username`: `username`, `password`: `password`, `initialDeviceName`: `initialDeviceName`, `deviceId`: `deviceId`))
loginUsernamePasswordInitialDeviceNameDeviceIdReceivedArguments = (username: username, password: password, initialDeviceName: initialDeviceName, deviceId: deviceId)
loginUsernamePasswordInitialDeviceNameDeviceIdReceivedInvocations.append((username: username, password: password, initialDeviceName: initialDeviceName, deviceId: deviceId))
try loginUsernamePasswordInitialDeviceNameDeviceIdClosure?(`username`, `password`, `initialDeviceName`, `deviceId`)
}
//MARK: - `logout`
@@ -438,8 +438,8 @@ class SDKClientMock: SDKClientProtocol {
throw error
}
searchUsersSearchTermLimitCallsCount += 1
searchUsersSearchTermLimitReceivedArguments = (`searchTerm`: `searchTerm`, `limit`: `limit`)
searchUsersSearchTermLimitReceivedInvocations.append((`searchTerm`: `searchTerm`, `limit`: `limit`))
searchUsersSearchTermLimitReceivedArguments = (searchTerm: searchTerm, limit: limit)
searchUsersSearchTermLimitReceivedInvocations.append((searchTerm: searchTerm, limit: limit))
if let searchUsersSearchTermLimitClosure = searchUsersSearchTermLimitClosure {
return try searchUsersSearchTermLimitClosure(`searchTerm`, `limit`)
} else {
@@ -483,8 +483,8 @@ class SDKClientMock: SDKClientProtocol {
throw error
}
setAccountDataEventTypeContentCallsCount += 1
setAccountDataEventTypeContentReceivedArguments = (`eventType`: `eventType`, `content`: `content`)
setAccountDataEventTypeContentReceivedInvocations.append((`eventType`: `eventType`, `content`: `content`))
setAccountDataEventTypeContentReceivedArguments = (eventType: eventType, content: content)
setAccountDataEventTypeContentReceivedInvocations.append((eventType: eventType, content: content))
try setAccountDataEventTypeContentClosure?(`eventType`, `content`)
}
//MARK: - `setDelegate`
@@ -555,10 +555,35 @@ class SDKClientMock: SDKClientProtocol {
throw error
}
setPusherIdentifiersKindAppDisplayNameDeviceDisplayNameProfileTagLangCallsCount += 1
setPusherIdentifiersKindAppDisplayNameDeviceDisplayNameProfileTagLangReceivedArguments = (`identifiers`: `identifiers`, `kind`: `kind`, `appDisplayName`: `appDisplayName`, `deviceDisplayName`: `deviceDisplayName`, `profileTag`: `profileTag`, `lang`: `lang`)
setPusherIdentifiersKindAppDisplayNameDeviceDisplayNameProfileTagLangReceivedInvocations.append((`identifiers`: `identifiers`, `kind`: `kind`, `appDisplayName`: `appDisplayName`, `deviceDisplayName`: `deviceDisplayName`, `profileTag`: `profileTag`, `lang`: `lang`))
setPusherIdentifiersKindAppDisplayNameDeviceDisplayNameProfileTagLangReceivedArguments = (identifiers: identifiers, kind: kind, appDisplayName: appDisplayName, deviceDisplayName: deviceDisplayName, profileTag: profileTag, lang: lang)
setPusherIdentifiersKindAppDisplayNameDeviceDisplayNameProfileTagLangReceivedInvocations.append((identifiers: identifiers, kind: kind, appDisplayName: appDisplayName, deviceDisplayName: deviceDisplayName, profileTag: profileTag, lang: lang))
try setPusherIdentifiersKindAppDisplayNameDeviceDisplayNameProfileTagLangClosure?(`identifiers`, `kind`, `appDisplayName`, `deviceDisplayName`, `profileTag`, `lang`)
}
//MARK: - `slidingSync`
public var slidingSyncIdThrowableError: Error?
public var slidingSyncIdCallsCount = 0
public var slidingSyncIdCalled: Bool {
return slidingSyncIdCallsCount > 0
}
public var slidingSyncIdReceivedId: String?
public var slidingSyncIdReceivedInvocations: [String] = []
public var slidingSyncIdReturnValue: SlidingSyncBuilder!
public var slidingSyncIdClosure: ((String) throws -> SlidingSyncBuilder)?
public func `slidingSync`(`id`: String) throws -> SlidingSyncBuilder {
if let error = slidingSyncIdThrowableError {
throw error
}
slidingSyncIdCallsCount += 1
slidingSyncIdReceivedId = id
slidingSyncIdReceivedInvocations.append(`id`)
if let slidingSyncIdClosure = slidingSyncIdClosure {
return try slidingSyncIdClosure(`id`)
} else {
return slidingSyncIdReturnValue
}
}
//MARK: - `unignoreUser`
public var unignoreUserUserIdThrowableError: Error?
@@ -596,8 +621,8 @@ class SDKClientMock: SDKClientProtocol {
throw error
}
uploadMediaMimeTypeDataCallsCount += 1
uploadMediaMimeTypeDataReceivedArguments = (`mimeType`: `mimeType`, `data`: `data`)
uploadMediaMimeTypeDataReceivedInvocations.append((`mimeType`: `mimeType`, `data`: `data`))
uploadMediaMimeTypeDataReceivedArguments = (mimeType: mimeType, data: data)
uploadMediaMimeTypeDataReceivedInvocations.append((mimeType: mimeType, data: data))
if let uploadMediaMimeTypeDataClosure = uploadMediaMimeTypeDataClosure {
return try uploadMediaMimeTypeDataClosure(`mimeType`, `data`)
} else {
@@ -625,30 +650,5 @@ class SDKClientMock: SDKClientProtocol {
return userIdReturnValue
}
}
//MARK: - `slidingSync`
public var slidingSyncIdThrowableError: Error?
public var slidingSyncIdCallsCount = 0
public var slidingSyncIdCalled: Bool {
return slidingSyncIdCallsCount > 0
}
public var slidingSyncIdReceivedId: String?
public var slidingSyncIdReceivedInvocations: [String] = []
public var slidingSyncIdReturnValue: SlidingSyncBuilder!
public var slidingSyncIdClosure: ((String) throws -> SlidingSyncBuilder)?
public func `slidingSync`(`id`: String) throws -> SlidingSyncBuilder {
if let error = slidingSyncIdThrowableError {
throw error
}
slidingSyncIdCallsCount += 1
slidingSyncIdReceivedId = id
slidingSyncIdReceivedInvocations.append(`id`)
if let slidingSyncIdClosure = slidingSyncIdClosure {
return try slidingSyncIdClosure(`id`)
} else {
return slidingSyncIdReturnValue
}
}
}
// swiftlint:enable all

View File

@@ -31,7 +31,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
private let timelineController: RoomTimelineControllerProtocol
private unowned let userIndicatorController: UserIndicatorControllerProtocol
private var loadingTask: Task<Void, Never>?
init(timelineController: RoomTimelineControllerProtocol,
mediaProvider: MediaProviderProtocol,
roomProxy: RoomProxyProtocol,
@@ -47,26 +47,8 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
readReceiptsEnabled: ServiceLocator.shared.settings.readReceiptsEnabled,
bindings: .init(composerText: "", composerFocused: false)),
imageProvider: mediaProvider)
timelineController.callbacks
.receive(on: DispatchQueue.main)
.sink { [weak self] callback in
guard let self else { return }
switch callback {
case .updatedTimelineItems:
self.buildTimelineViews()
case .canBackPaginate(let canBackPaginate):
if self.state.canBackPaginate != canBackPaginate {
self.state.canBackPaginate = canBackPaginate
}
case .isBackPaginating(let isBackPaginating):
if self.state.isBackPaginating != isBackPaginating {
self.state.isBackPaginating = isBackPaginating
}
}
}
.store(in: &cancellables)
setupSubscriptions()
state.timelineItemMenuActionProvider = { [weak self] itemId -> TimelineItemMenuActions? in
guard let self else {
@@ -75,34 +57,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
return self.timelineItemMenuActionsForItemId(itemId)
}
roomProxy
.updatesPublisher
.throttle(for: .seconds(1), scheduler: DispatchQueue.main, latest: true)
.sink { [weak self] _ in
guard let self else { return }
self.state.roomTitle = roomProxy.roomTitle
self.state.roomAvatarURL = roomProxy.avatarURL
}
.store(in: &cancellables)
ServiceLocator.shared.settings.$timelineStyle
.weakAssign(to: \.state.timelineStyle, on: self)
.store(in: &cancellables)
ServiceLocator.shared.settings.$readReceiptsEnabled
.weakAssign(to: \.state.readReceiptsEnabled, on: self)
.store(in: &cancellables)
roomProxy.membersPublisher
.map { members in
members.reduce(into: [String: RoomMemberState]()) { dictionary, member in
dictionary[member.userID] = RoomMemberState(displayName: member.displayName, avatarURL: member.avatarURL)
}
}
.weakAssign(to: \.state.members, on: self)
.store(in: &cancellables)
buildTimelineViews()
}
@@ -158,6 +113,55 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
}
// MARK: - Private
private func setupSubscriptions() {
timelineController.callbacks
.receive(on: DispatchQueue.main)
.sink { [weak self] callback in
guard let self else { return }
switch callback {
case .updatedTimelineItems:
self.buildTimelineViews()
case .canBackPaginate(let canBackPaginate):
if self.state.canBackPaginate != canBackPaginate {
self.state.canBackPaginate = canBackPaginate
}
case .isBackPaginating(let isBackPaginating):
if self.state.isBackPaginating != isBackPaginating {
self.state.isBackPaginating = isBackPaginating
}
}
}
.store(in: &cancellables)
roomProxy
.updatesPublisher
.throttle(for: .seconds(1), scheduler: DispatchQueue.main, latest: true)
.sink { [weak self] _ in
guard let self else { return }
self.state.roomTitle = roomProxy.roomTitle
self.state.roomAvatarURL = roomProxy.avatarURL
}
.store(in: &cancellables)
ServiceLocator.shared.settings.$timelineStyle
.weakAssign(to: \.state.timelineStyle, on: self)
.store(in: &cancellables)
ServiceLocator.shared.settings.$readReceiptsEnabled
.weakAssign(to: \.state.readReceiptsEnabled, on: self)
.store(in: &cancellables)
roomProxy.membersPublisher
.map { members in
members.reduce(into: [String: RoomMemberState]()) { dictionary, member in
dictionary[member.userID] = RoomMemberState(displayName: member.displayName, avatarURL: member.avatarURL)
}
}
.weakAssign(to: \.state.members, on: self)
.store(in: &cancellables)
}
private func paginateBackwards() async {
switch await timelineController.paginateBackwards(requestSize: Constants.backPaginationEventLimit, untilNumberOfItems: Constants.backPaginationPageSize) {

View File

@@ -198,7 +198,7 @@ class RoomProxy: RoomProxyProtocol {
func paginateBackwards(requestSize: UInt, untilNumberOfItems: UInt) async -> Result<Void, RoomProxyError> {
do {
try await Task.dispatch(on: .global()) {
try self.room.paginateBackwards(opts: .untilNumItems(eventLimit: UInt16(requestSize), items: UInt16(untilNumberOfItems)))
try self.room.paginateBackwards(opts: .untilNumItems(eventLimit: UInt16(requestSize), items: UInt16(untilNumberOfItems), waitForToken: true))
}
return .success(())

View File

@@ -27,8 +27,8 @@ import {{ import }}
{% call swiftifyMethodName method.selectorName %}ReceivedInvocations.append({% for param in method.parameters %}{{ param.name }}){% endfor %}
{% else %}
{% if not method.parameters.count == 0 and not hasNonEscapingClosures %}
{% call swiftifyMethodName method.selectorName %}ReceivedArguments = ({% for param in method.parameters %}{{ param.name }}: {{ param.name }}{% if not forloop.last%}, {% endif %}{% endfor %})
{% call swiftifyMethodName method.selectorName %}ReceivedInvocations.append(({% for param in method.parameters %}{{ param.name }}: {{ param.name }}{% if not forloop.last%}, {% endif %}{% endfor %}))
{% call swiftifyMethodName method.selectorName %}ReceivedArguments = ({% for param in method.parameters %}{{ param.name | replace:"`","" }}: {{ param.name | replace:"`","" }}{% if not forloop.last%}, {% endif %}{% endfor %})
{% call swiftifyMethodName method.selectorName %}ReceivedInvocations.append(({% for param in method.parameters %}{{ param.name | replace:"`","" }}: {{ param.name | replace:"`","" }}{% if not forloop.last%}, {% endif %}{% endfor %}))
{% endif %}
{% endif %}
{% endmacro %}

View File

@@ -54,6 +54,7 @@ struct BuildSDK: ParsableCommand {
try checkoutBranchIfSupplied()
try buildFramework()
try updateXcodeProject()
try generateSDKMocks()
}
/// Checks that all of the required targets have been added through rustup
@@ -115,4 +116,10 @@ struct BuildSDK: ParsableCommand {
let updatedYAMLString = try Yams.serialize(node: projectConfig)
try updatedYAMLString.write(to: yamlURL, atomically: true, encoding: .utf8)
}
func generateSDKMocks() throws {
var command = GenerateSDKMocks()
command.version = "local"
try command.run()
}
}

View File

@@ -19,6 +19,16 @@ import XCTest
@MainActor
class RoomScreenViewModelTests: XCTestCase {
var userIndicatorControllerMock: UserIndicatorControllerMock!
override func setUp() async throws {
userIndicatorControllerMock = UserIndicatorControllerMock.default
}
override func tearDown() async throws {
userIndicatorControllerMock = nil
}
func testMessageGrouping() {
// Given 3 messages from Bob.
let items = [
@@ -158,7 +168,7 @@ class RoomScreenViewModelTests: XCTestCase {
let roomMemberMock = RoomMemberProxyMock()
roomMemberMock.userID = "bob"
roomProxyMock.getMemberUserIDReturnValue = .success(roomMemberMock)
let userIndicatorControllerMock = UserIndicatorControllerMock.default
let viewModel = RoomScreenViewModel(timelineController: timelineController,
mediaProvider: MockMediaProvider(),
roomProxy: roomProxyMock,
@@ -190,7 +200,7 @@ class RoomScreenViewModelTests: XCTestCase {
try? await Task.sleep(for: .milliseconds(200))
return .success(roomMemberMock)
}
let userIndicatorControllerMock = UserIndicatorControllerMock.default
let viewModel = RoomScreenViewModel(timelineController: timelineController,
mediaProvider: MockMediaProvider(),
roomProxy: roomProxyMock,
@@ -222,7 +232,7 @@ class RoomScreenViewModelTests: XCTestCase {
roomProxyMock.getMemberUserIDClosure = { _ in
.failure(.failedRetrievingMember)
}
let userIndicatorControllerMock = UserIndicatorControllerMock.default
let viewModel = RoomScreenViewModel(timelineController: timelineController,
mediaProvider: MockMediaProvider(),
roomProxy: roomProxyMock,

View File

@@ -44,7 +44,7 @@ include:
packages:
MatrixRustSDK:
url: https://github.com/matrix-org/matrix-rust-components-swift
exactVersion: 1.0.73-alpha
exactVersion: 1.0.74-alpha
# path: ../matrix-rust-sdk
DesignKit:
path: DesignKit