From f661533000cbfce80c0d91482625154ed1ef1a41 Mon Sep 17 00:00:00 2001 From: Sangwoo Byeon Date: Sun, 9 Jun 2024 15:54:07 +0900 Subject: [PATCH 1/7] =?UTF-8?q?[Feat]=20#189=20-=20=EC=8B=A0=EA=B3=A0?= =?UTF-8?q?=ED=95=98=EA=B8=B0=20DTO=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DontBe-iOS.xcodeproj/project.pbxproj | 20 +++++++++++++++++++ .../Report/RequestDTO/ReportRequestDTO.swift | 15 ++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 DontBe-iOS/DontBe-iOS/Network/Report/RequestDTO/ReportRequestDTO.swift diff --git a/DontBe-iOS/DontBe-iOS.xcodeproj/project.pbxproj b/DontBe-iOS/DontBe-iOS.xcodeproj/project.pbxproj index abbf3fd1..92f5ca70 100644 --- a/DontBe-iOS/DontBe-iOS.xcodeproj/project.pbxproj +++ b/DontBe-iOS/DontBe-iOS.xcodeproj/project.pbxproj @@ -140,6 +140,7 @@ 3C70BE332B53EF92001AA5A6 /* MyPageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C70BE322B53EF92001AA5A6 /* MyPageViewModel.swift */; }; 3C7741522B5311750069E694 /* MyPageAccountInfoTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C7741512B5311750069E694 /* MyPageAccountInfoTableViewCell.swift */; }; 3C7741542B531AC80069E694 /* AccountInfoDummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C7741532B531AC80069E694 /* AccountInfoDummy.swift */; }; + 3C8CA0962C15744800D6D5C9 /* ReportRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C8CA0952C15744800D6D5C9 /* ReportRequestDTO.swift */; }; 3CA32F532B81E200003DF637 /* MyPageAccountInfoViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CA32F522B81E200003DF637 /* MyPageAccountInfoViewModel.swift */; }; 3CB634CA2B59080E00DB9DA5 /* DontBeTransparencyGrayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CB634C92B59080E00DB9DA5 /* DontBeTransparencyGrayView.swift */; }; 3CBCA3CA2B57212400D348D3 /* MyPageMemberCommentResponseDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CBCA3C92B57212400D348D3 /* MyPageMemberCommentResponseDTO.swift */; }; @@ -301,6 +302,7 @@ 3C70BE322B53EF92001AA5A6 /* MyPageViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageViewModel.swift; sourceTree = ""; }; 3C7741512B5311750069E694 /* MyPageAccountInfoTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageAccountInfoTableViewCell.swift; sourceTree = ""; }; 3C7741532B531AC80069E694 /* AccountInfoDummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountInfoDummy.swift; sourceTree = ""; }; + 3C8CA0952C15744800D6D5C9 /* ReportRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReportRequestDTO.swift; sourceTree = ""; }; 3CA32F522B81E200003DF637 /* MyPageAccountInfoViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageAccountInfoViewModel.swift; sourceTree = ""; }; 3CB634C92B59080E00DB9DA5 /* DontBeTransparencyGrayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DontBeTransparencyGrayView.swift; sourceTree = ""; }; 3CBCA3C92B57212400D348D3 /* MyPageMemberCommentResponseDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageMemberCommentResponseDTO.swift; sourceTree = ""; }; @@ -836,6 +838,7 @@ 2A28453C2B531DAD0023F9B5 /* SocialLogin */, 3C70BE2A2B53EB81001AA5A6 /* MyPage */, 3CF465182B58393800997FCA /* Transparency */, + 3C8CA0932C15741A00D6D5C9 /* Report */, 3C61930E2B3A787000220CEB /* Foundation */, ); path = Network; @@ -1034,6 +1037,22 @@ path = Cells; sourceTree = ""; }; + 3C8CA0932C15741A00D6D5C9 /* Report */ = { + isa = PBXGroup; + children = ( + 3C8CA0942C15742B00D6D5C9 /* RequestDTO */, + ); + path = Report; + sourceTree = ""; + }; + 3C8CA0942C15742B00D6D5C9 /* RequestDTO */ = { + isa = PBXGroup; + children = ( + 3C8CA0952C15744800D6D5C9 /* ReportRequestDTO.swift */, + ); + path = RequestDTO; + sourceTree = ""; + }; 3CBF991F2B549B470015FE4B /* Write */ = { isa = PBXGroup; children = ( @@ -1309,6 +1328,7 @@ 3C61930A2B3A781300220CEB /* ImageLiterals.swift in Sources */, 2A8D70C52B4D8079009F4C6C /* UIViewController+.swift in Sources */, 2A6D54C12B479B4300F9891E /* adjusted+.swift in Sources */, + 3C8CA0962C15744800D6D5C9 /* ReportRequestDTO.swift in Sources */, 2A8D70D12B4DD356009F4C6C /* JoinAgreementViewController.swift in Sources */, 2A0A730C2B541A43004478C1 /* NetworkServiceType.swift in Sources */, 3C2F54522B51224500E7BF01 /* MyPageAccountInfoViewController.swift in Sources */, diff --git a/DontBe-iOS/DontBe-iOS/Network/Report/RequestDTO/ReportRequestDTO.swift b/DontBe-iOS/DontBe-iOS/Network/Report/RequestDTO/ReportRequestDTO.swift new file mode 100644 index 00000000..15e5941d --- /dev/null +++ b/DontBe-iOS/DontBe-iOS/Network/Report/RequestDTO/ReportRequestDTO.swift @@ -0,0 +1,15 @@ +// +// ReportRequestDTO.swift +// DontBe-iOS +// +// Created by 변상우 on 6/9/24. +// + +import Foundation + +// MARK: - ReportRequestDTO + +struct ReportRequestDTO: Encodable { + let reportTargetNickname: String + let relateText: String +} From 922a4a922755b6136eb736ade81c80405aa49acf Mon Sep 17 00:00:00 2001 From: Sangwoo Byeon Date: Sun, 9 Jun 2024 15:54:24 +0900 Subject: [PATCH 2/7] =?UTF-8?q?[Feat]=20#189=20-=20=EC=8B=A0=EA=B3=A0?= =?UTF-8?q?=ED=95=98=EA=B8=B0=20API=20=ED=95=A8=EC=88=98=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/ViewModel/HomeViewModel.swift | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/DontBe-iOS/DontBe-iOS/Presentation/Home/ViewModel/HomeViewModel.swift b/DontBe-iOS/DontBe-iOS/Presentation/Home/ViewModel/HomeViewModel.swift index eb52b718..9b177920 100644 --- a/DontBe-iOS/DontBe-iOS/Presentation/Home/ViewModel/HomeViewModel.swift +++ b/DontBe-iOS/DontBe-iOS/Presentation/Home/ViewModel/HomeViewModel.swift @@ -246,4 +246,24 @@ extension HomeViewModel { return nil } } + + func postReportButtonAPI(reportTargetNickname: String, relateText: String) async throws -> BaseResponse? { + do { + guard let accessToken = KeychainWrapper.loadToken(forKey: "accessToken") else { return nil } + let data: BaseResponse? = try await + self.networkProvider.donNetwork( + type: .post, + baseURL: Config.baseURL + "/report/slack", + accessToken: accessToken, + body: ReportRequestDTO( + reportTargetNickname: reportTargetNickname, + relateText: relateText + ), + pathVariables: ["":""] + ) + return data + } catch { + return nil + } + } } From 022721ca3b7ddd21452c11a0b8eece1fb13a2497 Mon Sep 17 00:00:00 2001 From: Sangwoo Byeon Date: Sun, 9 Jun 2024 15:55:26 +0900 Subject: [PATCH 3/7] =?UTF-8?q?[Feat]=20#189=20-=20=ED=99=88=20=EB=B7=B0?= =?UTF-8?q?=20=EC=8B=A0=EA=B3=A0=ED=95=98=EA=B8=B0=20API=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=97=B0=EA=B2=B0=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewControllers/HomeViewController.swift | 47 +++++++++++++++---- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/DontBe-iOS/DontBe-iOS/Presentation/Home/ViewControllers/HomeViewController.swift b/DontBe-iOS/DontBe-iOS/Presentation/Home/ViewControllers/HomeViewController.swift index 96e7d636..946e1677 100644 --- a/DontBe-iOS/DontBe-iOS/Presentation/Home/ViewControllers/HomeViewController.swift +++ b/DontBe-iOS/DontBe-iOS/Presentation/Home/ViewControllers/HomeViewController.swift @@ -23,9 +23,12 @@ final class HomeViewController: UIViewController { var alarmTriggerdId: Int = 0 var ghostReason: String = "" var hasAppearedBefore = false + var reportTargetNickname: String = "" + var relateText: String = "" var transparentReasonView = DontBePopupReasonView() var deletePostPopupVC = DeletePopupViewController(viewModel: DeletePostViewModel(networkProvider: NetworkService())) + var reportPopupView = DontBePopupView(popupTitle: "신고하시겠어요?", popupContent: "해당 유저 혹은 게시글을 신고하시려면\n신고하기 버튼을 눌러주세요.", leftButtonTitle: "취소", rightButtonTitle: "신고하기") let refreshControl = UIRefreshControl() @@ -166,9 +169,16 @@ extension HomeViewController { } @objc - func warnUser() { + func reportButtonTapped() { popWarnUserBottomsheetView() - showWarnUserSafariView() + + if let window = UIApplication.shared.keyWindowInConnectedScenes { + window.addSubviews(self.reportPopupView) + + self.reportPopupView.snp.makeConstraints { + $0.edges.equalToSuperview() + } + } } func popWarnUserBottomsheetView() { @@ -184,11 +194,6 @@ extension HomeViewController { } } - func showWarnUserSafariView() { - let safariView: SFSafariViewController = SFSafariViewController(url: self.warnUserURL! as URL) - self.present(safariView, animated: true, completion: nil) - } - @objc private func popViewController() { self.navigationController?.popViewController(animated: true) @@ -198,6 +203,7 @@ extension HomeViewController { homeCollectionView.dataSource = self homeCollectionView.delegate = self transparentReasonView.delegate = self + reportPopupView.delegate = self } private func setNotification() { @@ -492,7 +498,9 @@ extension HomeViewController: UICollectionViewDataSource, UICollectionViewDelega cell.KebabButtonAction = { self.warnUserBottomsheetView.showSettings() - self.warnUserBottomsheetView.warnButton.addTarget(self, action: #selector(self.warnUser), for: .touchUpInside) + self.reportTargetNickname = cell.nicknameLabel.text ?? "" + self.relateText = cell.contentTextLabel.text ?? "" + self.warnUserBottomsheetView.warnButton.addTarget(self, action: #selector(self.reportButtonTapped), for: .touchUpInside) } } @@ -686,3 +694,26 @@ extension HomeViewController: DontBePopupReasonDelegate { } } } + +extension HomeViewController: DontBePopupDelegate { + func cancleButtonTapped() { + reportPopupView.removeFromSuperview() + } + + func confirmButtonTapped() { + reportPopupView.removeFromSuperview() + + Task { + do { + if let accessToken = KeychainWrapper.loadToken(forKey: "accessToken") { + let result = try await self.homeViewModel.postReportButtonAPI( + reportTargetNickname: self.reportTargetNickname, + relateText: self.relateText + ) + } + } catch { + print(error) + } + } + } +} From 829437fa94d48aa4e10dc06b632bd62751b7880a Mon Sep 17 00:00:00 2001 From: Sangwoo Byeon Date: Sun, 16 Jun 2024 13:16:50 +0900 Subject: [PATCH 4/7] =?UTF-8?q?[Feat]=20#189=20-=20=EA=B2=8C=EC=8B=9C?= =?UTF-8?q?=EA=B8=80=20=EC=83=81=EC=84=B8=EB=B3=B4=EA=B8=B0=20=EB=B7=B0=20?= =?UTF-8?q?=EC=8B=A0=EA=B3=A0=ED=95=98=EA=B8=B0=20API=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20=EC=97=B0=EA=B2=B0=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PostDetailViewController.swift | 46 +++++++++++++++++-- .../Post/ViewModel/PostDetailViewModel.swift | 20 ++++++++ 2 files changed, 61 insertions(+), 5 deletions(-) diff --git a/DontBe-iOS/DontBe-iOS/Presentation/Post/ViewControllers/PostDetailViewController.swift b/DontBe-iOS/DontBe-iOS/Presentation/Post/ViewControllers/PostDetailViewController.swift index d8c9d7c9..7fdd1a3a 100644 --- a/DontBe-iOS/DontBe-iOS/Presentation/Post/ViewControllers/PostDetailViewController.swift +++ b/DontBe-iOS/DontBe-iOS/Presentation/Post/ViewControllers/PostDetailViewController.swift @@ -53,6 +53,8 @@ final class PostDetailViewController: UIViewController { var userNickName: String = "" var userProfileURL: String = StringLiterals.Network.baseImageURL var contentText: String = "" + var reportTargetNickname: String = "" + var relateText: String = "" // MARK: - UI Components @@ -70,6 +72,8 @@ final class PostDetailViewController: UIViewController { private var deleteToastView: DontBeDeletePopupView? private var photoDetailView: DontBePhotoDetailView? + var reportPopupView = DontBePopupView(popupTitle: "신고하시겠어요?", popupContent: "해당 유저 혹은 게시글을 신고하시려면\n신고하기 버튼을 눌러주세요.", leftButtonTitle: "취소", rightButtonTitle: "신고하기") + // MARK: - Life Cycles override func viewDidLoad() { @@ -175,6 +179,7 @@ extension PostDetailViewController { postReplyCollectionView.dataSource = self postReplyCollectionView.delegate = self transparentReasonView.delegate = self + reportPopupView.delegate = self } private func setAppearNotification() { @@ -352,7 +357,7 @@ extension PostDetailViewController { private func addWarnUserButtonAction() { self.warnBottomsheet.deleteButton.removeFromSuperview() - self.warnBottomsheet.warnButton.addTarget(self, action: #selector(warnUser), for: .touchUpInside) + self.warnBottomsheet.warnButton.addTarget(self, action: #selector(reportButtonTapped), for: .touchUpInside) } @objc @@ -368,10 +373,16 @@ extension PostDetailViewController { } @objc - private func warnUser() { + private func reportButtonTapped() { popWarnView() - let safariView: SFSafariViewController = SFSafariViewController(url: self.warnUserURL! as URL) - self.present(safariView, animated: true, completion: nil) + + if let window = UIApplication.shared.keyWindowInConnectedScenes { + window.addSubviews(self.reportPopupView) + + self.reportPopupView.snp.makeConstraints { + $0.edges.equalToSuperview() + } + } } @objc @@ -793,7 +804,9 @@ extension PostDetailViewController: UICollectionViewDataSource, UICollectionView cell.KebabButtonAction = { self.warnBottomsheet.showSettings() - self.warnBottomsheet.warnButton.addTarget(self, action: #selector(self.warnUser), for: .touchUpInside) + self.reportTargetNickname = cell.nicknameLabel.text ?? "" + self.relateText = cell.contentTextLabel.text ?? "" + self.warnBottomsheet.warnButton.addTarget(self, action: #selector(self.reportButtonTapped), for: .touchUpInside) self.commentId = self.viewModel.postReplyDatas[indexPath.row].commentId } } @@ -1049,3 +1062,26 @@ extension PostDetailViewController: DontBePopupReasonDelegate { } } } + +extension PostDetailViewController: DontBePopupDelegate { + func cancleButtonTapped() { + reportPopupView.removeFromSuperview() + } + + func confirmButtonTapped() { + reportPopupView.removeFromSuperview() + + Task { + do { + if let accessToken = KeychainWrapper.loadToken(forKey: "accessToken") { + let result = try await self.viewModel.postReportButtonAPI( + reportTargetNickname: self.reportTargetNickname, + relateText: self.relateText + ) + } + } catch { + print(error) + } + } + } +} diff --git a/DontBe-iOS/DontBe-iOS/Presentation/Post/ViewModel/PostDetailViewModel.swift b/DontBe-iOS/DontBe-iOS/Presentation/Post/ViewModel/PostDetailViewModel.swift index 02d6367d..586952b5 100644 --- a/DontBe-iOS/DontBe-iOS/Presentation/Post/ViewModel/PostDetailViewModel.swift +++ b/DontBe-iOS/DontBe-iOS/Presentation/Post/ViewModel/PostDetailViewModel.swift @@ -336,4 +336,24 @@ extension PostDetailViewModel { return nil } } + + func postReportButtonAPI(reportTargetNickname: String, relateText: String) async throws -> BaseResponse? { + do { + guard let accessToken = KeychainWrapper.loadToken(forKey: "accessToken") else { return nil } + let data: BaseResponse? = try await + self.networkProvider.donNetwork( + type: .post, + baseURL: Config.baseURL + "/report/slack", + accessToken: accessToken, + body: ReportRequestDTO( + reportTargetNickname: reportTargetNickname, + relateText: relateText + ), + pathVariables: ["":""] + ) + return data + } catch { + return nil + } + } } From 36f9cf616a9104e6e029cd33952a9531e09b8d8e Mon Sep 17 00:00:00 2001 From: Sangwoo Byeon Date: Sun, 16 Jun 2024 13:18:17 +0900 Subject: [PATCH 5/7] =?UTF-8?q?[Feat]=20#189=20-=20=EB=A7=88=EC=9D=B4?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=B7=B0=20=EC=9C=A0=EC=A0=80=20?= =?UTF-8?q?=EC=8B=A0=EA=B3=A0=ED=95=98=EA=B8=B0=20API=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20=EC=97=B0=EA=B2=B0=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyPageViewController.swift | 73 +++++++++++++------ .../MyPage/Views/MyPageView.swift | 1 + 2 files changed, 52 insertions(+), 22 deletions(-) diff --git a/DontBe-iOS/DontBe-iOS/Presentation/MyPage/ViewControllers/MyPageViewController.swift b/DontBe-iOS/DontBe-iOS/Presentation/MyPage/ViewControllers/MyPageViewController.swift index 55f56c9b..cf032306 100644 --- a/DontBe-iOS/DontBe-iOS/Presentation/MyPage/ViewControllers/MyPageViewController.swift +++ b/DontBe-iOS/DontBe-iOS/Presentation/MyPage/ViewControllers/MyPageViewController.swift @@ -37,6 +37,8 @@ final class MyPageViewController: UIViewController { var targetMemberId: Int = 0 var alarmTriggerdId: Int = 0 var ghostReason: String = "" + var reportTargetNickname: String = "" + var relateText: String = "마이페이지 유저 신고" var commentDatas: [MyPageMemberCommentResponseDTO] = [] var contentDatas: [MyPageMemberContentResponseDTO] = [] @@ -209,6 +211,7 @@ extension MyPageViewController { rootView.pageViewController.delegate = self rootView.pageViewController.dataSource = self transparentReasonView.delegate = self + rootView.reportPopupView.delegate = self } private func setNotification() { @@ -593,10 +596,15 @@ extension MyPageViewController { @objc private func warnButtonTapped() { rootView.warnBottomsheet.handleDismiss() - let warnView: SFSafariViewController - if let warnURL = self.warnUserURL { - warnView = SFSafariViewController(url: warnURL) - self.present(warnView, animated: true, completion: nil) + + self.reportTargetNickname = self.rootView.myPageProfileView.userNickname.text ?? "" + + if let window = UIApplication.shared.keyWindowInConnectedScenes { + window.addSubviews(rootView.reportPopupView) + + self.rootView.reportPopupView.snp.makeConstraints { + $0.edges.equalToSuperview() + } } } @@ -766,29 +774,50 @@ extension MyPageViewController: UICollectionViewDelegate { extension MyPageViewController: DontBePopupDelegate { func cancleButtonTapped() { - self.logoutPopupView?.removeFromSuperview() + if logoutPopupView != nil { + self.logoutPopupView?.removeFromSuperview() + } else { + rootView.reportPopupView.removeFromSuperview() + } } func confirmButtonTapped() { - self.logoutPopupView?.removeFromSuperview() - self.rootView.myPageBottomsheet.handleDismiss() - - if let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate { - DispatchQueue.main.async { - let rootViewController = LoginViewController(viewModel: LoginViewModel(networkProvider: NetworkService())) - sceneDelegate.window?.rootViewController = UINavigationController(rootViewController: rootViewController) + if logoutPopupView != nil { + self.logoutPopupView?.removeFromSuperview() + self.rootView.myPageBottomsheet.handleDismiss() + + if let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate { + DispatchQueue.main.async { + let rootViewController = LoginViewController(viewModel: LoginViewModel(networkProvider: NetworkService())) + sceneDelegate.window?.rootViewController = UINavigationController(rootViewController: rootViewController) + } + } + + saveUserData(UserInfo(isSocialLogined: false, + isFirstUser: false, + isJoinedApp: true, + isOnboardingFinished: true, + userNickname: loadUserData()?.userNickname ?? "", + memberId: loadUserData()?.memberId ?? 0, + userProfileImage: loadUserData()?.userProfileImage ?? StringLiterals.Network.baseImageURL)) + + OnboardingViewController.pushCount = 0 + } else { + rootView.reportPopupView.removeFromSuperview() + + Task { + do { + if let accessToken = KeychainWrapper.loadToken(forKey: "accessToken") { + let result = try await self.homeViewModel.postReportButtonAPI( + reportTargetNickname: self.reportTargetNickname, + relateText: self.relateText + ) + } + } catch { + print(error) + } } } - - saveUserData(UserInfo(isSocialLogined: false, - isFirstUser: false, - isJoinedApp: true, - isOnboardingFinished: true, - userNickname: loadUserData()?.userNickname ?? "", - memberId: loadUserData()?.memberId ?? 0, - userProfileImage: loadUserData()?.userProfileImage ?? StringLiterals.Network.baseImageURL)) - - OnboardingViewController.pushCount = 0 } } diff --git a/DontBe-iOS/DontBe-iOS/Presentation/MyPage/Views/MyPageView.swift b/DontBe-iOS/DontBe-iOS/Presentation/MyPage/Views/MyPageView.swift index e1efdfd5..dee6e00f 100644 --- a/DontBe-iOS/DontBe-iOS/Presentation/MyPage/Views/MyPageView.swift +++ b/DontBe-iOS/DontBe-iOS/Presentation/MyPage/Views/MyPageView.swift @@ -82,6 +82,7 @@ final class MyPageView: UIView { var deleteBottomsheet = DontBeBottomSheetView(singleButtonImage: ImageLiterals.Posting.btnDelete) var warnBottomsheet = DontBeBottomSheetView(singleButtonImage: ImageLiterals.Posting.btnWarn) + var reportPopupView = DontBePopupView(popupTitle: "신고하시겠어요?", popupContent: "해당 유저 혹은 게시글을 신고하시려면\n신고하기 버튼을 눌러주세요.", leftButtonTitle: "취소", rightButtonTitle: "신고하기") // MARK: - Life Cycles From d02ac1804b78fc770381d3ca74eab19ebbd26ff8 Mon Sep 17 00:00:00 2001 From: Sangwoo Byeon Date: Sun, 16 Jun 2024 13:45:41 +0900 Subject: [PATCH 6/7] =?UTF-8?q?[Feat]=20#189=20-=20=EB=85=B8=ED=8B=B0?= =?UTF-8?q?=EC=97=90=20=EC=9D=B8=EA=B8=B0=EA=B8=80=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DontBe-iOS/Global/Literals/StringLiterals.swift | 1 + .../Cells/NotificationTableViewCell.swift | 12 +++++++++++- .../Notification/Models/NotificaitonType.swift | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/DontBe-iOS/DontBe-iOS/Global/Literals/StringLiterals.swift b/DontBe-iOS/DontBe-iOS/Global/Literals/StringLiterals.swift index 426cb28f..fbf56d8a 100644 --- a/DontBe-iOS/DontBe-iOS/Global/Literals/StringLiterals.swift +++ b/DontBe-iOS/DontBe-iOS/Global/Literals/StringLiterals.swift @@ -87,6 +87,7 @@ enum StringLiterals { static let commentTransparency = "님, 작성하신 답글로 인해 점점 투명해지고 있어요." static let emptyTitle = "아직 받은 알림이 없어요." static let emptyDescription = "새로운 소식이 도착하면 알려드릴게요." + static let popularWriter = "님이 작성하신 글이 인기글로 선정되었어요. 🥳🥳" } enum MyPage { diff --git a/DontBe-iOS/DontBe-iOS/Presentation/Notification/Cells/NotificationTableViewCell.swift b/DontBe-iOS/DontBe-iOS/Presentation/Notification/Cells/NotificationTableViewCell.swift index 1da26cf0..e077f204 100644 --- a/DontBe-iOS/DontBe-iOS/Presentation/Notification/Cells/NotificationTableViewCell.swift +++ b/DontBe-iOS/DontBe-iOS/Presentation/Notification/Cells/NotificationTableViewCell.swift @@ -25,7 +25,7 @@ final class NotificationTableViewCell: UITableViewCell, UITableViewCellRegistera return profileImage }() - let notificationLabel: UILabel = { + var notificationLabel: UILabel = { let notificationLabel = UILabel() notificationLabel.textColor = .donGray12 notificationLabel.font = .font(.body4) @@ -148,6 +148,16 @@ extension NotificationTableViewCell { text: notificationLabel.text, targetString: list.memberNickname, font: .font(.body3)) + case .popularWriter: + nicknameLabel.text = list.memberNickname + notificationLabel.text = list.memberNickname + " " + list.notificationType.description + notificationLabel.setTextWithLineHeightAndFont( + text: notificationLabel.text, + targetString: list.memberNickname, + font: .font(.body3)) + case .popularContent: + nicknameLabel.text = "어제 가장 인기있었던 글이에요.\n" + notificationLabel.text = "" } minutes.text = list.time.formattedTime() diff --git a/DontBe-iOS/DontBe-iOS/Presentation/Notification/Models/NotificaitonType.swift b/DontBe-iOS/DontBe-iOS/Presentation/Notification/Models/NotificaitonType.swift index 3384426d..981412cd 100644 --- a/DontBe-iOS/DontBe-iOS/Presentation/Notification/Models/NotificaitonType.swift +++ b/DontBe-iOS/DontBe-iOS/Presentation/Notification/Models/NotificaitonType.swift @@ -17,6 +17,8 @@ enum NotificaitonType: String { case contentGhost = "contentGhost" case commentGhost = "commentGhost" case userBan = "userBan" + case popularWriter = "popularWriter" + case popularContent = "popularContent" var description: String { switch self { @@ -36,6 +38,10 @@ enum NotificaitonType: String { return StringLiterals.Notification.commentTransparency case .userBan: return StringLiterals.Notification.violation + case .popularWriter: + return StringLiterals.Notification.popularWriter + case .popularContent: + return StringLiterals.Notification.violation } } } From e625ab450dc33420a4129e9b5e5716117e807e1d Mon Sep 17 00:00:00 2001 From: Sangwoo Byeon Date: Sun, 16 Jun 2024 13:46:28 +0900 Subject: [PATCH 7/7] =?UTF-8?q?[Feat]=20#189=20-=20=EB=85=B8=ED=8B=B0=20?= =?UTF-8?q?=EC=9D=B8=EA=B8=B0=EA=B8=80=20=EB=B7=B0=EC=97=90=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Notification/Models/NotificationList.swift | 4 +++- .../ViewControllers/NotificationViewController.swift | 11 ++++++++++- .../ViewModels/NotificationViewModel.swift | 9 ++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/DontBe-iOS/DontBe-iOS/Presentation/Notification/Models/NotificationList.swift b/DontBe-iOS/DontBe-iOS/Presentation/Notification/Models/NotificationList.swift index 0d858409..3cf16160 100644 --- a/DontBe-iOS/DontBe-iOS/Presentation/Notification/Models/NotificationList.swift +++ b/DontBe-iOS/DontBe-iOS/Presentation/Notification/Models/NotificationList.swift @@ -16,6 +16,7 @@ struct NotificationList { let time: String let notificationId: Int let triggerMemberId: Int + let notificationText: String } extension NotificationList { @@ -26,5 +27,6 @@ extension NotificationList { notificationType: .contentLiked, time: "", notificationId: 0, - triggerMemberId: 0) + triggerMemberId: 0, + notificationText: "") } diff --git a/DontBe-iOS/DontBe-iOS/Presentation/Notification/ViewControllers/NotificationViewController.swift b/DontBe-iOS/DontBe-iOS/Presentation/Notification/ViewControllers/NotificationViewController.swift index 177b1e17..51fed70c 100644 --- a/DontBe-iOS/DontBe-iOS/Presentation/Notification/ViewControllers/NotificationViewController.swift +++ b/DontBe-iOS/DontBe-iOS/Presentation/Notification/ViewControllers/NotificationViewController.swift @@ -198,7 +198,16 @@ extension NotificationViewController: UITableViewDataSource { return cell } else { guard let cell = tableView.dequeueReusableCell(withIdentifier: NotificationTableViewCell.reuseIdentifier, for: indexPath) as? NotificationTableViewCell else { return UITableViewCell() } - cell.configureCell(list: viewModel.notificationLists[indexPath.row]) + if viewModel.notificationLists[indexPath.row].notificationType == .popularContent { + cell.nicknameLabel.text = "어제 가장 인기있었던 글이에요.\n" + cell.notificationLabel.text = "어제 가장 인기있었던 글이에요.\n" + viewModel.notificationLists[indexPath.row].notificationText + cell.notificationLabel.setTextWithLineHeightAndFont( + text: cell.notificationLabel.text, + targetString: "어제 가장 인기있었던 글이에요.", + font: .font(.body3)) + } else { + cell.configureCell(list: viewModel.notificationLists[indexPath.row]) + } cell.selectionStyle = .none let numsOflines = UILabel.lineNumber(label: cell.notificationLabel, labelWidth: 216.adjusted) numsOfLinesOfCellLabel = numsOflines diff --git a/DontBe-iOS/DontBe-iOS/Presentation/Notification/ViewModels/NotificationViewModel.swift b/DontBe-iOS/DontBe-iOS/Presentation/Notification/ViewModels/NotificationViewModel.swift index 09a7a78e..38c456b3 100644 --- a/DontBe-iOS/DontBe-iOS/Presentation/Notification/ViewModels/NotificationViewModel.swift +++ b/DontBe-iOS/DontBe-iOS/Presentation/Notification/ViewModels/NotificationViewModel.swift @@ -49,8 +49,10 @@ final class NotificationViewModel: ViewModelType { triggerMemberProfileUrl: data.triggerMemberProfileUrl, notificationTriggerId: data.notificationTriggerId, notificationType: notificationType, - time: data.time, notificationId: data.notificationId, - triggerMemberId: data.triggerMemberId) + time: data.time, + notificationId: data.notificationId, + triggerMemberId: data.triggerMemberId, + notificationText: data.notificationText) } self.notificationList = myNotiList ?? [] notificationLists.append(contentsOf: notificationList) @@ -76,7 +78,8 @@ final class NotificationViewModel: ViewModelType { notificationType: notificationType, time: data.time, notificationId: data.notificationId, - triggerMemberId: data.triggerMemberId) + triggerMemberId: data.triggerMemberId, + notificationText: data.notificationText) } self.notificationList = myNotiList ?? [] _ = try await self.patchNotificationCheck()