Skip to content

Commit

Permalink
Remive debug code
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmuslos committed Dec 21, 2024
1 parent 5143c25 commit 9d7ba55
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 104 deletions.
19 changes: 0 additions & 19 deletions Multiplatform/Account/AccountSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,9 @@ internal struct AccountSheet: View {
return formatter.string(from: NSNumber(value: customPlaybackSpeed))!
}

@State private var stops: [StopEvent] = SPPlayback.stops

var body: some View {
NavigationStack {
List {
Section {
ForEach(stops, id: \.time) { stop in
VStack {
Text(stop.time, style: .relative)
Text(stop.reason.label)
}
}

Button("update") {
stops = SPPlayback.stops
}

Button("clear") {
clearStops()
}
}

Section {
if let username {
Text(username)
Expand Down
6 changes: 0 additions & 6 deletions Multiplatform/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -2548,9 +2548,6 @@
}
}
}
},
"clear" : {

},
"decrease" : {
"localizations" : {
Expand Down Expand Up @@ -7129,9 +7126,6 @@
}
}
}
},
"update" : {

}
},
"version" : "1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ internal extension NowPlaying {
}

Button {
AudioPlayer.shared.stop(.userRequest)
AudioPlayer.shared.stop()
} label: {
Label("playback.stop", systemImage: "stop.fill")
}
Expand Down
4 changes: 2 additions & 2 deletions ShelfPlayerKit/Sources/SPPlayback/AudioPlayer+Observers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ internal extension AudioPlayer {
do {
try await advance(finished: true)
} catch {
stop(.advanceFailed)
stop()
}
}
}
Expand Down Expand Up @@ -157,7 +157,7 @@ internal extension AudioPlayer {
let elapsed = Date().timeIntervalSince(lastPause)

if elapsed > timeout {
self.stop(.playerTimeout)
self.stop()
}
}
}
10 changes: 4 additions & 6 deletions ShelfPlayerKit/Sources/SPPlayback/AudioPlayer+Playback.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import SPOffline

public extension AudioPlayer {
func play(_ item: PlayableItem, at seconds: TimeInterval? = nil, withoutPlaybackSession: Bool = false) async throws {
stop(.newItem)
stop()

try await start(item, at: seconds, withoutPlaybackSession: withoutPlaybackSession)

Expand All @@ -33,9 +33,7 @@ public extension AudioPlayer {
}
}

func stop(_ reason: StopReason) {
stops.append(.init(time: .now, reason: reason))

func stop() {
buffering = true

item = nil
Expand Down Expand Up @@ -80,7 +78,7 @@ public extension AudioPlayer {
do {
try await advance(finished: true)
} catch {
stop(.seekExceededDuration)
stop()
}
}

Expand Down Expand Up @@ -183,7 +181,7 @@ internal extension AudioPlayer {
}

if queue.isEmpty {
stop(.queueEmpty)
stop()
return
}

Expand Down
2 changes: 1 addition & 1 deletion ShelfPlayerKit/Sources/SPPlayback/AudioPlayer+Queue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import SPExtension
public extension AudioPlayer {
func advance(to index: Int) async throws {
guard index < queue.count else {
stop(.queueIndexOutOfBounds)
stop()
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ internal extension SleepTimer {
}

func didExpire() {
if expiredAt != nil {
stops.append(.init(time: .now, reason: .sleepTime))
} else {
stops.append(.init(time: .now, reason: .sleepChapter))
}

expiresAt = nil
expiresAtChapterEnd = nil

Expand Down
63 changes: 0 additions & 63 deletions ShelfPlayerKit/Sources/SPPlayback/tmpDebug.swift

This file was deleted.

0 comments on commit 9d7ba55

Please sign in to comment.