-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c952902
commit 37b0be8
Showing
23 changed files
with
529 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
attendance-ios/Source/New/Dependency/UseCase/ConfigDependency.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// ConfigDependency.swift | ||
// attendance-ios | ||
// | ||
// Created by 이호영 on 2023/10/25. | ||
// | ||
|
||
import Foundation | ||
|
||
import ComposableArchitecture | ||
|
||
struct ConfigDependency { | ||
var remoteConfig: ConfigUseCase | ||
} | ||
|
||
extension ConfigDependency: DependencyKey { | ||
|
||
static let liveValue = Self( | ||
remoteConfig: ConfigUseCase() | ||
) | ||
|
||
static let testValue = Self( | ||
remoteConfig: unimplemented("SessionInfoDependency.sessionInfo") | ||
) | ||
} | ||
|
||
extension DependencyValues { | ||
var config: ConfigDependency { | ||
get { self[ConfigDependency.self] } | ||
set { self[ConfigDependency.self] = newValue } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// ConfigUseCase.swift | ||
// attendance-ios | ||
// | ||
// Created by 이호영 on 2023/10/25. | ||
// | ||
|
||
import Foundation | ||
|
||
import ComposableArchitecture | ||
|
||
final class ConfigUseCase { | ||
|
||
@Dependency(\.remoteConfig.remoteConfig) var remoteConfig | ||
|
||
init() { } | ||
|
||
func getSessionPassword() async throws -> String { | ||
return try await withCheckedThrowingContinuation { continuation in | ||
remoteConfig.decodeSessionPassword { result in | ||
switch result { | ||
case let .success(code): | ||
continuation.resume(returning: code) | ||
case let .failure(error): | ||
continuation.resume(throwing: error) | ||
} | ||
} | ||
} | ||
} | ||
|
||
func getSignUpPassword() async throws -> String { | ||
return try await withCheckedThrowingContinuation { continuation in | ||
remoteConfig.decodeSignUpPassword { result in | ||
switch result { | ||
case let .success(code): | ||
continuation.resume(returning: code) | ||
case let .failure(error): | ||
continuation.resume(throwing: error) | ||
} | ||
} | ||
} | ||
} | ||
|
||
func shouldShowGuestButton() async throws -> Bool { | ||
return try await withCheckedThrowingContinuation { continuation in | ||
remoteConfig.decodeShouldShowGuestButton { result in | ||
switch result { | ||
case let .success(isShow): | ||
continuation.resume(returning: isShow) | ||
case let .failure(error): | ||
continuation.resume(throwing: error) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.