forked from shadowfacts/Tusker
parent
9547bd2913
commit
9ce6bd566f
|
@ -116,12 +116,45 @@ class VideoGalleryContentViewController: UIViewController, GalleryContentViewCon
|
||||||
MainActor.runUnsafely {
|
MainActor.runUnsafely {
|
||||||
if item.status == .readyToPlay {
|
if item.status == .readyToPlay {
|
||||||
self.container?.setGalleryContentLoading(false)
|
self.container?.setGalleryContentLoading(false)
|
||||||
statusObservation = nil
|
self.statusObservation = nil
|
||||||
|
} else if item.status == .failed,
|
||||||
|
let error = item.error {
|
||||||
|
self.container?.setGalleryContentLoading(false)
|
||||||
|
self.showErrorView(error)
|
||||||
|
self.statusObservation = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func showErrorView(_ error: any Error) {
|
||||||
|
let image = UIImageView(image: UIImage(systemName: "exclamationmark.triangle.fill")!)
|
||||||
|
image.tintColor = .secondaryLabel
|
||||||
|
image.contentMode = .scaleAspectFit
|
||||||
|
|
||||||
|
let label = UILabel()
|
||||||
|
label.text = "Error Loading"
|
||||||
|
label.font = .preferredFont(forTextStyle: .title1).withTraits(.traitBold)!
|
||||||
|
label.textColor = .secondaryLabel
|
||||||
|
label.adjustsFontForContentSizeCategory = true
|
||||||
|
|
||||||
|
let stackView = UIStackView(arrangedSubviews: [
|
||||||
|
image,
|
||||||
|
label,
|
||||||
|
])
|
||||||
|
stackView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
stackView.axis = .vertical
|
||||||
|
stackView.alignment = .center
|
||||||
|
stackView.spacing = 8
|
||||||
|
view.addSubview(stackView)
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
image.widthAnchor.constraint(equalToConstant: 64),
|
||||||
|
image.heightAnchor.constraint(equalToConstant: 64),
|
||||||
|
stackView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
|
||||||
|
stackView.centerYAnchor.constraint(equalTo: view.centerYAnchor),
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
@objc private func preferencesChanged() {
|
@objc private func preferencesChanged() {
|
||||||
if isGrayscale != Preferences.shared.grayscaleImages {
|
if isGrayscale != Preferences.shared.grayscaleImages {
|
||||||
let isPlaying = player.rate > 0
|
let isPlaying = player.rate > 0
|
||||||
|
|
Loading…
Reference in New Issue