Fix retry video buttons

This commit is contained in:
Arkadiusz Fal 2022-11-13 18:50:23 +01:00
parent 0f8c82bbca
commit 9bea3b623d

View File

@ -314,16 +314,27 @@ extension PlayerModel {
message += errorString message += errorString
} }
let alert = Alert( var retryButton: Alert.Button?
title: Text("Could not load video"),
message: Text(message), if let video {
primaryButton: .cancel(), retryButton = Alert.Button.default(Text("Retry")) { [weak self] in
secondaryButton: .default(Text("Retry")) { [weak self] in if let self {
if let self, let video = video {
self.enqueueVideo(video, play: true, prepending: true, loadDetails: true) self.enqueueVideo(video, play: true, prepending: true, loadDetails: true)
} }
} }
) }
var alert: Alert
if let retryButton {
alert = Alert(
title: Text("Could not load video"),
message: Text(message),
primaryButton: .cancel(),
secondaryButton: retryButton
)
} else {
alert = Alert(title: Text("Could not load video"))
}
navigation.presentAlert(alert) navigation.presentAlert(alert)
advancing = false advancing = false