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

chore: 신고 삭제 로직 분리 #298

Merged
merged 2 commits into from
Dec 12, 2023
Merged

chore: 신고 삭제 로직 분리 #298

merged 2 commits into from
Dec 12, 2023

Conversation

chopmozzi
Copy link
Collaborator

🧑‍🚀 PR 요약

�authManager에서 memberID가져와 비교해 본인 것이면 삭제, 다른 사람 것이면 신고가 되도록 했습니다.

📸 ScreenShot
default.mov

Linked Issue

close #295

private let defaultPostManagerEndPointFactory: PostManagerEndPointFactory
private let defaultPostEndPointFactory: PostEndPointFactory
private let defaultUserEndPointFactory: UserEndPointFactory

// MARK: - Methods

init(provider: ProviderType = Provider(), defaultPostManagerEndPointFactory: PostManagerEndPointFactory = DefaultPostManagerEndPointFactory(), defaultPostEndPointFactory: PostEndPointFactory = DefaultPostEndPointFactory(), defaultUserEndPointFactory: UserEndPointFactory = DefaultUserEndPointFactory()) {
init(provider: ProviderType = Provider(), authManager: AuthManagerProtocol = AuthManager.shared, defaultPostManagerEndPointFactory: PostManagerEndPointFactory = DefaultPostManagerEndPointFactory(), defaultPostEndPointFactory: PostEndPointFactory = DefaultPostEndPointFactory(), defaultUserEndPointFactory: UserEndPointFactory = DefaultUserEndPointFactory()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

줄바꿈을 하면 좀 더 가독성이 좋아질 것 같습니다.

@@ -16,7 +16,7 @@ final class PlaybackCell: UICollectionViewCell {

weak var delegate: PlaybackViewControllerDelegate?

private var memberID: Int?
private (set) var memberID: Int?
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 값은 Interactor내에서만 관리가 불가능한가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

셀마다 memberID가 바뀌어서요. 셀과 현재 유저의 memberID비교를 위해서는 필요할 것 같네요.

Copy link
Collaborator

@loinsir loinsir Dec 11, 2023

Choose a reason for hiding this comment

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

궁금한 점은 PlaybackCell의 인덱스와 Interactor의 Post가 인덱스 순서 동기화는 전혀 안되는 건가요? 무한스크롤 때문인지

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

안 될건 없...죠? cell의 indexPath와 post index 비교해서 찾으려 하시는 건가용

Copy link
Collaborator

Choose a reason for hiding this comment

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

네 맞아요, view 인만큼 view와 관련이 없는 값들은 view가 몰라야 한다고 생각해서요.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

음 그러면 interactor에서도 셀이랑 포스트들 동기화 시켜서 배열 하나 가지고 있어야겠네용. 한 번 고민해보겠습니다!

Copy link
Collaborator

Choose a reason for hiding this comment

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

넹 그렇게 하셔서 state를 Interactor가 가지게 하면 좋을 것 같습니다. MVVM 패턴에서도 그런 방식으로 ViewModel이 State를 소유하는 구조로 알고 있어서요!

Copy link
Member

Choose a reason for hiding this comment

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

저도 가장 멍청해야할 뷰가 모델을 알고있는 느낌이라
가능하다면 cell 내부보다는 interactor에서 id를 관리하는 것이 좋을 것 같다고 생각되네요 !

@@ -179,7 +179,7 @@ enum PlaybackModels {
}

struct Response {
let parentView: ParentView
let buttonType: ButtonType
Copy link
Collaborator

@loinsir loinsir Dec 11, 2023

Choose a reason for hiding this comment

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

ButtonType의 description을 CustomStringConvertible을 채택하는건 어떨까요

Copy link
Collaborator

@loinsir loinsir left a comment

Choose a reason for hiding this comment

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

고생하셨습니다~~

guard let worker,
let currentCellMemberID: Int = previousCell?.memberID
else { return }
let buttonType: Models.SetSeemoreButton.ButtonType = worker.isMyVideo(currentCellMemberID: currentCellMemberID) ? .delete : .report
Copy link
Member

Choose a reason for hiding this comment

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

👍👍👍

Copy link
Member

@anyukyung anyukyung left a comment

Choose a reason for hiding this comment

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

인환님이 코멘트를 잘 남겨주셔서 딱히 말씀드릴 건 없는 것 같습니다 !!
수고수고링 (새벽에 죄송..)

@anyukyung
Copy link
Member

그리고 제 게시물 신고하지 말아주세요 흑흑

@chopmozzi chopmozzi merged commit b07571e into iOS/dev Dec 12, 2023
1 check passed
@chopmozzi chopmozzi deleted the iOS/chore#295 branch December 12, 2023 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants