Skip to content

Commit

Permalink
Merge pull request #335 from OMZigak/refactor/#301-home
Browse files Browse the repository at this point in the history
[refactor] 홈 화면 기능 QA 및 수정된 서버 명세 반영
  • Loading branch information
mmaybei authored Aug 26, 2024
2 parents 34af275 + 0248303 commit d04adba
Show file tree
Hide file tree
Showing 11 changed files with 418 additions and 288 deletions.
23 changes: 12 additions & 11 deletions KkuMulKum.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
A3DD9C402C41BAD000E58A13 /* MeetingListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3DD9C382C41BAD000E58A13 /* MeetingListViewController.swift */; };
A3DD9C412C41BAD000E58A13 /* MeetingListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3DD9C3A2C41BAD000E58A13 /* MeetingListViewModel.swift */; };
A3DD9C682C45C78300E58A13 /* HomeService.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3DD9C672C45C78300E58A13 /* HomeService.swift */; };
A3FB02442C788A790026DE0E /* HomeServiceProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3FB02432C788A790026DE0E /* HomeServiceProtocol.swift */; };
A3FB184D2C3BF45F001483E5 /* MakeMeetingsRequestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3FB184C2C3BF45F001483E5 /* MakeMeetingsRequestModel.swift */; };
A3FB184F2C3BF4BC001483E5 /* MakeMeetingsResponseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3FB184E2C3BF4BB001483E5 /* MakeMeetingsResponseModel.swift */; };
A3FB18512C3BF531001483E5 /* RegisterMeetingsResquestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3FB18502C3BF531001483E5 /* RegisterMeetingsResquestModel.swift */; };
Expand Down Expand Up @@ -127,7 +128,6 @@
DD39768A2C41C2AD00E2A4C4 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3976822C41C2AD00E2A4C4 /* HomeViewController.swift */; };
DD39768C2C41C36B00E2A4C4 /* Color.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DD39768B2C41C36B00E2A4C4 /* Color.xcassets */; };
DD3F9DC62C484DEB008E1FF7 /* PromiseService.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3F9DC52C484DEB008E1FF7 /* PromiseService.swift */; };
DD3F9DCC2C485614008E1FF7 /* HomeServiceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3F9DCB2C485614008E1FF7 /* HomeServiceType.swift */; };
DD3F9DD02C48571A008E1FF7 /* MeetingListServiceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3F9DCF2C48571A008E1FF7 /* MeetingListServiceType.swift */; };
DD3F9DD22C485753008E1FF7 /* UtilService.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3F9DD12C485753008E1FF7 /* UtilService.swift */; };
DD3F9DD42C4858A3008E1FF7 /* UtilTargetType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD3F9DD32C4858A3008E1FF7 /* UtilTargetType.swift */; };
Expand Down Expand Up @@ -307,6 +307,7 @@
A3DD9C382C41BAD000E58A13 /* MeetingListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeetingListViewController.swift; sourceTree = "<group>"; };
A3DD9C3A2C41BAD000E58A13 /* MeetingListViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeetingListViewModel.swift; sourceTree = "<group>"; };
A3DD9C672C45C78300E58A13 /* HomeService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeService.swift; sourceTree = "<group>"; };
A3FB02432C788A790026DE0E /* HomeServiceProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeServiceProtocol.swift; sourceTree = "<group>"; };
A3FB184C2C3BF45F001483E5 /* MakeMeetingsRequestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MakeMeetingsRequestModel.swift; sourceTree = "<group>"; };
A3FB184E2C3BF4BB001483E5 /* MakeMeetingsResponseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MakeMeetingsResponseModel.swift; sourceTree = "<group>"; };
A3FB18502C3BF531001483E5 /* RegisterMeetingsResquestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterMeetingsResquestModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -336,7 +337,6 @@
DD3976822C41C2AD00E2A4C4 /* HomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = "<group>"; };
DD39768B2C41C36B00E2A4C4 /* Color.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Color.xcassets; sourceTree = "<group>"; };
DD3F9DC52C484DEB008E1FF7 /* PromiseService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromiseService.swift; sourceTree = "<group>"; };
DD3F9DCB2C485614008E1FF7 /* HomeServiceType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeServiceType.swift; sourceTree = "<group>"; };
DD3F9DCF2C48571A008E1FF7 /* MeetingListServiceType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingListServiceType.swift; sourceTree = "<group>"; };
DD3F9DD12C485753008E1FF7 /* UtilService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtilService.swift; sourceTree = "<group>"; };
DD3F9DD32C4858A3008E1FF7 /* UtilTargetType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtilTargetType.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -760,6 +760,14 @@
path = Service;
sourceTree = "<group>";
};
A3FB02422C788A520026DE0E /* ServiceProtocol */ = {
isa = PBXGroup;
children = (
A3FB02432C788A790026DE0E /* HomeServiceProtocol.swift */,
);
path = ServiceProtocol;
sourceTree = "<group>";
};
DD1FD02C2C5CC6DE00D0A72C /* View */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -870,7 +878,7 @@
DD3976752C41C2AD00E2A4C4 /* Home */ = {
isa = PBXGroup;
children = (
DD3F9DCA2C485606008E1FF7 /* ServiceType */,
A3FB02422C788A520026DE0E /* ServiceProtocol */,
DD3976762C41C2AD00E2A4C4 /* ViewModel */,
DD3976812C41C2AD00E2A4C4 /* ViewController */,
DD39767C2C41C2AD00E2A4C4 /* View */,
Expand Down Expand Up @@ -949,14 +957,6 @@
path = ViewController;
sourceTree = "<group>";
};
DD3F9DCA2C485606008E1FF7 /* ServiceType */ = {
isa = PBXGroup;
children = (
DD3F9DCB2C485614008E1FF7 /* HomeServiceType.swift */,
);
path = ServiceType;
sourceTree = "<group>";
};
DD3F9DCE2C485700008E1FF7 /* ServiceType */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1834,6 +1834,7 @@
DD30721E2C3C0CC800416D9F /* PromiseInfoResponseModel.swift in Sources */,
DD41BEFF2C41DAA40095A068 /* TardyEmptyView.swift in Sources */,
A3FB18512C3BF531001483E5 /* RegisterMeetingsResquestModel.swift in Sources */,
A3FB02442C788A790026DE0E /* HomeServiceProtocol.swift in Sources */,
DD8626632C4606A300E4F980 /* EnterReadyInfoButtonView.swift in Sources */,
789AD4B32C3C0093002E2688 /* SocialLoginResponseModel.swift in Sources */,
DD43937F2C41357800EC1799 /* InviteCodeViewModel.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ import Foundation

struct NearestPromiseModel: ResponseModelType {
let promiseID, dDay: Int
let name, meetingName, dressUpLevel, date, time, placeName: String
let name, meetingName, dressUpLevel, time, placeName: String

enum CodingKeys: String, CodingKey {
case promiseID = "promiseId"
case dDay
case name
case meetingName
case dressUpLevel
case date
case time
case placeName
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ struct UpcomingPromiseListModel: ResponseModelType {

struct UpcomingPromise: Codable {
let promiseID, dDay: Int
let name, meetingName, dressUpLevel, date, time, placeName: String
let name, meetingName, dressUpLevel, time, placeName: String

enum CodingKeys: String, CodingKey {
case promiseID = "promiseId"
case dDay
case name
case meetingName
case dressUpLevel
case date
case time
case placeName
}
Expand Down
136 changes: 136 additions & 0 deletions KkuMulKum/Network/Service/HomeService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,139 @@ final class HomeService {
}
}
}

extension HomeService: HomeServiceProtocol {
func fetchMyReadyStatus(with promiseID: Int) async throws -> ResponseBodyDTO<MyReadyStatusModel>? {
return try await request(with: .fetchMyReadyStatus(promiseID: promiseID))
}

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

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

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

func fetchLoginUser() async throws -> ResponseBodyDTO<LoginUserModel>? {
return try await request(with: .fetchLoginUser)
}

func fetchNearestPromise() async throws -> ResponseBodyDTO<NearestPromiseModel>? {
return try await request(with: .fetchNearestPromise)
}

func fetchUpcomingPromise() async throws -> ResponseBodyDTO<UpcomingPromiseListModel>? {
return try await request(with: .fetchUpcomingPromise)
}
}

final class MockHomeService: HomeServiceProtocol {
func fetchMyReadyStatus(with promiseID: Int) async throws -> ResponseBodyDTO<MyReadyStatusModel>? {
return nil
}

func updatePreparationStatus(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>? {
return nil
}

func updateDepartureStatus(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>? {
return nil
}

func updateArrivalStatus(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>? {
return nil
}

func fetchLoginUser() async throws -> ResponseBodyDTO<LoginUserModel>? {
let mockData = ResponseBodyDTO<LoginUserModel>(
success: true,
data: LoginUserModel(
userID: 1,
name: "꾸물리안",
level: 4,
promiseCount: 8,
tardyCount: 2,
tardySum: 72,
profileImageURL: ""
),
error: nil
)
return mockData
}

func fetchNearestPromise() async throws -> ResponseBodyDTO<NearestPromiseModel>? {
let mockData = ResponseBodyDTO<NearestPromiseModel>(
success: true,
data: NearestPromiseModel(
promiseID: 1,
dDay: 0,
name: "꾸물이들 대환장 파티",
meetingName: "꾸물이들",
dressUpLevel: "냐미",
time: "PM 8:00",
placeName: "DMC역"
),
error: nil
)
return mockData
}

func fetchUpcomingPromise() async throws -> ResponseBodyDTO<UpcomingPromiseListModel>? {
let mockData = ResponseBodyDTO<UpcomingPromiseListModel>(
success: true,
data: UpcomingPromiseListModel(
promises: [
UpcomingPromise(
promiseID: 1,
dDay: 1,
name: "누가 코코볼 다 먹었어?",
meetingName: "우마우스",
dressUpLevel: "",
time: "PM 2:00",
placeName: "가자하우스"
),
UpcomingPromise(
promiseID: 2,
dDay: 1,
name: "누가 코코볼 다 먹었어?",
meetingName: "우마우스",
dressUpLevel: "",
time: "PM 2:00",
placeName: "가자하우스"
),
UpcomingPromise(
promiseID: 3,
dDay: 1,
name: "누가 코코볼 다 먹었어?",
meetingName: "우마우스",
dressUpLevel: "",
time: "PM 2:00",
placeName: "가자하우스"
),
UpcomingPromise(
promiseID: 4,
dDay: 1,
name: "누가 코코볼 다 먹었어?",
meetingName: "우마우스",
dressUpLevel: "",
time: "PM 2:00",
placeName: "가자하우스"
)
]
),
error: nil
)
return mockData
}
}
22 changes: 22 additions & 0 deletions KkuMulKum/Source/Home/ServiceProtocol/HomeServiceProtocol.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// HomeServiceProtocol.swift
// KkuMulKum
//
// Created by 예삐 on 8/23/24.
//

import Foundation

import Moya

protocol HomeServiceProtocol {
func fetchLoginUser() async throws -> ResponseBodyDTO<LoginUserModel>?

func fetchNearestPromise() async throws -> ResponseBodyDTO<NearestPromiseModel>?
func fetchUpcomingPromise() async throws -> ResponseBodyDTO<UpcomingPromiseListModel>?
func fetchMyReadyStatus(with promiseID: Int) async throws -> ResponseBodyDTO<MyReadyStatusModel>?

func updatePreparationStatus(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>?
func updateDepartureStatus(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>?
func updateArrivalStatus(with promiseID: Int) async throws -> ResponseBodyDTO<EmptyModel>?
}
Loading

0 comments on commit d04adba

Please sign in to comment.