Skip to content
Draft
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
3 changes: 3 additions & 0 deletions Sources/StreamCore/Utils/InternetConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ extension InternetConnection {

/// A protocol defining the interface for internet connection monitoring.
public protocol InternetConnectionProtocol {
/// The current Internet connection status.
var status: InternetConnectionStatus { get }

/// A publisher that emits the current internet connection status.
///
/// This publisher never fails and continuously updates with the latest
Expand Down
6 changes: 6 additions & 0 deletions Tests/StreamCoreTests/Utils/InternetConnection_Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ final class InternetConnection_Tests: XCTestCase, @unchecked Sendable {
XCTAssertTrue(monitor.delegate === internetConnection)
}

func test_internetConnectionProtocol_exposesCurrentStatus() {
let subject: any InternetConnectionProtocol = internetConnection

XCTAssertEqual(subject.status, monitor.status)
}

func test_internetConnection_postsStatusAndAvailabilityNotifications_whenAvailabilityChanges() {
// Set unavailable status
monitor.status = .unavailable
Expand Down
Loading