From e5261c3fc83f58051f62592ac4f79b56c054c845 Mon Sep 17 00:00:00 2001 From: zeng Date: Fri, 20 Jun 2025 18:46:17 +0800 Subject: [PATCH] =?UTF-8?q?1.1.1=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ThimraTV.xcodeproj/project.pbxproj | 26 +++++- ThimraTV/Base/View/SPFadeEdgeImageView.swift | 85 ++++++------------- .../Class/Home/View/SPHomeHeaderView.swift | 1 + ThimraTV/ThimraTV.entitlements | 2 +- 4 files changed, 50 insertions(+), 64 deletions(-) diff --git a/ThimraTV.xcodeproj/project.pbxproj b/ThimraTV.xcodeproj/project.pbxproj index 5357ab5..896a873 100644 --- a/ThimraTV.xcodeproj/project.pbxproj +++ b/ThimraTV.xcodeproj/project.pbxproj @@ -270,6 +270,19 @@ C3D1CE788CA03A1878493356 /* Pods_ThimraTV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B64805795B479324EB764157 /* Pods_ThimraTV.framework */; }; /* End PBXBuildFile section */ +/* Begin PBXCopyFilesBuildPhase section */ + 1BB9206E2E050B1A00A2C715 /* Embed Foundation Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + ); + name = "Embed Foundation Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 0538826A0638D33FEF3A2E38 /* Pods-ThimraTV.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ThimraTV.debug.xcconfig"; path = "Target Support Files/Pods-ThimraTV/Pods-ThimraTV.debug.xcconfig"; sourceTree = ""; }; 109EB01BE447EE135493CA38 /* Pods-MoviaBox.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MoviaBox.release.xcconfig"; path = "Target Support Files/Pods-MoviaBox/Pods-MoviaBox.release.xcconfig"; sourceTree = ""; }; @@ -582,11 +595,11 @@ isa = PBXGroup; children = ( 1BB91BBD2E04FD6A00A2C715 /* AppDelegate.swift */, + 1BB91BC22E04FD6A00A2C715 /* SceneDelegate.swift */, 1BB91BBE2E04FD6A00A2C715 /* AppDelegate+APNS.swift */, 1BB91BBF2E04FD6A00A2C715 /* AppDelegate+Config.swift */, 1BB91BC02E04FD6A00A2C715 /* AppDelegate+OpenApp.swift */, 1BB91BC12E04FD6A00A2C715 /* AppDelegate+Thirdparty.swift */, - 1BB91BC22E04FD6A00A2C715 /* SceneDelegate.swift */, ); path = AppDelegate; sourceTree = ""; @@ -1442,6 +1455,7 @@ 1DBC40562DA4EDFC0093FCB0 /* Frameworks */, 1DBC40572DA4EDFC0093FCB0 /* Resources */, 4E1CBF3F1205E28DFCF11722 /* [CP] Embed Pods Frameworks */, + 1BB9206E2E050B1A00A2C715 /* Embed Foundation Extensions */, ); buildRules = ( ); @@ -1459,7 +1473,7 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 1620; + LastSwiftUpdateCheck = 1640; LastUpgradeCheck = 1620; TargetAttributes = { 1DBC40582DA4EDFC0093FCB0 = { @@ -1514,10 +1528,14 @@ inputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-ThimraTV/Pods-ThimraTV-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); + inputPaths = ( + ); name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-ThimraTV/Pods-ThimraTV-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); + outputPaths = ( + ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ThimraTV/Pods-ThimraTV-frameworks.sh\"\n"; @@ -1859,7 +1877,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.1.0; + MARKETING_VERSION = 1.1.1; PRODUCT_BUNDLE_IDENTIFIER = com.thimratv.app; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1905,7 +1923,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.1.0; + MARKETING_VERSION = 1.1.1; PRODUCT_BUNDLE_IDENTIFIER = com.thimratv.app; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/ThimraTV/Base/View/SPFadeEdgeImageView.swift b/ThimraTV/Base/View/SPFadeEdgeImageView.swift index 13555dd..73e33f5 100644 --- a/ThimraTV/Base/View/SPFadeEdgeImageView.swift +++ b/ThimraTV/Base/View/SPFadeEdgeImageView.swift @@ -9,78 +9,45 @@ import UIKit class SPFadeEdgeImageView: UIImageView { -// override var image: UIImage? { -// didSet { -// -// if blurredImage != nil, blurredImage == image { -// return -// } -// -//// if let newImage = image?.applyBlur() { -//// self.blurredImage = newImage -//// self.image = newImage -//// } -// -// let context = CIContext(options: nil) -// guard let image = self.image else { return } -// guard let ciImage = CIImage(image: image) else { return } -// -// let filter = CIFilter(name: "CIGaussianBlur") -// filter?.setValue(ciImage, forKey: kCIInputImageKey) -// filter?.setValue(50, forKey: kCIInputRadiusKey) // 调整模糊半径 -// guard let outputImage = filter?.outputImage else { return } -// -// if let cgImage = context.createCGImage(outputImage, from: outputImage.extent) { -// let blurredImage = UIImage(cgImage: cgImage) -// self.blurredImage = blurredImage -// self.image = blurredImage -// } -// -// } -// } private var blurredImage: UIImage? override func layoutSubviews() { super.layoutSubviews() - applyBlurAndEdgeFadeEffect() + + applyCircularFade() } - private func applyBlurAndEdgeFadeEffect() { - - // 2. 创建渐变蒙版(四周虚化) - let maskLayer = CAShapeLayer() + /// 给当前视图添加一个圆形渐隐遮罩 + func applyCircularFade(radius: CGFloat? = nil) { + let maskLayer = CALayer() maskLayer.frame = bounds - // 画一个圆形的反向路径,中心完全显示,四周渐变透明 - let path = UIBezierPath(rect: bounds) - let insetRect = bounds.insetBy(dx: bounds.width * 0.1, dy: bounds.height * 0.1) - let innerPath = UIBezierPath(roundedRect: insetRect, cornerRadius: 20) - path.append(innerPath) - path.usesEvenOddFillRule = true + // 渲染一个径向渐变图像 + UIGraphicsBeginImageContextWithOptions(bounds.size, false, 0) + guard let ctx = UIGraphicsGetCurrentContext() else { return } - maskLayer.path = path.cgPath - maskLayer.fillRule = .evenOdd + let center = CGPoint(x: bounds.midX, y: bounds.midY) + let maxRadius = radius ?? min(bounds.width, bounds.height) / 2 - // 3. 创建径向渐变图层 - let gradientLayer = CAGradientLayer() - gradientLayer.frame = bounds - gradientLayer.colors = [ - UIColor.black.withAlphaComponent(1).cgColor, - UIColor.black.withAlphaComponent(0).cgColor - ] - gradientLayer.startPoint = CGPoint(x: 0.5, y: 0.5) - gradientLayer.endPoint = CGPoint(x: 1.0, y: 1.0) - gradientLayer.locations = [0.5, 1] - gradientLayer.type = .radial + let colorSpace = CGColorSpaceCreateDeviceGray() + let colors: [CGFloat] = [1, 1, 0, 0] // 中心透明度1,边缘透明度0 + let locations: [CGFloat] = [0, 1] - // 4. 添加渐变蒙版到图片 - let containerLayer = CALayer() - containerLayer.frame = bounds - containerLayer.addSublayer(gradientLayer) - containerLayer.mask = maskLayer + if let gradient = CGGradient(colorSpace: colorSpace, colorComponents: colors, locations: locations, count: 2) { + ctx.drawRadialGradient( + gradient, + startCenter: center, startRadius: 0, + endCenter: center, endRadius: maxRadius, + options: .drawsAfterEndLocation + ) + } - self.layer.mask = containerLayer + let maskImage = UIGraphicsGetImageFromCurrentImageContext()?.cgImage + UIGraphicsEndImageContext() + + maskLayer.contents = maskImage + self.layer.mask = maskLayer } } diff --git a/ThimraTV/Class/Home/View/SPHomeHeaderView.swift b/ThimraTV/Class/Home/View/SPHomeHeaderView.swift index d29a740..defde82 100644 --- a/ThimraTV/Class/Home/View/SPHomeHeaderView.swift +++ b/ThimraTV/Class/Home/View/SPHomeHeaderView.swift @@ -85,6 +85,7 @@ class SPHomeHeaderView: UICollectionReusableView { private lazy var bannerBgImageView: SPFadeEdgeImageView = { let imageView = SPFadeEdgeImageView() imageView.contentMode = .scaleAspectFill + imageView.layer.masksToBounds = true return imageView }() diff --git a/ThimraTV/ThimraTV.entitlements b/ThimraTV/ThimraTV.entitlements index 0191ace..0b55f92 100644 --- a/ThimraTV/ThimraTV.entitlements +++ b/ThimraTV/ThimraTV.entitlements @@ -10,8 +10,8 @@ com.apple.developer.associated-domains - applinks:moviaapp.go.link applinks:www.thimratv.com + applinks:moviaapp.go.link keychain-access-groups