Skip to content

Commit 8887c6a

Browse files
committed
Fix website opening from popup, use stop for live streams, square station image
1 parent eca716a commit 8887c6a

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

SwiftRadio/ViewControllers/InfoDetailViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class InfoDetailViewController: BaseController {
3636

3737
private let stationImageView: UIImageView = {
3838
let iv = UIImageView(image: UIImage(named: "stationImage"))
39-
iv.contentMode = .scaleAspectFit
40-
iv.layer.cornerRadius = 12
39+
iv.contentMode = .scaleAspectFill
40+
iv.layer.cornerRadius = 20
4141
iv.clipsToBounds = true
4242
iv.translatesAutoresizingMaskIntoConstraints = false
4343
return iv

SwiftRadio/ViewControllers/NowPlayingViewController.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ class NowPlayingViewController: UIViewController {
156156
mainStackView.translatesAutoresizingMaskIntoConstraints = false
157157

158158
controlsView.playingAction = { [unowned self] in
159-
player.togglePlaying()
159+
if player.isPlaying, player.duration == 0 {
160+
player.stop()
161+
} else {
162+
player.togglePlaying()
163+
}
160164
}
161165

162166
controlsView.nextAction = { [unowned self] in
@@ -274,12 +278,17 @@ class NowPlayingViewController: UIViewController {
274278
}
275279

276280
private func updatePopupBarPlayPauseButton(isPlaying: Bool) {
277-
let imageName = isPlaying ? "pause.fill" : "play.fill"
281+
let isLive = player.duration == 0
282+
let imageName = isPlaying ? (isLive ? "stop.fill" : "pause.fill") : "play.fill"
278283
playPauseButton.image = UIImage(systemName: imageName)
279284
}
280285

281286
@objc private func popupBarPlayPauseTapped() {
282-
player.togglePlaying()
287+
if player.isPlaying, player.duration == 0 {
288+
player.stop()
289+
} else {
290+
player.togglePlaying()
291+
}
283292
}
284293
}
285294

0 commit comments

Comments
 (0)