From 438c7c3a011854be85fe0b38db7376a97e09256c Mon Sep 17 00:00:00 2001 From: jeongdung-eo Date: Sat, 23 Mar 2024 16:23:28 +0900 Subject: [PATCH] =?UTF-8?q?[Fix]=20#244=20-=20mypage=20=EB=A1=9C=EC=A7=81?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/ViewControllers/MyPageViewController.swift | 8 -------- .../MyPage/Cells/InfoCollecitonViewCell.swift | 5 ++--- .../Presentation/MyPage/Model/MyPageModel.swift | 3 ++- .../MyPage/ViewControllers/MyPageViewController.swift | 4 +--- .../MyPage/ViewModel/MyPageViewModelImpl.swift | 11 +++++++---- 5 files changed, 12 insertions(+), 19 deletions(-) delete mode 100644 iOS-NOTTODO/iOS-NOTTODO/Presentation/Home/ViewControllers/MyPageViewController.swift diff --git a/iOS-NOTTODO/iOS-NOTTODO/Presentation/Home/ViewControllers/MyPageViewController.swift b/iOS-NOTTODO/iOS-NOTTODO/Presentation/Home/ViewControllers/MyPageViewController.swift deleted file mode 100644 index 546396e4..00000000 --- a/iOS-NOTTODO/iOS-NOTTODO/Presentation/Home/ViewControllers/MyPageViewController.swift +++ /dev/null @@ -1,8 +0,0 @@ -// -// MyPageViewController.swift -// iOS-NOTTODO -// -// Created by JEONGEUN KIM on 3/15/24. -// - -import Foundation diff --git a/iOS-NOTTODO/iOS-NOTTODO/Presentation/MyPage/Cells/InfoCollecitonViewCell.swift b/iOS-NOTTODO/iOS-NOTTODO/Presentation/MyPage/Cells/InfoCollecitonViewCell.swift index d7cd0ad1..d925a8a5 100644 --- a/iOS-NOTTODO/iOS-NOTTODO/Presentation/MyPage/Cells/InfoCollecitonViewCell.swift +++ b/iOS-NOTTODO/iOS-NOTTODO/Presentation/MyPage/Cells/InfoCollecitonViewCell.swift @@ -96,9 +96,8 @@ extension InfoCollectionViewCell { } func configure(with model: MyPageRowData) { - horizontalStackView.removeArrangedSubview(iconImage) - iconImage.removeFromSuperview() + iconImage.isHidden = true titleLabel.text = model.title - arrowImage.isHidden = false + arrowImage.isHidden = model.isArrowHidden } } diff --git a/iOS-NOTTODO/iOS-NOTTODO/Presentation/MyPage/Model/MyPageModel.swift b/iOS-NOTTODO/iOS-NOTTODO/Presentation/MyPage/Model/MyPageModel.swift index 3a6d0fc3..093e53d6 100644 --- a/iOS-NOTTODO/iOS-NOTTODO/Presentation/MyPage/Model/MyPageModel.swift +++ b/iOS-NOTTODO/iOS-NOTTODO/Presentation/MyPage/Model/MyPageModel.swift @@ -58,6 +58,7 @@ struct MyPageRowData: Hashable { var user: String? var email: String? var title: String? + var isArrowHidden: Bool = false static var profile: [MyPageRowData] { let user = UserDefaults.standard.bool(forKey: DefaultKeys.isAppleLogin) ? KeychainUtil.getAppleUsername() : KeychainUtil.getKakaoNickname() @@ -78,6 +79,6 @@ struct MyPageRowData: Hashable { ] static func version() -> [MyPageRowData] { - return [MyPageRowData(title: I18N.version + " " + (Utils.version ?? "1.0.0"))] + return [MyPageRowData(title: I18N.version + " " + (Utils.version ?? "1.0.0"), isArrowHidden: true)] } } diff --git a/iOS-NOTTODO/iOS-NOTTODO/Presentation/MyPage/ViewControllers/MyPageViewController.swift b/iOS-NOTTODO/iOS-NOTTODO/Presentation/MyPage/ViewControllers/MyPageViewController.swift index 444e8e01..318da1f6 100644 --- a/iOS-NOTTODO/iOS-NOTTODO/Presentation/MyPage/ViewControllers/MyPageViewController.swift +++ b/iOS-NOTTODO/iOS-NOTTODO/Presentation/MyPage/ViewControllers/MyPageViewController.swift @@ -101,8 +101,6 @@ extension MyPageViewController { switch section { case .support: cell.configureWithIcon(with: item) - case .info: - cell.configure(with: item) default: cell.configure(with: item) } @@ -118,7 +116,7 @@ extension MyPageViewController { return collectionView.dequeueConfiguredReusableCell(using: profileCellRegistration, for: indexPath, item: item) - case .support, .info, .version: + case .support, .info, .version: return collectionView.dequeueConfiguredReusableCell(using: infoCellRegistration, for: indexPath, item: item) diff --git a/iOS-NOTTODO/iOS-NOTTODO/Presentation/MyPage/ViewModel/MyPageViewModelImpl.swift b/iOS-NOTTODO/iOS-NOTTODO/Presentation/MyPage/ViewModel/MyPageViewModelImpl.swift index 8c57d23c..fa3f29ba 100644 --- a/iOS-NOTTODO/iOS-NOTTODO/Presentation/MyPage/ViewModel/MyPageViewModelImpl.swift +++ b/iOS-NOTTODO/iOS-NOTTODO/Presentation/MyPage/ViewModel/MyPageViewModelImpl.swift @@ -22,7 +22,6 @@ final class MyPageViewModelImpl: MyPageViewModel { func transform(input: MyPageViewModelInput) -> MyPageViewModelOutput { let viewWillAppearSubject = input.viewWillAppearSubject - .map { _ -> MyPageModel in AmplitudeAnalyticsService.shared.send(event: AnalyticsEvent.MyInfo.viewMyInfo) @@ -37,15 +36,15 @@ final class MyPageViewModelImpl: MyPageViewModel { input.myPageCellTapped .sink { [weak self] indexPath in - guard let self else { return } + guard let self = self else { return } guard let section = MyPageModel.Section(rawValue: indexPath.section), indexPath.item < section.events.count else { return } - + guard let coordinator = self.coordinator else { return } self.sendAnalyticsEvent(section.events[indexPath.item]) switch section { case .profile: - self.coordinator?.showMyInfoAccountViewController() + coordinator.showMyInfoAccountViewController() case .support, .info: let url = section.urls[indexPath.item] self.openSafariController.send(url.url) @@ -61,4 +60,8 @@ final class MyPageViewModelImpl: MyPageViewModel { private func sendAnalyticsEvent(_ event: AnalyticsEvent.MyInfo) { AmplitudeAnalyticsService.shared.send(event: event) } + + deinit { + cancelBag.forEach { $0.cancel() } + } }