Skip to content

Commit

Permalink
Fix warnings around unchecked Sendable requirement, makeConnectedUser…
Browse files Browse the repository at this point in the history
… is not async, and unused variables (#3555)
  • Loading branch information
laevandus authored Jan 9, 2025
1 parent bb76fe5 commit 8b5e108
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Sources/StreamChat/ChatClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public class ChatClient {
continuation.resume(with: error)
}
}
return try await makeConnectedUser()
return try makeConnectedUser()
}

/// Connects the client with the given user.
Expand Down Expand Up @@ -391,7 +391,7 @@ public class ChatClient {
continuation.resume(with: error)
}
}
return try await makeConnectedUser()
return try makeConnectedUser()
}

/// Connects a guest user.
Expand Down Expand Up @@ -423,7 +423,7 @@ public class ChatClient {
continuation.resume(with: error)
}
}
return try await makeConnectedUser()
return try makeConnectedUser()
}

/// Connects an anonymous user
Expand All @@ -447,7 +447,7 @@ public class ChatClient {
continuation.resume(with: error)
}
}
return try await makeConnectedUser()
return try makeConnectedUser()
}

/// Sets the user token to the client, this method is only needed to perform API calls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import AVFoundation

@dynamicMemberLookup
public final class MockAVURLAsset: AVURLAsset, Spy, Stub {
public final class MockAVURLAsset: AVURLAsset, Spy, Stub, @unchecked Sendable {

public let spyState = SpyState()
public var stubbedProperties: [String: Any] = [:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Foundation
@testable import StreamChat

/// Mock implementation of `EventNotificationCenter`
final class EventNotificationCenter_Mock: EventNotificationCenter {
final class EventNotificationCenter_Mock: EventNotificationCenter, @unchecked Sendable {

override var newMessageIds: Set<MessageId> {
newMessageIdsMock ?? super.newMessageIds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import CoreData
import XCTest

/// A testable subclass of DatabaseContainer allowing response simulation.
public final class DatabaseContainer_Spy: DatabaseContainer, Spy {
public final class DatabaseContainer_Spy: DatabaseContainer, Spy, @unchecked Sendable {
public let spyState = SpyState()

/// If set, the `write` completion block is called with this value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ final class StreamAppStateObserver_Tests: XCTestCase {
}
}

private final class StubNotificationCenter: NotificationCenter {
private final class StubNotificationCenter: NotificationCenter, @unchecked Sendable {
struct ObserverRecord {
var observer: AnyObject
var selector: Selector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ private final class MockΑudioRecorderMeterNormaliser: AudioValuePercentageNorma
}

@dynamicMemberLookup
private final class StubAudioRecorder: AVAudioRecorder, Stub {
private final class StubAudioRecorder: AVAudioRecorder, Stub, @unchecked Sendable {
var stubbedProperties: [String: Any] = [:]

var recordWasCalled = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ private final class StubAVAudioSession: AudioSessionProtocol, Stub {
}

@dynamicMemberLookup
private final class StubAVAudioSessionPortDescription: AVAudioSessionPortDescription, Stub {
private final class StubAVAudioSessionPortDescription: AVAudioSessionPortDescription, Stub, @unchecked Sendable {
var stubbedProperties: [String: Any] = [:]

override var portType: AVAudioSession.Port { self[dynamicMember: \.portType] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ extension StreamPlayerObserver_Tests {
}
}

private class MockNotificationCenter: NotificationCenter {
private class MockNotificationCenter: NotificationCenter, @unchecked Sendable {
private(set) var addObserverWasCalledWith: (
name: NSNotification.Name?,
obj: Any?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5111,6 +5111,7 @@ final class ChannelController_Tests: XCTestCase {
done(error)
}
}
XCTAssertNil(resultingError)
XCTAssertEqual(channelId, env.memberUpdater!.partialUpdate_cid)
XCTAssertEqual(currentUserId, env.memberUpdater!.partialUpdate_userId)
XCTAssertEqual(nil, env.memberUpdater!.partialUpdate_unset)
Expand All @@ -5133,6 +5134,7 @@ final class ChannelController_Tests: XCTestCase {
done(error)
}
}
XCTAssertNil(resultingError)
XCTAssertEqual(channelId, env.memberUpdater!.partialUpdate_cid)
XCTAssertEqual(currentUserId, env.memberUpdater!.partialUpdate_userId)
XCTAssertEqual(["pinned"], env.memberUpdater!.partialUpdate_unset)
Expand Down
2 changes: 1 addition & 1 deletion Tests/StreamChatTests/Database/FetchCache_Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ final class FetchCache_Tests: XCTestCase {
}
}

class TestId: NSManagedObjectID {
class TestId: NSManagedObjectID, @unchecked Sendable {
override func uriRepresentation() -> URL {
URL(string: "file://a")!
}
Expand Down

0 comments on commit 8b5e108

Please sign in to comment.