From ce56a7d4a94ecf4b6fb7a224f7555f4891b31155 Mon Sep 17 00:00:00 2001 From: minhokim Date: Wed, 1 Jan 2025 17:52:26 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20Dependency=20openURL=20=EB=A6=AC?= =?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FeatureLogin/Sources/Splash/SplashFeature.swift | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Projects/Feature/FeatureLogin/Sources/Splash/SplashFeature.swift b/Projects/Feature/FeatureLogin/Sources/Splash/SplashFeature.swift index 796e1501..3f3cdcdd 100644 --- a/Projects/Feature/FeatureLogin/Sources/Splash/SplashFeature.swift +++ b/Projects/Feature/FeatureLogin/Sources/Splash/SplashFeature.swift @@ -17,7 +17,9 @@ public struct SplashFeature { /// - Dependency @Dependency(\.continuousClock) var clock - @Dependency(UserDefaultsClient.self) + @Dependency(\.openURL) + var openURL + @Dependency(UserDefaultsClient.self) var userDefaults @Dependency(AuthClient.self) var authClient @@ -213,11 +215,11 @@ private extension SplashFeature { func handleScopeAction(_ action: Action.ScopeAction, state: inout State) -> Effect { switch action { case let .alert(.presented(.앱스토어_이동(trackId))): - if let url = URL(string: "https://apps.apple.com/app/id\(trackId)"), - UIApplication.shared.canOpenURL(url) { - UIApplication.shared.open(url, options: [:], completionHandler: nil) + return .run { _ in + if let url = URL(string: "https://apps.apple.com/app/id\(trackId)") { + await openURL.callAsFunction(url) + } } - return .none case .alert: return .none