Skip to content

Commit 8808152

Browse files
committed
Fix issues
1 parent c92e413 commit 8808152

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

Sources/StreamVideo/Utils/ScreenPropertiesAdapter/ScreenPropertiesAdapter.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import UIKit
1111

1212
public final class ScreenPropertiesAdapter: @unchecked Sendable {
1313

14-
public private(set) var preferredFramesPerSecond: Int = 0
15-
public private(set) var refreshRate: TimeInterval = 0
16-
public private(set) var scale: CGFloat = 0
14+
public private(set) var preferredFramesPerSecond: Int = 30
15+
public private(set) var refreshRate: TimeInterval = 0.16
16+
public private(set) var scale: CGFloat = 1
1717

1818
init() {
1919
Task { @MainActor in

Sources/StreamVideo/Utils/Timers/DefaultTimer.swift

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,21 @@ public struct DefaultTimer: Timer {
6767
/// implementation.
6868
/// - Returns: A publisher that emits ``Date`` values.
6969
public static func publish(
70-
every interval: TimeInterval
70+
every interval: TimeInterval,
71+
file: StaticString = #file,
72+
function: StaticString = #function,
73+
line: UInt = #line
7174
) -> AnyPublisher<Date, Never> {
72-
TimerStorage
75+
guard interval > 0 else {
76+
log.warning(
77+
"Interval cannot be 0 or less",
78+
functionName: function,
79+
fileName: file,
80+
lineNumber: line
81+
)
82+
return Just(Date()).eraseToAnyPublisher()
83+
}
84+
return TimerStorage
7385
.currentValue
7486
.timer(for: interval)
7587
.eraseToAnyPublisher()

Sources/StreamVideo/Utils/Timers/Protocol/Timer.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ protocol Timer {
6161
/// - repeating: A Boolean indicating if the timer should repeat.
6262
/// - Returns: A publisher that emits the current `Date` on each fire.
6363
static func publish(
64-
every interval: TimeInterval
64+
every interval: TimeInterval,
65+
file: StaticString,
66+
function: StaticString,
67+
line: UInt
6568
) -> AnyPublisher<Date, Never>
6669
}
6770

StreamVideoTests/TestUtils/VirtualTime/VirtualTimer.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ struct VirtualTimeTimer: Timer {
4040
}
4141

4242
static func publish(
43-
every interval: TimeInterval
43+
every interval: TimeInterval,
44+
file: StaticString,
45+
function: StaticString,
46+
line: UInt
4447
) -> AnyPublisher<Date, Never> {
4548
DefaultTimer
4649
.publish(every: interval)

0 commit comments

Comments
 (0)