mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 13:33:42 +00:00
Fix thumbnail view
This commit is contained in:
parent
23b6edfcc5
commit
9f3a94137c
@ -7,13 +7,19 @@ struct ThumbnailView: View {
|
||||
private let thumbnails = ThumbnailsModel.shared
|
||||
|
||||
var body: some View {
|
||||
viewForThumbnailExtension
|
||||
if url != nil {
|
||||
viewForThumbnailExtension
|
||||
}
|
||||
}
|
||||
|
||||
var thumbnailExtension: String? {
|
||||
guard let url else { return nil }
|
||||
let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false)
|
||||
return urlComponents?.path.components(separatedBy: ".").last
|
||||
guard let url,
|
||||
let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) else { return nil }
|
||||
|
||||
let pathComponents = urlComponents.path.components(separatedBy: ".")
|
||||
guard pathComponents.count > 1 else { return nil }
|
||||
|
||||
return pathComponents.last
|
||||
}
|
||||
|
||||
@ViewBuilder var viewForThumbnailExtension: some View {
|
||||
@ -24,7 +30,7 @@ struct ThumbnailView: View {
|
||||
asyncImageIfAvailable
|
||||
}
|
||||
} else {
|
||||
asyncImageIfAvailable
|
||||
webImage
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user