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
}
let alert = Alert(
title: Text("Could not load video"),
message: Text(message),
primaryButton: .cancel(),
secondaryButton: .default(Text("Retry")) { [weak self] in
if let self, let video = video {
var retryButton: Alert.Button?
if let video {
retryButton = Alert.Button.default(Text("Retry")) { [weak self] in
if let self {
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)
advancing = false