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

Fix [#82] 1.1.0버전 최종 QA 반영 #84

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
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: 10 additions & 2 deletions Wable-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@
05AD1EB52CE4C1D900F36D6B /* Dev.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 05AD1EB42CE4C1D900F36D6B /* Dev.xcconfig */; };
05AD1EB72CE4C1F400F36D6B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 05AD1EB62CE4C1F400F36D6B /* GoogleService-Info.plist */; };
05B4F47B2CF483010033FF67 /* HomeLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05B4F47A2CF483010033FF67 /* HomeLoadingView.swift */; };
05B4F47D2CF8BE360033FF67 /* Array+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05B4F47C2CF8BE360033FF67 /* Array+.swift */; };
05B4F47F2CF8C2450033FF67 /* BanRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05B4F47E2CF8C2450033FF67 /* BanRequestDTO.swift */; };
05FBEED22C886A0200E4BF17 /* HomeFeedContentDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05FBEED12C886A0200E4BF17 /* HomeFeedContentDTO.swift */; };
3C35317F2C6F13FF0015A8FA /* Pretendard-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 3C35317C2C6F13FF0015A8FA /* Pretendard-Regular.otf */; };
3C3531802C6F13FF0015A8FA /* Pretendard-SemiBold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 3C35317D2C6F13FF0015A8FA /* Pretendard-SemiBold.otf */; };
Expand Down Expand Up @@ -308,6 +310,8 @@
05AD1EB42CE4C1D900F36D6B /* Dev.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Dev.xcconfig; sourceTree = "<group>"; };
05AD1EB62CE4C1F400F36D6B /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
05B4F47A2CF483010033FF67 /* HomeLoadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeLoadingView.swift; sourceTree = "<group>"; };
05B4F47C2CF8BE360033FF67 /* Array+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+.swift"; sourceTree = "<group>"; };
05B4F47E2CF8C2450033FF67 /* BanRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BanRequestDTO.swift; sourceTree = "<group>"; };
05FBEED12C886A0200E4BF17 /* HomeFeedContentDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeFeedContentDTO.swift; sourceTree = "<group>"; };
3C35317C2C6F13FF0015A8FA /* Pretendard-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-Regular.otf"; sourceTree = "<group>"; };
3C35317D2C6F13FF0015A8FA /* Pretendard-SemiBold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-SemiBold.otf"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -736,6 +740,7 @@
3CDE2DE32C6F292B004A84CB /* Publisher+UIControl.swift */,
050E0CA32C74B35500326EEA /* UIApplication+.swift */,
050E0CA52C74B70800326EEA /* UIButton+.swift */,
05B4F47C2CF8BE360033FF67 /* Array+.swift */,
);
path = Extention;
sourceTree = "<group>";
Expand Down Expand Up @@ -1149,6 +1154,7 @@
3C8B4E542C84081B00174943 /* ReportRequestDTO.swift */,
3C8B4E562C84094100174943 /* PostTransparencyRequestDTO.swift */,
3CD071772C886A600088DED6 /* CommentLikeRequestDTO.swift */,
05B4F47E2CF8C2450033FF67 /* BanRequestDTO.swift */,
);
path = RequestDTO;
sourceTree = "<group>";
Expand Down Expand Up @@ -1761,6 +1767,8 @@
050E0CEA2C74DC4B00326EEA /* MatchProgress.swift in Sources */,
3C8B4E262C78E61B00174943 /* HttpMethod.swift in Sources */,
DE8001B32CF323B100D9DAD9 /* InfoNewsViewController.swift in Sources */,
05B4F47D2CF8BE360033FF67 /* Array+.swift in Sources */,
05B4F47F2CF8C2450033FF67 /* BanRequestDTO.swift in Sources */,
DE8001B62CF3250800D9DAD9 /* NewsCell.swift in Sources */,
DE8001A82CF31ECE00D9DAD9 /* InfoNewsViewModel.swift in Sources */,
050E0CD12C74B9A700326EEA /* WriteViewController.swift in Sources */,
Expand Down Expand Up @@ -1936,7 +1944,7 @@
CODE_SIGN_ENTITLEMENTS = "Wable-iOS/Wable-iOS.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = HGVD26K7DP;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Wable-iOS/Global/Resources/Info.plist";
Expand Down Expand Up @@ -1974,7 +1982,7 @@
CODE_SIGN_ENTITLEMENTS = "Wable-iOS/Wable-iOS.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = HGVD26K7DP;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Wable-iOS/Global/Resources/Info.plist";
Expand Down
31 changes: 18 additions & 13 deletions Wable-iOS/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,30 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
return
}

if isUpdateAvailable {
if self.shouldShowUpdateAlert(currentVersion: AppStoreCheckManager.appVersion ?? "0.0.0", marketingVersion: marketingVersion) {

self.showUpdateAlert(version: marketingVersion)
} else {
print("현재 최신버전입니다.")
print("현재 최신 버전입니다.")
}
}
}
}

private func shouldShowUpdateAlert(currentVersion: String, marketingVersion: String) -> Bool {
let currentComponents = currentVersion.split(separator: ".").map { Int($0) ?? 0 }
let marketingComponents = marketingVersion.split(separator: ".").map { Int($0) ?? 0 }

let currentMajor = currentComponents[safe: 0] ?? 0
let currentMinor = currentComponents[safe: 1] ?? 0
let currentPatch = currentComponents[safe: 2] ?? 0

let marketingMajor = marketingComponents[safe: 0] ?? 0
let marketingMinor = marketingComponents[safe: 1] ?? 0
let marketingPatch = marketingComponents[safe: 2] ?? 0
Comment on lines +94 to +103
Copy link
Collaborator

Choose a reason for hiding this comment

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

nil값을 대체하기 위해 많은 부분에서 기본값으로 0이 선언되어 있는데요.
이렇게 되면, nil일 때의 추적이 어렵고 기본값에 대한 의도치 않는 문제가 발생할 수 있다는 단점이 있을 것 같습니다.
이를 옵셔널 바인딩으로 처리하는 것은 어떨까요?


return currentMajor != marketingMajor || currentMinor != marketingMinor
}

func showUpdateAlert(version: String) {
let alert = UIAlertController(
Expand All @@ -100,21 +116,10 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
AppStoreCheckManager().openAppStore()
}

// 업데이트 액션만 추가
alert.addAction(updateAction)

// 윈도우의 rootViewController에 알림창을 띄웁니다.
if let window = UIApplication.shared.windows.first {
window.rootViewController?.present(alert, animated: true, completion: nil)
}

// let cancelAction = UIAlertAction(title: "나중에", style: .destructive, handler: nil)
//
// [ cancelAction, updateAction ].forEach { alert.addAction($0) }
//
// // 윈도우의 rootViewController에 알림창을 띄웁니다.
// if let window = UIApplication.shared.windows.first {
// window.rootViewController?.present(alert, animated: true, completion: nil)
// }
}
}
14 changes: 14 additions & 0 deletions Wable-iOS/Global/Extention/Array+.swift
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
Copy link
Collaborator

Choose a reason for hiding this comment

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

오, 이렇게 익스텐션으로 구현하신 이유가 궁금하네요.

1 change: 1 addition & 0 deletions Wable-iOS/Global/Literals/StringLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ enum StringLiterals {
static func postReply(contentID: Int) -> String {
return "v3/content/\(contentID)/comment"
}
static let postBan = "v1/report/ban"
}

enum Info {
Expand Down
17 changes: 16 additions & 1 deletion Wable-iOS/Global/Shared/AppStoreCheckManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

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

zip을 사용하셨군요! 👍

반복문 안에서 두 값이 같을 때의 처리는 없는데, 상관없는 부분일까요?


// 길이가 다르면 긴 버전이 더 최신
return currentComponents.count < appStoreComponents.count
}


func openAppStore() {
guard let url = URL(string: AppStoreCheckManager.appStoreOpenUrlString) else { return }
Expand Down
12 changes: 12 additions & 0 deletions Wable-iOS/Network/Home/HomeAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,16 @@ extension HomeAPI {
.unknownError($0.localizedDescription) }
.eraseToAnyPublisher()
}

func postBan(memberID: Int, triggerType: String, triggerID: Int) -> AnyPublisher<EmptyDTO?, WableNetworkError> {
homeProvider.requestPublisher(.postBan(requestBody: BanRequestDTO(memberID: memberID,
triggerType: triggerType,
triggerID: triggerID)))
.tryMap { [weak self] response -> EmptyDTO? in
return try self?.parseResponse(statusCode: response.statusCode, data: response.data)
}
.mapError { $0 as? WableNetworkError ??
.unknownError($0.localizedDescription)}
.eraseToAnyPublisher()
}
}
9 changes: 8 additions & 1 deletion Wable-iOS/Network/Home/HomeRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ enum HomeRouter {
case getContent(param: Int)
case patchFCMToken(param: UserProfileRequestDTO)
case postReply(param: Int, requestBody: WriteReplyRequestV3DTO)
case postBan(requestBody: BanRequestDTO)
}

extension HomeRouter: BaseTargetType {
Expand All @@ -24,6 +25,8 @@ extension HomeRouter: BaseTargetType {
return StringLiterals.Endpoint.Home.patchUserProfile
case .postReply(let contentID, _ ):
return StringLiterals.Endpoint.Home.postReply(contentID: contentID)
case .postBan:
return StringLiterals.Endpoint.Home.postBan
}
}

Expand All @@ -35,6 +38,8 @@ extension HomeRouter: BaseTargetType {
return .patch
case .postReply:
return .post
case .postBan:
return .post
}
}

Expand Down Expand Up @@ -62,12 +67,14 @@ extension HomeRouter: BaseTargetType {
case .postReply(_, let requestBody):
return .requestJSONEncodable(requestBody)

case .postBan(let requestBody):
return .requestJSONEncodable(requestBody)
}
}

var headers: [String : String]? {
switch self {
case .getContent, .postReply:
case .getContent, .postReply, .postBan:
return APIConstants.hasTokenHeader
case .patchFCMToken:
return APIConstants.multipartHeader
Expand Down
20 changes: 20 additions & 0 deletions Wable-iOS/Network/Home/RequestDTO/BanRequestDTO.swift
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
Expand Up @@ -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()
}
Expand All @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -429,8 +433,6 @@ extension FeedDetailViewController: UITextViewDelegate {

@objc
func deletePostButtonTapped() {
nowShowingPopup = "deletePost"

popBottomsheetView()

self.deletePopupView = WablePopupView(popupTitle: StringLiterals.Home.deletePopupTitle,
Expand Down Expand Up @@ -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) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

조건문이 많아서 개행하는 것이 좋아보여요.

viewModel.cursor = lastCommentID
viewModel.paginationDidAction.send(contentId)
print("===================Pagination 작동===================")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,6 @@ extension HomeViewController: UITableViewDelegate, UITableViewDataSource {
cell.grayView.alpha = CGFloat(Double(-memberGhost) / 100)
}

// 탈퇴한 회원 닉네임 텍스트 색상 변경, 프로필로 이동 못하도록 적용
// if self.viewModel.feedDatas[indexPath.row].isDeleted {
// cell.nicknameLabel.textColor = .donGray12
// cell.profileImageView.isUserInteractionEnabled = false
// } else {
// cell.nicknameLabel.textColor = .donBlack
// cell.profileImageView.isUserInteractionEnabled = true
// }

cell.profileButtonAction = {
let memberId = self.viewModel.feedDatas[indexPath.row].memberID

Expand All @@ -446,7 +437,7 @@ extension HomeViewController: UITableViewDelegate, UITableViewDataSource {
}

cell.bottomView.ghostButtonTapped = { [weak self] in
AmplitudeManager.shared.trackEvent(tag: "click_delete_post")
AmplitudeManager.shared.trackEvent(tag: "click_ghost_post")
self?.alarmTriggerType = cell.alarmTriggerType
self?.targetMemberId = cell.targetMemberId
self?.alarmTriggerdId = cell.alarmTriggerdId
Expand Down
Loading