From e4faeefbea90cd0e172d566ffb0144194fc1b287 Mon Sep 17 00:00:00 2001 From: Kai Date: Mon, 30 Oct 2023 14:06:01 +0800 Subject: [PATCH] Update media view framework, using minor version dependency. --- Planet.xcodeproj/project.pbxproj | 4 ++-- .../xcshareddata/swiftpm/Package.resolved | 4 ++-- PlanetLite/AppContentItemView.swift | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Planet.xcodeproj/project.pbxproj b/Planet.xcodeproj/project.pbxproj index 68072e07..599dcd88 100644 --- a/Planet.xcodeproj/project.pbxproj +++ b/Planet.xcodeproj/project.pbxproj @@ -2370,8 +2370,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/airwolfspace/mediaview"; requirement = { - branch = main; - kind = branch; + kind = upToNextMinorVersion; + minimumVersion = 1.0.0; }; }; 6A2A4D2A2A86422700F4491A /* XCRemoteSwiftPackageReference "WrappingHStack" */ = { diff --git a/Planet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Planet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index f3a48e4c..87d7e3ae 100644 --- a/Planet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Planet.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/airwolfspace/mediaview", "state" : { - "branch" : "main", - "revision" : "b1442b2371bd7c141f86b1331c83358bf1885806" + "revision" : "c64f8e9056203cdde5493ed469b350e14217b053", + "version" : "1.0.0" } }, { diff --git a/PlanetLite/AppContentItemView.swift b/PlanetLite/AppContentItemView.swift index 51f3d1ab..648cee7a 100644 --- a/PlanetLite/AppContentItemView.swift +++ b/PlanetLite/AppContentItemView.swift @@ -88,9 +88,19 @@ struct AppContentItemView: View { private func processAttachments(_ urls: [URL]) { if article.hasVideo { - ASMediaManager.shared.activateVideoView(withVideos: urls, title: article.title, andID: article.id) + DispatchQueue.global(qos: .userInitiated).async { + if let videoThumbnail = self.article.getVideoThumbnail(), !CGSizeEqualToSize(.zero, videoThumbnail.size) { + DispatchQueue.main.async { + ASMediaManager.shared.activateVideoView(withVideos: urls, title: self.article.title, id: self.article.id, defaultSize: videoThumbnail.size) + } + } else { + DispatchQueue.main.async { + ASMediaManager.shared.activateVideoView(withVideos: urls, title: self.article.title, id: self.article.id) + } + } + } } else { - ASMediaManager.shared.activatePhotoView(withPhotos: urls, title: article.title, andID: article.id) + ASMediaManager.shared.activatePhotoView(withPhotos: urls, title: article.title, id: article.id) } }