Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

bengHak
Copy link
Collaborator

@bengHak bengHak commented Nov 23, 2022

개요

resolved #2, #80
WIP #5

RealTimeDatabaseService 구현

  • 채팅 메시지 보내기
  • 채팅 메시지 페이지별로 불러오기
  • 새로운 메시지 observing
  • 채팅방 생성하기
  • 채팅방 정보 불러오기
  • 채팅방 정보 observing
  • UserChatRoomTicket 생성
  • UserChatRoomTicket 업데이트
  • UserChatRoomTicket 리스트 불러오기

UserChatRoomTicket 역할

  • 특정 채팅방의 마지막으로 읽은 메시지ID를 갖는다.
  • 특정 채팅방을 마지막으로 읽었을 때 그 채팅방의 메시지 총 개수를 갖는다.
  • 현재 채팅방의 메시지 총 개수와 티켓에 기록된 메시지 카운트 개수를 비교해서 안읽은 메시지를 계산한다.

해당하는 부분에 체크해주세요(x 표시 하면 됩니다)

  • New Feature

설명(Description)

  • ChatRoomListRepository 구현
  • ChatMessageRepository 구현

Screenshot(제작 화면)

  • PR 핵심을 잘 드러내는 screenshot을 업로드 해주세요.

주의사항 및 기타comments

해당 PR과 관련하여 기타, comment 그리고 토의할 내용이 있으면 여기에 적어주고 아니면 여기파트를 비워두세요.

@bengHak bengHak added the feature 기능 구현 label Nov 23, 2022
@bengHak bengHak added this to the SP2 milestone Nov 23, 2022
@bengHak bengHak self-assigned this Nov 23, 2022
@@ -13,9 +13,9 @@ protocol VerifyUserUseCase {
}

final class DefaultVerifyUserUseCase: VerifyUserUseCase {
private let authService: FirebaseAuthService
private let authService: AuthService
Copy link
Collaborator

Choose a reason for hiding this comment

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

제가 AuthService 역할을 위해 AuthRepository 만들었는데, AuthServie가 만들어졌네요. 네이밍 혹은 역할 문제로 AuthRepository 프로토콜을 없앨지 말지 한번 논의가 필요해 보일 것 같네요.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

이 부분은 AuthRepository를 적용하는게 맞네요

let myProfileDIContainer: MyProfileDIContainer = .init()
let myProfileCoordinator: MyProfileCoordinator = myProfileDIContainer.makeMyProfileCoordinator()
self.myProfileCoordinator = myProfileCoordinator
let myProfileVC: MyProfileViewController = .init(coordinator: myProfileCoordinator, viewModel: myProfileDIContainer.makeViewModel())
Copy link
Collaborator

Choose a reason for hiding this comment

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

이부분은 이번에 MyProfile Coordinator와 DIContainer 구조가 바꿔서 수정이 필요할 것 같은데 제가 나중에 수정해서 PR을 올리는 것도 괜찮을것 같습니다.

let chatRoomListViewController: ChatRoomListViewController
let friendListViewController: FriendListViewController
let myProfileViewController: MyProfileViewController
let mainMapNavigationController: UINavigationController
Copy link
Collaborator

Choose a reason for hiding this comment

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

NavigationController로 바꾸니 확실히, Coordinator를 통해 뷰를 동작시키는 것이 편해졌습니다.

@prestonk162
Copy link
Collaborator

바뀐 부분은 제가 작업한 것과 다른 부분이 있는데, 그거는 제가 수정하면 될 것 같습니다. 작업하시느라 수고 많으셨습니다.

@@ -44,4 +55,52 @@ final class DefaultFetchChatRoomUseCase: FetchChatRoomUseCase {
.map { $0.map { DMChatRoomListData(data: $0) } }
}

func newObserveGroupChatList() -> Observable<[GroupChatRoomListData]> {
self.newChatRoom
.map { $0.filter { $0.roomType == "group" } }
Copy link
Member

Choose a reason for hiding this comment

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

string이 아닌 enum으로 관리하시면 어떨까요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

enum으로 관리하시죠

@bengHak bengHak merged commit 400dfc8 into boostcampwm-2022:develop Nov 23, 2022
EgonD3V added a commit that referenced this pull request Nov 24, 2022
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 하나로 통일
EgonD3V added a commit that referenced this pull request Nov 28, 2022
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 하나로 통일
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 기능 구현
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[채팅방] 채팅 송수신
3 participants