Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 400dfc8
Merge: d07ca81 fe400d8
Author: Byunghak Ko <[email protected]>
Date:   Wed Nov 23 15:40:17 2022 +0900

    Merge pull request #102 from bengHak/feature/고병학/firebase-chat

    [네트워킹] 파이어베이스 RealtimeDatabase를 활용해서 채팅 기능 구현

commit fe400d8
Author: 고병학 <[email protected]>
Date:   Wed Nov 23 12:29:47 2022 +0900

    [Feat] 애플로그인 entitlements 추가

commit 74481ba
Author: 고병학 <[email protected]>
Date:   Wed Nov 23 12:29:31 2022 +0900

    [Feat] 루트 탭바 DIContainer 작업

commit 491c174
Author: 고병학 <[email protected]>
Date:   Wed Nov 23 12:29:12 2022 +0900

    [Feat] 루트 탭바 코디네이터 적용

commit 686c92b
Author: 고병학 <[email protected]>
Date:   Wed Nov 23 12:28:40 2022 +0900

    [Feat] 채팅방 조회, 생성 use case 구현

commit 329c36c
Author: 고병학 <[email protected]>
Date:   Wed Nov 23 12:28:17 2022 +0900

    [Feat] 채팅방 관련 Repository 구현

commit d0235f2
Author: 고병학 <[email protected]>
Date:   Wed Nov 23 12:27:36 2022 +0900

    [Feat] RealTimeDatabaseService 구현

commit 3a614c3
Merge: 51586db d07ca81
Author: 고병학 <[email protected]>
Date:   Tue Nov 22 14:54:07 2022 +0900

    Merge branch 'develop' into feature/고병학/firebase-chat

commit d07ca81
Merge: 9fccf42 1acc450
Author: Woogie <[email protected]>
Date:   Tue Nov 22 14:48:34 2022 +0900

    Merge pull request #101 from yw22/feature/김영욱/친구목록

    [친구 목록] MVVM-C, Clean Architecture 적용했습니다.

commit 1acc450
Merge: 57d45d3 9fccf42
Author: Woogie <[email protected]>
Date:   Tue Nov 22 14:47:35 2022 +0900

    Merge branch 'develop' into feature/김영욱/친구목록

commit 51586db
Author: 고병학 <[email protected]>
Date:   Tue Nov 22 13:44:19 2022 +0900

    [Refactor] 프로토콜 이름 수정 FirebaseAuthService -> AuthService

    인증서버가 교체할 수 있게 설계 하는게 클린아키텍처를 구현하는 목적에 더 맞다는 팀원들의 합의가 있어서 바꿨다.

commit 9fccf42
Merge: 9bdd9d7 385d0c9
Author: prestonk162 <[email protected]>
Date:   Tue Nov 22 13:11:09 2022 +0900

    Merge pull request #96 from prestonk162/feature/김준영/앱설정

    [앱설정->UseCase] LogoutUseCase, DropoutUseCase 구현

commit 57d45d3
Author: Woogie <[email protected]>
Date:   Tue Nov 22 11:31:40 2022 +0900

    [Feat] 더미데이터 추가, Preview 구현

commit 7461004
Author: Woogie <[email protected]>
Date:   Tue Nov 22 10:18:13 2022 +0900

    [Chore] ChatRoomListUseCase 이름 변경

commit 32fa62a
Author: Woogie <[email protected]>
Date:   Mon Nov 21 18:26:39 2022 +0900

    [Feat] Coordinator, Usecase 작성

commit 385d0c9
Author: prestonk162 <[email protected]>
Date:   Mon Nov 21 18:02:56 2022 +0900

    [Fix] AppSetting SwiftUI 프리뷰로 인한 컴파일 에러 해결

commit 4fac681
Author: prestonk162 <[email protected]>
Date:   Mon Nov 21 17:59:28 2022 +0900

    [Feat] DropOutUseCase 구현

commit a2aa513
Author: prestonk162 <[email protected]>
Date:   Mon Nov 21 17:56:54 2022 +0900

    [Feat] AuthRepository, LogoutUseCase 구현

commit 17962a4
Merge: 36905d2 9bdd9d7
Author: prestonk162 <[email protected]>
Date:   Mon Nov 21 15:50:37 2022 +0900

    Merge branch 'develop' into feature/김준영/앱설정

commit a46b298
Merge: 46649ef 9bdd9d7
Author: Woogie <[email protected]>
Date:   Mon Nov 21 15:46:06 2022 +0900

    Merge branch 'develop' of https://github.com/yw22/iOS06-NearTalk into feature/김영욱/친구목록

commit 46649ef
Author: Woogie <[email protected]>
Date:   Mon Nov 21 15:45:24 2022 +0900

    [Feat] ViewModel, UseCase 작성

commit 9bdd9d7
Merge: 23ff365 ab4f4f1
Author: Byunghak Ko <[email protected]>
Date:   Mon Nov 21 15:43:20 2022 +0900

    Merge pull request #95 from bengHak/fix/byunghak/firebase

    [네트워크] 파이어베이스 추상화

commit ab4f4f1
Author: 고병학 <[email protected]>
Date:   Mon Nov 21 15:39:02 2022 +0900

    [Refactor] 파이어베이스 서비스 추상화 작업

commit efe8b68
Merge: bc09e72 23ff365
Author: Woogie <[email protected]>
Date:   Mon Nov 21 14:29:55 2022 +0900

    Merge branch 'develop' of https://github.com/yw22/iOS06-NearTalk into feature/김영욱/친구목록

commit 25a97ee
Author: 고병학 <[email protected]>
Date:   Sun Nov 20 19:12:03 2022 +0900

    [Refactor] 파이어베이스 서비스 수정

    service, usecase의 역할에 맞게 다시 수정

commit 36905d2
Merge: 5c47df9 23ff365
Author: prestonk162 <[email protected]>
Date:   Sun Nov 20 16:25:27 2022 +0900

    Merge branch 'develop' into feature/김준영/앱설정

commit 5c47df9
Merge: 4b9b655 c46ddca
Author: prestonk162 <[email protected]>
Date:   Fri Nov 18 14:40:52 2022 +0900

    Merge branch 'develop' into feature/김준영/앱설정

commit 4b9b655
Merge: 4e0f907 b00e428
Author: prestonk162 <[email protected]>
Date:   Thu Nov 17 16:10:05 2022 +0900

    Merge branch 'develop' into feature/김준영/앱설정

commit 4e0f907
Merge: f89deae 7a0ab2c
Author: prestonk162 <[email protected]>
Date:   Wed Nov 16 15:22:07 2022 +0900

    Merge branch 'develop' into feature/김준영/앱설정

commit bc09e72
Author: Woogie <[email protected]>
Date:   Wed Nov 16 15:15:29 2022 +0900

    [chore] 그라운드룰 적용

commit f89deae
Merge: cd497ff bae33c2
Author: prestonk162 <[email protected]>
Date:   Tue Nov 15 14:09:25 2022 +0900

    Merge remote-tracking branch 'refs/remotes/upstream/develop'

commit cd497ff
Merge: 2dc0d26 de63899
Author: prestonk162 <[email protected]>
Date:   Tue Nov 15 13:32:09 2022 +0900

    Merge branch 'feature/김준영/앱설정' of https://github.com/prestonk162/iOS06-NearTalk into feature/김준영/앱설정

commit 2dc0d26
Author: prestonk162 <[email protected]>
Date:   Tue Nov 15 13:12:35 2022 +0900

    [Chore] cell identifier 이름 변경 및 if 문 주변 공백라인으로 정리, preview 하나로 통일
  • Loading branch information
EgonD3V committed Nov 23, 2022
1 parent 23ff365 commit e3e1116
Show file tree
Hide file tree
Showing 67 changed files with 2,025 additions and 1,048 deletions.
7 changes: 7 additions & 0 deletions NearTalk/GPSPoints/naver.gpx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<gpx version="1.1" creator="gpxgenerator.com">
<wpt lat="37.3596093566472" lon="127.1056219310272">
<ele>45.90</ele>
<time>2022-11-21T06:20:09Z</time>
</wpt>
</gpx>
198 changes: 147 additions & 51 deletions NearTalk/NearTalk.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

45 changes: 20 additions & 25 deletions NearTalk/NearTalk/Application/Coordinator/AppCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,43 @@ import UIKit
protocol Coordinator: AnyObject {
var navigationController: UINavigationController? { get set }
var parentCoordinator: Coordinator? { get set }
var childCoordinators: [Coordinator] { get set }


func start()
}

final class AppCoordinator: Coordinator {
var parentCoordinator: Coordinator?
var navigationController: UINavigationController?
weak var parentCoordinator: Coordinator?
var childCoordinators: [Coordinator] = []

init(navigationController: UINavigationController) {
self.navigationController = navigationController
}

// func start() {
// guard let navigationController else {
// return
// }
// let launchScreenDIContainer: LaunchScreenDIContainer = .init()
// let childCoordinator: LaunchScreenCoordinator = launchScreenDIContainer.makeLaunchScreenCoordinator(
// navigationController: navigationController,
// dependency: self
// )
// self.childCoordinators.append(childCoordinator)
// childCoordinator.start()
// }

func start() {
let rootTabBarDIContainer: RootTabBarDIContainer = .init()
let childCoordinator: RootTabBarCoordinator = rootTabBarDIContainer.makeTabBarCoordinator()
childCoordinator.navigationController = self.navigationController
self.childCoordinators.append(childCoordinator)
childCoordinator.start()
guard let navigationController else {
return
}
let launchScreenDIContainer: LaunchScreenDIContainer = .init()
let launchScreenCoordinator: LaunchScreenCoordinator = launchScreenDIContainer.makeLaunchScreenCoordinator(
navigationController: navigationController,
dependency: self
)
launchScreenCoordinator.start()
}
}

extension AppCoordinator: LaunchScreenCoordinatorDependency {
func showMainViewController() {
print(#function)
self.navigationController?.popViewController(animated: false)
guard let rootTabBarCoordinator: RootTabBarCoordinator = RootTabBarDIContainer()
.makeTabBarCoordinator(navigationController: self.navigationController) else {
return
}
rootTabBarCoordinator.start()
}

func showLoginViewController() {
print(#function)
self.navigationController?.viewControllers.insert(LoginViewController(), at: 0)
self.navigationController?.popViewController(animated: false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ final class ChatRoomListDIContainer {

// MARK: - Dependencies
struct Dependencies {
let apiDataTransferService: DefaultStorageService
let imageDataTransferService: DefaultStorageService
let apiDataTransferService: StorageService
let imageDataTransferService: StorageService
}

private let dependencies: Dependencies
Expand All @@ -42,15 +42,39 @@ final class ChatRoomListDIContainer {
}

// MARK: - Services
func makeFirestoreService() -> FirestoreService {
return DefaultFirestoreService()
}

func makeDatabaseService() -> RealTimeDatabaseService {
return DefaultRealTimeDatabaseService()
}

func makeAuthService() -> AuthService {
return DefaultFirebaseAuthService()
}

// MARK: - Repository
func makeProfileRepository() -> ProfileRepository {
return DefaultProfileRepository(
firestoreService: makeFirestoreService(),
firebaseAuthService: makeAuthService()
)
}

// MARK: - UseCases
func makeChatRoomListUseCase() -> ChatRoomListUseCase {
return DefaultChatRoomListUseCase(chatRoomListRepository: self.makeRepository())
func makeChatRoomListUseCase() -> FetchChatRoomUseCase {
return DefaultFetchChatRoomUseCase(chatRoomListRepository: self.makeRepository())
}

// MARK: - Repositories
func makeRepository() -> ChatRoomListRepository {
return DefaultChatRoomListRepository(dataTransferService: dependencies.apiDataTransferService)
return DefaultChatRoomListRepository(
dataTransferService: dependencies.apiDataTransferService,
profileRepository: makeProfileRepository(),
databaseService: makeDatabaseService(),
firestoreService: makeFirestoreService()
)
}

// ExampleMVVM에서는 보여줄수 있는 Scene의 뷰컨트롤러와 뷰모델이 존재
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// FriendListDIContainer.swift
// NearTalk
//
// Created by 김영욱 on 2022/11/21.
//

import UIKit

final class FriendListDIContainer {

// MARK: - Dependencies
struct Dependencies {
let firestoreService: FirestoreService
let firebaseAuthService: AuthService
}

private let dependencies: Dependencies

// MARK: - Persistent Storage
init(dependencies: Dependencies) {
self.dependencies = dependencies
}

// MARK: - Services

// MARK: - UseCases
func makeFetchFriendListUseCase() -> FetchFriendListUseCase {
return DefaultFetchFriendListUseCase(profileRepository: self.makeRepository())
}

func makeProfileDetailUseCaseAble() -> ProfileDetailUseCaseAble {
return ProfileDetailUseCase()
}

// MARK: - Repositories
func makeRepository() -> ProfileRepository {
return DefaultProfileRepository(firestoreService: dependencies.firestoreService, firebaseAuthService: dependencies.firebaseAuthService)
}

// MARK: - Friend Lsit
func makeFriendListViewController(actions: FriendListViewModelActions) -> FriendListViewController {
return FriendListViewController.create(with: self.makeFriendListViewModel(actions: actions))
}

func makeFriendListViewModel(actions: FriendListViewModelActions) -> FriendListViewModel {
return DefaultFriendListViewModel(useCase: self.makeFetchFriendListUseCase(), actions: actions)
}

// MARK: - Profile Detail
// func makeProfileDetailViewController() -> ProfileDetailViewController {
// return ProfileDetailViewController(viewModel: makeProfileDetailViewModel())
// }
//
// func makeProfileDetailViewModel() -> ProfileDetailViewModel {
// return ProfileDetailViewModel(profileDetailUseCase: self.makeProfileDetailUseCaseAble(), profileDetailCoordinator: self.makeProfileDetailCoordinator(makeFriendListCoordinator))
// }

// MARK: - Coordinator
func makeFriendListCoordinator(navigationController: UINavigationController) -> FriendListCoordinator {
return FriendListCoordinator(navigationController: navigationController, dependencies: self)
}

// func makeProfileDetailDIContainer() -> ProfileDetailDIContainer {
// let dependencies = ProfileDetailDIContainer.Dependencies()
// return ProfileDetailDICOntainer(dependencies: dependencies)
// }
}

extension FriendListDIContainer: FriendListCoordinatorDependencies {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,32 @@
// Created by 고병학 on 2022/11/13.
//

import Foundation
import UIKit

/// LaunchScreenViewController에 필요한 의존성을 주입해주는 클래스
final class LaunchScreenDIContainer {
// MARK: - Dependencies

// MARK: - Services

func makeAuthService() -> AuthService {
return DefaultFirebaseAuthService()
}

// MARK: - UseCases
func makeLaunchScreenUseCase() -> LaunchScreenUseCase {
return DefaultLaunchScreenUseCase(launchScreenRepository: self.makeRepository())
func makeVerifyUserUseCase() -> VerifyUserUseCase {
return DefaultVerifyUserUseCase(authService: makeAuthService())
}

// MARK: - Repositories
func makeRepository() -> LaunchScreenRepository {
return DefaultLaunchScreenRepository(firebaseAuthService: DefaultFirebaseAuthService())
}

// MARK: - ViewModels
func makeViewModel(actions: LaunchScreenViewModelActions) -> LaunchScreenViewModel {
return DefaultLaunchScreenViewModel(
useCase: self.makeLaunchScreenUseCase(),
actions: actions
)
return DefaultLaunchScreenViewModel(useCase: self.makeVerifyUserUseCase(), actions: actions)
}

// MARK: - Create viewController
func createLaunchScreenViewController(actions: LaunchScreenViewModelActions) -> LaunchScreenViewController {
return LaunchScreenViewController(
viewModel: self.makeViewModel(actions: actions),
repository: self.makeRepository()
)
return LaunchScreenViewController(viewModel: self.makeViewModel(actions: actions))
}

// MARK: - Coordinator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// Created by Preston Kim on 2022/11/15.
//

import Foundation
import UIKit

final class DefaultOnboardingDIContainer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,23 @@
// Created by 고병학 on 2022/11/18.
//

import Foundation
import UIKit

final class RootTabBarDIContainer {
// MARK: - Dependencies

// MARK: - Services
func makeStorageService() -> StorageService {
return DefaultStorageService()
}

func makeFirebaseAuthService() -> AuthService {
return DefaultFirebaseAuthService()
}

func makeFirestoreService() -> FirestoreService {
return DefaultFirestoreService()
}

// MARK: - UseCases
func makeTabBarUseCase() -> TabBarUseCase {
Expand All @@ -26,26 +37,34 @@ final class RootTabBarDIContainer {
func makeViewModel() -> RootTabBarViewModel {
return DefaultRootTabBarViewModel()
}

// MARK: - Create viewController
func createTabBarController() -> RootTabBarController {
let chatRoomListRepository = DefaultChatRoomListRepository(dataTransferService: DefaultStorageService())
let chatRoomListUseCase: ChatRoomListUseCase = DefaultChatRoomListUseCase(chatRoomListRepository: chatRoomListRepository)

let myProfileDIContainer: MyProfileDIContainer = .init()
let myProfileVC: MyProfileViewController = .init(coordinator: myProfileDIContainer.makeMyProfileCoordinator(), viewModel: myProfileDIContainer.makeViewModel())

let dependency: RootTabBarControllerDependency = .init(
mapViewController: MainMapViewController(),
chatRoomListViewController: ChatRoomListViewController.create(with: DefaultChatRoomListViewModel(useCase: chatRoomListUseCase)),
friendListViewController: FriendsListViewController(),
myProfileViewController: myProfileVC
)
func createTabBarController(dependency: RootTabBarControllerDependency) -> RootTabBarController {
return RootTabBarController(viewModel: makeViewModel(), dependency: dependency)
}

// MARK: - Coordinator
func makeTabBarCoordinator() -> RootTabBarCoordinator {
return RootTabBarCoordinator()
func makeTabBarCoordinator(navigationController: UINavigationController?) -> RootTabBarCoordinator? {
let chatRoomListDIContainerDependency: ChatRoomListDIContainer.Dependencies = .init(
apiDataTransferService: self.makeStorageService(),
imageDataTransferService: self.makeStorageService()
)
let chatRoomListDIContainer: ChatRoomListDIContainer = .init(dependencies: chatRoomListDIContainerDependency)
let chatRoomListCoordinator: ChatRoomListCoordinator = chatRoomListDIContainer.makeChatRoomListCoordinator(navigationController: .init())

let friendListDIContainerDependencies: FriendListDIContainer.Dependencies = .init(
firestoreService: self.makeFirestoreService(),
firebaseAuthService: self.makeFirebaseAuthService()
)
let friendListDIContainer: FriendListDIContainer = .init(dependencies: friendListDIContainerDependencies)
let friendListCoordinator: FriendListCoordinator = friendListDIContainer.makeFriendListCoordinator(navigationController: .init())

let dependency: RootTabBarCoordinatorDependency = .init(
mainMapCoordinator: MainMapCoordinator(),
chatRoomListCoordinator: chatRoomListCoordinator,
friendListCoordinator: friendListCoordinator,
myProfileCoordinator: MyProfileCoordinator(navigationController: .init())
)
return RootTabBarCoordinator(navigationController: navigationController, dependency: dependency)
}
}
12 changes: 8 additions & 4 deletions NearTalk/NearTalk/Data/Repositories/ChatRoomListRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ protocol ChatRoomListRepository {
// fireBase 채팅방 목록 가져오기
func fetchChatRoomList() -> Observable<[ChatRoom]>
func fetchUserChatRoomModel() -> Observable<[UserChatRoomModel]>

// coreData 채팅방 목록 가져오기
// func fetchCoreDataChatRoomList() -> Observable<[ChatRoom]>


func createChatRoom(_ chatRoom: ChatRoom) -> Completable
func fetchChatRoomListWithCoordinates(southWest: NCLocation, northEast: NCLocation) -> Single<[ChatRoom]>
func fetchUserChatRoomUUIDList() -> Single<[String]>
func fetchChatRoomInfo(_ chatRoomID: String) -> Single<ChatRoom>
func observeChatRoomInfo(_ chatRoomID: String) -> Observable<ChatRoom>
func fetchUserChatRoomTickets() -> Single<[UserChatRoomTicket]>
func updateUserChatRoomTicket(_ ticket: UserChatRoomTicket) -> Completable
}
24 changes: 24 additions & 0 deletions NearTalk/NearTalk/Data/Repositories/DefaultAuthRepository.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// DefaultAuthRepository.swift
// NearTalk
//
// Created by Preston Kim on 2022/11/21.
//

import RxSwift

final class DefaultAuthRepository: AuthRepository {
private let authService: any AuthService

init(authService: any AuthService) {
self.authService = authService
}

func logout() -> Completable {
return self.authService.logout()
}

func dropout() -> Completable {
return self.authService.deleteCurrentUser()
}
}
Loading

0 comments on commit e3e1116

Please sign in to comment.