Skip to content

Commit

Permalink
feat/#240 TardyService 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
youz2me committed Jul 19, 2024
1 parent 993b3c8 commit f135a9b
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion KkuMulKum/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
DispatchQueue.main.async {
if success {
print("Auto login successful, showing main screen")
self?.showLoginScreen()
self?.showMainScreen()
} else {
print("Auto login failed, showing login screen")
self?.showLoginScreen()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class ReadyStatusView: BaseView {
collectionViewLayout: UICollectionViewFlowLayout().then {
$0.scrollDirection = .vertical
$0.estimatedItemSize = .init(width: Screen.width(335), height: Screen.height(72))
$0.minimumInteritemSpacing = 10
}).then {
$0.backgroundColor = .clear
$0.isScrollEnabled = false
Expand Down
49 changes: 48 additions & 1 deletion KkuMulKum/Source/Promise/Tardy/Service/TardyService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,57 @@
import Foundation

protocol TardyServiceType {
func getPromiseTardyInfo(with promiseID: Int) -> ResponseBodyDTO<TardyInfoModel>?
func fetchTardyInfo(with promiseID: Int) async throws -> ResponseBodyDTO<TardyInfoModel>?
func updatePromiseCompletion(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>?
}

extension PromiseService: TardyServiceType {
func fetchTardyInfo(with promiseID: Int) async throws -> ResponseBodyDTO<TardyInfoModel>? {
return try await request(
with: .fetchTardyInfo(
promiseID: promiseID
)
)
}

func updatePromiseCompletion(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>? {
return try await request(
with: .updatePromiseCompletion(
promiseID: promiseID
)
)
}
}

final class MockTardyService: TardyServiceType {
func fetchTardyInfo(with promiseID: Int) -> ResponseBodyDTO<TardyInfoModel>? {
let mockData = TardyInfoModel(
penalty: "티라미수 케익 릴스",
isPastDue: true,
lateComers: [Comer(
participantId: 1,
name: "유짐이",
profileImageURL: ""
)]
)

return ResponseBodyDTO<TardyInfoModel>.init(
success: true,
data: mockData,
error: nil
)
}

func updatePromiseCompletion(with promiseID: Int) -> ResponseBodyDTO<EmptyModel>? {
let mockData = EmptyModel()

return ResponseBodyDTO<EmptyModel>.init(
success: true,
data: mockData,
error: nil
)
}

func getPromiseTardyInfo(with promiseID: Int) -> ResponseBodyDTO<TardyInfoModel>? {
let mockData = TardyInfoModel(
penalty: "티라미수 케익 릴스",
Expand Down

0 comments on commit f135a9b

Please sign in to comment.