Skip to content

Commit

Permalink
[feat] Dependency openURL 리팩토링
Browse files Browse the repository at this point in the history
  • Loading branch information
stealmh committed Jan 4, 2025
1 parent 190e2ae commit ce56a7d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Projects/Feature/FeatureLogin/Sources/Splash/SplashFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -213,11 +215,11 @@ private extension SplashFeature {
func handleScopeAction(_ action: Action.ScopeAction, state: inout State) -> Effect<Action> {
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
Expand Down

0 comments on commit ce56a7d

Please sign in to comment.