Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions Wable-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@
DEE5D61A2D91537C009E5A25 /* GameScheduleViewItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEE5D6192D91537C009E5A25 /* GameScheduleViewItem.swift */; };
DEF08E232DDB46170024B33C /* MyProfileEmptyCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF08E222DDB46170024B33C /* MyProfileEmptyCell.swift */; };
DEF08E292DDB73200024B33C /* ProfileEmptyCellItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF08E282DDB73200024B33C /* ProfileEmptyCellItem.swift */; };
DEF148402DA7B586003B2AD8 /* CommunityUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF1483F2DA7B586003B2AD8 /* CommunityUseCase.swift */; };
DEF148422DA7B7E5003B2AD8 /* IsUserRegistered.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF148412DA7B7E5003B2AD8 /* IsUserRegistered.swift */; };
DEF148442DA7B966003B2AD8 /* RegisterResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF148432DA7B966003B2AD8 /* RegisterResult.swift */; };
DEF148542DA7EF7B003B2AD8 /* CommunityRegistration.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEF148532DA7EF7B003B2AD8 /* CommunityRegistration.swift */; };
Expand Down Expand Up @@ -750,7 +749,6 @@
DEE5D6192D91537C009E5A25 /* GameScheduleViewItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameScheduleViewItem.swift; sourceTree = "<group>"; };
DEF08E222DDB46170024B33C /* MyProfileEmptyCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyProfileEmptyCell.swift; sourceTree = "<group>"; };
DEF08E282DDB73200024B33C /* ProfileEmptyCellItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileEmptyCellItem.swift; sourceTree = "<group>"; };
DEF1483F2DA7B586003B2AD8 /* CommunityUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityUseCase.swift; sourceTree = "<group>"; };
DEF148412DA7B7E5003B2AD8 /* IsUserRegistered.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IsUserRegistered.swift; sourceTree = "<group>"; };
DEF148432DA7B966003B2AD8 /* RegisterResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterResult.swift; sourceTree = "<group>"; };
DEF148532DA7EF7B003B2AD8 /* CommunityRegistration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityRegistration.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1493,7 +1491,6 @@
DE0D0CA32DD2012900FB64DC /* UserRole */,
DDED59732D78EFCF00A0BEF1 /* Onboarding */,
DD9EAE202D99C58600803A1A /* Home */,
DDED596E2D78EB9200A0BEF1 /* Community */,
DDED59822D79614E00A0BEF1 /* Overview */,
DDED59812D79612600A0BEF1 /* Notification */,
DDED59802D79611F00A0BEF1 /* Profile */,
Expand All @@ -1519,14 +1516,6 @@
path = Auth;
sourceTree = "<group>";
};
DDED596E2D78EB9200A0BEF1 /* Community */ = {
isa = PBXGroup;
children = (
DEF1483F2DA7B586003B2AD8 /* CommunityUseCase.swift */,
);
path = Community;
sourceTree = "<group>";
};
DDED59732D78EFCF00A0BEF1 /* Onboarding */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2943,7 +2932,6 @@
DD2968182D6DAD0200143851 /* CommunityRepository.swift in Sources */,
DD4AFD472D90264500D56B94 /* OAuthEventManager.swift in Sources */,
DDED59862D7965E900A0BEF1 /* OverviewUseCase.swift in Sources */,
DEF148402DA7B586003B2AD8 /* CommunityUseCase.swift in Sources */,
DE202FF62DE784FB00B04CAA /* AppVersion.swift in Sources */,
DDED597C2D794F0D00A0BEF1 /* FetchUserAuthUseCase.swift in Sources */,
DE7C53102D761E3300076E5D /* String+.swift in Sources */,
Expand Down
39 changes: 19 additions & 20 deletions Wable-iOS/App/AppDelegate+InjectDependency.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,17 @@ extension AppDelegate {

diContainer.register(for: ReportRepository.self) { env in
switch env {
case .mock:
return MockReportRepository()
case .production:
return ReportRepositoryImpl()
case .mock: MockReportRepository()
case .production: ReportRepositoryImpl()
}
}

// MARK: - Viewit

diContainer.register(for: ViewitRepository.self) { env in
switch env {
case .mock:
return MockViewitRepository()
case .production:
return ViewitRepositoryImpl()
case .mock: MockViewitRepository()
case .production: ViewitRepositoryImpl()
}
}

Expand All @@ -45,10 +41,8 @@ extension AppDelegate {

diContainer.register(for: CommentRepository.self) { env in
switch env {
case .mock:
return MockCommentRepository()
case .production:
return CommentRepositoryImpl()
case .mock: MockCommentRepository()
case .production: CommentRepositoryImpl()
}
}
diContainer.register(for: CommentLikedRepository.self, object: CommentLikedRepositoryImpl())
Expand All @@ -72,19 +66,24 @@ extension AppDelegate {

diContainer.register(for: AppVersionRepository.self) { env in
switch env {
case .mock:
return MockAppVersionRepository()
case .production:
return AppVersionRepositoryImpl()
case .mock: MockAppVersionRepository()
case .production: AppVersionRepositoryImpl()
}
}

diContainer.register(for: UpdateAlertPolicyRepository.self) { env in
switch env {
case .mock:
return MockUpdateAlertPolicyRepository()
case .production:
return UpdateAlertPolicyRepositoryImpl()
case .mock: MockUpdateAlertPolicyRepository()
case .production: UpdateAlertPolicyRepositoryImpl()
}
}

// MARK: - Community

diContainer.register(for: CommunityRepository.self) { env in
switch env {
case .mock: MockCommunityRepository()
case .production: CommunityRepositoryImpl()
Comment on lines +76 to +86
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 Switch 문이 한줄만 있어도 줄바꿈을 하는 편이라... 이런 부분은 이야기해보고 맞추면 좋지 않을까 생각이 들어요.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드를 많이 작성하다 보니, 가장 간결한게 최고인 것 같아서 우선 개행하지 않는 편으로 작성하게 되었습니다.
다가오는 토의 시간에 이야기를 해보면 좋을 것 같아요.

}
}
}
Expand Down
40 changes: 38 additions & 2 deletions Wable-iOS/Data/RepositoryImpl/CommunityRepositoryImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class CommunityRepositoryImpl {
}

extension CommunityRepositoryImpl: CommunityRepository {
func updateRegister(communityName: String) -> AnyPublisher<Double, WableError> {
func updateRegistration(communityName: String) -> AnyPublisher<Double, WableError> {
return provider.request(
.updateRegister(
request: DTO.Request.UpdateRegister(
Expand All @@ -39,9 +39,45 @@ extension CommunityRepositoryImpl: CommunityRepository {
.mapWableError()
}

func isUserRegistered() -> AnyPublisher<CommunityRegistration, WableError> {
func checkUserRegistration() -> AnyPublisher<CommunityRegistration, WableError> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

함수 이름이 깔끔해졌네요! 확실히 동사+주어 조합이 깔끔하고 알아보기 쉬운 것 같습니다. 👍

return provider.request(.isUserRegistered, for: DTO.Response.IsUserRegistered.self)
.map(CommunityMapper.toDomain)
.mapWableError()
}
}

struct MockCommunityRepository: CommunityRepository {
private var randomDelay: TimeInterval { Double.random(in: 0.7...1.3) }

func updateRegistration(communityName: String) -> AnyPublisher<Double, WableError> {
return .just(88.0)
.delay(for: .seconds(randomDelay), scheduler: DispatchQueue.main)
.eraseToAnyPublisher()
}

func fetchCommunityList() -> AnyPublisher<[Community], WableError> {
let communityMockData: [Community] = [
Community(team: .t1, registrationRate: 0.91),
Community(team: .gen, registrationRate: 0.88),
Community(team: .hle, registrationRate: 0.72),
Community(team: .dk, registrationRate: 0.79),
Community(team: .kt, registrationRate: 0.65),
Community(team: .ns, registrationRate: 0.54),
Community(team: .drx, registrationRate: 0.49),
Community(team: .bro, registrationRate: 0.37),
Community(team: .bfx, registrationRate: 0.42),
Community(team: .dnf, registrationRate: 0.33)
]

return .just(communityMockData)
.delay(for: .seconds(randomDelay), scheduler: DispatchQueue.main)
.eraseToAnyPublisher()
}

func checkUserRegistration() -> AnyPublisher<CommunityRegistration, WableError> {
let registration = CommunityRegistration(team: nil, hasRegisteredTeam: false)
return .just(registration)
.delay(for: .seconds(randomDelay), scheduler: DispatchQueue.main)
.eraseToAnyPublisher()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Combine
import Foundation

protocol CommunityRepository {
func updateRegister(communityName: String) -> AnyPublisher<Double, WableError>
func updateRegistration(communityName: String) -> AnyPublisher<Double, WableError>
func fetchCommunityList() -> AnyPublisher<[Community], WableError>
func isUserRegistered() -> AnyPublisher<CommunityRegistration, WableError>
func checkUserRegistration() -> AnyPublisher<CommunityRegistration, WableError>
}
71 changes: 0 additions & 71 deletions Wable-iOS/Domain/UseCase/Community/CommunityUseCase.swift

This file was deleted.

Loading