mirror of
https://github.com/yattee/yattee.git
synced 2024-11-10 00:08:21 +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
|
private let thumbnails = ThumbnailsModel.shared
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
if url != nil {
|
||||||
viewForThumbnailExtension
|
viewForThumbnailExtension
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var thumbnailExtension: String? {
|
var thumbnailExtension: String? {
|
||||||
guard let url else { return nil }
|
guard let url,
|
||||||
let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false)
|
let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) else { return nil }
|
||||||
return urlComponents?.path.components(separatedBy: ".").last
|
|
||||||
|
let pathComponents = urlComponents.path.components(separatedBy: ".")
|
||||||
|
guard pathComponents.count > 1 else { return nil }
|
||||||
|
|
||||||
|
return pathComponents.last
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder var viewForThumbnailExtension: some View {
|
@ViewBuilder var viewForThumbnailExtension: some View {
|
||||||
@ -24,7 +30,7 @@ struct ThumbnailView: View {
|
|||||||
asyncImageIfAvailable
|
asyncImageIfAvailable
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
asyncImageIfAvailable
|
webImage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user