Skip to content

Commit 471944e

Browse files
committed
Fix compilation errors from StreamChat changes
1 parent 721abc5 commit 471944e

File tree

4 files changed

+28
-22
lines changed

4 files changed

+28
-22
lines changed

Sources/StreamChatSwiftUI/ChatChannel/ChannelInfo/AddUsersViewModel.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,26 +45,26 @@ import SwiftUI
4545
if !loadingNextUsers {
4646
loadingNextUsers = true
4747
searchController.loadNextUsers { [weak self] _ in
48-
guard let self = self else { return }
49-
self.users = self.searchController.userArray
50-
self.loadingNextUsers = false
48+
guard let self else { return }
49+
users = searchController.userArray
50+
loadingNextUsers = false
5151
}
5252
}
5353
}
5454

5555
private func searchUsers() {
56-
let filter: Filter<UserListFilterScope> = .notIn(.id, values: loadedUserIds)
57-
let query = UserListQuery(filter: filter)
58-
searchController.search(query: query) { [weak self] error in
59-
guard let self = self, error == nil else { return }
60-
self.users = self.searchController.userArray
56+
searchController.search(query: UserListQuery()) { [weak self] error in
57+
guard let self, error == nil else { return }
58+
users = searchController.userArray.filter { user in
59+
!self.loadedUserIds.contains(user.id)
60+
}
6161
}
6262
}
6363

6464
private func searchUsers(term: String) {
6565
searchController.search(term: searchText) { [weak self] error in
66-
guard let self = self, error == nil else { return }
67-
self.users = self.searchController.userArray.filter { user in
66+
guard let self, error == nil else { return }
67+
users = searchController.userArray.filter { user in
6868
!self.loadedUserIds.contains(user.id)
6969
}
7070
}

StreamChatSwiftUITests/Tests/ChatChannel/ChatChannelTestHelpers.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class ChatChannelTestHelpers {
5959
payload: ImageAttachmentPayload(
6060
title: "test",
6161
imageRemoteURL: testURL,
62+
file: attachmentFile,
6263
extraData: [:]
6364
),
6465
downloadingState: nil,
@@ -83,6 +84,7 @@ class ChatChannelTestHelpers {
8384
payload: ImageAttachmentPayload(
8485
title: "test",
8586
imageRemoteURL: testURL,
87+
file: attachmentFile,
8688
extraData: [:]
8789
),
8890
downloadingState: nil,

StreamChatSwiftUITests/Tests/ChatChannel/MessageAttachmentsConverter_Tests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ class MessageAttachmentsConverter_Tests: StreamChatTestCase {
373373
payload: ImageAttachmentPayload(
374374
title: "Test Image",
375375
imageRemoteURL: URL(string: "https://example.com/image.png")!,
376+
file: attachmentFile,
376377
extraData: ["test": "value"]
377378
),
378379
downloadingState: nil,
@@ -394,6 +395,7 @@ class MessageAttachmentsConverter_Tests: StreamChatTestCase {
394395
payload: ImageAttachmentPayload(
395396
title: "Test Image",
396397
imageRemoteURL: URL(string: "https://example.com/image.png")!,
398+
file: attachmentFile,
397399
extraData: ["test": "value"]
398400
),
399401
downloadingState: nil,
@@ -410,6 +412,7 @@ class MessageAttachmentsConverter_Tests: StreamChatTestCase {
410412
payload: ImageAttachmentPayload(
411413
title: "Test Image",
412414
imageRemoteURL: URL(string: "https://example.com/image.png")!,
415+
file: attachmentFile,
413416
extraData: ["test": "value"]
414417
),
415418
downloadingState: nil,

StreamChatSwiftUITests/Tests/ChatChannelList/ChatChannelListItemView_Tests.swift

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ import XCTest
355355

356356
func test_channelListItem_draftMessageWithAttachment() throws {
357357
// Given
358-
let message = DraftMessage.mock(text: "Draft message", attachments: [.dummy(payload: try JSONEncoder().encode(
358+
let message = try DraftMessage.mock(text: "Draft message", attachments: [.dummy(payload: JSONEncoder().encode(
359359
ImageAttachmentPayload(
360360
title: "Test",
361361
imageRemoteURL: .localYodaImage,
@@ -381,7 +381,7 @@ import XCTest
381381
// MARK: - private
382382

383383
private func mockAudioMessage(text: String, isSentByCurrentUser: Bool) throws -> ChatMessage {
384-
.mock(
384+
try .mock(
385385
id: .unique,
386386
cid: .unique,
387387
text: text,
@@ -391,7 +391,7 @@ import XCTest
391391
attachments: [
392392
.dummy(
393393
type: .audio,
394-
payload: try JSONEncoder().encode(AudioAttachmentPayload(
394+
payload: JSONEncoder().encode(AudioAttachmentPayload(
395395
title: "Some Audio",
396396
audioRemoteURL: URL(string: "url")!,
397397
file: .init(type: .mp3, size: 123, mimeType: nil),
@@ -405,7 +405,7 @@ import XCTest
405405
}
406406

407407
private func mockImageMessage(text: String, isSentByCurrentUser: Bool) throws -> ChatMessage {
408-
.mock(
408+
try .mock(
409409
id: .unique,
410410
cid: .unique,
411411
text: text,
@@ -415,9 +415,10 @@ import XCTest
415415
attachments: [
416416
.dummy(
417417
type: .image,
418-
payload: try JSONEncoder().encode(ImageAttachmentPayload(
418+
payload: JSONEncoder().encode(ImageAttachmentPayload(
419419
title: "Test",
420-
imageRemoteURL: URL(string: "Url")!
420+
imageRemoteURL: URL(string: "Url")!,
421+
file: AttachmentFile(type: .png, size: 123, mimeType: nil)
421422
))
422423
)
423424
],
@@ -427,7 +428,7 @@ import XCTest
427428
}
428429

429430
private func mockVideoMessage(text: String, isSentByCurrentUser: Bool) throws -> ChatMessage {
430-
.mock(
431+
try .mock(
431432
id: .unique,
432433
cid: .unique,
433434
text: text,
@@ -437,7 +438,7 @@ import XCTest
437438
attachments: [
438439
.dummy(
439440
type: .video,
440-
payload: try JSONEncoder().encode(VideoAttachmentPayload(
441+
payload: JSONEncoder().encode(VideoAttachmentPayload(
441442
title: "Test",
442443
videoRemoteURL: URL(string: "Url")!,
443444
file: .init(type: .mp4, size: 123, mimeType: nil),
@@ -451,7 +452,7 @@ import XCTest
451452
}
452453

453454
private func mockFileMessage(title: String?, text: String, isSentByCurrentUser: Bool) throws -> ChatMessage {
454-
.mock(
455+
try .mock(
455456
id: .unique,
456457
cid: .unique,
457458
text: text,
@@ -461,7 +462,7 @@ import XCTest
461462
attachments: [
462463
.dummy(
463464
type: .file,
464-
payload: try JSONEncoder().encode(FileAttachmentPayload(
465+
payload: JSONEncoder().encode(FileAttachmentPayload(
465466
title: title,
466467
assetRemoteURL: URL(string: "Url")!,
467468
file: .init(type: .pdf, size: 123, mimeType: nil),
@@ -475,7 +476,7 @@ import XCTest
475476
}
476477

477478
private func mockGiphyMessage(text: String, isSentByCurrentUser: Bool) throws -> ChatMessage {
478-
.mock(
479+
try .mock(
479480
id: .unique,
480481
cid: .unique,
481482
text: text,
@@ -485,7 +486,7 @@ import XCTest
485486
attachments: [
486487
.dummy(
487488
type: .giphy,
488-
payload: try JSONEncoder().encode(GiphyAttachmentPayload(
489+
payload: JSONEncoder().encode(GiphyAttachmentPayload(
489490
title: "Test",
490491
previewURL: URL(string: "Url")!
491492
))

0 commit comments

Comments
 (0)