-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix [#82] 1.1.0버전 최종 QA 반영 #84
base: develop
Are you sure you want to change the base?
Changes from all commits
1633f34
951833c
332d6b6
50e0a27
8b599d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// Array+.swift | ||
// Wable-iOS | ||
// | ||
// Created by 박윤빈 on 11/29/24. | ||
// | ||
|
||
import Foundation | ||
|
||
extension Array { | ||
subscript(safe index: Int) -> Element? { | ||
return indices.contains(index) ? self[index] : nil | ||
} | ||
} | ||
Comment on lines
+10
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오, 이렇게 익스텐션으로 구현하신 이유가 궁금하네요. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,8 +48,23 @@ final class AppStoreCheckManager { | |
|
||
// 버전 비교 메소드 (문자열 버전을 비교) | ||
private func isNewVersionAvailable(currentVersion: String, appStoreVersion: String) -> Bool { | ||
return appStoreVersion.compare(currentVersion, options: .numeric) == .orderedDescending | ||
// 버전 문자열을 각 자릿수로 분리하여 비교 | ||
let currentComponents = currentVersion.split(separator: ".").map { Int($0) ?? 0 } | ||
let appStoreComponents = appStoreVersion.split(separator: ".").map { Int($0) ?? 0 } | ||
|
||
// 각 자릿수 비교 | ||
for (current, appStore) in zip(currentComponents, appStoreComponents) { | ||
if current < appStore { | ||
return true | ||
} else if current > appStore { | ||
return false | ||
} | ||
} | ||
Comment on lines
+56
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오 반복문 안에서 두 값이 같을 때의 처리는 없는데, 상관없는 부분일까요? |
||
|
||
// 길이가 다르면 긴 버전이 더 최신 | ||
return currentComponents.count < appStoreComponents.count | ||
} | ||
|
||
|
||
func openAppStore() { | ||
guard let url = URL(string: AppStoreCheckManager.appStoreOpenUrlString) else { return } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// BanRequestDTO.swift | ||
// Wable-iOS | ||
// | ||
// Created by 박윤빈 on 11/29/24. | ||
// | ||
|
||
import Foundation | ||
|
||
struct BanRequestDTO: Encodable { | ||
let memberID: Int | ||
let triggerType: String | ||
let triggerID: Int | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case memberID = "memberId" | ||
case triggerType | ||
case triggerID = "triggerId" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -208,7 +208,6 @@ extension FeedDetailViewController { | |
viewModel.replyDatas | ||
.receive(on: DispatchQueue.main) | ||
.sink { [weak self] data in | ||
print("replyDatas🥳🥳🥳") | ||
self?.replyData = data | ||
self?.feedDetailView.feedDetailTableView.reloadData() | ||
} | ||
|
@@ -232,9 +231,13 @@ extension FeedDetailViewController { | |
private func didPullToRefresh() { | ||
print("didPullToRefresh") | ||
self.viewModel.cursor = -1 | ||
self.viewModel.unFlattenReplyDatas.send([]) | ||
self.replyData = [] | ||
self.paginationReplyData = [] | ||
|
||
DispatchQueue.main.async { | ||
self.getAPI() | ||
self.viewModel.viewWillAppear.send(self.viewModel.contentIDSubject.value ?? Int()) | ||
self.viewWillAppear.send(self.viewModel.contentIDSubject.value) | ||
} | ||
self.perform(#selector(finishedRefreshing), with: nil, afterDelay: 0.1) | ||
} | ||
|
@@ -297,6 +300,7 @@ extension FeedDetailViewController { | |
DispatchQueue.main.async { | ||
self.viewModel.cursor = -1 | ||
self.viewModel.viewWillAppear.send(self.viewModel.contentIDSubject.value ?? Int()) | ||
self.replyButtonDidTapSubject.send(nil) | ||
self.makeTextViewEmpty() | ||
self.feedDetailView.bottomWriteView.uploadButton.setImage(ImageLiterals.Button.btnRippleDefault, for: .normal) | ||
} | ||
|
@@ -429,8 +433,6 @@ extension FeedDetailViewController: UITextViewDelegate { | |
|
||
@objc | ||
func deletePostButtonTapped() { | ||
nowShowingPopup = "deletePost" | ||
|
||
popBottomsheetView() | ||
|
||
self.deletePopupView = WablePopupView(popupTitle: StringLiterals.Home.deletePopupTitle, | ||
|
@@ -518,9 +520,10 @@ extension FeedDetailViewController: UITableViewDataSource { | |
|
||
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) { | ||
if scrollView == feedDetailView.feedDetailTableView { | ||
let lastCommentID = self.replyData.last?.commentID ?? Int() | ||
let unFlattenDatas = viewModel.unFlattenReplyDatas.value | ||
let lastCommentID = unFlattenDatas.last?.commentID ?? -1 | ||
|
||
if replyData.count % 15 == 0 && viewModel.cursor != lastCommentID && (scrollView.contentOffset.y + scrollView.frame.size.height) >= (scrollView.contentSize.height) { | ||
if unFlattenDatas.count % 10 == 0 && viewModel.cursor != lastCommentID && (scrollView.contentOffset.y + scrollView.frame.size.height) >= (scrollView.contentSize.height) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 조건문이 많아서 개행하는 것이 좋아보여요. |
||
viewModel.cursor = lastCommentID | ||
viewModel.paginationDidAction.send(contentId) | ||
print("===================Pagination 작동===================") | ||
|
@@ -567,7 +570,7 @@ extension FeedDetailViewController: UITableViewDataSource { | |
cell.bottomView.ghostButton.isHidden = isMine | ||
cell.menuButtonTapped = { [weak self] in | ||
guard let self else { return } | ||
setBottomSheetButton(isMine: isMine, isAdmin: isAdmin ?? false) | ||
setBottomSheetButton(index: indexPath.row, isMine: isMine, isAdmin: isAdmin ?? false, isReply: false) | ||
} | ||
|
||
var memberGhost = getFeedData?.memberGhost | ||
|
@@ -665,7 +668,7 @@ extension FeedDetailViewController: UITableViewDataSource { | |
cell.bottomView.ghostButton.isHidden = isMine | ||
cell.menuButtonTapped = { [weak self] in | ||
guard let self else { return } | ||
setBottomSheetButton(isMine: isMine, isAdmin: isAdmin ?? false) | ||
setBottomSheetButton(index: indexPath.row, isMine: isMine, isAdmin: isAdmin ?? false, isReply: true) | ||
} | ||
|
||
var memberGhost = self.replyData[indexPath.row].memberGhost | ||
|
@@ -716,6 +719,7 @@ extension FeedDetailViewController: UITableViewDataSource { | |
} | ||
|
||
cell.bottomView.replyButtonTapped = { [weak self] in | ||
AmplitudeManager.shared.trackEvent(tag: "click_write_comment") | ||
self?.feedDetailView.bottomWriteView.writeTextView.resignFirstResponder() | ||
self?.feedDetailView.bottomWriteView.writeTextView.becomeFirstResponder() | ||
self?.replyButtonDidTapSubject.send(indexPath.row) | ||
|
@@ -726,7 +730,8 @@ extension FeedDetailViewController: UITableViewDataSource { | |
} | ||
} | ||
|
||
private func setBottomSheetButton(isMine: Bool, isAdmin: Bool) { | ||
private func setBottomSheetButton(index: Int, isMine: Bool, isAdmin: Bool, isReply: Bool) { | ||
self.commentId = isReply ? self.replyData[index].commentID : commentId | ||
let bottomSheetHeight = isAdmin ? 178.adjusted : 122.adjusted | ||
homeBottomsheetView.bottomsheetView.snp.remakeConstraints { | ||
$0.height.equalTo(bottomSheetHeight) | ||
|
@@ -735,22 +740,23 @@ extension FeedDetailViewController: UITableViewDataSource { | |
homeBottomsheetView.deleteButton.isHidden = !isMine | ||
homeBottomsheetView.reportButton.isHidden = isMine | ||
homeBottomsheetView.banButton.isHidden = !isAdmin | ||
|
||
configureButtonActions(isMine: isMine) | ||
configureButtonActions(isMine: isMine, isReply: isReply) | ||
if isAdmin { | ||
self.homeBottomsheetView.banButton.addTarget(self, action: #selector(banButtonTapped), for: .touchUpInside) | ||
} | ||
} | ||
|
||
private func configureButtonActions(isMine: Bool) { | ||
private func configureButtonActions(isMine: Bool, isReply: Bool) { | ||
if isMine { | ||
setupDeleteButtonAction() | ||
setupDeleteButtonAction(isReply: isReply) | ||
} else { | ||
setupReportButtonAction() | ||
} | ||
} | ||
|
||
private func setupDeleteButtonAction() { | ||
private func setupDeleteButtonAction(isReply: Bool) { | ||
nowShowingPopup = isReply ? "deleteReply" : "deletePost" | ||
homeBottomsheetView.deleteButton.addTarget(self, action: #selector(deletePostButtonTapped), for: .touchUpInside) | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nil
값을 대체하기 위해 많은 부분에서 기본값으로0
이 선언되어 있는데요.이렇게 되면,
nil
일 때의 추적이 어렵고 기본값에 대한 의도치 않는 문제가 발생할 수 있다는 단점이 있을 것 같습니다.이를 옵셔널 바인딩으로 처리하는 것은 어떨까요?