25 lines
667 B
Swift
25 lines
667 B
Swift
/// 会话用例。
|
|
public struct SessionUseCase: Sendable {
|
|
private let repository: SessionRepository
|
|
|
|
public init(repository: SessionRepository) {
|
|
self.repository = repository
|
|
}
|
|
|
|
public func observeIsLoggedIn() -> AsyncThrowingStream<Bool, Error> {
|
|
repository.observeIsLoggedIn()
|
|
}
|
|
|
|
public func requestSmsCode(phone: String) async throws {
|
|
try await repository.requestSmsCode(phone: phone)
|
|
}
|
|
|
|
public func login(phone: String, code: String) async throws {
|
|
try await repository.login(phone: phone, code: code)
|
|
}
|
|
|
|
public func logout() async throws {
|
|
try await repository.logout()
|
|
}
|
|
}
|