Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings: unchecked Sendable, non-async makeConnectedUser, and unused variables #3555

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading