From c7eb069587c055d5c1ca1f79b2ccb19b75052e26 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 15 Apr 2023 20:32:18 +0900 Subject: [PATCH 001/468] =?UTF-8?q?[ADD]=20DetailWaitView=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC=20UIView=20=EC=83=9D=EC=84=B1=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 12 ++++++++++++ .../Screens/Detail-Wait/View/DetailWaitView.swift | 8 ++++++++ 2 files changed, 20 insertions(+) create mode 100644 Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index bd8869f87..0c4fe1a8a 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 333BF669285864CE0039F77F /* MemoryViewController.swift */; }; 33BDF5622856E03800564211 /* FriendListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33BDF5612856E03800564211 /* FriendListViewController.swift */; }; 39018F4228C4708A00C78DBA /* UIButton+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */; }; + 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391612D729E9231B004AE982 /* DetailWaitView.swift */; }; 391B3003286198C200421F1D /* Size.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391B3002286198C200421F1D /* Size.swift */; }; 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392EC77D2855C388006918A9 /* SettingButton.swift */; }; 392EC7812855D17D006918A9 /* DetailWaitTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392EC7802855D17D006918A9 /* DetailWaitTitleView.swift */; }; @@ -171,6 +172,7 @@ 333BF669285864CE0039F77F /* MemoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryViewController.swift; sourceTree = ""; }; 33BDF5612856E03800564211 /* FriendListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendListViewController.swift; sourceTree = ""; }; 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+Extension.swift"; sourceTree = ""; }; + 391612D729E9231B004AE982 /* DetailWaitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitView.swift; sourceTree = ""; }; 391B3002286198C200421F1D /* Size.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Size.swift; sourceTree = ""; }; 392EC77D2855C388006918A9 /* SettingButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingButton.swift; sourceTree = ""; }; 392EC7802855D17D006918A9 /* DetailWaitTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitTitleView.swift; sourceTree = ""; }; @@ -349,6 +351,14 @@ path = Cell; sourceTree = ""; }; + 391612D629E92308004AE982 /* View */ = { + isa = PBXGroup; + children = ( + 391612D729E9231B004AE982 /* DetailWaitView.swift */, + ); + path = View; + sourceTree = ""; + }; 392EC77F2855D107006918A9 /* UIComponent */ = { isa = PBXGroup; children = ( @@ -652,6 +662,7 @@ B5F524E828519B2F00614FF7 /* Detail-Wait */ = { isa = PBXGroup; children = ( + 391612D629E92308004AE982 /* View */, 392EC77F2855D107006918A9 /* UIComponent */, B5F525092851A06700614FF7 /* DetailWaitViewController.swift */, 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */, @@ -1124,6 +1135,7 @@ B50B1B44285B146A0080992C /* ManittoCollectionViewCell.swift in Sources */, B5F5253128545E4C00614FF7 /* BackButton.swift in Sources */, 39C957D628799AB900A04A2B /* HTTPMethod.swift in Sources */, + 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */, B5F525392854871E00614FF7 /* BottomOfSendLetterView.swift in Sources */, B5F525202851A21D00614FF7 /* UIViewController+Extension.swift in Sources */, 7ED845BA2876BE530075AC61 /* SettingViewTableCell.swift in Sources */, diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift new file mode 100644 index 000000000..204a926ab --- /dev/null +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -0,0 +1,8 @@ +// +// DetailWaitView.swift +// Manito +// +// Created by Mingwan Choi on 2023/04/14. +// + +import Foundation From 9a119bc917ddd10f6fd6e5f12f0845b2be03930e Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 15 Apr 2023 20:32:38 +0900 Subject: [PATCH 002/468] =?UTF-8?q?[CHORE]=20canStart=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Network/Models/Room.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Network/Models/Room.swift b/Manito/Manito/Network/Models/Room.swift index c527cdb24..ad8f1e7e8 100644 --- a/Manito/Manito/Network/Models/Room.swift +++ b/Manito/Manito/Network/Models/Room.swift @@ -41,9 +41,10 @@ struct Room: Decodable { var canStart: Bool { if let count = participants?.count, - let date = roomInformation?.startDate?.stringToDate { + let date = roomInformation?.startDate?.stringToDate, + let isAdmin = admin { let isMinimumUserCount = count >= 4 - return isMinimumUserCount && date.isToday + return isMinimumUserCount && date.isToday && isAdmin } else { return false } From 12b210926f636de7e9490c47c9db40acf6771c36 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 15 Apr 2023 20:35:34 +0900 Subject: [PATCH 003/468] =?UTF-8?q?[CHORE]=20view=20=EB=B6=84=EB=A6=AC=20(?= =?UTF-8?q?#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 712 +++++++++--------- .../Detail-Wait/View/DetailWaitView.swift | 281 ++++++- 2 files changed, 644 insertions(+), 349 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index ab58a23d5..29c2b08cb 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -11,117 +11,119 @@ import SnapKit final class DetailWaitViewController: BaseViewController { - private enum UserStatus: CaseIterable { - case owner - case member - - var alertText: (title: String, - message: String, - okTitle: String) { - switch self { - case .owner: - return (title: TextLiteral.datailWaitViewControllerDeleteTitle, - message: TextLiteral.datailWaitViewControllerDeleteMessage, - okTitle: TextLiteral.delete) - case .member: - return (title: TextLiteral.datailWaitViewControllerExitTitle, - message: TextLiteral.datailWaitViewControllerExitMessage, - okTitle: TextLiteral.leave) - } - } - } - - private enum ButtonText: String { - case waiting - case start - - var status: String { - switch self { - case .waiting: - return TextLiteral.datailWaitViewControllerButtonWaitingText - case .start: - return TextLiteral.datailWaitViewControllerButtonStartText - } - } - } +// private enum UserStatus: CaseIterable { +// case owner +// case member +// +// var alertText: (title: String, +// message: String, +// okTitle: String) { +// switch self { +// case .owner: +// return (title: TextLiteral.datailWaitViewControllerDeleteTitle, +// message: TextLiteral.datailWaitViewControllerDeleteMessage, +// okTitle: TextLiteral.delete) +// case .member: +// return (title: TextLiteral.datailWaitViewControllerExitTitle, +// message: TextLiteral.datailWaitViewControllerExitMessage, +// okTitle: TextLiteral.leave) +// } +// } +// } +// +// private enum ButtonText: String { +// case waiting +// case start +// +// var status: String { +// switch self { +// case .waiting: +// return TextLiteral.datailWaitViewControllerButtonWaitingText +// case .start: +// return TextLiteral.datailWaitViewControllerButtonStartText +// } +// } +// } // MARK: - ui component + + private let detailWaitView = DetailWaitView() - private let moreButton: UIButton = { - let button = MoreButton() - button.showsMenuAsPrimaryAction = true - return button - }() - private let titleView: DetailWaitTitleView = DetailWaitTitleView() - private let togetherFriendLabel: UILabel = { - let label = UILabel() - label.text = TextLiteral.togetherFriend - label.textColor = .white - label.font = .font(.regular, ofSize: 16) - return label - }() - private let imgNiView: UIImageView = { - let imageView = UIImageView() - imageView.image = ImageLiterals.imgNi - return imageView - }() - private let userCountLabel: UILabel = { - let label = UILabel() - label.textColor = .white - label.font = .font(.regular, ofSize: 14) - return label - }() - private let copyButton: UIButton = { - let button = UIButton(type: .system) - button.setTitle(TextLiteral.copyCode, for: .normal) - button.setTitleColor(.subBlue, for: .normal) - button.titleLabel?.font = .font(.regular, ofSize: 16) - return button - }() - private let listTableView: UITableView = { - let tableView = UITableView() - tableView.layer.cornerRadius = 10 - tableView.isScrollEnabled = false - tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") - return tableView - }() - private lazy var startButton: UIButton = { - let button = MainButton() - self.detectStartableStatus = { value in - if value { - button.title = ButtonText.start.status - button.isDisabled = false - let action = UIAction { [weak self] _ in - self?.requestStartManitto() - } - button.addAction(action, for: .touchUpInside) - } else { - button.title = ButtonText.waiting.status - button.isDisabled = true - } - } - return button - }() +// private let moreButton: UIButton = { +// let button = MoreButton() +// button.showsMenuAsPrimaryAction = true +// return button +// }() +// private let titleView: DetailWaitTitleView = DetailWaitTitleView() +// private let togetherFriendLabel: UILabel = { +// let label = UILabel() +// label.text = TextLiteral.togetherFriend +// label.textColor = .white +// label.font = .font(.regular, ofSize: 16) +// return label +// }() +// private let imgNiView: UIImageView = { +// let imageView = UIImageView() +// imageView.image = ImageLiterals.imgNi +// return imageView +// }() +// private let userCountLabel: UILabel = { +// let label = UILabel() +// label.textColor = .white +// label.font = .font(.regular, ofSize: 14) +// return label +// }() +// private let copyButton: UIButton = { +// let button = UIButton(type: .system) +// button.setTitle(TextLiteral.copyCode, for: .normal) +// button.setTitleColor(.subBlue, for: .normal) +// button.titleLabel?.font = .font(.regular, ofSize: 16) +// return button +// }() +// private let listTableView: UITableView = { +// let tableView = UITableView() +// tableView.layer.cornerRadius = 10 +// tableView.isScrollEnabled = false +// tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") +// return tableView +// }() +// private lazy var startButton: UIButton = { +// let button = MainButton() +// self.detectStartableStatus = { value in +// if value { +// button.title = ButtonText.start.status +// button.isDisabled = false +// let action = UIAction { [weak self] _ in +// self?.requestStartManitto() +// } +// button.addAction(action, for: .touchUpInside) +// } else { +// button.title = ButtonText.waiting.status +// button.isDisabled = true +// } +// } +// return button +// }() // MARK: - property - private var room: Room? +// private var room: Room? private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) private let roomIndex: Int - var roomInformation: ParticipatingRoom? - private var roomInfo: RoomDTO? - private var userArr: [String] = [] { - didSet { - self.setupLayoutTableView() - } - } - private var detectStartableStatus: ((Bool) -> ())? - private var memberType = UserStatus.member { - didSet { - self.moreButton.menu = self.setExitButtonMenu() - self.setupTitleViewGesture() - } - } +// var roomInformation: ParticipatingRoom? +// private var roomInfo: RoomDTO? +// private var userArr: [String] = [] { +// didSet { +// self.setupLayoutTableView() +// } +// } +// private var detectStartableStatus: ((Bool) -> ())? +// private var memberType = UserStatus.member { +// didSet { +// self.moreButton.menu = self.setExitButtonMenu() +// self.setupTitleViewGesture() +// } +// } // MARK: - init @@ -139,253 +141,264 @@ final class DetailWaitViewController: BaseViewController { } // MARK: - life cycle + + override func loadView() { + self.view = self.detailWaitView + } override func viewDidLoad() { super.viewDidLoad() self.requestWaitRoomInfo() - self.setupDelegation() - self.setupNotificationCenter() - self.setupCopyButton() + self.configureNavigationController() +// self.setupDelegation() +// self.setupNotificationCenter() +// self.setupCopyButton() } // MARK: - override - override func setupLayout() { - self.view.addSubview(self.titleView) - self.titleView.snp.makeConstraints { - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.top.equalToSuperview().offset(100) - $0.height.equalTo(86) - } - - self.view.addSubview(self.togetherFriendLabel) - self.togetherFriendLabel.snp.makeConstraints { - $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.top.equalTo(titleView.snp.bottom).offset(44) - } - - self.view.addSubview(self.imgNiView) - self.imgNiView.snp.makeConstraints { - $0.centerY.equalTo(self.togetherFriendLabel.snp.centerY) - $0.leading.equalTo(self.togetherFriendLabel.snp.trailing).offset(7) - $0.width.height.equalTo(30) - } - - self.view.addSubview(self.userCountLabel) - self.userCountLabel.snp.makeConstraints { - $0.leading.equalTo(self.imgNiView.snp.trailing) - $0.centerY.equalTo(self.imgNiView.snp.centerY) - } - - self.view.addSubview(self.copyButton) - self.copyButton.snp.makeConstraints { - $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.centerY.equalTo(self.togetherFriendLabel.snp.centerY) - } - - self.view.addSubview(self.startButton) - self.startButton.snp.makeConstraints { - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalToSuperview().inset(65) - $0.height.equalTo(60) - } - } +// override func setupLayout() { +// self.view.addSubview(self.titleView) +// self.titleView.snp.makeConstraints { +// $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) +// $0.top.equalToSuperview().offset(100) +// $0.height.equalTo(86) +// } +// +// self.view.addSubview(self.togetherFriendLabel) +// self.togetherFriendLabel.snp.makeConstraints { +// $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) +// $0.top.equalTo(titleView.snp.bottom).offset(44) +// } +// +// self.view.addSubview(self.imgNiView) +// self.imgNiView.snp.makeConstraints { +// $0.centerY.equalTo(self.togetherFriendLabel.snp.centerY) +// $0.leading.equalTo(self.togetherFriendLabel.snp.trailing).offset(7) +// $0.width.height.equalTo(30) +// } +// +// self.view.addSubview(self.userCountLabel) +// self.userCountLabel.snp.makeConstraints { +// $0.leading.equalTo(self.imgNiView.snp.trailing) +// $0.centerY.equalTo(self.imgNiView.snp.centerY) +// } +// +// self.view.addSubview(self.copyButton) +// self.copyButton.snp.makeConstraints { +// $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) +// $0.centerY.equalTo(self.togetherFriendLabel.snp.centerY) +// } +// +// self.view.addSubview(self.startButton) +// self.startButton.snp.makeConstraints { +// $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) +// $0.bottom.equalToSuperview().inset(65) +// $0.height.equalTo(60) +// } +// } - override func configureUI() { - super.configureUI() - self.setupSettingButton() - } +// override func configureUI() { +// super.configureUI() +// self.setupSettingButton() +// } // MARK: - func - private func setupDelegation() { - self.listTableView.delegate = self - self.listTableView.dataSource = self - } +// private func setupDelegation() { +// self.listTableView.delegate = self +// self.listTableView.dataSource = self +// } - private func setupCopyButton() { - let action = UIAction { [weak self] _ in - if let code = self?.room?.invitation?.code { - ToastView.showToast(code: code, - message: TextLiteral.detailWaitViewControllerCopyCode, - controller: self ?? UIViewController()) - } - } - copyButton.addAction(action, for: .touchUpInside) - } - - private func presentDetailEditViewController(startString: String, endString: String, isDateEdit: Bool) { - guard let title = self.titleView.roomTitleLabel.text else { return } - let viewController = DetailEditViewController(editMode: isDateEdit ? .date : .information, - roomIndex: roomIndex, - title: title) - viewController.didTappedChangeButton = { [weak self] in - self?.requestWaitRoomInfo() - } - guard let userCount = room?.participants?.count, - let capacity = room?.roomInformation?.capacity else { return } - viewController.currentUserCount = userCount - viewController.sliderValue = capacity - viewController.startDateText = startString - viewController.endDateText = endString - self.present(viewController, animated: true, completion: nil) - } +// private func setupCopyButton() { +// let action = UIAction { [weak self] _ in +// if let code = self?.room?.invitation?.code { +// ToastView.showToast(code: code, +// message: TextLiteral.detailWaitViewControllerCopyCode, +// controller: self ?? UIViewController()) +// } +// } +// copyButton.addAction(action, for: .touchUpInside) +// } - private func setupSettingButton() { - let rightOffsetSettingButton = super.removeBarButtonItemOffset(with: moreButton, - offsetX: -10) - let settingButton = super.makeBarButtonItem(with: rightOffsetSettingButton) +// private func presentDetailEditViewController(startString: String, endString: String, isDateEdit: Bool) { +// guard let title = self.titleView.roomTitleLabel.text else { return } +// let viewController = DetailEditViewController(editMode: isDateEdit ? .date : .information, +// roomIndex: roomIndex, +// title: title) +// viewController.didTappedChangeButton = { [weak self] in +// self?.requestWaitRoomInfo() +// } +// guard let userCount = room?.participants?.count, +// let capacity = room?.roomInformation?.capacity else { return } +// viewController.currentUserCount = userCount +// viewController.sliderValue = capacity +// viewController.startDateText = startString +// viewController.endDateText = endString +// self.present(viewController, animated: true, completion: nil) +// } - self.navigationItem.rightBarButtonItem = settingButton - } +// private func setupSettingButton() { +// let rightOffsetSettingButton = super.removeBarButtonItemOffset(with: moreButton, +// offsetX: -10) +// let settingButton = super.makeBarButtonItem(with: rightOffsetSettingButton) +// +// self.navigationItem.rightBarButtonItem = settingButton +// } - private func setExitButtonMenu() -> UIMenu { - let children: [UIAction] = memberType == .owner - ? [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in - self?.presentEditRoomView() - }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in - self?.makeRequestAlert(title: UserStatus.owner.alertText.title, - message: UserStatus.owner.alertText.message, - okTitle: UserStatus.owner.alertText.okTitle, - okAction: { _ in - self?.requestDeleteRoom() - - }) - - }) - ] - : [UIAction(title: TextLiteral.detailWaitViewControllerLeaveRoom, handler: { [weak self] _ in - self?.makeRequestAlert(title: UserStatus.member.alertText.title, - message: UserStatus.member.alertText.message, - okTitle: UserStatus.member.alertText.okTitle, - okAction: { _ in - self?.requestDeleteLeaveRoom() - }) - })] - let menu = UIMenu(children: children) - return menu - } +// private func setExitButtonMenu() -> UIMenu { +// let children: [UIAction] = memberType == .owner +// ? [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in +// self?.presentEditRoomView() +// }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in +// self?.makeRequestAlert(title: UserStatus.owner.alertText.title, +// message: UserStatus.owner.alertText.message, +// okTitle: UserStatus.owner.alertText.okTitle, +// okAction: { _ in +// self?.requestDeleteRoom() +// +// }) +// +// }) +// ] +// : [UIAction(title: TextLiteral.detailWaitViewControllerLeaveRoom, handler: { [weak self] _ in +// self?.makeRequestAlert(title: UserStatus.member.alertText.title, +// message: UserStatus.member.alertText.message, +// okTitle: UserStatus.member.alertText.okTitle, +// okAction: { _ in +// self?.requestDeleteLeaveRoom() +// }) +// })] +// let menu = UIMenu(children: children) +// return menu +// } - private func presentEditRoomView() { - guard let roomInformation = self.room?.roomInformation else { return } - if roomInformation.isAlreadyPastDate { - self.editInfoFromDefaultDate(isDateEdit: false) - } else { - self.editInfoFromCurrentDate() - } - } +// private func presentEditRoomView() { +// guard let roomInformation = self.room?.roomInformation else { return } +// if roomInformation.isAlreadyPastDate { +// self.editInfoFromDefaultDate(isDateEdit: false) +// } else { +// self.editInfoFromCurrentDate() +// } +// } - private func editInfoFromDefaultDate(isDateEdit: Bool) { - let fiveDaysInterval: TimeInterval = 86400 * 4 - let defaultStartDate = Date().dateToString - let defaultEndDate = (Date() + fiveDaysInterval).dateToString - self.presentDetailEditViewController(startString: defaultStartDate, - endString: defaultEndDate, - isDateEdit: isDateEdit) - } +// private func editInfoFromDefaultDate(isDateEdit: Bool) { +// let fiveDaysInterval: TimeInterval = 86400 * 4 +// let defaultStartDate = Date().dateToString +// let defaultEndDate = (Date() + fiveDaysInterval).dateToString +// self.presentDetailEditViewController(startString: defaultStartDate, +// endString: defaultEndDate, +// isDateEdit: isDateEdit) +// } - private func editInfoFromCurrentDate() { - guard let startDate = self.room?.roomInformation?.startDate, - let endDate = self.room?.roomInformation?.endDate else { return } - self.presentDetailEditViewController(startString: startDate, - endString: endDate, - isDateEdit: false) - } +// private func editInfoFromCurrentDate() { +// guard let startDate = self.room?.roomInformation?.startDate, +// let endDate = self.room?.roomInformation?.endDate else { return } +// self.presentDetailEditViewController(startString: startDate, +// endString: endDate, +// isDateEdit: false) +// } - private func setupNotificationCenter() { - NotificationCenter.default.addObserver(self, selector: #selector(self.didTapEnterButton), name: .createRoomInvitedCode, object: nil) - } +// private func setupNotificationCenter() { +// NotificationCenter.default.addObserver(self, selector: #selector(self.didTapEnterButton), name: .createRoomInvitedCode, object: nil) +// } - private func isPastStartDate() { - guard let isStart = self.room?.roomInformation?.isStart else { return } - if !isStart { - switch memberType { - case .owner: - let action: ((UIAlertAction) -> ()) = { [weak self] _ in - self?.editInfoFromDefaultDate(isDateEdit: true) - } - self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, - message: TextLiteral.detailWaitViewControllerPastOwnerAlertMessage, - okAction: action) - case .member: - self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, - message: TextLiteral.detailWaitViewControllerPastAlertMessage) - } - } - } +// private func isPastStartDate() { +// guard let isStart = self.room?.roomInformation?.isStart else { return } +// if !isStart { +// switch memberType { +// case .owner: +// let action: ((UIAlertAction) -> ()) = { [weak self] _ in +// self?.editInfoFromDefaultDate(isDateEdit: true) +// } +// self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, +// message: TextLiteral.detailWaitViewControllerPastOwnerAlertMessage, +// okAction: action) +// case .member: +// self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, +// message: TextLiteral.detailWaitViewControllerPastAlertMessage) +// } +// } +// } - private func setStartButton() { - if memberType == .owner { - guard let canStart = self.room?.canStart else { return } - self.detectStartableStatus?(canStart) - } else { - self.detectStartableStatus?(false) - } - } +// private func setStartButton() { +// if memberType == .owner { +// guard let canStart = self.room?.canStart else { return } +// self.detectStartableStatus?(canStart) +// } else { +// self.detectStartableStatus?(false) +// } +// } - private func setupLayoutTableView() { - DispatchQueue.main.async { - self.listTableView.reloadData() - self.view.addSubview(self.listTableView) - var tableHeight = self.userArr.count * 44 - if tableHeight > 400 { - tableHeight = 400 - self.listTableView.isScrollEnabled = true - } - self.listTableView.snp.makeConstraints { - $0.top.equalTo(self.togetherFriendLabel.snp.bottom).offset(30) - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.centerX.equalToSuperview() - $0.height.equalTo(tableHeight) - } - } - } +// private func setupLayoutTableView() { +// DispatchQueue.main.async { +// self.listTableView.reloadData() +// self.view.addSubview(self.listTableView) +// var tableHeight = self.userArr.count * 44 +// if tableHeight > 400 { +// tableHeight = 400 +// self.listTableView.isScrollEnabled = true +// } +// self.listTableView.snp.makeConstraints { +// $0.top.equalTo(self.togetherFriendLabel.snp.bottom).offset(30) +// $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) +// $0.centerX.equalToSuperview() +// $0.height.equalTo(tableHeight) +// } +// } +// } - private func setupTitleViewGesture() { - if self.memberType == .owner { - let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.presentEditViewController)) - self.titleView.addGestureRecognizer(tapGesture) - } - } +// private func setupTitleViewGesture() { +// if self.memberType == .owner { +// let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.presentEditViewController)) +// self.titleView.addGestureRecognizer(tapGesture) +// } +// } private func presentSelectManittoViewController(nickname: String) { let viewController = SelectManittoViewController() viewController.modalPresentationStyle = .fullScreen viewController.manitteeName = nickname - viewController.roomId = self.roomInformation?.id?.description + viewController.roomId = self.roomIndex.description +// viewController.roomId = self.roomInformation?.id?.description self.present(viewController, animated: true) } + + private func configureNavigationController() { + guard let navigationController = self.navigationController else { return } + self.detailWaitView.configureNavigationItem(navigationController) + } // MARK: - selector - @objc - private func didTapEnterButton() { - guard let roomInfo = self.roomInfo, - let code = self.room?.invitation?.code else { return } - let viewController = InvitedCodeViewController(roomInfo: RoomDTO(title: roomInfo.title, - capacity: roomInfo.capacity, - startDate: roomInfo.startDate, - endDate: roomInfo.endDate), - code: code) - viewController.roomInfo = roomInfo - viewController.modalPresentationStyle = .overCurrentContext - viewController.modalTransitionStyle = .crossDissolve - self.present(viewController, animated: true) - } +// @objc +// private func didTapEnterButton() { +// guard let roomInfo = self.roomInfo, +// let code = self.room?.invitation?.code else { return } +// let viewController = InvitedCodeViewController(roomInfo: RoomDTO(title: roomInfo.title, +// capacity: roomInfo.capacity, +// startDate: roomInfo.startDate, +// endDate: roomInfo.endDate), +// code: code) +// viewController.roomInfo = roomInfo +// viewController.modalPresentationStyle = .overCurrentContext +// viewController.modalTransitionStyle = .crossDissolve +// self.present(viewController, animated: true) +// } - @objc - private func presentEditViewController() { - guard let startDate = self.room?.roomInformation?.startDate, - let endDate = self.room?.roomInformation?.endDate else { return } - self.presentDetailEditViewController(startString: startDate, - endString: endDate, - isDateEdit: false) - } +// @objc +// private func presentEditViewController() { +// guard let startDate = self.room?.roomInformation?.startDate, +// let endDate = self.room?.roomInformation?.endDate else { return } +// self.presentDetailEditViewController(startString: startDate, +// endString: endDate, +// isDateEdit: false) +// } - @objc - private func changeStartButton() { - self.setStartButton() - } +// @objc +// private func changeStartButton() { +// self.setStartButton() +// } // MARK: - network @@ -394,22 +407,25 @@ final class DetailWaitViewController: BaseViewController { do { let data = try await self.detailWaitService.getWaitingRoomInfo(roomId: "\(roomIndex)") if let roomInfo = data { - guard let title = roomInfo.roomInformation?.title, - let state = roomInfo.roomInformation?.state, - let participants = roomInfo.participants, - let isAdmin = roomInfo.admin else { return } - self.room = roomInfo - self.userArr = participants.membersNickname - self.memberType = isAdmin ? .owner : .member - self.roomInfo = roomInfo.roomDTO - self.setStartButton() +// guard let title = roomInfo.roomInformation?.title, +// let state = roomInfo.roomInformation?.state, +// let participants = roomInfo.participants, +// let isAdmin = roomInfo.admin else { return } DispatchQueue.main.async { - self.isPastStartDate() - self.titleView.setStartState(state: state) - self.userCountLabel.text = roomInfo.userCount - self.titleView.setRoomTitleLabelText(text: title) - self.titleView.setDurationDateLabel(text: roomInfo.roomInformation?.dateRange ?? "") + self.detailWaitView.updateLayoutWithData(room: roomInfo) } +// self.room = roomInfo +// self.userArr = participants.membersNickname +// self.memberType = isAdmin ? .owner : .member +// self.roomInfo = roomInfo.roomDTO +// self.setStartButton() +// DispatchQueue.main.async { +// self.isPastStartDate() +// self.titleView.setStartState(state: state) +// self.userCountLabel.text = roomInfo.userCount +// self.titleView.setRoomTitleLabelText(text: title) +// self.titleView.setDurationDateLabel(text: roomInfo.roomInformation?.dateRange ?? "") +// } } } catch NetworkError.serverError { print("server Error") @@ -474,23 +490,23 @@ final class DetailWaitViewController: BaseViewController { } } -extension DetailWaitViewController: UITableViewDelegate { - func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - return 44 - } -} - -extension DetailWaitViewController: UITableViewDataSource { - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return self.userArr.count - } - - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell = self.listTableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as UITableViewCell - cell.textLabel?.text = self.userArr[indexPath.row] - cell.textLabel?.font = .font(.regular, ofSize: 17) - cell.backgroundColor = .darkGrey003 - cell.selectionStyle = .none - return cell - } -} +//extension DetailWaitViewController: UITableViewDelegate { +// func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { +// return 44 +// } +//} +// +//extension DetailWaitViewController: UITableViewDataSource { +// func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { +// return self.userArr.count +// } +// +// func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { +// let cell = self.listTableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as UITableViewCell +// cell.textLabel?.text = self.userArr[indexPath.row] +// cell.textLabel?.font = .font(.regular, ofSize: 17) +// cell.backgroundColor = .darkGrey003 +// cell.selectionStyle = .none +// return cell +// } +//} diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 204a926ab..b4bfc397a 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -5,4 +5,283 @@ // Created by Mingwan Choi on 2023/04/14. // -import Foundation +import UIKit + +import SnapKit + +final class DetailWaitView: UIView { + private var userArray: [User] = [] { + didSet { + DispatchQueue.main.async { + self.listTableView.reloadData() + self.updateTableViewHeight() + } + } + } + private var canStart: Bool = false { + didSet { + self.setStartButton(self.canStart) + } + } + + private enum UserStatus: CaseIterable { + case owner + case member + + var alertText: (title: String, + message: String, + okTitle: String) { + switch self { + case .owner: + return (title: TextLiteral.datailWaitViewControllerDeleteTitle, + message: TextLiteral.datailWaitViewControllerDeleteMessage, + okTitle: TextLiteral.delete) + case .member: + return (title: TextLiteral.datailWaitViewControllerExitTitle, + message: TextLiteral.datailWaitViewControllerExitMessage, + okTitle: TextLiteral.leave) + } + } + } + + private enum ButtonText: String { + case waiting + case start + + var status: String { + switch self { + case .waiting: + return TextLiteral.datailWaitViewControllerButtonWaitingText + case .start: + return TextLiteral.datailWaitViewControllerButtonStartText + } + } + } + + // MARK: - ui component + + private let moreButton: UIButton = { + let button = MoreButton() + button.showsMenuAsPrimaryAction = true + return button + }() + private let titleView: DetailWaitTitleView = DetailWaitTitleView() + private let togetherFriendLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.togetherFriend + label.textColor = .white + label.font = .font(.regular, ofSize: 16) + return label + }() + private let imgNiView: UIImageView = { + let imageView = UIImageView() + imageView.image = ImageLiterals.imgNi + return imageView + }() + private let userCountLabel: UILabel = { + let label = UILabel() + label.textColor = .white + label.font = .font(.regular, ofSize: 14) + return label + }() + private let copyButton: UIButton = { + let button = UIButton(type: .system) + button.setTitle(TextLiteral.copyCode, for: .normal) + button.setTitleColor(.subBlue, for: .normal) + button.titleLabel?.font = .font(.regular, ofSize: 16) + return button + }() + private lazy var listTableView: UITableView = { + let tableView = UITableView() + tableView.delegate = self + tableView.dataSource = self + tableView.layer.cornerRadius = 10 + tableView.isScrollEnabled = false + tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") + return tableView + }() + private let startButton: MainButton = MainButton() + + // MARK: - init + + override init(frame: CGRect) { + super.init(frame: frame) + self.setupLayout() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - func + + private func setupLayout() { + self.addSubview(self.titleView) + self.titleView.snp.makeConstraints { + $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.top.equalToSuperview().offset(100) + $0.height.equalTo(86) + } + + self.addSubview(self.togetherFriendLabel) + self.togetherFriendLabel.snp.makeConstraints { + $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.top.equalTo(titleView.snp.bottom).offset(44) + } + + self.addSubview(self.imgNiView) + self.imgNiView.snp.makeConstraints { + $0.centerY.equalTo(self.togetherFriendLabel.snp.centerY) + $0.leading.equalTo(self.togetherFriendLabel.snp.trailing).offset(7) + $0.width.height.equalTo(30) + } + + self.addSubview(self.userCountLabel) + self.userCountLabel.snp.makeConstraints { + $0.leading.equalTo(self.imgNiView.snp.trailing) + $0.centerY.equalTo(self.imgNiView.snp.centerY) + } + + self.addSubview(self.copyButton) + self.copyButton.snp.makeConstraints { + $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.centerY.equalTo(self.togetherFriendLabel.snp.centerY) + } + + self.addSubview(self.listTableView) + self.listTableView.snp.makeConstraints { + $0.top.equalTo(self.togetherFriendLabel.snp.bottom).offset(30) + $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.centerX.equalToSuperview() + $0.height.equalTo(44) + } + + self.addSubview(self.startButton) + self.startButton.snp.makeConstraints { + $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.bottom.equalToSuperview().inset(65) + $0.height.equalTo(60) + } + } + + private func setupCopyButton(_ invitationCode: String) { + let action = UIAction { [weak self] _ in + ToastView.showToast(code: invitationCode, + message: TextLiteral.detailWaitViewControllerCopyCode, + view: self ?? UIView()) + } + self.copyButton.addAction(action, for: .touchUpInside) + } + + func configureNavigationItem(_ navigationController: UINavigationController) { + let navigationItem = navigationController.topViewController?.navigationItem + let moreButton = UIBarButtonItem(customView: self.moreButton) + + navigationItem?.rightBarButtonItem = moreButton + } + + func updateLayoutWithData(room: Room) { + guard let title = room.roomInformation?.title, + let state = room.roomInformation?.state, + let dateRange = room.roomInformation?.dateRange, + let users = room.participants?.members, + let isOwner = room.admin, + let code = room.invitation?.code + else { return } + self.titleView.setRoomTitleLabelText(text: title) + self.titleView.setStartState(state: state) + self.userCountLabel.text = room.userCount + self.titleView.setDurationDateLabel(text: dateRange) + self.userArray = users + self.showStartButtonForAdmin(isOwner) + self.canStart = room.canStart + self.setExitButtonMenu(isOwner) + self.setupCopyButton(code) + } + + private func updateTableViewHeight() { + var tableHeight = self.userArray.count * 44 + if tableHeight > 400 { + tableHeight = 400 + self.listTableView.isScrollEnabled = true + } + self.listTableView.snp.updateConstraints { + $0.height.equalTo(tableHeight) + } + } + + private func showStartButtonForAdmin(_ isOwner: Bool) { + self.startButton.isHidden = !isOwner + } + + private func setStartButton(_ canStart: Bool) { + if canStart { + self.startButton.title = ButtonText.start.status + self.startButton.isDisabled = false + let action = UIAction { [weak self] _ in + // FIXME: - delegate 연결 +// self?.requestStartManitto() + } + self.startButton.addAction(action, for: .touchUpInside) + } else { + self.startButton.title = ButtonText.waiting.status + self.startButton.isDisabled = true + } + } + + private func setExitButtonMenu(_ isOwner: Bool) { + let viewController = UIViewController() + var children: [UIAction] + if isOwner { + children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { _ in + // FIXME: - delegate 연결 + // self?.presentEditRoomView() + }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { _ in + viewController.makeRequestAlert(title: UserStatus.owner.alertText.title, + message: UserStatus.owner.alertText.message, + okTitle: UserStatus.owner.alertText.okTitle, + okAction: { _ in + // FIXME: - delegate 연결 + // self?.requestDeleteRoom() + + }) + + }) + ] + } else { + children = [UIAction(title: TextLiteral.detailWaitViewControllerLeaveRoom, handler: { _ in + viewController.makeRequestAlert(title: UserStatus.member.alertText.title, + message: UserStatus.member.alertText.message, + okTitle: UserStatus.member.alertText.okTitle, + okAction: { _ in + // FIXME: - delegate 연결 + // self?.requestDeleteLeaveRoom() + }) + })] + } + let menu = UIMenu(children: children) + self.moreButton.menu = menu + } +} + +extension DetailWaitView: UITableViewDelegate { + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return 44 + } +} + +extension DetailWaitView: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return self.userArray.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = self.listTableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as UITableViewCell + cell.textLabel?.text = self.userArray[indexPath.row].nickname + cell.textLabel?.font = .font(.regular, ofSize: 17) + cell.backgroundColor = .darkGrey003 + cell.selectionStyle = .none + return cell + } +} From 640c55a2128c3992f4242d2b685f7a2ea148b832 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 15 Apr 2023 20:36:39 +0900 Subject: [PATCH 004/468] =?UTF-8?q?[CHORE]=20toast=20UIView=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/UIComponent/ToastPopupView.swift | 37 ++++++++++++++++++- .../DetailEditViewController.swift | 2 +- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Global/UIComponent/ToastPopupView.swift b/Manito/Manito/Global/UIComponent/ToastPopupView.swift index 5cb2dea31..5a8f86044 100644 --- a/Manito/Manito/Global/UIComponent/ToastPopupView.swift +++ b/Manito/Manito/Global/UIComponent/ToastPopupView.swift @@ -39,9 +39,44 @@ struct ToastView { }) }) } + + static func showToast(message: String, view: UIView) { + let toastLabel = UILabel() + toastLabel.backgroundColor = .grey001 + toastLabel.textColor = .black + toastLabel.font = .font(.regular, ofSize: 14) + toastLabel.textAlignment = .center + toastLabel.text = message + toastLabel.alpha = 0 + toastLabel.layer.cornerRadius = 10 + toastLabel.clipsToBounds = true + view.addSubview(toastLabel) - static func showToast(code code: String, message: String, controller: UIViewController) { + toastLabel.snp.makeConstraints { + $0.centerX.equalToSuperview() + $0.bottom.equalToSuperview().inset(150) + $0.width.equalTo(140) + $0.height.equalTo(40) + } + + UIView.animate(withDuration: 0.7, animations: { + toastLabel.alpha = 0.8 + }, completion: { isCompleted in + UIView.animate(withDuration: 0.7, delay: 0.5, animations: { + toastLabel.alpha = 0 + }, completion: { isCompleted in + toastLabel.removeFromSuperview() + }) + }) + } + + static func showToast(code: String, message: String, controller: UIViewController) { UIPasteboard.general.string = code showToast(message: TextLiteral.detailWaitViewControllerCopyCode, controller: controller) } + + static func showToast(code: String, message: String, view: UIView) { + UIPasteboard.general.string = code + showToast(message: TextLiteral.detailWaitViewControllerCopyCode, view: view) + } } diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index 9f09850ee..71f70f933 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -324,7 +324,7 @@ final class DetailEditViewController: BaseViewController { roomInfo: roomDto) if status == 204 { ToastView.showToast(message: "방 정보 수정 완료", - controller: self) + view: self.view ?? UIView()) self.didTappedChangeButton?() self.dismiss(animated: true) } From 1912ac17b95902f8e1264399a47f259f569963ff Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 15 Apr 2023 20:36:57 +0900 Subject: [PATCH 005/468] =?UTF-8?q?[CHORE]=20DetailWait=20=EB=82=B4?= =?UTF-8?q?=EB=B6=80=20=EB=B3=80=EC=88=98=20=EC=82=AD=EC=A0=9C=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Main/MainViewController.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Manito/Manito/Screens/Main/MainViewController.swift b/Manito/Manito/Screens/Main/MainViewController.swift index eed356851..26ccc7bb1 100644 --- a/Manito/Manito/Screens/Main/MainViewController.swift +++ b/Manito/Manito/Screens/Main/MainViewController.swift @@ -273,7 +273,6 @@ final class MainViewController: BaseViewController { case .waiting: guard let index = index else { return } let viewController = DetailWaitViewController(index: index) - viewController.roomInformation = self.rooms?[roomIndex] self.navigationController?.pushViewController(viewController, animated: true) default: guard let roomId = rooms?[roomIndex].id?.description From 6facb13b20e5749f1da2adcb3cad3a0ca8ae628d Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 15 Apr 2023 20:58:24 +0900 Subject: [PATCH 006/468] =?UTF-8?q?[CHORE]=20=EC=8B=9C=EC=9E=91=EB=82=A0?= =?UTF-8?q?=EC=A7=9C=20=EC=A7=80=EB=82=AC=EC=9D=84=20=EB=95=8C=20Alert?= =?UTF-8?q?=EB=9D=84=EC=9A=B0=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 23 +-------- .../Detail-Wait/View/DetailWaitView.swift | 50 ++++++++++++++----- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 29c2b08cb..1ea188ca8 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -412,7 +412,7 @@ final class DetailWaitViewController: BaseViewController { // let participants = roomInfo.participants, // let isAdmin = roomInfo.admin else { return } DispatchQueue.main.async { - self.detailWaitView.updateLayoutWithData(room: roomInfo) + self.detailWaitView.configureLayout(room: roomInfo) } // self.room = roomInfo // self.userArr = participants.membersNickname @@ -489,24 +489,3 @@ final class DetailWaitViewController: BaseViewController { } } } - -//extension DetailWaitViewController: UITableViewDelegate { -// func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { -// return 44 -// } -//} -// -//extension DetailWaitViewController: UITableViewDataSource { -// func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { -// return self.userArr.count -// } -// -// func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { -// let cell = self.listTableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as UITableViewCell -// cell.textLabel?.text = self.userArr[indexPath.row] -// cell.textLabel?.font = .font(.regular, ofSize: 17) -// cell.backgroundColor = .darkGrey003 -// cell.selectionStyle = .none -// return cell -// } -//} diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index b4bfc397a..6f9899cb9 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -181,13 +181,14 @@ final class DetailWaitView: UIView { navigationItem?.rightBarButtonItem = moreButton } - func updateLayoutWithData(room: Room) { + func configureLayout(room: Room) { guard let title = room.roomInformation?.title, let state = room.roomInformation?.state, let dateRange = room.roomInformation?.dateRange, let users = room.participants?.members, let isOwner = room.admin, - let code = room.invitation?.code + let code = room.invitation?.code, + let isStart = room.roomInformation?.isStart else { return } self.titleView.setRoomTitleLabelText(text: title) self.titleView.setStartState(state: state) @@ -198,6 +199,7 @@ final class DetailWaitView: UIView { self.canStart = room.canStart self.setExitButtonMenu(isOwner) self.setupCopyButton(code) + self.showAlertWhenPastDate(isOwner, isStart: isStart) } private func updateTableViewHeight() { @@ -215,6 +217,7 @@ final class DetailWaitView: UIView { self.startButton.isHidden = !isOwner } + // FIXME: - configureStartButton이 더 났나? private func setStartButton(_ canStart: Bool) { if canStart { self.startButton.title = ButtonText.start.status @@ -231,38 +234,59 @@ final class DetailWaitView: UIView { } private func setExitButtonMenu(_ isOwner: Bool) { - let viewController = UIViewController() var children: [UIAction] if isOwner { children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { _ in // FIXME: - delegate 연결 // self?.presentEditRoomView() }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { _ in - viewController.makeRequestAlert(title: UserStatus.owner.alertText.title, - message: UserStatus.owner.alertText.message, - okTitle: UserStatus.owner.alertText.okTitle, - okAction: { _ in +// viewController.makeRequestAlert(title: UserStatus.owner.alertText.title, +// message: UserStatus.owner.alertText.message, +// okTitle: UserStatus.owner.alertText.okTitle, +// okAction: { _ in // FIXME: - delegate 연결 // self?.requestDeleteRoom() - }) +// }) }) ] } else { children = [UIAction(title: TextLiteral.detailWaitViewControllerLeaveRoom, handler: { _ in - viewController.makeRequestAlert(title: UserStatus.member.alertText.title, - message: UserStatus.member.alertText.message, - okTitle: UserStatus.member.alertText.okTitle, - okAction: { _ in +// viewController.makeRequestAlert(title: UserStatus.member.alertText.title, +// message: UserStatus.member.alertText.message, +// okTitle: UserStatus.member.alertText.okTitle, +// okAction: { _ in // FIXME: - delegate 연결 // self?.requestDeleteLeaveRoom() - }) +// }) })] } let menu = UIMenu(children: children) self.moreButton.menu = menu } + + private func showAlertWhenPastDate(_ isAdmin: Bool, isStart: Bool) { + let type: UserStatus = isAdmin ? .owner : .member + if !isStart { + switch type { + case .owner: + print("delegate로 넘겨야함") + // FIXME: - delegate로 넘겨야함 +// let action: ((UIAlertAction) -> ()) = { [weak self] _ in +// self?.editInfoFromDefaultDate(isDateEdit: true) +// } +// viewController.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, +// message: TextLiteral.detailWaitViewControllerPastOwnerAlertMessage, +// okAction: action) + case .member: + print("delegate로 넘겨야함") + // FIXME: - delegate로 넘겨야함 +// viewController.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, +// message: TextLiteral.detailWaitViewControllerPastAlertMessage) + } + } + } } extension DetailWaitView: UITableViewDelegate { From cc6955bd87df73c2e6e25b44a63caf6e0749d82e Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 15 Apr 2023 21:04:37 +0900 Subject: [PATCH 007/468] =?UTF-8?q?[CHORE]=20=EB=B6=84=EB=A6=AC=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C=ED=95=9C=20=EC=A3=BC=EC=84=9D=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 100 ++---------------- 1 file changed, 6 insertions(+), 94 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 1ea188ca8..d8af76745 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -246,107 +246,35 @@ final class DetailWaitViewController: BaseViewController { // self.navigationItem.rightBarButtonItem = settingButton // } -// private func setExitButtonMenu() -> UIMenu { -// let children: [UIAction] = memberType == .owner -// ? [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in -// self?.presentEditRoomView() -// }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in -// self?.makeRequestAlert(title: UserStatus.owner.alertText.title, -// message: UserStatus.owner.alertText.message, -// okTitle: UserStatus.owner.alertText.okTitle, -// okAction: { _ in -// self?.requestDeleteRoom() -// -// }) -// -// }) -// ] -// : [UIAction(title: TextLiteral.detailWaitViewControllerLeaveRoom, handler: { [weak self] _ in -// self?.makeRequestAlert(title: UserStatus.member.alertText.title, -// message: UserStatus.member.alertText.message, -// okTitle: UserStatus.member.alertText.okTitle, -// okAction: { _ in -// self?.requestDeleteLeaveRoom() -// }) -// })] -// let menu = UIMenu(children: children) -// return menu -// } - -// private func presentEditRoomView() { + private func presentEditRoomView() { // guard let roomInformation = self.room?.roomInformation else { return } // if roomInformation.isAlreadyPastDate { // self.editInfoFromDefaultDate(isDateEdit: false) // } else { // self.editInfoFromCurrentDate() // } -// } + } -// private func editInfoFromDefaultDate(isDateEdit: Bool) { + private func editInfoFromDefaultDate(isDateEdit: Bool) { // let fiveDaysInterval: TimeInterval = 86400 * 4 // let defaultStartDate = Date().dateToString // let defaultEndDate = (Date() + fiveDaysInterval).dateToString // self.presentDetailEditViewController(startString: defaultStartDate, // endString: defaultEndDate, // isDateEdit: isDateEdit) -// } + } -// private func editInfoFromCurrentDate() { + private func editInfoFromCurrentDate() { // guard let startDate = self.room?.roomInformation?.startDate, // let endDate = self.room?.roomInformation?.endDate else { return } // self.presentDetailEditViewController(startString: startDate, // endString: endDate, // isDateEdit: false) -// } + } // private func setupNotificationCenter() { // NotificationCenter.default.addObserver(self, selector: #selector(self.didTapEnterButton), name: .createRoomInvitedCode, object: nil) // } - -// private func isPastStartDate() { -// guard let isStart = self.room?.roomInformation?.isStart else { return } -// if !isStart { -// switch memberType { -// case .owner: -// let action: ((UIAlertAction) -> ()) = { [weak self] _ in -// self?.editInfoFromDefaultDate(isDateEdit: true) -// } -// self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, -// message: TextLiteral.detailWaitViewControllerPastOwnerAlertMessage, -// okAction: action) -// case .member: -// self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, -// message: TextLiteral.detailWaitViewControllerPastAlertMessage) -// } -// } -// } - -// private func setStartButton() { -// if memberType == .owner { -// guard let canStart = self.room?.canStart else { return } -// self.detectStartableStatus?(canStart) -// } else { -// self.detectStartableStatus?(false) -// } -// } - -// private func setupLayoutTableView() { -// DispatchQueue.main.async { -// self.listTableView.reloadData() -// self.view.addSubview(self.listTableView) -// var tableHeight = self.userArr.count * 44 -// if tableHeight > 400 { -// tableHeight = 400 -// self.listTableView.isScrollEnabled = true -// } -// self.listTableView.snp.makeConstraints { -// $0.top.equalTo(self.togetherFriendLabel.snp.bottom).offset(30) -// $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) -// $0.centerX.equalToSuperview() -// $0.height.equalTo(tableHeight) -// } -// } -// } // private func setupTitleViewGesture() { // if self.memberType == .owner { @@ -407,25 +335,9 @@ final class DetailWaitViewController: BaseViewController { do { let data = try await self.detailWaitService.getWaitingRoomInfo(roomId: "\(roomIndex)") if let roomInfo = data { -// guard let title = roomInfo.roomInformation?.title, -// let state = roomInfo.roomInformation?.state, -// let participants = roomInfo.participants, -// let isAdmin = roomInfo.admin else { return } DispatchQueue.main.async { self.detailWaitView.configureLayout(room: roomInfo) } -// self.room = roomInfo -// self.userArr = participants.membersNickname -// self.memberType = isAdmin ? .owner : .member -// self.roomInfo = roomInfo.roomDTO -// self.setStartButton() -// DispatchQueue.main.async { -// self.isPastStartDate() -// self.titleView.setStartState(state: state) -// self.userCountLabel.text = roomInfo.userCount -// self.titleView.setRoomTitleLabelText(text: title) -// self.titleView.setDurationDateLabel(text: roomInfo.roomInformation?.dateRange ?? "") -// } } } catch NetworkError.serverError { print("server Error") From 203b6c753b3cdd344a83f0ff3bf7b3bb3ed2199b Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 15 Apr 2023 21:23:43 +0900 Subject: [PATCH 008/468] =?UTF-8?q?[CHORE]=20detailWait=20delegate=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 27 +++++++ .../Detail-Wait/View/DetailWaitView.swift | 71 +++++++++++-------- 2 files changed, 70 insertions(+), 28 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index d8af76745..734d4ce4b 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -149,6 +149,7 @@ final class DetailWaitViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() self.requestWaitRoomInfo() + self.configureDelegation() self.configureNavigationController() // self.setupDelegation() // self.setupNotificationCenter() @@ -204,6 +205,10 @@ final class DetailWaitViewController: BaseViewController { // } // MARK: - func + + private func configureDelegation() { + self.detailWaitView.configureDelegation(self) + } // private func setupDelegation() { // self.listTableView.delegate = self @@ -401,3 +406,25 @@ final class DetailWaitViewController: BaseViewController { } } } + +extension DetailWaitViewController: DetailWaitViewDelegate { + func startManitto() { + + } + + func presentRoomEditViewController() { + + } + + func deleteRoom() { + + } + + func leaveRoom() { + + } + + func showAlert(title: String, message: String) { + self.makeAlert(title: title, message: message) + } +} diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 6f9899cb9..d7dcfb55e 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -9,21 +9,20 @@ import UIKit import SnapKit +protocol DetailWaitViewDelegate: AnyObject { + // 마니또 시작 + func startManitto() + // 방 정보 수정 뷰로 이동 + func presentRoomEditViewController() + // 방 삭제 + func deleteRoom() + // 방 나가기 + func leaveRoom() + // 시작 날짜 지남 alert 표시 + func showAlert(title: String, message: String) +} + final class DetailWaitView: UIView { - private var userArray: [User] = [] { - didSet { - DispatchQueue.main.async { - self.listTableView.reloadData() - self.updateTableViewHeight() - } - } - } - private var canStart: Bool = false { - didSet { - self.setStartButton(self.canStart) - } - } - private enum UserStatus: CaseIterable { case owner case member @@ -102,6 +101,22 @@ final class DetailWaitView: UIView { }() private let startButton: MainButton = MainButton() + private var userArray: [User] = [] { + didSet { + DispatchQueue.main.async { + self.listTableView.reloadData() + self.updateTableViewHeight() + } + } + } + private var canStart: Bool = false { + didSet { + self.setStartButton(self.canStart) + } + } + + private weak var delegate: DetailWaitViewDelegate? + // MARK: - init override init(frame: CGRect) { @@ -174,6 +189,10 @@ final class DetailWaitView: UIView { self.copyButton.addAction(action, for: .touchUpInside) } + func configureDelegation(_ delegate: DetailWaitViewDelegate) { + self.delegate = delegate + } + func configureNavigationItem(_ navigationController: UINavigationController) { let navigationItem = navigationController.topViewController?.navigationItem let moreButton = UIBarButtonItem(customView: self.moreButton) @@ -223,7 +242,7 @@ final class DetailWaitView: UIView { self.startButton.title = ButtonText.start.status self.startButton.isDisabled = false let action = UIAction { [weak self] _ in - // FIXME: - delegate 연결 + self?.delegate?.startManitto() // self?.requestStartManitto() } self.startButton.addAction(action, for: .touchUpInside) @@ -236,28 +255,27 @@ final class DetailWaitView: UIView { private func setExitButtonMenu(_ isOwner: Bool) { var children: [UIAction] if isOwner { - children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { _ in - // FIXME: - delegate 연결 + children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in + self?.delegate?.presentRoomEditViewController() // self?.presentEditRoomView() - }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { _ in + }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in // viewController.makeRequestAlert(title: UserStatus.owner.alertText.title, // message: UserStatus.owner.alertText.message, // okTitle: UserStatus.owner.alertText.okTitle, // okAction: { _ in // FIXME: - delegate 연결 + self?.delegate?.deleteRoom() // self?.requestDeleteRoom() - // }) - }) ] } else { - children = [UIAction(title: TextLiteral.detailWaitViewControllerLeaveRoom, handler: { _ in + children = [UIAction(title: TextLiteral.detailWaitViewControllerLeaveRoom, handler: { [weak self] _ in // viewController.makeRequestAlert(title: UserStatus.member.alertText.title, // message: UserStatus.member.alertText.message, // okTitle: UserStatus.member.alertText.okTitle, // okAction: { _ in - // FIXME: - delegate 연결 + self?.delegate?.leaveRoom() // self?.requestDeleteLeaveRoom() // }) })] @@ -271,8 +289,7 @@ final class DetailWaitView: UIView { if !isStart { switch type { case .owner: - print("delegate로 넘겨야함") - // FIXME: - delegate로 넘겨야함 + self.delegate?.presentRoomEditViewController() // let action: ((UIAlertAction) -> ()) = { [weak self] _ in // self?.editInfoFromDefaultDate(isDateEdit: true) // } @@ -280,10 +297,8 @@ final class DetailWaitView: UIView { // message: TextLiteral.detailWaitViewControllerPastOwnerAlertMessage, // okAction: action) case .member: - print("delegate로 넘겨야함") - // FIXME: - delegate로 넘겨야함 -// viewController.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, -// message: TextLiteral.detailWaitViewControllerPastAlertMessage) + self.delegate?.showAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, + message: TextLiteral.detailWaitViewControllerPastAlertMessage) } } } From 120c053b7e9c47ec3bf5caa4df22fe9cbb5a5d37 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 15 Apr 2023 21:28:34 +0900 Subject: [PATCH 009/468] =?UTF-8?q?[CHORE]=20=EB=B6=84=EB=A6=AC=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C=ED=95=9C=20=EC=A3=BC=EC=84=9D=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 166 +----------------- 1 file changed, 5 insertions(+), 161 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 734d4ce4b..dfb384939 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -10,120 +10,15 @@ import UIKit import SnapKit final class DetailWaitViewController: BaseViewController { - -// private enum UserStatus: CaseIterable { -// case owner -// case member -// -// var alertText: (title: String, -// message: String, -// okTitle: String) { -// switch self { -// case .owner: -// return (title: TextLiteral.datailWaitViewControllerDeleteTitle, -// message: TextLiteral.datailWaitViewControllerDeleteMessage, -// okTitle: TextLiteral.delete) -// case .member: -// return (title: TextLiteral.datailWaitViewControllerExitTitle, -// message: TextLiteral.datailWaitViewControllerExitMessage, -// okTitle: TextLiteral.leave) -// } -// } -// } -// -// private enum ButtonText: String { -// case waiting -// case start -// -// var status: String { -// switch self { -// case .waiting: -// return TextLiteral.datailWaitViewControllerButtonWaitingText -// case .start: -// return TextLiteral.datailWaitViewControllerButtonStartText -// } -// } -// } - + // MARK: - ui component private let detailWaitView = DetailWaitView() - -// private let moreButton: UIButton = { -// let button = MoreButton() -// button.showsMenuAsPrimaryAction = true -// return button -// }() -// private let titleView: DetailWaitTitleView = DetailWaitTitleView() -// private let togetherFriendLabel: UILabel = { -// let label = UILabel() -// label.text = TextLiteral.togetherFriend -// label.textColor = .white -// label.font = .font(.regular, ofSize: 16) -// return label -// }() -// private let imgNiView: UIImageView = { -// let imageView = UIImageView() -// imageView.image = ImageLiterals.imgNi -// return imageView -// }() -// private let userCountLabel: UILabel = { -// let label = UILabel() -// label.textColor = .white -// label.font = .font(.regular, ofSize: 14) -// return label -// }() -// private let copyButton: UIButton = { -// let button = UIButton(type: .system) -// button.setTitle(TextLiteral.copyCode, for: .normal) -// button.setTitleColor(.subBlue, for: .normal) -// button.titleLabel?.font = .font(.regular, ofSize: 16) -// return button -// }() -// private let listTableView: UITableView = { -// let tableView = UITableView() -// tableView.layer.cornerRadius = 10 -// tableView.isScrollEnabled = false -// tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") -// return tableView -// }() -// private lazy var startButton: UIButton = { -// let button = MainButton() -// self.detectStartableStatus = { value in -// if value { -// button.title = ButtonText.start.status -// button.isDisabled = false -// let action = UIAction { [weak self] _ in -// self?.requestStartManitto() -// } -// button.addAction(action, for: .touchUpInside) -// } else { -// button.title = ButtonText.waiting.status -// button.isDisabled = true -// } -// } -// return button -// }() // MARK: - property -// private var room: Room? private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) private let roomIndex: Int -// var roomInformation: ParticipatingRoom? -// private var roomInfo: RoomDTO? -// private var userArr: [String] = [] { -// didSet { -// self.setupLayoutTableView() -// } -// } -// private var detectStartableStatus: ((Bool) -> ())? -// private var memberType = UserStatus.member { -// didSet { -// self.moreButton.menu = self.setExitButtonMenu() -// self.setupTitleViewGesture() -// } -// } // MARK: - init @@ -151,59 +46,8 @@ final class DetailWaitViewController: BaseViewController { self.requestWaitRoomInfo() self.configureDelegation() self.configureNavigationController() -// self.setupDelegation() -// self.setupNotificationCenter() -// self.setupCopyButton() } - // MARK: - override - -// override func setupLayout() { -// self.view.addSubview(self.titleView) -// self.titleView.snp.makeConstraints { -// $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) -// $0.top.equalToSuperview().offset(100) -// $0.height.equalTo(86) -// } -// -// self.view.addSubview(self.togetherFriendLabel) -// self.togetherFriendLabel.snp.makeConstraints { -// $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) -// $0.top.equalTo(titleView.snp.bottom).offset(44) -// } -// -// self.view.addSubview(self.imgNiView) -// self.imgNiView.snp.makeConstraints { -// $0.centerY.equalTo(self.togetherFriendLabel.snp.centerY) -// $0.leading.equalTo(self.togetherFriendLabel.snp.trailing).offset(7) -// $0.width.height.equalTo(30) -// } -// -// self.view.addSubview(self.userCountLabel) -// self.userCountLabel.snp.makeConstraints { -// $0.leading.equalTo(self.imgNiView.snp.trailing) -// $0.centerY.equalTo(self.imgNiView.snp.centerY) -// } -// -// self.view.addSubview(self.copyButton) -// self.copyButton.snp.makeConstraints { -// $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) -// $0.centerY.equalTo(self.togetherFriendLabel.snp.centerY) -// } -// -// self.view.addSubview(self.startButton) -// self.startButton.snp.makeConstraints { -// $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) -// $0.bottom.equalToSuperview().inset(65) -// $0.height.equalTo(60) -// } -// } - -// override func configureUI() { -// super.configureUI() -// self.setupSettingButton() -// } - // MARK: - func private func configureDelegation() { @@ -409,19 +253,19 @@ final class DetailWaitViewController: BaseViewController { extension DetailWaitViewController: DetailWaitViewDelegate { func startManitto() { - + print("startManitto") } func presentRoomEditViewController() { - + print("presentRoomEditViewController") } func deleteRoom() { - + print("deleteRoom") } func leaveRoom() { - + print("leaveRoom") } func showAlert(title: String, message: String) { From b734019df13c2feddaa02153c8571d01357469d8 Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 16 Apr 2023 19:21:51 +0900 Subject: [PATCH 010/468] =?UTF-8?q?[FEAT]=20delete=20Delegate=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 43 +++++++++++++------ .../Detail-Wait/View/DetailWaitView.swift | 15 ++++--- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index dfb384939..f402df40a 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -216,19 +216,19 @@ final class DetailWaitViewController: BaseViewController { } } - private func requestDeleteRoom() { + private func requestDeleteRoom(completionHandler: @escaping ((Result) -> Void)) { Task { do { - let status = try await self.detailWaitService.deleteRoom(roomId: "\(roomIndex)") - if status == 204 { - self.navigationController?.popViewController(animated: true) + let statusCode = try await self.detailWaitService.deleteRoom(roomId: "\(roomIndex)") + switch statusCode { + case 200..<300: completionHandler(.success(())) + default: + completionHandler(.failure(.unknownError)) } } catch NetworkError.serverError { - print("server Error") - } catch NetworkError.encodingError { - print("encoding Error") + completionHandler(.failure(.serverError)) } catch NetworkError.clientError(let message) { - print("client Error: \(String(describing: message))") + completionHandler(.failure(.clientError(message: message))) } } } @@ -256,12 +256,31 @@ extension DetailWaitViewController: DetailWaitViewDelegate { print("startManitto") } - func presentRoomEditViewController() { - print("presentRoomEditViewController") + func presentRoomEditViewController(title: String, message: String, okTitle: String) { + self.makeRequestAlert(title: title, + message: message, + okTitle: okTitle, + okAction: { [weak self] _ in + print("presentRoomEditViewController") + }) } - func deleteRoom() { - print("deleteRoom") + func deleteRoom(title: String, message: String, okTitle: String) { + self.makeRequestAlert(title: title, + message: message, + okTitle: okTitle, + okAction: { [weak self] _ in + self?.requestDeleteRoom() { response in + guard let self else { return } + switch response { + case .success: + self.navigationController?.popToViewController(self, animated: true) + case .failure: + // FIXME: - 에러 메시지 추가 + self.makeAlert(title: "에러 메시지 표시하기") + } + } + }) } func leaveRoom() { diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index d7dcfb55e..5eb514a70 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -13,9 +13,9 @@ protocol DetailWaitViewDelegate: AnyObject { // 마니또 시작 func startManitto() // 방 정보 수정 뷰로 이동 - func presentRoomEditViewController() + func presentRoomEditViewController(title: String, message: String, okTitle: String) // 방 삭제 - func deleteRoom() + func deleteRoom(title: String, message: String, okTitle: String) // 방 나가기 func leaveRoom() // 시작 날짜 지남 alert 표시 @@ -256,15 +256,19 @@ final class DetailWaitView: UIView { var children: [UIAction] if isOwner { children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in - self?.delegate?.presentRoomEditViewController() + self?.delegate?.presentRoomEditViewController(title: UserStatus.owner.alertText.title, + message: UserStatus.owner.alertText.message, + okTitle: UserStatus.owner.alertText.okTitle) // self?.presentEditRoomView() }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in + self?.delegate?.deleteRoom(title: UserStatus.owner.alertText.title, + message: UserStatus.owner.alertText.message, + okTitle: UserStatus.owner.alertText.okTitle) // viewController.makeRequestAlert(title: UserStatus.owner.alertText.title, // message: UserStatus.owner.alertText.message, // okTitle: UserStatus.owner.alertText.okTitle, // okAction: { _ in // FIXME: - delegate 연결 - self?.delegate?.deleteRoom() // self?.requestDeleteRoom() // }) }) @@ -289,7 +293,8 @@ final class DetailWaitView: UIView { if !isStart { switch type { case .owner: - self.delegate?.presentRoomEditViewController() + print("") +// self.delegate?.presentRoomEditViewController() // let action: ((UIAlertAction) -> ()) = { [weak self] _ in // self?.editInfoFromDefaultDate(isDateEdit: true) // } From de8c889e520cb73b2b6cb2527bc50de26b13aa42 Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 16 Apr 2023 20:01:05 +0900 Subject: [PATCH 011/468] =?UTF-8?q?[FEAT]=20=EB=B0=A9=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20delegate=20=EC=97=B0=EA=B2=B0=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 43 ++++++++----------- .../Detail-Wait/View/DetailWaitView.swift | 21 +++------ 2 files changed, 26 insertions(+), 38 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index f402df40a..d62820600 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -69,23 +69,23 @@ final class DetailWaitViewController: BaseViewController { // } // copyButton.addAction(action, for: .touchUpInside) // } - -// private func presentDetailEditViewController(startString: String, endString: String, isDateEdit: Bool) { -// guard let title = self.titleView.roomTitleLabel.text else { return } -// let viewController = DetailEditViewController(editMode: isDateEdit ? .date : .information, -// roomIndex: roomIndex, -// title: title) -// viewController.didTappedChangeButton = { [weak self] in -// self?.requestWaitRoomInfo() -// } -// guard let userCount = room?.participants?.count, -// let capacity = room?.roomInformation?.capacity else { return } -// viewController.currentUserCount = userCount -// viewController.sliderValue = capacity -// viewController.startDateText = startString -// viewController.endDateText = endString -// self.present(viewController, animated: true, completion: nil) -// } + + private func presentDetailEditViewController(room: Room, _ isOnlyDateEdit: Bool) { + guard let index = room.roomInformation?.id, + let title = room.roomInformation?.title, + let startDate = room.roomInformation?.startDate, + let endDate = room.roomInformation?.endDate, + let currentUserCount = room.participants?.count, + let capacity = room.roomInformation?.capacity else { return} + let viewController = DetailEditViewController(editMode: isOnlyDateEdit ? .date : .information, + roomIndex: index, + title: title) + viewController.startDateText = startDate + viewController.endDateText = endDate + viewController.currentUserCount = currentUserCount + viewController.sliderValue = capacity + self.present(viewController, animated: true) + } // private func setupSettingButton() { // let rightOffsetSettingButton = super.removeBarButtonItemOffset(with: moreButton, @@ -256,13 +256,8 @@ extension DetailWaitViewController: DetailWaitViewDelegate { print("startManitto") } - func presentRoomEditViewController(title: String, message: String, okTitle: String) { - self.makeRequestAlert(title: title, - message: message, - okTitle: okTitle, - okAction: { [weak self] _ in - print("presentRoomEditViewController") - }) + func presentRoomEditViewController(room: Room, _ isOnlyDateEdit: Bool) { + self.presentDetailEditViewController(room: room, isOnlyDateEdit) } func deleteRoom(title: String, message: String, okTitle: String) { diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 5eb514a70..f9c04fd73 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -13,7 +13,7 @@ protocol DetailWaitViewDelegate: AnyObject { // 마니또 시작 func startManitto() // 방 정보 수정 뷰로 이동 - func presentRoomEditViewController(title: String, message: String, okTitle: String) + func presentRoomEditViewController(room: Room, _ isOnlyDateEdit: Bool) // 방 삭제 func deleteRoom(title: String, message: String, okTitle: String) // 방 나가기 @@ -115,6 +115,7 @@ final class DetailWaitView: UIView { } } + private var roomInformation: Room? private weak var delegate: DetailWaitViewDelegate? // MARK: - init @@ -201,6 +202,7 @@ final class DetailWaitView: UIView { } func configureLayout(room: Room) { + self.roomInformation = room guard let title = room.roomInformation?.title, let state = room.roomInformation?.state, let dateRange = room.roomInformation?.dateRange, @@ -256,21 +258,12 @@ final class DetailWaitView: UIView { var children: [UIAction] if isOwner { children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in - self?.delegate?.presentRoomEditViewController(title: UserStatus.owner.alertText.title, - message: UserStatus.owner.alertText.message, - okTitle: UserStatus.owner.alertText.okTitle) - // self?.presentEditRoomView() + guard let roomInformation = self?.roomInformation else { return } + self?.delegate?.presentRoomEditViewController(room: roomInformation, false) }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in self?.delegate?.deleteRoom(title: UserStatus.owner.alertText.title, - message: UserStatus.owner.alertText.message, - okTitle: UserStatus.owner.alertText.okTitle) -// viewController.makeRequestAlert(title: UserStatus.owner.alertText.title, -// message: UserStatus.owner.alertText.message, -// okTitle: UserStatus.owner.alertText.okTitle, -// okAction: { _ in - // FIXME: - delegate 연결 - // self?.requestDeleteRoom() -// }) + message: UserStatus.owner.alertText.message, + okTitle: UserStatus.owner.alertText.okTitle) }) ] } else { From 4d571c773ebdbe65395828e44149e6e0fb465f1d Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 16 Apr 2023 20:16:57 +0900 Subject: [PATCH 012/468] =?UTF-8?q?[FEAT]=20=EC=8B=9C=EC=9E=91=20=EB=82=A0?= =?UTF-8?q?=EC=A7=9C=20=EC=A7=80=EB=82=AC=EC=9D=84=20=EB=95=8C=20alert=20?= =?UTF-8?q?=ED=91=9C=EC=8B=9C=20=ED=9B=84=20present=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20delegate=20=EC=99=84=EB=A3=8C=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailWaitViewController.swift | 7 +++++++ .../Screens/Detail-Wait/View/DetailWaitView.swift | 11 +++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index d62820600..647237ae2 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -282,6 +282,13 @@ extension DetailWaitViewController: DetailWaitViewDelegate { print("leaveRoom") } + func presentEditViewControllerAfterShowAlert(room: Room) { + self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, + message: TextLiteral.detailWaitViewControllerPastOwnerAlertMessage, + okAction: { _ in self.presentDetailEditViewController(room: room, true) } + ) + } + func showAlert(title: String, message: String) { self.makeAlert(title: title, message: message) } diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index f9c04fd73..cba85c4ef 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -19,6 +19,7 @@ protocol DetailWaitViewDelegate: AnyObject { // 방 나가기 func leaveRoom() // 시작 날짜 지남 alert 표시 + func presentEditViewControllerAfterShowAlert(room: Room) func showAlert(title: String, message: String) } @@ -286,14 +287,8 @@ final class DetailWaitView: UIView { if !isStart { switch type { case .owner: - print("") -// self.delegate?.presentRoomEditViewController() -// let action: ((UIAlertAction) -> ()) = { [weak self] _ in -// self?.editInfoFromDefaultDate(isDateEdit: true) -// } -// viewController.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, -// message: TextLiteral.detailWaitViewControllerPastOwnerAlertMessage, -// okAction: action) + guard let roomInformation = self.roomInformation else { return } + self.delegate?.presentEditViewControllerAfterShowAlert(room: roomInformation) case .member: self.delegate?.showAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, message: TextLiteral.detailWaitViewControllerPastAlertMessage) From a761b35eaccf7fbb1f51f9c8656e10c2549d188b Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 16 Apr 2023 20:31:21 +0900 Subject: [PATCH 013/468] =?UTF-8?q?[FEAT]=20=EC=98=A4=EB=8A=98=EB=B3=B4?= =?UTF-8?q?=EB=8B=A4=20=EA=B3=BC=EA=B1=B0=EC=9D=B8=EC=A7=80=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=20extension=20=EC=B6=94=EA=B0=80=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Extension/Date+Extension.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Manito/Manito/Global/Extension/Date+Extension.swift b/Manito/Manito/Global/Extension/Date+Extension.swift index b7854ee32..35cd96821 100644 --- a/Manito/Manito/Global/Extension/Date+Extension.swift +++ b/Manito/Manito/Global/Extension/Date+Extension.swift @@ -37,4 +37,9 @@ extension Date { var isOpenManitto: Bool { return self.isToday && self.isOverOpenTime } + + func isPast() -> Bool { + let distance = self.distance(to: Date()) + return distance > 86400 + } } From 21571088468c40e4807124a110b3a03131540461 Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 16 Apr 2023 20:32:19 +0900 Subject: [PATCH 014/468] =?UTF-8?q?[CHORE]=20=EB=B0=A9=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EC=88=98=EC=A0=95=20=EB=94=94=ED=8F=B4=ED=8A=B8=20?= =?UTF-8?q?=EB=82=A0=EC=A7=9C=20=EC=B6=94=EA=B0=80=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 45 +++++-------------- 1 file changed, 11 insertions(+), 34 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 647237ae2..2a0db2665 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -80,45 +80,22 @@ final class DetailWaitViewController: BaseViewController { let viewController = DetailEditViewController(editMode: isOnlyDateEdit ? .date : .information, roomIndex: index, title: title) - viewController.startDateText = startDate - viewController.endDateText = endDate + if self.checkStartDateIsPast(startDate) { + let fiveDaysInterval: TimeInterval = 86400 * 4 + viewController.startDateText = Date().dateToString + viewController.endDateText = (Date() + fiveDaysInterval).dateToString + } else { + viewController.startDateText = startDate + viewController.endDateText = endDate + } viewController.currentUserCount = currentUserCount viewController.sliderValue = capacity self.present(viewController, animated: true) } - -// private func setupSettingButton() { -// let rightOffsetSettingButton = super.removeBarButtonItemOffset(with: moreButton, -// offsetX: -10) -// let settingButton = super.makeBarButtonItem(with: rightOffsetSettingButton) -// -// self.navigationItem.rightBarButtonItem = settingButton -// } - - private func presentEditRoomView() { -// guard let roomInformation = self.room?.roomInformation else { return } -// if roomInformation.isAlreadyPastDate { -// self.editInfoFromDefaultDate(isDateEdit: false) -// } else { -// self.editInfoFromCurrentDate() -// } - } - private func editInfoFromDefaultDate(isDateEdit: Bool) { -// let fiveDaysInterval: TimeInterval = 86400 * 4 -// let defaultStartDate = Date().dateToString -// let defaultEndDate = (Date() + fiveDaysInterval).dateToString -// self.presentDetailEditViewController(startString: defaultStartDate, -// endString: defaultEndDate, -// isDateEdit: isDateEdit) - } - - private func editInfoFromCurrentDate() { -// guard let startDate = self.room?.roomInformation?.startDate, -// let endDate = self.room?.roomInformation?.endDate else { return } -// self.presentDetailEditViewController(startString: startDate, -// endString: endDate, -// isDateEdit: false) + private func checkStartDateIsPast(_ startDate: String) -> Bool { + guard let startDate = startDate.stringToDate else { return false } + return startDate.isPast() } // private func setupNotificationCenter() { From 24cbf5e49daea11749a70deed9f9db9c53e5041a Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 16 Apr 2023 20:41:07 +0900 Subject: [PATCH 015/468] =?UTF-8?q?[CHORE]=20=EC=A3=BC=EC=84=9D=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailWaitViewController.swift | 16 ---------------- .../Detail-Wait/View/DetailWaitView.swift | 2 ++ 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 2a0db2665..53f7dc636 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -53,22 +53,6 @@ final class DetailWaitViewController: BaseViewController { private func configureDelegation() { self.detailWaitView.configureDelegation(self) } - -// private func setupDelegation() { -// self.listTableView.delegate = self -// self.listTableView.dataSource = self -// } - -// private func setupCopyButton() { -// let action = UIAction { [weak self] _ in -// if let code = self?.room?.invitation?.code { -// ToastView.showToast(code: code, -// message: TextLiteral.detailWaitViewControllerCopyCode, -// controller: self ?? UIViewController()) -// } -// } -// copyButton.addAction(action, for: .touchUpInside) -// } private func presentDetailEditViewController(room: Room, _ isOnlyDateEdit: Bool) { guard let index = room.roomInformation?.id, diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index cba85c4ef..bf077e8ec 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -102,6 +102,8 @@ final class DetailWaitView: UIView { }() private let startButton: MainButton = MainButton() + // MARK: - property + private var userArray: [User] = [] { didSet { DispatchQueue.main.async { From fd0a3744b2d78d4bf53f9d09ab66814042980dbd Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 16 Apr 2023 20:56:54 +0900 Subject: [PATCH 016/468] =?UTF-8?q?[FEAT]=20=EB=A7=88=EB=8B=88=EB=98=90=20?= =?UTF-8?q?=EC=8B=9C=EC=9E=91=20delegate=20=EC=B6=94=EA=B0=80=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailWaitViewController.swift | 15 +++++++++++---- .../Screens/Detail-Wait/View/DetailWaitView.swift | 11 ++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 53f7dc636..a444290f0 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -98,7 +98,6 @@ final class DetailWaitViewController: BaseViewController { viewController.modalPresentationStyle = .fullScreen viewController.manitteeName = nickname viewController.roomId = self.roomIndex.description -// viewController.roomId = self.roomInformation?.id?.description self.present(viewController, animated: true) } @@ -159,13 +158,13 @@ final class DetailWaitViewController: BaseViewController { } } - private func requestStartManitto() { + private func requestStartManitto(completionHandler: @escaping ((Result) -> Void)) { Task { do { let data = try await self.detailWaitService.startManitto(roomId: "\(roomIndex)") if let manittee = data { guard let nickname = manittee.nickname else { return } - self.presentSelectManittoViewController(nickname: nickname) + completionHandler(.success(nickname)) } } catch NetworkError.serverError { print("server Error") @@ -214,7 +213,15 @@ final class DetailWaitViewController: BaseViewController { extension DetailWaitViewController: DetailWaitViewDelegate { func startManitto() { - print("startManitto") + self.requestStartManitto() { [weak self] result in + switch result { + case .success(let nickname): + self?.presentSelectManittoViewController(nickname: nickname) + case .failure: + // FIXME: - ERROR 추가 + self?.makeAlert(title: "error") + } + } } func presentRoomEditViewController(room: Room, _ isOnlyDateEdit: Bool) { diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index bf077e8ec..6c9a8d6d6 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -10,15 +10,10 @@ import UIKit import SnapKit protocol DetailWaitViewDelegate: AnyObject { - // 마니또 시작 func startManitto() - // 방 정보 수정 뷰로 이동 func presentRoomEditViewController(room: Room, _ isOnlyDateEdit: Bool) - // 방 삭제 func deleteRoom(title: String, message: String, okTitle: String) - // 방 나가기 func leaveRoom() - // 시작 날짜 지남 alert 표시 func presentEditViewControllerAfterShowAlert(room: Room) func showAlert(title: String, message: String) } @@ -114,7 +109,7 @@ final class DetailWaitView: UIView { } private var canStart: Bool = false { didSet { - self.setStartButton(self.canStart) + self.configureStartButton(self.canStart) } } @@ -241,14 +236,12 @@ final class DetailWaitView: UIView { self.startButton.isHidden = !isOwner } - // FIXME: - configureStartButton이 더 났나? - private func setStartButton(_ canStart: Bool) { + private func configureStartButton(_ canStart: Bool) { if canStart { self.startButton.title = ButtonText.start.status self.startButton.isDisabled = false let action = UIAction { [weak self] _ in self?.delegate?.startManitto() -// self?.requestStartManitto() } self.startButton.addAction(action, for: .touchUpInside) } else { From 035fece58c5c138d6d30b4cb511b25cb9505c55c Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 16 Apr 2023 20:57:52 +0900 Subject: [PATCH 017/468] =?UTF-8?q?[CHORE]=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/DetailWaitViewController.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index a444290f0..7e6dcd5be 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -167,11 +167,9 @@ final class DetailWaitViewController: BaseViewController { completionHandler(.success(nickname)) } } catch NetworkError.serverError { - print("server Error") - } catch NetworkError.encodingError { - print("encoding Error") + completionHandler(.failure(.serverError)) } catch NetworkError.clientError(let message) { - print("client Error: \(String(describing: message))") + completionHandler(.failure(.clientError(message: message))) } } } From e588da966320b3ad154120da90d206b6e3ca3921 Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 16 Apr 2023 21:20:52 +0900 Subject: [PATCH 018/468] =?UTF-8?q?[FEAT]=20=EB=B0=A9=20=EB=82=98=EA=B0=80?= =?UTF-8?q?=EA=B8=B0=20delegate=20=EC=B6=94=EA=B0=80=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 7e6dcd5be..637e9dd23 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -191,19 +191,19 @@ final class DetailWaitViewController: BaseViewController { } } - private func requestDeleteLeaveRoom() { + // FIXME: - 나가기 테스트 해야함 + private func requestDeleteLeaveRoom(completionHandler: @escaping ((Result) -> Void)) { Task { do { - let status = try await self.detailWaitService.deleteLeaveRoom(roomId: "\(roomIndex)") - if status == 204 { - self.navigationController?.popViewController(animated: true) + let statusCode = try await self.detailWaitService.deleteLeaveRoom(roomId: "\(roomIndex)") + switch statusCode { + case 200..<300: completionHandler(.success(())) + default: completionHandler(.failure(.unknownError)) } } catch NetworkError.serverError { - print("server Error") - } catch NetworkError.encodingError { - print("encoding Error") + completionHandler(.failure(.serverError)) } catch NetworkError.clientError(let message) { - print("client Error: \(String(describing: message))") + completionHandler(.failure(.clientError(message: message))) } } } @@ -231,21 +231,27 @@ extension DetailWaitViewController: DetailWaitViewDelegate { message: message, okTitle: okTitle, okAction: { [weak self] _ in - self?.requestDeleteRoom() { response in - guard let self else { return } - switch response { + self?.requestDeleteRoom() { result in + switch result { case .success: - self.navigationController?.popToViewController(self, animated: true) + self?.navigationController?.popViewController(animated: true) case .failure: // FIXME: - 에러 메시지 추가 - self.makeAlert(title: "에러 메시지 표시하기") + self?.makeAlert(title: "에러 메시지 표시하기") } } }) } func leaveRoom() { - print("leaveRoom") + self.requestDeleteLeaveRoom() { [weak self] result in + switch result { + case .success: + self?.navigationController?.popViewController(animated: true) + case .failure: + self?.makeAlert(title: "error") + } + } } func presentEditViewControllerAfterShowAlert(room: Room) { From 45ef643fd029924c1dbfb4a5da29074433dd97ab Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 16 Apr 2023 21:24:14 +0900 Subject: [PATCH 019/468] =?UTF-8?q?[CHORE]=20=EB=B0=A9=20=EB=82=98?= =?UTF-8?q?=EA=B0=80=EA=B8=B0=20alert=20=EC=B6=94=EA=B0=80=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 20 +++++++++++-------- .../Detail-Wait/View/DetailWaitView.swift | 7 +++++-- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 637e9dd23..3f913022b 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -243,15 +243,19 @@ extension DetailWaitViewController: DetailWaitViewDelegate { }) } - func leaveRoom() { - self.requestDeleteLeaveRoom() { [weak self] result in - switch result { - case .success: - self?.navigationController?.popViewController(animated: true) - case .failure: - self?.makeAlert(title: "error") + func leaveRoom(title: String, message: String, okTitle: String) { + self.makeRequestAlert(title: title, + message: message, + okAction: { [weak self] _ in + self?.requestDeleteLeaveRoom() { result in + switch result { + case .success: + self?.navigationController?.popViewController(animated: true) + case .failure: + self?.makeAlert(title: "error") + } } - } + }) } func presentEditViewControllerAfterShowAlert(room: Room) { diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 6c9a8d6d6..022a80a54 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -13,7 +13,7 @@ protocol DetailWaitViewDelegate: AnyObject { func startManitto() func presentRoomEditViewController(room: Room, _ isOnlyDateEdit: Bool) func deleteRoom(title: String, message: String, okTitle: String) - func leaveRoom() + func leaveRoom(title: String, message: String, okTitle: String) func presentEditViewControllerAfterShowAlert(room: Room) func showAlert(title: String, message: String) } @@ -268,7 +268,10 @@ final class DetailWaitView: UIView { // message: UserStatus.member.alertText.message, // okTitle: UserStatus.member.alertText.okTitle, // okAction: { _ in - self?.delegate?.leaveRoom() + self?.delegate?.leaveRoom(title: UserStatus.member.alertText.title, + message: UserStatus.member.alertText.message, + okTitle: UserStatus.member.alertText.okTitle + ) // self?.requestDeleteLeaveRoom() // }) })] From 7c130f7c19727f21539c05a533faf28b68d741a0 Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 16 Apr 2023 21:27:33 +0900 Subject: [PATCH 020/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 84 +++++++++---------- .../Detail-Wait/View/DetailWaitView.swift | 22 ++--- 2 files changed, 50 insertions(+), 56 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 3f913022b..a0d83b610 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -2,7 +2,7 @@ // DetailWaitViewController.swift // Manito // -// Created by SHIN YOON AH on 2022/06/09. +// Created by Mingwan Choi on 2023/04/15. // import UIKit @@ -19,7 +19,7 @@ final class DetailWaitViewController: BaseViewController { private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) private let roomIndex: Int - + // MARK: - init init(index: Int) { @@ -40,7 +40,7 @@ final class DetailWaitViewController: BaseViewController { override func loadView() { self.view = self.detailWaitView } - + override func viewDidLoad() { super.viewDidLoad() self.requestWaitRoomInfo() @@ -81,17 +81,17 @@ final class DetailWaitViewController: BaseViewController { guard let startDate = startDate.stringToDate else { return false } return startDate.isPast() } - -// private func setupNotificationCenter() { -// NotificationCenter.default.addObserver(self, selector: #selector(self.didTapEnterButton), name: .createRoomInvitedCode, object: nil) -// } -// private func setupTitleViewGesture() { -// if self.memberType == .owner { -// let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.presentEditViewController)) -// self.titleView.addGestureRecognizer(tapGesture) -// } -// } + // private func setupNotificationCenter() { + // NotificationCenter.default.addObserver(self, selector: #selector(self.didTapEnterButton), name: .createRoomInvitedCode, object: nil) + // } + + // private func setupTitleViewGesture() { + // if self.memberType == .owner { + // let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.presentEditViewController)) + // self.titleView.addGestureRecognizer(tapGesture) + // } + // } private func presentSelectManittoViewController(nickname: String) { let viewController = SelectManittoViewController() @@ -105,37 +105,37 @@ final class DetailWaitViewController: BaseViewController { guard let navigationController = self.navigationController else { return } self.detailWaitView.configureNavigationItem(navigationController) } - + // MARK: - selector -// @objc -// private func didTapEnterButton() { -// guard let roomInfo = self.roomInfo, -// let code = self.room?.invitation?.code else { return } -// let viewController = InvitedCodeViewController(roomInfo: RoomDTO(title: roomInfo.title, -// capacity: roomInfo.capacity, -// startDate: roomInfo.startDate, -// endDate: roomInfo.endDate), -// code: code) -// viewController.roomInfo = roomInfo -// viewController.modalPresentationStyle = .overCurrentContext -// viewController.modalTransitionStyle = .crossDissolve -// self.present(viewController, animated: true) -// } - -// @objc -// private func presentEditViewController() { -// guard let startDate = self.room?.roomInformation?.startDate, -// let endDate = self.room?.roomInformation?.endDate else { return } -// self.presentDetailEditViewController(startString: startDate, -// endString: endDate, -// isDateEdit: false) -// } - -// @objc -// private func changeStartButton() { -// self.setStartButton() -// } + // @objc + // private func didTapEnterButton() { + // guard let roomInfo = self.roomInfo, + // let code = self.room?.invitation?.code else { return } + // let viewController = InvitedCodeViewController(roomInfo: RoomDTO(title: roomInfo.title, + // capacity: roomInfo.capacity, + // startDate: roomInfo.startDate, + // endDate: roomInfo.endDate), + // code: code) + // viewController.roomInfo = roomInfo + // viewController.modalPresentationStyle = .overCurrentContext + // viewController.modalTransitionStyle = .crossDissolve + // self.present(viewController, animated: true) + // } + + // @objc + // private func presentEditViewController() { + // guard let startDate = self.room?.roomInformation?.startDate, + // let endDate = self.room?.roomInformation?.endDate else { return } + // self.presentDetailEditViewController(startString: startDate, + // endString: endDate, + // isDateEdit: false) + // } + + // @objc + // private func changeStartButton() { + // self.setStartButton() + // } // MARK: - network diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 022a80a54..917895f6b 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -22,7 +22,7 @@ final class DetailWaitView: UIView { private enum UserStatus: CaseIterable { case owner case member - + var alertText: (title: String, message: String, okTitle: String) { @@ -38,7 +38,7 @@ final class DetailWaitView: UIView { } } } - + private enum ButtonText: String { case waiting case start @@ -137,26 +137,26 @@ final class DetailWaitView: UIView { $0.top.equalToSuperview().offset(100) $0.height.equalTo(86) } - + self.addSubview(self.togetherFriendLabel) self.togetherFriendLabel.snp.makeConstraints { $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) $0.top.equalTo(titleView.snp.bottom).offset(44) } - + self.addSubview(self.imgNiView) self.imgNiView.snp.makeConstraints { $0.centerY.equalTo(self.togetherFriendLabel.snp.centerY) $0.leading.equalTo(self.togetherFriendLabel.snp.trailing).offset(7) $0.width.height.equalTo(30) } - + self.addSubview(self.userCountLabel) self.userCountLabel.snp.makeConstraints { $0.leading.equalTo(self.imgNiView.snp.trailing) $0.centerY.equalTo(self.imgNiView.snp.centerY) } - + self.addSubview(self.copyButton) self.copyButton.snp.makeConstraints { $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) @@ -170,7 +170,7 @@ final class DetailWaitView: UIView { $0.centerX.equalToSuperview() $0.height.equalTo(44) } - + self.addSubview(self.startButton) self.startButton.snp.makeConstraints { $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) @@ -264,16 +264,10 @@ final class DetailWaitView: UIView { ] } else { children = [UIAction(title: TextLiteral.detailWaitViewControllerLeaveRoom, handler: { [weak self] _ in -// viewController.makeRequestAlert(title: UserStatus.member.alertText.title, -// message: UserStatus.member.alertText.message, -// okTitle: UserStatus.member.alertText.okTitle, -// okAction: { _ in self?.delegate?.leaveRoom(title: UserStatus.member.alertText.title, message: UserStatus.member.alertText.message, okTitle: UserStatus.member.alertText.okTitle ) - // self?.requestDeleteLeaveRoom() -// }) })] } let menu = UIMenu(children: children) @@ -305,7 +299,7 @@ extension DetailWaitView: UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return self.userArray.count } - + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = self.listTableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as UITableViewCell cell.textLabel?.text = self.userArray[indexPath.row].nickname From 3787cacae3e5cd7d67b93dfcec28deb8dfebc7e5 Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 16 Apr 2023 21:33:58 +0900 Subject: [PATCH 021/468] =?UTF-8?q?[FEAT]=20=EB=B0=A9=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20view=20tapGesture=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailWaitViewController.swift | 16 ++++++++-------- .../Detail-Wait/View/DetailWaitView.swift | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index a0d83b610..8b3b21908 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -123,14 +123,14 @@ final class DetailWaitViewController: BaseViewController { // self.present(viewController, animated: true) // } - // @objc - // private func presentEditViewController() { - // guard let startDate = self.room?.roomInformation?.startDate, - // let endDate = self.room?.roomInformation?.endDate else { return } - // self.presentDetailEditViewController(startString: startDate, - // endString: endDate, - // isDateEdit: false) - // } +// @objc +// private func presentEditViewController() { +// guard let startDate = self.room?.roomInformation?.startDate, +// let endDate = self.room?.roomInformation?.endDate else { return } +// self.presentDetailEditViewController(startString: startDate, +// endString: endDate, +// isDateEdit: false) +// } // @objc // private func changeStartButton() { diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 917895f6b..038c811e3 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -219,6 +219,7 @@ final class DetailWaitView: UIView { self.setExitButtonMenu(isOwner) self.setupCopyButton(code) self.showAlertWhenPastDate(isOwner, isStart: isStart) + self.setupTitleViewGesture(isOwner) } private func updateTableViewHeight() { @@ -287,6 +288,21 @@ final class DetailWaitView: UIView { } } } + + private func setupTitleViewGesture(_ isOwner: Bool) { + if isOwner { + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.presentEditViewController)) + self.titleView.addGestureRecognizer(tapGesture) + } + } + + // MARK: - selector + + @objc + private func presentEditViewController() { + guard let roomInformation = self.roomInformation else { return } + self.delegate?.presentRoomEditViewController(room: roomInformation, false) + } } extension DetailWaitView: UITableViewDelegate { From a78eabb08f870ad7c2c202ca2d7462050c11e43e Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 16 Apr 2023 21:35:23 +0900 Subject: [PATCH 022/468] =?UTF-8?q?[CHORE]=20=EC=A3=BC=EC=84=9D=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 8b3b21908..0068fb985 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -86,13 +86,6 @@ final class DetailWaitViewController: BaseViewController { // NotificationCenter.default.addObserver(self, selector: #selector(self.didTapEnterButton), name: .createRoomInvitedCode, object: nil) // } - // private func setupTitleViewGesture() { - // if self.memberType == .owner { - // let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.presentEditViewController)) - // self.titleView.addGestureRecognizer(tapGesture) - // } - // } - private func presentSelectManittoViewController(nickname: String) { let viewController = SelectManittoViewController() viewController.modalPresentationStyle = .fullScreen @@ -123,20 +116,6 @@ final class DetailWaitViewController: BaseViewController { // self.present(viewController, animated: true) // } -// @objc -// private func presentEditViewController() { -// guard let startDate = self.room?.roomInformation?.startDate, -// let endDate = self.room?.roomInformation?.endDate else { return } -// self.presentDetailEditViewController(startString: startDate, -// endString: endDate, -// isDateEdit: false) -// } - - // @objc - // private func changeStartButton() { - // self.setStartButton() - // } - // MARK: - network private func requestWaitRoomInfo() { From a1eb16852c56ee593d975a2abd4ee8307a599417 Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 16 Apr 2023 21:41:33 +0900 Subject: [PATCH 023/468] =?UTF-8?q?[ADD]=20=EC=98=A4=EB=A5=98=20=EB=A9=94?= =?UTF-8?q?=EC=8B=9C=EC=A7=80=20Alert=20=EC=B6=94=EA=B0=80=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Literal/TextLiteral.swift | 6 ++++++ .../Detail-Wait/DetailWaitViewController.swift | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Manito/Manito/Global/Literal/TextLiteral.swift b/Manito/Manito/Global/Literal/TextLiteral.swift index ad1cd40e1..7dcfb8dc5 100644 --- a/Manito/Manito/Global/Literal/TextLiteral.swift +++ b/Manito/Manito/Global/Literal/TextLiteral.swift @@ -179,6 +179,12 @@ enum TextLiteral { static let detailWaitViewControllerPastAlertTitle: String = "마니또 시작일이 지났어요" static let detailWaitViewControllerPastAlertMessage: String = "방장이 진행기간을 재설정 \n 할 때까지 기다려주세요." static let detailWaitViewControllerPastOwnerAlertMessage: String = "진행기간을 재설정 해주세요" + static let detailWaitViewControllerDeleteErrorTitle: String = "오류 발생" + static let detailWaitViewControllerDeleteErrorMessage: String = "방 삭제에 실패했습니다. 다시 시도해주세요" + static let detailWaitViewControllerStartErrorTitle: String = "오류 발생" + static let detailWaitViewControllerStartErrorMessage: String = "마니또 시작에 실패했습니다. 다시 시도해주세요" + static let detailWaitViewControllerLeaveErrorTitle: String = "오류 발생" + static let detailWaitViewControllerLeaveErrorMessage: String = "방 나가기에 실패했습니다. 다시 시도해주세요" // MARK: - MemoryViewController static let memoryViewControllerTitleLabel: String = "함께 했던 기록" diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 0068fb985..fabe70581 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -195,8 +195,8 @@ extension DetailWaitViewController: DetailWaitViewDelegate { case .success(let nickname): self?.presentSelectManittoViewController(nickname: nickname) case .failure: - // FIXME: - ERROR 추가 - self?.makeAlert(title: "error") + self?.makeAlert(title: TextLiteral.detailWaitViewControllerStartErrorTitle, + message: TextLiteral.detailWaitViewControllerStartErrorMessage) } } } @@ -215,8 +215,8 @@ extension DetailWaitViewController: DetailWaitViewDelegate { case .success: self?.navigationController?.popViewController(animated: true) case .failure: - // FIXME: - 에러 메시지 추가 - self?.makeAlert(title: "에러 메시지 표시하기") + self?.makeAlert(title: TextLiteral.detailWaitViewControllerDeleteErrorTitle, + message: TextLiteral.detailWaitViewControllerDeleteErrorMessage) } } }) @@ -231,7 +231,8 @@ extension DetailWaitViewController: DetailWaitViewDelegate { case .success: self?.navigationController?.popViewController(animated: true) case .failure: - self?.makeAlert(title: "error") + self?.makeAlert(title: TextLiteral.detailWaitViewControllerLeaveErrorTitle, + message: TextLiteral.detailWaitViewControllerLeaveErrorMessage) } } }) From b45956602bde0b579f58e6ad807de84f5b44a153 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 18 Apr 2023 22:45:06 +0900 Subject: [PATCH 024/468] =?UTF-8?q?[CHORE]=20roomIndex=20=EB=B3=80?= =?UTF-8?q?=EC=88=98=EB=AA=85=20=EB=B3=80=EA=B2=BD=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChooseCharacter/ChooseCharacterViewController.swift | 4 ++-- Manito/Manito/Screens/Main/MainViewController.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index 2c8edb1fc..54297b78a 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -181,7 +181,7 @@ class ChooseCharacterViewController: BaseViewController { let roomId = try await roomService.postCreateRoom(body: room), let navigationController = self.presentingViewController as? UINavigationController else { return } - let viewController = DetailWaitViewController(index: roomId) + let viewController = DetailWaitViewController(roomIndex: roomId) navigationController.popViewController(animated: true) navigationController.pushViewController(viewController, animated: false) @@ -209,7 +209,7 @@ class ChooseCharacterViewController: BaseViewController { if status == 201 { guard let navigationController = self.presentingViewController as? UINavigationController else { return } guard let id = self.roomId else { return } - let viewController = DetailWaitViewController(index: id) + let viewController = DetailWaitViewController(roomIndex: id) self.dismiss(animated: true) { navigationController.pushViewController(viewController, animated: true) } diff --git a/Manito/Manito/Screens/Main/MainViewController.swift b/Manito/Manito/Screens/Main/MainViewController.swift index 26ccc7bb1..89e6526ae 100644 --- a/Manito/Manito/Screens/Main/MainViewController.swift +++ b/Manito/Manito/Screens/Main/MainViewController.swift @@ -272,7 +272,7 @@ final class MainViewController: BaseViewController { switch status { case .waiting: guard let index = index else { return } - let viewController = DetailWaitViewController(index: index) + let viewController = DetailWaitViewController(roomIndex: index) self.navigationController?.pushViewController(viewController, animated: true) default: guard let roomId = rooms?[roomIndex].id?.description From 44bb5b54042133fe39358c8cb014e2fdd948f6ee Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 18 Apr 2023 23:25:34 +0900 Subject: [PATCH 025/468] =?UTF-8?q?[CHORE]=20=EB=B0=A9=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EB=B6=88=EB=9F=AC=EC=98=A4=EA=B8=B0=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20escaping=20=EC=A0=81=EC=9A=A9=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Global/Literal/TextLiteral.swift | 2 + .../DetailWaitViewController.swift | 50 ++++++++----------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/Manito/Manito/Global/Literal/TextLiteral.swift b/Manito/Manito/Global/Literal/TextLiteral.swift index 7dcfb8dc5..132d199c8 100644 --- a/Manito/Manito/Global/Literal/TextLiteral.swift +++ b/Manito/Manito/Global/Literal/TextLiteral.swift @@ -185,6 +185,8 @@ enum TextLiteral { static let detailWaitViewControllerStartErrorMessage: String = "마니또 시작에 실패했습니다. 다시 시도해주세요" static let detailWaitViewControllerLeaveErrorTitle: String = "오류 발생" static let detailWaitViewControllerLeaveErrorMessage: String = "방 나가기에 실패했습니다. 다시 시도해주세요" + static let detailWaitViewControllerLoadDataTitle: String = "오류 발생" + static let detailWaitViewControllerLoadDataMessage: String = "방 정보를 불러올 수 없습니다. 다시 시도해주세요" // MARK: - MemoryViewController static let memoryViewControllerTitleLabel: String = "함께 했던 기록" diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index fabe70581..7907b9a8a 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -22,11 +22,12 @@ final class DetailWaitViewController: BaseViewController { // MARK: - init - init(index: Int) { - self.roomIndex = index + init(roomIndex: Int) { + self.roomIndex = roomIndex super.init() } + @available(*, unavailable) required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } @@ -43,7 +44,7 @@ final class DetailWaitViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() - self.requestWaitRoomInfo() + self.fetchRoomData() self.configureDelegation() self.configureNavigationController() } @@ -60,7 +61,7 @@ final class DetailWaitViewController: BaseViewController { let startDate = room.roomInformation?.startDate, let endDate = room.roomInformation?.endDate, let currentUserCount = room.participants?.count, - let capacity = room.roomInformation?.capacity else { return} + let capacity = room.roomInformation?.capacity else { return } let viewController = DetailEditViewController(editMode: isOnlyDateEdit ? .date : .information, roomIndex: index, title: title) @@ -99,40 +100,33 @@ final class DetailWaitViewController: BaseViewController { self.detailWaitView.configureNavigationItem(navigationController) } - // MARK: - selector - - // @objc - // private func didTapEnterButton() { - // guard let roomInfo = self.roomInfo, - // let code = self.room?.invitation?.code else { return } - // let viewController = InvitedCodeViewController(roomInfo: RoomDTO(title: roomInfo.title, - // capacity: roomInfo.capacity, - // startDate: roomInfo.startDate, - // endDate: roomInfo.endDate), - // code: code) - // viewController.roomInfo = roomInfo - // viewController.modalPresentationStyle = .overCurrentContext - // viewController.modalTransitionStyle = .crossDissolve - // self.present(viewController, animated: true) - // } + private func fetchRoomData() { + self.requestWaitRoomInfo() { [weak self] result in + switch result { + case .success(let room): + DispatchQueue.main.async { + self?.detailWaitView.configureLayout(room: room) + } + case .failure: + self?.makeAlert(title: TextLiteral.detailWaitViewControllerLoadDataTitle, + message: TextLiteral.detailWaitViewControllerLoadDataMessage) + } + } + } // MARK: - network - private func requestWaitRoomInfo() { + private func requestWaitRoomInfo(completionHandler: @escaping ((Result) -> Void)) { Task { do { let data = try await self.detailWaitService.getWaitingRoomInfo(roomId: "\(roomIndex)") if let roomInfo = data { - DispatchQueue.main.async { - self.detailWaitView.configureLayout(room: roomInfo) - } + completionHandler(.success(roomInfo)) } } catch NetworkError.serverError { - print("server Error") - } catch NetworkError.encodingError { - print("encoding Error") + completionHandler(.failure(.serverError)) } catch NetworkError.clientError(let message) { - print("client Error: \(String(describing: message))") + completionHandler(.failure(.clientError(message: message))) } } } From 7ddade0b9820d25ab54f26fd3e4f23b3b1bd87bf Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 18 Apr 2023 23:33:53 +0900 Subject: [PATCH 026/468] =?UTF-8?q?[CHORE]=20view=EC=97=90=EC=84=9C=20room?= =?UTF-8?q?=EB=B3=80=EC=88=98=20=EC=82=AD=EC=A0=9C=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailWaitViewController.swift | 16 ++++++++++------ .../Detail-Wait/View/DetailWaitView.swift | 17 +++++++---------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 7907b9a8a..6d4187481 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -19,6 +19,7 @@ final class DetailWaitViewController: BaseViewController { private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) private let roomIndex: Int + private var roomInformation: Room? // MARK: - init @@ -55,8 +56,9 @@ final class DetailWaitViewController: BaseViewController { self.detailWaitView.configureDelegation(self) } - private func presentDetailEditViewController(room: Room, _ isOnlyDateEdit: Bool) { - guard let index = room.roomInformation?.id, + private func presentDetailEditViewController(isOnlyDateEdit: Bool) { + guard let room = self.roomInformation, + let index = room.roomInformation?.id, let title = room.roomInformation?.title, let startDate = room.roomInformation?.startDate, let endDate = room.roomInformation?.endDate, @@ -121,6 +123,7 @@ final class DetailWaitViewController: BaseViewController { do { let data = try await self.detailWaitService.getWaitingRoomInfo(roomId: "\(roomIndex)") if let roomInfo = data { + self.roomInformation = roomInfo completionHandler(.success(roomInfo)) } } catch NetworkError.serverError { @@ -195,8 +198,8 @@ extension DetailWaitViewController: DetailWaitViewDelegate { } } - func presentRoomEditViewController(room: Room, _ isOnlyDateEdit: Bool) { - self.presentDetailEditViewController(room: room, isOnlyDateEdit) + func presentRoomEditViewController(isOnlyDateEdit: Bool) { + self.presentDetailEditViewController(isOnlyDateEdit: isOnlyDateEdit) } func deleteRoom(title: String, message: String, okTitle: String) { @@ -232,10 +235,11 @@ extension DetailWaitViewController: DetailWaitViewDelegate { }) } - func presentEditViewControllerAfterShowAlert(room: Room) { + func presentEditViewControllerAfterShowAlert() { self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, message: TextLiteral.detailWaitViewControllerPastOwnerAlertMessage, - okAction: { _ in self.presentDetailEditViewController(room: room, true) } + okAction: { [weak self] _ in + self?.presentDetailEditViewController(isOnlyDateEdit: true) } ) } diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 038c811e3..cb5633bb0 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -11,10 +11,10 @@ import SnapKit protocol DetailWaitViewDelegate: AnyObject { func startManitto() - func presentRoomEditViewController(room: Room, _ isOnlyDateEdit: Bool) + func presentRoomEditViewController(isOnlyDateEdit: Bool) func deleteRoom(title: String, message: String, okTitle: String) func leaveRoom(title: String, message: String, okTitle: String) - func presentEditViewControllerAfterShowAlert(room: Room) + func presentEditViewControllerAfterShowAlert() func showAlert(title: String, message: String) } @@ -113,7 +113,7 @@ final class DetailWaitView: UIView { } } - private var roomInformation: Room? +// private var roomInformation: Room? private weak var delegate: DetailWaitViewDelegate? // MARK: - init @@ -200,7 +200,7 @@ final class DetailWaitView: UIView { } func configureLayout(room: Room) { - self.roomInformation = room +// self.roomInformation = room guard let title = room.roomInformation?.title, let state = room.roomInformation?.state, let dateRange = room.roomInformation?.dateRange, @@ -255,8 +255,7 @@ final class DetailWaitView: UIView { var children: [UIAction] if isOwner { children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in - guard let roomInformation = self?.roomInformation else { return } - self?.delegate?.presentRoomEditViewController(room: roomInformation, false) + self?.delegate?.presentRoomEditViewController(isOnlyDateEdit: false) }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in self?.delegate?.deleteRoom(title: UserStatus.owner.alertText.title, message: UserStatus.owner.alertText.message, @@ -280,8 +279,7 @@ final class DetailWaitView: UIView { if !isStart { switch type { case .owner: - guard let roomInformation = self.roomInformation else { return } - self.delegate?.presentEditViewControllerAfterShowAlert(room: roomInformation) + self.delegate?.presentEditViewControllerAfterShowAlert() case .member: self.delegate?.showAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, message: TextLiteral.detailWaitViewControllerPastAlertMessage) @@ -300,8 +298,7 @@ final class DetailWaitView: UIView { @objc private func presentEditViewController() { - guard let roomInformation = self.roomInformation else { return } - self.delegate?.presentRoomEditViewController(room: roomInformation, false) + self.delegate?.presentRoomEditViewController(isOnlyDateEdit: false) } } From db0ee1dab280f8046f49210b957e0f6f7df69512 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 18 Apr 2023 23:36:15 +0900 Subject: [PATCH 027/468] =?UTF-8?q?[CHORE]=20=EC=A3=BC=EC=84=9D=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/DetailWaitViewController.swift | 4 ---- Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift | 2 -- 2 files changed, 6 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 6d4187481..424f22d1c 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -85,10 +85,6 @@ final class DetailWaitViewController: BaseViewController { return startDate.isPast() } - // private func setupNotificationCenter() { - // NotificationCenter.default.addObserver(self, selector: #selector(self.didTapEnterButton), name: .createRoomInvitedCode, object: nil) - // } - private func presentSelectManittoViewController(nickname: String) { let viewController = SelectManittoViewController() viewController.modalPresentationStyle = .fullScreen diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index cb5633bb0..6bfd2bc50 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -113,7 +113,6 @@ final class DetailWaitView: UIView { } } -// private var roomInformation: Room? private weak var delegate: DetailWaitViewDelegate? // MARK: - init @@ -200,7 +199,6 @@ final class DetailWaitView: UIView { } func configureLayout(room: Room) { -// self.roomInformation = room guard let title = room.roomInformation?.title, let state = room.roomInformation?.state, let dateRange = room.roomInformation?.dateRange, From 37614206227ab15381557a7e8f7eedbf79865dc5 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 18 Apr 2023 23:45:26 +0900 Subject: [PATCH 028/468] =?UTF-8?q?[CHORE]=20roomIndex=20decription=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/DetailWaitViewController.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 424f22d1c..66059005f 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -117,7 +117,7 @@ final class DetailWaitViewController: BaseViewController { private func requestWaitRoomInfo(completionHandler: @escaping ((Result) -> Void)) { Task { do { - let data = try await self.detailWaitService.getWaitingRoomInfo(roomId: "\(roomIndex)") + let data = try await self.detailWaitService.getWaitingRoomInfo(roomId: self.roomIndex.description) if let roomInfo = data { self.roomInformation = roomInfo completionHandler(.success(roomInfo)) @@ -133,7 +133,7 @@ final class DetailWaitViewController: BaseViewController { private func requestStartManitto(completionHandler: @escaping ((Result) -> Void)) { Task { do { - let data = try await self.detailWaitService.startManitto(roomId: "\(roomIndex)") + let data = try await self.detailWaitService.startManitto(roomId: self.roomIndex.description) if let manittee = data { guard let nickname = manittee.nickname else { return } completionHandler(.success(nickname)) @@ -149,7 +149,7 @@ final class DetailWaitViewController: BaseViewController { private func requestDeleteRoom(completionHandler: @escaping ((Result) -> Void)) { Task { do { - let statusCode = try await self.detailWaitService.deleteRoom(roomId: "\(roomIndex)") + let statusCode = try await self.detailWaitService.deleteRoom(roomId: self.roomIndex.description) switch statusCode { case 200..<300: completionHandler(.success(())) default: @@ -167,7 +167,7 @@ final class DetailWaitViewController: BaseViewController { private func requestDeleteLeaveRoom(completionHandler: @escaping ((Result) -> Void)) { Task { do { - let statusCode = try await self.detailWaitService.deleteLeaveRoom(roomId: "\(roomIndex)") + let statusCode = try await self.detailWaitService.deleteLeaveRoom(roomId: self.roomIndex.description) switch statusCode { case 200..<300: completionHandler(.success(())) default: completionHandler(.failure(.unknownError)) From 67c27534601bf195cbfdb76c40b1433b20568d3d Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 20 Apr 2023 15:03:17 +0900 Subject: [PATCH 029/468] =?UTF-8?q?[ADD]=20DetailEdit=20View=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 + .../Detail-Wait/View/DetailEditView.swift | 181 ++++++++++++++++++ 2 files changed, 185 insertions(+) create mode 100644 Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index b0f8ca4af..2c51de639 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -19,6 +19,7 @@ 397A241428BA516B00454E4F /* DetailWaitAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241328BA516B00454E4F /* DetailWaitAPI.swift */; }; 397A241828BA51B400454E4F /* DetailWaitProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */; }; 397A241A28BA532A00454E4F /* FriendList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241928BA532A00454E4F /* FriendList.swift */; }; + 398B1C9B29F10B0300DEFCEC /* DetailEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 398B1C9A29F10B0300DEFCEC /* DetailEditView.swift */; }; 399D17AB2856C83B00F50D9D /* DetailEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */; }; 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */; }; 39C957D02879521400A04A2B /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CF2879521400A04A2B /* String+Extension.swift */; }; @@ -180,6 +181,7 @@ 397A241328BA516B00454E4F /* DetailWaitAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitAPI.swift; sourceTree = ""; }; 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitProtocol.swift; sourceTree = ""; }; 397A241928BA532A00454E4F /* FriendList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendList.swift; sourceTree = ""; }; + 398B1C9A29F10B0300DEFCEC /* DetailEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailEditView.swift; sourceTree = ""; }; 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailEditViewController.swift; sourceTree = ""; }; 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; 39C957CF2879521400A04A2B /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = ""; }; @@ -357,6 +359,7 @@ isa = PBXGroup; children = ( 391612D729E9231B004AE982 /* DetailWaitView.swift */, + 398B1C9A29F10B0300DEFCEC /* DetailEditView.swift */, ); path = View; sourceTree = ""; @@ -1185,6 +1188,7 @@ B5F5250E2851A07700614FF7 /* LetterViewController.swift in Sources */, B5F5251C2851A19A00614FF7 /* BaseCollectionViewCell.swift in Sources */, B5F525082851A05E00614FF7 /* InvitedCodeViewController.swift in Sources */, + 398B1C9B29F10B0300DEFCEC /* DetailEditView.swift in Sources */, B50B1AFD2856C3500080992C /* CreateLetterTextView.swift in Sources */, D77224DF285DDAB7008B760B /* Notification+Extension.swift in Sources */, B5706BF629B9D4650093D198 /* GuideView.swift in Sources */, diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift new file mode 100644 index 000000000..9bbfca907 --- /dev/null +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -0,0 +1,181 @@ +// +// DetailEditView.swift +// Manito +// +// Created by Mingwan Choi on 2023/04/20. +// + +import UIKit + +import SnapKit + +final class DetailEditView: UIView { + + // MARK: - ui component + + private let cancelButton: UIButton = { + let button = UIButton(type: .system) + button.setTitle(TextLiteral.cancel, for: .normal) + button.setTitleColor(.white, for: .normal) + button.titleLabel?.font = .font(.regular, ofSize: 16) + return button + }() + private let topIndicatorView: UIView = { + let view = UIView() + view.backgroundColor = .white.withAlphaComponent(0.8) + view.layer.cornerRadius = 1.5 + return view + }() + private let changeButton: UIButton = { + let button = UIButton(type: .system) + button.setTitle(TextLiteral.change, for: .normal) + button.setTitleColor(.subBlue, for: .normal) + button.titleLabel?.font = .font(.regular, ofSize: 16) + return button + }() + private let titleLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.modifiedRoomInfo + label.font = .font(.regular, ofSize: 16) + return label + }() + private let startSettingLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.detailEditViewControllerStartSetting + label.font = .font(.regular, ofSize: 16) + label.textColor = .white + return label + }() + private let calendarView: CalendarView = CalendarView() + private let tipLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.maxMessage + label.textColor = .grey004 + label.font = .font(.regular, ofSize: 14) + return label + }() + private let setMemberLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.detailEditViewControllerSetMember + label.font = .font(.regular, ofSize: 18) + label.textColor = .white + return label + }() + private lazy var minMemberLabel: UILabel = { + let label = UILabel() + label.text = "\(Int(self.memberSlider.minimumValue))인" + label.font = .font(.regular, ofSize: 16) + label.textColor = .white + return label + }() + private lazy var maxMemberLabel: UILabel = { + let label = UILabel() + label.text = "\(Int(self.memberSlider.maximumValue))인" + label.font = .font(.regular, ofSize: 16) + label.textColor = .white + return label + }() + private lazy var memberSlider: UISlider = { + let slider = UISlider() + slider.minimumValue = 4 + slider.maximumValue = 15 + slider.maximumTrackTintColor = .darkGrey003 + slider.minimumTrackTintColor = .red001 +// slider.value = Float(self.sliderValue) + slider.isContinuous = true + slider.setThumbImage(ImageLiterals.imageSliderThumb, for: .normal) + return slider + }() + private lazy var memberCountLabel: UILabel = { + let label = UILabel() +// label.text = "\(self.sliderValue)" + TextLiteral.per + label.font = .font(.regular, ofSize: 24) + label.textColor = .white + return label + }() + + // MARK: - func + + private func setupLayout() { + self.addSubview(self.cancelButton) + self.cancelButton.snp.makeConstraints { + $0.top.equalToSuperview().inset(24) + $0.leading.equalToSuperview().inset(29) + $0.width.height.equalTo(44) + } + + self.addSubview(self.changeButton) + self.changeButton.snp.makeConstraints { + $0.top.equalToSuperview().inset(24) + $0.trailing.equalToSuperview().inset(29) + $0.width.height.equalTo(44) + } + + self.addSubview(self.topIndicatorView) + self.topIndicatorView.snp.makeConstraints { + $0.top.equalToSuperview().inset(8) + $0.centerX.equalToSuperview() + $0.width.equalTo(40) + $0.height.equalTo(3) + } + + self.addSubview(self.titleLabel) + self.titleLabel.snp.makeConstraints { + $0.centerX.equalToSuperview() + $0.centerY.equalTo(self.cancelButton.snp.centerY) + } + + self.addSubview(self.startSettingLabel) + self.startSettingLabel.snp.makeConstraints { + $0.top.equalTo(self.cancelButton.snp.bottom).offset(51) + $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) + } + + self.addSubview(self.calendarView) + self.calendarView.snp.makeConstraints { + $0.top.equalTo(self.startSettingLabel.snp.bottom).offset(30) + $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.height.equalTo(400) + } + + self.addSubview(tipLabel) + self.tipLabel.snp.makeConstraints { + $0.top.equalTo(self.calendarView.snp.bottom).offset(8) + $0.trailing.equalToSuperview().inset(25) + } + +// if self.editMode == .information { +// self.addSubview(self.setMemberLabel) +// self.setMemberLabel.snp.makeConstraints { +// $0.top.equalTo(self.calendarView.snp.bottom).offset(60) +// $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) +// } +// +// self.addSubview(self.minMemberLabel) +// self.minMemberLabel.snp.makeConstraints { +// $0.top.equalTo(self.setMemberLabel.snp.bottom).offset(30) +// $0.leading.equalToSuperview().inset(24) +// } +// +// self.addSubview(self.memberSlider) +// self.memberSlider.snp.makeConstraints { +// $0.leading.equalTo(self.minMemberLabel.snp.trailing).offset(5) +// $0.height.equalTo(45) +// $0.centerY.equalTo(self.minMemberLabel.snp.centerY) +// } +// +// self.addSubview(self.maxMemberLabel) +// self.maxMemberLabel.snp.makeConstraints { +// $0.top.equalTo(self.setMemberLabel.snp.bottom).offset(30) +// $0.leading.equalTo(self.memberSlider.snp.trailing).offset(5) +// $0.trailing.equalToSuperview().inset(24) +// } +// +// self.addSubview(self.memberCountLabel) +// self.memberCountLabel.snp.makeConstraints { +// $0.centerX.equalToSuperview() +// $0.centerY.equalTo(self.setMemberLabel.snp.centerY) +// } +// } + } +} From a8e5805e5612a19e7fc2a52837cc50d1f6b69aba Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 20 Apr 2023 15:28:20 +0900 Subject: [PATCH 030/468] =?UTF-8?q?[CHORE]=20=EC=9D=B8=EC=9B=90=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20layout=20setup=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/View/DetailEditView.swift | 108 +++++++++++------- 1 file changed, 65 insertions(+), 43 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 9bbfca907..22090131c 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -11,8 +11,13 @@ import SnapKit final class DetailEditView: UIView { + enum EditMode { + case date + case information + } + // MARK: - ui component - + private let cancelButton: UIButton = { let button = UIButton(type: .system) button.setTitle(TextLiteral.cancel, for: .normal) @@ -81,19 +86,32 @@ final class DetailEditView: UIView { slider.maximumValue = 15 slider.maximumTrackTintColor = .darkGrey003 slider.minimumTrackTintColor = .red001 -// slider.value = Float(self.sliderValue) + // slider.value = Float(self.sliderValue) slider.isContinuous = true slider.setThumbImage(ImageLiterals.imageSliderThumb, for: .normal) return slider }() private lazy var memberCountLabel: UILabel = { let label = UILabel() -// label.text = "\(self.sliderValue)" + TextLiteral.per + // label.text = "\(self.sliderValue)" + TextLiteral.per label.font = .font(.regular, ofSize: 24) label.textColor = .white return label }() + private var editMode: EditMode + + init(editMode: EditMode) { + self.editMode = editMode + super.init(frame: .zero) + self.setupLayout() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + // MARK: - func private func setupLayout() { @@ -103,14 +121,14 @@ final class DetailEditView: UIView { $0.leading.equalToSuperview().inset(29) $0.width.height.equalTo(44) } - + self.addSubview(self.changeButton) self.changeButton.snp.makeConstraints { $0.top.equalToSuperview().inset(24) $0.trailing.equalToSuperview().inset(29) $0.width.height.equalTo(44) } - + self.addSubview(self.topIndicatorView) self.topIndicatorView.snp.makeConstraints { $0.top.equalToSuperview().inset(8) @@ -118,64 +136,68 @@ final class DetailEditView: UIView { $0.width.equalTo(40) $0.height.equalTo(3) } - + self.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { $0.centerX.equalToSuperview() $0.centerY.equalTo(self.cancelButton.snp.centerY) } - + self.addSubview(self.startSettingLabel) self.startSettingLabel.snp.makeConstraints { $0.top.equalTo(self.cancelButton.snp.bottom).offset(51) $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) } - + self.addSubview(self.calendarView) self.calendarView.snp.makeConstraints { $0.top.equalTo(self.startSettingLabel.snp.bottom).offset(30) $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) $0.height.equalTo(400) } - + self.addSubview(tipLabel) self.tipLabel.snp.makeConstraints { $0.top.equalTo(self.calendarView.snp.bottom).offset(8) $0.trailing.equalToSuperview().inset(25) } - -// if self.editMode == .information { -// self.addSubview(self.setMemberLabel) -// self.setMemberLabel.snp.makeConstraints { -// $0.top.equalTo(self.calendarView.snp.bottom).offset(60) -// $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) -// } -// -// self.addSubview(self.minMemberLabel) -// self.minMemberLabel.snp.makeConstraints { -// $0.top.equalTo(self.setMemberLabel.snp.bottom).offset(30) -// $0.leading.equalToSuperview().inset(24) -// } -// -// self.addSubview(self.memberSlider) -// self.memberSlider.snp.makeConstraints { -// $0.leading.equalTo(self.minMemberLabel.snp.trailing).offset(5) -// $0.height.equalTo(45) -// $0.centerY.equalTo(self.minMemberLabel.snp.centerY) -// } -// -// self.addSubview(self.maxMemberLabel) -// self.maxMemberLabel.snp.makeConstraints { -// $0.top.equalTo(self.setMemberLabel.snp.bottom).offset(30) -// $0.leading.equalTo(self.memberSlider.snp.trailing).offset(5) -// $0.trailing.equalToSuperview().inset(24) -// } -// -// self.addSubview(self.memberCountLabel) -// self.memberCountLabel.snp.makeConstraints { -// $0.centerX.equalToSuperview() -// $0.centerY.equalTo(self.setMemberLabel.snp.centerY) -// } -// } + + if self.editMode == .information { + self.setupEditMembersLayout() + } + } + + private func setupEditMembersLayout() { + self.addSubview(self.setMemberLabel) + self.setMemberLabel.snp.makeConstraints { + $0.top.equalTo(self.calendarView.snp.bottom).offset(60) + $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) + } + + self.addSubview(self.minMemberLabel) + self.minMemberLabel.snp.makeConstraints { + $0.top.equalTo(self.setMemberLabel.snp.bottom).offset(30) + $0.leading.equalToSuperview().inset(24) + } + + self.addSubview(self.memberSlider) + self.memberSlider.snp.makeConstraints { + $0.leading.equalTo(self.minMemberLabel.snp.trailing).offset(5) + $0.height.equalTo(45) + $0.centerY.equalTo(self.minMemberLabel.snp.centerY) + } + + self.addSubview(self.maxMemberLabel) + self.maxMemberLabel.snp.makeConstraints { + $0.top.equalTo(self.setMemberLabel.snp.bottom).offset(30) + $0.leading.equalTo(self.memberSlider.snp.trailing).offset(5) + $0.trailing.equalToSuperview().inset(24) + } + + self.addSubview(self.memberCountLabel) + self.memberCountLabel.snp.makeConstraints { + $0.centerX.equalToSuperview() + $0.centerY.equalTo(self.setMemberLabel.snp.centerY) + } } } From 24124b71262f8bdacb18f44b676a7d273fdb4e1f Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 20 Apr 2023 16:02:18 +0900 Subject: [PATCH 031/468] =?UTF-8?q?[ADD]=20delegate=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?=20=ED=9B=84=20dismiss=20=EC=B6=94=EA=B0=80=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailEditViewController.swift | 507 +++++++++--------- .../Detail-Wait/View/DetailEditView.swift | 46 +- 2 files changed, 298 insertions(+), 255 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index 71f70f933..0e412c559 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -18,116 +18,120 @@ final class DetailEditViewController: BaseViewController { } // MARK: - ui component + + private lazy var detailEditView = DetailEditView() - private let cancelButton: UIButton = { - let button = UIButton(type: .system) - button.setTitle(TextLiteral.cancel, for: .normal) - button.setTitleColor(.white, for: .normal) - button.titleLabel?.font = .font(.regular, ofSize: 16) - return button - }() - private let topIndicatorView: UIView = { - let view = UIView() - view.backgroundColor = .white.withAlphaComponent(0.8) - view.layer.cornerRadius = 1.5 - return view - }() - private let changeButton: UIButton = { - let button = UIButton(type: .system) - button.setTitle(TextLiteral.change, for: .normal) - button.setTitleColor(.subBlue, for: .normal) - button.titleLabel?.font = .font(.regular, ofSize: 16) - return button - }() - private let titleLabel: UILabel = { - let label = UILabel() - label.text = TextLiteral.modifiedRoomInfo - label.font = .font(.regular, ofSize: 16) - return label - }() - private let startSettingLabel: UILabel = { - let label = UILabel() - label.text = TextLiteral.detailEditViewControllerStartSetting - label.font = .font(.regular, ofSize: 16) - label.textColor = .white - return label - }() - private let calendarView: CalendarView = CalendarView() - private let tipLabel: UILabel = { - let label = UILabel() - label.text = TextLiteral.maxMessage - label.textColor = .grey004 - label.font = .font(.regular, ofSize: 14) - return label - }() - private let setMemberLabel: UILabel = { - let label = UILabel() - label.text = TextLiteral.detailEditViewControllerSetMember - label.font = .font(.regular, ofSize: 18) - label.textColor = .white - return label - }() - private lazy var minMemberLabel: UILabel = { - let label = UILabel() - label.text = "\(Int(self.memberSlider.minimumValue))인" - label.font = .font(.regular, ofSize: 16) - label.textColor = .white - return label - }() - private lazy var maxMemberLabel: UILabel = { - let label = UILabel() - label.text = "\(Int(self.memberSlider.maximumValue))인" - label.font = .font(.regular, ofSize: 16) - label.textColor = .white - return label - }() - private lazy var memberSlider: UISlider = { - let slider = UISlider() - slider.minimumValue = 4 - slider.maximumValue = 15 - slider.maximumTrackTintColor = .darkGrey003 - slider.minimumTrackTintColor = .red001 - slider.value = Float(self.sliderValue) - slider.isContinuous = true - slider.setThumbImage(ImageLiterals.imageSliderThumb, for: .normal) - return slider - }() - private lazy var memberCountLabel: UILabel = { - let label = UILabel() - label.text = "\(self.sliderValue)" + TextLiteral.per - label.font = .font(.regular, ofSize: 24) - label.textColor = .white - return label - }() +// private let cancelButton: UIButton = { +// let button = UIButton(type: .system) +// button.setTitle(TextLiteral.cancel, for: .normal) +// button.setTitleColor(.white, for: .normal) +// button.titleLabel?.font = .font(.regular, ofSize: 16) +// return button +// }() +// private let topIndicatorView: UIView = { +// let view = UIView() +// view.backgroundColor = .white.withAlphaComponent(0.8) +// view.layer.cornerRadius = 1.5 +// return view +// }() +// private let changeButton: UIButton = { +// let button = UIButton(type: .system) +// button.setTitle(TextLiteral.change, for: .normal) +// button.setTitleColor(.subBlue, for: .normal) +// button.titleLabel?.font = .font(.regular, ofSize: 16) +// return button +// }() +// private let titleLabel: UILabel = { +// let label = UILabel() +// label.text = TextLiteral.modifiedRoomInfo +// label.font = .font(.regular, ofSize: 16) +// return label +// }() +// private let startSettingLabel: UILabel = { +// let label = UILabel() +// label.text = TextLiteral.detailEditViewControllerStartSetting +// label.font = .font(.regular, ofSize: 16) +// label.textColor = .white +// return label +// }() +// private let calendarView: CalendarView = CalendarView() +// private let tipLabel: UILabel = { +// let label = UILabel() +// label.text = TextLiteral.maxMessage +// label.textColor = .grey004 +// label.font = .font(.regular, ofSize: 14) +// return label +// }() +// private let setMemberLabel: UILabel = { +// let label = UILabel() +// label.text = TextLiteral.detailEditViewControllerSetMember +// label.font = .font(.regular, ofSize: 18) +// label.textColor = .white +// return label +// }() +// private lazy var minMemberLabel: UILabel = { +// let label = UILabel() +// label.text = "\(Int(self.memberSlider.minimumValue))인" +// label.font = .font(.regular, ofSize: 16) +// label.textColor = .white +// return label +// }() +// private lazy var maxMemberLabel: UILabel = { +// let label = UILabel() +// label.text = "\(Int(self.memberSlider.maximumValue))인" +// label.font = .font(.regular, ofSize: 16) +// label.textColor = .white +// return label +// }() +// private lazy var memberSlider: UISlider = { +// let slider = UISlider() +// slider.minimumValue = 4 +// slider.maximumValue = 15 +// slider.maximumTrackTintColor = .darkGrey003 +// slider.minimumTrackTintColor = .red001 +// slider.value = Float(self.sliderValue) +// slider.isContinuous = true +// slider.setThumbImage(ImageLiterals.imageSliderThumb, for: .normal) +// return slider +// }() +// private lazy var memberCountLabel: UILabel = { +// let label = UILabel() +// label.text = "\(self.sliderValue)" + TextLiteral.per +// label.font = .font(.regular, ofSize: 24) +// label.textColor = .white +// return label +// }() // MARK: - property private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) - var didTappedChangeButton: (() -> ())? +// var didTappedChangeButton: (() -> ())? private let roomIndex: Int - private let roomTitle: String +// private let roomTitle: String var editMode: EditMode var currentUserCount: Int = 0 var sliderValue: Int = 10 - var startDateText: String = "" { - didSet { - self.calendarView.startDateText = startDateText - self.calendarView.setupDateRange() - } - } - var endDateText: String = "" { - didSet { - self.calendarView.endDateText = endDateText - self.calendarView.setupDateRange() - } - } + var startDateText: String = "" +// { +// didSet { +// self.calendarView.startDateText = startDateText +// self.calendarView.setupDateRange() +// } +// } + var endDateText: String = "" +// { +// didSet { +// self.calendarView.endDateText = endDateText +// self.calendarView.setupDateRange() +// } +// } // MARK: - init init(editMode: EditMode, roomIndex: Int, title: String) { self.editMode = editMode self.roomIndex = roomIndex - self.roomTitle = title +// self.roomTitle = title super.init() } @@ -141,135 +145,140 @@ final class DetailEditViewController: BaseViewController { // MARK: - override + override func loadView() { + self.view = self.detailEditView + } + override func viewDidLoad() { super.viewDidLoad() - self.setupCalendarChangeButton() - self.setupCancleButton() - self.setupChangeButton() - self.setupMemberSlider() + self.configureDelegation() +// self.setupCalendarChangeButton() +// self.setupCancleButton() +// self.setupChangeButton() +// self.setupMemberSlider() } - override func configureUI() { - super.configureUI() - self.navigationController?.isNavigationBarHidden = true - self.presentationController?.delegate = self - self.isModalInPresentation = true - } - - override func setupLayout() { - self.view.addSubview(self.cancelButton) - self.cancelButton.snp.makeConstraints { - $0.top.equalToSuperview().inset(24) - $0.leading.equalToSuperview().inset(29) - $0.width.height.equalTo(44) - } - - self.view.addSubview(self.changeButton) - self.changeButton.snp.makeConstraints { - $0.top.equalToSuperview().inset(24) - $0.trailing.equalToSuperview().inset(29) - $0.width.height.equalTo(44) - } - - self.view.addSubview(self.topIndicatorView) - self.topIndicatorView.snp.makeConstraints { - $0.top.equalToSuperview().inset(8) - $0.centerX.equalToSuperview() - $0.width.equalTo(40) - $0.height.equalTo(3) - } - - self.view.addSubview(self.titleLabel) - self.titleLabel.snp.makeConstraints { - $0.centerX.equalToSuperview() - $0.centerY.equalTo(self.cancelButton.snp.centerY) - } +// override func configureUI() { +// super.configureUI() +// self.navigationController?.isNavigationBarHidden = true +// self.presentationController?.delegate = self +// self.isModalInPresentation = true +// } - self.view.addSubview(self.startSettingLabel) - self.startSettingLabel.snp.makeConstraints { - $0.top.equalTo(self.cancelButton.snp.bottom).offset(51) - $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) - } - - self.view.addSubview(self.calendarView) - self.calendarView.snp.makeConstraints { - $0.top.equalTo(self.startSettingLabel.snp.bottom).offset(30) - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.height.equalTo(400) - } - - self.view.addSubview(tipLabel) - self.tipLabel.snp.makeConstraints { - $0.top.equalTo(self.calendarView.snp.bottom).offset(8) - $0.trailing.equalToSuperview().inset(25) - } - - if self.editMode == .information { - self.view.addSubview(self.setMemberLabel) - self.setMemberLabel.snp.makeConstraints { - $0.top.equalTo(self.calendarView.snp.bottom).offset(60) - $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) - } - - self.view.addSubview(self.minMemberLabel) - self.minMemberLabel.snp.makeConstraints { - $0.top.equalTo(self.setMemberLabel.snp.bottom).offset(30) - $0.leading.equalToSuperview().inset(24) - } - - self.view.addSubview(self.memberSlider) - self.memberSlider.snp.makeConstraints { - $0.leading.equalTo(self.minMemberLabel.snp.trailing).offset(5) - $0.height.equalTo(45) - $0.centerY.equalTo(self.minMemberLabel.snp.centerY) - } - - self.view.addSubview(self.maxMemberLabel) - self.maxMemberLabel.snp.makeConstraints { - $0.top.equalTo(self.setMemberLabel.snp.bottom).offset(30) - $0.leading.equalTo(self.memberSlider.snp.trailing).offset(5) - $0.trailing.equalToSuperview().inset(24) - } - - self.view.addSubview(self.memberCountLabel) - self.memberCountLabel.snp.makeConstraints { - $0.centerX.equalToSuperview() - $0.centerY.equalTo(self.setMemberLabel.snp.centerY) - } - } - } +// override func setupLayout() { +// self.view.addSubview(self.cancelButton) +// self.cancelButton.snp.makeConstraints { +// $0.top.equalToSuperview().inset(24) +// $0.leading.equalToSuperview().inset(29) +// $0.width.height.equalTo(44) +// } +// +// self.view.addSubview(self.changeButton) +// self.changeButton.snp.makeConstraints { +// $0.top.equalToSuperview().inset(24) +// $0.trailing.equalToSuperview().inset(29) +// $0.width.height.equalTo(44) +// } +// +// self.view.addSubview(self.topIndicatorView) +// self.topIndicatorView.snp.makeConstraints { +// $0.top.equalToSuperview().inset(8) +// $0.centerX.equalToSuperview() +// $0.width.equalTo(40) +// $0.height.equalTo(3) +// } +// +// self.view.addSubview(self.titleLabel) +// self.titleLabel.snp.makeConstraints { +// $0.centerX.equalToSuperview() +// $0.centerY.equalTo(self.cancelButton.snp.centerY) +// } +// +// self.view.addSubview(self.startSettingLabel) +// self.startSettingLabel.snp.makeConstraints { +// $0.top.equalTo(self.cancelButton.snp.bottom).offset(51) +// $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) +// } +// +// self.view.addSubview(self.calendarView) +// self.calendarView.snp.makeConstraints { +// $0.top.equalTo(self.startSettingLabel.snp.bottom).offset(30) +// $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) +// $0.height.equalTo(400) +// } +// +// self.view.addSubview(tipLabel) +// self.tipLabel.snp.makeConstraints { +// $0.top.equalTo(self.calendarView.snp.bottom).offset(8) +// $0.trailing.equalToSuperview().inset(25) +// } +// +// if self.editMode == .information { +// self.view.addSubview(self.setMemberLabel) +// self.setMemberLabel.snp.makeConstraints { +// $0.top.equalTo(self.calendarView.snp.bottom).offset(60) +// $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) +// } +// +// self.view.addSubview(self.minMemberLabel) +// self.minMemberLabel.snp.makeConstraints { +// $0.top.equalTo(self.setMemberLabel.snp.bottom).offset(30) +// $0.leading.equalToSuperview().inset(24) +// } +// +// self.view.addSubview(self.memberSlider) +// self.memberSlider.snp.makeConstraints { +// $0.leading.equalTo(self.minMemberLabel.snp.trailing).offset(5) +// $0.height.equalTo(45) +// $0.centerY.equalTo(self.minMemberLabel.snp.centerY) +// } +// +// self.view.addSubview(self.maxMemberLabel) +// self.maxMemberLabel.snp.makeConstraints { +// $0.top.equalTo(self.setMemberLabel.snp.bottom).offset(30) +// $0.leading.equalTo(self.memberSlider.snp.trailing).offset(5) +// $0.trailing.equalToSuperview().inset(24) +// } +// +// self.view.addSubview(self.memberCountLabel) +// self.memberCountLabel.snp.makeConstraints { +// $0.centerX.equalToSuperview() +// $0.centerY.equalTo(self.setMemberLabel.snp.centerY) +// } +// } +// } // MARK: - func - private func setupCancleButton() { - let action = UIAction { [weak self] _ in - self?.dismiss(animated: true) - } - self.cancelButton.addAction(action, for: .touchUpInside) - } +// private func setupCancleButton() { +// let action = UIAction { [weak self] _ in +// self?.dismiss(animated: true) +// } +// self.cancelButton.addAction(action, for: .touchUpInside) +// } - private func setupChangeButton() { - let action = UIAction { [weak self] _ in - self?.didTapChangeButton() - } - self.changeButton.addAction(action, for: .touchUpInside) - } +// private func setupChangeButton() { +// let action = UIAction { [weak self] _ in +// self?.didTapChangeButton() +// } +// self.changeButton.addAction(action, for: .touchUpInside) +// } - private func setupMemberSlider() { - let valueChangeAction = UIAction { [weak self] action in - guard let sender = action.sender as? UISlider else { return } - self?.changeMemberCount(sender: sender) - } - self.memberSlider.addAction(valueChangeAction, for: .valueChanged) - } +// private func setupMemberSlider() { +// let valueChangeAction = UIAction { [weak self] action in +// guard let sender = action.sender as? UISlider else { return } +// self?.changeMemberCount(sender: sender) +// } +// self.memberSlider.addAction(valueChangeAction, for: .valueChanged) +// } - private func presentationControllerDidAttemptToDismissAlert() { - guard self.calendarView.isFirstTap else { - self.dismiss(animated: true) - return - } - self.showDiscardChangAlert() - } +// private func presentationControllerDidAttemptToDismissAlert() { +// guard self.calendarView.isFirstTap else { +// self.dismiss(animated: true) +// return +// } +// self.showDiscardChangAlert() +// } private func showDiscardChangAlert() { let actionTitles = [TextLiteral.destructive, TextLiteral.cancel] @@ -282,37 +291,41 @@ final class DetailEditViewController: BaseViewController { actions: actions) } - private func setupCalendarChangeButton() { - self.calendarView.changeButtonState = { [weak self] value in - self?.changeButton.isEnabled = value - self?.changeButton.setTitleColor(.subBlue, for: .normal) - self?.changeButton.setTitleColor(.grey002, for: .disabled) - } - } +// private func setupCalendarChangeButton() { +// self.calendarView.changeButtonState = { [weak self] value in +// self?.changeButton.isEnabled = value +// self?.changeButton.setTitleColor(.subBlue, for: .normal) +// self?.changeButton.setTitleColor(.grey002, for: .disabled) +// } +// } - private func didTapChangeButton() { - let dto = RoomDTO(title: self.roomTitle, - capacity: Int(self.memberSlider.value), - startDate: "20\(self.calendarView.getTempStartDate())", - endDate: "20\(self.calendarView.getTempEndDate())") - switch self.editMode { - case .date: - self.putChangeRoomInfo(roomDto: dto) - case .information: - if self.currentUserCount <= self.sliderValue { - self.putChangeRoomInfo(roomDto: dto) - } else { - self.makeAlert(title: TextLiteral.detailEditViewControllerChangeRoomInfoAlertTitle, - message: TextLiteral.detailEditViewControllerChangeRoomInfoAlertMessage) - } - } - } +// private func didTapChangeButton() { +// let dto = RoomDTO(title: self.roomTitle, +// capacity: Int(self.memberSlider.value), +// startDate: "20\(self.calendarView.getTempStartDate())", +// endDate: "20\(self.calendarView.getTempEndDate())") +// switch self.editMode { +// case .date: +// self.putChangeRoomInfo(roomDto: dto) +// case .information: +// if self.currentUserCount <= self.sliderValue { +// self.putChangeRoomInfo(roomDto: dto) +// } else { +// self.makeAlert(title: TextLiteral.detailEditViewControllerChangeRoomInfoAlertTitle, +// message: TextLiteral.detailEditViewControllerChangeRoomInfoAlertMessage) +// } +// } +// } + +// private func changeMemberCount(sender: UISlider) { +// self.sliderValue = Int(sender.value) +// self.memberCountLabel.text = String(Int(sender.value)) + TextLiteral.per +// self.memberCountLabel.font = .font(.regular, ofSize: 24) +// self.memberCountLabel.textColor = .white +// } - private func changeMemberCount(sender: UISlider) { - self.sliderValue = Int(sender.value) - self.memberCountLabel.text = String(Int(sender.value)) + TextLiteral.per - self.memberCountLabel.font = .font(.regular, ofSize: 24) - self.memberCountLabel.textColor = .white + private func configureDelegation() { + self.detailEditView.configureDelegation(self) } // MARK: - network @@ -325,7 +338,7 @@ final class DetailEditViewController: BaseViewController { if status == 204 { ToastView.showToast(message: "방 정보 수정 완료", view: self.view ?? UIView()) - self.didTappedChangeButton?() +// self.didTappedChangeButton?() self.dismiss(animated: true) } } catch NetworkError.serverError { @@ -341,6 +354,12 @@ final class DetailEditViewController: BaseViewController { extension DetailEditViewController: UIAdaptivePresentationControllerDelegate { func presentationControllerDidAttemptToDismiss(_ presentationController: UIPresentationController) { - self.presentationControllerDidAttemptToDismissAlert() +// self.presentationControllerDidAttemptToDismissAlert() + } +} + +extension DetailEditViewController: DetailEditDelegate { + func dismiss() { + self.dismiss(animated: true) } } diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 22090131c..a4349c76f 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -9,12 +9,16 @@ import UIKit import SnapKit +protocol DetailEditDelegate: AnyObject { + func dismiss() +} + final class DetailEditView: UIView { - enum EditMode { - case date - case information - } +// enum EditMode { +// case date +// case information +// } // MARK: - ui component @@ -99,13 +103,22 @@ final class DetailEditView: UIView { return label }() - private var editMode: EditMode + // MARK: - property - init(editMode: EditMode) { - self.editMode = editMode - super.init(frame: .zero) + private weak var delegate: DetailEditDelegate? + + override init(frame: CGRect) { + super.init(frame: frame) self.setupLayout() + self.setupCancleButton() } +// private var editMode: EditMode + +// init(editMode: EditMode) { +// self.editMode = editMode +// super.init(frame: .zero) +// self.setupLayout() +// } @available(*, unavailable) required init?(coder: NSCoder) { @@ -162,9 +175,9 @@ final class DetailEditView: UIView { $0.trailing.equalToSuperview().inset(25) } - if self.editMode == .information { - self.setupEditMembersLayout() - } +// if self.editMode == .information { +// self.setupEditMembersLayout() +// } } private func setupEditMembersLayout() { @@ -200,4 +213,15 @@ final class DetailEditView: UIView { $0.centerY.equalTo(self.setMemberLabel.snp.centerY) } } + + func configureDelegation(_ delegate: DetailEditDelegate) { + self.delegate = delegate + } + + private func setupCancleButton() { + let action = UIAction { [weak self] _ in + self?.delegate?.dismiss() + } + self.cancelButton.addAction(action, for: .touchUpInside) + } } From 3711264a992e92ee909f2c2e51f9bb11cec14f2b Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 20 Apr 2023 16:05:14 +0900 Subject: [PATCH 032/468] =?UTF-8?q?[ADD]=20=EB=B3=80=EA=B2=BD=20delegate?= =?UTF-8?q?=20=ED=95=A8=EC=88=98=20=EC=B6=94=EA=B0=80=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/DetailEditViewController.swift | 4 ++++ .../Manito/Screens/Detail-Wait/View/DetailEditView.swift | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index 0e412c559..9aa1d26ec 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -362,4 +362,8 @@ extension DetailEditViewController: DetailEditDelegate { func dismiss() { self.dismiss(animated: true) } + + func changeRoomInformation() { + print("변경") + } } diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index a4349c76f..11ae3fb7e 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -11,6 +11,7 @@ import SnapKit protocol DetailEditDelegate: AnyObject { func dismiss() + func changeRoomInformation() } final class DetailEditView: UIView { @@ -111,6 +112,7 @@ final class DetailEditView: UIView { super.init(frame: frame) self.setupLayout() self.setupCancleButton() + self.setupChangeButton() } // private var editMode: EditMode @@ -224,4 +226,11 @@ final class DetailEditView: UIView { } self.cancelButton.addAction(action, for: .touchUpInside) } + + private func setupChangeButton() { + let action = UIAction { [weak self] _ in + self?.delegate?.changeRoomInformation() + } + self.changeButton.addAction(action, for: .touchUpInside) + } } From b7c758b298d8b8d6835347929dd3134a995987bb Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 20 Apr 2023 16:37:35 +0900 Subject: [PATCH 033/468] =?UTF-8?q?[CHORE]=20dateRange=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailEditViewController.swift | 10 ++++++++-- .../Screens/Detail-Wait/View/DetailEditView.swift | 13 +++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index 9aa1d26ec..4008f51ad 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -152,6 +152,7 @@ final class DetailEditViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() self.configureDelegation() + self.setupCalendarLayout() // self.setupCalendarChangeButton() // self.setupCancleButton() // self.setupChangeButton() @@ -328,6 +329,10 @@ final class DetailEditViewController: BaseViewController { self.detailEditView.configureDelegation(self) } + private func setupCalendarLayout() { + self.detailEditView.setupDateRange(from: self.startDateText, to: self.endDateText) + } + // MARK: - network private func putChangeRoomInfo(roomDto: RoomDTO) { @@ -363,7 +368,8 @@ extension DetailEditViewController: DetailEditDelegate { self.dismiss(animated: true) } - func changeRoomInformation() { - print("변경") + func changeRoomInformation(from startDate: String, to endDate: String) { + print("startDate", startDate) + print("endDate", endDate) } } diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 11ae3fb7e..866cf68c2 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -11,7 +11,7 @@ import SnapKit protocol DetailEditDelegate: AnyObject { func dismiss() - func changeRoomInformation() + func changeRoomInformation(from startDate: String, to endDate: String) } final class DetailEditView: UIView { @@ -220,6 +220,12 @@ final class DetailEditView: UIView { self.delegate = delegate } + func setupDateRange(from startDateString: String, to endDateString: String) { + self.calendarView.startDateText = startDateString + self.calendarView.endDateText = endDateString + self.calendarView.setupDateRange() + } + private func setupCancleButton() { let action = UIAction { [weak self] _ in self?.delegate?.dismiss() @@ -229,7 +235,10 @@ final class DetailEditView: UIView { private func setupChangeButton() { let action = UIAction { [weak self] _ in - self?.delegate?.changeRoomInformation() + guard let startDateString = self?.calendarView.getTempStartDate(), + let endDateString = self?.calendarView.getTempEndDate() else { return } + self?.delegate?.changeRoomInformation(from: startDateString, + to: endDateString) } self.changeButton.addAction(action, for: .touchUpInside) } From 5bbd03909a8126d23f094b5906ba0ded243a5479 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 20 Apr 2023 16:41:06 +0900 Subject: [PATCH 034/468] =?UTF-8?q?[CHORE]=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EB=B9=84=ED=99=9C=EC=84=B1=ED=99=94=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 866cf68c2..97d0e4b26 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -241,5 +241,11 @@ final class DetailEditView: UIView { to: endDateString) } self.changeButton.addAction(action, for: .touchUpInside) + + self.calendarView.changeButtonState = { [weak self] value in + self?.changeButton.isEnabled = value + self?.changeButton.setTitleColor(.subBlue, for: .normal) + self?.changeButton.setTitleColor(.grey002, for: .disabled) + } } } From 984ae21e51de646d33fd737dc4bd7c51524ca98c Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 20 Apr 2023 17:02:37 +0900 Subject: [PATCH 035/468] =?UTF-8?q?[CHORE]=20UISlider=20=EA=B0=92=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailEditViewController.swift | 15 ++++--- .../Detail-Wait/View/DetailEditView.swift | 43 ++++++++++++------- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index 4008f51ad..676fbd6be 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -19,7 +19,7 @@ final class DetailEditViewController: BaseViewController { // MARK: - ui component - private lazy var detailEditView = DetailEditView() + private lazy var detailEditView = DetailEditView(maximumMemberCount: self.sliderValue) // private let cancelButton: UIButton = { // let button = UIButton(type: .system) @@ -107,7 +107,7 @@ final class DetailEditViewController: BaseViewController { private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) // var didTappedChangeButton: (() -> ())? private let roomIndex: Int -// private let roomTitle: String + private let roomTitle: String var editMode: EditMode var currentUserCount: Int = 0 var sliderValue: Int = 10 @@ -131,7 +131,7 @@ final class DetailEditViewController: BaseViewController { init(editMode: EditMode, roomIndex: Int, title: String) { self.editMode = editMode self.roomIndex = roomIndex -// self.roomTitle = title + self.roomTitle = title super.init() } @@ -368,8 +368,11 @@ extension DetailEditViewController: DetailEditDelegate { self.dismiss(animated: true) } - func changeRoomInformation(from startDate: String, to endDate: String) { - print("startDate", startDate) - print("endDate", endDate) + func changeRoomInformation(capacity: Int, from startDate: String, to endDate: String) { + let dto = RoomDTO(title: self.roomTitle, + capacity: capacity, + startDate: "20\(startDate)", + endDate: "20\(endDate)") + print(dto) } } diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 97d0e4b26..b1f46605d 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -11,7 +11,7 @@ import SnapKit protocol DetailEditDelegate: AnyObject { func dismiss() - func changeRoomInformation(from startDate: String, to endDate: String) + func changeRoomInformation(capacity: Int, from startDate: String, to endDate: String) } final class DetailEditView: UIView { @@ -91,14 +91,14 @@ final class DetailEditView: UIView { slider.maximumValue = 15 slider.maximumTrackTintColor = .darkGrey003 slider.minimumTrackTintColor = .red001 - // slider.value = Float(self.sliderValue) + slider.value = Float(self.maximumMemberCount) slider.isContinuous = true slider.setThumbImage(ImageLiterals.imageSliderThumb, for: .normal) return slider }() private lazy var memberCountLabel: UILabel = { let label = UILabel() - // label.text = "\(self.sliderValue)" + TextLiteral.per + label.text = "\(self.maximumMemberCount)" + TextLiteral.per label.font = .font(.regular, ofSize: 24) label.textColor = .white return label @@ -107,20 +107,16 @@ final class DetailEditView: UIView { // MARK: - property private weak var delegate: DetailEditDelegate? + private var maximumMemberCount: Int - override init(frame: CGRect) { - super.init(frame: frame) + init(maximumMemberCount: Int) { + self.maximumMemberCount = maximumMemberCount + super.init(frame: .zero) self.setupLayout() self.setupCancleButton() self.setupChangeButton() + self.setupMemberSlider() } -// private var editMode: EditMode - -// init(editMode: EditMode) { -// self.editMode = editMode -// super.init(frame: .zero) -// self.setupLayout() -// } @available(*, unavailable) required init?(coder: NSCoder) { @@ -178,7 +174,7 @@ final class DetailEditView: UIView { } // if self.editMode == .information { -// self.setupEditMembersLayout() + self.setupEditMembersLayout() // } } @@ -235,9 +231,11 @@ final class DetailEditView: UIView { private func setupChangeButton() { let action = UIAction { [weak self] _ in - guard let startDateString = self?.calendarView.getTempStartDate(), + guard let capacity = self?.memberSlider.value, + let startDateString = self?.calendarView.getTempStartDate(), let endDateString = self?.calendarView.getTempEndDate() else { return } - self?.delegate?.changeRoomInformation(from: startDateString, + self?.delegate?.changeRoomInformation(capacity: Int(capacity), + from: startDateString, to: endDateString) } self.changeButton.addAction(action, for: .touchUpInside) @@ -248,4 +246,19 @@ final class DetailEditView: UIView { self?.changeButton.setTitleColor(.grey002, for: .disabled) } } + + private func setupMemberSlider() { + let valueChangeAction = UIAction { [weak self] action in + guard let sender = action.sender as? UISlider else { return } + self?.changeMemberCount(sender: sender) + } + self.memberSlider.addAction(valueChangeAction, for: .valueChanged) + } + + private func changeMemberCount(sender: UISlider) { + self.maximumMemberCount = Int(sender.value) + self.memberCountLabel.text = String(Int(sender.value)) + TextLiteral.per + self.memberCountLabel.font = .font(.regular, ofSize: 24) + self.memberCountLabel.textColor = .white + } } From 1ecb1921fbdefd215dad5acbdbd64889b5743d49 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 20 Apr 2023 17:13:08 +0900 Subject: [PATCH 036/468] =?UTF-8?q?[CHORE]=20slider=20change=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=EB=AA=85=20=EB=B3=80=EA=B2=BD=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/View/DetailEditView.swift | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index b1f46605d..8d4742f37 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -107,7 +107,11 @@ final class DetailEditView: UIView { // MARK: - property private weak var delegate: DetailEditDelegate? - private var maximumMemberCount: Int + private var maximumMemberCount: Int { + didSet { + self.memberCountLabel.text = maximumMemberCount.description + TextLiteral.per + } + } init(maximumMemberCount: Int) { self.maximumMemberCount = maximumMemberCount @@ -250,15 +254,12 @@ final class DetailEditView: UIView { private func setupMemberSlider() { let valueChangeAction = UIAction { [weak self] action in guard let sender = action.sender as? UISlider else { return } - self?.changeMemberCount(sender: sender) + self?.changeMemberSliderValue(sender: sender) } self.memberSlider.addAction(valueChangeAction, for: .valueChanged) } - private func changeMemberCount(sender: UISlider) { + private func changeMemberSliderValue(sender: UISlider) { self.maximumMemberCount = Int(sender.value) - self.memberCountLabel.text = String(Int(sender.value)) + TextLiteral.per - self.memberCountLabel.font = .font(.regular, ofSize: 24) - self.memberCountLabel.textColor = .white } } From f6e4142459b96972b430379e91a6ef35547627e0 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 20 Apr 2023 17:58:17 +0900 Subject: [PATCH 037/468] =?UTF-8?q?[CHORE]=20=EB=AA=A8=EB=8B=AC=20?= =?UTF-8?q?=EB=82=B4=EB=A0=B8=EC=9D=84=20=EB=95=8C=20actionSheet=20?= =?UTF-8?q?=ED=91=9C=EC=8B=9C=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailEditViewController.swift | 175 +++--------------- .../Detail-Wait/View/DetailEditView.swift | 2 +- 2 files changed, 26 insertions(+), 151 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index 676fbd6be..7bcc732e0 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -153,152 +153,15 @@ final class DetailEditViewController: BaseViewController { super.viewDidLoad() self.configureDelegation() self.setupCalendarLayout() -// self.setupCalendarChangeButton() -// self.setupCancleButton() -// self.setupChangeButton() -// self.setupMemberSlider() } -// override func configureUI() { -// super.configureUI() -// self.navigationController?.isNavigationBarHidden = true -// self.presentationController?.delegate = self -// self.isModalInPresentation = true -// } - -// override func setupLayout() { -// self.view.addSubview(self.cancelButton) -// self.cancelButton.snp.makeConstraints { -// $0.top.equalToSuperview().inset(24) -// $0.leading.equalToSuperview().inset(29) -// $0.width.height.equalTo(44) -// } -// -// self.view.addSubview(self.changeButton) -// self.changeButton.snp.makeConstraints { -// $0.top.equalToSuperview().inset(24) -// $0.trailing.equalToSuperview().inset(29) -// $0.width.height.equalTo(44) -// } -// -// self.view.addSubview(self.topIndicatorView) -// self.topIndicatorView.snp.makeConstraints { -// $0.top.equalToSuperview().inset(8) -// $0.centerX.equalToSuperview() -// $0.width.equalTo(40) -// $0.height.equalTo(3) -// } -// -// self.view.addSubview(self.titleLabel) -// self.titleLabel.snp.makeConstraints { -// $0.centerX.equalToSuperview() -// $0.centerY.equalTo(self.cancelButton.snp.centerY) -// } -// -// self.view.addSubview(self.startSettingLabel) -// self.startSettingLabel.snp.makeConstraints { -// $0.top.equalTo(self.cancelButton.snp.bottom).offset(51) -// $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) -// } -// -// self.view.addSubview(self.calendarView) -// self.calendarView.snp.makeConstraints { -// $0.top.equalTo(self.startSettingLabel.snp.bottom).offset(30) -// $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) -// $0.height.equalTo(400) -// } -// -// self.view.addSubview(tipLabel) -// self.tipLabel.snp.makeConstraints { -// $0.top.equalTo(self.calendarView.snp.bottom).offset(8) -// $0.trailing.equalToSuperview().inset(25) -// } -// -// if self.editMode == .information { -// self.view.addSubview(self.setMemberLabel) -// self.setMemberLabel.snp.makeConstraints { -// $0.top.equalTo(self.calendarView.snp.bottom).offset(60) -// $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) -// } -// -// self.view.addSubview(self.minMemberLabel) -// self.minMemberLabel.snp.makeConstraints { -// $0.top.equalTo(self.setMemberLabel.snp.bottom).offset(30) -// $0.leading.equalToSuperview().inset(24) -// } -// -// self.view.addSubview(self.memberSlider) -// self.memberSlider.snp.makeConstraints { -// $0.leading.equalTo(self.minMemberLabel.snp.trailing).offset(5) -// $0.height.equalTo(45) -// $0.centerY.equalTo(self.minMemberLabel.snp.centerY) -// } -// -// self.view.addSubview(self.maxMemberLabel) -// self.maxMemberLabel.snp.makeConstraints { -// $0.top.equalTo(self.setMemberLabel.snp.bottom).offset(30) -// $0.leading.equalTo(self.memberSlider.snp.trailing).offset(5) -// $0.trailing.equalToSuperview().inset(24) -// } -// -// self.view.addSubview(self.memberCountLabel) -// self.memberCountLabel.snp.makeConstraints { -// $0.centerX.equalToSuperview() -// $0.centerY.equalTo(self.setMemberLabel.snp.centerY) -// } -// } -// } - - // MARK: - func - -// private func setupCancleButton() { -// let action = UIAction { [weak self] _ in -// self?.dismiss(animated: true) -// } -// self.cancelButton.addAction(action, for: .touchUpInside) -// } - -// private func setupChangeButton() { -// let action = UIAction { [weak self] _ in -// self?.didTapChangeButton() -// } -// self.changeButton.addAction(action, for: .touchUpInside) -// } - -// private func setupMemberSlider() { -// let valueChangeAction = UIAction { [weak self] action in -// guard let sender = action.sender as? UISlider else { return } -// self?.changeMemberCount(sender: sender) -// } -// self.memberSlider.addAction(valueChangeAction, for: .valueChanged) -// } - -// private func presentationControllerDidAttemptToDismissAlert() { -// guard self.calendarView.isFirstTap else { -// self.dismiss(animated: true) -// return -// } -// self.showDiscardChangAlert() -// } - - private func showDiscardChangAlert() { - let actionTitles = [TextLiteral.destructive, TextLiteral.cancel] - let actionStyle: [UIAlertAction.Style] = [.destructive, .cancel] - let actions: [((UIAlertAction) -> Void)?] = [{ [weak self] _ in - self?.dismiss(animated: true) - }, nil] - makeActionSheet(actionTitles: actionTitles, - actionStyle: actionStyle, - actions: actions) + override func configureUI() { + super.configureUI() + self.presentationController?.delegate = self + self.isModalInPresentation = true } -// private func setupCalendarChangeButton() { -// self.calendarView.changeButtonState = { [weak self] value in -// self?.changeButton.isEnabled = value -// self?.changeButton.setTitleColor(.subBlue, for: .normal) -// self?.changeButton.setTitleColor(.grey002, for: .disabled) -// } -// } + // MARK: - func // private func didTapChangeButton() { // let dto = RoomDTO(title: self.roomTitle, @@ -316,13 +179,6 @@ final class DetailEditViewController: BaseViewController { // message: TextLiteral.detailEditViewControllerChangeRoomInfoAlertMessage) // } // } -// } - -// private func changeMemberCount(sender: UISlider) { -// self.sliderValue = Int(sender.value) -// self.memberCountLabel.text = String(Int(sender.value)) + TextLiteral.per -// self.memberCountLabel.font = .font(.regular, ofSize: 24) -// self.memberCountLabel.textColor = .white // } private func configureDelegation() { @@ -333,6 +189,25 @@ final class DetailEditViewController: BaseViewController { self.detailEditView.setupDateRange(from: self.startDateText, to: self.endDateText) } + private func presentationControllerDidAttemptToDismissAlert() { + guard self.detailEditView.calendarView.isFirstTap else { + self.dismiss(animated: true) + return + } + self.showDiscardActionSheet() + } + + private func showDiscardActionSheet() { + let actionTitles = [TextLiteral.destructive, TextLiteral.cancel] + let actionStyle: [UIAlertAction.Style] = [.destructive, .cancel] + let actions: [((UIAlertAction) -> Void)?] = [{ [weak self] _ in + self?.dismiss(animated: true) + }, nil] + self.makeActionSheet(actionTitles: actionTitles, + actionStyle: actionStyle, + actions: actions) + } + // MARK: - network private func putChangeRoomInfo(roomDto: RoomDTO) { @@ -359,7 +234,7 @@ final class DetailEditViewController: BaseViewController { extension DetailEditViewController: UIAdaptivePresentationControllerDelegate { func presentationControllerDidAttemptToDismiss(_ presentationController: UIPresentationController) { -// self.presentationControllerDidAttemptToDismissAlert() + self.presentationControllerDidAttemptToDismissAlert() } } diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 8d4742f37..52b1b9a7e 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -56,7 +56,7 @@ final class DetailEditView: UIView { label.textColor = .white return label }() - private let calendarView: CalendarView = CalendarView() + let calendarView: CalendarView = CalendarView() private let tipLabel: UILabel = { let label = UILabel() label.text = TextLiteral.maxMessage From 7d369136502eb084f02bce982e1e58e9f970864f Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 20 Apr 2023 18:15:06 +0900 Subject: [PATCH 038/468] =?UTF-8?q?[CHORE]=20=EB=B0=A9=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EC=88=98=EC=A0=95=20api=20=EC=97=B0=EA=B2=B0=20(#4?= =?UTF-8?q?45)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailEditViewController.swift | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index 7bcc732e0..c989878ff 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -210,23 +210,21 @@ final class DetailEditViewController: BaseViewController { // MARK: - network - private func putChangeRoomInfo(roomDto: RoomDTO) { + private func putChangeRoomInfo(roomDto: RoomDTO, completionHandler: @escaping ((Result) -> Void)) { Task { do { let status = try await self.detailWaitService.editRoomInfo(roomId: "\(roomIndex)", roomInfo: roomDto) - if status == 204 { - ToastView.showToast(message: "방 정보 수정 완료", - view: self.view ?? UIView()) -// self.didTappedChangeButton?() - self.dismiss(animated: true) + switch status { + case 200..<300: + completionHandler(.success(())) + default: + completionHandler(.failure((.unknownError))) } } catch NetworkError.serverError { - print("server Error") - } catch NetworkError.encodingError { - print("encoding Error") + completionHandler(.failure(.serverError)) } catch NetworkError.clientError(let message) { - print("client Error: \(String(describing: message))") + completionHandler(.failure(.clientError(message: message))) } } } @@ -248,6 +246,23 @@ extension DetailEditViewController: DetailEditDelegate { capacity: capacity, startDate: "20\(startDate)", endDate: "20\(endDate)") - print(dto) + if self.currentUserCount <= capacity { + self.putChangeRoomInfo(roomDto: dto) { [weak self] result in + switch result { + case .success: + // FIXME: - 토스트 고장 + ToastView.showToast(message: "방 정보 수정 완료", + controller: self ?? UIViewController()) + self?.dismiss() + case .failure: + self?.makeAlert(title: TextLiteral.detailEditViewControllerChangeErrorTitle, + message: TextLiteral.detailEditViewControllerChangeErrorMessage + ) + } + } + } else { + self.makeAlert(title: TextLiteral.detailEditViewControllerChangeRoomInfoAlertTitle, + message: TextLiteral.detailEditViewControllerChangeRoomInfoAlertMessage) + } } } From 4f7414899e03214e7b08f8f061a145230025f235 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 20 Apr 2023 18:15:34 +0900 Subject: [PATCH 039/468] =?UTF-8?q?[ADD]=20=EB=B0=A9=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=EC=98=A4=EB=A5=98=20alert=20TextLitera?= =?UTF-8?q?l=20=EC=B6=94=EA=B0=80=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Literal/TextLiteral.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Manito/Manito/Global/Literal/TextLiteral.swift b/Manito/Manito/Global/Literal/TextLiteral.swift index 9f6ede101..46bc5d1d3 100644 --- a/Manito/Manito/Global/Literal/TextLiteral.swift +++ b/Manito/Manito/Global/Literal/TextLiteral.swift @@ -202,6 +202,8 @@ enum TextLiteral { static let detailEditViewControllerSetMember: String = "인원 설정" static let detailEditViewControllerChangeRoomInfoAlertTitle: String = "인원을 다시 설정해 주세요" static let detailEditViewControllerChangeRoomInfoAlertMessage: String = "현재 인원보다 최대 인원을 \n더 적게 설정할 수 없어요." + static let detailEditViewControllerChangeErrorTitle: String = "오류 발생" + static let detailEditViewControllerChangeErrorMessage: String = "방 정보 수정에 실패했습니다. 다시 시도해주세요" // MARK: - InputNameView static let inputNameViewRoomNameText: String = "방 이름을 적어주세요" From 9c08d70cb40f2cf7eb1da1a48f93ce9d40daad3a Mon Sep 17 00:00:00 2001 From: chemi Date: Fri, 21 Apr 2023 17:20:03 +0900 Subject: [PATCH 040/468] =?UTF-8?q?[CHORE]=20=EC=A3=BC=EC=84=9D=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailEditViewController.swift | 112 ------------------ 1 file changed, 112 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index c989878ff..cf456c03b 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -7,7 +7,6 @@ import UIKit -import FSCalendar import SnapKit final class DetailEditViewController: BaseViewController { @@ -20,87 +19,6 @@ final class DetailEditViewController: BaseViewController { // MARK: - ui component private lazy var detailEditView = DetailEditView(maximumMemberCount: self.sliderValue) - -// private let cancelButton: UIButton = { -// let button = UIButton(type: .system) -// button.setTitle(TextLiteral.cancel, for: .normal) -// button.setTitleColor(.white, for: .normal) -// button.titleLabel?.font = .font(.regular, ofSize: 16) -// return button -// }() -// private let topIndicatorView: UIView = { -// let view = UIView() -// view.backgroundColor = .white.withAlphaComponent(0.8) -// view.layer.cornerRadius = 1.5 -// return view -// }() -// private let changeButton: UIButton = { -// let button = UIButton(type: .system) -// button.setTitle(TextLiteral.change, for: .normal) -// button.setTitleColor(.subBlue, for: .normal) -// button.titleLabel?.font = .font(.regular, ofSize: 16) -// return button -// }() -// private let titleLabel: UILabel = { -// let label = UILabel() -// label.text = TextLiteral.modifiedRoomInfo -// label.font = .font(.regular, ofSize: 16) -// return label -// }() -// private let startSettingLabel: UILabel = { -// let label = UILabel() -// label.text = TextLiteral.detailEditViewControllerStartSetting -// label.font = .font(.regular, ofSize: 16) -// label.textColor = .white -// return label -// }() -// private let calendarView: CalendarView = CalendarView() -// private let tipLabel: UILabel = { -// let label = UILabel() -// label.text = TextLiteral.maxMessage -// label.textColor = .grey004 -// label.font = .font(.regular, ofSize: 14) -// return label -// }() -// private let setMemberLabel: UILabel = { -// let label = UILabel() -// label.text = TextLiteral.detailEditViewControllerSetMember -// label.font = .font(.regular, ofSize: 18) -// label.textColor = .white -// return label -// }() -// private lazy var minMemberLabel: UILabel = { -// let label = UILabel() -// label.text = "\(Int(self.memberSlider.minimumValue))인" -// label.font = .font(.regular, ofSize: 16) -// label.textColor = .white -// return label -// }() -// private lazy var maxMemberLabel: UILabel = { -// let label = UILabel() -// label.text = "\(Int(self.memberSlider.maximumValue))인" -// label.font = .font(.regular, ofSize: 16) -// label.textColor = .white -// return label -// }() -// private lazy var memberSlider: UISlider = { -// let slider = UISlider() -// slider.minimumValue = 4 -// slider.maximumValue = 15 -// slider.maximumTrackTintColor = .darkGrey003 -// slider.minimumTrackTintColor = .red001 -// slider.value = Float(self.sliderValue) -// slider.isContinuous = true -// slider.setThumbImage(ImageLiterals.imageSliderThumb, for: .normal) -// return slider -// }() -// private lazy var memberCountLabel: UILabel = { -// let label = UILabel() -// label.text = "\(self.sliderValue)" + TextLiteral.per -// label.font = .font(.regular, ofSize: 24) -// label.textColor = .white -// return label -// }() // MARK: - property @@ -112,19 +30,7 @@ final class DetailEditViewController: BaseViewController { var currentUserCount: Int = 0 var sliderValue: Int = 10 var startDateText: String = "" -// { -// didSet { -// self.calendarView.startDateText = startDateText -// self.calendarView.setupDateRange() -// } -// } var endDateText: String = "" -// { -// didSet { -// self.calendarView.endDateText = endDateText -// self.calendarView.setupDateRange() -// } -// } // MARK: - init @@ -162,24 +68,6 @@ final class DetailEditViewController: BaseViewController { } // MARK: - func - -// private func didTapChangeButton() { -// let dto = RoomDTO(title: self.roomTitle, -// capacity: Int(self.memberSlider.value), -// startDate: "20\(self.calendarView.getTempStartDate())", -// endDate: "20\(self.calendarView.getTempEndDate())") -// switch self.editMode { -// case .date: -// self.putChangeRoomInfo(roomDto: dto) -// case .information: -// if self.currentUserCount <= self.sliderValue { -// self.putChangeRoomInfo(roomDto: dto) -// } else { -// self.makeAlert(title: TextLiteral.detailEditViewControllerChangeRoomInfoAlertTitle, -// message: TextLiteral.detailEditViewControllerChangeRoomInfoAlertMessage) -// } -// } -// } private func configureDelegation() { self.detailEditView.configureDelegation(self) From f060fb6fe8238392ef76a537406de75f2cc18b38 Mon Sep 17 00:00:00 2001 From: chemi Date: Fri, 21 Apr 2023 17:27:51 +0900 Subject: [PATCH 041/468] =?UTF-8?q?[FEAT]=20=EB=B3=80=EA=B2=BD=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20tap=EC=8B=9C=20=EB=B0=A9=20=EC=A0=95=EB=B3=B4=20rel?= =?UTF-8?q?oad=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/DetailEditViewController.swift | 3 ++- .../Manito/Screens/Detail-Wait/DetailWaitViewController.swift | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index cf456c03b..294baad5c 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -23,7 +23,7 @@ final class DetailEditViewController: BaseViewController { // MARK: - property private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) -// var didTappedChangeButton: (() -> ())? + var didTappedChangeButton: (() -> ())? private let roomIndex: Int private let roomTitle: String var editMode: EditMode @@ -141,6 +141,7 @@ extension DetailEditViewController: DetailEditDelegate { // FIXME: - 토스트 고장 ToastView.showToast(message: "방 정보 수정 완료", controller: self ?? UIViewController()) + self?.didTappedChangeButton?() self?.dismiss() case .failure: self?.makeAlert(title: TextLiteral.detailEditViewControllerChangeErrorTitle, diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 66059005f..7ddd1c8db 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -67,6 +67,9 @@ final class DetailWaitViewController: BaseViewController { let viewController = DetailEditViewController(editMode: isOnlyDateEdit ? .date : .information, roomIndex: index, title: title) + viewController.didTappedChangeButton = { [weak self] in + self?.fetchRoomData() + } if self.checkStartDateIsPast(startDate) { let fiveDaysInterval: TimeInterval = 86400 * 4 viewController.startDateText = Date().dateToString From 9f8f00ca38eea02e59a001bba8ec71edd3c3161c Mon Sep 17 00:00:00 2001 From: chemi Date: Fri, 21 Apr 2023 17:55:48 +0900 Subject: [PATCH 042/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailEditViewController.swift | 1 + .../Screens/Detail-Wait/View/DetailEditView.swift | 11 +++-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index 294baad5c..f628327ed 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -41,6 +41,7 @@ final class DetailEditViewController: BaseViewController { super.init() } + @available(*, unavailable) required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 52b1b9a7e..81d9a1150 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -16,11 +16,6 @@ protocol DetailEditDelegate: AnyObject { final class DetailEditView: UIView { -// enum EditMode { -// case date -// case information -// } - // MARK: - ui component private let cancelButton: UIButton = { @@ -113,6 +108,8 @@ final class DetailEditView: UIView { } } + // MARK: - init + init(maximumMemberCount: Int) { self.maximumMemberCount = maximumMemberCount super.init(frame: .zero) @@ -177,9 +174,7 @@ final class DetailEditView: UIView { $0.trailing.equalToSuperview().inset(25) } -// if self.editMode == .information { - self.setupEditMembersLayout() -// } + self.setupEditMembersLayout() } private func setupEditMembersLayout() { From bddaaf56ec940596a358a98300dbedf794f0ec94 Mon Sep 17 00:00:00 2001 From: chemi Date: Fri, 21 Apr 2023 21:50:48 +0900 Subject: [PATCH 043/468] =?UTF-8?q?[CHORE]=20room=20=EB=AA=A8=EB=8D=B8?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EC=88=98=20=EC=A0=81=EC=9A=A9=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailEditViewController.swift | 43 +++++++++---------- .../DetailWaitViewController.swift | 21 +-------- .../Detail-Wait/View/DetailEditView.swift | 31 +++++++++---- 3 files changed, 45 insertions(+), 50 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index f628327ed..753ed29c9 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -11,33 +11,21 @@ import SnapKit final class DetailEditViewController: BaseViewController { - enum EditMode { - case date - case information - } - // MARK: - ui component - private lazy var detailEditView = DetailEditView(maximumMemberCount: self.sliderValue) + private let detailEditView: DetailEditView // MARK: - property private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) var didTappedChangeButton: (() -> ())? - private let roomIndex: Int - private let roomTitle: String - var editMode: EditMode - var currentUserCount: Int = 0 - var sliderValue: Int = 10 - var startDateText: String = "" - var endDateText: String = "" + private let room: Room // MARK: - init - init(editMode: EditMode, roomIndex: Int, title: String) { - self.editMode = editMode - self.roomIndex = roomIndex - self.roomTitle = title + init(editMode: DetailEditView.EditMode, room: Room) { + self.detailEditView = DetailEditView(editMode: editMode) + self.room = room super.init() } @@ -60,6 +48,7 @@ final class DetailEditViewController: BaseViewController { super.viewDidLoad() self.configureDelegation() self.setupCalendarLayout() + self.setupMemberSliderValue() } override func configureUI() { @@ -75,7 +64,14 @@ final class DetailEditViewController: BaseViewController { } private func setupCalendarLayout() { - self.detailEditView.setupDateRange(from: self.startDateText, to: self.endDateText) + guard let startDate = self.room.roomInformation?.startDate, + let endDate = self.room.roomInformation?.endDate else { return } + self.detailEditView.setupDateRange(from: startDate, to: endDate) + } + + private func setupMemberSliderValue() { + guard let capacity = self.room.roomInformation?.capacity else { return } + self.detailEditView.setupSliderValue(capacity) } private func presentationControllerDidAttemptToDismissAlert() { @@ -85,7 +81,7 @@ final class DetailEditViewController: BaseViewController { } self.showDiscardActionSheet() } - + private func showDiscardActionSheet() { let actionTitles = [TextLiteral.destructive, TextLiteral.cancel] let actionStyle: [UIAlertAction.Style] = [.destructive, .cancel] @@ -100,9 +96,10 @@ final class DetailEditViewController: BaseViewController { // MARK: - network private func putChangeRoomInfo(roomDto: RoomDTO, completionHandler: @escaping ((Result) -> Void)) { + guard let roomIndex = self.room.roomInformation?.id else { return } Task { do { - let status = try await self.detailWaitService.editRoomInfo(roomId: "\(roomIndex)", + let status = try await self.detailWaitService.editRoomInfo(roomId: roomIndex.description, roomInfo: roomDto) switch status { case 200..<300: @@ -131,11 +128,13 @@ extension DetailEditViewController: DetailEditDelegate { } func changeRoomInformation(capacity: Int, from startDate: String, to endDate: String) { - let dto = RoomDTO(title: self.roomTitle, + guard let roomTitle = self.room.roomInformation?.title, + let currentUserCount = self.room.participants?.count else { return } + let dto = RoomDTO(title: roomTitle, capacity: capacity, startDate: "20\(startDate)", endDate: "20\(endDate)") - if self.currentUserCount <= capacity { + if currentUserCount <= capacity { self.putChangeRoomInfo(roomDto: dto) { [weak self] result in switch result { case .success: diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 7ddd1c8db..1e2f366e2 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -57,29 +57,12 @@ final class DetailWaitViewController: BaseViewController { } private func presentDetailEditViewController(isOnlyDateEdit: Bool) { - guard let room = self.roomInformation, - let index = room.roomInformation?.id, - let title = room.roomInformation?.title, - let startDate = room.roomInformation?.startDate, - let endDate = room.roomInformation?.endDate, - let currentUserCount = room.participants?.count, - let capacity = room.roomInformation?.capacity else { return } + guard let room = self.roomInformation else { return } let viewController = DetailEditViewController(editMode: isOnlyDateEdit ? .date : .information, - roomIndex: index, - title: title) + room: room) viewController.didTappedChangeButton = { [weak self] in self?.fetchRoomData() } - if self.checkStartDateIsPast(startDate) { - let fiveDaysInterval: TimeInterval = 86400 * 4 - viewController.startDateText = Date().dateToString - viewController.endDateText = (Date() + fiveDaysInterval).dateToString - } else { - viewController.startDateText = startDate - viewController.endDateText = endDate - } - viewController.currentUserCount = currentUserCount - viewController.sliderValue = capacity self.present(viewController, animated: true) } diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 81d9a1150..6e2845d9b 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -16,6 +16,11 @@ protocol DetailEditDelegate: AnyObject { final class DetailEditView: UIView { + enum EditMode { + case date + case information + } + // MARK: - ui component private let cancelButton: UIButton = { @@ -80,20 +85,18 @@ final class DetailEditView: UIView { label.textColor = .white return label }() - private lazy var memberSlider: UISlider = { + private let memberSlider: UISlider = { let slider = UISlider() slider.minimumValue = 4 slider.maximumValue = 15 slider.maximumTrackTintColor = .darkGrey003 slider.minimumTrackTintColor = .red001 - slider.value = Float(self.maximumMemberCount) slider.isContinuous = true slider.setThumbImage(ImageLiterals.imageSliderThumb, for: .normal) return slider }() private lazy var memberCountLabel: UILabel = { let label = UILabel() - label.text = "\(self.maximumMemberCount)" + TextLiteral.per label.font = .font(.regular, ofSize: 24) label.textColor = .white return label @@ -102,16 +105,19 @@ final class DetailEditView: UIView { // MARK: - property private weak var delegate: DetailEditDelegate? - private var maximumMemberCount: Int { - didSet { - self.memberCountLabel.text = maximumMemberCount.description + TextLiteral.per + private let editMode: EditMode + private var maximumMemberCount: Int? { + willSet(count) { + if let count { + self.memberCountLabel.text = count.description + TextLiteral.per + } } } // MARK: - init - init(maximumMemberCount: Int) { - self.maximumMemberCount = maximumMemberCount + init(editMode: EditMode) { + self.editMode = editMode super.init(frame: .zero) self.setupLayout() self.setupCancleButton() @@ -174,7 +180,9 @@ final class DetailEditView: UIView { $0.trailing.equalToSuperview().inset(25) } - self.setupEditMembersLayout() + if self.editMode == .information { + self.setupEditMembersLayout() + } } private func setupEditMembersLayout() { @@ -221,6 +229,11 @@ final class DetailEditView: UIView { self.calendarView.setupDateRange() } + func setupSliderValue(_ value: Int) { + self.maximumMemberCount = value + self.memberSlider.value = Float(value) + } + private func setupCancleButton() { let action = UIAction { [weak self] _ in self?.delegate?.dismiss() From 88147635874e4b0920d0919771fefbb95bb71e30 Mon Sep 17 00:00:00 2001 From: chemi Date: Fri, 21 Apr 2023 21:54:31 +0900 Subject: [PATCH 044/468] =?UTF-8?q?[CHORE]=20=ED=86=A0=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=20=EA=B3=A0=EC=9E=A5=20=ED=95=B4=EA=B2=B0=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/DetailEditViewController.swift | 3 --- .../Manito/Screens/Detail-Wait/DetailWaitViewController.swift | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index 753ed29c9..e5fb50772 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -138,9 +138,6 @@ extension DetailEditViewController: DetailEditDelegate { self.putChangeRoomInfo(roomDto: dto) { [weak self] result in switch result { case .success: - // FIXME: - 토스트 고장 - ToastView.showToast(message: "방 정보 수정 완료", - controller: self ?? UIViewController()) self?.didTappedChangeButton?() self?.dismiss() case .failure: diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 1e2f366e2..eb3b5b68f 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -62,6 +62,8 @@ final class DetailWaitViewController: BaseViewController { room: room) viewController.didTappedChangeButton = { [weak self] in self?.fetchRoomData() + ToastView.showToast(message: "방 정보 수정 완료", + controller: self ?? UIViewController()) } self.present(viewController, animated: true) } From 8efac235d2b4b006a05c68c3781b3c3921e62d33 Mon Sep 17 00:00:00 2001 From: chemi Date: Fri, 21 Apr 2023 22:10:43 +0900 Subject: [PATCH 045/468] =?UTF-8?q?[CHORE]=20default=20=EC=8B=9C=EC=9E=91?= =?UTF-8?q?=20=EB=82=A0=EC=A7=9C=20=EC=84=A4=EC=A0=95=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/View/DetailEditView.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 6e2845d9b..99309c77b 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -224,8 +224,15 @@ final class DetailEditView: UIView { } func setupDateRange(from startDateString: String, to endDateString: String) { - self.calendarView.startDateText = startDateString - self.calendarView.endDateText = endDateString + guard let startDate = startDateString.stringToDate else { return } + if startDate.isPast() { + let fiveDaysInterval: TimeInterval = 86400 * 4 + self.calendarView.startDateText = Date().dateToString + self.calendarView.endDateText = (Date() + fiveDaysInterval).dateToString + } else { + self.calendarView.startDateText = startDateString + self.calendarView.endDateText = endDateString + } self.calendarView.setupDateRange() } From 137aee36faa08ddfc951ceb4c84db64c19bb44cc Mon Sep 17 00:00:00 2001 From: chemi Date: Fri, 21 Apr 2023 23:02:12 +0900 Subject: [PATCH 046/468] =?UTF-8?q?[CHORE]=20lazy=20var=20->=20let=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 99309c77b..e037797fe 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -95,7 +95,7 @@ final class DetailEditView: UIView { slider.setThumbImage(ImageLiterals.imageSliderThumb, for: .normal) return slider }() - private lazy var memberCountLabel: UILabel = { + private let memberCountLabel: UILabel = { let label = UILabel() label.font = .font(.regular, ofSize: 24) label.textColor = .white From 31a1e9c323e5064b66f4d4b9f940496a14e363d2 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 22 Apr 2023 13:27:46 +0900 Subject: [PATCH 047/468] =?UTF-8?q?[CHORE]=20=EB=A7=88=EB=8B=88=EB=9D=A0?= =?UTF-8?q?=20=EA=B3=B5=EA=B0=9C=20=EB=B7=B0=20=EC=BB=A8=ED=94=8C=EB=A6=AD?= =?UTF-8?q?=ED=8A=B8=20=ED=95=B4=EA=B2=B0=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/DetailWaitViewController.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 378f9c839..8cf44e312 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -86,12 +86,10 @@ final class DetailWaitViewController: BaseViewController { } private func presentSelectManittoViewController(nickname: String) { - guard let roomId = self.roomInformation?.id?.description else { return } + guard let roomId = self.roomInformation?.roomInformation?.id?.description else { return } let viewController = SelectManitteeViewController(roomId: roomId, manitteeNickname: nickname) viewController.modalTransitionStyle = .crossDissolve viewController.modalPresentationStyle = .fullScreen - viewController.manitteeName = nickname - viewController.roomId = self.roomIndex.description self.present(viewController, animated: true) } From 19d225f95f9722cffe75761aab5739ae1370beb5 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 22 Apr 2023 13:36:59 +0900 Subject: [PATCH 048/468] =?UTF-8?q?[CHORE]=20isPast=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Extension/Date+Extension.swift | 2 +- .../Manito/Screens/Detail-Wait/DetailWaitViewController.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Global/Extension/Date+Extension.swift b/Manito/Manito/Global/Extension/Date+Extension.swift index 35cd96821..cd6f768ce 100644 --- a/Manito/Manito/Global/Extension/Date+Extension.swift +++ b/Manito/Manito/Global/Extension/Date+Extension.swift @@ -38,7 +38,7 @@ extension Date { return self.isToday && self.isOverOpenTime } - func isPast() -> Bool { + var isPast: Bool { let distance = self.distance(to: Date()) return distance > 86400 } diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 8cf44e312..61e41b8b0 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -82,7 +82,7 @@ final class DetailWaitViewController: BaseViewController { private func checkStartDateIsPast(_ startDate: String) -> Bool { guard let startDate = startDate.stringToDate else { return false } - return startDate.isPast() + return startDate.isPast } private func presentSelectManittoViewController(nickname: String) { From 34d36192b25b9aaf9024a742c6dac269591a6d3d Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 22 Apr 2023 13:46:02 +0900 Subject: [PATCH 049/468] =?UTF-8?q?[CHORE]=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=A0=9C=EB=AA=A9=20=ED=86=B5=ED=95=A9=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Literal/TextLiteral.swift | 5 +---- .../Screens/Detail-Wait/DetailWaitViewController.swift | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Manito/Manito/Global/Literal/TextLiteral.swift b/Manito/Manito/Global/Literal/TextLiteral.swift index 54dc52f4c..84378c622 100644 --- a/Manito/Manito/Global/Literal/TextLiteral.swift +++ b/Manito/Manito/Global/Literal/TextLiteral.swift @@ -35,6 +35,7 @@ enum TextLiteral { static let createRoom: String = "방 생성하기" static let next: String = "다음" static let previous: String = "이전" + static let errorAlertTitle: String = "오류 발생" // MARK: - SettingDeveloperInfo static let settingDeveloperInfoTitle: String = "개발자 정보" @@ -182,13 +183,9 @@ enum TextLiteral { static let detailWaitViewControllerPastAlertTitle: String = "마니또 시작일이 지났어요" static let detailWaitViewControllerPastAlertMessage: String = "방장이 진행기간을 재설정 \n 할 때까지 기다려주세요." static let detailWaitViewControllerPastOwnerAlertMessage: String = "진행기간을 재설정 해주세요" - static let detailWaitViewControllerDeleteErrorTitle: String = "오류 발생" static let detailWaitViewControllerDeleteErrorMessage: String = "방 삭제에 실패했습니다. 다시 시도해주세요" - static let detailWaitViewControllerStartErrorTitle: String = "오류 발생" static let detailWaitViewControllerStartErrorMessage: String = "마니또 시작에 실패했습니다. 다시 시도해주세요" - static let detailWaitViewControllerLeaveErrorTitle: String = "오류 발생" static let detailWaitViewControllerLeaveErrorMessage: String = "방 나가기에 실패했습니다. 다시 시도해주세요" - static let detailWaitViewControllerLoadDataTitle: String = "오류 발생" static let detailWaitViewControllerLoadDataMessage: String = "방 정보를 불러올 수 없습니다. 다시 시도해주세요" // MARK: - MemoryViewController diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 61e41b8b0..d335642a0 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -106,7 +106,7 @@ final class DetailWaitViewController: BaseViewController { self?.detailWaitView.configureLayout(room: room) } case .failure: - self?.makeAlert(title: TextLiteral.detailWaitViewControllerLoadDataTitle, + self?.makeAlert(title: TextLiteral.errorAlertTitle, message: TextLiteral.detailWaitViewControllerLoadDataMessage) } } @@ -188,7 +188,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { case .success(let nickname): self?.presentSelectManittoViewController(nickname: nickname) case .failure: - self?.makeAlert(title: TextLiteral.detailWaitViewControllerStartErrorTitle, + self?.makeAlert(title: TextLiteral.errorAlertTitle, message: TextLiteral.detailWaitViewControllerStartErrorMessage) } } @@ -208,7 +208,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { case .success: self?.navigationController?.popViewController(animated: true) case .failure: - self?.makeAlert(title: TextLiteral.detailWaitViewControllerDeleteErrorTitle, + self?.makeAlert(title: TextLiteral.errorAlertTitle, message: TextLiteral.detailWaitViewControllerDeleteErrorMessage) } } @@ -224,7 +224,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { case .success: self?.navigationController?.popViewController(animated: true) case .failure: - self?.makeAlert(title: TextLiteral.detailWaitViewControllerLeaveErrorTitle, + self?.makeAlert(title: TextLiteral.errorAlertTitle, message: TextLiteral.detailWaitViewControllerLeaveErrorMessage) } } From 1bc7c2d5e5dc04c84e3a1ad3b588a56b7fd71287 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 22 Apr 2023 13:56:53 +0900 Subject: [PATCH 050/468] =?UTF-8?q?[CHORE]=20ToastView=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/UIComponent/ToastPopupView.swift | 35 ------------------- .../DetailEditViewController.swift | 2 +- .../DetailWaitViewController.swift | 6 ++++ .../Detail-Wait/View/DetailWaitView.swift | 5 ++- 4 files changed, 9 insertions(+), 39 deletions(-) diff --git a/Manito/Manito/Global/UIComponent/ToastPopupView.swift b/Manito/Manito/Global/UIComponent/ToastPopupView.swift index 5a8f86044..73a5c6fa9 100644 --- a/Manito/Manito/Global/UIComponent/ToastPopupView.swift +++ b/Manito/Manito/Global/UIComponent/ToastPopupView.swift @@ -39,44 +39,9 @@ struct ToastView { }) }) } - - static func showToast(message: String, view: UIView) { - let toastLabel = UILabel() - toastLabel.backgroundColor = .grey001 - toastLabel.textColor = .black - toastLabel.font = .font(.regular, ofSize: 14) - toastLabel.textAlignment = .center - toastLabel.text = message - toastLabel.alpha = 0 - toastLabel.layer.cornerRadius = 10 - toastLabel.clipsToBounds = true - view.addSubview(toastLabel) - - toastLabel.snp.makeConstraints { - $0.centerX.equalToSuperview() - $0.bottom.equalToSuperview().inset(150) - $0.width.equalTo(140) - $0.height.equalTo(40) - } - - UIView.animate(withDuration: 0.7, animations: { - toastLabel.alpha = 0.8 - }, completion: { isCompleted in - UIView.animate(withDuration: 0.7, delay: 0.5, animations: { - toastLabel.alpha = 0 - }, completion: { isCompleted in - toastLabel.removeFromSuperview() - }) - }) - } static func showToast(code: String, message: String, controller: UIViewController) { UIPasteboard.general.string = code showToast(message: TextLiteral.detailWaitViewControllerCopyCode, controller: controller) } - - static func showToast(code: String, message: String, view: UIView) { - UIPasteboard.general.string = code - showToast(message: TextLiteral.detailWaitViewControllerCopyCode, view: view) - } } diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index 71f70f933..9f09850ee 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -324,7 +324,7 @@ final class DetailEditViewController: BaseViewController { roomInfo: roomDto) if status == 204 { ToastView.showToast(message: "방 정보 수정 완료", - view: self.view ?? UIView()) + controller: self) self.didTappedChangeButton?() self.dismiss(animated: true) } diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index d335642a0..08c1cd1a0 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -242,4 +242,10 @@ extension DetailWaitViewController: DetailWaitViewDelegate { func showAlert(title: String, message: String) { self.makeAlert(title: title, message: message) } + + func didTapCodeCopyButton(invitationCode: String) { + ToastView.showToast(code: invitationCode, + message: TextLiteral.detailWaitViewControllerCopyCode, + controller: self) + } } diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 6bfd2bc50..eb2239a34 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -16,6 +16,7 @@ protocol DetailWaitViewDelegate: AnyObject { func leaveRoom(title: String, message: String, okTitle: String) func presentEditViewControllerAfterShowAlert() func showAlert(title: String, message: String) + func didTapCodeCopyButton(invitationCode: String) } final class DetailWaitView: UIView { @@ -180,9 +181,7 @@ final class DetailWaitView: UIView { private func setupCopyButton(_ invitationCode: String) { let action = UIAction { [weak self] _ in - ToastView.showToast(code: invitationCode, - message: TextLiteral.detailWaitViewControllerCopyCode, - view: self ?? UIView()) + self?.delegate?.didTapCodeCopyButton(invitationCode: invitationCode) } self.copyButton.addAction(action, for: .touchUpInside) } From 5da81333762bc9e193574a8004849c41a77dc407 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 22 Apr 2023 14:13:10 +0900 Subject: [PATCH 051/468] =?UTF-8?q?[CHORE]=20dateRange=20=EB=AA=A8?= =?UTF-8?q?=EB=8D=B8=EB=A1=9C=20=EB=B6=84=EB=A6=AC=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Network/Models/Room.swift | 15 ++++++++++++++- .../Detail-Wait/DetailWaitViewController.swift | 16 ++++++---------- .../Detail-Wait/View/DetailWaitView.swift | 2 +- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Manito/Manito/Network/Models/Room.swift b/Manito/Manito/Network/Models/Room.swift index ad8f1e7e8..1abcf3fe6 100644 --- a/Manito/Manito/Network/Models/Room.swift +++ b/Manito/Manito/Network/Models/Room.swift @@ -104,7 +104,7 @@ struct RoomInfo: Decodable { let id, capacity: Int? let title, startDate, endDate, state: String? - var dateRange: String { + var dateRangeText: String { if let startDate, let endDate { return startDate + " ~ " + endDate @@ -130,6 +130,19 @@ struct RoomInfo: Decodable { return false } } + + var isStartDatePast: Bool { + guard let startDate = self.startDate?.stringToDate else { return true } + return startDate.isPast + } + + var dateRange: (startDate: String, endDate: String) { + let fiveDaysInterval: TimeInterval = 86400 * 4 + let startDate: String = isStartDatePast ? Date().dateToString : self.startDate ?? "" + let endDate: String = isStartDatePast ? (Date() + fiveDaysInterval).dateToString : self.endDate ?? "" + + return (startDate, endDate) + } } struct Mission: Codable { diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 08c1cd1a0..8a84c256b 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -60,21 +60,17 @@ final class DetailWaitViewController: BaseViewController { guard let room = self.roomInformation, let index = room.roomInformation?.id, let title = room.roomInformation?.title, - let startDate = room.roomInformation?.startDate, - let endDate = room.roomInformation?.endDate, let currentUserCount = room.participants?.count, let capacity = room.roomInformation?.capacity else { return } let viewController = DetailEditViewController(editMode: isOnlyDateEdit ? .date : .information, roomIndex: index, title: title) - if self.checkStartDateIsPast(startDate) { - let fiveDaysInterval: TimeInterval = 86400 * 4 - viewController.startDateText = Date().dateToString - viewController.endDateText = (Date() + fiveDaysInterval).dateToString - } else { - viewController.startDateText = startDate - viewController.endDateText = endDate - } + + guard let startDate = room.roomInformation?.dateRange.startDate, + let endDate = room.roomInformation?.dateRange.endDate else { return } + + viewController.startDateText = startDate + viewController.endDateText = endDate viewController.currentUserCount = currentUserCount viewController.sliderValue = capacity self.present(viewController, animated: true) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index eb2239a34..675edc6b8 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -200,7 +200,7 @@ final class DetailWaitView: UIView { func configureLayout(room: Room) { guard let title = room.roomInformation?.title, let state = room.roomInformation?.state, - let dateRange = room.roomInformation?.dateRange, + let dateRange = room.roomInformation?.dateRangeText, let users = room.participants?.members, let isOwner = room.admin, let code = room.invitation?.code, From c4922143a794a47e65f15a36b63d4bda97ebd492 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 22 Apr 2023 14:17:39 +0900 Subject: [PATCH 052/468] =?UTF-8?q?[CHORE]=20=EC=BA=90=EB=A6=AD=ED=84=B0?= =?UTF-8?q?=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EB=B7=B0=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EB=B0=8D=20=EB=B3=80=EA=B2=BD=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/View/DetailWaitView.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 675edc6b8..7fdf7fa67 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -69,7 +69,7 @@ final class DetailWaitView: UIView { label.font = .font(.regular, ofSize: 16) return label }() - private let imgNiView: UIImageView = { + private let niCharacterImageView: UIImageView = { let imageView = UIImageView() imageView.image = ImageLiterals.imgNi return imageView @@ -144,8 +144,8 @@ final class DetailWaitView: UIView { $0.top.equalTo(titleView.snp.bottom).offset(44) } - self.addSubview(self.imgNiView) - self.imgNiView.snp.makeConstraints { + self.addSubview(self.niCharacterImageView) + self.niCharacterImageView.snp.makeConstraints { $0.centerY.equalTo(self.togetherFriendLabel.snp.centerY) $0.leading.equalTo(self.togetherFriendLabel.snp.trailing).offset(7) $0.width.height.equalTo(30) @@ -153,8 +153,8 @@ final class DetailWaitView: UIView { self.addSubview(self.userCountLabel) self.userCountLabel.snp.makeConstraints { - $0.leading.equalTo(self.imgNiView.snp.trailing) - $0.centerY.equalTo(self.imgNiView.snp.centerY) + $0.leading.equalTo(self.niCharacterImageView.snp.trailing) + $0.centerY.equalTo(self.niCharacterImageView.snp.centerY) } self.addSubview(self.copyButton) From 4313cb584742d0ad9087a8e5bc58ee0b2206cc24 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 22 Apr 2023 14:22:21 +0900 Subject: [PATCH 053/468] =?UTF-8?q?[CHORE]=20isAdmin=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EB=B0=8D=EC=9C=BC=EB=A1=9C=20=ED=86=B5=EC=9D=BC=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Global/Literal/TextLiteral.swift | 2 +- .../DetailWaitViewController.swift | 2 +- .../Detail-Wait/View/DetailWaitView.swift | 36 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Manito/Manito/Global/Literal/TextLiteral.swift b/Manito/Manito/Global/Literal/TextLiteral.swift index 84378c622..e8d299b32 100644 --- a/Manito/Manito/Global/Literal/TextLiteral.swift +++ b/Manito/Manito/Global/Literal/TextLiteral.swift @@ -182,7 +182,7 @@ enum TextLiteral { static let detailWaitViewControllerCopyCode: String = "코드 복사 완료!" static let detailWaitViewControllerPastAlertTitle: String = "마니또 시작일이 지났어요" static let detailWaitViewControllerPastAlertMessage: String = "방장이 진행기간을 재설정 \n 할 때까지 기다려주세요." - static let detailWaitViewControllerPastOwnerAlertMessage: String = "진행기간을 재설정 해주세요" + static let detailWaitViewControllerPastAdminAlertMessage: String = "진행기간을 재설정 해주세요" static let detailWaitViewControllerDeleteErrorMessage: String = "방 삭제에 실패했습니다. 다시 시도해주세요" static let detailWaitViewControllerStartErrorMessage: String = "마니또 시작에 실패했습니다. 다시 시도해주세요" static let detailWaitViewControllerLeaveErrorMessage: String = "방 나가기에 실패했습니다. 다시 시도해주세요" diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 8a84c256b..1930a3322 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -229,7 +229,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { func presentEditViewControllerAfterShowAlert() { self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, - message: TextLiteral.detailWaitViewControllerPastOwnerAlertMessage, + message: TextLiteral.detailWaitViewControllerPastAdminAlertMessage, okAction: { [weak self] _ in self?.presentDetailEditViewController(isOnlyDateEdit: true) } ) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 7fdf7fa67..96fce1687 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -21,14 +21,14 @@ protocol DetailWaitViewDelegate: AnyObject { final class DetailWaitView: UIView { private enum UserStatus: CaseIterable { - case owner + case admin case member var alertText: (title: String, message: String, okTitle: String) { switch self { - case .owner: + case .admin: return (title: TextLiteral.datailWaitViewControllerDeleteTitle, message: TextLiteral.datailWaitViewControllerDeleteMessage, okTitle: TextLiteral.delete) @@ -202,7 +202,7 @@ final class DetailWaitView: UIView { let state = room.roomInformation?.state, let dateRange = room.roomInformation?.dateRangeText, let users = room.participants?.members, - let isOwner = room.admin, + let isAdmin = room.admin, let code = room.invitation?.code, let isStart = room.roomInformation?.isStart else { return } @@ -211,12 +211,12 @@ final class DetailWaitView: UIView { self.userCountLabel.text = room.userCount self.titleView.setDurationDateLabel(text: dateRange) self.userArray = users - self.showStartButtonForAdmin(isOwner) + self.showStartButtonForAdmin(isAdmin) self.canStart = room.canStart - self.setExitButtonMenu(isOwner) + self.setExitButtonMenu(isAdmin) self.setupCopyButton(code) - self.showAlertWhenPastDate(isOwner, isStart: isStart) - self.setupTitleViewGesture(isOwner) + self.showAlertWhenPastDate(isAdmin, isStart: isStart) + self.setupTitleViewGesture(isAdmin) } private func updateTableViewHeight() { @@ -230,8 +230,8 @@ final class DetailWaitView: UIView { } } - private func showStartButtonForAdmin(_ isOwner: Bool) { - self.startButton.isHidden = !isOwner + private func showStartButtonForAdmin(_ isAdmin: Bool) { + self.startButton.isHidden = !isAdmin } private func configureStartButton(_ canStart: Bool) { @@ -248,15 +248,15 @@ final class DetailWaitView: UIView { } } - private func setExitButtonMenu(_ isOwner: Bool) { + private func setExitButtonMenu(_ isAdmin: Bool) { var children: [UIAction] - if isOwner { + if isAdmin { children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in self?.delegate?.presentRoomEditViewController(isOnlyDateEdit: false) }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in - self?.delegate?.deleteRoom(title: UserStatus.owner.alertText.title, - message: UserStatus.owner.alertText.message, - okTitle: UserStatus.owner.alertText.okTitle) + self?.delegate?.deleteRoom(title: UserStatus.admin.alertText.title, + message: UserStatus.admin.alertText.message, + okTitle: UserStatus.admin.alertText.okTitle) }) ] } else { @@ -272,10 +272,10 @@ final class DetailWaitView: UIView { } private func showAlertWhenPastDate(_ isAdmin: Bool, isStart: Bool) { - let type: UserStatus = isAdmin ? .owner : .member + let type: UserStatus = isAdmin ? .admin : .member if !isStart { switch type { - case .owner: + case .admin: self.delegate?.presentEditViewControllerAfterShowAlert() case .member: self.delegate?.showAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, @@ -284,8 +284,8 @@ final class DetailWaitView: UIView { } } - private func setupTitleViewGesture(_ isOwner: Bool) { - if isOwner { + private func setupTitleViewGesture(_ isAdmin: Bool) { + if isAdmin { let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.presentEditViewController)) self.titleView.addGestureRecognizer(tapGesture) } From 7620894c903033308165e6640b29c4548b16a098 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 25 Apr 2023 17:14:15 +0900 Subject: [PATCH 054/468] =?UTF-8?q?[CHORE]=20=EB=82=98=EA=B0=80=EA=B8=B0?= =?UTF-8?q?=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=99=84=EB=A3=8C=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 1930a3322..fa9bcac23 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -159,7 +159,6 @@ final class DetailWaitViewController: BaseViewController { } } - // FIXME: - 나가기 테스트 해야함 private func requestDeleteLeaveRoom(completionHandler: @escaping ((Result) -> Void)) { Task { do { From b969c01ff6388ff5c95d750b0925f2f1d592a281 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 4 May 2023 13:16:02 +0900 Subject: [PATCH 055/468] =?UTF-8?q?[CHORE]=20delegate=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailWaitViewController.swift | 8 ++++---- .../Detail-Wait/View/DetailWaitView.swift | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index fa9bcac23..bad711f39 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -177,7 +177,7 @@ final class DetailWaitViewController: BaseViewController { } extension DetailWaitViewController: DetailWaitViewDelegate { - func startManitto() { + func startButtonDidTap() { self.requestStartManitto() { [weak self] result in switch result { case .success(let nickname): @@ -193,7 +193,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { self.presentDetailEditViewController(isOnlyDateEdit: isOnlyDateEdit) } - func deleteRoom(title: String, message: String, okTitle: String) { + func deleteButtonDidTap(title: String, message: String, okTitle: String) { self.makeRequestAlert(title: title, message: message, okTitle: okTitle, @@ -210,7 +210,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { }) } - func leaveRoom(title: String, message: String, okTitle: String) { + func leaveButtonDidTap(title: String, message: String, okTitle: String) { self.makeRequestAlert(title: title, message: message, okAction: { [weak self] _ in @@ -238,7 +238,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { self.makeAlert(title: title, message: message) } - func didTapCodeCopyButton(invitationCode: String) { + func codeCopyButtonDidTap(invitationCode: String) { ToastView.showToast(code: invitationCode, message: TextLiteral.detailWaitViewControllerCopyCode, controller: self) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 96fce1687..a5fd5b3e2 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -10,13 +10,13 @@ import UIKit import SnapKit protocol DetailWaitViewDelegate: AnyObject { - func startManitto() + func startButtonDidTap() func presentRoomEditViewController(isOnlyDateEdit: Bool) - func deleteRoom(title: String, message: String, okTitle: String) - func leaveRoom(title: String, message: String, okTitle: String) + func deleteButtonDidTap(title: String, message: String, okTitle: String) + func leaveButtonDidTap(title: String, message: String, okTitle: String) func presentEditViewControllerAfterShowAlert() func showAlert(title: String, message: String) - func didTapCodeCopyButton(invitationCode: String) + func codeCopyButtonDidTap(invitationCode: String) } final class DetailWaitView: UIView { @@ -181,7 +181,7 @@ final class DetailWaitView: UIView { private func setupCopyButton(_ invitationCode: String) { let action = UIAction { [weak self] _ in - self?.delegate?.didTapCodeCopyButton(invitationCode: invitationCode) + self?.delegate?.codeCopyButtonDidTap(invitationCode: invitationCode) } self.copyButton.addAction(action, for: .touchUpInside) } @@ -239,7 +239,7 @@ final class DetailWaitView: UIView { self.startButton.title = ButtonText.start.status self.startButton.isDisabled = false let action = UIAction { [weak self] _ in - self?.delegate?.startManitto() + self?.delegate?.startButtonDidTap() } self.startButton.addAction(action, for: .touchUpInside) } else { @@ -254,14 +254,14 @@ final class DetailWaitView: UIView { children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in self?.delegate?.presentRoomEditViewController(isOnlyDateEdit: false) }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in - self?.delegate?.deleteRoom(title: UserStatus.admin.alertText.title, + self?.delegate?.deleteButtonDidTap(title: UserStatus.admin.alertText.title, message: UserStatus.admin.alertText.message, okTitle: UserStatus.admin.alertText.okTitle) }) ] } else { children = [UIAction(title: TextLiteral.detailWaitViewControllerLeaveRoom, handler: { [weak self] _ in - self?.delegate?.leaveRoom(title: UserStatus.member.alertText.title, + self?.delegate?.leaveButtonDidTap(title: UserStatus.member.alertText.title, message: UserStatus.member.alertText.message, okTitle: UserStatus.member.alertText.okTitle ) From 9e8382b923f44e9d640a6a0c3c03e250194053f5 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 4 May 2023 13:23:26 +0900 Subject: [PATCH 056/468] =?UTF-8?q?[CHORE]=20configure=ED=95=A8=EC=88=98?= =?UTF-8?q?=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/DetailWaitViewController.swift | 2 +- Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index bad711f39..acc52f953 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -99,7 +99,7 @@ final class DetailWaitViewController: BaseViewController { switch result { case .success(let room): DispatchQueue.main.async { - self?.detailWaitView.configureLayout(room: room) + self?.detailWaitView.bind(room: room) } case .failure: self?.makeAlert(title: TextLiteral.errorAlertTitle, diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index a5fd5b3e2..3d40a4bcd 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -197,7 +197,7 @@ final class DetailWaitView: UIView { navigationItem?.rightBarButtonItem = moreButton } - func configureLayout(room: Room) { + func bind(room: Room) { guard let title = room.roomInformation?.title, let state = room.roomInformation?.state, let dateRange = room.roomInformation?.dateRangeText, From 4f718efe8a6ca5a4ad70d04c592a9be164801625 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 4 May 2023 13:28:52 +0900 Subject: [PATCH 057/468] =?UTF-8?q?[CHORE]=20textLabel=20deprecated?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=88=98=EC=A0=95=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 3d40a4bcd..4f8955ddd 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -312,8 +312,10 @@ extension DetailWaitView: UITableViewDataSource { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = self.listTableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as UITableViewCell - cell.textLabel?.text = self.userArray[indexPath.row].nickname - cell.textLabel?.font = .font(.regular, ofSize: 17) + var cellConfigure = cell.defaultContentConfiguration() + cellConfigure.text = self.userArray[indexPath.row].nickname + cellConfigure.textProperties.font = .font(.regular, ofSize: 17) + cell.contentConfiguration = cellConfigure cell.backgroundColor = .darkGrey003 cell.selectionStyle = .none return cell From 1753196ab61990ca41d346b2558174561d3c77b2 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 4 May 2023 14:22:34 +0900 Subject: [PATCH 058/468] =?UTF-8?q?[CHORE]=20=EC=B4=88=EB=8C=80=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EB=B3=B5=EC=82=AC=20delegate=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=88=98=EC=A0=95=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/DetailWaitViewController.swift | 3 ++- Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index acc52f953..00bed6aa3 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -238,7 +238,8 @@ extension DetailWaitViewController: DetailWaitViewDelegate { self.makeAlert(title: title, message: message) } - func codeCopyButtonDidTap(invitationCode: String) { + func codeCopyButtonDidTap() { + guard let invitationCode = self.roomInformation?.invitation?.code else { return } ToastView.showToast(code: invitationCode, message: TextLiteral.detailWaitViewControllerCopyCode, controller: self) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 4f8955ddd..33c061f84 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -16,7 +16,7 @@ protocol DetailWaitViewDelegate: AnyObject { func leaveButtonDidTap(title: String, message: String, okTitle: String) func presentEditViewControllerAfterShowAlert() func showAlert(title: String, message: String) - func codeCopyButtonDidTap(invitationCode: String) + func codeCopyButtonDidTap() } final class DetailWaitView: UIView { @@ -181,7 +181,7 @@ final class DetailWaitView: UIView { private func setupCopyButton(_ invitationCode: String) { let action = UIAction { [weak self] _ in - self?.delegate?.codeCopyButtonDidTap(invitationCode: invitationCode) + self?.delegate?.codeCopyButtonDidTap() } self.copyButton.addAction(action, for: .touchUpInside) } From 21b321da769951a2a8b45c67e379014367f2bd88 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 4 May 2023 14:46:49 +0900 Subject: [PATCH 059/468] =?UTF-8?q?[CHORE]=20bind=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIComponent/DetailWaitTitleView.swift | 9 ++-- .../Detail-Wait/View/DetailWaitView.swift | 48 ++++++++++++------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/UIComponent/DetailWaitTitleView.swift b/Manito/Manito/Screens/Detail-Wait/UIComponent/DetailWaitTitleView.swift index a909fce63..e686a7df4 100644 --- a/Manito/Manito/Screens/Detail-Wait/UIComponent/DetailWaitTitleView.swift +++ b/Manito/Manito/Screens/Detail-Wait/UIComponent/DetailWaitTitleView.swift @@ -131,11 +131,8 @@ final class DetailWaitTitleView: UIView { } } - func setRoomTitleLabelText(text: String) { - self.roomTitleLabel.text = text - } - - func setDurationDateLabel(text: String) { - self.durationDateLabel.text = text + func setupLabelData(title: String, dateRange: String) { + self.roomTitleLabel.text = title + self.durationDateLabel.text = dateRange } } diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 33c061f84..ef458fb4a 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -108,11 +108,11 @@ final class DetailWaitView: UIView { } } } - private var canStart: Bool = false { - didSet { - self.configureStartButton(self.canStart) - } - } +// private var canStart: Bool = false { +// didSet { +// self.configureStartButton(self.canStart) +// } +// } private weak var delegate: DetailWaitViewDelegate? @@ -202,21 +202,33 @@ final class DetailWaitView: UIView { let state = room.roomInformation?.state, let dateRange = room.roomInformation?.dateRangeText, let users = room.participants?.members, - let isAdmin = room.admin, - let code = room.invitation?.code, - let isStart = room.roomInformation?.isStart + let isStart = room.roomInformation?.isStart, + let admin = room.admin else { return } - self.titleView.setRoomTitleLabelText(text: title) - self.titleView.setStartState(state: state) - self.userCountLabel.text = room.userCount - self.titleView.setDurationDateLabel(text: dateRange) + self.userArray = users - self.showStartButtonForAdmin(isAdmin) - self.canStart = room.canStart - self.setExitButtonMenu(isAdmin) - self.setupCopyButton(code) - self.showAlertWhenPastDate(isAdmin, isStart: isStart) - self.setupTitleViewGesture(isAdmin) + + self.setupTitleViewData(title: title, state: state, dateRange: dateRange) + self.setupRelatedViews(of: admin, isStart) + + self.configureStartButton(room.canStart) + self.configureUserCountLabel(userCount: room.userCount) + } + + private func setupTitleViewData(title: String, state: String, dateRange: String) { + self.titleView.setStartState(state: state) + self.titleView.setupLabelData(title: title, dateRange: dateRange) + } + + private func setupRelatedViews(of userStatus: Bool, _ isStart: Bool) { + self.showStartButtonForAdmin(userStatus) + self.setExitButtonMenu(userStatus) + self.showAlertWhenPastDate(userStatus, isStart: isStart) + self.setupTitleViewGesture(userStatus) + } + + private func configureUserCountLabel(userCount: String) { + self.userCountLabel.text = userCount } private func updateTableViewHeight() { From d290816237050d0a666c03d4c01c95d46bfd2fc8 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 4 May 2023 14:58:06 +0900 Subject: [PATCH 060/468] =?UTF-8?q?[CHORE]=20private,=20internal=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=88=9C=EC=84=9C=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/View/DetailWaitView.swift | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index ef458fb4a..4c8ff396f 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -186,35 +186,6 @@ final class DetailWaitView: UIView { self.copyButton.addAction(action, for: .touchUpInside) } - func configureDelegation(_ delegate: DetailWaitViewDelegate) { - self.delegate = delegate - } - - func configureNavigationItem(_ navigationController: UINavigationController) { - let navigationItem = navigationController.topViewController?.navigationItem - let moreButton = UIBarButtonItem(customView: self.moreButton) - - navigationItem?.rightBarButtonItem = moreButton - } - - func bind(room: Room) { - guard let title = room.roomInformation?.title, - let state = room.roomInformation?.state, - let dateRange = room.roomInformation?.dateRangeText, - let users = room.participants?.members, - let isStart = room.roomInformation?.isStart, - let admin = room.admin - else { return } - - self.userArray = users - - self.setupTitleViewData(title: title, state: state, dateRange: dateRange) - self.setupRelatedViews(of: admin, isStart) - - self.configureStartButton(room.canStart) - self.configureUserCountLabel(userCount: room.userCount) - } - private func setupTitleViewData(title: String, state: String, dateRange: String) { self.titleView.setStartState(state: state) self.titleView.setupLabelData(title: title, dateRange: dateRange) @@ -303,6 +274,35 @@ final class DetailWaitView: UIView { } } + func configureDelegation(_ delegate: DetailWaitViewDelegate) { + self.delegate = delegate + } + + func configureNavigationItem(_ navigationController: UINavigationController) { + let navigationItem = navigationController.topViewController?.navigationItem + let moreButton = UIBarButtonItem(customView: self.moreButton) + + navigationItem?.rightBarButtonItem = moreButton + } + + func bind(room: Room) { + guard let title = room.roomInformation?.title, + let state = room.roomInformation?.state, + let dateRange = room.roomInformation?.dateRangeText, + let users = room.participants?.members, + let isStart = room.roomInformation?.isStart, + let admin = room.admin + else { return } + + self.userArray = users + + self.setupTitleViewData(title: title, state: state, dateRange: dateRange) + self.setupRelatedViews(of: admin, isStart) + + self.configureStartButton(room.canStart) + self.configureUserCountLabel(userCount: room.userCount) + } + // MARK: - selector @objc From 5cf06e373b67b2e01e65df33cc3e3919b766d4db Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 4 May 2023 15:04:18 +0900 Subject: [PATCH 061/468] =?UTF-8?q?[CHORE]=20bind=20->=20updateDetailWaitV?= =?UTF-8?q?iew=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/DetailWaitViewController.swift | 2 +- Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 00bed6aa3..c53401671 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -99,7 +99,7 @@ final class DetailWaitViewController: BaseViewController { switch result { case .success(let room): DispatchQueue.main.async { - self?.detailWaitView.bind(room: room) + self?.detailWaitView.updateDetailWaitView(room: room) } case .failure: self?.makeAlert(title: TextLiteral.errorAlertTitle, diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 4c8ff396f..63fd8304b 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -285,7 +285,7 @@ final class DetailWaitView: UIView { navigationItem?.rightBarButtonItem = moreButton } - func bind(room: Room) { + func updateDetailWaitView(room: Room) { guard let title = room.roomInformation?.title, let state = room.roomInformation?.state, let dateRange = room.roomInformation?.dateRangeText, From 79fc6191b13729e778fb8cd9536b72d655409eca Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 9 May 2023 22:45:52 +0900 Subject: [PATCH 062/468] =?UTF-8?q?[CHORE]=20=EB=8C=80=EB=AC=B8=EC=9E=90?= =?UTF-8?q?=EB=A1=9C=20=EC=9E=85=EB=A0=A5=EB=90=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#451)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ParticipateRoom/UIComponent/InputInvitedCodeView.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/ParticipateRoom/UIComponent/InputInvitedCodeView.swift b/Manito/Manito/Screens/ParticipateRoom/UIComponent/InputInvitedCodeView.swift index 33f906d84..d1f27faf8 100644 --- a/Manito/Manito/Screens/ParticipateRoom/UIComponent/InputInvitedCodeView.swift +++ b/Manito/Manito/Screens/ParticipateRoom/UIComponent/InputInvitedCodeView.swift @@ -30,7 +30,7 @@ final class InputInvitedCodeView: UIView { textField.returnKeyType = .done textField.delegate = self textField.autocorrectionType = .no - textField.autocapitalizationType = .none + textField.autocapitalizationType = .allCharacters textField.becomeFirstResponder() return textField }() @@ -104,5 +104,7 @@ extension InputInvitedCodeView: UITextFieldDelegate { guard let textCount = roomCodeTextField.text?.count else { return } let hasText = textCount >= maxLength changeNextButtonEnableStatus?(hasText) + + textField.text = textField.text?.uppercased() } } From a5ecdeaa43c92e5322974a971925bdf20e4c3e4b Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Wed, 10 May 2023 10:41:00 +0900 Subject: [PATCH 063/468] =?UTF-8?q?[CHORE]=20MARK=20=EC=A3=BC=EC=84=9D=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChooseCharacterViewController.swift | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index 2c8edb1fc..7b89b4bfd 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -11,8 +11,6 @@ import SnapKit class ChooseCharacterViewController: BaseViewController { - let roomService: RoomProtocol = RoomAPI(apiService: APIService()) - private enum Size { static let leadingTrailingPadding: CGFloat = 20 static let collectionHorizontalSpacing: CGFloat = 29.0 @@ -31,13 +29,7 @@ class ChooseCharacterViewController: BaseViewController { case enterRoom } - var statusMode: Status - var roomInfo: RoomDTO? - var roomId: Int? - - private var colorIdx: Int = 0 - - // MARK: - Property + // MARK: - ui component private let titleLabel: UILabel = { let label = UILabel() @@ -96,7 +88,7 @@ class ChooseCharacterViewController: BaseViewController { } button.addAction(action, for: .touchUpInside) return button - }() + }() private lazy var backButton: UIButton = { let button = UIButton() button.setImage(ImageLiterals.icBack, for: .normal) @@ -109,6 +101,14 @@ class ChooseCharacterViewController: BaseViewController { return button }() + // MARK: - property + + let roomService: RoomProtocol = RoomAPI(apiService: APIService()) + var statusMode: Status + var roomInfo: RoomDTO? + var roomId: Int? + private var colorIdx: Int = 0 + // MARK: - init init(statusMode: Status, roomId: Int?) { @@ -125,7 +125,7 @@ class ChooseCharacterViewController: BaseViewController { print("\(#file) is dead") } - // MARK: - life cycle + // MARK: - override override func setupLayout() { view.addSubview(closeButton) @@ -172,33 +172,23 @@ class ChooseCharacterViewController: BaseViewController { navigationController?.navigationBar.prefersLargeTitles = false } - // MARK: - API + // MARK: - func - func requestCreateRoom(room: CreateRoomDTO) { - Task { - do { - guard - let roomId = try await roomService.postCreateRoom(body: room), - let navigationController = self.presentingViewController as? UINavigationController - else { return } - let viewController = DetailWaitViewController(index: roomId) - navigationController.popViewController(animated: true) - navigationController.pushViewController(viewController, animated: false) - - self.dismiss(animated: true) { - NotificationCenter.default.post(name: .createRoomInvitedCode, object: nil) - } - } catch NetworkError.serverError { - print("server Error") - } catch NetworkError.encodingError { - print("encoding Error") - } catch NetworkError.clientError(let message) { - print("client Error: \(String(describing: message))") - } + private func didTapEnterButton() { + switch statusMode { + case .createRoom: + guard let roomInfo = roomInfo else { return } + requestCreateRoom(room: CreateRoomDTO(room: RoomDTO(title: roomInfo.title, + capacity: roomInfo.capacity, + startDate: roomInfo.startDate, + endDate: roomInfo.endDate) , + member: MemberDTO(colorIdx: colorIdx))) + case .enterRoom: + requestJoinRoom() } } - // MARK: - func + // MARK: - network private func requestJoinRoom() { Task { @@ -227,17 +217,27 @@ class ChooseCharacterViewController: BaseViewController { } } - private func didTapEnterButton() { - switch statusMode { - case .createRoom: - guard let roomInfo = roomInfo else { return } - requestCreateRoom(room: CreateRoomDTO(room: RoomDTO(title: roomInfo.title, - capacity: roomInfo.capacity, - startDate: roomInfo.startDate, - endDate: roomInfo.endDate) , - member: MemberDTO(colorIdx: colorIdx))) - case .enterRoom: - requestJoinRoom() + func requestCreateRoom(room: CreateRoomDTO) { + Task { + do { + guard + let roomId = try await roomService.postCreateRoom(body: room), + let navigationController = self.presentingViewController as? UINavigationController + else { return } + let viewController = DetailWaitViewController(index: roomId) + navigationController.popViewController(animated: true) + navigationController.pushViewController(viewController, animated: false) + + self.dismiss(animated: true) { + NotificationCenter.default.post(name: .createRoomInvitedCode, object: nil) + } + } catch NetworkError.serverError { + print("server Error") + } catch NetworkError.encodingError { + print("encoding Error") + } catch NetworkError.clientError(let message) { + print("client Error: \(String(describing: message))") + } } } } From 7b2444226a9433e73bbb7b90832800073cbce40f Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Wed, 10 May 2023 16:15:44 +0900 Subject: [PATCH 064/468] =?UTF-8?q?[REFACTOR]=20ChooseCharacterView=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 + .../UIComponent/ChooseCharacterView.swift | 100 ++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 Manito/Manito/Screens/CreateRoom/UIComponent/ChooseCharacterView.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 131d47c6a..49429389a 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -167,6 +167,7 @@ D77224DF285DDAB7008B760B /* Notification+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D77224DE285DDAB7008B760B /* Notification+Extension.swift */; }; D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = D777D2C828C7780E008655BD /* URLLiteral.swift */; }; D7B6C97C2858B2D40024F326 /* CheckRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */; }; + D7C4A1A72A0B2EB000C3AE4C /* ChooseCharacterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1A62A0B2EB000C3AE4C /* ChooseCharacterView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -328,6 +329,7 @@ D77224DE285DDAB7008B760B /* Notification+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Notification+Extension.swift"; sourceTree = ""; }; D777D2C828C7780E008655BD /* URLLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLLiteral.swift; sourceTree = ""; }; D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckRoomView.swift; sourceTree = ""; }; + D7C4A1A62A0B2EB000C3AE4C /* ChooseCharacterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooseCharacterView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -461,6 +463,7 @@ 7E3058C72854B64D00489E6A /* InputPersonView.swift */, 7E3058C92854B7A900489E6A /* InputDateView.swift */, D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */, + D7C4A1A62A0B2EB000C3AE4C /* ChooseCharacterView.swift */, ); path = UIComponent; sourceTree = ""; @@ -1179,6 +1182,7 @@ 39CD581D28C4C03C00496E91 /* DetailDoneProtocol.swift in Sources */, CB9592B52855D52700847751 /* CommonMissionView.swift in Sources */, CBA4D7A42856CE9F0018BDC2 /* CreateRoomCollectionViewCell.swift in Sources */, + D7C4A1A72A0B2EB000C3AE4C /* ChooseCharacterView.swift in Sources */, 39C95802287DACC300A04A2B /* RoomEndPoint.swift in Sources */, CB4C77E628C0D4EB007A1AD2 /* MainAPI.swift in Sources */, B5F524FD28519EEC00614FF7 /* UIColor+Extension.swift in Sources */, diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/ChooseCharacterView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/ChooseCharacterView.swift new file mode 100644 index 000000000..0a4c2c59a --- /dev/null +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/ChooseCharacterView.swift @@ -0,0 +1,100 @@ +// +// ChooseCharacterView.swift +// Manito +// +// Created by 이성호 on 2023/05/10. +// + +import UIKit + +import SnapKit + +final class ChooseCharacterView: UIView { + + private enum InternalSize { + static let collectionHorizontalSpacing: CGFloat = 29.0 + static let cellInterSpacing: CGFloat = 39.0 + static let cellLineSpacing: CGFloat = 24.0 + static let cellWidth: CGFloat = (UIScreen.main.bounds.size.width - (collectionHorizontalSpacing * 2 + cellInterSpacing * 2)) / 3 + static let collectionInset = UIEdgeInsets(top: 0, + left: 0, + bottom: 0, + right: 0) + } + + // MARK: - ui component + + private let collectionViewFlowLayout: UICollectionViewFlowLayout = { + let flowLayout = UICollectionViewFlowLayout() + flowLayout.scrollDirection = .vertical + flowLayout.sectionInset = InternalSize.collectionInset + flowLayout.minimumLineSpacing = InternalSize.cellLineSpacing + flowLayout.minimumInteritemSpacing = InternalSize.cellInterSpacing + flowLayout.sectionHeadersPinToVisibleBounds = true + flowLayout.itemSize = CGSize(width: InternalSize.cellWidth, height: InternalSize.cellWidth) + return flowLayout + }() + private lazy var manittoCollectionView: UICollectionView = { + let collectionView = UICollectionView(frame: .zero, collectionViewLayout: collectionViewFlowLayout) + collectionView.backgroundColor = .clear + collectionView.dataSource = self + collectionView.delegate = self + collectionView.showsVerticalScrollIndicator = false + collectionView.isScrollEnabled = false + collectionView.register(cell: CharacterCollectionViewCell.self, + forCellWithReuseIdentifier: CharacterCollectionViewCell.className) + return collectionView + }() + + // MARK: - property + + private var characterIndex: Int = 0 + + // MARK: - init + + override init(frame: CGRect) { + super.init(frame: frame) + self.setupLayout() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - func + + private func setupLayout() { + self.addSubview(self.manittoCollectionView) + self.manittoCollectionView.snp.makeConstraints { + $0.edges.equalToSuperview() + } + } +} + +extension ChooseCharacterView: UICollectionViewDataSource { + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return Character.allCases.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + guard let cell: CharacterCollectionViewCell = collectionView.dequeueReusableCell(forIndexPath: indexPath) as? CharacterCollectionViewCell else { return UICollectionViewCell() } + + cell.characterBackground = Character.allCases[indexPath.item].color + cell.characterImageView.image = Character.allCases[indexPath.item].image + cell.setImageBackgroundColor() + + if indexPath.item == 0 { + cell.isSelected = true + collectionView.selectItem(at: indexPath, animated: false , scrollPosition: .init()) + } + + return cell + } +} + +extension ChooseCharacterView: UICollectionViewDelegateFlowLayout { + func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { + self.characterIndex = indexPath.item + } +} From d0c4c4e17bf2701965c37059dac62c9ff3264271 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Wed, 10 May 2023 16:45:46 +0900 Subject: [PATCH 065/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=BB=A8=EB=B2=A4=EC=85=98=20=EB=B0=8F=20=EB=B3=80=EC=88=98=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD(#435)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 8 +- .../ChooseCharacterViewController.swift | 140 +++++------------- .../CharacterCollectionViewCell.swift | 33 +++-- ...ew.swift => CharacterCollectionView.swift} | 13 +- 4 files changed, 70 insertions(+), 124 deletions(-) rename Manito/Manito/Screens/CreateRoom/UIComponent/{ChooseCharacterView.swift => CharacterCollectionView.swift} (85%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 49429389a..77bba8018 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -167,7 +167,7 @@ D77224DF285DDAB7008B760B /* Notification+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D77224DE285DDAB7008B760B /* Notification+Extension.swift */; }; D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = D777D2C828C7780E008655BD /* URLLiteral.swift */; }; D7B6C97C2858B2D40024F326 /* CheckRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */; }; - D7C4A1A72A0B2EB000C3AE4C /* ChooseCharacterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1A62A0B2EB000C3AE4C /* ChooseCharacterView.swift */; }; + D7C4A1A72A0B2EB000C3AE4C /* CharacterCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -329,7 +329,7 @@ D77224DE285DDAB7008B760B /* Notification+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Notification+Extension.swift"; sourceTree = ""; }; D777D2C828C7780E008655BD /* URLLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLLiteral.swift; sourceTree = ""; }; D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckRoomView.swift; sourceTree = ""; }; - D7C4A1A62A0B2EB000C3AE4C /* ChooseCharacterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooseCharacterView.swift; sourceTree = ""; }; + D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterCollectionView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -463,7 +463,7 @@ 7E3058C72854B64D00489E6A /* InputPersonView.swift */, 7E3058C92854B7A900489E6A /* InputDateView.swift */, D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */, - D7C4A1A62A0B2EB000C3AE4C /* ChooseCharacterView.swift */, + D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */, ); path = UIComponent; sourceTree = ""; @@ -1182,7 +1182,7 @@ 39CD581D28C4C03C00496E91 /* DetailDoneProtocol.swift in Sources */, CB9592B52855D52700847751 /* CommonMissionView.swift in Sources */, CBA4D7A42856CE9F0018BDC2 /* CreateRoomCollectionViewCell.swift in Sources */, - D7C4A1A72A0B2EB000C3AE4C /* ChooseCharacterView.swift in Sources */, + D7C4A1A72A0B2EB000C3AE4C /* CharacterCollectionView.swift in Sources */, 39C95802287DACC300A04A2B /* RoomEndPoint.swift in Sources */, CB4C77E628C0D4EB007A1AD2 /* MainAPI.swift in Sources */, B5F524FD28519EEC00614FF7 /* UIColor+Extension.swift in Sources */, diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index 7b89b4bfd..e5ba42a85 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -9,20 +9,7 @@ import UIKit import SnapKit -class ChooseCharacterViewController: BaseViewController { - - private enum Size { - static let leadingTrailingPadding: CGFloat = 20 - static let collectionHorizontalSpacing: CGFloat = 29.0 - static let collectionVerticalSpacing: CGFloat = 37.0 - static let cellInterSpacing: CGFloat = 39.0 - static let cellLineSpacing: CGFloat = 24.0 - static let cellWidth: CGFloat = (UIScreen.main.bounds.size.width - (collectionHorizontalSpacing * 2 + cellInterSpacing * 2)) / 3 - static let collectionInset = UIEdgeInsets(top: collectionVerticalSpacing, - left: collectionHorizontalSpacing, - bottom: collectionVerticalSpacing, - right: collectionHorizontalSpacing) - } +final class ChooseCharacterViewController: BaseViewController { enum Status { case createRoom @@ -54,27 +41,7 @@ class ChooseCharacterViewController: BaseViewController { button.addAction(action, for: .touchUpInside) return button }() - private let collectionViewFlowLayout: UICollectionViewFlowLayout = { - let flowLayout = UICollectionViewFlowLayout() - flowLayout.scrollDirection = .vertical - flowLayout.sectionInset = Size.collectionInset - flowLayout.minimumLineSpacing = Size.cellLineSpacing - flowLayout.minimumInteritemSpacing = Size.cellInterSpacing - flowLayout.sectionHeadersPinToVisibleBounds = true - flowLayout.itemSize = CGSize(width: Size.cellWidth, height: Size.cellWidth) - return flowLayout - }() - private lazy var manittoCollectionView: UICollectionView = { - let collectionView = UICollectionView(frame: .zero, collectionViewLayout: collectionViewFlowLayout) - collectionView.backgroundColor = .clear - collectionView.dataSource = self - collectionView.delegate = self - collectionView.showsVerticalScrollIndicator = false - collectionView.isScrollEnabled = false - collectionView.register(cell: CharacterCollectionViewCell.self, - forCellWithReuseIdentifier: CharacterCollectionViewCell.className) - return collectionView - }() + private let manittoCollectionView: CharacterCollectionView = CharacterCollectionView() private lazy var enterButton: MainButton = { let button = MainButton() switch statusMode { @@ -103,11 +70,11 @@ class ChooseCharacterViewController: BaseViewController { // MARK: - property - let roomService: RoomProtocol = RoomAPI(apiService: APIService()) - var statusMode: Status - var roomInfo: RoomDTO? - var roomId: Int? + private let roomService: RoomProtocol = RoomAPI(apiService: APIService()) + private var statusMode: Status + private var roomId: Int? private var colorIdx: Int = 0 + var roomInfo: RoomDTO? // MARK: - init @@ -117,6 +84,7 @@ class ChooseCharacterViewController: BaseViewController { super.init() } + @available(*, unavailable) required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } @@ -128,63 +96,64 @@ class ChooseCharacterViewController: BaseViewController { // MARK: - override override func setupLayout() { - view.addSubview(closeButton) - closeButton.snp.makeConstraints { - $0.top.equalTo(view.safeAreaLayoutGuide).inset(9) + self.view.addSubview(self.closeButton) + self.closeButton.snp.makeConstraints { + $0.top.equalTo(self.view.safeAreaLayoutGuide).inset(9) $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) } - view.addSubview(titleLabel) - titleLabel.snp.makeConstraints { - $0.top.equalTo(view.safeAreaLayoutGuide).inset(66) + self.view.addSubview(self.titleLabel) + self.titleLabel.snp.makeConstraints { + $0.top.equalTo(self.view.safeAreaLayoutGuide).inset(66) $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) } - view.addSubview(subTitleLabel) - subTitleLabel.snp.makeConstraints { - $0.top.equalTo(titleLabel.snp.bottom).offset(10) + self.view.addSubview(self.subTitleLabel) + self.subTitleLabel.snp.makeConstraints { + $0.top.equalTo(self.titleLabel.snp.bottom).offset(10) $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) } - view.addSubview(backButton) - backButton.snp.makeConstraints { - $0.top.equalTo(closeButton) - $0.leading.equalTo(view.safeAreaLayoutGuide) + self.view.addSubview(self.backButton) + self.backButton.snp.makeConstraints { + $0.top.equalTo(self.closeButton) + $0.leading.equalTo(self.view.safeAreaLayoutGuide) } - view.addSubview(manittoCollectionView) - manittoCollectionView.snp.makeConstraints { - $0.top.equalTo(subTitleLabel.snp.bottom) - $0.leading.trailing.bottom.equalTo(view.safeAreaLayoutGuide) - } - - view.addSubview(enterButton) - enterButton.snp.makeConstraints { + self.view.addSubview(self.enterButton) + self.enterButton.snp.makeConstraints { $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) $0.bottom.equalToSuperview().inset(57) $0.height.equalTo(60) } + + self.view.addSubview(self.manittoCollectionView) + self.manittoCollectionView.snp.makeConstraints { + $0.top.equalTo(self.subTitleLabel.snp.bottom).offset(37) + $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.bottom.equalTo(self.enterButton.snp.top) + } } override func setupNavigationBar() { super.setupNavigationBar() - navigationController?.navigationBar.isHidden = true - navigationController?.navigationBar.prefersLargeTitles = false + self.navigationController?.navigationBar.isHidden = true + self.navigationController?.navigationBar.prefersLargeTitles = false } // MARK: - func private func didTapEnterButton() { - switch statusMode { + switch self.statusMode { case .createRoom: - guard let roomInfo = roomInfo else { return } - requestCreateRoom(room: CreateRoomDTO(room: RoomDTO(title: roomInfo.title, + guard let roomInfo = self.roomInfo else { return } + self.requestCreateRoom(room: CreateRoomDTO(room: RoomDTO(title: roomInfo.title, capacity: roomInfo.capacity, startDate: roomInfo.startDate, endDate: roomInfo.endDate) , member: MemberDTO(colorIdx: colorIdx))) case .enterRoom: - requestJoinRoom() + self.requestJoinRoom() } } @@ -193,9 +162,9 @@ class ChooseCharacterViewController: BaseViewController { private func requestJoinRoom() { Task { do { - guard let id = roomId else { return } - let status = try await roomService.dispatchJoinRoom(roodId: id.description, - dto: MemberDTO(colorIdx: colorIdx)) + guard let id = self.roomId else { return } + let status = try await self.roomService.dispatchJoinRoom(roodId: id.description, + dto: MemberDTO(colorIdx: self.colorIdx)) if status == 201 { guard let navigationController = self.presentingViewController as? UINavigationController else { return } guard let id = self.roomId else { return } @@ -210,7 +179,7 @@ class ChooseCharacterViewController: BaseViewController { print("encoding Error") } catch NetworkError.clientError(let message) { print("client Error: \(String(describing: message))") - makeAlert(title: "이미 참여중인 방입니다", message: "참여중인 애니또 리스트를 확인해 보세요", okAction: { [weak self] _ in + self.makeAlert(title: "이미 참여중인 방입니다", message: "참여중인 애니또 리스트를 확인해 보세요", okAction: { [weak self] _ in self?.dismiss(animated: true) }) } @@ -221,7 +190,7 @@ class ChooseCharacterViewController: BaseViewController { Task { do { guard - let roomId = try await roomService.postCreateRoom(body: room), + let roomId = try await self.roomService.postCreateRoom(body: room), let navigationController = self.presentingViewController as? UINavigationController else { return } let viewController = DetailWaitViewController(index: roomId) @@ -241,32 +210,3 @@ class ChooseCharacterViewController: BaseViewController { } } } - -// MARK: - UICollectionViewDataSource -extension ChooseCharacterViewController: UICollectionViewDataSource { - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return Character.allCases.count - } - - func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - let cell: CharacterCollectionViewCell = collectionView.dequeueReusableCell(forIndexPath: indexPath) - - cell.characterBackground = Character.allCases[indexPath.item].color - cell.characterImageView.image = Character.allCases[indexPath.item].image - cell.setImageBackgroundColor() - - if indexPath.item == 0 { - cell.isSelected = true - collectionView.selectItem(at: indexPath, animated: false , scrollPosition: .init()) - } - - return cell - } -} - -// MARK: - UICollectionViewDelegate -extension ChooseCharacterViewController: UICollectionViewDelegateFlowLayout { - func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - colorIdx = indexPath.item - } -} diff --git a/Manito/Manito/Screens/ChooseCharacter/UIComponent/CharacterCollectionViewCell.swift b/Manito/Manito/Screens/ChooseCharacter/UIComponent/CharacterCollectionViewCell.swift index ccb8c7125..0c07000c3 100644 --- a/Manito/Manito/Screens/ChooseCharacter/UIComponent/CharacterCollectionViewCell.swift +++ b/Manito/Manito/Screens/ChooseCharacter/UIComponent/CharacterCollectionViewCell.swift @@ -11,41 +11,48 @@ import SnapKit final class CharacterCollectionViewCell: BaseCollectionViewCell { - var characterBackground: UIColor? + // MARK: - ui component - // MARK: - property - - lazy var characterImageView: UIImageView = { + private let characterImageView: UIImageView = { let imageView = UIImageView() imageView.contentMode = .scaleAspectFit imageView.image = ImageLiterals.imgMa return imageView }() - // MARK: - life cycle + // MARK: - property + + private var characterBackground: UIColor? + + // MARK: - override override func setupLayout() { - contentView.addSubview(characterImageView) - characterImageView.snp.makeConstraints { + self.contentView.addSubview(self.characterImageView) + self.characterImageView.snp.makeConstraints { $0.center.equalToSuperview() $0.width.height.equalTo(self.frame.size.width).multipliedBy(0.92) } } override func configureUI() { - makeBorderLayer(color: .white) + self.makeBorderLayer(color: .white) layer.cornerRadius = self.frame.size.width / 2 } override var isSelected: Bool { didSet { - backgroundColor = isSelected ? characterBackground : characterBackground?.withAlphaComponent(0.5) - contentView.alpha = isSelected ? 1.0 : 0.5 + self.backgroundColor = self.isSelected ? self.characterBackground : self.characterBackground?.withAlphaComponent(0.5) + self.contentView.alpha = self.isSelected ? 1.0 : 0.5 } } + + func configureBackground(color: UIColor) { + self.characterBackground = color + self.backgroundColor = self.characterBackground?.withAlphaComponent(0.5) + self.contentView.alpha = 0.5 + } - func setImageBackgroundColor() { - backgroundColor = characterBackground?.withAlphaComponent(0.5) - contentView.alpha = 0.5 + func configureImage(image: UIImage) { + self.characterImageView.image = image } } diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/ChooseCharacterView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift similarity index 85% rename from Manito/Manito/Screens/CreateRoom/UIComponent/ChooseCharacterView.swift rename to Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift index 0a4c2c59a..d6744462f 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/ChooseCharacterView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -final class ChooseCharacterView: UIView { +final class CharacterCollectionView: UIView { private enum InternalSize { static let collectionHorizontalSpacing: CGFloat = 29.0 @@ -72,17 +72,16 @@ final class ChooseCharacterView: UIView { } } -extension ChooseCharacterView: UICollectionViewDataSource { +extension CharacterCollectionView: UICollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return Character.allCases.count } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - guard let cell: CharacterCollectionViewCell = collectionView.dequeueReusableCell(forIndexPath: indexPath) as? CharacterCollectionViewCell else { return UICollectionViewCell() } + guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CharacterCollectionViewCell.className, for: indexPath) as? CharacterCollectionViewCell else { return UICollectionViewCell() } - cell.characterBackground = Character.allCases[indexPath.item].color - cell.characterImageView.image = Character.allCases[indexPath.item].image - cell.setImageBackgroundColor() + cell.configureBackground(color: Character.allCases[indexPath.item].color) + cell.configureImage(image: Character.allCases[indexPath.item].image) if indexPath.item == 0 { cell.isSelected = true @@ -93,7 +92,7 @@ extension ChooseCharacterView: UICollectionViewDataSource { } } -extension ChooseCharacterView: UICollectionViewDelegateFlowLayout { +extension CharacterCollectionView: UICollectionViewDelegateFlowLayout { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { self.characterIndex = indexPath.item } From 351b10624fa4853ef22f3d4f0edda8225bc6d533 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Wed, 10 May 2023 17:37:15 +0900 Subject: [PATCH 066/468] =?UTF-8?q?[FEAT]=20ChooseCharacterView=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++++ .../UIComponent/ChooseCharacterView.swift | 14 ++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 77bba8018..5cc3b75e9 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -168,6 +168,7 @@ D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = D777D2C828C7780E008655BD /* URLLiteral.swift */; }; D7B6C97C2858B2D40024F326 /* CheckRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */; }; D7C4A1A72A0B2EB000C3AE4C /* CharacterCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */; }; + D7C4A1A92A0B895300C3AE4C /* ChooseCharacterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -330,6 +331,7 @@ D777D2C828C7780E008655BD /* URLLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLLiteral.swift; sourceTree = ""; }; D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckRoomView.swift; sourceTree = ""; }; D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterCollectionView.swift; sourceTree = ""; }; + D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooseCharacterView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -928,6 +930,7 @@ isa = PBXGroup; children = ( CB21C33828C4C10200128D25 /* CharacterCollectionViewCell.swift */, + D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */, ); path = UIComponent; sourceTree = ""; @@ -1139,6 +1142,7 @@ B5F524CF28519AA000614FF7 /* AppDelegate.swift in Sources */, 435B17682913E71400212663 /* DetailingViewController.swift in Sources */, B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */, + D7C4A1A92A0B895300C3AE4C /* ChooseCharacterView.swift in Sources */, 397A241828BA51B400454E4F /* DetailWaitProtocol.swift in Sources */, 7EA25C2728C4FEA800746AEA /* ChangeNickNameViewController.swift in Sources */, D724AF5F28708D830003F280 /* ImageRowView.swift in Sources */, diff --git a/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift b/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift new file mode 100644 index 000000000..48488f7c7 --- /dev/null +++ b/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift @@ -0,0 +1,14 @@ +// +// ChooseCharacterView.swift +// Manito +// +// Created by 이성호 on 2023/05/10. +// + +import UIKit + +import SnapKit + +final class ChooseCharacterView: UIView { + +} From 195d67b04f15a819eace22563aa93399a1caf734 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Wed, 10 May 2023 20:56:39 +0900 Subject: [PATCH 067/468] =?UTF-8?q?[REFACTOR]=20View=EC=99=80=20Controller?= =?UTF-8?q?=20=EB=B6=84=EB=A6=AC=20(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChooseCharacterViewController.swift | 132 +++++------------- .../UIComponent/ChooseCharacterView.swift | 119 ++++++++++++++++ .../UIComponent/CharacterCollectionView.swift | 2 +- 3 files changed, 158 insertions(+), 95 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index e5ba42a85..ca6ebd358 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -17,63 +17,16 @@ final class ChooseCharacterViewController: BaseViewController { } // MARK: - ui component - - private let titleLabel: UILabel = { - let label = UILabel() - label.text = TextLiteral.chooseCharacterViewControllerTitleLabel - label.font = .font(.regular, ofSize: 34) - return label - }() - private let subTitleLabel: UILabel = { - let label = UILabel() - label.text = TextLiteral.chooseCharacterViewControllerSubTitleLabel - label.font = .font(.regular, ofSize: 18) - label.textColor = .grey002 - return label - }() - private lazy var closeButton: UIButton = { - let button = UIButton(type: .system) - button.tintColor = .lightGray - button.setImage(ImageLiterals.btnXmark, for: .normal) - let action = UIAction { [weak self] _ in - self?.dismiss(animated: true, completion: nil) - } - button.addAction(action, for: .touchUpInside) - return button - }() - private let manittoCollectionView: CharacterCollectionView = CharacterCollectionView() - private lazy var enterButton: MainButton = { - let button = MainButton() - switch statusMode { - case .createRoom: - button.title = TextLiteral.createRoom - case .enterRoom: - button.title = TextLiteral.enterRoom - } - let action = UIAction { [weak self] _ in - self?.didTapEnterButton() - } - button.addAction(action, for: .touchUpInside) - return button - }() - private lazy var backButton: UIButton = { - let button = UIButton() - button.setImage(ImageLiterals.icBack, for: .normal) - button.titleLabel?.font = .font(.regular, ofSize: 14) - button.tintColor = .white - let action = UIAction { [weak self] _ in - self?.navigationController?.popViewController(animated: true) - } - button.addAction(action, for: .touchUpInside) - return button - }() + + private lazy var chooseCharacterView: ChooseCharacterView = ChooseCharacterView() // MARK: - property private let roomService: RoomProtocol = RoomAPI(apiService: APIService()) + // FIXME: 삭제예정 private var statusMode: Status private var roomId: Int? - private var colorIdx: Int = 0 + private var characterIndex: Int = 0 var roomInfo: RoomDTO? // MARK: - init @@ -93,57 +46,33 @@ final class ChooseCharacterViewController: BaseViewController { print("\(#file) is dead") } - // MARK: - override + // MARK: - life cycle - override func setupLayout() { - self.view.addSubview(self.closeButton) - self.closeButton.snp.makeConstraints { - $0.top.equalTo(self.view.safeAreaLayoutGuide).inset(9) - $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - } - - self.view.addSubview(self.titleLabel) - self.titleLabel.snp.makeConstraints { - $0.top.equalTo(self.view.safeAreaLayoutGuide).inset(66) - $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) - } - - self.view.addSubview(self.subTitleLabel) - self.subTitleLabel.snp.makeConstraints { - $0.top.equalTo(self.titleLabel.snp.bottom).offset(10) - $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) - } - - self.view.addSubview(self.backButton) - self.backButton.snp.makeConstraints { - $0.top.equalTo(self.closeButton) - $0.leading.equalTo(self.view.safeAreaLayoutGuide) - } - - self.view.addSubview(self.enterButton) - self.enterButton.snp.makeConstraints { - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalToSuperview().inset(57) - $0.height.equalTo(60) - } - - self.view.addSubview(self.manittoCollectionView) - self.manittoCollectionView.snp.makeConstraints { - $0.top.equalTo(self.subTitleLabel.snp.bottom).offset(37) - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalTo(self.enterButton.snp.top) - } + override func viewDidLoad() { + super.viewDidLoad() + self.configureDelegation() + } + + override func loadView() { + self.view = self.chooseCharacterView } + // MARK: - override + override func setupNavigationBar() { super.setupNavigationBar() - self.navigationController?.navigationBar.isHidden = true - self.navigationController?.navigationBar.prefersLargeTitles = false + navigationController?.navigationBar.isHidden = true + navigationController?.navigationBar.prefersLargeTitles = false } // MARK: - func + private func configureDelegation() { + self.chooseCharacterView.configureDelegate(self) + } + private func didTapEnterButton() { + // FIXME: statusMode 삭제 이후 enterRoom 변경 예정 switch self.statusMode { case .createRoom: guard let roomInfo = self.roomInfo else { return } @@ -151,7 +80,7 @@ final class ChooseCharacterViewController: BaseViewController { capacity: roomInfo.capacity, startDate: roomInfo.startDate, endDate: roomInfo.endDate) , - member: MemberDTO(colorIdx: colorIdx))) + member: MemberDTO(colorIdx: characterIndex))) case .enterRoom: self.requestJoinRoom() } @@ -164,7 +93,7 @@ final class ChooseCharacterViewController: BaseViewController { do { guard let id = self.roomId else { return } let status = try await self.roomService.dispatchJoinRoom(roodId: id.description, - dto: MemberDTO(colorIdx: self.colorIdx)) + dto: MemberDTO(colorIdx: self.characterIndex)) if status == 201 { guard let navigationController = self.presentingViewController as? UINavigationController else { return } guard let id = self.roomId else { return } @@ -210,3 +139,18 @@ final class ChooseCharacterViewController: BaseViewController { } } } + +extension ChooseCharacterViewController: ChooseCharacterViewDelegate { + func backButtonDidTap() { + self.navigationController?.popViewController(animated: true) + } + + func closeButtonDidTap() { + self.dismiss(animated: true) + } + + func joinButtonDidTap(characterIndex: Int) { + self.characterIndex = characterIndex + self.didTapEnterButton() + } +} diff --git a/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift b/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift index 48488f7c7..05d4290ce 100644 --- a/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift +++ b/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift @@ -9,6 +9,125 @@ import UIKit import SnapKit +protocol ChooseCharacterViewDelegate: AnyObject { + func backButtonDidTap() + func closeButtonDidTap() + func joinButtonDidTap(characterIndex: Int) +} + final class ChooseCharacterView: UIView { + // MARK: - ui component + + private let closeButton: UIButton = { + let button = UIButton(type: .system) + button.tintColor = .lightGray + button.setImage(ImageLiterals.btnXmark, for: .normal) + return button + }() + private let backButton: UIButton = { + let button = UIButton() + button.setImage(ImageLiterals.icBack, for: .normal) + button.titleLabel?.font = .font(.regular, ofSize: 14) + button.tintColor = .white + return button + }() + private let titleLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.chooseCharacterViewControllerTitleLabel + label.font = .font(.regular, ofSize: 34) + return label + }() + private let subTitleLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.chooseCharacterViewControllerSubTitleLabel + label.font = .font(.regular, ofSize: 18) + label.textColor = .grey002 + return label + }() + private let manittoCollectionView: CharacterCollectionView = CharacterCollectionView() + private lazy var joinButton: MainButton = { + let button = MainButton() + button.title = TextLiteral.enterRoom + return button + }() + + // MARK: - property + + private weak var delegate: ChooseCharacterViewDelegate? + + // MARK: - init + + override init(frame: CGRect) { + super.init(frame: frame) + self.setupLayout() + self.setupButtonAction() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - func + + private func setupLayout() { + self.addSubview(self.closeButton) + self.closeButton.snp.makeConstraints { + $0.top.equalTo(self.safeAreaLayoutGuide).inset(9) + $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + } + + self.addSubview(self.titleLabel) + self.titleLabel.snp.makeConstraints { + $0.top.equalTo(self.safeAreaLayoutGuide).inset(66) + $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) + } + + self.addSubview(self.subTitleLabel) + self.subTitleLabel.snp.makeConstraints { + $0.top.equalTo(self.titleLabel.snp.bottom).offset(10) + $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) + } + + self.addSubview(self.backButton) + self.backButton.snp.makeConstraints { + $0.top.equalTo(self.closeButton) + $0.leading.equalToSuperview() + } + + self.addSubview(self.joinButton) + self.joinButton.snp.makeConstraints { + $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.bottom.equalToSuperview().inset(57) + $0.height.equalTo(60) + } + + self.addSubview(self.manittoCollectionView) + self.manittoCollectionView.snp.makeConstraints { + $0.top.equalTo(self.subTitleLabel.snp.bottom).offset(37) + $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.bottom.equalTo(self.joinButton.snp.top) + } + } + + private func setupButtonAction() { + let didTapBackButton = UIAction { [weak self] _ in + self?.delegate?.backButtonDidTap() + } + let didTapCloseButton = UIAction { [weak self] _ in + self?.delegate?.closeButtonDidTap() + } + let didTapJoinButton = UIAction { [weak self] _ in + self?.delegate?.joinButtonDidTap(characterIndex: self?.manittoCollectionView.characterIndex ?? 0) + } + + self.backButton.addAction(didTapBackButton, for: .touchUpInside) + self.closeButton.addAction(didTapCloseButton, for: .touchUpInside) + self.joinButton.addAction(didTapJoinButton, for: .touchUpInside) + } + + func configureDelegate(_ delegate: ChooseCharacterViewDelegate) { + self.delegate = delegate + } } diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift index d6744462f..8c8b3da71 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift @@ -48,7 +48,7 @@ final class CharacterCollectionView: UIView { // MARK: - property - private var characterIndex: Int = 0 + var characterIndex: Int = 0 // MARK: - init From f29d6dc06827894eeef2c1bff5874e982402b05a Mon Sep 17 00:00:00 2001 From: chemi Date: Wed, 10 May 2023 22:00:23 +0900 Subject: [PATCH 068/468] =?UTF-8?q?[CHORE]=20=EC=BA=90=EB=A6=AD=ED=84=B0?= =?UTF-8?q?=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EB=B7=B0=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EB=B0=8D=20=EB=B3=80=EA=B2=BD=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/View/DetailWaitView.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 63fd8304b..150b15675 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -69,7 +69,7 @@ final class DetailWaitView: UIView { label.font = .font(.regular, ofSize: 16) return label }() - private let niCharacterImageView: UIImageView = { + private let characterImageView: UIImageView = { let imageView = UIImageView() imageView.image = ImageLiterals.imgNi return imageView @@ -144,8 +144,8 @@ final class DetailWaitView: UIView { $0.top.equalTo(titleView.snp.bottom).offset(44) } - self.addSubview(self.niCharacterImageView) - self.niCharacterImageView.snp.makeConstraints { + self.addSubview(self.characterImageView) + self.characterImageView.snp.makeConstraints { $0.centerY.equalTo(self.togetherFriendLabel.snp.centerY) $0.leading.equalTo(self.togetherFriendLabel.snp.trailing).offset(7) $0.width.height.equalTo(30) @@ -153,8 +153,8 @@ final class DetailWaitView: UIView { self.addSubview(self.userCountLabel) self.userCountLabel.snp.makeConstraints { - $0.leading.equalTo(self.niCharacterImageView.snp.trailing) - $0.centerY.equalTo(self.niCharacterImageView.snp.centerY) + $0.leading.equalTo(self.characterImageView.snp.trailing) + $0.centerY.equalTo(self.characterImageView.snp.centerY) } self.addSubview(self.copyButton) From ff7956ec181562bbe09d3f833de186176a0233b1 Mon Sep 17 00:00:00 2001 From: chemi Date: Wed, 10 May 2023 22:14:57 +0900 Subject: [PATCH 069/468] =?UTF-8?q?[CHORE]=20=EB=B0=A9=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EC=88=98=EC=A0=95=20delegate=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EB=B0=8D=20=EB=B3=80=EA=B2=BD=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailWaitViewController.swift | 2 +- .../Screens/Detail-Wait/View/DetailWaitView.swift | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index c53401671..9305dc9e6 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -189,7 +189,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { } } - func presentRoomEditViewController(isOnlyDateEdit: Bool) { + func editButtonDidTap(isOnlyDateEdit: Bool) { self.presentDetailEditViewController(isOnlyDateEdit: isOnlyDateEdit) } diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 150b15675..f39fc60e7 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -11,7 +11,7 @@ import SnapKit protocol DetailWaitViewDelegate: AnyObject { func startButtonDidTap() - func presentRoomEditViewController(isOnlyDateEdit: Bool) + func editButtonDidTap(isOnlyDateEdit: Bool) func deleteButtonDidTap(title: String, message: String, okTitle: String) func leaveButtonDidTap(title: String, message: String, okTitle: String) func presentEditViewControllerAfterShowAlert() @@ -108,11 +108,6 @@ final class DetailWaitView: UIView { } } } -// private var canStart: Bool = false { -// didSet { -// self.configureStartButton(self.canStart) -// } -// } private weak var delegate: DetailWaitViewDelegate? @@ -235,7 +230,7 @@ final class DetailWaitView: UIView { var children: [UIAction] if isAdmin { children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in - self?.delegate?.presentRoomEditViewController(isOnlyDateEdit: false) + self?.delegate?.editButtonDidTap(isOnlyDateEdit: false) }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in self?.delegate?.deleteButtonDidTap(title: UserStatus.admin.alertText.title, message: UserStatus.admin.alertText.message, @@ -307,7 +302,7 @@ final class DetailWaitView: UIView { @objc private func presentEditViewController() { - self.delegate?.presentRoomEditViewController(isOnlyDateEdit: false) + self.delegate?.editButtonDidTap(isOnlyDateEdit: false) } } From 60412028f17d8c528d50fbb9e51c4c9154fe21b5 Mon Sep 17 00:00:00 2001 From: chemi Date: Wed, 10 May 2023 23:54:15 +0900 Subject: [PATCH 070/468] =?UTF-8?q?[CHORE]=20=EC=8B=9C=EC=9E=91=20?= =?UTF-8?q?=EB=82=A0=EC=A7=9C=20=EC=A7=80=EB=82=AC=EC=9D=84=20=EB=95=8C=20?= =?UTF-8?q?delegate=20=ED=95=A8=EC=88=98=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(#441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 25 ++++++++++--------- .../Detail-Wait/View/DetailWaitView.swift | 12 ++------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 9305dc9e6..dbc5da6f0 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -226,22 +226,23 @@ extension DetailWaitViewController: DetailWaitViewDelegate { }) } - func presentEditViewControllerAfterShowAlert() { - self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, - message: TextLiteral.detailWaitViewControllerPastAdminAlertMessage, - okAction: { [weak self] _ in - self?.presentDetailEditViewController(isOnlyDateEdit: true) } - ) - } - - func showAlert(title: String, message: String) { - self.makeAlert(title: title, message: message) - } - func codeCopyButtonDidTap() { guard let invitationCode = self.roomInformation?.invitation?.code else { return } ToastView.showToast(code: invitationCode, message: TextLiteral.detailWaitViewControllerCopyCode, controller: self) } + + func didPassStartDate(isAdmin: Bool) { + if isAdmin { + self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, + message: TextLiteral.detailWaitViewControllerPastAdminAlertMessage, + okAction: { [weak self] _ in + self?.presentDetailEditViewController(isOnlyDateEdit: true) } + ) + } else { + self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, + message: TextLiteral.detailWaitViewControllerPastAlertMessage) + } + } } diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index f39fc60e7..b4339d3bc 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -14,9 +14,8 @@ protocol DetailWaitViewDelegate: AnyObject { func editButtonDidTap(isOnlyDateEdit: Bool) func deleteButtonDidTap(title: String, message: String, okTitle: String) func leaveButtonDidTap(title: String, message: String, okTitle: String) - func presentEditViewControllerAfterShowAlert() - func showAlert(title: String, message: String) func codeCopyButtonDidTap() + func didPassStartDate(isAdmin: Bool) } final class DetailWaitView: UIView { @@ -250,15 +249,8 @@ final class DetailWaitView: UIView { } private func showAlertWhenPastDate(_ isAdmin: Bool, isStart: Bool) { - let type: UserStatus = isAdmin ? .admin : .member if !isStart { - switch type { - case .admin: - self.delegate?.presentEditViewControllerAfterShowAlert() - case .member: - self.delegate?.showAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, - message: TextLiteral.detailWaitViewControllerPastAlertMessage) - } + self.delegate?.didPassStartDate(isAdmin: isAdmin) } } From 1d842ff17ce272aee75be1ca1301d140537d12de Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 11 May 2023 00:01:28 +0900 Subject: [PATCH 071/468] =?UTF-8?q?[CHORE]=20admin=EC=97=AC=EB=B6=80?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=9D=BC=20type=20=EB=B6=84=EB=A5=98=20(#?= =?UTF-8?q?441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index b4339d3bc..fe1bd7154 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -226,8 +226,10 @@ final class DetailWaitView: UIView { } private func setExitButtonMenu(_ isAdmin: Bool) { + let type: UserStatus = isAdmin ? .admin : .member var children: [UIAction] - if isAdmin { + switch type { + case .admin: children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in self?.delegate?.editButtonDidTap(isOnlyDateEdit: false) }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in @@ -236,7 +238,7 @@ final class DetailWaitView: UIView { okTitle: UserStatus.admin.alertText.okTitle) }) ] - } else { + case .member: children = [UIAction(title: TextLiteral.detailWaitViewControllerLeaveRoom, handler: { [weak self] _ in self?.delegate?.leaveButtonDidTap(title: UserStatus.member.alertText.title, message: UserStatus.member.alertText.message, From 21163f19a6b465fdb62950c049efe3362fa02df2 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Thu, 11 May 2023 13:38:06 +0900 Subject: [PATCH 072/468] =?UTF-8?q?[REFACTOR]=20navigationController?= =?UTF-8?q?=EB=A5=BC=20View=EB=A1=9C=20=EB=84=98=EA=B2=A8=EC=84=9C=20confi?= =?UTF-8?q?guration=20=EC=A7=84=ED=96=89=20(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChooseCharacterViewController.swift | 14 +++++++--- .../UIComponent/ChooseCharacterView.swift | 26 +++++++++---------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index ca6ebd358..b7e924f30 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -10,7 +10,7 @@ import UIKit import SnapKit final class ChooseCharacterViewController: BaseViewController { - + // FIXME: Status 삭제예정 enum Status { case createRoom case enterRoom @@ -18,7 +18,7 @@ final class ChooseCharacterViewController: BaseViewController { // MARK: - ui component - private lazy var chooseCharacterView: ChooseCharacterView = ChooseCharacterView() + private let chooseCharacterView: ChooseCharacterView = ChooseCharacterView() // MARK: - property @@ -51,6 +51,7 @@ final class ChooseCharacterViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() self.configureDelegation() + self.configureNavigationController() } override func loadView() { @@ -61,8 +62,8 @@ final class ChooseCharacterViewController: BaseViewController { override func setupNavigationBar() { super.setupNavigationBar() - navigationController?.navigationBar.isHidden = true - navigationController?.navigationBar.prefersLargeTitles = false + // FIXME: ParticipateRoomVC 수정 시 삭제 예정 + navigationController?.navigationBar.isHidden = false } // MARK: - func @@ -71,6 +72,11 @@ final class ChooseCharacterViewController: BaseViewController { self.chooseCharacterView.configureDelegate(self) } + private func configureNavigationController() { + guard let navigationController = self.navigationController else { return } + self.chooseCharacterView.configureNavigationItem(navigationController) + } + private func didTapEnterButton() { // FIXME: statusMode 삭제 이후 enterRoom 변경 예정 switch self.statusMode { diff --git a/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift b/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift index 05d4290ce..1dbdf021d 100644 --- a/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift +++ b/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift @@ -20,13 +20,13 @@ final class ChooseCharacterView: UIView { // MARK: - ui component private let closeButton: UIButton = { - let button = UIButton(type: .system) + let button = UIButton(frame: CGRect(origin: .zero, size: CGSize(width: 44, height: 44))) button.tintColor = .lightGray button.setImage(ImageLiterals.btnXmark, for: .normal) return button }() private let backButton: UIButton = { - let button = UIButton() + let button = UIButton(frame: CGRect(origin: .zero, size: CGSize(width: 44, height: 44))) button.setImage(ImageLiterals.icBack, for: .normal) button.titleLabel?.font = .font(.regular, ofSize: 14) button.tintColor = .white @@ -72,15 +72,10 @@ final class ChooseCharacterView: UIView { // MARK: - func private func setupLayout() { - self.addSubview(self.closeButton) - self.closeButton.snp.makeConstraints { - $0.top.equalTo(self.safeAreaLayoutGuide).inset(9) - $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - } self.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { - $0.top.equalTo(self.safeAreaLayoutGuide).inset(66) + $0.top.equalTo(self.safeAreaLayoutGuide).inset(20) $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) } @@ -90,12 +85,6 @@ final class ChooseCharacterView: UIView { $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) } - self.addSubview(self.backButton) - self.backButton.snp.makeConstraints { - $0.top.equalTo(self.closeButton) - $0.leading.equalToSuperview() - } - self.addSubview(self.joinButton) self.joinButton.snp.makeConstraints { $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) @@ -130,4 +119,13 @@ final class ChooseCharacterView: UIView { func configureDelegate(_ delegate: ChooseCharacterViewDelegate) { self.delegate = delegate } + + func configureNavigationItem(_ navigationController: UINavigationController) { + let navigationItem = navigationController.topViewController?.navigationItem + let backButton = UIBarButtonItem(customView: self.backButton) + let closeButton = UIBarButtonItem(customView: self.closeButton) + + navigationItem?.leftBarButtonItem = backButton + navigationItem?.rightBarButtonItem = closeButton + } } From 5d7c25da4fa1a2c2163ff3bfd21a7134c19090bd Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Thu, 11 May 2023 13:44:29 +0900 Subject: [PATCH 073/468] =?UTF-8?q?[CHORE]=20lazy,=20fixme=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChooseCharacter/UIComponent/ChooseCharacterView.swift | 5 +---- .../ParticipateRoom/ParticipateRoomViewController.swift | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift b/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift index 1dbdf021d..5c2bf86d7 100644 --- a/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift +++ b/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift @@ -21,15 +21,12 @@ final class ChooseCharacterView: UIView { private let closeButton: UIButton = { let button = UIButton(frame: CGRect(origin: .zero, size: CGSize(width: 44, height: 44))) - button.tintColor = .lightGray button.setImage(ImageLiterals.btnXmark, for: .normal) return button }() private let backButton: UIButton = { let button = UIButton(frame: CGRect(origin: .zero, size: CGSize(width: 44, height: 44))) button.setImage(ImageLiterals.icBack, for: .normal) - button.titleLabel?.font = .font(.regular, ofSize: 14) - button.tintColor = .white return button }() private let titleLabel: UILabel = { @@ -46,7 +43,7 @@ final class ChooseCharacterView: UIView { return label }() private let manittoCollectionView: CharacterCollectionView = CharacterCollectionView() - private lazy var joinButton: MainButton = { + private let joinButton: MainButton = { let button = MainButton() button.title = TextLiteral.enterRoom return button diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift index 31a78df7a..e4a9b4bce 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift @@ -119,6 +119,7 @@ final class ParticipateRoomViewController: BaseViewController { // MARK: - func override func setupNavigationBar() { + // FIXME: navigation으로 변경하면서 삭제예정 navigationController?.navigationBar.isHidden = true } From 6387cd9d6df89a7a65d0e2e43283b7e5633775f7 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Thu, 11 May 2023 14:37:10 +0900 Subject: [PATCH 074/468] =?UTF-8?q?[BUGFIX]=20=EB=92=A4=EB=A1=9C=EA=B0=80?= =?UTF-8?q?=EA=B8=B0=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95=20(#435)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/CreateRoom/CreateRoomViewController.swift | 5 +++++ .../ParticipateRoom/ParticipateRoomViewController.swift | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index 98e9ffc07..a2287a21f 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -75,6 +75,11 @@ final class CreateRoomViewController: BaseViewController { self.setInputViewIsHidden() self.setupAction() } + // FIXME: 플로우 연결 하면서 변경 될 예정 + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + navigationController?.navigationBar.isHidden = true + } // MARK: - override diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift index e4a9b4bce..9fed4c846 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift @@ -54,7 +54,13 @@ final class ParticipateRoomViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() toggleButton() - setupNotificationCenter() + } + // FIXME: 플로우 연결 하면서 변경 될 예정 + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + // FIXME: 뒤로가기 버그 수정(PR에서 얘기후 삭제 예정) + self.setupNotificationCenter() + navigationController?.navigationBar.isHidden = true } override func setupLayout() { From 90fc4e4217192bfc5b23de1cc1b93fbb2785cd67 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Thu, 11 May 2023 21:44:52 +0900 Subject: [PATCH 075/468] =?UTF-8?q?[ADD]=20ParticipateRoomView=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20(#456)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++++ .../Screens/ParticipateRoom/ParticipateRoomView.swift | 8 ++++++++ 2 files changed, 12 insertions(+) create mode 100644 Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 5cc3b75e9..ea6efa9e7 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -169,6 +169,7 @@ D7B6C97C2858B2D40024F326 /* CheckRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */; }; D7C4A1A72A0B2EB000C3AE4C /* CharacterCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */; }; D7C4A1A92A0B895300C3AE4C /* ChooseCharacterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */; }; + D7C4A1AB2A0D1AA400C3AE4C /* ParticipateRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1AA2A0D1AA400C3AE4C /* ParticipateRoomView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -332,6 +333,7 @@ D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckRoomView.swift; sourceTree = ""; }; D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterCollectionView.swift; sourceTree = ""; }; D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooseCharacterView.swift; sourceTree = ""; }; + D7C4A1AA2A0D1AA400C3AE4C /* ParticipateRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipateRoomView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -870,6 +872,7 @@ children = ( CB637A3928595BF900FF1240 /* UIComponent */, CB637A3A28595C1200FF1240 /* ParticipateRoomViewController.swift */, + D7C4A1AA2A0D1AA400C3AE4C /* ParticipateRoomView.swift */, ); path = ParticipateRoom; sourceTree = ""; @@ -1118,6 +1121,7 @@ 39CD581B28C4BE8800496E91 /* DetailStartingAPI.swift in Sources */, 39C957D22879523200A04A2B /* Date+Extension.swift in Sources */, B5F5250A2851A06700614FF7 /* DetailWaitViewController.swift in Sources */, + D7C4A1AB2A0D1AA400C3AE4C /* ParticipateRoomView.swift in Sources */, 39C957D02879521400A04A2B /* String+Extension.swift in Sources */, 399D17AB2856C83B00F50D9D /* DetailEditViewController.swift in Sources */, 7E15F67E28B35B3D00441305 /* TextLiteral.swift in Sources */, diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift new file mode 100644 index 000000000..c721fed8d --- /dev/null +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift @@ -0,0 +1,8 @@ +// +// ParticipateRoomView.swift +// Manito +// +// Created by 이성호 on 2023/05/11. +// + +import Foundation From 05ea67f4abd7348accd10384632f319d79d50c17 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Thu, 11 May 2023 21:56:43 +0900 Subject: [PATCH 076/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=94=A9=20?= =?UTF-8?q?=EC=BB=A8=EB=B2=A4=EC=85=98=20=EC=A0=81=EC=9A=A9=20(#456)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ParticipateRoomViewController.swift | 121 ++++++++++-------- 1 file changed, 67 insertions(+), 54 deletions(-) diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift index 9fed4c846..72b6f596e 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift @@ -11,9 +11,7 @@ import SnapKit final class ParticipateRoomViewController: BaseViewController { - private let checkRoomInfoService: RoomProtocol = RoomAPI(apiService: APIService()) - - // MARK: - property + // MARK: - ui component private let titleLabel: UILabel = { let label = UILabel() @@ -21,27 +19,23 @@ final class ParticipateRoomViewController: BaseViewController { label.font = .font(.regular, ofSize: 34) return label }() - private lazy var closeButton: UIButton = { + private let closeButton: UIButton = { let button = UIButton(type: .system) button.tintColor = .lightGray button.setImage(ImageLiterals.btnXmark, for: .normal) - let action = UIAction { [weak self] _ in - self?.dismiss(animated: true, completion: nil) - } - button.addAction(action, for: .touchUpInside) return button }() - private lazy var nextButton: MainButton = { + private let nextButton: MainButton = { let button = MainButton() button.title = TextLiteral.searchRoom button.isDisabled = true - let action = UIAction { [weak self] _ in - self?.dispatchInviteCode() - } - button.addAction(action, for: .touchUpInside) return button }() - private let inputInvitedCodeView = InputInvitedCodeView() + private let inputInvitedCodeView: InputInvitedCodeView = InputInvitedCodeView() + + // MARK: - property + + private let checkRoomInfoService: RoomProtocol = RoomAPI(apiService: APIService()) // MARK: - init @@ -53,7 +47,8 @@ final class ParticipateRoomViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() - toggleButton() + self.toggleButton() + self.setupButtonAction() } // FIXME: 플로우 연결 하면서 변경 될 예정 override func viewWillAppear(_ animated: Bool) { @@ -63,6 +58,8 @@ final class ParticipateRoomViewController: BaseViewController { navigationController?.navigationBar.isHidden = true } + // MARK: - override + override func setupLayout() { view.addSubview(closeButton) closeButton.snp.makeConstraints { @@ -93,63 +90,48 @@ final class ParticipateRoomViewController: BaseViewController { view.bringSubviewToFront(nextButton) } - // MARK: - API - - private func dispatchInviteCode() { - Task { - do { - guard let code = inputInvitedCodeView.roomCodeTextField.text else { return } - let data = try await checkRoomInfoService - .dispatchVerification(body: code) - if let info = data { - guard let id = info.id else { return } - let viewController = CheckRoomViewController() - viewController.modalPresentationStyle = .overFullScreen - viewController.modalTransitionStyle = .crossDissolve - viewController.verification = info - viewController.roomId = id - - present(viewController, animated: true) - } - } catch NetworkError.serverError { - print("server Error") - } catch NetworkError.encodingError { - print("encoding Error") - } catch NetworkError.clientError(let message) { - makeAlert(title: TextLiteral.checkRoomViewControllerErrorAlertTitle, message: TextLiteral.checkRoomViewControllerErrorAlertMessage) - print("client Error: \(String(describing: message))") - } - } + override func setupNavigationBar() { + // FIXME: navigation으로 변경하면서 삭제예정 + navigationController?.navigationBar.isHidden = true } // MARK: - func - override func setupNavigationBar() { - // FIXME: navigation으로 변경하면서 삭제예정 - navigationController?.navigationBar.isHidden = true + private func setupButtonAction() { + let didTapCloseButton = UIAction { [weak self] _ in + self?.dismiss(animated: true, completion: nil) + } + + let didTapNextButton = UIAction { [weak self] _ in + self?.dispatchInviteCode() + } + + self.closeButton.addAction(didTapCloseButton, for: .touchUpInside) + self.nextButton.addAction(didTapNextButton, for: .touchUpInside) } private func setupNotificationCenter() { - NotificationCenter.default.addObserver(self, selector: #selector(didReceiveNextNotification(_:)), name: .nextNotification, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(self.didReceiveNextNotification(_:)), name: .nextNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) } private func toggleButton() { - inputInvitedCodeView.changeNextButtonEnableStatus = { [weak self] isEnable in + self.inputInvitedCodeView.changeNextButtonEnableStatus = { [weak self] isEnable in self?.nextButton.isDisabled = !isEnable } } override func endEditingView() { - if !nextButton.isTouchInside { - view.endEditing(true) + if !self.nextButton.isTouchInside { + self.view.endEditing(true) } } // MARK: - selector - @objc private func keyboardWillShow(notification:NSNotification) { + @objc + private func keyboardWillShow(notification: NSNotification) { if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { UIView.animate(withDuration: 0.2, animations: { self.nextButton.transform = CGAffineTransform(translationX: 0, y: -keyboardSize.height + 30) @@ -157,14 +139,45 @@ final class ParticipateRoomViewController: BaseViewController { } } - @objc private func keyboardWillHide(notification:NSNotification) { + @objc + private func keyboardWillHide(notification: NSNotification) { UIView.animate(withDuration: 0.2, animations: { self.nextButton.transform = .identity }) } - @objc private func didReceiveNextNotification(_ notification: Notification) { + @objc + private func didReceiveNextNotification(_ notification: Notification) { guard let id = notification.userInfo?["roomId"] as? Int else { return } self.navigationController?.pushViewController(ChooseCharacterViewController(statusMode: .enterRoom, roomId: id), animated: true) } + + // MARK: - network + + private func dispatchInviteCode() { + Task { + do { + guard let code = self.inputInvitedCodeView.roomCodeTextField.text else { return } + let data = try await self.checkRoomInfoService + .dispatchVerification(body: code) + if let info = data { + guard let id = info.id else { return } + let viewController = CheckRoomViewController() + viewController.modalPresentationStyle = .overFullScreen + viewController.modalTransitionStyle = .crossDissolve + viewController.verification = info + viewController.roomId = id + + present(viewController, animated: true) + } + } catch NetworkError.serverError { + print("server Error") + } catch NetworkError.encodingError { + print("encoding Error") + } catch NetworkError.clientError(let message) { + makeAlert(title: TextLiteral.checkRoomViewControllerErrorAlertTitle, message: TextLiteral.checkRoomViewControllerErrorAlertMessage) + print("client Error: \(String(describing: message))") + } + } + } } From d403497f74b3e4d7d5aac41bbc4bf94462d3a3fd Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Thu, 11 May 2023 22:35:19 +0900 Subject: [PATCH 077/468] =?UTF-8?q?[REFACTOR]=20View=20=EB=A1=9C=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC=20(#456)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ParticipateRoom/ParticipateRoomView.swift | 145 +++++++++++++++++- .../ParticipateRoomViewController.swift | 129 ++++------------ 2 files changed, 170 insertions(+), 104 deletions(-) diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift index c721fed8d..8e3ddde87 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift @@ -5,4 +5,147 @@ // Created by 이성호 on 2023/05/11. // -import Foundation +import UIKit + +import SnapKit + +protocol ParticipateRoomViewDelegate: AnyObject { + func closeButtonDidTap() + func nextButtonDidTap() + func observeNextNotification(roomId: Int) +} + +final class ParticipateRoomView: UIView { + + // MARK: - ui component + + private let titleLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.enterRoom + label.font = .font(.regular, ofSize: 34) + return label + }() + private let closeButton: UIButton = { + let button = UIButton(type: .system) + button.tintColor = .lightGray + button.setImage(ImageLiterals.btnXmark, for: .normal) + return button + }() + private let nextButton: MainButton = { + let button = MainButton() + button.title = TextLiteral.searchRoom + button.isDisabled = true + return button + }() + let inputInvitedCodeView: InputInvitedCodeView = InputInvitedCodeView() + + // MARK: - property + + private weak var delegate: ParticipateRoomViewDelegate? + + // MARK: - init + + override init(frame: CGRect) { + super.init(frame: frame) + self.setupLayout() + self.setupButtonAction() + self.setupNotificationCenter() + self.toggleButton() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - func + + private func setupLayout() { + self.addSubview(self.closeButton) + self.closeButton.snp.makeConstraints { + $0.top.equalTo(self.safeAreaLayoutGuide).inset(9) + $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + } + + self.addSubview(self.titleLabel) + self.titleLabel.snp.makeConstraints { + $0.top.equalTo(self.safeAreaLayoutGuide).inset(66) + $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) + } + + self.addSubview(self.nextButton) + self.nextButton.snp.makeConstraints { + $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.bottom.equalTo(self.safeAreaLayoutGuide).inset(23) + $0.height.equalTo(60) + } + + self.addSubview(self.inputInvitedCodeView) + self.inputInvitedCodeView.snp.makeConstraints { + $0.top.equalTo(titleLabel.snp.bottom).offset(66) + $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.bottom.equalTo(nextButton.snp.top) + } + + self.bringSubviewToFront(self.nextButton) + } + + private func setupButtonAction() { + let didTapCloseButton = UIAction { [weak self] _ in + self?.delegate?.closeButtonDidTap() + } + + let didTapNextButton = UIAction { [weak self] _ in + self?.delegate?.nextButtonDidTap() + } + + self.closeButton.addAction(didTapCloseButton, for: .touchUpInside) + self.nextButton.addAction(didTapNextButton, for: .touchUpInside) + } + + private func setupNotificationCenter() { + NotificationCenter.default.addObserver(self, selector: #selector(self.didReceiveNextNotification(_:)), name: .nextNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) + } + + private func toggleButton() { + self.inputInvitedCodeView.changeNextButtonEnableStatus = { [weak self] isEnable in + self?.nextButton.isDisabled = !isEnable + } + } + + func configureDelegate(_ delegate: ParticipateRoomViewDelegate) { + self.delegate = delegate + } + + func endEditing() { + if !self.nextButton.isTouchInside { + self.endEditing(true) + } + } + + // MARK: - selector + + @objc + private func keyboardWillShow(notification: NSNotification) { + if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { + UIView.animate(withDuration: 0.2, animations: { + self.nextButton.transform = CGAffineTransform(translationX: 0, y: -keyboardSize.height + 30) + }) + } + } + + @objc + private func keyboardWillHide(notification: NSNotification) { + UIView.animate(withDuration: 0.2, animations: { + self.nextButton.transform = .identity + }) + } + + @objc + private func didReceiveNextNotification(_ notification: Notification) { + guard let id = notification.userInfo?["roomId"] as? Int else { return } + self.delegate?.observeNextNotification(roomId: id) + } +} diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift index 72b6f596e..85617a794 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift @@ -13,25 +13,7 @@ final class ParticipateRoomViewController: BaseViewController { // MARK: - ui component - private let titleLabel: UILabel = { - let label = UILabel() - label.text = TextLiteral.enterRoom - label.font = .font(.regular, ofSize: 34) - return label - }() - private let closeButton: UIButton = { - let button = UIButton(type: .system) - button.tintColor = .lightGray - button.setImage(ImageLiterals.btnXmark, for: .normal) - return button - }() - private let nextButton: MainButton = { - let button = MainButton() - button.title = TextLiteral.searchRoom - button.isDisabled = true - return button - }() - private let inputInvitedCodeView: InputInvitedCodeView = InputInvitedCodeView() + private let participateRoomView: ParticipateRoomView = ParticipateRoomView() // MARK: - property @@ -47,117 +29,44 @@ final class ParticipateRoomViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() - self.toggleButton() - self.setupButtonAction() + self.configureDelegation() } + + override func loadView() { + self.view = self.participateRoomView + } + // FIXME: 플로우 연결 하면서 변경 될 예정 override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) // FIXME: 뒤로가기 버그 수정(PR에서 얘기후 삭제 예정) - self.setupNotificationCenter() navigationController?.navigationBar.isHidden = true } // MARK: - override - override func setupLayout() { - view.addSubview(closeButton) - closeButton.snp.makeConstraints { - $0.top.equalTo(view.safeAreaLayoutGuide).inset(9) - $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - } - - view.addSubview(titleLabel) - titleLabel.snp.makeConstraints { - $0.top.equalTo(view.safeAreaLayoutGuide).inset(66) - $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) - } - - view.addSubview(nextButton) - nextButton.snp.makeConstraints { - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalTo(view.safeAreaLayoutGuide).inset(23) - $0.height.equalTo(60) - } - - view.addSubview(inputInvitedCodeView) - inputInvitedCodeView.snp.makeConstraints { - $0.top.equalTo(titleLabel.snp.bottom).offset(66) - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalTo(nextButton.snp.top) - } - - view.bringSubviewToFront(nextButton) - } - override func setupNavigationBar() { // FIXME: navigation으로 변경하면서 삭제예정 navigationController?.navigationBar.isHidden = true } - // MARK: - func - - private func setupButtonAction() { - let didTapCloseButton = UIAction { [weak self] _ in - self?.dismiss(animated: true, completion: nil) - } - - let didTapNextButton = UIAction { [weak self] _ in - self?.dispatchInviteCode() - } - - self.closeButton.addAction(didTapCloseButton, for: .touchUpInside) - self.nextButton.addAction(didTapNextButton, for: .touchUpInside) - } - - private func setupNotificationCenter() { - NotificationCenter.default.addObserver(self, selector: #selector(self.didReceiveNextNotification(_:)), name: .nextNotification, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) - } - - private func toggleButton() { - self.inputInvitedCodeView.changeNextButtonEnableStatus = { [weak self] isEnable in - self?.nextButton.isDisabled = !isEnable - } - } - override func endEditingView() { - if !self.nextButton.isTouchInside { - self.view.endEditing(true) - } + self.participateRoomView.endEditing() } - // MARK: - selector - - @objc - private func keyboardWillShow(notification: NSNotification) { - if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { - UIView.animate(withDuration: 0.2, animations: { - self.nextButton.transform = CGAffineTransform(translationX: 0, y: -keyboardSize.height + 30) - }) - } - } + // MARK: - func - @objc - private func keyboardWillHide(notification: NSNotification) { - UIView.animate(withDuration: 0.2, animations: { - self.nextButton.transform = .identity - }) + private func configureDelegation() { + self.participateRoomView.configureDelegate(self) } - @objc - private func didReceiveNextNotification(_ notification: Notification) { - guard let id = notification.userInfo?["roomId"] as? Int else { return } - self.navigationController?.pushViewController(ChooseCharacterViewController(statusMode: .enterRoom, roomId: id), animated: true) - } // MARK: - network private func dispatchInviteCode() { Task { do { - guard let code = self.inputInvitedCodeView.roomCodeTextField.text else { return } + guard let code = self.participateRoomView.inputInvitedCodeView.roomCodeTextField.text else { return } let data = try await self.checkRoomInfoService .dispatchVerification(body: code) if let info = data { @@ -181,3 +90,17 @@ final class ParticipateRoomViewController: BaseViewController { } } } + +extension ParticipateRoomViewController: ParticipateRoomViewDelegate { + func closeButtonDidTap() { + self.dismiss(animated: true) + } + + func nextButtonDidTap() { + self.dispatchInviteCode() + } + + func observeNextNotification(roomId: Int) { + self.navigationController?.pushViewController(ChooseCharacterViewController(statusMode: .enterRoom, roomId: roomId), animated: true) + } +} From 7fa5eef7dcb492ad882a365b649d94bdfa5f8cb2 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Thu, 11 May 2023 22:51:16 +0900 Subject: [PATCH 078/468] =?UTF-8?q?[REFACTOR]=20navigationBar=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20(#456)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ParticipateRoom/ParticipateRoomView.swift | 18 ++++++++++-------- .../ParticipateRoomViewController.swift | 17 +++++------------ 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift index 8e3ddde87..a9b068903 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift @@ -26,8 +26,7 @@ final class ParticipateRoomView: UIView { return label }() private let closeButton: UIButton = { - let button = UIButton(type: .system) - button.tintColor = .lightGray + let button = UIButton(frame: CGRect(origin: .zero, size: CGSize(width: 44, height: 44))) button.setImage(ImageLiterals.btnXmark, for: .normal) return button }() @@ -61,15 +60,10 @@ final class ParticipateRoomView: UIView { // MARK: - func private func setupLayout() { - self.addSubview(self.closeButton) - self.closeButton.snp.makeConstraints { - $0.top.equalTo(self.safeAreaLayoutGuide).inset(9) - $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - } self.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { - $0.top.equalTo(self.safeAreaLayoutGuide).inset(66) + $0.top.equalTo(self.safeAreaLayoutGuide).inset(20) $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) } @@ -119,6 +113,14 @@ final class ParticipateRoomView: UIView { self.delegate = delegate } + func configureNavigationBarItem(_ navigationController: UINavigationController) { + let navigationItem = navigationController.topViewController?.navigationItem + let closeButton = UIBarButtonItem(customView: self.closeButton) + + navigationItem?.rightBarButtonItem = closeButton + navigationItem?.leftBarButtonItem = nil + } + func endEditing() { if !self.nextButton.isTouchInside { self.endEditing(true) diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift index 85617a794..1fe252143 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift @@ -30,26 +30,15 @@ final class ParticipateRoomViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() self.configureDelegation() + self.configureNavigation() } override func loadView() { self.view = self.participateRoomView } - // FIXME: 플로우 연결 하면서 변경 될 예정 - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - // FIXME: 뒤로가기 버그 수정(PR에서 얘기후 삭제 예정) - navigationController?.navigationBar.isHidden = true - } - // MARK: - override - override func setupNavigationBar() { - // FIXME: navigation으로 변경하면서 삭제예정 - navigationController?.navigationBar.isHidden = true - } - override func endEditingView() { self.participateRoomView.endEditing() } @@ -60,6 +49,10 @@ final class ParticipateRoomViewController: BaseViewController { self.participateRoomView.configureDelegate(self) } + private func configureNavigation() { + guard let navigationController = self.navigationController else { return } + self.participateRoomView.configureNavigationBarItem(navigationController) + } // MARK: - network From 372a500f1189eaf51c95715d3b1bcb934fc49531 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Thu, 11 May 2023 22:54:37 +0900 Subject: [PATCH 079/468] =?UTF-8?q?[CHORE]=20private=20=EB=B6=99=EC=9D=B4?= =?UTF-8?q?=EB=A9=B0=20code=20=EC=A0=84=EB=8B=AC=20(#456)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/ParticipateRoom/ParticipateRoomView.swift | 7 ++++--- .../ParticipateRoom/ParticipateRoomViewController.swift | 7 +++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift index a9b068903..5e83669f0 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift @@ -11,7 +11,7 @@ import SnapKit protocol ParticipateRoomViewDelegate: AnyObject { func closeButtonDidTap() - func nextButtonDidTap() + func nextButtonDidTap(code: String) func observeNextNotification(roomId: Int) } @@ -36,7 +36,7 @@ final class ParticipateRoomView: UIView { button.isDisabled = true return button }() - let inputInvitedCodeView: InputInvitedCodeView = InputInvitedCodeView() + private let inputInvitedCodeView: InputInvitedCodeView = InputInvitedCodeView() // MARK: - property @@ -90,7 +90,8 @@ final class ParticipateRoomView: UIView { } let didTapNextButton = UIAction { [weak self] _ in - self?.delegate?.nextButtonDidTap() + guard let code = self?.inputInvitedCodeView.roomCodeTextField.text else { return } + self?.delegate?.nextButtonDidTap(code: code) } self.closeButton.addAction(didTapCloseButton, for: .touchUpInside) diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift index 1fe252143..146f852ee 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift @@ -56,10 +56,9 @@ final class ParticipateRoomViewController: BaseViewController { // MARK: - network - private func dispatchInviteCode() { + private func dispatchInviteCode(_ code : String) { Task { do { - guard let code = self.participateRoomView.inputInvitedCodeView.roomCodeTextField.text else { return } let data = try await self.checkRoomInfoService .dispatchVerification(body: code) if let info = data { @@ -89,8 +88,8 @@ extension ParticipateRoomViewController: ParticipateRoomViewDelegate { self.dismiss(animated: true) } - func nextButtonDidTap() { - self.dispatchInviteCode() + func nextButtonDidTap(code: String) { + self.dispatchInviteCode(code) } func observeNextNotification(roomId: Int) { From d213e2a0bc64d1dda2b5645a761bc80ef44e7176 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Thu, 11 May 2023 23:01:28 +0900 Subject: [PATCH 080/468] =?UTF-8?q?[CHORE]=20=EB=84=A4=EB=B9=84=EB=B0=94?= =?UTF-8?q?=EA=B0=80=20=EC=83=9D=EA=B8=B0=EB=AF=80=EB=A1=9C=20=EC=9D=B8?= =?UTF-8?q?=ED=95=B4=20=EC=9D=B4=EC=A0=84=20=ED=9E=88=EB=93=A0=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EC=82=AD=EC=A0=9C=20(#456)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChooseCharacter/ChooseCharacterViewController.swift | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index b7e924f30..0ee34e92a 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -58,14 +58,6 @@ final class ChooseCharacterViewController: BaseViewController { self.view = self.chooseCharacterView } - // MARK: - override - - override func setupNavigationBar() { - super.setupNavigationBar() - // FIXME: ParticipateRoomVC 수정 시 삭제 예정 - navigationController?.navigationBar.isHidden = false - } - // MARK: - func private func configureDelegation() { From bd1ee5c84f8832e5a233dfa9438ac9d5eaefca45 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Fri, 12 May 2023 11:18:01 +0900 Subject: [PATCH 081/468] =?UTF-8?q?[ADD]=20SettingView=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 +++ .../Manito/Screens/Setting/SettingView.swift | 27 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 Manito/Manito/Screens/Setting/SettingView.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 131d47c6a..6f86d6445 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -167,6 +167,7 @@ D77224DF285DDAB7008B760B /* Notification+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D77224DE285DDAB7008B760B /* Notification+Extension.swift */; }; D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = D777D2C828C7780E008655BD /* URLLiteral.swift */; }; D7B6C97C2858B2D40024F326 /* CheckRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */; }; + D7C4A1AD2A0DD8FA00C3AE4C /* SettingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1AC2A0DD8FA00C3AE4C /* SettingView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -328,6 +329,7 @@ D77224DE285DDAB7008B760B /* Notification+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Notification+Extension.swift"; sourceTree = ""; }; D777D2C828C7780E008655BD /* URLLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLLiteral.swift; sourceTree = ""; }; D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckRoomView.swift; sourceTree = ""; }; + D7C4A1AC2A0DD8FA00C3AE4C /* SettingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -953,6 +955,7 @@ D75ECB6E28A5EDC400A5B271 /* Component */, D75ECB6D28A5EDBC00A5B271 /* Cell */, D724AF5C287088310003F280 /* SettingViewController.swift */, + D7C4A1AC2A0DD8FA00C3AE4C /* SettingView.swift */, 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */, ); path = Setting; @@ -1183,6 +1186,7 @@ CB4C77E628C0D4EB007A1AD2 /* MainAPI.swift in Sources */, B5F524FD28519EEC00614FF7 /* UIColor+Extension.swift in Sources */, B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */, + D7C4A1AD2A0DD8FA00C3AE4C /* SettingView.swift in Sources */, 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */, 33BDF5622856E03800564211 /* FriendListViewController.swift in Sources */, B5F5250E2851A07700614FF7 /* LetterViewController.swift in Sources */, diff --git a/Manito/Manito/Screens/Setting/SettingView.swift b/Manito/Manito/Screens/Setting/SettingView.swift new file mode 100644 index 000000000..0ee5ebb1b --- /dev/null +++ b/Manito/Manito/Screens/Setting/SettingView.swift @@ -0,0 +1,27 @@ +// +// SettingView.swift +// Manito +// +// Created by 이성호 on 2023/05/12. +// + +import UIKit + +import SnapKit + +final class SettingView: UIView { + + // MARK: - init + + override init(frame: CGRect) { + super.init(frame: frame) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - func + +} From 9f933636941851dc706f89ba099b85036a345232 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Fri, 12 May 2023 19:47:45 +0900 Subject: [PATCH 082/468] =?UTF-8?q?[REFACTOR]=20View=20=EB=B6=84=EB=A6=AC?= =?UTF-8?q?=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Setting/SettingView.swift | 120 ++++++++++++++ .../Setting/SettingViewController.swift | 150 +++--------------- 2 files changed, 140 insertions(+), 130 deletions(-) diff --git a/Manito/Manito/Screens/Setting/SettingView.swift b/Manito/Manito/Screens/Setting/SettingView.swift index 0ee5ebb1b..93b15d5df 100644 --- a/Manito/Manito/Screens/Setting/SettingView.swift +++ b/Manito/Manito/Screens/Setting/SettingView.swift @@ -9,12 +9,47 @@ import UIKit import SnapKit +protocol SettingViewDelegate: AnyObject { + func changNicknameButtonDidTap() + func personalInfomationButtonDidTap() + func termsOfServiceButtonDidTap() + func developerInfoButtonDidTap() + func helpButtonDidTap() + func logoutButtonDidTap() +} + final class SettingView: UIView { + struct Option { + let title: String + let handler: () -> Void + } + // MARK: - ui component + + private lazy var tableView: UITableView = { + let tableView = UITableView() + tableView.register(SettingViewTableCell.self, forCellReuseIdentifier: SettingViewTableCell.className) + tableView.separatorStyle = .none + tableView.alwaysBounceVertical = false + tableView.backgroundColor = .backgroundGrey + tableView.delegate = self + tableView.dataSource = self + return tableView + }() + + private let imageRow: ImageRowView = ImageRowView() + + // MARK: - property + + private var options: [Option] = [] + private weak var delegate: SettingViewDelegate? + // MARK: - init override init(frame: CGRect) { super.init(frame: frame) + self.setupLayout() + self.configureModels() } @available(*, unavailable) @@ -24,4 +59,89 @@ final class SettingView: UIView { // MARK: - func + private func setupLayout() { + self.addSubview(self.imageRow) + self.imageRow.snp.makeConstraints { + $0.top.equalTo(self.safeAreaLayoutGuide) + $0.height.equalTo(40) + $0.centerX.equalToSuperview() + } + + self.addSubview(self.tableView) + self.tableView.snp.makeConstraints { + $0.top.equalTo(self.imageRow.snp.bottom) + $0.centerX.equalToSuperview() + $0.width.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.bottom.equalToSuperview() + } + } + + func configureModels() { + options.append(Option(title: TextLiteral.settingViewControllerChangeNickNameTitle, handler: { [weak self] in + DispatchQueue.main.async { + self?.delegate?.changNicknameButtonDidTap() + } + })) + + options.append(Option(title: TextLiteral.settingViewControllerPersonalInfomationTitle, handler: { [weak self] in + DispatchQueue.main.async { + self?.delegate?.personalInfomationButtonDidTap() + } + })) + + options.append(Option(title: TextLiteral.settingViewControllerTermsOfServiceTitle, handler: { [weak self] in + DispatchQueue.main.async { + self?.delegate?.termsOfServiceButtonDidTap() + } + })) + + options.append(Option(title: TextLiteral.settingViewControllerDeveloperInfoTitle, handler: { [weak self] in + DispatchQueue.main.async { + self?.delegate?.developerInfoButtonDidTap() + } + })) + + options.append(Option(title: TextLiteral.settingViewControllerHelpTitle, handler: { [weak self] in + DispatchQueue.main.async { + self?.delegate?.helpButtonDidTap() + } + })) + + options.append(Option(title: TextLiteral.settingViewControllerLogoutTitle, handler: { [weak self] in + DispatchQueue.main.async { + self?.delegate?.logoutButtonDidTap() + } + })) + } + + func configureDelegate(_ delegate: SettingViewDelegate) { + self.delegate = delegate + } +} + +extension SettingView: UITableViewDelegate { + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let model = options[indexPath.row] + model.handler() + } + + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return 70 + } +} + +extension SettingView: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return options.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let model = options[indexPath.row] + guard let cell = tableView.dequeueReusableCell(withIdentifier: SettingViewTableCell.className ,for: indexPath) as? SettingViewTableCell else { + return UITableViewCell() + } + cell.titleLabel.text = model.title + cell.selectionStyle = .none + return cell + } } diff --git a/Manito/Manito/Screens/Setting/SettingViewController.swift b/Manito/Manito/Screens/Setting/SettingViewController.swift index 163b0d097..520f9f138 100644 --- a/Manito/Manito/Screens/Setting/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/SettingViewController.swift @@ -10,30 +10,11 @@ import UIKit import SnapKit -struct Option { - let title: String - let handler: () -> Void -} - class SettingViewController: BaseViewController { - private var options = [Option]() - - // MARK: - Property + // MARK: - ui component - private lazy var tableView: UITableView = { - let tableView = UITableView() - tableView.register(SettingViewTableCell.self, forCellReuseIdentifier: SettingViewTableCell.className) - tableView.separatorStyle = .none - tableView.alwaysBounceVertical = false - tableView.backgroundColor = .backgroundGrey - return tableView - }() - - private let imageRow: ImageRowView = { - let view = ImageRowView() - return view - }() + private let settingView: SettingView = SettingView() // MARK: - init @@ -41,12 +22,11 @@ class SettingViewController: BaseViewController { print("\(#file) is dead") } - // MARK: - Life Cycle + // MARK: - life cycle override func viewDidLoad() { - configureModels() super.viewDidLoad() - setupDelegate() + self.configureDelegation() } override func viewWillAppear(_ animated: Bool) { @@ -54,106 +34,46 @@ class SettingViewController: BaseViewController { navigationController?.navigationBar.prefersLargeTitles = false } - override func setupLayout() { - view.addSubview(imageRow) - imageRow.snp.makeConstraints { - $0.top.equalTo(view.safeAreaLayoutGuide) - $0.height.equalTo(40) - $0.centerX.equalToSuperview() - } - - view.addSubview(tableView) - tableView.snp.makeConstraints { - $0.top.equalTo(imageRow.snp.bottom) - $0.centerX.equalToSuperview() - $0.width.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalToSuperview() - } + override func loadView() { + self.view = self.settingView } - // MARK: - Configure + // MARK: - func - override func configureUI() { - super.configureUI() + private func configureDelegation() { + self.settingView.configureDelegate(self) } - - override func setupNavigationBar() { - super.setupNavigationBar() +} - navigationController?.navigationBar.prefersLargeTitles = false - } - - // MARK: - Functions - - private func setupDelegate() { - tableView.delegate = self - tableView.dataSource = self - - } - - private func configureModels() { - options.append(Option(title: TextLiteral.settingViewControllerChangeNickNameTitle, handler: { [weak self] in - DispatchQueue.main.async { - self?.goToChangeNickname() - } - })) - - options.append(Option(title: TextLiteral.settingViewControllerPersonalInfomationTitle, handler: { [weak self] in - DispatchQueue.main.async { - self?.goToPersonalInfomation() - } - })) - - options.append(Option(title: TextLiteral.settingViewControllerTermsOfServiceTitle, handler: { [weak self] in - DispatchQueue.main.async { - self?.goToTermsOfService() - } - })) - - options.append(Option(title: TextLiteral.settingViewControllerDeveloperInfoTitle, handler: { [weak self] in - DispatchQueue.main.async { - self?.goToDeveloperInfo() - } - })) - - options.append(Option(title: TextLiteral.settingViewControllerHelpTitle, handler: { [weak self] in - DispatchQueue.main.async { - self?.goToHelp() - } - })) - - options.append(Option(title: TextLiteral.settingViewControllerLogoutTitle, handler: { [weak self] in - DispatchQueue.main.async { - self?.goToLogOut() - } - })) - } - - private func goToChangeNickname() { + +// MARK: - Extensions + +extension SettingViewController: SettingViewDelegate { + func changNicknameButtonDidTap() { navigationController?.pushViewController(ChangeNickNameViewController(), animated: true) } - private func goToPersonalInfomation() { + func personalInfomationButtonDidTap() { if let url = URL(string: URLLiteral.personalInfomationUrl) { UIApplication.shared.open(url, options: [:]) } } - private func goToTermsOfService() { + func termsOfServiceButtonDidTap() { if let url = URL(string: URLLiteral.termsOfServiceUrl) { UIApplication.shared.open(url, options: [:]) } } - private func goToDeveloperInfo() { + func developerInfoButtonDidTap() { navigationController?.pushViewController(SettingDeveloperInfoViewController(), animated: true) } - private func goToHelp() { + func helpButtonDidTap() { self.sendReportMail() } - private func goToLogOut() { + func logoutButtonDidTap() { makeRequestAlert(title: "로그아웃 하시겠습니까?", message: "", okTitle: "확인", cancelTitle: "취소", okAction: { _ in UserDefaultHandler.clearAllDataExcludingFcmToken() guard let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate @@ -163,36 +83,6 @@ class SettingViewController: BaseViewController { } } - -// MARK: - Extensions - -extension SettingViewController: UITableViewDelegate { - func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - let model = options[indexPath.row] - model.handler() - } - - func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - return 70 - } -} - -extension SettingViewController: UITableViewDataSource { - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return options.count - } - - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let model = options[indexPath.row] - guard let cell = tableView.dequeueReusableCell(withIdentifier: SettingViewTableCell.className ,for: indexPath) as? SettingViewTableCell else { - return UITableViewCell() - } - cell.titleLabel.text = model.title - cell.selectionStyle = .none - return cell - } -} - // MARK: - MFMailComposeViewControllerDelegate extension SettingViewController: MFMailComposeViewControllerDelegate { func sendReportMail() { From f7a0a2dd967eb0b68da7792512ff21fb60783c4c Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Fri, 12 May 2023 19:50:52 +0900 Subject: [PATCH 083/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=94=A9=20?= =?UTF-8?q?=EC=BB=A8=EB=B2=A4=EC=85=98=20=EC=A0=81=EC=9A=A9=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Setting/SettingView.swift | 19 ++++++++++--------- .../Setting/SettingViewController.swift | 10 +++++----- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Manito/Manito/Screens/Setting/SettingView.swift b/Manito/Manito/Screens/Setting/SettingView.swift index 93b15d5df..2a232c5d5 100644 --- a/Manito/Manito/Screens/Setting/SettingView.swift +++ b/Manito/Manito/Screens/Setting/SettingView.swift @@ -24,6 +24,7 @@ final class SettingView: UIView { let title: String let handler: () -> Void } + // MARK: - ui component private lazy var tableView: UITableView = { @@ -77,37 +78,37 @@ final class SettingView: UIView { } func configureModels() { - options.append(Option(title: TextLiteral.settingViewControllerChangeNickNameTitle, handler: { [weak self] in + self.options.append(Option(title: TextLiteral.settingViewControllerChangeNickNameTitle, handler: { [weak self] in DispatchQueue.main.async { self?.delegate?.changNicknameButtonDidTap() } })) - options.append(Option(title: TextLiteral.settingViewControllerPersonalInfomationTitle, handler: { [weak self] in + self.options.append(Option(title: TextLiteral.settingViewControllerPersonalInfomationTitle, handler: { [weak self] in DispatchQueue.main.async { self?.delegate?.personalInfomationButtonDidTap() } })) - options.append(Option(title: TextLiteral.settingViewControllerTermsOfServiceTitle, handler: { [weak self] in + self.options.append(Option(title: TextLiteral.settingViewControllerTermsOfServiceTitle, handler: { [weak self] in DispatchQueue.main.async { self?.delegate?.termsOfServiceButtonDidTap() } })) - options.append(Option(title: TextLiteral.settingViewControllerDeveloperInfoTitle, handler: { [weak self] in + self.options.append(Option(title: TextLiteral.settingViewControllerDeveloperInfoTitle, handler: { [weak self] in DispatchQueue.main.async { self?.delegate?.developerInfoButtonDidTap() } })) - options.append(Option(title: TextLiteral.settingViewControllerHelpTitle, handler: { [weak self] in + self.options.append(Option(title: TextLiteral.settingViewControllerHelpTitle, handler: { [weak self] in DispatchQueue.main.async { self?.delegate?.helpButtonDidTap() } })) - options.append(Option(title: TextLiteral.settingViewControllerLogoutTitle, handler: { [weak self] in + self.options.append(Option(title: TextLiteral.settingViewControllerLogoutTitle, handler: { [weak self] in DispatchQueue.main.async { self?.delegate?.logoutButtonDidTap() } @@ -121,7 +122,7 @@ final class SettingView: UIView { extension SettingView: UITableViewDelegate { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - let model = options[indexPath.row] + let model = self.options[indexPath.row] model.handler() } @@ -132,11 +133,11 @@ extension SettingView: UITableViewDelegate { extension SettingView: UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return options.count + return self.options.count } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let model = options[indexPath.row] + let model = self.options[indexPath.row] guard let cell = tableView.dequeueReusableCell(withIdentifier: SettingViewTableCell.className ,for: indexPath) as? SettingViewTableCell else { return UITableViewCell() } diff --git a/Manito/Manito/Screens/Setting/SettingViewController.swift b/Manito/Manito/Screens/Setting/SettingViewController.swift index 520f9f138..de52d0612 100644 --- a/Manito/Manito/Screens/Setting/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/SettingViewController.swift @@ -10,7 +10,7 @@ import UIKit import SnapKit -class SettingViewController: BaseViewController { +final class SettingViewController: BaseViewController { // MARK: - ui component @@ -31,7 +31,7 @@ class SettingViewController: BaseViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - navigationController?.navigationBar.prefersLargeTitles = false + self.navigationController?.navigationBar.prefersLargeTitles = false } override func loadView() { @@ -50,7 +50,7 @@ class SettingViewController: BaseViewController { extension SettingViewController: SettingViewDelegate { func changNicknameButtonDidTap() { - navigationController?.pushViewController(ChangeNickNameViewController(), animated: true) + self.navigationController?.pushViewController(ChangeNickNameViewController(), animated: true) } func personalInfomationButtonDidTap() { @@ -66,7 +66,7 @@ extension SettingViewController: SettingViewDelegate { } func developerInfoButtonDidTap() { - navigationController?.pushViewController(SettingDeveloperInfoViewController(), animated: true) + self.navigationController?.pushViewController(SettingDeveloperInfoViewController(), animated: true) } func helpButtonDidTap() { @@ -74,7 +74,7 @@ extension SettingViewController: SettingViewDelegate { } func logoutButtonDidTap() { - makeRequestAlert(title: "로그아웃 하시겠습니까?", message: "", okTitle: "확인", cancelTitle: "취소", okAction: { _ in + self.makeRequestAlert(title: "로그아웃 하시겠습니까?", message: "", okTitle: "확인", cancelTitle: "취소", okAction: { _ in UserDefaultHandler.clearAllDataExcludingFcmToken() guard let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate else { return } From 550468dc86857b31b94b2e10ec02c372e85a789c Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Fri, 12 May 2023 19:54:54 +0900 Subject: [PATCH 084/468] =?UTF-8?q?[CHORE]=20extension=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 14 ++++- ...er+MailComposeViewControllerDelegate.swift | 52 +++++++++++++++++++ .../Setting/SettingViewController.swift | 47 +---------------- .../Setting/{ => View}/SettingView.swift | 0 4 files changed, 66 insertions(+), 47 deletions(-) create mode 100644 Manito/Manito/Screens/Setting/SettingViewController+MailComposeViewControllerDelegate.swift rename Manito/Manito/Screens/Setting/{ => View}/SettingView.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 6f86d6445..970a3ae3b 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -168,6 +168,7 @@ D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = D777D2C828C7780E008655BD /* URLLiteral.swift */; }; D7B6C97C2858B2D40024F326 /* CheckRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */; }; D7C4A1AD2A0DD8FA00C3AE4C /* SettingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1AC2A0DD8FA00C3AE4C /* SettingView.swift */; }; + D7C4A1B02A0E522800C3AE4C /* SettingViewController+MailComposeViewControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1AF2A0E522800C3AE4C /* SettingViewController+MailComposeViewControllerDelegate.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -330,6 +331,7 @@ D777D2C828C7780E008655BD /* URLLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLLiteral.swift; sourceTree = ""; }; D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckRoomView.swift; sourceTree = ""; }; D7C4A1AC2A0DD8FA00C3AE4C /* SettingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingView.swift; sourceTree = ""; }; + D7C4A1AF2A0E522800C3AE4C /* SettingViewController+MailComposeViewControllerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SettingViewController+MailComposeViewControllerDelegate.swift"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -952,10 +954,11 @@ D724AF5B287088110003F280 /* Setting */ = { isa = PBXGroup; children = ( + D7C4A1AE2A0E51F500C3AE4C /* View */, D75ECB6E28A5EDC400A5B271 /* Component */, D75ECB6D28A5EDBC00A5B271 /* Cell */, D724AF5C287088310003F280 /* SettingViewController.swift */, - D7C4A1AC2A0DD8FA00C3AE4C /* SettingView.swift */, + D7C4A1AF2A0E522800C3AE4C /* SettingViewController+MailComposeViewControllerDelegate.swift */, 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */, ); path = Setting; @@ -985,6 +988,14 @@ path = Component; sourceTree = ""; }; + D7C4A1AE2A0E51F500C3AE4C /* View */ = { + isa = PBXGroup; + children = ( + D7C4A1AC2A0DD8FA00C3AE4C /* SettingView.swift */, + ); + path = View; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -1188,6 +1199,7 @@ B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */, D7C4A1AD2A0DD8FA00C3AE4C /* SettingView.swift in Sources */, 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */, + D7C4A1B02A0E522800C3AE4C /* SettingViewController+MailComposeViewControllerDelegate.swift in Sources */, 33BDF5622856E03800564211 /* FriendListViewController.swift in Sources */, B5F5250E2851A07700614FF7 /* LetterViewController.swift in Sources */, B5F5251C2851A19A00614FF7 /* BaseCollectionViewCell.swift in Sources */, diff --git a/Manito/Manito/Screens/Setting/SettingViewController+MailComposeViewControllerDelegate.swift b/Manito/Manito/Screens/Setting/SettingViewController+MailComposeViewControllerDelegate.swift new file mode 100644 index 000000000..7066d051e --- /dev/null +++ b/Manito/Manito/Screens/Setting/SettingViewController+MailComposeViewControllerDelegate.swift @@ -0,0 +1,52 @@ +// +// SettingViewController+MailComposeViewControllerDelegate.swift +// Manito +// +// Created by 이성호 on 2023/05/12. +// + +import MessageUI + +// MARK: - MFMailComposeViewControllerDelegate +extension SettingViewController: MFMailComposeViewControllerDelegate { + func sendReportMail() { + if MFMailComposeViewController.canSendMail() { + let composeVC = MFMailComposeViewController() + let aenittoEmail = "aenitto@gmail.com" + let messageBody = """ + + ----------------------------- + + - 문의하는 닉네임: \(String(describing: UserDefaultStorage.nickname)) + - 문의 메시지 제목 한줄 요약: + - 문의 날짜: \(Date()) + + ------------------------------ + + 문의 내용을 작성해주세요. + + """ + + composeVC.mailComposeDelegate = self + composeVC.setToRecipients([aenittoEmail]) + composeVC.setSubject("[문의 사항]") + composeVC.setMessageBody(messageBody, isHTML: false) + + self.present(composeVC, animated: true, completion: nil) + } + else { + self.showSendMailErrorAlert() + } + } + + private func showSendMailErrorAlert() { + let sendMailErrorAlert = UIAlertController(title: "메일 전송 실패", message: "아이폰 이메일 설정을 확인하고 다시 시도해주세요.", preferredStyle: .alert) + let confirmAction = UIAlertAction(title: "확인", style: .default) + sendMailErrorAlert.addAction(confirmAction) + self.present(sendMailErrorAlert, animated: true, completion: nil) + } + + func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) { + controller.dismiss(animated: true, completion: nil) + } +} diff --git a/Manito/Manito/Screens/Setting/SettingViewController.swift b/Manito/Manito/Screens/Setting/SettingViewController.swift index de52d0612..b79b3e6f6 100644 --- a/Manito/Manito/Screens/Setting/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/SettingViewController.swift @@ -83,49 +83,4 @@ extension SettingViewController: SettingViewDelegate { } } -// MARK: - MFMailComposeViewControllerDelegate -extension SettingViewController: MFMailComposeViewControllerDelegate { - func sendReportMail() { - if MFMailComposeViewController.canSendMail() { - let composeVC = MFMailComposeViewController() - let aenittoEmail = "aenitto@gmail.com" - let messageBody = """ - - ----------------------------- - - - 문의하는 닉네임: \(String(describing: UserDefaultStorage.nickname)) - - 문의 메시지 제목 한줄 요약: - - 문의 날짜: \(Date()) - - ------------------------------ - - 문의 내용을 작성해주세요. - - """ - - composeVC.mailComposeDelegate = self - composeVC.setToRecipients([aenittoEmail]) - composeVC.setSubject("[문의 사항]") - composeVC.setMessageBody(messageBody, isHTML: false) - - self.present(composeVC, animated: true, completion: nil) - } - else { - self.showSendMailErrorAlert() - } - } - - private func showSendMailErrorAlert() { - let sendMailErrorAlert = UIAlertController(title: "메일 전송 실패", message: "아이폰 이메일 설정을 확인하고 다시 시도해주세요.", preferredStyle: .alert) - let confirmAction = UIAlertAction(title: "확인", style: .default) { - (action) in - print("확인") - } - sendMailErrorAlert.addAction(confirmAction) - self.present(sendMailErrorAlert, animated: true, completion: nil) - } - - func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) { - controller.dismiss(animated: true, completion: nil) - } -} + diff --git a/Manito/Manito/Screens/Setting/SettingView.swift b/Manito/Manito/Screens/Setting/View/SettingView.swift similarity index 100% rename from Manito/Manito/Screens/Setting/SettingView.swift rename to Manito/Manito/Screens/Setting/View/SettingView.swift From 3fe30d47870f513a3c99c4c4e32b4dd0e51a8859 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Fri, 12 May 2023 20:40:01 +0900 Subject: [PATCH 085/468] =?UTF-8?q?[CHORE]=20Cell=20=EB=82=B4=EB=B6=80=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EB=B3=80=EA=B2=BD=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Setting/Cell/SettingViewTableCell.swift | 45 ++++++++++++------- .../Screens/Setting/View/SettingView.swift | 3 +- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift b/Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift index 417086feb..9f836e658 100644 --- a/Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift +++ b/Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift @@ -11,8 +11,9 @@ import SnapKit class SettingViewTableCell: UITableViewCell { - // MARK: - Property - lazy var settingCellView: UIView = { + // MARK: - ui component + + private let settingCellView: UIView = { let view = UIView() view.layer.borderWidth = 1 view.layer.borderColor = UIColor.white.cgColor @@ -21,42 +22,56 @@ class SettingViewTableCell: UITableViewCell { return view }() - lazy var titleLabel: UILabel = { + private let titleLabel: UILabel = { let label = UILabel() label.font = .font(.regular, ofSize: 15) return label }() // MARK: - init + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) - self.backgroundColor = .backgroundGrey - render() + self.setupLayout() + self.configureUI() } + + @available(*, unavailable) required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + // MARK: - override + override func layoutSubviews() { super.layoutSubviews() - - contentView.frame = contentView.frame.inset(by: UIEdgeInsets(top: 10, left: 0, bottom: 10, right: 0)) + self.contentView.frame = self.contentView.frame.inset(by: UIEdgeInsets(top: 10, left: 0, bottom: 10, right: 0)) } - // MARK: - render - private func render() { - - self.addSubview(settingCellView) - settingCellView.snp.makeConstraints { + // MARK: - func + + private func setupLayout() { + self.addSubview(self.settingCellView) + self.settingCellView.snp.makeConstraints { $0.centerY.centerX.equalToSuperview() $0.width.equalToSuperview() $0.height.equalTo(50) } - settingCellView.addSubview(titleLabel) - titleLabel.snp.makeConstraints { + self.settingCellView.addSubview(self.titleLabel) + self.titleLabel.snp.makeConstraints { $0.centerY.centerX.equalToSuperview() } - + } + + private func configureUI() { + self.backgroundColor = .backgroundGrey + self.selectionStyle = .none + } + + func configureCell(title: String) { + DispatchQueue.main.async { + self.titleLabel.text = title + } } } diff --git a/Manito/Manito/Screens/Setting/View/SettingView.swift b/Manito/Manito/Screens/Setting/View/SettingView.swift index 2a232c5d5..d70a9da35 100644 --- a/Manito/Manito/Screens/Setting/View/SettingView.swift +++ b/Manito/Manito/Screens/Setting/View/SettingView.swift @@ -141,8 +141,7 @@ extension SettingView: UITableViewDataSource { guard let cell = tableView.dequeueReusableCell(withIdentifier: SettingViewTableCell.className ,for: indexPath) as? SettingViewTableCell else { return UITableViewCell() } - cell.titleLabel.text = model.title - cell.selectionStyle = .none + cell.configureCell(title: model.title) return cell } } From f2b69321a11a3c6d1640a1a392ac623fe935db6c Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Fri, 12 May 2023 23:03:59 +0900 Subject: [PATCH 086/468] =?UTF-8?q?[CHORE]=20import=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Setting/SettingViewController.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Manito/Manito/Screens/Setting/SettingViewController.swift b/Manito/Manito/Screens/Setting/SettingViewController.swift index b79b3e6f6..482dd278f 100644 --- a/Manito/Manito/Screens/Setting/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/SettingViewController.swift @@ -5,7 +5,6 @@ // Created by 이성호 on 2022/07/02. // -import MessageUI import UIKit import SnapKit From 38dcbfbffb2e6e14e24aecc53b7c7bb497e38002 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 15 May 2023 19:31:31 +0900 Subject: [PATCH 087/468] =?UTF-8?q?[SETTING]=20Test=20Target=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#454)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 133 +++++++++++++++++- .../xcshareddata/xcschemes/Manito.xcscheme | 11 ++ Manito/ManitoTests/ManitoTests.swift | 35 +++++ 3 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 Manito/ManitoTests/ManitoTests.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index e5e2e5db2..d91e99f13 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -19,6 +19,7 @@ 397A241428BA516B00454E4F /* DetailWaitAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241328BA516B00454E4F /* DetailWaitAPI.swift */; }; 397A241828BA51B400454E4F /* DetailWaitProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */; }; 397A241A28BA532A00454E4F /* FriendList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241928BA532A00454E4F /* FriendList.swift */; }; + 398B1CBC2A12415C00DEFCEC /* ManitoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */; }; 399D17AB2856C83B00F50D9D /* DetailEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */; }; 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */; }; 39C957D02879521400A04A2B /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CF2879521400A04A2B /* String+Extension.swift */; }; @@ -170,6 +171,16 @@ D7B6C97C2858B2D40024F326 /* CheckRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 398B1CBD2A12415C00DEFCEC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B5F524C328519AA000614FF7 /* Project object */; + proxyType = 1; + remoteGlobalIDString = B5F524CA28519AA000614FF7; + remoteInfo = Manito; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXFileReference section */ 333BF66528571CF00039F77F /* FriendCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendCollectionViewCell.swift; sourceTree = ""; }; 333BF669285864CE0039F77F /* MemoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryViewController.swift; sourceTree = ""; }; @@ -182,6 +193,8 @@ 397A241328BA516B00454E4F /* DetailWaitAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitAPI.swift; sourceTree = ""; }; 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitProtocol.swift; sourceTree = ""; }; 397A241928BA532A00454E4F /* FriendList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendList.swift; sourceTree = ""; }; + 398B1CB92A12415B00DEFCEC /* ManitoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ManitoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManitoTests.swift; sourceTree = ""; }; 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailEditViewController.swift; sourceTree = ""; }; 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; 39C957CF2879521400A04A2B /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = ""; }; @@ -333,6 +346,13 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 398B1CB62A12415B00DEFCEC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; B5F524C828519AA000614FF7 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -406,6 +426,14 @@ path = Protocol; sourceTree = ""; }; + 398B1CBA2A12415C00DEFCEC /* ManitoTests */ = { + isa = PBXGroup; + children = ( + 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */, + ); + path = ManitoTests; + sourceTree = ""; + }; 39C957CC2876E2BE00A04A2B /* Login */ = { isa = PBXGroup; children = ( @@ -573,6 +601,7 @@ children = ( B55BCEB528D99F8600AF7E45 /* Settings.bundle */, B5F524CD28519AA000614FF7 /* Manito */, + 398B1CBA2A12415C00DEFCEC /* ManitoTests */, B5F524CC28519AA000614FF7 /* Products */, ); sourceTree = ""; @@ -581,6 +610,7 @@ isa = PBXGroup; children = ( B5F524CB28519AA000614FF7 /* Manito.app */, + 398B1CB92A12415B00DEFCEC /* ManitoTests.xctest */, ); name = Products; sourceTree = ""; @@ -996,6 +1026,24 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 398B1CB82A12415B00DEFCEC /* ManitoTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 398B1CC12A12415C00DEFCEC /* Build configuration list for PBXNativeTarget "ManitoTests" */; + buildPhases = ( + 398B1CB52A12415B00DEFCEC /* Sources */, + 398B1CB62A12415B00DEFCEC /* Frameworks */, + 398B1CB72A12415B00DEFCEC /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 398B1CBE2A12415C00DEFCEC /* PBXTargetDependency */, + ); + name = ManitoTests; + productName = ManitoTests; + productReference = 398B1CB92A12415B00DEFCEC /* ManitoTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; B5F524CA28519AA000614FF7 /* Manito */ = { isa = PBXNativeTarget; buildConfigurationList = B5F524DF28519AA100614FF7 /* Build configuration list for PBXNativeTarget "Manito" */; @@ -1027,9 +1075,13 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 1320; + LastSwiftUpdateCheck = 1420; LastUpgradeCheck = 1320; TargetAttributes = { + 398B1CB82A12415B00DEFCEC = { + CreatedOnToolsVersion = 14.2; + TestTargetID = B5F524CA28519AA000614FF7; + }; B5F524CA28519AA000614FF7 = { CreatedOnToolsVersion = 13.2.1; }; @@ -1056,11 +1108,19 @@ projectRoot = ""; targets = ( B5F524CA28519AA000614FF7 /* Manito */, + 398B1CB82A12415B00DEFCEC /* ManitoTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 398B1CB72A12415B00DEFCEC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; B5F524C928519AA000614FF7 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -1085,6 +1145,14 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 398B1CB52A12415B00DEFCEC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 398B1CBC2A12415C00DEFCEC /* ManitoTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; B5F524C728519AA000614FF7 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1236,6 +1304,14 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 398B1CBE2A12415C00DEFCEC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = B5F524CA28519AA000614FF7 /* Manito */; + targetProxy = 398B1CBD2A12415C00DEFCEC /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ B5F524D428519AA000614FF7 /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -1256,6 +1332,52 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ + 398B1CBF2A12415C00DEFCEC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = HF8GHZB58X; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; + MACOSX_DEPLOYMENT_TARGET = 13.1; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = mingwan.ManitoTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Manito.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Manito"; + }; + name = Debug; + }; + 398B1CC02A12415C00DEFCEC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = HF8GHZB58X; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; + MACOSX_DEPLOYMENT_TARGET = 13.1; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = mingwan.ManitoTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Manito.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Manito"; + }; + name = Release; + }; B5F524DD28519AA100614FF7 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1451,6 +1573,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 398B1CC12A12415C00DEFCEC /* Build configuration list for PBXNativeTarget "ManitoTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 398B1CBF2A12415C00DEFCEC /* Debug */, + 398B1CC02A12415C00DEFCEC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; B5F524C628519AA000614FF7 /* Build configuration list for PBXProject "Manito" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito.xcscheme b/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito.xcscheme index fd37e8576..0e99ce95e 100644 --- a/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito.xcscheme +++ b/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito.xcscheme @@ -28,6 +28,17 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + + + Date: Tue, 16 May 2023 15:27:40 +0900 Subject: [PATCH 088/468] =?UTF-8?q?[CHORE]=20=EC=8D=A8=EB=93=9C=ED=8C=8C?= =?UTF-8?q?=ED=8B=B0=20=EB=AA=A8=EB=93=88=20=EC=97=90=EB=9F=AC=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0=20(#454)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 26 +++++++++++++++++++++++++ Manito/ManitoTests/ManitoTests.swift | 1 + 2 files changed, 27 insertions(+) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index d91e99f13..81c6daefd 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -20,6 +20,8 @@ 397A241828BA51B400454E4F /* DetailWaitProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */; }; 397A241A28BA532A00454E4F /* FriendList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241928BA532A00454E4F /* FriendList.swift */; }; 398B1CBC2A12415C00DEFCEC /* ManitoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */; }; + 398B1CCA2A13597600DEFCEC /* FSCalendar in Frameworks */ = {isa = PBXBuildFile; productRef = 398B1CC92A13597600DEFCEC /* FSCalendar */; }; + 398B1CCC2A13599D00DEFCEC /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = 398B1CCB2A13599D00DEFCEC /* FirebaseAuth */; }; 399D17AB2856C83B00F50D9D /* DetailEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */; }; 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */; }; 39C957D02879521400A04A2B /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CF2879521400A04A2B /* String+Extension.swift */; }; @@ -350,6 +352,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 398B1CCA2A13597600DEFCEC /* FSCalendar in Frameworks */, + 398B1CCC2A13599D00DEFCEC /* FirebaseAuth in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -434,6 +438,13 @@ path = ManitoTests; sourceTree = ""; }; + 398B1CC82A13597600DEFCEC /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; 39C957CC2876E2BE00A04A2B /* Login */ = { isa = PBXGroup; children = ( @@ -603,6 +614,7 @@ B5F524CD28519AA000614FF7 /* Manito */, 398B1CBA2A12415C00DEFCEC /* ManitoTests */, B5F524CC28519AA000614FF7 /* Products */, + 398B1CC82A13597600DEFCEC /* Frameworks */, ); sourceTree = ""; }; @@ -1040,6 +1052,10 @@ 398B1CBE2A12415C00DEFCEC /* PBXTargetDependency */, ); name = ManitoTests; + packageProductDependencies = ( + 398B1CC92A13597600DEFCEC /* FSCalendar */, + 398B1CCB2A13599D00DEFCEC /* FirebaseAuth */, + ); productName = ManitoTests; productReference = 398B1CB92A12415B00DEFCEC /* ManitoTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; @@ -1646,6 +1662,16 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ + 398B1CC92A13597600DEFCEC /* FSCalendar */ = { + isa = XCSwiftPackageProductDependency; + package = B50B1B0528596CB10080992C /* XCRemoteSwiftPackageReference "FSCalendar" */; + productName = FSCalendar; + }; + 398B1CCB2A13599D00DEFCEC /* FirebaseAuth */ = { + isa = XCSwiftPackageProductDependency; + package = 39FFE33228F457AF008442EE /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseAuth; + }; 39FFE33328F457AF008442EE /* FirebaseMessaging */ = { isa = XCSwiftPackageProductDependency; package = 39FFE33228F457AF008442EE /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; diff --git a/Manito/ManitoTests/ManitoTests.swift b/Manito/ManitoTests/ManitoTests.swift index e457e8b36..e9d485745 100644 --- a/Manito/ManitoTests/ManitoTests.swift +++ b/Manito/ManitoTests/ManitoTests.swift @@ -6,6 +6,7 @@ // import XCTest +@testable import Manito final class ManitoTests: XCTestCase { From 8785646c52b05dcb4c511fb1a4adbdaef7d146a3 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 18 May 2023 15:04:27 +0900 Subject: [PATCH 089/468] =?UTF-8?q?[CHORE]=20isPast=20=EB=B0=98=EC=98=81?= =?UTF-8?q?=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index e037797fe..73a6c07f2 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -225,7 +225,7 @@ final class DetailEditView: UIView { func setupDateRange(from startDateString: String, to endDateString: String) { guard let startDate = startDateString.stringToDate else { return } - if startDate.isPast() { + if startDate.isPast { let fiveDaysInterval: TimeInterval = 86400 * 4 self.calendarView.startDateText = Date().dateToString self.calendarView.endDateText = (Date() + fiveDaysInterval).dateToString From f2e2807e50decf5535faffef82171ec68e4cac25 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 29 May 2023 10:22:26 +0900 Subject: [PATCH 090/468] =?UTF-8?q?[CHORE]=20FIXME=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/ChooseCharacter/ChooseCharacterViewController.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index b7e924f30..1e2c12f4c 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -27,6 +27,7 @@ final class ChooseCharacterViewController: BaseViewController { private var statusMode: Status private var roomId: Int? private var characterIndex: Int = 0 + // FIXME: private 변경 예정 var roomInfo: RoomDTO? // MARK: - init From 8ebb2e9d6a5ef312358a1ec6173dbb40c0c4f487 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 29 May 2023 11:08:10 +0900 Subject: [PATCH 091/468] =?UTF-8?q?[CHORE]=20api=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=EC=97=90=EC=84=9C=20view=EA=B4=80=EB=A0=A8=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EB=B6=84=EB=A6=AC=20(#435)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChooseCharacterViewController.swift | 55 +++++++++++-------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index c648836d8..d2a0b4c48 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -93,21 +93,43 @@ final class ChooseCharacterViewController: BaseViewController { } } + private func pushDetailWaitViewController(status: Status, roomId: Int) { + guard let navigationController = self.presentingViewController as? UINavigationController else { return } + + let viewController = DetailWaitViewController(roomIndex: roomId) + + switch status { + case .createRoom: + navigationController.popViewController(animated: true) + navigationController.pushViewController(viewController, animated: false) + + self.dismiss(animated: true) { + NotificationCenter.default.post(name: .createRoomInvitedCode, object: nil) + } + case .enterRoom: + self.dismiss(animated: true) { + navigationController.pushViewController(viewController, animated: true) + } + } + + } + + private func makeAlertWhenAlreadyJoin() { + self.makeAlert(title: "이미 참여중인 방입니다", message: "참여중인 애니또 리스트를 확인해 보세요", okAction: { [weak self] _ in + self?.dismiss(animated: true) + }) + } + // MARK: - network private func requestJoinRoom() { Task { do { - guard let id = self.roomId else { return } - let status = try await self.roomService.dispatchJoinRoom(roodId: id.description, + guard let roomId = self.roomId else { return } + let status = try await self.roomService.dispatchJoinRoom(roodId: roomId.description, dto: MemberDTO(colorIdx: self.characterIndex)) if status == 201 { - guard let navigationController = self.presentingViewController as? UINavigationController else { return } - guard let id = self.roomId else { return } - let viewController = DetailWaitViewController(roomIndex: id) - self.dismiss(animated: true) { - navigationController.pushViewController(viewController, animated: true) - } + self.pushDetailWaitViewController(status: .enterRoom, roomId: roomId) } } catch NetworkError.serverError { print("server Error") @@ -115,9 +137,7 @@ final class ChooseCharacterViewController: BaseViewController { print("encoding Error") } catch NetworkError.clientError(let message) { print("client Error: \(String(describing: message))") - self.makeAlert(title: "이미 참여중인 방입니다", message: "참여중인 애니또 리스트를 확인해 보세요", okAction: { [weak self] _ in - self?.dismiss(animated: true) - }) + self.makeAlertWhenAlreadyJoin() } } } @@ -125,17 +145,8 @@ final class ChooseCharacterViewController: BaseViewController { func requestCreateRoom(room: CreateRoomDTO) { Task { do { - guard - let roomId = try await self.roomService.postCreateRoom(body: room), - let navigationController = self.presentingViewController as? UINavigationController - else { return } - let viewController = DetailWaitViewController(roomIndex: roomId) - navigationController.popViewController(animated: true) - navigationController.pushViewController(viewController, animated: false) - - self.dismiss(animated: true) { - NotificationCenter.default.post(name: .createRoomInvitedCode, object: nil) - } + guard let roomId = try await self.roomService.postCreateRoom(body: room) else { return } + self.pushDetailWaitViewController(status: .createRoom, roomId: roomId) } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { From e18c27981c99b5efd5700962e1f1008c217f33bb Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 29 May 2023 11:27:12 +0900 Subject: [PATCH 092/468] =?UTF-8?q?[CHORE]=20=EB=B3=80=EC=88=98=EB=AA=85?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIComponent/CharacterCollectionViewCell.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/UIComponent/CharacterCollectionViewCell.swift b/Manito/Manito/Screens/ChooseCharacter/UIComponent/CharacterCollectionViewCell.swift index 0c07000c3..3b3a990b6 100644 --- a/Manito/Manito/Screens/ChooseCharacter/UIComponent/CharacterCollectionViewCell.swift +++ b/Manito/Manito/Screens/ChooseCharacter/UIComponent/CharacterCollectionViewCell.swift @@ -22,7 +22,7 @@ final class CharacterCollectionViewCell: BaseCollectionViewCell { // MARK: - property - private var characterBackground: UIColor? + private var characterBackgroundColor: UIColor? // MARK: - override @@ -41,14 +41,14 @@ final class CharacterCollectionViewCell: BaseCollectionViewCell { override var isSelected: Bool { didSet { - self.backgroundColor = self.isSelected ? self.characterBackground : self.characterBackground?.withAlphaComponent(0.5) + self.backgroundColor = self.isSelected ? self.characterBackgroundColor : self.characterBackgroundColor?.withAlphaComponent(0.5) self.contentView.alpha = self.isSelected ? 1.0 : 0.5 } } func configureBackground(color: UIColor) { - self.characterBackground = color - self.backgroundColor = self.characterBackground?.withAlphaComponent(0.5) + self.characterBackgroundColor = color + self.backgroundColor = self.characterBackgroundColor?.withAlphaComponent(0.5) self.contentView.alpha = 0.5 } From 78be6cf5a878b17191565e2bc7e0ee2fb982656e Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 29 May 2023 11:41:29 +0900 Subject: [PATCH 093/468] =?UTF-8?q?[CHORE]=20whitespace=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=20(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChooseCharacter/UIComponent/ChooseCharacterView.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift b/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift index 5c2bf86d7..f33e79636 100644 --- a/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift +++ b/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift @@ -69,7 +69,6 @@ final class ChooseCharacterView: UIView { // MARK: - func private func setupLayout() { - self.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { $0.top.equalTo(self.safeAreaLayoutGuide).inset(20) From c0d4570522de86d50a8287f57cf3e04a1e2011cc Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 29 May 2023 11:45:34 +0900 Subject: [PATCH 094/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreateRoom/UIComponent/CharacterCollectionView.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift index 8c8b3da71..0c1898c9e 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift @@ -35,7 +35,7 @@ final class CharacterCollectionView: UIView { return flowLayout }() private lazy var manittoCollectionView: UICollectionView = { - let collectionView = UICollectionView(frame: .zero, collectionViewLayout: collectionViewFlowLayout) + let collectionView = UICollectionView(frame: .zero, collectionViewLayout: self.collectionViewFlowLayout) collectionView.backgroundColor = .clear collectionView.dataSource = self collectionView.delegate = self @@ -92,7 +92,7 @@ extension CharacterCollectionView: UICollectionViewDataSource { } } -extension CharacterCollectionView: UICollectionViewDelegateFlowLayout { +extension CharacterCollectionView: UICollectionViewDelegate { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { self.characterIndex = indexPath.item } From e5962fec6c7f918643e8221c39aca6c849274132 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 29 May 2023 12:27:30 +0900 Subject: [PATCH 095/468] =?UTF-8?q?[CHORE]=20life=20cycle=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=20=EB=B3=80=EA=B2=BD=20(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChooseCharacter/ChooseCharacterViewController.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index d2a0b4c48..8069d4891 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -49,16 +49,16 @@ final class ChooseCharacterViewController: BaseViewController { // MARK: - life cycle + override func loadView() { + self.view = self.chooseCharacterView + } + override func viewDidLoad() { super.viewDidLoad() self.configureDelegation() self.configureNavigationController() } - override func loadView() { - self.view = self.chooseCharacterView - } - // MARK: - override override func setupNavigationBar() { From 4ae6efa06af6197194bf731f10d54171ff3ad423 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 29 May 2023 12:28:44 +0900 Subject: [PATCH 096/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChooseCharacter/ChooseCharacterViewController.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index 8069d4891..9d5176a83 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -87,7 +87,7 @@ final class ChooseCharacterViewController: BaseViewController { capacity: roomInfo.capacity, startDate: roomInfo.startDate, endDate: roomInfo.endDate) , - member: MemberDTO(colorIdx: characterIndex))) + member: MemberDTO(colorIdx: self.characterIndex))) case .enterRoom: self.requestJoinRoom() } @@ -142,7 +142,7 @@ final class ChooseCharacterViewController: BaseViewController { } } - func requestCreateRoom(room: CreateRoomDTO) { + private func requestCreateRoom(room: CreateRoomDTO) { Task { do { guard let roomId = try await self.roomService.postCreateRoom(body: room) else { return } From b0b7ee9cf294cf80d161a6a897eafff8ad872ba7 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 29 May 2023 12:56:15 +0900 Subject: [PATCH 097/468] =?UTF-8?q?[CHORE]=20=EC=88=9C=EC=88=98=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EB=B3=80=EA=B2=BD=20(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChooseCharacter/ChooseCharacterViewController.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index 9d5176a83..71be63aa5 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -78,7 +78,7 @@ final class ChooseCharacterViewController: BaseViewController { self.chooseCharacterView.configureNavigationItem(navigationController) } - private func didTapEnterButton() { + private func didTapEnterButton(characterIndex: Int) { // FIXME: statusMode 삭제 이후 enterRoom 변경 예정 switch self.statusMode { case .createRoom: @@ -87,7 +87,7 @@ final class ChooseCharacterViewController: BaseViewController { capacity: roomInfo.capacity, startDate: roomInfo.startDate, endDate: roomInfo.endDate) , - member: MemberDTO(colorIdx: self.characterIndex))) + member: MemberDTO(colorIdx: characterIndex))) case .enterRoom: self.requestJoinRoom() } @@ -169,6 +169,6 @@ extension ChooseCharacterViewController: ChooseCharacterViewDelegate { func joinButtonDidTap(characterIndex: Int) { self.characterIndex = characterIndex - self.didTapEnterButton() + self.didTapEnterButton(characterIndex: self.characterIndex) } } From b6d3ba8b39e446f0262febb1528279846f8c0873 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 29 May 2023 15:23:24 +0900 Subject: [PATCH 098/468] =?UTF-8?q?[CHORE]=20=EB=B3=80=EC=88=98=EB=AA=85?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Network/Models/Request/RoomDTO.swift | 2 +- .../ChooseCharacter/ChooseCharacterViewController.swift | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Network/Models/Request/RoomDTO.swift b/Manito/Manito/Network/Models/Request/RoomDTO.swift index 631c61559..10f650530 100644 --- a/Manito/Manito/Network/Models/Request/RoomDTO.swift +++ b/Manito/Manito/Network/Models/Request/RoomDTO.swift @@ -20,5 +20,5 @@ struct RoomDTO: Encodable { } struct MemberDTO: Encodable { - var colorIdx: Int + var colorIndex: Int } diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index 71be63aa5..9bb861b84 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -87,7 +87,7 @@ final class ChooseCharacterViewController: BaseViewController { capacity: roomInfo.capacity, startDate: roomInfo.startDate, endDate: roomInfo.endDate) , - member: MemberDTO(colorIdx: characterIndex))) + member: MemberDTO(colorIndex: characterIndex))) case .enterRoom: self.requestJoinRoom() } @@ -127,7 +127,7 @@ final class ChooseCharacterViewController: BaseViewController { do { guard let roomId = self.roomId else { return } let status = try await self.roomService.dispatchJoinRoom(roodId: roomId.description, - dto: MemberDTO(colorIdx: self.characterIndex)) + dto: MemberDTO(colorIndex: self.characterIndex)) if status == 201 { self.pushDetailWaitViewController(status: .enterRoom, roomId: roomId) } @@ -169,6 +169,6 @@ extension ChooseCharacterViewController: ChooseCharacterViewDelegate { func joinButtonDidTap(characterIndex: Int) { self.characterIndex = characterIndex - self.didTapEnterButton(characterIndex: self.characterIndex) + self.didTapEnterButton(characterIndex: characterIndex) } } From 76bc265ad7d878154a1ea90dc8a943890a360f18 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 29 May 2023 15:27:51 +0900 Subject: [PATCH 099/468] =?UTF-8?q?[CHORE]=20characterIndex=20=EB=B3=80?= =?UTF-8?q?=EC=88=98=20=EC=82=AD=EC=A0=9C=20(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChooseCharacter/ChooseCharacterViewController.swift | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index 9bb861b84..4b74c6b19 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -26,7 +26,6 @@ final class ChooseCharacterViewController: BaseViewController { // FIXME: 삭제예정 private var statusMode: Status private var roomId: Int? - private var characterIndex: Int = 0 // FIXME: private 변경 예정 var roomInfo: RoomDTO? @@ -89,7 +88,7 @@ final class ChooseCharacterViewController: BaseViewController { endDate: roomInfo.endDate) , member: MemberDTO(colorIndex: characterIndex))) case .enterRoom: - self.requestJoinRoom() + self.requestJoinRoom(characterIndex: characterIndex) } } @@ -122,12 +121,12 @@ final class ChooseCharacterViewController: BaseViewController { // MARK: - network - private func requestJoinRoom() { + private func requestJoinRoom(characterIndex: Int) { Task { do { guard let roomId = self.roomId else { return } let status = try await self.roomService.dispatchJoinRoom(roodId: roomId.description, - dto: MemberDTO(colorIndex: self.characterIndex)) + dto: MemberDTO(colorIndex: characterIndex)) if status == 201 { self.pushDetailWaitViewController(status: .enterRoom, roomId: roomId) } @@ -168,7 +167,6 @@ extension ChooseCharacterViewController: ChooseCharacterViewDelegate { } func joinButtonDidTap(characterIndex: Int) { - self.characterIndex = characterIndex self.didTapEnterButton(characterIndex: characterIndex) } } From 6f05570975d402b261f38fcbed3e700fd7b3357e Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 29 May 2023 15:31:41 +0900 Subject: [PATCH 100/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20(#453)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIComponent/CharacterCollectionViewCell.swift | 2 +- .../CreateRoom/UIComponent/CharacterCollectionView.swift | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/UIComponent/CharacterCollectionViewCell.swift b/Manito/Manito/Screens/ChooseCharacter/UIComponent/CharacterCollectionViewCell.swift index 3b3a990b6..07f046f63 100644 --- a/Manito/Manito/Screens/ChooseCharacter/UIComponent/CharacterCollectionViewCell.swift +++ b/Manito/Manito/Screens/ChooseCharacter/UIComponent/CharacterCollectionViewCell.swift @@ -46,7 +46,7 @@ final class CharacterCollectionViewCell: BaseCollectionViewCell { } } - func configureBackground(color: UIColor) { + func configureBackgroundColor(color: UIColor) { self.characterBackgroundColor = color self.backgroundColor = self.characterBackgroundColor?.withAlphaComponent(0.5) self.contentView.alpha = 0.5 diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift index 0c1898c9e..eafd46644 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift @@ -16,10 +16,7 @@ final class CharacterCollectionView: UIView { static let cellInterSpacing: CGFloat = 39.0 static let cellLineSpacing: CGFloat = 24.0 static let cellWidth: CGFloat = (UIScreen.main.bounds.size.width - (collectionHorizontalSpacing * 2 + cellInterSpacing * 2)) / 3 - static let collectionInset = UIEdgeInsets(top: 0, - left: 0, - bottom: 0, - right: 0) + static let collectionInset = UIEdgeInsets.zero } // MARK: - ui component @@ -80,7 +77,7 @@ extension CharacterCollectionView: UICollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CharacterCollectionViewCell.className, for: indexPath) as? CharacterCollectionViewCell else { return UICollectionViewCell() } - cell.configureBackground(color: Character.allCases[indexPath.item].color) + cell.configureBackgroundColor(color: Character.allCases[indexPath.item].color) cell.configureImage(image: Character.allCases[indexPath.item].image) if indexPath.item == 0 { From 7376285cb7755f3d24839e1732927e6e56614850 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 29 May 2023 15:59:13 +0900 Subject: [PATCH 101/468] =?UTF-8?q?[CHORE]=20SettingCellView=20->=20Conten?= =?UTF-8?q?tViewLayer=20=EB=B3=80=EA=B2=BD=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Setting/Cell/SettingViewTableCell.swift | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift b/Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift index 9f836e658..3e44c4f40 100644 --- a/Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift +++ b/Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift @@ -9,22 +9,14 @@ import UIKit import SnapKit -class SettingViewTableCell: UITableViewCell { +final class SettingViewTableCell: UITableViewCell { // MARK: - ui component - - private let settingCellView: UIView = { - let view = UIView() - view.layer.borderWidth = 1 - view.layer.borderColor = UIColor.white.cgColor - view.layer.cornerRadius = 10 - view.backgroundColor = .darkGrey002 - return view - }() - + private let titleLabel: UILabel = { let label = UILabel() label.font = .font(.regular, ofSize: 15) + label.text = "SSSSS" return label }() @@ -34,6 +26,7 @@ class SettingViewTableCell: UITableViewCell { super.init(style: style, reuseIdentifier: reuseIdentifier) self.setupLayout() self.configureUI() + self.configureContentViewLayer() } @available(*, unavailable) @@ -51,14 +44,7 @@ class SettingViewTableCell: UITableViewCell { // MARK: - func private func setupLayout() { - self.addSubview(self.settingCellView) - self.settingCellView.snp.makeConstraints { - $0.centerY.centerX.equalToSuperview() - $0.width.equalToSuperview() - $0.height.equalTo(50) - } - - self.settingCellView.addSubview(self.titleLabel) + self.contentView.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { $0.centerY.centerX.equalToSuperview() } @@ -69,6 +55,13 @@ class SettingViewTableCell: UITableViewCell { self.selectionStyle = .none } + private func configureContentViewLayer() { + self.contentView.layer.borderWidth = 1 + self.contentView.layer.borderColor = UIColor.white.cgColor + self.contentView.layer.cornerRadius = 10 + self.contentView.backgroundColor = .darkGrey002 + } + func configureCell(title: String) { DispatchQueue.main.async { self.titleLabel.text = title From 293bf541a508f6b6f7da23131d59fb362effae48 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 29 May 2023 16:03:59 +0900 Subject: [PATCH 102/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift b/Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift index 3e44c4f40..f20faef88 100644 --- a/Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift +++ b/Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift @@ -63,8 +63,6 @@ final class SettingViewTableCell: UITableViewCell { } func configureCell(title: String) { - DispatchQueue.main.async { - self.titleLabel.text = title - } + self.titleLabel.text = title } } From ea8c202a1a41ccea90360c74eae02b9391eea79b Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 29 May 2023 16:06:29 +0900 Subject: [PATCH 103/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Setting/SettingViewController.swift | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Manito/Manito/Screens/Setting/SettingViewController.swift b/Manito/Manito/Screens/Setting/SettingViewController.swift index 482dd278f..3e6ad73f0 100644 --- a/Manito/Manito/Screens/Setting/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/SettingViewController.swift @@ -23,6 +23,10 @@ final class SettingViewController: BaseViewController { // MARK: - life cycle + override func loadView() { + self.view = self.settingView + } + override func viewDidLoad() { super.viewDidLoad() self.configureDelegation() @@ -30,11 +34,7 @@ final class SettingViewController: BaseViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - self.navigationController?.navigationBar.prefersLargeTitles = false - } - - override func loadView() { - self.view = self.settingView + self.configureNavigationBar() } // MARK: - func @@ -42,6 +42,10 @@ final class SettingViewController: BaseViewController { private func configureDelegation() { self.settingView.configureDelegate(self) } + + private func configureNavigationBar() { + self.navigationController?.navigationBar.prefersLargeTitles = false + } } From 544bae3b7e1616fbdeef3012d11e43339ca112ad Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 29 May 2023 16:12:09 +0900 Subject: [PATCH 104/468] =?UTF-8?q?[CHORE]=20whitespace=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=20(#456)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift index 5e83669f0..4c0791817 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift @@ -60,7 +60,6 @@ final class ParticipateRoomView: UIView { // MARK: - func private func setupLayout() { - self.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { $0.top.equalTo(self.safeAreaLayoutGuide).inset(20) From 95f3cd5781429ef027773c6e77cedc84eea4cc9e Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 29 May 2023 17:57:27 +0900 Subject: [PATCH 105/468] =?UTF-8?q?[CHORE]=20=EC=A3=BC=EC=84=9D=20life=20c?= =?UTF-8?q?ycle=20=EC=88=98=EC=A0=95=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/DetailEditViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index e5fb50772..248610bd0 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -38,7 +38,7 @@ final class DetailEditViewController: BaseViewController { print("\(#file) is dead") } - // MARK: - override + // MARK: - life cycle override func loadView() { self.view = self.detailEditView From e54099e0a7c6fe3a3afbc81718ebd1fa111b82c7 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 29 May 2023 17:58:32 +0900 Subject: [PATCH 106/468] =?UTF-8?q?[CHORE]=20=EC=A3=BC=EC=84=9D=20override?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/DetailEditViewController.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index 248610bd0..60a42e44a 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -51,6 +51,8 @@ final class DetailEditViewController: BaseViewController { self.setupMemberSliderValue() } + // MARK: - override + override func configureUI() { super.configureUI() self.presentationController?.delegate = self @@ -81,7 +83,7 @@ final class DetailEditViewController: BaseViewController { } self.showDiscardActionSheet() } - + private func showDiscardActionSheet() { let actionTitles = [TextLiteral.destructive, TextLiteral.cancel] let actionStyle: [UIAlertAction.Style] = [.destructive, .cancel] From e78418f52392bf98a918a0caf8a193106fdf1661 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 29 May 2023 18:00:00 +0900 Subject: [PATCH 107/468] =?UTF-8?q?[CHORE]=20=EC=BA=98=EB=A6=B0=EB=8D=94?= =?UTF-8?q?=20=EB=82=A0=EC=A7=9C=20=EC=84=A4=EC=A0=95=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EC=88=98=EC=A0=95=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/DetailEditViewController.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index 60a42e44a..39d31291b 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -47,7 +47,7 @@ final class DetailEditViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() self.configureDelegation() - self.setupCalendarLayout() + self.setupCalendarDateRange() self.setupMemberSliderValue() } @@ -65,7 +65,7 @@ final class DetailEditViewController: BaseViewController { self.detailEditView.configureDelegation(self) } - private func setupCalendarLayout() { + private func setupCalendarDateRange() { guard let startDate = self.room.roomInformation?.startDate, let endDate = self.room.roomInformation?.endDate else { return } self.detailEditView.setupDateRange(from: startDate, to: endDate) From 924f42ed773c0e31e78de15784aab5088d103ad9 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 29 May 2023 18:02:59 +0900 Subject: [PATCH 108/468] =?UTF-8?q?[CHORE]=20put=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=EB=AA=85=20=EC=88=98=EC=A0=95=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/DetailEditViewController.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index 39d31291b..a052c12e9 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -97,7 +97,7 @@ final class DetailEditViewController: BaseViewController { // MARK: - network - private func putChangeRoomInfo(roomDto: RoomDTO, completionHandler: @escaping ((Result) -> Void)) { + private func putRoomInfo(roomDto: RoomDTO, completionHandler: @escaping ((Result) -> Void)) { guard let roomIndex = self.room.roomInformation?.id else { return } Task { do { @@ -137,7 +137,7 @@ extension DetailEditViewController: DetailEditDelegate { startDate: "20\(startDate)", endDate: "20\(endDate)") if currentUserCount <= capacity { - self.putChangeRoomInfo(roomDto: dto) { [weak self] result in + self.putRoomInfo(roomDto: dto) { [weak self] result in switch result { case .success: self?.didTappedChangeButton?() From 6cad6c50aa58ac5e82a0cddf2f8b0d99bfe3546c Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 29 May 2023 18:23:10 +0900 Subject: [PATCH 109/468] =?UTF-8?q?[CHORE]=20delegate=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/DetailEditViewController.swift | 6 +++--- .../Manito/Screens/Detail-Wait/View/DetailEditView.swift | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index a052c12e9..6eff29c37 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -125,11 +125,11 @@ extension DetailEditViewController: UIAdaptivePresentationControllerDelegate { } extension DetailEditViewController: DetailEditDelegate { - func dismiss() { + func cancleButtonDidTap() { self.dismiss(animated: true) } - func changeRoomInformation(capacity: Int, from startDate: String, to endDate: String) { + func changeButtonDidTap(capacity: Int, from startDate: String, to endDate: String) { guard let roomTitle = self.room.roomInformation?.title, let currentUserCount = self.room.participants?.count else { return } let dto = RoomDTO(title: roomTitle, @@ -141,7 +141,7 @@ extension DetailEditViewController: DetailEditDelegate { switch result { case .success: self?.didTappedChangeButton?() - self?.dismiss() + self?.cancleButtonDidTap() case .failure: self?.makeAlert(title: TextLiteral.detailEditViewControllerChangeErrorTitle, message: TextLiteral.detailEditViewControllerChangeErrorMessage diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 73a6c07f2..51838752e 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -10,8 +10,8 @@ import UIKit import SnapKit protocol DetailEditDelegate: AnyObject { - func dismiss() - func changeRoomInformation(capacity: Int, from startDate: String, to endDate: String) + func cancleButtonDidTap() + func changeButtonDidTap(capacity: Int, from startDate: String, to endDate: String) } final class DetailEditView: UIView { @@ -243,7 +243,7 @@ final class DetailEditView: UIView { private func setupCancleButton() { let action = UIAction { [weak self] _ in - self?.delegate?.dismiss() + self?.delegate?.cancleButtonDidTap() } self.cancelButton.addAction(action, for: .touchUpInside) } @@ -253,7 +253,7 @@ final class DetailEditView: UIView { guard let capacity = self?.memberSlider.value, let startDateString = self?.calendarView.getTempStartDate(), let endDateString = self?.calendarView.getTempEndDate() else { return } - self?.delegate?.changeRoomInformation(capacity: Int(capacity), + self?.delegate?.changeButtonDidTap(capacity: Int(capacity), from: startDateString, to: endDateString) } From 61085a6813fe964df22c62f55ac79fd64e99f683 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 29 May 2023 18:26:02 +0900 Subject: [PATCH 110/468] =?UTF-8?q?[CHORE]=20label=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EB=B0=8D=20=EB=B3=80=EA=B2=BD=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/View/DetailEditView.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 51838752e..ab32b8182 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -49,7 +49,7 @@ final class DetailEditView: UIView { label.font = .font(.regular, ofSize: 16) return label }() - private let startSettingLabel: UILabel = { + private let manittoPeriodTitleLabel: UILabel = { let label = UILabel() label.text = TextLiteral.detailEditViewControllerStartSetting label.font = .font(.regular, ofSize: 16) @@ -161,15 +161,15 @@ final class DetailEditView: UIView { $0.centerY.equalTo(self.cancelButton.snp.centerY) } - self.addSubview(self.startSettingLabel) - self.startSettingLabel.snp.makeConstraints { + self.addSubview(self.manittoPeriodTitleLabel) + self.manittoPeriodTitleLabel.snp.makeConstraints { $0.top.equalTo(self.cancelButton.snp.bottom).offset(51) $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) } self.addSubview(self.calendarView) self.calendarView.snp.makeConstraints { - $0.top.equalTo(self.startSettingLabel.snp.bottom).offset(30) + $0.top.equalTo(self.manittoPeriodTitleLabel.snp.bottom).offset(30) $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) $0.height.equalTo(400) } From 8b569af14cf85c5b39bb0565c3bd3d38a235888b Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 29 May 2023 18:37:55 +0900 Subject: [PATCH 111/468] =?UTF-8?q?[CHORE]=20UILabel=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EB=B0=8D=20=EC=88=98=EC=A0=95=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/View/DetailEditView.swift | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index ab32b8182..06f5ab093 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -57,28 +57,28 @@ final class DetailEditView: UIView { return label }() let calendarView: CalendarView = CalendarView() - private let tipLabel: UILabel = { + private let helpLabel: UILabel = { let label = UILabel() label.text = TextLiteral.maxMessage label.textColor = .grey004 label.font = .font(.regular, ofSize: 14) return label }() - private let setMemberLabel: UILabel = { + private let numberOfParticipantsTitleLabel: UILabel = { let label = UILabel() label.text = TextLiteral.detailEditViewControllerSetMember label.font = .font(.regular, ofSize: 18) label.textColor = .white return label }() - private lazy var minMemberLabel: UILabel = { + private lazy var minimumNumberOfMembersLabel: UILabel = { let label = UILabel() label.text = "\(Int(self.memberSlider.minimumValue))인" label.font = .font(.regular, ofSize: 16) label.textColor = .white return label }() - private lazy var maxMemberLabel: UILabel = { + private lazy var maxNumberOfMembersLabel: UILabel = { let label = UILabel() label.text = "\(Int(self.memberSlider.maximumValue))인" label.font = .font(.regular, ofSize: 16) @@ -174,8 +174,8 @@ final class DetailEditView: UIView { $0.height.equalTo(400) } - self.addSubview(tipLabel) - self.tipLabel.snp.makeConstraints { + self.addSubview(helpLabel) + self.helpLabel.snp.makeConstraints { $0.top.equalTo(self.calendarView.snp.bottom).offset(8) $0.trailing.equalToSuperview().inset(25) } @@ -186,28 +186,28 @@ final class DetailEditView: UIView { } private func setupEditMembersLayout() { - self.addSubview(self.setMemberLabel) - self.setMemberLabel.snp.makeConstraints { + self.addSubview(self.numberOfParticipantsTitleLabel) + self.numberOfParticipantsTitleLabel.snp.makeConstraints { $0.top.equalTo(self.calendarView.snp.bottom).offset(60) $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) } - self.addSubview(self.minMemberLabel) - self.minMemberLabel.snp.makeConstraints { - $0.top.equalTo(self.setMemberLabel.snp.bottom).offset(30) + self.addSubview(self.minimumNumberOfMembersLabel) + self.minimumNumberOfMembersLabel.snp.makeConstraints { + $0.top.equalTo(self.numberOfParticipantsTitleLabel.snp.bottom).offset(30) $0.leading.equalToSuperview().inset(24) } self.addSubview(self.memberSlider) self.memberSlider.snp.makeConstraints { - $0.leading.equalTo(self.minMemberLabel.snp.trailing).offset(5) + $0.leading.equalTo(self.minimumNumberOfMembersLabel.snp.trailing).offset(5) $0.height.equalTo(45) - $0.centerY.equalTo(self.minMemberLabel.snp.centerY) + $0.centerY.equalTo(self.minimumNumberOfMembersLabel.snp.centerY) } - self.addSubview(self.maxMemberLabel) - self.maxMemberLabel.snp.makeConstraints { - $0.top.equalTo(self.setMemberLabel.snp.bottom).offset(30) + self.addSubview(self.maxNumberOfMembersLabel) + self.maxNumberOfMembersLabel.snp.makeConstraints { + $0.top.equalTo(self.numberOfParticipantsTitleLabel.snp.bottom).offset(30) $0.leading.equalTo(self.memberSlider.snp.trailing).offset(5) $0.trailing.equalToSuperview().inset(24) } @@ -215,7 +215,7 @@ final class DetailEditView: UIView { self.addSubview(self.memberCountLabel) self.memberCountLabel.snp.makeConstraints { $0.centerX.equalToSuperview() - $0.centerY.equalTo(self.setMemberLabel.snp.centerY) + $0.centerY.equalTo(self.numberOfParticipantsTitleLabel.snp.centerY) } } From b2c09dbbdd6752ec566fe15cd4c73a36a9389d0d Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 29 May 2023 18:40:55 +0900 Subject: [PATCH 112/468] =?UTF-8?q?[CHORE]=20member=20->=20participant=20?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/View/DetailEditView.swift | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 06f5ab093..d99ad5474 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -71,21 +71,21 @@ final class DetailEditView: UIView { label.textColor = .white return label }() - private lazy var minimumNumberOfMembersLabel: UILabel = { + private lazy var minimumNumberOfParticipantsLabel: UILabel = { let label = UILabel() - label.text = "\(Int(self.memberSlider.minimumValue))인" + label.text = "\(Int(self.participantsSlider.minimumValue))인" label.font = .font(.regular, ofSize: 16) label.textColor = .white return label }() - private lazy var maxNumberOfMembersLabel: UILabel = { + private lazy var maxNumberOfParticipantsLabel: UILabel = { let label = UILabel() - label.text = "\(Int(self.memberSlider.maximumValue))인" + label.text = "\(Int(self.participantsSlider.maximumValue))인" label.font = .font(.regular, ofSize: 16) label.textColor = .white return label }() - private let memberSlider: UISlider = { + private let participantsSlider: UISlider = { let slider = UISlider() slider.minimumValue = 4 slider.maximumValue = 15 @@ -95,7 +95,7 @@ final class DetailEditView: UIView { slider.setThumbImage(ImageLiterals.imageSliderThumb, for: .normal) return slider }() - private let memberCountLabel: UILabel = { + private let numberOfParticipantsLabel: UILabel = { let label = UILabel() label.font = .font(.regular, ofSize: 24) label.textColor = .white @@ -109,7 +109,7 @@ final class DetailEditView: UIView { private var maximumMemberCount: Int? { willSet(count) { if let count { - self.memberCountLabel.text = count.description + TextLiteral.per + self.numberOfParticipantsLabel.text = count.description + TextLiteral.per } } } @@ -192,28 +192,28 @@ final class DetailEditView: UIView { $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) } - self.addSubview(self.minimumNumberOfMembersLabel) - self.minimumNumberOfMembersLabel.snp.makeConstraints { + self.addSubview(self.minimumNumberOfParticipantsLabel) + self.minimumNumberOfParticipantsLabel.snp.makeConstraints { $0.top.equalTo(self.numberOfParticipantsTitleLabel.snp.bottom).offset(30) $0.leading.equalToSuperview().inset(24) } - self.addSubview(self.memberSlider) - self.memberSlider.snp.makeConstraints { - $0.leading.equalTo(self.minimumNumberOfMembersLabel.snp.trailing).offset(5) + self.addSubview(self.participantsSlider) + self.participantsSlider.snp.makeConstraints { + $0.leading.equalTo(self.minimumNumberOfParticipantsLabel.snp.trailing).offset(5) $0.height.equalTo(45) - $0.centerY.equalTo(self.minimumNumberOfMembersLabel.snp.centerY) + $0.centerY.equalTo(self.minimumNumberOfParticipantsLabel.snp.centerY) } - self.addSubview(self.maxNumberOfMembersLabel) - self.maxNumberOfMembersLabel.snp.makeConstraints { + self.addSubview(self.maxNumberOfParticipantsLabel) + self.maxNumberOfParticipantsLabel.snp.makeConstraints { $0.top.equalTo(self.numberOfParticipantsTitleLabel.snp.bottom).offset(30) - $0.leading.equalTo(self.memberSlider.snp.trailing).offset(5) + $0.leading.equalTo(self.participantsSlider.snp.trailing).offset(5) $0.trailing.equalToSuperview().inset(24) } - self.addSubview(self.memberCountLabel) - self.memberCountLabel.snp.makeConstraints { + self.addSubview(self.numberOfParticipantsLabel) + self.numberOfParticipantsLabel.snp.makeConstraints { $0.centerX.equalToSuperview() $0.centerY.equalTo(self.numberOfParticipantsTitleLabel.snp.centerY) } @@ -238,7 +238,7 @@ final class DetailEditView: UIView { func setupSliderValue(_ value: Int) { self.maximumMemberCount = value - self.memberSlider.value = Float(value) + self.participantsSlider.value = Float(value) } private func setupCancleButton() { @@ -250,7 +250,7 @@ final class DetailEditView: UIView { private func setupChangeButton() { let action = UIAction { [weak self] _ in - guard let capacity = self?.memberSlider.value, + guard let capacity = self?.participantsSlider.value, let startDateString = self?.calendarView.getTempStartDate(), let endDateString = self?.calendarView.getTempEndDate() else { return } self?.delegate?.changeButtonDidTap(capacity: Int(capacity), @@ -271,7 +271,7 @@ final class DetailEditView: UIView { guard let sender = action.sender as? UISlider else { return } self?.changeMemberSliderValue(sender: sender) } - self.memberSlider.addAction(valueChangeAction, for: .valueChanged) + self.participantsSlider.addAction(valueChangeAction, for: .valueChanged) } private func changeMemberSliderValue(sender: UISlider) { From 3fc78007673bb823e674279719f8a641d6407b1c Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 29 May 2023 18:55:07 +0900 Subject: [PATCH 113/468] =?UTF-8?q?[CHORE]=20editmode=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailEditViewController.swift | 6 ++- .../Detail-Wait/View/DetailEditView.swift | 52 +++++++++---------- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index 6eff29c37..ef3d249ff 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -17,6 +17,7 @@ final class DetailEditViewController: BaseViewController { // MARK: - property + private let editMode: DetailEditView.EditMode private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) var didTappedChangeButton: (() -> ())? private let room: Room @@ -25,6 +26,7 @@ final class DetailEditViewController: BaseViewController { init(editMode: DetailEditView.EditMode, room: Room) { self.detailEditView = DetailEditView(editMode: editMode) + self.editMode = editMode self.room = room super.init() } @@ -48,7 +50,9 @@ final class DetailEditViewController: BaseViewController { super.viewDidLoad() self.configureDelegation() self.setupCalendarDateRange() - self.setupMemberSliderValue() + if self.editMode == .information { + self.setupMemberSliderValue() + } } // MARK: - override diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index d99ad5474..b9ea3140a 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -64,7 +64,7 @@ final class DetailEditView: UIView { label.font = .font(.regular, ofSize: 14) return label }() - private let numberOfParticipantsTitleLabel: UILabel = { + private lazy var numberOfParticipantsTitleLabel: UILabel = { let label = UILabel() label.text = TextLiteral.detailEditViewControllerSetMember label.font = .font(.regular, ofSize: 18) @@ -85,7 +85,7 @@ final class DetailEditView: UIView { label.textColor = .white return label }() - private let participantsSlider: UISlider = { + private lazy var participantsSlider: UISlider = { let slider = UISlider() slider.minimumValue = 4 slider.maximumValue = 15 @@ -95,7 +95,7 @@ final class DetailEditView: UIView { slider.setThumbImage(ImageLiterals.imageSliderThumb, for: .normal) return slider }() - private let numberOfParticipantsLabel: UILabel = { + private lazy var numberOfParticipantsLabel: UILabel = { let label = UILabel() label.font = .font(.regular, ofSize: 24) label.textColor = .white @@ -122,7 +122,6 @@ final class DetailEditView: UIView { self.setupLayout() self.setupCancleButton() self.setupChangeButton() - self.setupMemberSlider() } @available(*, unavailable) @@ -182,6 +181,7 @@ final class DetailEditView: UIView { if self.editMode == .information { self.setupEditMembersLayout() + self.setupMemberSlider() } } @@ -219,28 +219,6 @@ final class DetailEditView: UIView { } } - func configureDelegation(_ delegate: DetailEditDelegate) { - self.delegate = delegate - } - - func setupDateRange(from startDateString: String, to endDateString: String) { - guard let startDate = startDateString.stringToDate else { return } - if startDate.isPast { - let fiveDaysInterval: TimeInterval = 86400 * 4 - self.calendarView.startDateText = Date().dateToString - self.calendarView.endDateText = (Date() + fiveDaysInterval).dateToString - } else { - self.calendarView.startDateText = startDateString - self.calendarView.endDateText = endDateString - } - self.calendarView.setupDateRange() - } - - func setupSliderValue(_ value: Int) { - self.maximumMemberCount = value - self.participantsSlider.value = Float(value) - } - private func setupCancleButton() { let action = UIAction { [weak self] _ in self?.delegate?.cancleButtonDidTap() @@ -277,4 +255,26 @@ final class DetailEditView: UIView { private func changeMemberSliderValue(sender: UISlider) { self.maximumMemberCount = Int(sender.value) } + + func setupSliderValue(_ value: Int) { + self.maximumMemberCount = value + self.participantsSlider.value = Float(value) + } + + func setupDateRange(from startDateString: String, to endDateString: String) { + guard let startDate = startDateString.stringToDate else { return } + if startDate.isPast { + let fiveDaysInterval: TimeInterval = 86400 * 4 + self.calendarView.startDateText = Date().dateToString + self.calendarView.endDateText = (Date() + fiveDaysInterval).dateToString + } else { + self.calendarView.startDateText = startDateString + self.calendarView.endDateText = endDateString + } + self.calendarView.setupDateRange() + } + + func configureDelegation(_ delegate: DetailEditDelegate) { + self.delegate = delegate + } } From 270937a04c2b553b4b541d0849dd89220ba12932 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 29 May 2023 19:04:26 +0900 Subject: [PATCH 114/468] =?UTF-8?q?[CHORE]=20self=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index b9ea3140a..9e7662f9a 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -173,7 +173,7 @@ final class DetailEditView: UIView { $0.height.equalTo(400) } - self.addSubview(helpLabel) + self.addSubview(self.helpLabel) self.helpLabel.snp.makeConstraints { $0.top.equalTo(self.calendarView.snp.bottom).offset(8) $0.trailing.equalToSuperview().inset(25) From 5d194b52eb113c9ca281631c0d7ff505be7a9f8e Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 29 May 2023 19:37:20 +0900 Subject: [PATCH 115/468] =?UTF-8?q?[CHORE]=20calendar=20delegate=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailEditViewController.swift | 7 +++++++ .../Detail-Wait/UIComponent/CalendarView.swift | 11 +++++++++++ .../Detail-Wait/View/DetailEditView.swift | 17 +++++++++++------ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index ef3d249ff..a57170b3f 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -67,6 +67,7 @@ final class DetailEditViewController: BaseViewController { private func configureDelegation() { self.detailEditView.configureDelegation(self) + self.detailEditView.configureCalendarDelegate(self) } private func setupCalendarDateRange() { @@ -158,3 +159,9 @@ extension DetailEditViewController: DetailEditDelegate { } } } + +extension DetailEditViewController: CalendarDelegate { + func detectChangeButton(_ value: Bool) { + self.detailEditView.setupChangeButton(value) + } +} diff --git a/Manito/Manito/Screens/Detail-Wait/UIComponent/CalendarView.swift b/Manito/Manito/Screens/Detail-Wait/UIComponent/CalendarView.swift index d2c0f60da..ead6c1c03 100644 --- a/Manito/Manito/Screens/Detail-Wait/UIComponent/CalendarView.swift +++ b/Manito/Manito/Screens/Detail-Wait/UIComponent/CalendarView.swift @@ -10,6 +10,10 @@ import UIKit import FSCalendar import SnapKit +protocol CalendarDelegate: AnyObject { + func detectChangeButton(_ value: Bool) +} + final class CalendarView: UIView { private enum CalendarMoveType { @@ -69,6 +73,7 @@ final class CalendarView: UIView { private var tempStartDateText: String = "" private var tempEndDateText: String = "" var isFirstTap: Bool = false + private weak var delegate: CalendarDelegate? // MARK: - init @@ -119,8 +124,14 @@ final class CalendarView: UIView { self.nextButton.addAction(action, for: .touchUpInside) } + func configureCalendarDelegate(_ delegate: CalendarDelegate) { + self.delegate = delegate + } + func setupButtonState() { let hasDate = self.tempStartDateText != "" && self.tempEndDateText != "" + self.delegate?.detectChangeButton(hasDate) + // FIXME: - delegate로 통일 후 삭제해야함 self.changeButtonState?(hasDate) } diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 9e7662f9a..92b728744 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -105,6 +105,7 @@ final class DetailEditView: UIView { // MARK: - property private weak var delegate: DetailEditDelegate? + private weak var calendarDelegate: CalendarDelegate? private let editMode: EditMode private var maximumMemberCount: Int? { willSet(count) { @@ -236,12 +237,12 @@ final class DetailEditView: UIView { to: endDateString) } self.changeButton.addAction(action, for: .touchUpInside) - - self.calendarView.changeButtonState = { [weak self] value in - self?.changeButton.isEnabled = value - self?.changeButton.setTitleColor(.subBlue, for: .normal) - self?.changeButton.setTitleColor(.grey002, for: .disabled) - } + } + + func setupChangeButton(_ value: Bool) { + self.changeButton.isEnabled = value + self.changeButton.setTitleColor(.subBlue, for: .normal) + self.changeButton.setTitleColor(.grey002, for: .disabled) } private func setupMemberSlider() { @@ -277,4 +278,8 @@ final class DetailEditView: UIView { func configureDelegation(_ delegate: DetailEditDelegate) { self.delegate = delegate } + + func configureCalendarDelegate(_ delegate: CalendarDelegate) { + self.calendarView.configureCalendarDelegate(delegate) + } } From d7ef7fdb771803535e0a9642a7705a4c413f7da5 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 29 May 2023 20:12:00 +0900 Subject: [PATCH 116/468] =?UTF-8?q?[CHORE]=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?=ED=9B=84=20=EB=B0=A9=EC=A0=95=EB=B3=B4=20load=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20delegate=EB=A1=9C=20=EB=B6=84=EB=A6=AC=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailEditViewController.swift | 4 ++-- .../DetailWaitViewController.swift | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index a57170b3f..a40686732 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -19,8 +19,8 @@ final class DetailEditViewController: BaseViewController { private let editMode: DetailEditView.EditMode private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) - var didTappedChangeButton: (() -> ())? private let room: Room + weak var detailWaitDelegate: DetailWaitViewControllerDelegate? // MARK: - init @@ -145,7 +145,7 @@ extension DetailEditViewController: DetailEditDelegate { self.putRoomInfo(roomDto: dto) { [weak self] result in switch result { case .success: - self?.didTappedChangeButton?() + self?.detailWaitDelegate?.didTappedChangeButton() self?.cancleButtonDidTap() case .failure: self?.makeAlert(title: TextLiteral.detailEditViewControllerChangeErrorTitle, diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 72dbcdcd3..f88af88d6 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -9,6 +9,10 @@ import UIKit import SnapKit +protocol DetailWaitViewControllerDelegate: AnyObject { + func didTappedChangeButton() +} + final class DetailWaitViewController: BaseViewController { // MARK: - ui component @@ -20,6 +24,7 @@ final class DetailWaitViewController: BaseViewController { private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) private let roomIndex: Int private var roomInformation: Room? + private weak var delegate: DetailWaitViewControllerDelegate? // MARK: - init @@ -60,11 +65,7 @@ final class DetailWaitViewController: BaseViewController { guard let room = self.roomInformation else { return } let viewController = DetailEditViewController(editMode: isOnlyDateEdit ? .date : .information, room: room) - viewController.didTappedChangeButton = { [weak self] in - self?.fetchRoomData() - ToastView.showToast(message: "방 정보 수정 완료", - controller: self ?? UIViewController()) - } + viewController.detailWaitDelegate = self self.present(viewController, animated: true) } @@ -238,3 +239,11 @@ extension DetailWaitViewController: DetailWaitViewDelegate { } } } + +extension DetailWaitViewController: DetailWaitViewControllerDelegate { + func didTappedChangeButton() { + self.fetchRoomData() + ToastView.showToast(message: "방 정보 수정 완료", + controller: self) + } +} From c5003864307abe71971b8084930723d9ad9763f4 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 30 May 2023 17:31:45 +0900 Subject: [PATCH 117/468] =?UTF-8?q?[CHORE]=20DetailWaitViewModel=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 12 +++++++++ .../DetailWaitViewController.swift | 20 +++++++++++++++ .../ViewModel/DetailWaitViewModel.swift | 25 +++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index e5e2e5db2..78d83d299 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 391B3003286198C200421F1D /* Size.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391B3002286198C200421F1D /* Size.swift */; }; 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392EC77D2855C388006918A9 /* SettingButton.swift */; }; 392EC7812855D17D006918A9 /* DetailWaitTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392EC7802855D17D006918A9 /* DetailWaitTitleView.swift */; }; + 395B5BC22A25E20000CE1420 /* DetailWaitViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */; }; 397A241028BA494100454E4F /* APIEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957F0287D984900A04A2B /* APIEnvironment.swift */; }; 397A241428BA516B00454E4F /* DetailWaitAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241328BA516B00454E4F /* DetailWaitAPI.swift */; }; 397A241828BA51B400454E4F /* DetailWaitProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */; }; @@ -179,6 +180,7 @@ 391B3002286198C200421F1D /* Size.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Size.swift; sourceTree = ""; }; 392EC77D2855C388006918A9 /* SettingButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingButton.swift; sourceTree = ""; }; 392EC7802855D17D006918A9 /* DetailWaitTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitTitleView.swift; sourceTree = ""; }; + 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitViewModel.swift; sourceTree = ""; }; 397A241328BA516B00454E4F /* DetailWaitAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitAPI.swift; sourceTree = ""; }; 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitProtocol.swift; sourceTree = ""; }; 397A241928BA532A00454E4F /* FriendList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendList.swift; sourceTree = ""; }; @@ -374,6 +376,14 @@ path = UIComponent; sourceTree = ""; }; + 395B5BC02A25E1F400CE1420 /* ViewModel */ = { + isa = PBXGroup; + children = ( + 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */, + ); + path = ViewModel; + sourceTree = ""; + }; 397A241128BA513E00454E4F /* API */ = { isa = PBXGroup; children = ( @@ -663,6 +673,7 @@ B5F524E828519B2F00614FF7 /* Detail-Wait */ = { isa = PBXGroup; children = ( + 395B5BC02A25E1F400CE1420 /* ViewModel */, 391612D629E92308004AE982 /* View */, 392EC77F2855D107006918A9 /* UIComponent */, B5F525092851A06700614FF7 /* DetailWaitViewController.swift */, @@ -1192,6 +1203,7 @@ CB9592B52855D52700847751 /* CommonMissionView.swift in Sources */, CBA4D7A42856CE9F0018BDC2 /* CreateRoomCollectionViewCell.swift in Sources */, 39C95802287DACC300A04A2B /* RoomEndPoint.swift in Sources */, + 395B5BC22A25E20000CE1420 /* DetailWaitViewModel.swift in Sources */, CB4C77E628C0D4EB007A1AD2 /* MainAPI.swift in Sources */, B5F524FD28519EEC00614FF7 /* UIColor+Extension.swift in Sources */, B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */, diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index dbc5da6f0..7f87e6166 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -5,6 +5,7 @@ // Created by Mingwan Choi on 2023/04/15. // +import Combine import UIKit import SnapKit @@ -17,6 +18,8 @@ final class DetailWaitViewController: BaseViewController { // MARK: - property + private var cancleable = Set() + private let viewModel = DetailWaitViewModel() private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) private let roomIndex: Int private var roomInformation: Room? @@ -48,10 +51,26 @@ final class DetailWaitViewController: BaseViewController { self.fetchRoomData() self.configureDelegation() self.configureNavigationController() + self.bind() } // MARK: - func + private func bind() { + self.viewModel.roomInformationSubject + .sink(receiveCompletion: { result in + switch result { + case .finished: + print("finish") + case .failure: + print("error") + } + }, receiveValue: { room in + dump(room) + }) + .store(in: &self.cancleable) + } + private func configureDelegation() { self.detailWaitView.configureDelegation(self) } @@ -111,6 +130,7 @@ final class DetailWaitViewController: BaseViewController { // MARK: - network private func requestWaitRoomInfo(completionHandler: @escaping ((Result) -> Void)) { + self.viewModel.fetchRoomInformation(roomIndex: self.roomIndex) Task { do { let data = try await self.detailWaitService.getWaitingRoomInfo(roomId: self.roomIndex.description) diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift new file mode 100644 index 000000000..da7671b46 --- /dev/null +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -0,0 +1,25 @@ +// +// DetailWaitViewModel.swift +// Manito +// +// Created by Mingwan Choi on 2023/05/30. +// + +import Combine +import Foundation + +final class DetailWaitViewModel { + + private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) + + let roomInformationSubject = PassthroughSubject() + + func fetchRoomInformation(roomIndex: Int) { + Task { + let data = try await detailWaitService.getWaitingRoomInfo(roomId: roomIndex.description) + if let roomInformation = data { + self.roomInformationSubject.send(roomInformation) + } + } + } +} From a818cfc8e640fd137b1e219225f6bf798cfc6858 Mon Sep 17 00:00:00 2001 From: chemi Date: Wed, 31 May 2023 17:11:31 +0900 Subject: [PATCH 118/468] =?UTF-8?q?[CHORE]=20input=20output=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 7 +++++-- .../ViewModel/DetailWaitViewModel.swift | 21 +++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 7f87e6166..66b838bd9 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -19,7 +19,7 @@ final class DetailWaitViewController: BaseViewController { // MARK: - property private var cancleable = Set() - private let viewModel = DetailWaitViewModel() + private lazy var viewModel = DetailWaitViewModel(roomIndex: self.roomIndex, detailWaitService: DetailWaitAPI(apiService: APIService())) private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) private let roomIndex: Int private var roomInformation: Room? @@ -69,6 +69,10 @@ final class DetailWaitViewController: BaseViewController { dump(room) }) .store(in: &self.cancleable) + + + let detailWaitInput = DetailWaitViewModel.Input( + viewDidLoad: Just(Void()).eraseToAnyPublisher()) } private func configureDelegation() { @@ -130,7 +134,6 @@ final class DetailWaitViewController: BaseViewController { // MARK: - network private func requestWaitRoomInfo(completionHandler: @escaping ((Result) -> Void)) { - self.viewModel.fetchRoomInformation(roomIndex: self.roomIndex) Task { do { let data = try await self.detailWaitService.getWaitingRoomInfo(roomId: self.roomIndex.description) diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index da7671b46..e82843cbd 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -6,17 +6,30 @@ // import Combine -import Foundation final class DetailWaitViewModel { - private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) + private let roomIndex: Int + private let detailWaitService: DetailWaitAPI + struct Input { + let viewDidLoad: AnyPublisher + } + + struct Output { + let roomInformationDidUpdate: AnyPublisher + } + let roomInformationSubject = PassthroughSubject() - func fetchRoomInformation(roomIndex: Int) { + init(roomIndex: Int, detailWaitService: DetailWaitAPI) { + self.roomIndex = roomIndex + self.detailWaitService = detailWaitService + } + + func fetchRoomInformation() { Task { - let data = try await detailWaitService.getWaitingRoomInfo(roomId: roomIndex.description) + let data = try await detailWaitService.getWaitingRoomInfo(roomId: self.roomIndex.description) if let roomInformation = data { self.roomInformationSubject.send(roomInformation) } From d6321365615ec09bcfc2ed17da1a53d468a16608 Mon Sep 17 00:00:00 2001 From: chemi Date: Wed, 31 May 2023 17:44:46 +0900 Subject: [PATCH 119/468] =?UTF-8?q?[FEAT]=20=EB=B0=A9=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=20MVVM=20=EC=97=B0=EA=B2=B0=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 66 +++++++++---------- .../ViewModel/DetailWaitViewModel.swift | 14 ++-- 2 files changed, 38 insertions(+), 42 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 66b838bd9..15c1aca4b 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -48,10 +48,10 @@ final class DetailWaitViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() - self.fetchRoomData() self.configureDelegation() self.configureNavigationController() self.bind() + self.viewModel.fetchRoomInformation() } // MARK: - func @@ -66,13 +66,11 @@ final class DetailWaitViewController: BaseViewController { print("error") } }, receiveValue: { room in - dump(room) + DispatchQueue.main.async { + self.detailWaitView.updateDetailWaitView(room: room) + } }) .store(in: &self.cancleable) - - - let detailWaitInput = DetailWaitViewModel.Input( - viewDidLoad: Just(Void()).eraseToAnyPublisher()) } private func configureDelegation() { @@ -117,37 +115,37 @@ final class DetailWaitViewController: BaseViewController { self.detailWaitView.configureNavigationItem(navigationController) } - private func fetchRoomData() { - self.requestWaitRoomInfo() { [weak self] result in - switch result { - case .success(let room): - DispatchQueue.main.async { - self?.detailWaitView.updateDetailWaitView(room: room) - } - case .failure: - self?.makeAlert(title: TextLiteral.errorAlertTitle, - message: TextLiteral.detailWaitViewControllerLoadDataMessage) - } - } - } +// private func fetchRoomData() { +// self.requestWaitRoomInfo() { [weak self] result in +// switch result { +// case .success(let room): +// DispatchQueue.main.async { +// self?.detailWaitView.updateDetailWaitView(room: room) +// } +// case .failure: +// self?.makeAlert(title: TextLiteral.errorAlertTitle, +// message: TextLiteral.detailWaitViewControllerLoadDataMessage) +// } +// } +// } // MARK: - network - private func requestWaitRoomInfo(completionHandler: @escaping ((Result) -> Void)) { - Task { - do { - let data = try await self.detailWaitService.getWaitingRoomInfo(roomId: self.roomIndex.description) - if let roomInfo = data { - self.roomInformation = roomInfo - completionHandler(.success(roomInfo)) - } - } catch NetworkError.serverError { - completionHandler(.failure(.serverError)) - } catch NetworkError.clientError(let message) { - completionHandler(.failure(.clientError(message: message))) - } - } - } +// private func requestWaitRoomInfo(completionHandler: @escaping ((Result) -> Void)) { +// Task { +// do { +// let data = try await self.detailWaitService.getWaitingRoomInfo(roomId: self.roomIndex.description) +// if let roomInfo = data { +// self.roomInformation = roomInfo +// completionHandler(.success(roomInfo)) +// } +// } catch NetworkError.serverError { +// completionHandler(.failure(.serverError)) +// } catch NetworkError.clientError(let message) { +// completionHandler(.failure(.clientError(message: message))) +// } +// } +// } private func requestStartManitto(completionHandler: @escaping ((Result) -> Void)) { Task { diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index e82843cbd..77c32d45d 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -9,24 +9,22 @@ import Combine final class DetailWaitViewModel { + // MARK: - property + private let roomIndex: Int private let detailWaitService: DetailWaitAPI - struct Input { - let viewDidLoad: AnyPublisher - } - - struct Output { - let roomInformationDidUpdate: AnyPublisher - } - let roomInformationSubject = PassthroughSubject() + // MARK: - init + init(roomIndex: Int, detailWaitService: DetailWaitAPI) { self.roomIndex = roomIndex self.detailWaitService = detailWaitService } + // MARK: - func + func fetchRoomInformation() { Task { let data = try await detailWaitService.getWaitingRoomInfo(roomId: self.roomIndex.description) From a345c16f9d0f35710d1b5f2ed18fad4af94b21fe Mon Sep 17 00:00:00 2001 From: chemi Date: Wed, 31 May 2023 18:12:55 +0900 Subject: [PATCH 120/468] =?UTF-8?q?[CHORE]=20@Published=EB=A1=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 42 +++---------------- .../Detail-Wait/View/DetailWaitView.swift | 3 +- .../ViewModel/DetailWaitViewModel.swift | 5 +-- 3 files changed, 10 insertions(+), 40 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 15c1aca4b..8b97166ff 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -57,7 +57,7 @@ final class DetailWaitViewController: BaseViewController { // MARK: - func private func bind() { - self.viewModel.roomInformationSubject + self.viewModel.$roomInformation .sink(receiveCompletion: { result in switch result { case .finished: @@ -66,8 +66,10 @@ final class DetailWaitViewController: BaseViewController { print("error") } }, receiveValue: { room in - DispatchQueue.main.async { - self.detailWaitView.updateDetailWaitView(room: room) + if let room { + DispatchQueue.main.async { + self.detailWaitView.updateDetailWaitView(room: room) + } } }) .store(in: &self.cancleable) @@ -115,38 +117,6 @@ final class DetailWaitViewController: BaseViewController { self.detailWaitView.configureNavigationItem(navigationController) } -// private func fetchRoomData() { -// self.requestWaitRoomInfo() { [weak self] result in -// switch result { -// case .success(let room): -// DispatchQueue.main.async { -// self?.detailWaitView.updateDetailWaitView(room: room) -// } -// case .failure: -// self?.makeAlert(title: TextLiteral.errorAlertTitle, -// message: TextLiteral.detailWaitViewControllerLoadDataMessage) -// } -// } -// } - - // MARK: - network - -// private func requestWaitRoomInfo(completionHandler: @escaping ((Result) -> Void)) { -// Task { -// do { -// let data = try await self.detailWaitService.getWaitingRoomInfo(roomId: self.roomIndex.description) -// if let roomInfo = data { -// self.roomInformation = roomInfo -// completionHandler(.success(roomInfo)) -// } -// } catch NetworkError.serverError { -// completionHandler(.failure(.serverError)) -// } catch NetworkError.clientError(let message) { -// completionHandler(.failure(.clientError(message: message))) -// } -// } -// } - private func requestStartManitto(completionHandler: @escaping ((Result) -> Void)) { Task { do { @@ -248,7 +218,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { } func codeCopyButtonDidTap() { - guard let invitationCode = self.roomInformation?.invitation?.code else { return } + guard let invitationCode = self.viewModel.roomInformation?.invitation?.code else { return } ToastView.showToast(code: invitationCode, message: TextLiteral.detailWaitViewControllerCopyCode, controller: self) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index fe1bd7154..6ac1fef6a 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -115,6 +115,7 @@ final class DetailWaitView: UIView { override init(frame: CGRect) { super.init(frame: frame) self.setupLayout() + self.setupCopyButton() } @available(*, unavailable) @@ -173,7 +174,7 @@ final class DetailWaitView: UIView { } } - private func setupCopyButton(_ invitationCode: String) { + private func setupCopyButton() { let action = UIAction { [weak self] _ in self?.delegate?.codeCopyButtonDidTap() } diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 77c32d45d..8848b7c30 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -13,8 +13,7 @@ final class DetailWaitViewModel { private let roomIndex: Int private let detailWaitService: DetailWaitAPI - - let roomInformationSubject = PassthroughSubject() + @Published var roomInformation: Room? // MARK: - init @@ -29,7 +28,7 @@ final class DetailWaitViewModel { Task { let data = try await detailWaitService.getWaitingRoomInfo(roomId: self.roomIndex.description) if let roomInformation = data { - self.roomInformationSubject.send(roomInformation) + self.roomInformation = roomInformation } } } From ebfff64d2a0646a9895aafcf61660de76af69e8a Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 6 Jun 2023 11:47:39 +0900 Subject: [PATCH 121/468] =?UTF-8?q?[CHORE]=20=EC=95=88=EC=93=B0=EB=8A=94?= =?UTF-8?q?=20delegate=20=EB=B3=80=EC=88=98=20=EC=82=AD=EC=A0=9C=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index f88af88d6..ca2d38644 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -24,7 +24,6 @@ final class DetailWaitViewController: BaseViewController { private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) private let roomIndex: Int private var roomInformation: Room? - private weak var delegate: DetailWaitViewControllerDelegate? // MARK: - init From fb9e6d4510a69a81a7a4ae4ef2bbb0d5fa82dd98 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 6 Jun 2023 11:49:11 +0900 Subject: [PATCH 122/468] =?UTF-8?q?[CHORE]=20=EC=98=A4=ED=83=80=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/DetailEditViewController.swift | 4 ++-- Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index a40686732..b9ed537cc 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -130,7 +130,7 @@ extension DetailEditViewController: UIAdaptivePresentationControllerDelegate { } extension DetailEditViewController: DetailEditDelegate { - func cancleButtonDidTap() { + func cancelButtonDidTap() { self.dismiss(animated: true) } @@ -146,7 +146,7 @@ extension DetailEditViewController: DetailEditDelegate { switch result { case .success: self?.detailWaitDelegate?.didTappedChangeButton() - self?.cancleButtonDidTap() + self?.cancelButtonDidTap() case .failure: self?.makeAlert(title: TextLiteral.detailEditViewControllerChangeErrorTitle, message: TextLiteral.detailEditViewControllerChangeErrorMessage diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 92b728744..5aaafbe76 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -10,7 +10,7 @@ import UIKit import SnapKit protocol DetailEditDelegate: AnyObject { - func cancleButtonDidTap() + func cancelButtonDidTap() func changeButtonDidTap(capacity: Int, from startDate: String, to endDate: String) } @@ -222,7 +222,7 @@ final class DetailEditView: UIView { private func setupCancleButton() { let action = UIAction { [weak self] _ in - self?.delegate?.cancleButtonDidTap() + self?.delegate?.cancelButtonDidTap() } self.cancelButton.addAction(action, for: .touchUpInside) } From 612b84df17a541044eb3677eda800428e70348dc Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 6 Jun 2023 22:47:39 +0900 Subject: [PATCH 123/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift b/Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift index f20faef88..5b2248a08 100644 --- a/Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift +++ b/Manito/Manito/Screens/Setting/Cell/SettingViewTableCell.swift @@ -16,7 +16,6 @@ final class SettingViewTableCell: UITableViewCell { private let titleLabel: UILabel = { let label = UILabel() label.font = .font(.regular, ofSize: 15) - label.text = "SSSSS" return label }() From c6895d25ff509dacbfe26dc89a124428c072d925 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 6 Jun 2023 22:49:06 +0900 Subject: [PATCH 124/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ontroller+MailComposeViewControllerDelegate.swift | 12 ++++++------ .../Screens/Setting/SettingViewController.swift | 2 -- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Manito/Manito/Screens/Setting/SettingViewController+MailComposeViewControllerDelegate.swift b/Manito/Manito/Screens/Setting/SettingViewController+MailComposeViewControllerDelegate.swift index 7066d051e..f6ebf3169 100644 --- a/Manito/Manito/Screens/Setting/SettingViewController+MailComposeViewControllerDelegate.swift +++ b/Manito/Manito/Screens/Setting/SettingViewController+MailComposeViewControllerDelegate.swift @@ -11,7 +11,7 @@ import MessageUI extension SettingViewController: MFMailComposeViewControllerDelegate { func sendReportMail() { if MFMailComposeViewController.canSendMail() { - let composeVC = MFMailComposeViewController() + let composeViewController = MFMailComposeViewController() let aenittoEmail = "aenitto@gmail.com" let messageBody = """ @@ -27,12 +27,12 @@ extension SettingViewController: MFMailComposeViewControllerDelegate { """ - composeVC.mailComposeDelegate = self - composeVC.setToRecipients([aenittoEmail]) - composeVC.setSubject("[문의 사항]") - composeVC.setMessageBody(messageBody, isHTML: false) + composeViewController.mailComposeDelegate = self + composeViewController.setToRecipients([aenittoEmail]) + composeViewController.setSubject("[문의 사항]") + composeViewController.setMessageBody(messageBody, isHTML: false) - self.present(composeVC, animated: true, completion: nil) + self.present(composeViewController, animated: true, completion: nil) } else { self.showSendMailErrorAlert() diff --git a/Manito/Manito/Screens/Setting/SettingViewController.swift b/Manito/Manito/Screens/Setting/SettingViewController.swift index 3e6ad73f0..55059478c 100644 --- a/Manito/Manito/Screens/Setting/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/SettingViewController.swift @@ -85,5 +85,3 @@ extension SettingViewController: SettingViewDelegate { }) } } - - From 5b40ee353b586845da6945142de5bf1d50c31547 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 6 Jun 2023 23:26:46 +0900 Subject: [PATCH 125/468] =?UTF-8?q?[CHORE]=20DetailWaitViewModelTest=20cla?= =?UTF-8?q?ss=20=EC=83=9D=EC=84=B1(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++++ .../ManitoTests/DetailWaitViewModelTest.swift | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 Manito/ManitoTests/DetailWaitViewModelTest.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index b0dd6ec64..6b579d287 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392EC77D2855C388006918A9 /* SettingButton.swift */; }; 392EC7812855D17D006918A9 /* DetailWaitTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392EC7802855D17D006918A9 /* DetailWaitTitleView.swift */; }; 395B5BC22A25E20000CE1420 /* DetailWaitViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */; }; + 395B5BCC2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */; }; 397A241028BA494100454E4F /* APIEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957F0287D984900A04A2B /* APIEnvironment.swift */; }; 397A241428BA516B00454E4F /* DetailWaitAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241328BA516B00454E4F /* DetailWaitAPI.swift */; }; 397A241828BA51B400454E4F /* DetailWaitProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */; }; @@ -194,6 +195,7 @@ 392EC77D2855C388006918A9 /* SettingButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingButton.swift; sourceTree = ""; }; 392EC7802855D17D006918A9 /* DetailWaitTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitTitleView.swift; sourceTree = ""; }; 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitViewModel.swift; sourceTree = ""; }; + 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitViewModelTest.swift; sourceTree = ""; }; 397A241328BA516B00454E4F /* DetailWaitAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitAPI.swift; sourceTree = ""; }; 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitProtocol.swift; sourceTree = ""; }; 397A241928BA532A00454E4F /* FriendList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendList.swift; sourceTree = ""; }; @@ -444,6 +446,7 @@ isa = PBXGroup; children = ( 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */, + 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */, ); path = ManitoTests; sourceTree = ""; @@ -1176,6 +1179,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 395B5BCC2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift in Sources */, 398B1CBC2A12415C00DEFCEC /* ManitoTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift new file mode 100644 index 000000000..830628b32 --- /dev/null +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -0,0 +1,19 @@ +// +// DetailWaitViewModelTest.swift +// ManitoTests +// +// Created by Mingwan Choi on 2023/06/06. +// + +import XCTest +@testable import Manito + + +final class DetailWaitViewModelTest: XCTestCase { + + private let viewModel = DetailWaitViewModel(roomIndex: 1, detailWaitService: DetailWaitAPI(apiService: APIService())) + + func testExistFetchRoomInformation() { + let _ = viewModel.fetchRoomInformation() + } +} From 499de90659830962e505786944e4748f9d56d479 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 6 Jun 2023 23:27:07 +0900 Subject: [PATCH 126/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Setting/View/SettingView.swift | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/Manito/Manito/Screens/Setting/View/SettingView.swift b/Manito/Manito/Screens/Setting/View/SettingView.swift index d70a9da35..72e5748db 100644 --- a/Manito/Manito/Screens/Setting/View/SettingView.swift +++ b/Manito/Manito/Screens/Setting/View/SettingView.swift @@ -79,39 +79,27 @@ final class SettingView: UIView { func configureModels() { self.options.append(Option(title: TextLiteral.settingViewControllerChangeNickNameTitle, handler: { [weak self] in - DispatchQueue.main.async { - self?.delegate?.changNicknameButtonDidTap() - } + self?.delegate?.changNicknameButtonDidTap() })) self.options.append(Option(title: TextLiteral.settingViewControllerPersonalInfomationTitle, handler: { [weak self] in - DispatchQueue.main.async { - self?.delegate?.personalInfomationButtonDidTap() - } + self?.delegate?.personalInfomationButtonDidTap() })) self.options.append(Option(title: TextLiteral.settingViewControllerTermsOfServiceTitle, handler: { [weak self] in - DispatchQueue.main.async { - self?.delegate?.termsOfServiceButtonDidTap() - } + self?.delegate?.termsOfServiceButtonDidTap() })) self.options.append(Option(title: TextLiteral.settingViewControllerDeveloperInfoTitle, handler: { [weak self] in - DispatchQueue.main.async { - self?.delegate?.developerInfoButtonDidTap() - } + self?.delegate?.developerInfoButtonDidTap() })) self.options.append(Option(title: TextLiteral.settingViewControllerHelpTitle, handler: { [weak self] in - DispatchQueue.main.async { - self?.delegate?.helpButtonDidTap() - } + self?.delegate?.helpButtonDidTap() })) self.options.append(Option(title: TextLiteral.settingViewControllerLogoutTitle, handler: { [weak self] in - DispatchQueue.main.async { - self?.delegate?.logoutButtonDidTap() - } + self?.delegate?.logoutButtonDidTap() })) } From fa46aac767e4492671df91102a04cf4909b98559 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 6 Jun 2023 23:27:15 +0900 Subject: [PATCH 127/468] =?UTF-8?q?[CHORE]=20=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=EC=8A=A4=EC=BC=80=EC=A4=84=EB=9F=AC=20=EC=A0=81=EC=9A=A9=20(#1?= =?UTF-8?q?85)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/DetailWaitViewController.swift | 5 ++--- .../Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 8b97166ff..81ae58d1d 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -58,6 +58,7 @@ final class DetailWaitViewController: BaseViewController { private func bind() { self.viewModel.$roomInformation + .receive(on: DispatchQueue.main) .sink(receiveCompletion: { result in switch result { case .finished: @@ -67,9 +68,7 @@ final class DetailWaitViewController: BaseViewController { } }, receiveValue: { room in if let room { - DispatchQueue.main.async { - self.detailWaitView.updateDetailWaitView(room: room) - } + self.detailWaitView.updateDetailWaitView(room: room) } }) .store(in: &self.cancleable) diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 8848b7c30..2d59aa4a8 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -14,6 +14,7 @@ final class DetailWaitViewModel { private let roomIndex: Int private let detailWaitService: DetailWaitAPI @Published var roomInformation: Room? +// var roomInfo = PassthroughSubject() // MARK: - init @@ -29,6 +30,7 @@ final class DetailWaitViewModel { let data = try await detailWaitService.getWaitingRoomInfo(roomId: self.roomIndex.description) if let roomInformation = data { self.roomInformation = roomInformation +// roomInfo.send(roomInformation) } } } From 6243c5ba0bf0e7398f9c1b18bccef66822b8ac4a Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 8 Jun 2023 22:18:19 +0900 Subject: [PATCH 128/468] =?UTF-8?q?[CHORE]=20=EB=84=A4=ED=8A=B8=EC=9B=8C?= =?UTF-8?q?=ED=81=AC=20=EC=BD=94=EB=93=9C=20ViewModel=EB=A1=9C=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 59 ++----------------- .../ViewModel/DetailWaitViewModel.swift | 51 +++++++++++++++- 2 files changed, 54 insertions(+), 56 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 81ae58d1d..b7919a6df 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -50,13 +50,13 @@ final class DetailWaitViewController: BaseViewController { super.viewDidLoad() self.configureDelegation() self.configureNavigationController() - self.bind() + self.setBind() self.viewModel.fetchRoomInformation() } // MARK: - func - private func bind() { + private func setBind() { self.viewModel.$roomInformation .receive(on: DispatchQueue.main) .sink(receiveCompletion: { result in @@ -115,60 +115,11 @@ final class DetailWaitViewController: BaseViewController { guard let navigationController = self.navigationController else { return } self.detailWaitView.configureNavigationItem(navigationController) } - - private func requestStartManitto(completionHandler: @escaping ((Result) -> Void)) { - Task { - do { - let data = try await self.detailWaitService.startManitto(roomId: self.roomIndex.description) - if let manittee = data { - guard let nickname = manittee.nickname else { return } - completionHandler(.success(nickname)) - } - } catch NetworkError.serverError { - completionHandler(.failure(.serverError)) - } catch NetworkError.clientError(let message) { - completionHandler(.failure(.clientError(message: message))) - } - } - } - - private func requestDeleteRoom(completionHandler: @escaping ((Result) -> Void)) { - Task { - do { - let statusCode = try await self.detailWaitService.deleteRoom(roomId: self.roomIndex.description) - switch statusCode { - case 200..<300: completionHandler(.success(())) - default: - completionHandler(.failure(.unknownError)) - } - } catch NetworkError.serverError { - completionHandler(.failure(.serverError)) - } catch NetworkError.clientError(let message) { - completionHandler(.failure(.clientError(message: message))) - } - } - } - - private func requestDeleteLeaveRoom(completionHandler: @escaping ((Result) -> Void)) { - Task { - do { - let statusCode = try await self.detailWaitService.deleteLeaveRoom(roomId: self.roomIndex.description) - switch statusCode { - case 200..<300: completionHandler(.success(())) - default: completionHandler(.failure(.unknownError)) - } - } catch NetworkError.serverError { - completionHandler(.failure(.serverError)) - } catch NetworkError.clientError(let message) { - completionHandler(.failure(.clientError(message: message))) - } - } - } } extension DetailWaitViewController: DetailWaitViewDelegate { func startButtonDidTap() { - self.requestStartManitto() { [weak self] result in + self.viewModel.requestStartManitto() { [weak self] result in switch result { case .success(let nickname): self?.presentSelectManittoViewController(nickname: nickname) @@ -188,7 +139,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { message: message, okTitle: okTitle, okAction: { [weak self] _ in - self?.requestDeleteRoom() { result in + self?.viewModel.requestDeleteRoom() { result in switch result { case .success: self?.navigationController?.popViewController(animated: true) @@ -204,7 +155,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { self.makeRequestAlert(title: title, message: message, okAction: { [weak self] _ in - self?.requestDeleteLeaveRoom() { result in + self?.viewModel.requestDeleteLeaveRoom() { result in switch result { case .success: self?.navigationController?.popViewController(animated: true) diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 2d59aa4a8..5f775f4f0 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -14,7 +14,6 @@ final class DetailWaitViewModel { private let roomIndex: Int private let detailWaitService: DetailWaitAPI @Published var roomInformation: Room? -// var roomInfo = PassthroughSubject() // MARK: - init @@ -30,7 +29,55 @@ final class DetailWaitViewModel { let data = try await detailWaitService.getWaitingRoomInfo(roomId: self.roomIndex.description) if let roomInformation = data { self.roomInformation = roomInformation -// roomInfo.send(roomInformation) + } + } + } + + func requestStartManitto(completionHandler: @escaping ((Result) -> Void)) { + Task { + do { + let data = try await self.detailWaitService.startManitto(roomId: self.roomIndex.description) + if let manittee = data { + guard let nickname = manittee.nickname else { return } + completionHandler(.success(nickname)) + } + } catch NetworkError.serverError { + completionHandler(.failure(.serverError)) + } catch NetworkError.clientError(let message) { + completionHandler(.failure(.clientError(message: message))) + } + } + } + + func requestDeleteRoom(completionHandler: @escaping ((Result) -> Void)) { + Task { + do { + let statusCode = try await self.detailWaitService.deleteRoom(roomId: self.roomIndex.description) + switch statusCode { + case 200..<300: completionHandler(.success(())) + default: + completionHandler(.failure(.unknownError)) + } + } catch NetworkError.serverError { + completionHandler(.failure(.serverError)) + } catch NetworkError.clientError(let message) { + completionHandler(.failure(.clientError(message: message))) + } + } + } + + func requestDeleteLeaveRoom(completionHandler: @escaping ((Result) -> Void)) { + Task { + do { + let statusCode = try await self.detailWaitService.deleteLeaveRoom(roomId: self.roomIndex.description) + switch statusCode { + case 200..<300: completionHandler(.success(())) + default: completionHandler(.failure(.unknownError)) + } + } catch NetworkError.serverError { + completionHandler(.failure(.serverError)) + } catch NetworkError.clientError(let message) { + completionHandler(.failure(.clientError(message: message))) } } } From 379ee2da75d074b2982ec2efc676a58fa538df65 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 8 Jun 2023 22:33:39 +0900 Subject: [PATCH 129/468] =?UTF-8?q?[CHORE]=20=EB=B0=A9=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=ED=86=B5=EC=8B=A0=20=EC=BD=94=EB=93=9C=20ViewModel?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=8F=99(185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModel/DetailWaitViewModel.swift | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 5f775f4f0..87e135f08 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -25,10 +25,29 @@ final class DetailWaitViewModel { // MARK: - func func fetchRoomInformation() { + requestWaitRoomInfo { [weak self] result in + switch result { + case .success(let roominformation): + self?.roomInformation = roominformation + case .failure(let error): + print(error) + } + } + } + + // MARK: - network + + private func requestWaitRoomInfo(completionHandler: @escaping ((Result) -> Void)) { Task { - let data = try await detailWaitService.getWaitingRoomInfo(roomId: self.roomIndex.description) - if let roomInformation = data { - self.roomInformation = roomInformation + do { + let data = try await self.detailWaitService.getWaitingRoomInfo(roomId: self.roomIndex.description) + if let roomInformation = data { + completionHandler(.success(roomInformation)) + } + } catch NetworkError.serverError { + completionHandler(.failure(.serverError)) + } catch NetworkError.clientError(let message) { + completionHandler(.failure(.clientError(message: message))) } } } From 037871a98e177f360de30a9c62fbe5825c02be38 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 8 Jun 2023 22:34:00 +0900 Subject: [PATCH 130/468] =?UTF-8?q?[CHORE]=20=EB=A9=94=EC=9D=B8=EC=8A=A4?= =?UTF-8?q?=EB=A0=88=EB=93=9C=20=EB=B3=B4=EC=9E=A5=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index b7919a6df..24bb0c246 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -120,12 +120,14 @@ final class DetailWaitViewController: BaseViewController { extension DetailWaitViewController: DetailWaitViewDelegate { func startButtonDidTap() { self.viewModel.requestStartManitto() { [weak self] result in - switch result { - case .success(let nickname): - self?.presentSelectManittoViewController(nickname: nickname) - case .failure: - self?.makeAlert(title: TextLiteral.errorAlertTitle, - message: TextLiteral.detailWaitViewControllerStartErrorMessage) + DispatchQueue.main.async { + switch result { + case .success(let nickname): + self?.presentSelectManittoViewController(nickname: nickname) + case .failure: + self?.makeAlert(title: TextLiteral.errorAlertTitle, + message: TextLiteral.detailWaitViewControllerStartErrorMessage) + } } } } @@ -140,12 +142,14 @@ extension DetailWaitViewController: DetailWaitViewDelegate { okTitle: okTitle, okAction: { [weak self] _ in self?.viewModel.requestDeleteRoom() { result in - switch result { - case .success: - self?.navigationController?.popViewController(animated: true) - case .failure: - self?.makeAlert(title: TextLiteral.errorAlertTitle, - message: TextLiteral.detailWaitViewControllerDeleteErrorMessage) + DispatchQueue.main.async { + switch result { + case .success: + self?.navigationController?.popViewController(animated: true) + case .failure: + self?.makeAlert(title: TextLiteral.errorAlertTitle, + message: TextLiteral.detailWaitViewControllerDeleteErrorMessage) + } } } }) @@ -156,12 +160,14 @@ extension DetailWaitViewController: DetailWaitViewDelegate { message: message, okAction: { [weak self] _ in self?.viewModel.requestDeleteLeaveRoom() { result in - switch result { - case .success: - self?.navigationController?.popViewController(animated: true) - case .failure: - self?.makeAlert(title: TextLiteral.errorAlertTitle, - message: TextLiteral.detailWaitViewControllerLeaveErrorMessage) + DispatchQueue.main.async { + switch result { + case .success: + self?.navigationController?.popViewController(animated: true) + case .failure: + self?.makeAlert(title: TextLiteral.errorAlertTitle, + message: TextLiteral.detailWaitViewControllerLeaveErrorMessage) + } } } }) From e45a751c979404e491d9f16a449c6c48586e30f8 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 8 Jun 2023 23:04:59 +0900 Subject: [PATCH 131/468] =?UTF-8?q?[CHORE]=20=EC=95=88=EC=93=B0=EB=8A=94?= =?UTF-8?q?=20=ED=95=A8=EC=88=98=20=EC=82=AD=EC=A0=9C=20=EB=B0=8F=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=9C=84=EC=B9=98=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailWaitViewController.swift | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 24bb0c246..ff8ad1877 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -78,6 +78,11 @@ final class DetailWaitViewController: BaseViewController { self.detailWaitView.configureDelegation(self) } + private func configureNavigationController() { + guard let navigationController = self.navigationController else { return } + self.detailWaitView.configureNavigationItem(navigationController) + } + private func presentDetailEditViewController(isOnlyDateEdit: Bool) { guard let room = self.roomInformation, let index = room.roomInformation?.id, @@ -98,11 +103,6 @@ final class DetailWaitViewController: BaseViewController { self.present(viewController, animated: true) } - private func checkStartDateIsPast(_ startDate: String) -> Bool { - guard let startDate = startDate.stringToDate else { return false } - return startDate.isPast - } - private func presentSelectManittoViewController(nickname: String) { guard let roomId = self.roomInformation?.roomInformation?.id?.description else { return } let viewController = SelectManitteeViewController(roomId: roomId, manitteeNickname: nickname) @@ -110,11 +110,6 @@ final class DetailWaitViewController: BaseViewController { viewController.modalPresentationStyle = .fullScreen self.present(viewController, animated: true) } - - private func configureNavigationController() { - guard let navigationController = self.navigationController else { return } - self.detailWaitView.configureNavigationItem(navigationController) - } } extension DetailWaitViewController: DetailWaitViewDelegate { From 7fce4e13b2676ef03a42a6c47c7a08bc5fc4ef86 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 10 Jun 2023 16:42:32 +0900 Subject: [PATCH 132/468] =?UTF-8?q?[CHORE]=20roomIndex=20=EB=B7=B0?= =?UTF-8?q?=EC=BB=A8=EC=97=90=EC=84=9C=20=EC=A0=9C=EA=B1=B0=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 28 +++++++++---------- .../ViewModel/DetailWaitViewModel.swift | 2 +- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index e3363cdae..d873bf40e 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -23,15 +23,13 @@ final class DetailWaitViewController: BaseViewController { // MARK: - property private var cancleable = Set() - private lazy var viewModel = DetailWaitViewModel(roomIndex: self.roomIndex, detailWaitService: DetailWaitAPI(apiService: APIService())) + private let detailWaitViewModel: DetailWaitViewModel private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) - private let roomIndex: Int - private var roomInformation: Room? // MARK: - init init(roomIndex: Int) { - self.roomIndex = roomIndex + self.detailWaitViewModel = DetailWaitViewModel(roomIndex: roomIndex, detailWaitService: DetailWaitAPI(apiService: APIService())) super.init() } @@ -55,13 +53,13 @@ final class DetailWaitViewController: BaseViewController { self.configureDelegation() self.configureNavigationController() self.setBind() - self.viewModel.fetchRoomInformation() + self.detailWaitViewModel.fetchRoomInformation() } // MARK: - func private func setBind() { - self.viewModel.$roomInformation + self.detailWaitViewModel.$roomInformation .receive(on: DispatchQueue.main) .sink(receiveCompletion: { result in switch result { @@ -88,16 +86,16 @@ final class DetailWaitViewController: BaseViewController { } private func presentDetailEditViewController(isOnlyDateEdit: Bool) { - guard let room = self.roomInformation else { return } + guard let roominformation = self.detailWaitViewModel.roomInformation else { return } let viewController = DetailEditViewController(editMode: isOnlyDateEdit ? .date : .information, - room: room) + room: roominformation) viewController.detailWaitDelegate = self self.present(viewController, animated: true) } private func presentSelectManittoViewController(nickname: String) { - guard let roomId = self.roomInformation?.roomInformation?.id?.description else { return } - let viewController = SelectManitteeViewController(roomId: roomId, manitteeNickname: nickname) + let roomIndex = self.detailWaitViewModel.roomIndex.description + let viewController = SelectManitteeViewController(roomId: roomIndex, manitteeNickname: nickname) viewController.modalTransitionStyle = .crossDissolve viewController.modalPresentationStyle = .fullScreen self.present(viewController, animated: true) @@ -106,7 +104,7 @@ final class DetailWaitViewController: BaseViewController { extension DetailWaitViewController: DetailWaitViewDelegate { func startButtonDidTap() { - self.viewModel.requestStartManitto() { [weak self] result in + self.detailWaitViewModel.requestStartManitto() { [weak self] result in DispatchQueue.main.async { switch result { case .success(let nickname): @@ -128,7 +126,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { message: message, okTitle: okTitle, okAction: { [weak self] _ in - self?.viewModel.requestDeleteRoom() { result in + self?.detailWaitViewModel.requestDeleteRoom() { result in DispatchQueue.main.async { switch result { case .success: @@ -146,7 +144,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { self.makeRequestAlert(title: title, message: message, okAction: { [weak self] _ in - self?.viewModel.requestDeleteLeaveRoom() { result in + self?.detailWaitViewModel.requestDeleteLeaveRoom() { result in DispatchQueue.main.async { switch result { case .success: @@ -161,7 +159,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { } func codeCopyButtonDidTap() { - guard let invitationCode = self.viewModel.roomInformation?.invitation?.code else { return } + guard let invitationCode = self.detailWaitViewModel.roomInformation?.invitation?.code else { return } ToastView.showToast(code: invitationCode, message: TextLiteral.detailWaitViewControllerCopyCode, controller: self) @@ -183,7 +181,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { extension DetailWaitViewController: DetailWaitViewControllerDelegate { func didTappedChangeButton() { - self.fetchRoomData() + self.detailWaitViewModel.fetchRoomInformation() ToastView.showToast(message: "방 정보 수정 완료", controller: self) } diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 87e135f08..aef5f3984 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -11,7 +11,7 @@ final class DetailWaitViewModel { // MARK: - property - private let roomIndex: Int + let roomIndex: Int private let detailWaitService: DetailWaitAPI @Published var roomInformation: Room? From 2cd21a0e07b0f30da1610bfb690c5c0c4222d4e6 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 10 Jun 2023 16:45:50 +0900 Subject: [PATCH 133/468] =?UTF-8?q?[CHORE]=20=EB=84=A4=ED=8A=B8=EC=9B=8C?= =?UTF-8?q?=ED=81=AC=20=EC=BD=94=EB=93=9C=20=EB=B7=B0=EC=BB=A8=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EC=82=AD=EC=A0=9C=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index d873bf40e..e19afeb8a 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -24,7 +24,6 @@ final class DetailWaitViewController: BaseViewController { private var cancleable = Set() private let detailWaitViewModel: DetailWaitViewModel - private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) // MARK: - init From c846afbc5c822be7eac64806bd6e12f501870d60 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 10 Jun 2023 21:31:15 +0900 Subject: [PATCH 134/468] =?UTF-8?q?[CHORE]=20UIControl=20Combine=20?= =?UTF-8?q?=EC=A0=9C=EC=8A=A4=EC=B2=98=20extension=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 + .../Extension/UIControl+Extension.swift | 99 +++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 Manito/Manito/Global/Extension/UIControl+Extension.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 09b600178..6194c50b7 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -17,6 +17,7 @@ 392EC7812855D17D006918A9 /* DetailWaitTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392EC7802855D17D006918A9 /* DetailWaitTitleView.swift */; }; 395B5BC22A25E20000CE1420 /* DetailWaitViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */; }; 395B5BCC2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */; }; + 395B5BD62A34A3C200CE1420 /* UIControl+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395B5BD52A34A3C200CE1420 /* UIControl+Extension.swift */; }; 397A241028BA494100454E4F /* APIEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957F0287D984900A04A2B /* APIEnvironment.swift */; }; 397A241428BA516B00454E4F /* DetailWaitAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241328BA516B00454E4F /* DetailWaitAPI.swift */; }; 397A241828BA51B400454E4F /* DetailWaitProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */; }; @@ -201,6 +202,7 @@ 392EC7802855D17D006918A9 /* DetailWaitTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitTitleView.swift; sourceTree = ""; }; 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitViewModel.swift; sourceTree = ""; }; 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitViewModelTest.swift; sourceTree = ""; }; + 395B5BD52A34A3C200CE1420 /* UIControl+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Extension.swift"; sourceTree = ""; }; 397A241328BA516B00454E4F /* DetailWaitAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitAPI.swift; sourceTree = ""; }; 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitProtocol.swift; sourceTree = ""; }; 397A241928BA532A00454E4F /* FriendList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendList.swift; sourceTree = ""; }; @@ -806,6 +808,7 @@ 39C957CF2879521400A04A2B /* String+Extension.swift */, 39C957D12879523200A04A2B /* Date+Extension.swift */, 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */, + 395B5BD52A34A3C200CE1420 /* UIControl+Extension.swift */, ); path = Extension; sourceTree = ""; @@ -1212,6 +1215,7 @@ buildActionMask = 2147483647; files = ( D75E8C7F28D76FFB004A6C41 /* LetterCountBadgeView.swift in Sources */, + 395B5BD62A34A3C200CE1420 /* UIControl+Extension.swift in Sources */, CBA4D7A62856D48C0018BDC2 /* RoomStateView.swift in Sources */, 333BF66628571CF00039F77F /* FriendCollectionViewCell.swift in Sources */, 39D95265285B097800183B09 /* CalendarView.swift in Sources */, diff --git a/Manito/Manito/Global/Extension/UIControl+Extension.swift b/Manito/Manito/Global/Extension/UIControl+Extension.swift new file mode 100644 index 000000000..cc2989705 --- /dev/null +++ b/Manito/Manito/Global/Extension/UIControl+Extension.swift @@ -0,0 +1,99 @@ +// +// UIControl+Extension.swift +// Manito +// +// Created by Mingwan Choi on 2023/06/10. +// + +import Combine +import UIKit + +extension UIControl { + func controlPublisher(for event: UIControl.Event) -> UIControl.EventPublisher { + return UIControl.EventPublisher(control: self, event: event) + } + + // Publisher + struct EventPublisher: Publisher { + typealias Output = UIControl + typealias Failure = Never + + let control: UIControl + let event: UIControl.Event + + func receive(subscriber: S) + where S: Subscriber, Never == S.Failure, UIControl == S.Input { + let subscription = EventSubscription( + control: control, + subscriber: subscriber, + event: event + ) + subscriber.receive(subscription: subscription) + } + } + + // Subscription + fileprivate class EventSubscription: Subscription + where EventSubscriber.Input == UIControl, EventSubscriber.Failure == Never { + + let control: UIControl + let event: UIControl.Event + var subscriber: EventSubscriber? + + init(control: UIControl, subscriber: EventSubscriber, event: UIControl.Event) { + self.control = control + self.subscriber = subscriber + self.event = event + + control.addTarget(self, action: #selector(eventDidOccur), for: event) + } + + func request(_ demand: Subscribers.Demand) {} + + func cancel() { + subscriber = nil + control.removeTarget(self, action: #selector(eventDidOccur), for: event) + } + + @objc func eventDidOccur() { + _ = subscriber?.receive(control) + } + } +} + +extension UITextField { + var textPublisher: AnyPublisher { + controlPublisher(for: .editingChanged) + .map { $0 as! UITextField } + .map { $0.text! } + .eraseToAnyPublisher() + } +} + +extension UIButton { + var tapPublisher: AnyPublisher { + controlPublisher(for: .touchUpInside) + .map { _ in } + .eraseToAnyPublisher() + } +} + +extension UISegmentedControl { + var selectionPublisher: AnyPublisher { + controlPublisher(for: .valueChanged) + .map { $0 as! UISegmentedControl } + .map { $0.selectedSegmentIndex } + .eraseToAnyPublisher() + } +} + +extension UISlider { + var valuePublisher: AnyPublisher { + controlPublisher(for: .valueChanged) + .map { $0 as! UISlider } + .map { $0.value } + .eraseToAnyPublisher() + } +} + +//출처:https://velog.io/@aurora_97/Combine-UIKit%EC%97%90%EC%84%9C-Combine-%ED%8E%B8%ED%95%98%EA%B2%8C-%EC%93%B0%EA%B8%B0 From 36a1bbb535681be24b52d7d28fa0aba35c1c5df1 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 10 Jun 2023 21:32:22 +0900 Subject: [PATCH 135/468] =?UTF-8?q?[CHORE]=20Input=20Output=20=EA=B5=AC?= =?UTF-8?q?=EC=A1=B0=EB=A1=9C=20=EC=88=98=EC=A0=95=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 37 +++++++++++-------- .../Detail-Wait/View/DetailWaitView.swift | 2 +- .../ViewModel/DetailWaitViewModel.swift | 24 +++++++++++- 3 files changed, 44 insertions(+), 19 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index e19afeb8a..12ba8f568 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -52,27 +52,32 @@ final class DetailWaitViewController: BaseViewController { self.configureDelegation() self.configureNavigationController() self.setBind() - self.detailWaitViewModel.fetchRoomInformation() } // MARK: - func private func setBind() { - self.detailWaitViewModel.$roomInformation + let input = DetailWaitViewModel.Input( + viewDidLoad: Just(Void()) + .map { self.detailWaitViewModel.fetchRoomInformation() } + .eraseToAnyPublisher(), + copyButtonDidTap: self.detailWaitView.copyButton.tapPublisher) + + let output = detailWaitViewModel.transform(input) + + output.roomInformationDidUpdate .receive(on: DispatchQueue.main) - .sink(receiveCompletion: { result in - switch result { - case .finished: - print("finish") - case .failure: - print("error") - } - }, receiveValue: { room in - if let room { - self.detailWaitView.updateDetailWaitView(room: room) - } - }) + .sink(receiveValue: { room in + if let room { + self.detailWaitView.updateDetailWaitView(room: room) + } + }) .store(in: &self.cancleable) + + output.showToastView.sink(receiveValue: { [weak self] code in + self?.codeCopyButtonDidTap() + }) + .store(in: &self.cancleable) } private func configureDelegation() { @@ -85,7 +90,7 @@ final class DetailWaitViewController: BaseViewController { } private func presentDetailEditViewController(isOnlyDateEdit: Bool) { - guard let roominformation = self.detailWaitViewModel.roomInformation else { return } + guard let roominformation = self.detailWaitViewModel.roomInformation.value else { return } let viewController = DetailEditViewController(editMode: isOnlyDateEdit ? .date : .information, room: roominformation) viewController.detailWaitDelegate = self @@ -158,7 +163,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { } func codeCopyButtonDidTap() { - guard let invitationCode = self.detailWaitViewModel.roomInformation?.invitation?.code else { return } + guard let invitationCode = self.detailWaitViewModel.roomInformation.value?.invitation?.code else { return } ToastView.showToast(code: invitationCode, message: TextLiteral.detailWaitViewControllerCopyCode, controller: self) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 6ac1fef6a..772e61da3 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -79,7 +79,7 @@ final class DetailWaitView: UIView { label.font = .font(.regular, ofSize: 14) return label }() - private let copyButton: UIButton = { + let copyButton: UIButton = { let button = UIButton(type: .system) button.setTitle(TextLiteral.copyCode, for: .normal) button.setTitleColor(.subBlue, for: .normal) diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index aef5f3984..8bf3df531 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -13,7 +13,27 @@ final class DetailWaitViewModel { let roomIndex: Int private let detailWaitService: DetailWaitAPI - @Published var roomInformation: Room? + var roomInformation = CurrentValueSubject(nil) + + struct Input { + let viewDidLoad: AnyPublisher + let copyButtonDidTap: AnyPublisher + } + + struct Output { + let roomInformationDidUpdate: AnyPublisher + let showToastView: AnyPublisher + } + + func transform(_ input: Input) -> Output { + let showToastView = input.copyButtonDidTap + .compactMap { self.roomInformation.value?.invitation?.code } + .eraseToAnyPublisher() + + return Output( + roomInformationDidUpdate: self.roomInformation.eraseToAnyPublisher(), + showToastView: showToastView) + } // MARK: - init @@ -28,7 +48,7 @@ final class DetailWaitViewModel { requestWaitRoomInfo { [weak self] result in switch result { case .success(let roominformation): - self?.roomInformation = roominformation + self?.roomInformation.send(roominformation) case .failure(let error): print(error) } From 428e34b1f7f9a252b47c13ced121fc887368b411 Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 11 Jun 2023 22:32:04 +0900 Subject: [PATCH 136/468] =?UTF-8?q?[CHORE]=20push=20=EC=BB=A4=EB=B0=8B=20(?= =?UTF-8?q?#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 19 +++++++++++++------ .../ViewModel/DetailWaitViewModel.swift | 16 +++++++++------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 12ba8f568..29bf0a556 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -60,8 +60,8 @@ final class DetailWaitViewController: BaseViewController { let input = DetailWaitViewModel.Input( viewDidLoad: Just(Void()) .map { self.detailWaitViewModel.fetchRoomInformation() } - .eraseToAnyPublisher(), - copyButtonDidTap: self.detailWaitView.copyButton.tapPublisher) + .eraseToAnyPublisher()) +// copyButtonDidTap: self.detailWaitView.copyButton.tapPublisher) let output = detailWaitViewModel.transform(input) @@ -74,10 +74,16 @@ final class DetailWaitViewController: BaseViewController { }) .store(in: &self.cancleable) - output.showToastView.sink(receiveValue: { [weak self] code in - self?.codeCopyButtonDidTap() - }) - .store(in: &self.cancleable) +// output.showToastView.sink(receiveValue: { [weak self] code in +// self?.codeCopyButtonDidTap() +// }) +// .store(in: &self.cancleable) + + self.detailWaitViewModel.copyButtonStream + .sink(receiveValue: { [weak self] _ in + self?.codeCopyButtonDidTap() + }) + .store(in: &self.cancleable) } private func configureDelegation() { @@ -163,6 +169,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { } func codeCopyButtonDidTap() { + self.detailWaitViewModel.copyButtonStream.send(Void()) guard let invitationCode = self.detailWaitViewModel.roomInformation.value?.invitation?.code else { return } ToastView.showToast(code: invitationCode, message: TextLiteral.detailWaitViewControllerCopyCode, diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 8bf3df531..0e7678059 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -17,22 +17,24 @@ final class DetailWaitViewModel { struct Input { let viewDidLoad: AnyPublisher - let copyButtonDidTap: AnyPublisher +// let copyButtonDidTap: AnyPublisher } + var copyButtonStream = PassthroughSubject() + struct Output { let roomInformationDidUpdate: AnyPublisher - let showToastView: AnyPublisher +// let showToastView: AnyPublisher } func transform(_ input: Input) -> Output { - let showToastView = input.copyButtonDidTap - .compactMap { self.roomInformation.value?.invitation?.code } - .eraseToAnyPublisher() +// let showToastView = input.copyButtonDidTap +// .compactMap { self.roomInformation.value?.invitation?.code } +// .eraseToAnyPublisher() return Output( - roomInformationDidUpdate: self.roomInformation.eraseToAnyPublisher(), - showToastView: showToastView) + roomInformationDidUpdate: self.roomInformation.eraseToAnyPublisher()) +// showToastView: showToastView) } // MARK: - init From 557148adea75e304d1c02474115e7a59e89ed197 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 12 Jun 2023 11:08:18 +0900 Subject: [PATCH 137/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20-=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=EB=AA=85=20=EB=B3=80=EA=B2=BD=20(#456)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/ParticipateRoom/ParticipateRoomView.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift index 4c0791817..7b819052b 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift @@ -49,7 +49,7 @@ final class ParticipateRoomView: UIView { self.setupLayout() self.setupButtonAction() self.setupNotificationCenter() - self.toggleButton() + self.detectNextButtonStatus() } @available(*, unavailable) @@ -103,7 +103,7 @@ final class ParticipateRoomView: UIView { NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) } - private func toggleButton() { + private func detectNextButtonStatus() { self.inputInvitedCodeView.changeNextButtonEnableStatus = { [weak self] isEnable in self?.nextButton.isDisabled = !isEnable } From b8a266717b2947bc48d8f12232be3743c9cdcd9c Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 12 Jun 2023 11:10:18 +0900 Subject: [PATCH 138/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20-=20life=20cycle=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=20=EB=B3=80=EA=B2=BD=20(#456)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ParticipateRoom/ParticipateRoomViewController.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift index 146f852ee..af5b2d8ae 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift @@ -27,16 +27,16 @@ final class ParticipateRoomViewController: BaseViewController { // MARK: - life cycle + override func loadView() { + self.view = self.participateRoomView + } + override func viewDidLoad() { super.viewDidLoad() self.configureDelegation() self.configureNavigation() } - override func loadView() { - self.view = self.participateRoomView - } - // MARK: - override override func endEditingView() { From 5022a38b3cf6c244b68782c583d9c94f36a010ac Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 12 Jun 2023 11:11:05 +0900 Subject: [PATCH 139/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20-=20self=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=20=EB=B6=99=EC=9D=B4=EA=B8=B0=20(#456)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/ParticipateRoom/ParticipateRoomViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift index af5b2d8ae..95e7d64c4 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift @@ -69,7 +69,7 @@ final class ParticipateRoomViewController: BaseViewController { viewController.verification = info viewController.roomId = id - present(viewController, animated: true) + self.present(viewController, animated: true) } } catch NetworkError.serverError { print("server Error") From 53de881f07665e489aaa72659d6cc26309e77fce Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 12 Jun 2023 11:14:21 +0900 Subject: [PATCH 140/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20-=20self=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=20=EB=B6=99=EC=9D=B4=EA=B8=B0=20(#456)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/ParticipateRoom/ParticipateRoomViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift index 95e7d64c4..ec026c061 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift @@ -76,7 +76,7 @@ final class ParticipateRoomViewController: BaseViewController { } catch NetworkError.encodingError { print("encoding Error") } catch NetworkError.clientError(let message) { - makeAlert(title: TextLiteral.checkRoomViewControllerErrorAlertTitle, message: TextLiteral.checkRoomViewControllerErrorAlertMessage) + self.makeAlert(title: TextLiteral.checkRoomViewControllerErrorAlertTitle, message: TextLiteral.checkRoomViewControllerErrorAlertMessage) print("client Error: \(String(describing: message))") } } From 6336cf66c3813ac9b3b9d683184457308b440a32 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 12 Jun 2023 17:05:05 +0900 Subject: [PATCH 141/468] =?UTF-8?q?[CHORE]=20fetchRoom=ED=95=A8=EC=88=98?= =?UTF-8?q?=20input=20output=20=EA=B5=AC=EC=A1=B0=EB=A1=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 43 ++++++++----------- .../ViewModel/DetailWaitViewModel.swift | 16 +++---- 2 files changed, 23 insertions(+), 36 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 29bf0a556..ddb0d4906 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -51,39 +51,24 @@ final class DetailWaitViewController: BaseViewController { super.viewDidLoad() self.configureDelegation() self.configureNavigationController() + self.detailWaitViewModel.fetchRoomInformation() self.setBind() } // MARK: - func private func setBind() { - let input = DetailWaitViewModel.Input( - viewDidLoad: Just(Void()) - .map { self.detailWaitViewModel.fetchRoomInformation() } - .eraseToAnyPublisher()) -// copyButtonDidTap: self.detailWaitView.copyButton.tapPublisher) - - let output = detailWaitViewModel.transform(input) + let input = DetailWaitViewModel.Input(viewDidLoad: Just(()).eraseToAnyPublisher()) + let output = self.detailWaitViewModel.transform(input) output.roomInformationDidUpdate .receive(on: DispatchQueue.main) - .sink(receiveValue: { room in + .sink(receiveValue: { [weak self] room in if let room { - self.detailWaitView.updateDetailWaitView(room: room) + self?.detailWaitView.updateDetailWaitView(room: room) } }) .store(in: &self.cancleable) - -// output.showToastView.sink(receiveValue: { [weak self] code in -// self?.codeCopyButtonDidTap() -// }) -// .store(in: &self.cancleable) - - self.detailWaitViewModel.copyButtonStream - .sink(receiveValue: { [weak self] _ in - self?.codeCopyButtonDidTap() - }) - .store(in: &self.cancleable) } private func configureDelegation() { @@ -110,6 +95,13 @@ final class DetailWaitViewController: BaseViewController { viewController.modalPresentationStyle = .fullScreen self.present(viewController, animated: true) } + + private func showToastView() { + guard let invitationCode = self.detailWaitViewModel.roomInformation.value?.invitation?.code else { return } + ToastView.showToast(code: invitationCode, + message: TextLiteral.detailWaitViewControllerCopyCode, + controller: self) + } } extension DetailWaitViewController: DetailWaitViewDelegate { @@ -169,11 +161,12 @@ extension DetailWaitViewController: DetailWaitViewDelegate { } func codeCopyButtonDidTap() { - self.detailWaitViewModel.copyButtonStream.send(Void()) - guard let invitationCode = self.detailWaitViewModel.roomInformation.value?.invitation?.code else { return } - ToastView.showToast(code: invitationCode, - message: TextLiteral.detailWaitViewControllerCopyCode, - controller: self) +// self.detailWaitViewModel.didTappedCopyButton() +// self.detailWaitViewModel.copyButtonStream.send(Void()) +// guard let invitationCode = self.detailWaitViewModel.roomInformation.value?.invitation?.code else { return } +// ToastView.showToast(code: invitationCode, +// message: TextLiteral.detailWaitViewControllerCopyCode, +// controller: self) } func didPassStartDate(isAdmin: Bool) { diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 0e7678059..b543311d8 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -17,24 +17,14 @@ final class DetailWaitViewModel { struct Input { let viewDidLoad: AnyPublisher -// let copyButtonDidTap: AnyPublisher } - var copyButtonStream = PassthroughSubject() - struct Output { let roomInformationDidUpdate: AnyPublisher -// let showToastView: AnyPublisher } func transform(_ input: Input) -> Output { -// let showToastView = input.copyButtonDidTap -// .compactMap { self.roomInformation.value?.invitation?.code } -// .eraseToAnyPublisher() - - return Output( - roomInformationDidUpdate: self.roomInformation.eraseToAnyPublisher()) -// showToastView: showToastView) + return Output(roomInformationDidUpdate: self.roomInformation.eraseToAnyPublisher()) } // MARK: - init @@ -57,6 +47,10 @@ final class DetailWaitViewModel { } } +// func didTappedCopyButton() { +// self.copyButtonStream.send(Void()) +// } + // MARK: - network private func requestWaitRoomInfo(completionHandler: @escaping ((Result) -> Void)) { From a93bf24115dd058adeb537a692dd9f5f444fb337 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 12 Jun 2023 17:23:48 +0900 Subject: [PATCH 142/468] =?UTF-8?q?[CHORE]=20=EC=B4=88=EB=8C=80=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EB=B2=84=ED=8A=BC,=20=EB=A7=88=EB=8B=88=EB=98=90?= =?UTF-8?q?=20=EC=8B=9C=EC=9E=91=20=EB=B2=84=ED=8A=BC=20input=20output=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 45 +++++++++++++------ .../Detail-Wait/View/DetailWaitView.swift | 4 +- .../ViewModel/DetailWaitViewModel.swift | 20 ++++++--- 3 files changed, 48 insertions(+), 21 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index ddb0d4906..a6b15f5f4 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -58,7 +58,11 @@ final class DetailWaitViewController: BaseViewController { // MARK: - func private func setBind() { - let input = DetailWaitViewModel.Input(viewDidLoad: Just(()).eraseToAnyPublisher()) + let input = DetailWaitViewModel.Input( + viewDidLoad: Just(()).eraseToAnyPublisher(), + codeCopyButtonDidTap: self.detailWaitView.copyButton.tapPublisher, + startButtonDidTap: self.detailWaitView.startButton.tapPublisher + ) let output = self.detailWaitViewModel.transform(input) output.roomInformationDidUpdate @@ -69,6 +73,21 @@ final class DetailWaitViewController: BaseViewController { } }) .store(in: &self.cancleable) + + output.showToast + .receive(on: DispatchQueue.main) + .sink(receiveValue: { [weak self] code in + self?.showToastView(code: code) + }) + .store(in: &self.cancleable) + + output.startManitto + .receive(on: DispatchQueue.main) + .throttle(for: 1, scheduler: DispatchQueue.main, latest: false) + .sink(receiveValue: { [weak self] _ in + self?.startManitto() + }) + .store(in: &self.cancleable) } private func configureDelegation() { @@ -96,16 +115,13 @@ final class DetailWaitViewController: BaseViewController { self.present(viewController, animated: true) } - private func showToastView() { - guard let invitationCode = self.detailWaitViewModel.roomInformation.value?.invitation?.code else { return } - ToastView.showToast(code: invitationCode, + private func showToastView(code: String) { + ToastView.showToast(code: code, message: TextLiteral.detailWaitViewControllerCopyCode, controller: self) } -} - -extension DetailWaitViewController: DetailWaitViewDelegate { - func startButtonDidTap() { + + private func startManitto() { self.detailWaitViewModel.requestStartManitto() { [weak self] result in DispatchQueue.main.async { switch result { @@ -118,6 +134,12 @@ extension DetailWaitViewController: DetailWaitViewDelegate { } } } +} + +extension DetailWaitViewController: DetailWaitViewDelegate { + func startButtonDidTap() { + // delegate 삭제 예정 + } func editButtonDidTap(isOnlyDateEdit: Bool) { self.presentDetailEditViewController(isOnlyDateEdit: isOnlyDateEdit) @@ -161,12 +183,7 @@ extension DetailWaitViewController: DetailWaitViewDelegate { } func codeCopyButtonDidTap() { -// self.detailWaitViewModel.didTappedCopyButton() -// self.detailWaitViewModel.copyButtonStream.send(Void()) -// guard let invitationCode = self.detailWaitViewModel.roomInformation.value?.invitation?.code else { return } -// ToastView.showToast(code: invitationCode, -// message: TextLiteral.detailWaitViewControllerCopyCode, -// controller: self) + // delegate 삭제 예정 } func didPassStartDate(isAdmin: Bool) { diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 772e61da3..a9f0b8194 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -95,7 +95,7 @@ final class DetailWaitView: UIView { tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") return tableView }() - private let startButton: MainButton = MainButton() + let startButton: MainButton = MainButton() // MARK: - property @@ -289,7 +289,7 @@ final class DetailWaitView: UIView { self.setupTitleViewData(title: title, state: state, dateRange: dateRange) self.setupRelatedViews(of: admin, isStart) - self.configureStartButton(room.canStart) + self.configureStartButton(true) self.configureUserCountLabel(userCount: room.userCount) } diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index b543311d8..02d00aa65 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -17,14 +17,28 @@ final class DetailWaitViewModel { struct Input { let viewDidLoad: AnyPublisher + let codeCopyButtonDidTap: AnyPublisher + let startButtonDidTap: AnyPublisher } struct Output { let roomInformationDidUpdate: AnyPublisher + let showToast: AnyPublisher + let startManitto: AnyPublisher } func transform(_ input: Input) -> Output { - return Output(roomInformationDidUpdate: self.roomInformation.eraseToAnyPublisher()) + let showToastOutput = input.codeCopyButtonDidTap + .compactMap { self.roomInformation.value?.invitation?.code } + .eraseToAnyPublisher() + + let startManittoOutput = input.startButtonDidTap + .eraseToAnyPublisher() + + return Output(roomInformationDidUpdate: self.roomInformation.eraseToAnyPublisher(), + showToast: showToastOutput, + startManitto: startManittoOutput + ) } // MARK: - init @@ -47,10 +61,6 @@ final class DetailWaitViewModel { } } -// func didTappedCopyButton() { -// self.copyButtonStream.send(Void()) -// } - // MARK: - network private func requestWaitRoomInfo(completionHandler: @escaping ((Result) -> Void)) { From 5ca4eb95c92a07a915cf77f686100912aa6b28d8 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 12 Jun 2023 18:06:35 +0900 Subject: [PATCH 143/468] =?UTF-8?q?[CHORE]=20=EC=8B=9C=EC=9E=91=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=20=ED=99=9C=EC=84=B1=ED=99=94=20=ED=95=B4?= =?UTF-8?q?=EC=A0=9C=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index a9f0b8194..421d4042b 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -289,7 +289,7 @@ final class DetailWaitView: UIView { self.setupTitleViewData(title: title, state: state, dateRange: dateRange) self.setupRelatedViews(of: admin, isStart) - self.configureStartButton(true) + self.configureStartButton(room.canStart) self.configureUserCountLabel(userCount: room.userCount) } From 86cb4c1aa5971fa68c04f836c09ae868f211c1d5 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 12 Jun 2023 18:30:28 +0900 Subject: [PATCH 144/468] =?UTF-8?q?[CHORE]=20=EB=B0=A9=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EC=88=98=EC=A0=95=20stream=20=EA=B5=AC=EC=A1=B0?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailWaitViewController.swift | 11 +++++++++-- .../Screens/Detail-Wait/View/DetailWaitView.swift | 6 +++--- .../Detail-Wait/ViewModel/DetailWaitViewModel.swift | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index a6b15f5f4..e5551761d 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -88,6 +88,13 @@ final class DetailWaitViewController: BaseViewController { self?.startManitto() }) .store(in: &self.cancleable) + + self.detailWaitViewModel.editButtonDidTap + .receive(on: DispatchQueue.main) + .sink(receiveValue: { [weak self] _ in + self?.presentDetailEditViewController(isOnlyDateEdit: false) + }) + .store(in: &self.cancleable) } private func configureDelegation() { @@ -141,8 +148,8 @@ extension DetailWaitViewController: DetailWaitViewDelegate { // delegate 삭제 예정 } - func editButtonDidTap(isOnlyDateEdit: Bool) { - self.presentDetailEditViewController(isOnlyDateEdit: isOnlyDateEdit) + func editButtonDidTap() { + self.detailWaitViewModel.editButtonDidTap.send(()) } func deleteButtonDidTap(title: String, message: String, okTitle: String) { diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 421d4042b..fa68cb95a 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -11,7 +11,7 @@ import SnapKit protocol DetailWaitViewDelegate: AnyObject { func startButtonDidTap() - func editButtonDidTap(isOnlyDateEdit: Bool) + func editButtonDidTap() func deleteButtonDidTap(title: String, message: String, okTitle: String) func leaveButtonDidTap(title: String, message: String, okTitle: String) func codeCopyButtonDidTap() @@ -232,7 +232,7 @@ final class DetailWaitView: UIView { switch type { case .admin: children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in - self?.delegate?.editButtonDidTap(isOnlyDateEdit: false) + self?.delegate?.editButtonDidTap() }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in self?.delegate?.deleteButtonDidTap(title: UserStatus.admin.alertText.title, message: UserStatus.admin.alertText.message, @@ -297,7 +297,7 @@ final class DetailWaitView: UIView { @objc private func presentEditViewController() { - self.delegate?.editButtonDidTap(isOnlyDateEdit: false) + self.delegate?.editButtonDidTap() } } diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 02d00aa65..50e4e1a2e 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -14,6 +14,7 @@ final class DetailWaitViewModel { let roomIndex: Int private let detailWaitService: DetailWaitAPI var roomInformation = CurrentValueSubject(nil) + lazy var editButtonDidTap = PassthroughSubject() struct Input { let viewDidLoad: AnyPublisher @@ -34,7 +35,7 @@ final class DetailWaitViewModel { let startManittoOutput = input.startButtonDidTap .eraseToAnyPublisher() - + return Output(roomInformationDidUpdate: self.roomInformation.eraseToAnyPublisher(), showToast: showToastOutput, startManitto: startManittoOutput From b780f27eade4a3e2ea41f9e3f6c0dd71d2dcae03 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 12 Jun 2023 21:25:33 +0900 Subject: [PATCH 145/468] =?UTF-8?q?[CHORE]=20viewDidLoad=20input=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift | 1 - .../Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift | 1 - 2 files changed, 2 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index e5551761d..789b39c92 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -59,7 +59,6 @@ final class DetailWaitViewController: BaseViewController { private func setBind() { let input = DetailWaitViewModel.Input( - viewDidLoad: Just(()).eraseToAnyPublisher(), codeCopyButtonDidTap: self.detailWaitView.copyButton.tapPublisher, startButtonDidTap: self.detailWaitView.startButton.tapPublisher ) diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 50e4e1a2e..bc42e5dca 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -17,7 +17,6 @@ final class DetailWaitViewModel { lazy var editButtonDidTap = PassthroughSubject() struct Input { - let viewDidLoad: AnyPublisher let codeCopyButtonDidTap: AnyPublisher let startButtonDidTap: AnyPublisher } From 982aa783150a5744a43b6624bdee71d4d7266d8f Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 12 Jun 2023 21:36:42 +0900 Subject: [PATCH 146/468] =?UTF-8?q?[CHORE]=20delete=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20stream=20=EC=B6=94=EA=B0=80=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 39 ++++++++++++------- .../Detail-Wait/View/DetailWaitView.swift | 6 +-- .../ViewModel/DetailWaitViewModel.swift | 1 + 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 789b39c92..096e44920 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -94,6 +94,13 @@ final class DetailWaitViewController: BaseViewController { self?.presentDetailEditViewController(isOnlyDateEdit: false) }) .store(in: &self.cancleable) + + self.detailWaitViewModel.deleteButtonDidTap + .receive(on: DispatchQueue.main) + .sink(receiveValue: { [weak self] _ in + self?.deleteRoom() + }) + .store(in: &self.cancleable) } private func configureDelegation() { @@ -140,21 +147,11 @@ final class DetailWaitViewController: BaseViewController { } } } -} - -extension DetailWaitViewController: DetailWaitViewDelegate { - func startButtonDidTap() { - // delegate 삭제 예정 - } - - func editButtonDidTap() { - self.detailWaitViewModel.editButtonDidTap.send(()) - } - func deleteButtonDidTap(title: String, message: String, okTitle: String) { - self.makeRequestAlert(title: title, - message: message, - okTitle: okTitle, + private func deleteRoom() { + self.makeRequestAlert(title: TextLiteral.datailWaitViewControllerDeleteTitle, + message: TextLiteral.datailWaitViewControllerDeleteMessage, + okTitle: TextLiteral.delete, okAction: { [weak self] _ in self?.detailWaitViewModel.requestDeleteRoom() { result in DispatchQueue.main.async { @@ -169,6 +166,20 @@ extension DetailWaitViewController: DetailWaitViewDelegate { } }) } +} + +extension DetailWaitViewController: DetailWaitViewDelegate { + func startButtonDidTap() { + // delegate 삭제 예정 + } + + func editButtonDidTap() { + self.detailWaitViewModel.editButtonDidTap.send(()) + } + + func deleteButtonDidTap() { + self.detailWaitViewModel.deleteButtonDidTap.send(()) + } func leaveButtonDidTap(title: String, message: String, okTitle: String) { self.makeRequestAlert(title: title, diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index fa68cb95a..80dec271f 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -12,7 +12,7 @@ import SnapKit protocol DetailWaitViewDelegate: AnyObject { func startButtonDidTap() func editButtonDidTap() - func deleteButtonDidTap(title: String, message: String, okTitle: String) + func deleteButtonDidTap() func leaveButtonDidTap(title: String, message: String, okTitle: String) func codeCopyButtonDidTap() func didPassStartDate(isAdmin: Bool) @@ -234,9 +234,7 @@ final class DetailWaitView: UIView { children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in self?.delegate?.editButtonDidTap() }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in - self?.delegate?.deleteButtonDidTap(title: UserStatus.admin.alertText.title, - message: UserStatus.admin.alertText.message, - okTitle: UserStatus.admin.alertText.okTitle) + self?.delegate?.deleteButtonDidTap() }) ] case .member: diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index bc42e5dca..d40ce9d39 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -15,6 +15,7 @@ final class DetailWaitViewModel { private let detailWaitService: DetailWaitAPI var roomInformation = CurrentValueSubject(nil) lazy var editButtonDidTap = PassthroughSubject() + lazy var deleteButtonDidTap = PassthroughSubject() struct Input { let codeCopyButtonDidTap: AnyPublisher From 30b3fe9f0ec4bcdc7a76eb9ad6080baeb7a1012b Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 12 Jun 2023 21:45:45 +0900 Subject: [PATCH 147/468] =?UTF-8?q?[CHORE]=20leave=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?stream=20=EC=B6=94=EA=B0=80=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 44 ++++++++++++------- .../Detail-Wait/View/DetailWaitView.swift | 24 ++-------- .../ViewModel/DetailWaitViewModel.swift | 1 + 3 files changed, 32 insertions(+), 37 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 096e44920..84e1b6242 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -101,6 +101,13 @@ final class DetailWaitViewController: BaseViewController { self?.deleteRoom() }) .store(in: &self.cancleable) + + self.detailWaitViewModel.leaveButtonDidTap + .receive(on: DispatchQueue.main) + .sink(receiveValue: { [weak self] _ in + self?.leaveRoom() + }) + .store(in: &self.cancleable) } private func configureDelegation() { @@ -166,6 +173,25 @@ final class DetailWaitViewController: BaseViewController { } }) } + + private func leaveRoom() { + self.makeRequestAlert(title: TextLiteral.datailWaitViewControllerExitTitle, + message: TextLiteral.datailWaitViewControllerExitMessage, + okTitle: TextLiteral.leave, + okAction: { [weak self] _ in + self?.detailWaitViewModel.requestDeleteLeaveRoom() { result in + DispatchQueue.main.async { + switch result { + case .success: + self?.navigationController?.popViewController(animated: true) + case .failure: + self?.makeAlert(title: TextLiteral.errorAlertTitle, + message: TextLiteral.detailWaitViewControllerLeaveErrorMessage) + } + } + } + }) + } } extension DetailWaitViewController: DetailWaitViewDelegate { @@ -181,22 +207,8 @@ extension DetailWaitViewController: DetailWaitViewDelegate { self.detailWaitViewModel.deleteButtonDidTap.send(()) } - func leaveButtonDidTap(title: String, message: String, okTitle: String) { - self.makeRequestAlert(title: title, - message: message, - okAction: { [weak self] _ in - self?.detailWaitViewModel.requestDeleteLeaveRoom() { result in - DispatchQueue.main.async { - switch result { - case .success: - self?.navigationController?.popViewController(animated: true) - case .failure: - self?.makeAlert(title: TextLiteral.errorAlertTitle, - message: TextLiteral.detailWaitViewControllerLeaveErrorMessage) - } - } - } - }) + func leaveButtonDidTap() { + self.detailWaitViewModel.leaveButtonDidTap.send(()) } func codeCopyButtonDidTap() { diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 80dec271f..0a5bedd2b 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -13,30 +13,15 @@ protocol DetailWaitViewDelegate: AnyObject { func startButtonDidTap() func editButtonDidTap() func deleteButtonDidTap() - func leaveButtonDidTap(title: String, message: String, okTitle: String) + func leaveButtonDidTap() func codeCopyButtonDidTap() func didPassStartDate(isAdmin: Bool) } final class DetailWaitView: UIView { - private enum UserStatus: CaseIterable { + private enum UserStatus { case admin case member - - var alertText: (title: String, - message: String, - okTitle: String) { - switch self { - case .admin: - return (title: TextLiteral.datailWaitViewControllerDeleteTitle, - message: TextLiteral.datailWaitViewControllerDeleteMessage, - okTitle: TextLiteral.delete) - case .member: - return (title: TextLiteral.datailWaitViewControllerExitTitle, - message: TextLiteral.datailWaitViewControllerExitMessage, - okTitle: TextLiteral.leave) - } - } } private enum ButtonText: String { @@ -239,10 +224,7 @@ final class DetailWaitView: UIView { ] case .member: children = [UIAction(title: TextLiteral.detailWaitViewControllerLeaveRoom, handler: { [weak self] _ in - self?.delegate?.leaveButtonDidTap(title: UserStatus.member.alertText.title, - message: UserStatus.member.alertText.message, - okTitle: UserStatus.member.alertText.okTitle - ) + self?.delegate?.leaveButtonDidTap() })] } let menu = UIMenu(children: children) diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index d40ce9d39..ca4195a6f 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -16,6 +16,7 @@ final class DetailWaitViewModel { var roomInformation = CurrentValueSubject(nil) lazy var editButtonDidTap = PassthroughSubject() lazy var deleteButtonDidTap = PassthroughSubject() + lazy var leaveButtonDidTap = PassthroughSubject() struct Input { let codeCopyButtonDidTap: AnyPublisher From 09ba2185af3cf1cdde01900c24c704d689e09cf0 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 12 Jun 2023 21:53:38 +0900 Subject: [PATCH 148/468] =?UTF-8?q?[CHORE]=20startButton=20delegate=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailWaitViewController.swift | 4 ---- .../Screens/Detail-Wait/View/DetailWaitView.swift | 15 +++------------ 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 84e1b6242..3d8947363 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -195,10 +195,6 @@ final class DetailWaitViewController: BaseViewController { } extension DetailWaitViewController: DetailWaitViewDelegate { - func startButtonDidTap() { - // delegate 삭제 예정 - } - func editButtonDidTap() { self.detailWaitViewModel.editButtonDidTap.send(()) } diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 0a5bedd2b..21cf6167f 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -10,7 +10,6 @@ import UIKit import SnapKit protocol DetailWaitViewDelegate: AnyObject { - func startButtonDidTap() func editButtonDidTap() func deleteButtonDidTap() func leaveButtonDidTap() @@ -198,17 +197,9 @@ final class DetailWaitView: UIView { } private func configureStartButton(_ canStart: Bool) { - if canStart { - self.startButton.title = ButtonText.start.status - self.startButton.isDisabled = false - let action = UIAction { [weak self] _ in - self?.delegate?.startButtonDidTap() - } - self.startButton.addAction(action, for: .touchUpInside) - } else { - self.startButton.title = ButtonText.waiting.status - self.startButton.isDisabled = true - } + let type: ButtonText = canStart ? .start : .waiting + self.startButton.title = type.status + self.startButton.isDisabled = !canStart } private func setExitButtonMenu(_ isAdmin: Bool) { From 2b7416cdc1a7d0f3f03ebc270f092ae3d6278143 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 12 Jun 2023 21:55:19 +0900 Subject: [PATCH 149/468] =?UTF-8?q?[CHORE]=20copy=20code=20delegate=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/DetailWaitViewController.swift | 4 ---- .../Manito/Screens/Detail-Wait/View/DetailWaitView.swift | 9 --------- 2 files changed, 13 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 3d8947363..3467b7a6c 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -207,10 +207,6 @@ extension DetailWaitViewController: DetailWaitViewDelegate { self.detailWaitViewModel.leaveButtonDidTap.send(()) } - func codeCopyButtonDidTap() { - // delegate 삭제 예정 - } - func didPassStartDate(isAdmin: Bool) { if isAdmin { self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 21cf6167f..0b95b6d52 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -13,7 +13,6 @@ protocol DetailWaitViewDelegate: AnyObject { func editButtonDidTap() func deleteButtonDidTap() func leaveButtonDidTap() - func codeCopyButtonDidTap() func didPassStartDate(isAdmin: Bool) } @@ -99,7 +98,6 @@ final class DetailWaitView: UIView { override init(frame: CGRect) { super.init(frame: frame) self.setupLayout() - self.setupCopyButton() } @available(*, unavailable) @@ -158,13 +156,6 @@ final class DetailWaitView: UIView { } } - private func setupCopyButton() { - let action = UIAction { [weak self] _ in - self?.delegate?.codeCopyButtonDidTap() - } - self.copyButton.addAction(action, for: .touchUpInside) - } - private func setupTitleViewData(title: String, state: String, dateRange: String) { self.titleView.setStartState(state: state) self.titleView.setupLabelData(title: title, dateRange: dateRange) From cd80b5099cffb5a86146147ad2ca2787afa9fac1 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 12 Jun 2023 22:12:23 +0900 Subject: [PATCH 150/468] =?UTF-8?q?[CHORE]=20UIMenu=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=EB=93=A4=20output=20=EC=B6=94=EA=B0=80=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/DetailWaitViewController.swift | 7 +++---- .../Detail-Wait/ViewModel/DetailWaitViewModel.swift | 10 +++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 3467b7a6c..e2a34d77b 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -82,27 +82,26 @@ final class DetailWaitViewController: BaseViewController { output.startManitto .receive(on: DispatchQueue.main) - .throttle(for: 1, scheduler: DispatchQueue.main, latest: false) .sink(receiveValue: { [weak self] _ in self?.startManitto() }) .store(in: &self.cancleable) - self.detailWaitViewModel.editButtonDidTap + output.presentEditView .receive(on: DispatchQueue.main) .sink(receiveValue: { [weak self] _ in self?.presentDetailEditViewController(isOnlyDateEdit: false) }) .store(in: &self.cancleable) - self.detailWaitViewModel.deleteButtonDidTap + output.deleteRoom .receive(on: DispatchQueue.main) .sink(receiveValue: { [weak self] _ in self?.deleteRoom() }) .store(in: &self.cancleable) - self.detailWaitViewModel.leaveButtonDidTap + output.leaveRoom .receive(on: DispatchQueue.main) .sink(receiveValue: { [weak self] _ in self?.leaveRoom() diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index ca4195a6f..5e9167ecd 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -6,6 +6,7 @@ // import Combine +import Foundation final class DetailWaitViewModel { @@ -27,6 +28,9 @@ final class DetailWaitViewModel { let roomInformationDidUpdate: AnyPublisher let showToast: AnyPublisher let startManitto: AnyPublisher + let presentEditView: AnyPublisher + let deleteRoom: AnyPublisher + let leaveRoom: AnyPublisher } func transform(_ input: Input) -> Output { @@ -35,11 +39,15 @@ final class DetailWaitViewModel { .eraseToAnyPublisher() let startManittoOutput = input.startButtonDidTap + .throttle(for: 1, scheduler: DispatchQueue.main, latest: false) .eraseToAnyPublisher() return Output(roomInformationDidUpdate: self.roomInformation.eraseToAnyPublisher(), showToast: showToastOutput, - startManitto: startManittoOutput + startManitto: startManittoOutput, + presentEditView: self.editButtonDidTap.eraseToAnyPublisher(), + deleteRoom: self.deleteButtonDidTap.eraseToAnyPublisher(), + leaveRoom: self.leaveButtonDidTap.eraseToAnyPublisher() ) } From 84959bcbcaaaf2e9097ac00bc17011a5e7cbe33b Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 12 Jun 2023 23:18:33 +0900 Subject: [PATCH 151/468] =?UTF-8?q?[CHORE]=20=EC=8B=9C=EC=9E=91=EB=82=A0?= =?UTF-8?q?=EC=A7=9C=20=EC=A7=80=EB=82=9C=20alert=20=ED=91=9C=EC=8B=9C=20o?= =?UTF-8?q?utput=20=EC=B6=94=EA=B0=80=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 37 ++++++++++++------- .../ViewModel/DetailWaitViewModel.swift | 15 +++++--- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index e2a34d77b..2fe792af3 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -107,6 +107,13 @@ final class DetailWaitViewController: BaseViewController { self?.leaveRoom() }) .store(in: &self.cancleable) + + output.showStartDatePassedAlert + .receive(on: DispatchQueue.main) + .sink(receiveValue: { [weak self] value in + self?.showStartDatePassedAlert(isAdmin: value) + }) + .store(in: &self.cancleable) } private func configureDelegation() { @@ -191,32 +198,36 @@ final class DetailWaitViewController: BaseViewController { } }) } + + private func showStartDatePassedAlert(isAdmin: Bool) { + if isAdmin { + self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, + message: TextLiteral.detailWaitViewControllerPastAdminAlertMessage, + okAction: { [weak self] _ in + self?.presentDetailEditViewController(isOnlyDateEdit: true) } + ) + } else { + self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, + message: TextLiteral.detailWaitViewControllerPastAlertMessage) + } + } } extension DetailWaitViewController: DetailWaitViewDelegate { func editButtonDidTap() { - self.detailWaitViewModel.editButtonDidTap.send(()) + self.detailWaitViewModel.editMenuButtonDidTap.send(()) } func deleteButtonDidTap() { - self.detailWaitViewModel.deleteButtonDidTap.send(()) + self.detailWaitViewModel.deleteMenuButtonDidTap.send(()) } func leaveButtonDidTap() { - self.detailWaitViewModel.leaveButtonDidTap.send(()) + self.detailWaitViewModel.leaveMenuButtonDidTap.send(()) } func didPassStartDate(isAdmin: Bool) { - if isAdmin { - self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, - message: TextLiteral.detailWaitViewControllerPastAdminAlertMessage, - okAction: { [weak self] _ in - self?.presentDetailEditViewController(isOnlyDateEdit: true) } - ) - } else { - self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, - message: TextLiteral.detailWaitViewControllerPastAlertMessage) - } + self.detailWaitViewModel.didPassedStartDate.send(isAdmin) } } diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 5e9167ecd..dcc0627af 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -15,9 +15,10 @@ final class DetailWaitViewModel { let roomIndex: Int private let detailWaitService: DetailWaitAPI var roomInformation = CurrentValueSubject(nil) - lazy var editButtonDidTap = PassthroughSubject() - lazy var deleteButtonDidTap = PassthroughSubject() - lazy var leaveButtonDidTap = PassthroughSubject() + lazy var editMenuButtonDidTap = PassthroughSubject() + lazy var deleteMenuButtonDidTap = PassthroughSubject() + lazy var leaveMenuButtonDidTap = PassthroughSubject() + var didPassedStartDate = PassthroughSubject() struct Input { let codeCopyButtonDidTap: AnyPublisher @@ -31,6 +32,7 @@ final class DetailWaitViewModel { let presentEditView: AnyPublisher let deleteRoom: AnyPublisher let leaveRoom: AnyPublisher + let showStartDatePassedAlert: AnyPublisher } func transform(_ input: Input) -> Output { @@ -45,9 +47,10 @@ final class DetailWaitViewModel { return Output(roomInformationDidUpdate: self.roomInformation.eraseToAnyPublisher(), showToast: showToastOutput, startManitto: startManittoOutput, - presentEditView: self.editButtonDidTap.eraseToAnyPublisher(), - deleteRoom: self.deleteButtonDidTap.eraseToAnyPublisher(), - leaveRoom: self.leaveButtonDidTap.eraseToAnyPublisher() + presentEditView: self.editMenuButtonDidTap.eraseToAnyPublisher(), + deleteRoom: self.deleteMenuButtonDidTap.eraseToAnyPublisher(), + leaveRoom: self.leaveMenuButtonDidTap.eraseToAnyPublisher(), + showStartDatePassedAlert: self.didPassedStartDate.eraseToAnyPublisher() ) } From 6cd3e01723bb65a668094736396fe547683b65ea Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 15 Jun 2023 22:44:01 +0900 Subject: [PATCH 152/468] =?UTF-8?q?[CHORE]=20cancellable=20=EC=98=A4?= =?UTF-8?q?=ED=83=80=20=EC=88=98=EC=A0=95=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailWaitViewController.swift | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 2fe792af3..75e05e5a1 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -22,7 +22,7 @@ final class DetailWaitViewController: BaseViewController { // MARK: - property - private var cancleable = Set() + private var cancellable = Set() private let detailWaitViewModel: DetailWaitViewModel // MARK: - init @@ -71,49 +71,49 @@ final class DetailWaitViewController: BaseViewController { self?.detailWaitView.updateDetailWaitView(room: room) } }) - .store(in: &self.cancleable) + .store(in: &self.cancellable) output.showToast .receive(on: DispatchQueue.main) .sink(receiveValue: { [weak self] code in self?.showToastView(code: code) }) - .store(in: &self.cancleable) + .store(in: &self.cancellable) output.startManitto .receive(on: DispatchQueue.main) .sink(receiveValue: { [weak self] _ in self?.startManitto() }) - .store(in: &self.cancleable) + .store(in: &self.cancellable) output.presentEditView .receive(on: DispatchQueue.main) .sink(receiveValue: { [weak self] _ in self?.presentDetailEditViewController(isOnlyDateEdit: false) }) - .store(in: &self.cancleable) + .store(in: &self.cancellable) output.deleteRoom .receive(on: DispatchQueue.main) .sink(receiveValue: { [weak self] _ in self?.deleteRoom() }) - .store(in: &self.cancleable) + .store(in: &self.cancellable) output.leaveRoom .receive(on: DispatchQueue.main) .sink(receiveValue: { [weak self] _ in self?.leaveRoom() }) - .store(in: &self.cancleable) + .store(in: &self.cancellable) output.showStartDatePassedAlert .receive(on: DispatchQueue.main) .sink(receiveValue: { [weak self] value in self?.showStartDatePassedAlert(isAdmin: value) }) - .store(in: &self.cancleable) + .store(in: &self.cancellable) } private func configureDelegation() { From 7c696fe69de7659af28fdb0fd788c73041324803 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 15 Jun 2023 22:47:40 +0900 Subject: [PATCH 153/468] =?UTF-8?q?[CHORE]=20=EB=B0=A9=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=20fetch=ED=95=A8=EC=88=98=20=EB=B6=84=EB=A6=AC=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/DetailWaitViewController.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 75e05e5a1..083eb24b9 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -51,7 +51,7 @@ final class DetailWaitViewController: BaseViewController { super.viewDidLoad() self.configureDelegation() self.configureNavigationController() - self.detailWaitViewModel.fetchRoomInformation() + self.fetchRoomInformationAtViewModel() self.setBind() } @@ -125,6 +125,10 @@ final class DetailWaitViewController: BaseViewController { self.detailWaitView.configureNavigationItem(navigationController) } + private func fetchRoomInformationAtViewModel() { + self.detailWaitViewModel.fetchRoomInformation() + } + private func presentDetailEditViewController(isOnlyDateEdit: Bool) { guard let roominformation = self.detailWaitViewModel.roomInformation.value else { return } let viewController = DetailEditViewController(editMode: isOnlyDateEdit ? .date : .information, From a42e93481a387dd0a4df92309fbde577a2d6d1a6 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 15 Jun 2023 22:50:49 +0900 Subject: [PATCH 154/468] =?UTF-8?q?[CHORE]=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=88=9C=EC=84=9C=20=EB=B3=80=EA=B2=BD=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 083eb24b9..985482d97 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -52,12 +52,25 @@ final class DetailWaitViewController: BaseViewController { self.configureDelegation() self.configureNavigationController() self.fetchRoomInformationAtViewModel() - self.setBind() + self.setupBindings() } // MARK: - func - private func setBind() { + private func configureDelegation() { + self.detailWaitView.configureDelegation(self) + } + + private func configureNavigationController() { + guard let navigationController = self.navigationController else { return } + self.detailWaitView.configureNavigationItem(navigationController) + } + + private func fetchRoomInformationAtViewModel() { + self.detailWaitViewModel.fetchRoomInformation() + } + + private func setupBindings() { let input = DetailWaitViewModel.Input( codeCopyButtonDidTap: self.detailWaitView.copyButton.tapPublisher, startButtonDidTap: self.detailWaitView.startButton.tapPublisher @@ -116,19 +129,6 @@ final class DetailWaitViewController: BaseViewController { .store(in: &self.cancellable) } - private func configureDelegation() { - self.detailWaitView.configureDelegation(self) - } - - private func configureNavigationController() { - guard let navigationController = self.navigationController else { return } - self.detailWaitView.configureNavigationItem(navigationController) - } - - private func fetchRoomInformationAtViewModel() { - self.detailWaitViewModel.fetchRoomInformation() - } - private func presentDetailEditViewController(isOnlyDateEdit: Bool) { guard let roominformation = self.detailWaitViewModel.roomInformation.value else { return } let viewController = DetailEditViewController(editMode: isOnlyDateEdit ? .date : .information, From 49cb7af0851a54b2f28305bf1f753eabf5730607 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sun, 18 Jun 2023 21:50:04 +0900 Subject: [PATCH 155/468] =?UTF-8?q?[CHORE]=20self=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=20=EB=B6=99=EC=9D=B4=EA=B8=B0=20(#456)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/ParticipateRoom/ParticipateRoomView.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift index 7b819052b..b12dc23ab 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift @@ -75,9 +75,9 @@ final class ParticipateRoomView: UIView { self.addSubview(self.inputInvitedCodeView) self.inputInvitedCodeView.snp.makeConstraints { - $0.top.equalTo(titleLabel.snp.bottom).offset(66) + $0.top.equalTo(self.titleLabel.snp.bottom).offset(66) $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalTo(nextButton.snp.top) + $0.bottom.equalTo(self.nextButton.snp.top) } self.bringSubviewToFront(self.nextButton) From b5e83b8f20237d7907a0a812092435fe5e017cb6 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 15:43:13 +0900 Subject: [PATCH 156/468] =?UTF-8?q?[CHORE]=20DetailIng=20View=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 12 + .../Detail-Ing/DetailingViewController.swift | 552 ++---------------- .../Detail-Ing/View/DetailingView.swift | 503 ++++++++++++++++ 3 files changed, 576 insertions(+), 491 deletions(-) create mode 100644 Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 1f4e93dd4..eef409a08 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -51,6 +51,7 @@ 39CD582128C4C3E800496E91 /* DetailDoneAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CD582028C4C3E800496E91 /* DetailDoneAPI.swift */; }; 39D95265285B097800183B09 /* CalendarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39D95264285B097800183B09 /* CalendarView.swift */; }; 39E099AD287FC020004F464E /* LetterDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39E099AC287FC020004F464E /* LetterDTO.swift */; }; + 39EE956D2A401ED400AF6857 /* DetailingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EE956C2A401ED400AF6857 /* DetailingView.swift */; }; 39EEF65628CB3BB200437654 /* LoginProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65528CB3BB200437654 /* LoginProtocol.swift */; }; 39EEF65828CB3C1100437654 /* Login.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65728CB3C1100437654 /* Login.swift */; }; 39EEF65A28CB3C7B00437654 /* Token.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65928CB3C7B00437654 /* Token.swift */; }; @@ -233,6 +234,7 @@ 39D95264285B097800183B09 /* CalendarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarView.swift; sourceTree = ""; }; 39E099AC287FC020004F464E /* LetterDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterDTO.swift; sourceTree = ""; }; 39E6321328BDE59C00CFC6C4 /* Manito.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Manito.entitlements; sourceTree = ""; }; + 39EE956C2A401ED400AF6857 /* DetailingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailingView.swift; sourceTree = ""; }; 39EEF65528CB3BB200437654 /* LoginProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginProtocol.swift; sourceTree = ""; }; 39EEF65728CB3C1100437654 /* Login.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Login.swift; sourceTree = ""; }; 39EEF65928CB3C7B00437654 /* Token.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Token.swift; sourceTree = ""; }; @@ -506,6 +508,14 @@ path = Request; sourceTree = ""; }; + 39EE956B2A401E9600AF6857 /* View */ = { + isa = PBXGroup; + children = ( + 39EE956C2A401ED400AF6857 /* DetailingView.swift */, + ); + path = View; + sourceTree = ""; + }; 7E0C5C342855B1EF00F698D1 /* CreateNickName */ = { isa = PBXGroup; children = ( @@ -728,6 +738,7 @@ B5F524E928519B3F00614FF7 /* Detail-Ing */ = { isa = PBXGroup; children = ( + 39EE956B2A401E9600AF6857 /* View */, D75E8C7D28D76FB1004A6C41 /* UIcomponent */, 333BF66428571C850039F77F /* Cell */, 435B17672913E71400212663 /* DetailingViewController.swift */, @@ -1250,6 +1261,7 @@ B5AE11F229D28CB500F86FF8 /* OpenManittoPopupView.swift in Sources */, B517C04A28D1F7EC0008BED0 /* TokenEndPoint.swift in Sources */, 39C957DF2879A35300A04A2B /* RoomDTO.swift in Sources */, + 39EE956D2A401ED400AF6857 /* DetailingView.swift in Sources */, 39C95808287DB05C00A04A2B /* SettingEndPoint.swift in Sources */, 39C957F4287D9EB400A04A2B /* APIService.swift in Sources */, B5F524CF28519AA000614FF7 /* AppDelegate.swift in Sources */, diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index 9bc563780..f0538549d 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -13,217 +13,12 @@ final class DetailingViewController: BaseViewController { private let detailIngService: DetailIngAPI = DetailIngAPI(apiService: APIService()) private let detailDoneService: DetailDoneAPI = DetailDoneAPI(apiService: APIService()) - - private enum RoomType: String { - case PROCESSING - case POST - } - private let roomId: String - private var roomType: RoomType = .PROCESSING - private var isTappedManittee: Bool = false private var missionId: String = "" - private var manittoNickname: String = "" - var letterViewController: UIViewController { - guard let mission = missionContentsLabel.text else { return UIViewController() } - let viewController = LetterViewController(roomState: roomType.rawValue, - roomId: roomId, - mission: mission, - missionId: self.missionId, - entryPoint: .notification) - return viewController - } // MARK: - property - private let titleLabel: UILabel = { - let label = UILabel() - label.textColor = .white - label.font = .font(.regular, ofSize: 34) - return label - }() - private let periodLabel: UILabel = { - let label = UILabel() - label.textColor = .grey002 - label.font = .font(.regular, ofSize: 16) - return label - }() - private let statusLabel: UILabel = { - let label = UILabel() - label.layer.masksToBounds = true - label.layer.cornerRadius = 11 - label.textColor = .white - label.font = .font(.regular, ofSize: 13) - label.textAlignment = .center - return label - }() - private let missionBackgroundView: UIView = { - var view = UIView() - view.backgroundColor = .darkGrey004 - return view - }() - private let missionTitleLabel: UILabel = { - let label = UILabel() - label.text = TextLiteral.individualMissionViewTitleLabel - label.textColor = .grey002 - label.font = .font(.regular, ofSize: 14) - return label - }() - private let missionContentsLabel: UILabel = { - let label = UILabel() - let paragraphStyle = NSMutableParagraphStyle() - paragraphStyle.lineBreakStrategy = .hangulWordPriority - let attributedText = NSAttributedString(string: "", attributes: [.paragraphStyle: paragraphStyle]) - label.attributedText = attributedText - label.textAlignment = .center - label.numberOfLines = 0 - label.textColor = .white - label.font = .font(.regular, ofSize: 18) - return label - }() - private let informationTitleLabel: UILabel = { - let label = UILabel() - label.text = TextLiteral.detailIngViewControllerDetailInformatioin - label.textColor = .white - label.font = .font(.regular, ofSize: 16) - return label - }() - private lazy var manitteeBackView: UIView = { - let view = UIView() - let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didTappedManittee)) - view.addGestureRecognizer(tapGesture) - view.backgroundColor = .darkGrey002 - view.makeBorderLayer(color: .white) - return view - }() - private let manitteeImageView: UIView = { - let view = UIView() - view.backgroundColor = .subOrange - view.layer.borderWidth = 1 - view.layer.borderColor = UIColor.grey005.cgColor - view.layer.cornerRadius = 49.5 - return view - }() - private let manitteeIconView = UIImageView(image: ImageLiterals.icManiTti) - private let manitteeLabel: UILabel = { - let label = UILabel() - label.text = "\(UserDefaultStorage.nickname)의 마니띠" - label.textColor = .white - label.font = .font(.regular, ofSize: 15) - return label - }() - private lazy var listBackView: UIView = { - let view = UIView() - let tapGesture = UITapGestureRecognizer(target: self, action: #selector(pushFriendListViewController(_:))) - view.addGestureRecognizer(tapGesture) - view.backgroundColor = .darkGrey002 - view.makeBorderLayer(color: .white) - return view - }() - private let listImageView: UIView = { - let view = UIView() - view.backgroundColor = .subPink - view.layer.borderWidth = 1 - view.layer.borderColor = UIColor.grey005.cgColor - view.layer.cornerRadius = 49.5 - return view - }() - private let listIconView = UIImageView(image: ImageLiterals.icList) - private let listLabel: UILabel = { - let label = UILabel() - label.text = TextLiteral.togetherFriend - label.textColor = .white - label.font = .font(.regular, ofSize: 15) - return label - }() - private lazy var letterBoxButton: UIButton = { - let button = UIButton(type: .system) - let action = UIAction { [weak self] _ in - guard let roomType = self?.roomType, - let roomId = self?.roomId, - let mission = self?.missionContentsLabel.text - else { return } - let letterViewController = LetterViewController(roomState: roomType.rawValue, - roomId: roomId, - mission: mission, - missionId: self?.missionId ?? "", - entryPoint: .detail) - self?.navigationController?.pushViewController(letterViewController, animated: true) - } - button.addAction(action, for: .touchUpInside) - button.setTitle(TextLiteral.letterViewControllerTitle, for: .normal) - button.setTitleColor(.white, for: .normal) - button.titleLabel?.font = .font(.regular, ofSize: 15) - button.backgroundColor = .darkGrey002 - button.makeBorderLayer(color: .white) - return button - }() - private lazy var manittoMemoryButton: UIButton = { - let button = UIButton(type: .system) - let action = UIAction { [weak self] _ in - guard let roomId = self?.roomId else { return } - let viewController = MemoryViewController(roomId: roomId) - self?.navigationController?.pushViewController(viewController, animated: true) - } - button.addAction(action, for: .touchUpInside) - button.setTitle(TextLiteral.memoryViewControllerTitleLabel, for: .normal) - button.setTitleColor(.white, for: .normal) - button.titleLabel?.font = .font(.regular, ofSize: 15) - button.backgroundColor = .darkGrey002 - button.makeBorderLayer(color: .white) - return button - }() - private let manitteeAnimationLabel: UILabel = { - let label = UILabel() - label.textColor = .white - label.alpha = 0 - label.font = .font(.regular, ofSize: 15) - return label - }() - private let manitiRealIconView: UIImageView = { - let imageView = UIImageView(image: ImageLiterals.imgMa) - imageView.alpha = 0 - return imageView - }() - private let manittoOpenButtonShadowView: UIView = { - let view = UIView() - view.backgroundColor = .mainRed - view.layer.masksToBounds = false - view.layer.cornerRadius = 30 - view.makeShadow(color: .shadowRed, opacity: 1.0, offset: CGSize(width: 0, height: 6), radius: 1) - view.isHidden = true - return view - }() - // FIXME: - 마니또 공개 API 확실히 하기 - private lazy var manittoOpenButton: MainButton = { - let button = MainButton() - let action = UIAction { [weak self] _ in - guard - let roomId = self?.roomId, - let manittoNickname = self?.manittoNickname - else { return } - let viewController = OpenManittoViewController(roomId: roomId, manittoNickname: manittoNickname) - viewController.modalTransitionStyle = .crossDissolve - viewController.modalPresentationStyle = .fullScreen - self?.present(viewController, animated: true) - } - button.addAction(action, for: .touchUpInside) - button.title = TextLiteral.detailIngViewControllerManitoOpenButton - return button - }() - private let badgeLabel: LetterCountBadgeView = { - let label = LetterCountBadgeView() - label.layer.cornerRadius = 15 - label.isHidden = true - return label - }() - private let exitButton: UIButton = { - let button = UIButton() - button.setImage(ImageLiterals.icMore, for: .normal) - button.showsMenuAsPrimaryAction = true - return button - }() - private let guideView: GuideView = GuideView(type: .detailing) + private let detailingView: DetailingView = DetailingView() // MARK: - init @@ -242,248 +37,52 @@ final class DetailingViewController: BaseViewController { // MARK: - life cycle - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - setupLargeTitleToOriginal() - requestRoomInfo() + override func loadView() { + self.view = self.detailingView } - override func setupLayout() { - view.addSubview(titleLabel) - titleLabel.snp.makeConstraints { - $0.top.equalTo(view.safeAreaLayoutGuide).inset(19) - $0.leading.equalTo(view.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) - } - - view.addSubview(periodLabel) - periodLabel.snp.makeConstraints { - $0.top.equalTo(titleLabel.snp.bottom).offset(12) - $0.leading.equalTo(view.safeAreaLayoutGuide).inset(24) - } - - view.addSubview(statusLabel) - statusLabel.snp.makeConstraints { - $0.centerY.equalTo(titleLabel.snp.centerY) - $0.leading.equalTo(titleLabel.snp.trailing).offset(6) - $0.width.equalTo(67) - $0.height.equalTo(23) - } - - view.addSubview(missionBackgroundView) - missionBackgroundView.snp.makeConstraints { - $0.top.equalTo(periodLabel.snp.bottom).offset(31) - $0.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) - $0.height.equalTo(100) - } - - missionBackgroundView.addSubview(missionTitleLabel) - missionTitleLabel.snp.makeConstraints{ - $0.top.equalTo(missionBackgroundView.snp.top).inset(12) - $0.centerX.equalTo(missionBackgroundView.snp.centerX) - } - - missionBackgroundView.addSubview(missionContentsLabel) - missionContentsLabel.snp.makeConstraints{ - $0.centerY.equalTo(missionTitleLabel.snp.bottom).offset(30) - $0.centerX.equalTo(missionBackgroundView.snp.centerX) - $0.leading.trailing.equalTo(missionBackgroundView).inset(12) - } - - view.addSubview(informationTitleLabel) - informationTitleLabel.snp.makeConstraints { - $0.top.equalTo(missionBackgroundView.snp.bottom).offset(44) - $0.leading.equalTo(view.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) - } - - view.addSubview(manitteeBackView) - manitteeBackView.snp.makeConstraints { - $0.top.equalTo(informationTitleLabel.snp.bottom).offset(31) - $0.leading.equalTo(view.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) - $0.trailing.equalTo(view.snp.centerX).offset(-14) - $0.height.equalTo((UIScreen.main.bounds.width-28-40)/2) - } - - manitteeBackView.addSubview(manitteeImageView) - manitteeImageView.snp.makeConstraints { - $0.top.equalTo(manitteeBackView.snp.top).inset(16) - $0.centerX.equalTo(manitteeBackView) - $0.width.height.equalTo(99) - } - - manitteeBackView.addSubview(manitteeIconView) - manitteeIconView.snp.makeConstraints { - $0.centerX.equalTo(manitteeImageView) - $0.centerY.equalTo(manitteeImageView.snp.centerY) - $0.width.height.equalTo(90) - } - - manitteeBackView.addSubview(manitteeLabel) - manitteeLabel.snp.makeConstraints { - $0.bottom.equalTo(manitteeBackView.snp.bottom).inset(15) - $0.centerX.equalTo(manitteeBackView) - } - - manitteeBackView.addSubview(manitteeAnimationLabel) - manitteeAnimationLabel.snp.makeConstraints { - $0.bottom.equalTo(manitteeBackView.snp.bottom).inset(15) - $0.centerX.equalTo(manitteeBackView) - } - - view.addSubview(listBackView) - listBackView.snp.makeConstraints { - $0.top.equalTo(informationTitleLabel.snp.bottom).offset(31) - $0.leading.equalTo(view.snp.centerX).offset(14) - $0.trailing.equalTo(view.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) - $0.height.equalTo((UIScreen.main.bounds.width-28-40)/2) - } - - listBackView.addSubview(listImageView) - listImageView.snp.makeConstraints { - $0.top.equalTo(listBackView.snp.top).inset(16) - $0.centerX.equalTo(listBackView) - $0.width.height.equalTo(99) - } - - listBackView.addSubview(listIconView) - listIconView.snp.makeConstraints { - $0.centerX.equalTo(listImageView) - $0.centerY.equalTo(listImageView.snp.centerY) - $0.width.height.equalTo(80) - } - - listBackView.addSubview(listLabel) - listLabel.snp.makeConstraints { - $0.bottom.equalTo(listBackView.snp.bottom).inset(15) - $0.centerX.equalTo(listBackView) - } - - view.addSubview(letterBoxButton) - letterBoxButton.snp.makeConstraints { - $0.top.equalTo(manitteeBackView.snp.bottom).offset(25) - $0.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) - $0.height.equalTo(80) - } - - view.addSubview(manittoMemoryButton) - manittoMemoryButton.snp.makeConstraints { - $0.top.equalTo(letterBoxButton.snp.bottom).offset(18) - $0.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) - $0.height.equalTo(80) - } - - view.addSubview(manittoOpenButtonShadowView) - manittoOpenButtonShadowView.snp.makeConstraints { - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalTo(view.safeAreaLayoutGuide).inset(7) - $0.centerX.equalToSuperview() - $0.height.equalTo(60) - } - - manittoOpenButtonShadowView.addSubview(manittoOpenButton) - manittoOpenButton.snp.makeConstraints { - $0.edges.equalToSuperview() - } - - view.addSubview(manitiRealIconView) - manitiRealIconView.snp.makeConstraints { - $0.top.equalTo(manitteeIconView.snp.top) - $0.trailing.equalTo(manitteeIconView.snp.trailing) - $0.leading.equalTo(manitteeIconView.snp.leading) - $0.bottom.equalTo(manitteeIconView.snp.bottom) - } - - view.addSubview(badgeLabel) - badgeLabel.snp.makeConstraints { - $0.centerX.equalToSuperview().offset(35) - $0.centerY.equalTo(letterBoxButton).offset(-10) - $0.width.height.equalTo(30) - } - - self.view.addSubview(self.guideView) - self.guideView.snp.makeConstraints { - $0.top.equalTo(self.missionBackgroundView.snp.top) - $0.trailing.equalTo(self.missionBackgroundView.snp.trailing) - } - self.guideView.setupGuideViewLayout() + override func viewDidLoad() { + super.viewDidLoad() + self.configureDelegation() + self.configureNavigationController() } - override func setupNavigationBar() { - super.setupNavigationBar() - let rightItem = makeBarButtonItem(with: exitButton) - navigationItem.rightBarButtonItem = rightItem - } - - override func endEditingView() { - self.guideView.didTapAroundToHideGuideView() + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + setupLargeTitleToOriginal() + self.requestRoomInfo() { [weak self] result in + switch result { + case .success(let roomInformation): + self?.detailingView.updateDetailingView(room: roomInformation) + case .failure: + print("error") + } + } } // MARK: - func - private func setupLargeTitleToOriginal() { - navigationController?.navigationBar.prefersLargeTitles = false - navigationController?.navigationItem.largeTitleDisplayMode = .never - } - - private func setupProcessingUI() { - missionBackgroundView.makeBorderLayer(color: .subOrange) - statusLabel.text = TextLiteral.doing - statusLabel.backgroundColor = .mainRed - manittoMemoryButton.isHidden = true - exitButton.isHidden = true + private func configureDelegation() { + self.detailingView.configureDelegation(self) } - private func setupPostUI() { - missionBackgroundView.makeBorderLayer(color: .darkGrey001) - statusLabel.text = TextLiteral.done - statusLabel.backgroundColor = .grey002 - manittoMemoryButton.isHidden = false - exitButton.isHidden = false - missionContentsLabel.attributedText = NSAttributedString(string: TextLiteral.detailIngViewControllerDoneMissionText) - } - - private func setupManittoOpenButton(date: String) { - guard let endDate = date.stringToDateYYYY() else { return } - manittoOpenButtonShadowView.isHidden = !(endDate.isOpenManitto) + private func configureNavigationController() { + guard let navigationController = self.navigationController else { return } + self.detailingView.configureNavigationItem(navigationController) } - private func setupBadge(count: Int) { - if count > 0 { - badgeLabel.isHidden = false - badgeLabel.countLabel.text = String(count) - } else { - badgeLabel.isHidden = true - } + private func setupLargeTitleToOriginal() { + navigationController?.navigationBar.prefersLargeTitles = false + navigationController?.navigationItem.largeTitleDisplayMode = .never } - + private func openManittee(manitteeName: String) { let viewController = SelectManitteeViewController(roomId: self.roomId, manitteeNickname: manitteeName) viewController.modalTransitionStyle = .crossDissolve viewController.modalPresentationStyle = .fullScreen present(viewController, animated: true) } - - private func setupExitButton(admin: Bool) { - if admin { - let menu = UIMenu(options: [], children: [ - UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in - self?.makeRequestAlert(title: TextLiteral.detailIngViewControllerDoneExitAlertAdminTitle, message: TextLiteral.detailIngViewControllerDoneExitAlertAdmin, okAction: { _ in - self?.requestDeleteRoom() - }) - }) - ]) - exitButton.menu = menu - } else { - let menu = UIMenu(options: [], children: [ - UIAction(title: TextLiteral.detailWaitViewControllerLeaveRoom, handler: { [weak self] _ in - self?.makeRequestAlert(title: TextLiteral.detailIngViewControllerDoneExitAlertTitle, message: TextLiteral.detailIngViewControllerDoneExitAlertMessage, okAction: { _ in - self?.requestExitRoom() - }) - }) - ]) - exitButton.menu = menu - } - } - + func pushNavigationAfterRequestRoomInfo() { Task { do { @@ -503,32 +102,7 @@ final class DetailingViewController: BaseViewController { } } } - - // MARK: - selector - - @objc - private func didTappedManittee() { - if !isTappedManittee { - self.isTappedManittee = true - UIView.animate(withDuration: 1.0) { - self.toggledManitteeAnimation(self.isTappedManittee) - } completion: { _ in - UIView.animate(withDuration: 1.0, delay: 0.5) { - self.toggledManitteeAnimation(!self.isTappedManittee) - } completion: { _ in - self.isTappedManittee = false - } - } - } - } - - private func toggledManitteeAnimation(_ value: Bool) { - manitteeLabel.alpha = value ? 0 : 1 - manitteeIconView.alpha = value ? 0 : 1 - manitiRealIconView.alpha = value ? 1 : 0 - manitteeAnimationLabel.alpha = value ? 1 : 0 - } - + // FIXME: - 추후 PR 때, friendslistViewController codebase로 만들 예정 @objc private func pushFriendListViewController(_ gesture: UITapGestureRecognizer) { @@ -541,46 +115,12 @@ final class DetailingViewController: BaseViewController { // MARK: - DetailStarting API - private func requestRoomInfo() { + private func requestRoomInfo(completionHandler: @escaping ((Result) -> Void)) { Task { do { let data = try await detailIngService.requestStartingRoomInfo(roomId: roomId) if let info = data { - guard let state = data?.roomInformation?.state, - let title = info.roomInformation?.title, - let startDate = info.roomInformation?.startDate, - let endDate = info.roomInformation?.endDate, - let manittee = info.manittee?.nickname, - let admin = info.admin, - let badgeCount = info.messages?.count - else { return } - - roomType = RoomType.init(rawValue: state) ?? .PROCESSING - missionId = info.mission?.id?.description ?? "" - - DispatchQueue.main.async { - self.titleLabel.text = title - self.periodLabel.text = "\(startDate.subStringToDate()) ~ \(endDate.subStringToDate())" - self.manitteeAnimationLabel.text = manittee - self.setupBadge(count: badgeCount) - - if self.roomType == .PROCESSING { - self.setupProcessingUI() - guard let missionContent = info.mission?.content, - let didView = info.didViewRoulette, - let manittoNickname = info.manitto?.nickname - else { return } - self.missionContentsLabel.attributedText = NSAttributedString(string: missionContent) - self.manittoNickname = manittoNickname - if !didView && !admin { - self.openManittee(manitteeName: manittee) - } - self.setupManittoOpenButton(date: endDate) - } else { - self.setupPostUI() - self.setupExitButton(admin: admin) - } - } + completionHandler(.success(info)) } } catch NetworkError.serverError { print("server Error") @@ -628,3 +168,33 @@ final class DetailingViewController: BaseViewController { } } +extension DetailingViewController: DetailingDelegate { + + func listBackDidTap() { + print("") + } + + func letterBoxDidTap() { + print("") + } + + func manittoMemoryButtonDidTap() { + print("") + } + + func manittoOpenButtonDidTap() { + print("") + } + + func deleteButtonDidTap() { + print("") + } + + func leaveButtonDidTap() { + print("") + } + + func didNotShowManitteeView(manitteeName: String) { + self.openManittee(manitteeName: manitteeName) + } +} diff --git a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift new file mode 100644 index 000000000..c6c5a3e4a --- /dev/null +++ b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift @@ -0,0 +1,503 @@ +// +// DetailingView.swift +// Manito +// +// Created by Mingwan Choi on 2023/06/19. +// + +import UIKit + +import SnapKit + +protocol DetailingDelegate: AnyObject { + func listBackDidTap() + func letterBoxDidTap() + func manittoMemoryButtonDidTap() + func manittoOpenButtonDidTap() + func deleteButtonDidTap() + func leaveButtonDidTap() + func didNotShowManitteeView(manitteeName: String) +} + +final class DetailingView: UIView { + + private enum RoomType: String { + case PROCESSING + case POST + } + + // MARK: - property + + private var isTappedManittee: Bool = false + private var missionId: String = "" + private var roomType: RoomType = .PROCESSING + private weak var delegate: DetailingDelegate? + + // MARK: - component + + private let titleLabel: UILabel = { + let label = UILabel() + label.textColor = .white + label.font = .font(.regular, ofSize: 34) + return label + }() + private let periodLabel: UILabel = { + let label = UILabel() + label.textColor = .grey002 + label.font = .font(.regular, ofSize: 16) + return label + }() + private let statusLabel: UILabel = { + let label = UILabel() + label.layer.masksToBounds = true + label.layer.cornerRadius = 11 + label.textColor = .white + label.font = .font(.regular, ofSize: 13) + label.textAlignment = .center + return label + }() + private let missionBackgroundView: UIView = { + var view = UIView() + view.backgroundColor = .darkGrey004 + return view + }() + private let missionTitleLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.individualMissionViewTitleLabel + label.textColor = .grey002 + label.font = .font(.regular, ofSize: 14) + return label + }() + private let missionContentsLabel: UILabel = { + let label = UILabel() + let paragraphStyle = NSMutableParagraphStyle() + paragraphStyle.lineBreakStrategy = .hangulWordPriority + let attributedText = NSAttributedString(string: "", attributes: [.paragraphStyle: paragraphStyle]) + label.attributedText = attributedText + label.textAlignment = .center + label.numberOfLines = 0 + label.textColor = .white + label.font = .font(.regular, ofSize: 18) + return label + }() + private let informationTitleLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.detailIngViewControllerDetailInformatioin + label.textColor = .white + label.font = .font(.regular, ofSize: 16) + return label + }() + private lazy var manitteeBackView: UIView = { + let view = UIView() + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.didTappedManittee)) + view.addGestureRecognizer(tapGesture) + view.backgroundColor = .darkGrey002 + view.makeBorderLayer(color: .white) + return view + }() + private let manitteeImageView: UIView = { + let view = UIView() + view.backgroundColor = .subOrange + view.layer.borderWidth = 1 + view.layer.borderColor = UIColor.grey005.cgColor + view.layer.cornerRadius = 49.5 + return view + }() + private let manitteeIconView = UIImageView(image: ImageLiterals.icManiTti) + private let manitteeLabel: UILabel = { + let label = UILabel() + label.text = "\(UserDefaultStorage.nickname)의 마니띠" + label.textColor = .white + label.font = .font(.regular, ofSize: 15) + return label + }() + private lazy var listBackView: UIView = { + let view = UIView() + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.didTappedListBack)) + view.addGestureRecognizer(tapGesture) + view.backgroundColor = .darkGrey002 + view.makeBorderLayer(color: .white) + return view + }() + private let listImageView: UIView = { + let view = UIView() + view.backgroundColor = .subPink + view.layer.borderWidth = 1 + view.layer.borderColor = UIColor.grey005.cgColor + view.layer.cornerRadius = 49.5 + return view + }() + private let listIconView = UIImageView(image: ImageLiterals.icList) + private let listLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.togetherFriend + label.textColor = .white + label.font = .font(.regular, ofSize: 15) + return label + }() + private lazy var letterBoxButton: UIButton = { + let button = UIButton(type: .system) + let action = UIAction { [weak self] _ in + self?.delegate?.letterBoxDidTap() + } + button.addAction(action, for: .touchUpInside) + button.setTitle(TextLiteral.letterViewControllerTitle, for: .normal) + button.setTitleColor(.white, for: .normal) + button.titleLabel?.font = .font(.regular, ofSize: 15) + button.backgroundColor = .darkGrey002 + button.makeBorderLayer(color: .white) + return button + }() + private lazy var manittoMemoryButton: UIButton = { + let button = UIButton(type: .system) + let action = UIAction { [weak self] _ in + self?.delegate?.manittoMemoryButtonDidTap() + } + button.addAction(action, for: .touchUpInside) + button.setTitle(TextLiteral.memoryViewControllerTitleLabel, for: .normal) + button.setTitleColor(.white, for: .normal) + button.titleLabel?.font = .font(.regular, ofSize: 15) + button.backgroundColor = .darkGrey002 + button.makeBorderLayer(color: .white) + return button + }() + private let manitteeAnimationLabel: UILabel = { + let label = UILabel() + label.textColor = .white + label.alpha = 0 + label.font = .font(.regular, ofSize: 15) + return label + }() + private let manitiRealIconView: UIImageView = { + let imageView = UIImageView(image: ImageLiterals.imgMa) + imageView.alpha = 0 + return imageView + }() + private let manittoOpenButtonShadowView: UIView = { + let view = UIView() + view.backgroundColor = .mainRed + view.layer.masksToBounds = false + view.layer.cornerRadius = 30 + view.makeShadow(color: .shadowRed, opacity: 1.0, offset: CGSize(width: 0, height: 6), radius: 1) + view.isHidden = true + return view + }() + // FIXME: - 마니또 공개 API 확실히 하기 + private lazy var manittoOpenButton: MainButton = { + let button = MainButton() + let action = UIAction { [weak self] _ in + self?.delegate?.manittoOpenButtonDidTap() + } + button.addAction(action, for: .touchUpInside) + button.title = TextLiteral.detailIngViewControllerManitoOpenButton + return button + }() + private let badgeLabel: LetterCountBadgeView = { + let label = LetterCountBadgeView() + label.layer.cornerRadius = 15 + label.isHidden = true + return label + }() + private let exitButton: UIButton = { + let button = UIButton() + button.setImage(ImageLiterals.icMore, for: .normal) + button.showsMenuAsPrimaryAction = true + return button + }() + private let guideView: GuideView = GuideView(type: .detailing) + + override init(frame: CGRect) { + super.init(frame: frame) + self.setupLayout() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - func + + private func setupLayout() { + self.addSubview(self.titleLabel) + self.titleLabel.snp.makeConstraints { + $0.top.equalToSuperview().offset(100) + $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) + } + + self.addSubview(self.periodLabel) + self.periodLabel.snp.makeConstraints { + $0.top.equalTo(self.titleLabel.snp.bottom).offset(12) + $0.leading.equalToSuperview().inset(24) + } + + self.addSubview(self.statusLabel) + self.statusLabel.snp.makeConstraints { + $0.centerY.equalTo(self.titleLabel.snp.centerY) + $0.leading.equalTo(self.titleLabel.snp.trailing).offset(6) + $0.width.equalTo(67) + $0.height.equalTo(23) + } + + self.addSubview(self.missionBackgroundView) + self.missionBackgroundView.snp.makeConstraints { + $0.top.equalTo(self.periodLabel.snp.bottom).offset(31) + $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.height.equalTo(100) + } + + self.missionBackgroundView.addSubview(self.missionTitleLabel) + self.missionTitleLabel.snp.makeConstraints{ + $0.top.equalTo(self.missionBackgroundView.snp.top).inset(12) + $0.centerX.equalTo(self.missionBackgroundView.snp.centerX) + } + + self.missionBackgroundView.addSubview(self.missionContentsLabel) + self.missionContentsLabel.snp.makeConstraints{ + $0.centerY.equalTo(self.missionTitleLabel.snp.bottom).offset(30) + $0.centerX.equalTo(self.missionBackgroundView.snp.centerX) + $0.leading.trailing.equalTo(self.missionBackgroundView).inset(12) + } + + self.addSubview(self.informationTitleLabel) + self.informationTitleLabel.snp.makeConstraints { + $0.top.equalTo(self.missionBackgroundView.snp.bottom).offset(44) + $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) + } + + self.addSubview(self.manitteeBackView) + self.manitteeBackView.snp.makeConstraints { + $0.top.equalTo(self.informationTitleLabel.snp.bottom).offset(31) + $0.leading.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.trailing.equalTo(self.snp.centerX).offset(-14) + $0.height.equalTo((UIScreen.main.bounds.width - 28 - 40) / 2) + } + + self.manitteeBackView.addSubview(self.manitteeImageView) + self.manitteeImageView.snp.makeConstraints { + $0.top.equalTo(self.manitteeBackView.snp.top).inset(16) + $0.centerX.equalTo(self.manitteeBackView) + $0.width.height.equalTo(99) + } + + self.manitteeBackView.addSubview(self.manitteeIconView) + self.manitteeIconView.snp.makeConstraints { + $0.centerX.equalTo(self.manitteeImageView) + $0.centerY.equalTo(self.manitteeImageView.snp.centerY) + $0.width.height.equalTo(90) + } + + self.manitteeBackView.addSubview(self.manitteeLabel) + self.manitteeLabel.snp.makeConstraints { + $0.bottom.equalTo(self.manitteeBackView.snp.bottom).inset(15) + $0.centerX.equalTo(self.manitteeBackView) + } + + self.manitteeBackView.addSubview(self.manitteeAnimationLabel) + self.manitteeAnimationLabel.snp.makeConstraints { + $0.bottom.equalTo(self.manitteeBackView.snp.bottom).inset(15) + $0.centerX.equalTo(self.manitteeBackView) + } + + self.addSubview(self.listBackView) + self.listBackView.snp.makeConstraints { + $0.top.equalTo(self.informationTitleLabel.snp.bottom).offset(31) + $0.leading.equalTo(self.snp.centerX).offset(14) + $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.height.equalTo((UIScreen.main.bounds.width - 28 - 40) / 2) + } + + self.listBackView.addSubview(self.listImageView) + self.listImageView.snp.makeConstraints { + $0.top.equalTo(self.listBackView.snp.top).inset(16) + $0.centerX.equalTo(self.listBackView) + $0.width.height.equalTo(99) + } + + self.listBackView.addSubview(self.listIconView) + self.listIconView.snp.makeConstraints { + $0.centerX.equalTo(self.listImageView) + $0.centerY.equalTo(self.listImageView.snp.centerY) + $0.width.height.equalTo(80) + } + + self.listBackView.addSubview(self.listLabel) + self.listLabel.snp.makeConstraints { + $0.bottom.equalTo(self.listBackView.snp.bottom).inset(15) + $0.centerX.equalTo(self.listBackView) + } + + self.addSubview(self.letterBoxButton) + self.letterBoxButton.snp.makeConstraints { + $0.top.equalTo(self.manitteeBackView.snp.bottom).offset(25) + $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.height.equalTo(80) + } + + self.addSubview(self.manittoMemoryButton) + self.manittoMemoryButton.snp.makeConstraints { + $0.top.equalTo(self.letterBoxButton.snp.bottom).offset(18) + $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.height.equalTo(80) + } + + self.addSubview(self.manittoOpenButtonShadowView) + self.manittoOpenButtonShadowView.snp.makeConstraints { + $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.bottom.equalToSuperview().inset(7) + $0.centerX.equalToSuperview() + $0.height.equalTo(60) + } + + self.manittoOpenButtonShadowView.addSubview(self.manittoOpenButton) + self.manittoOpenButton.snp.makeConstraints { + $0.edges.equalToSuperview() + } + + self.addSubview(self.manitiRealIconView) + self.manitiRealIconView.snp.makeConstraints { + $0.top.equalTo(self.manitteeIconView.snp.top) + $0.trailing.equalTo(self.manitteeIconView.snp.trailing) + $0.leading.equalTo(self.manitteeIconView.snp.leading) + $0.bottom.equalTo(self.manitteeIconView.snp.bottom) + } + + self.addSubview(self.badgeLabel) + self.badgeLabel.snp.makeConstraints { + $0.centerX.equalToSuperview().offset(35) + $0.centerY.equalTo(letterBoxButton).offset(-10) + $0.width.height.equalTo(30) + } + + self.addSubview(self.guideView) + self.guideView.snp.makeConstraints { + $0.top.equalTo(self.missionBackgroundView.snp.top) + $0.trailing.equalTo(self.missionBackgroundView.snp.trailing) + } + self.guideView.setupGuideViewLayout() + } + + func configureDelegation(_ delegate: DetailingDelegate) { + self.delegate = delegate + } + + func configureNavigationItem(_ navigationController: UINavigationController) { + let navigationItem = navigationController.topViewController?.navigationItem + let exitButton = UIBarButtonItem(customView: self.exitButton) + + navigationItem?.rightBarButtonItem = exitButton + } + + func updateDetailingView(room: Room) { + guard let state = room.roomInformation?.state, + let title = room.roomInformation?.title, + let startDate = room.roomInformation?.startDate, + let endDate = room.roomInformation?.endDate, + let manittee = room.manittee?.nickname, + let admin = room.admin, + let badgeCount = room.messages?.count + else { return } + self.roomType = RoomType.init(rawValue: state) ?? .PROCESSING + self.missionId = room.mission?.id?.description ?? "" + DispatchQueue.main.async { + self.titleLabel.text = title + self.periodLabel.text = "\(startDate.subStringToDate()) ~ \(endDate.subStringToDate())" + self.manitteeAnimationLabel.text = manittee + self.setupBadge(count: badgeCount) + + if self.roomType == .PROCESSING { + self.setupProcessingUI() + guard let missionContent = room.mission?.content, + let didView = room.didViewRoulette + else { return } + self.missionContentsLabel.attributedText = NSAttributedString(string: missionContent) + if !didView && !admin { + self.delegate?.didNotShowManitteeView(manitteeName: manittee) + } + self.setupManittoOpenButton(date: endDate) + } else { + self.setupPostUI() + self.setupExitButton(admin: admin) + } + } + } + + private func setupExitButton(admin: Bool) { + if admin { + let menu = UIMenu(options: [], children: [ + UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in + self?.delegate?.deleteButtonDidTap() + }) + ]) + exitButton.menu = menu + } else { + let menu = UIMenu(options: [], children: [ + UIAction(title: TextLiteral.detailWaitViewControllerLeaveRoom, handler: { [weak self] _ in + self?.delegate?.leaveButtonDidTap() + }) + ]) + exitButton.menu = menu + } + } + + private func setupBadge(count: Int) { + if count > 0 { + badgeLabel.isHidden = false + badgeLabel.countLabel.text = String(count) + } else { + badgeLabel.isHidden = true + } + } + + private func setupProcessingUI() { + self.missionBackgroundView.makeBorderLayer(color: .subOrange) + self.statusLabel.text = TextLiteral.doing + self.statusLabel.backgroundColor = .mainRed + self.manittoMemoryButton.isHidden = true + self.exitButton.isHidden = true + } + + private func setupPostUI() { + self.missionBackgroundView.makeBorderLayer(color: .darkGrey001) + self.statusLabel.text = TextLiteral.done + self.statusLabel.backgroundColor = .grey002 + self.manittoMemoryButton.isHidden = false + self.exitButton.isHidden = false + self.missionContentsLabel.attributedText = NSAttributedString(string: TextLiteral.detailIngViewControllerDoneMissionText) + } + + private func setupManittoOpenButton(date: String) { + guard let endDate = date.stringToDateYYYY() else { return } + self.manittoOpenButtonShadowView.isHidden = !(endDate.isOpenManitto) + } + + private func toggledManitteeAnimation(_ value: Bool) { + manitteeLabel.alpha = value ? 0 : 1 + manitteeIconView.alpha = value ? 0 : 1 + manitiRealIconView.alpha = value ? 1 : 0 + manitteeAnimationLabel.alpha = value ? 1 : 0 + } + + // MARK: - selector + + @objc + private func didTappedListBack() { + self.delegate?.listBackDidTap() + } + + @objc + private func didTappedManittee() { + if !isTappedManittee { + self.isTappedManittee = true + UIView.animate(withDuration: 1.0) { + self.toggledManitteeAnimation(self.isTappedManittee) + } completion: { _ in + UIView.animate(withDuration: 1.0, delay: 0.5) { + self.toggledManitteeAnimation(!self.isTappedManittee) + } completion: { _ in + self.isTappedManittee = false + } + } + } + } +} From 09f8d009bc93df405c4e5a86d4f10dbe4a63c26f Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 15:46:21 +0900 Subject: [PATCH 157/468] =?UTF-8?q?[CHORE]=20self=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Ing/DetailingViewController.swift | 20 ++++++++++--------- .../Detail-Ing/View/DetailingView.swift | 18 ++++++++--------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index f0538549d..be01eb95f 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -11,12 +11,14 @@ import SnapKit final class DetailingViewController: BaseViewController { + // MARK: - property + private let detailIngService: DetailIngAPI = DetailIngAPI(apiService: APIService()) private let detailDoneService: DetailDoneAPI = DetailDoneAPI(apiService: APIService()) private let roomId: String private var missionId: String = "" - - // MARK: - property + + // MARK: - component private let detailingView: DetailingView = DetailingView() @@ -27,6 +29,7 @@ final class DetailingViewController: BaseViewController { super.init() } + @available(*, unavailable) required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } @@ -49,7 +52,7 @@ final class DetailingViewController: BaseViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - setupLargeTitleToOriginal() + self.setupLargeTitleToOriginal() self.requestRoomInfo() { [weak self] result in switch result { case .success(let roomInformation): @@ -72,21 +75,21 @@ final class DetailingViewController: BaseViewController { } private func setupLargeTitleToOriginal() { - navigationController?.navigationBar.prefersLargeTitles = false - navigationController?.navigationItem.largeTitleDisplayMode = .never + self.navigationController?.navigationBar.prefersLargeTitles = false + self.navigationController?.navigationItem.largeTitleDisplayMode = .never } private func openManittee(manitteeName: String) { let viewController = SelectManitteeViewController(roomId: self.roomId, manitteeNickname: manitteeName) viewController.modalTransitionStyle = .crossDissolve viewController.modalPresentationStyle = .fullScreen - present(viewController, animated: true) + self.present(viewController, animated: true) } func pushNavigationAfterRequestRoomInfo() { Task { do { - let data = try await detailIngService.requestStartingRoomInfo(roomId: roomId) + let data = try await detailIngService.requestStartingRoomInfo(roomId: self.roomId) if let info = data { guard let state = info.roomInformation?.state, let mission = info.mission?.content, @@ -102,8 +105,7 @@ final class DetailingViewController: BaseViewController { } } } - - // FIXME: - 추후 PR 때, friendslistViewController codebase로 만들 예정 + @objc private func pushFriendListViewController(_ gesture: UITapGestureRecognizer) { let storyboard = UIStoryboard(name: "DetailIng", bundle: nil) diff --git a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift index c6c5a3e4a..db54dff51 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift @@ -429,23 +429,23 @@ final class DetailingView: UIView { self?.delegate?.deleteButtonDidTap() }) ]) - exitButton.menu = menu + self.exitButton.menu = menu } else { let menu = UIMenu(options: [], children: [ UIAction(title: TextLiteral.detailWaitViewControllerLeaveRoom, handler: { [weak self] _ in self?.delegate?.leaveButtonDidTap() }) ]) - exitButton.menu = menu + self.exitButton.menu = menu } } private func setupBadge(count: Int) { if count > 0 { - badgeLabel.isHidden = false - badgeLabel.countLabel.text = String(count) + self.badgeLabel.isHidden = false + self.badgeLabel.countLabel.text = String(count) } else { - badgeLabel.isHidden = true + self.badgeLabel.isHidden = true } } @@ -472,10 +472,10 @@ final class DetailingView: UIView { } private func toggledManitteeAnimation(_ value: Bool) { - manitteeLabel.alpha = value ? 0 : 1 - manitteeIconView.alpha = value ? 0 : 1 - manitiRealIconView.alpha = value ? 1 : 0 - manitteeAnimationLabel.alpha = value ? 1 : 0 + self.manitteeLabel.alpha = value ? 0 : 1 + self.manitteeIconView.alpha = value ? 0 : 1 + self.manitiRealIconView.alpha = value ? 1 : 0 + self.manitteeAnimationLabel.alpha = value ? 1 : 0 } // MARK: - selector From f4060eebe0b9553023f4ebba74cfcc53558a6129 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 16:06:43 +0900 Subject: [PATCH 158/468] =?UTF-8?q?[CHORE]=20network=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Ing/DetailingViewController.swift | 79 +++++++++++-------- 1 file changed, 47 insertions(+), 32 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index be01eb95f..b82075650 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -85,29 +85,8 @@ final class DetailingViewController: BaseViewController { viewController.modalPresentationStyle = .fullScreen self.present(viewController, animated: true) } - - func pushNavigationAfterRequestRoomInfo() { - Task { - do { - let data = try await detailIngService.requestStartingRoomInfo(roomId: self.roomId) - if let info = data { - guard let state = info.roomInformation?.state, - let mission = info.mission?.content, - let missionId = info.mission?.id - else { return } - let viewController = LetterViewController(roomState: state, - roomId: self.roomId, - mission: mission, - missionId: missionId.description, - entryPoint: .notification) - self.navigationController?.pushViewController(viewController, animated: true) - } - } - } - } - @objc - private func pushFriendListViewController(_ gesture: UITapGestureRecognizer) { + private func pushFriendListViewController() { let storyboard = UIStoryboard(name: "DetailIng", bundle: nil) guard let viewController = storyboard.instantiateViewController(withIdentifier: FriendListViewController.className) as? FriendListViewController else { return } guard let roomId = Int(roomId) else { return } @@ -115,7 +94,7 @@ final class DetailingViewController: BaseViewController { self.navigationController?.pushViewController(viewController, animated: true) } - // MARK: - DetailStarting API + // MARK: - network private func requestRoomInfo(completionHandler: @escaping ((Result) -> Void)) { Task { @@ -134,12 +113,33 @@ final class DetailingViewController: BaseViewController { } } - private func requestExitRoom() { + func pushNavigationAfterRequestRoomInfo() { + Task { + do { + let data = try await detailIngService.requestStartingRoomInfo(roomId: self.roomId) + if let info = data { + guard let state = info.roomInformation?.state, + let mission = info.mission?.content, + let missionId = info.mission?.id + else { return } + let viewController = LetterViewController(roomState: state, + roomId: self.roomId, + mission: mission, + missionId: missionId.description, + entryPoint: .notification) + self.navigationController?.pushViewController(viewController, animated: true) + } + } + } + } + + private func requestExitRoom(completionHandler: @escaping ((Result) -> Void)) { Task { do { let statusCode = try await detailDoneService.requestExitRoom(roomId: roomId) - if statusCode == 204 { - navigationController?.popViewController(animated: true) + switch statusCode { + case 200..<300: completionHandler(.success(())) + default: completionHandler(.failure(.unknownError)) } } catch NetworkError.serverError { print("server Error") @@ -152,12 +152,13 @@ final class DetailingViewController: BaseViewController { } } - private func requestDeleteRoom() { + private func requestDeleteRoom(completionHandler: @escaping ((Result) -> Void)) { Task { do { let statusCode = try await detailDoneService.requestDeleteRoom(roomId: roomId) - if statusCode == 204 { - navigationController?.popViewController(animated: true) + switch statusCode { + case 200..<300: completionHandler(.success(())) + default: completionHandler(.failure(.unknownError)) } } catch NetworkError.serverError { print("server Error") @@ -173,7 +174,7 @@ final class DetailingViewController: BaseViewController { extension DetailingViewController: DetailingDelegate { func listBackDidTap() { - print("") + self.pushFriendListViewController() } func letterBoxDidTap() { @@ -189,11 +190,25 @@ extension DetailingViewController: DetailingDelegate { } func deleteButtonDidTap() { - print("") + self.requestDeleteRoom() { [weak self] result in + switch result { + case .success: + self?.navigationController?.popViewController(animated: true) + case .failure: + print("error") + } + } } func leaveButtonDidTap() { - print("") + self.requestExitRoom() { [weak self] result in + switch result { + case .success: + self?.navigationController?.popViewController(animated: true) + case .failure: + print("error") + } + } } func didNotShowManitteeView(manitteeName: String) { From 74a69aa71e072c519acc8259cf1a14715d362357 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 16:19:43 +0900 Subject: [PATCH 159/468] =?UTF-8?q?[CHORE]=20=EC=AA=BD=EC=A7=80=ED=95=A8?= =?UTF-8?q?=20delegate=20=EC=88=98=EC=A0=95=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Ing/DetailingViewController.swift | 11 +++++++++-- .../Screens/Detail-Ing/View/DetailingView.swift | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index b82075650..8578d38f4 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -177,8 +177,15 @@ extension DetailingViewController: DetailingDelegate { self.pushFriendListViewController() } - func letterBoxDidTap() { - print("") + func letterBoxDidTap(type: String, + mission: String, + missionId: String) { + let letterViewController = LetterViewController(roomState: type, + roomId: self.roomId, + mission: mission, + missionId: missionId, + entryPoint: .detail) + self.navigationController?.pushViewController(letterViewController, animated: true) } func manittoMemoryButtonDidTap() { diff --git a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift index db54dff51..5d85e28ea 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift @@ -11,7 +11,9 @@ import SnapKit protocol DetailingDelegate: AnyObject { func listBackDidTap() - func letterBoxDidTap() + func letterBoxDidTap(type: String, + mission: String, + missionId: String) func manittoMemoryButtonDidTap() func manittoOpenButtonDidTap() func deleteButtonDidTap() @@ -138,7 +140,12 @@ final class DetailingView: UIView { private lazy var letterBoxButton: UIButton = { let button = UIButton(type: .system) let action = UIAction { [weak self] _ in - self?.delegate?.letterBoxDidTap() + guard let roomType = self?.roomType, + let mission = self?.missionContentsLabel.text + else { return } + self?.delegate?.letterBoxDidTap(type: roomType.rawValue, + mission: mission, + missionId: self?.missionId ?? "") } button.addAction(action, for: .touchUpInside) button.setTitle(TextLiteral.letterViewControllerTitle, for: .normal) From b523578f668dfc937982b83fa36f2eca5680161b Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 16:30:29 +0900 Subject: [PATCH 160/468] =?UTF-8?q?[CHORE]=20delegate=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84=EB=B6=80=20=EC=A0=95=EB=A6=AC=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Ing/DetailingViewController.swift | 11 +++++++---- .../Screens/Detail-Ing/View/DetailingView.swift | 10 +++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index 8578d38f4..1810ae745 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -172,7 +172,6 @@ final class DetailingViewController: BaseViewController { } extension DetailingViewController: DetailingDelegate { - func listBackDidTap() { self.pushFriendListViewController() } @@ -189,11 +188,15 @@ extension DetailingViewController: DetailingDelegate { } func manittoMemoryButtonDidTap() { - print("") + let viewController = MemoryViewController(roomId: self.roomId) + self.navigationController?.pushViewController(viewController, animated: true) } - func manittoOpenButtonDidTap() { - print("") + func manittoOpenButtonDidTap(nickname: String) { + let viewController = OpenManittoViewController(roomId: self.roomId, manittoNickname: nickname) + viewController.modalTransitionStyle = .crossDissolve + viewController.modalPresentationStyle = .fullScreen + self.present(viewController, animated: true) } func deleteButtonDidTap() { diff --git a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift index 5d85e28ea..2dc3393b8 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift @@ -15,7 +15,7 @@ protocol DetailingDelegate: AnyObject { mission: String, missionId: String) func manittoMemoryButtonDidTap() - func manittoOpenButtonDidTap() + func manittoOpenButtonDidTap(nickname: String) func deleteButtonDidTap() func leaveButtonDidTap() func didNotShowManitteeView(manitteeName: String) @@ -32,6 +32,7 @@ final class DetailingView: UIView { private var isTappedManittee: Bool = false private var missionId: String = "" + private var manittoNickname: String = "" private var roomType: RoomType = .PROCESSING private weak var delegate: DetailingDelegate? @@ -193,7 +194,8 @@ final class DetailingView: UIView { private lazy var manittoOpenButton: MainButton = { let button = MainButton() let action = UIAction { [weak self] _ in - self?.delegate?.manittoOpenButtonDidTap() + guard let manittoNickname = self?.manittoNickname else { return } + self?.delegate?.manittoOpenButtonDidTap(nickname: manittoNickname) } button.addAction(action, for: .touchUpInside) button.title = TextLiteral.detailIngViewControllerManitoOpenButton @@ -415,9 +417,11 @@ final class DetailingView: UIView { if self.roomType == .PROCESSING { self.setupProcessingUI() guard let missionContent = room.mission?.content, - let didView = room.didViewRoulette + let didView = room.didViewRoulette, + let manittoNickname = room.manitto?.nickname else { return } self.missionContentsLabel.attributedText = NSAttributedString(string: missionContent) + self.manittoNickname = manittoNickname if !didView && !admin { self.delegate?.didNotShowManitteeView(manitteeName: manittee) } From b45d48be9dbc07e31e7ea4f92a81759babc1344e Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 17:06:02 +0900 Subject: [PATCH 161/468] =?UTF-8?q?[ADD]=20=EC=97=B0=ED=95=84=20=EC=95=84?= =?UTF-8?q?=EC=9D=B4=EC=BD=98=20=EC=B6=94=EA=B0=80=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Literal/ImageLiteral.swift | 1 + .../ic_pencil.imageset/Contents.json | 12 ++++++++++++ .../ic_pencil.imageset/ic_pencil.pdf | Bin 0 -> 7696 bytes .../Screens/Detail-Ing/View/DetailingView.swift | 16 ++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 Manito/Manito/Global/Resource/Assets.xcassets/ic_pencil.imageset/Contents.json create mode 100644 Manito/Manito/Global/Resource/Assets.xcassets/ic_pencil.imageset/ic_pencil.pdf diff --git a/Manito/Manito/Global/Literal/ImageLiteral.swift b/Manito/Manito/Global/Literal/ImageLiteral.swift index bb0f721df..3cc3e1a37 100644 --- a/Manito/Manito/Global/Literal/ImageLiteral.swift +++ b/Manito/Manito/Global/Literal/ImageLiteral.swift @@ -22,6 +22,7 @@ enum ImageLiterals { static var icMissionInfo: UIImage { .load(name: "ic_missionInfo")} static var icRight: UIImage { .load(name: "ic_right")} static var icSave: UIImage { .load(name: "ic_save")} + static var icPencil: UIImage { .load(name: "ic_pencil") } // MARK: - button diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_pencil.imageset/Contents.json b/Manito/Manito/Global/Resource/Assets.xcassets/ic_pencil.imageset/Contents.json new file mode 100644 index 000000000..fbfbe7756 --- /dev/null +++ b/Manito/Manito/Global/Resource/Assets.xcassets/ic_pencil.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "007aff 2.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_pencil.imageset/ic_pencil.pdf b/Manito/Manito/Global/Resource/Assets.xcassets/ic_pencil.imageset/ic_pencil.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8bc341f5ac8f085a021f5168eaafc2053f50c080 GIT binary patch literal 7696 zcmc&(d010d7XK7ke8@7D03V7zW-1EE61GHT5pb6s5d&Bzzyl(X#3UdTg(9T3v{F7T zk%~f5D^gJ`$W{Lcf@L2lAh4N(Nt+Dh-Vv^{} z;BmbPjvFhM&0-Qv9!{P7;Z86kc~Q7EsP&yBZ6O$uQ9Rt5I>i&f2uCc6Z#Py9i{r

n`T+B)8@>v`bVxT*We=^8FpR?@D`i39uoC3&>TT(N=kKTVV^xdra zq~?di!3{s)%BE*a2CFl^cfoeJhdklR6*)Bpn4S&rDGL2b`=;4k48A^=>oUA%kE&SL zQ(4@5&M-ZQN=nZ^9k0z4@6b-pYR`@JCprgu={`L(}$nw8qbRjst&bKKijlJm~S zFA}Ay0~w6Qz=j`8O`FP`69U|WT2Oizd1KdVLfcDslCNZJ8|u^QA~g%jGrsrVaXd0b zaxtf(*x$Y6)P0AMw0#Yii3_3cqRC%gYj)N=n$&#$oULfQXE!;Pc7CP_Z7_E&Ny4P5 z3-K6u0b7DrmwB{{emcAoNZBd_*J=oJwX{p{0_8o936;glbnS{_WwHMbgId)AK{>ui z2(Q|VZD}uh9+m2*yR^a!yp=4g4Qe@Pr3NpFsi{U++P=m>Z52AaW*9BbQ2|Am5HHTz ziBg;fte}6VyV+Ur0eJu#%+8XU!3wegL{f7G1N0y*K+Iq?*s6hG$thnTHe3!hNC%z( z9~1C7G?1(z1fKKfbkbdRkuT(c)a&L{j$ejYiscLdb z$WN5YV#k$tR#}OXQFO4jF}-JPTFC!2on2y~!-y;)S@X?;b0VEl$grmQ>O+01C@2@K zm`%?cLsEv{d{%MDJVZgtrPMK zUv6t`cUu}F7B=tyg6KEOEMbcob@xl93UwWgO(cuj8@+)oQVy4|4#+7eztR~j76Pgg zv6d9DYLFjIn>AYndk|~ynoblgNG!zkG<`oOVo}Xex1i994X9#g%}4c56^$cxII92NHprX{ zwgAX<({ZXVShPDI%E>Q|A9SKzw1BShD7@^#K8(9x(0c=dl8(R|f7P4d>4e;kE z8rQI0h_njI0ao)OCsd9j_vnr7fSjVT6eSPj$|WKez_GWjKGhh-^b2MIy8ynYcr}Fx z4bvpE9t$HiCc{5Kacmssji^0StE`L|s~o&=&Rp zI>KJIqz-Tyf&SbGHt--humeKKU&=N$Rmd~!ZxE$ySNxy-{tIAe+CJ@Meuc}hYO?9evgA(ooO`-V-OepeMr&h@}Rde3lk9P`--jKnPGAA9>bSGvTQuJT6 zbidXc9;jO<8rSt~Doe?lKh(z(KX4dPHL?1wBvQ8Kn>EF&W*;=0cz@`^Pdkk zzMEZVb*|~}Bpg!IavQ2vdz4Z%#I_E-uoy%sB{VY9&>xVl0|#$ zZRXXDHRf#^RZ*2IYUb(nSABEL=Nt>T%^$R8Ic&3>x zMjd?dKA9q^zdMxzU%e3nNAvD(&q1F!j5LGB#1&wpi(QQ-t_iPT5M8Be@XH(+ICcZ&PylW{pjG`dgUx z>H&gWM{-tYjPAwNl%!Bxu1N3k1J{T@IB7wownk-Y`G+9(<5{$HksAczaci}(*9gKg z4%ZbAX+xlktv`|^szK-rKifF$kPgX6zw^ia%UmHnay9o_>$42gI_`LU<61D@dggZ> z8@FynVYL(}=RMo`;lrmW4~Bs~3}$x1?%(Oh!nRc@<3D=oc)11hXa>5N|Km7Udn{$M zkAueEdjw}*2W0YCm6fIki3@>v8JAOIz2!4zlY=}1ZXge;h|foY~aWyI7txTT2N-r09PhfRa| z;g*$z3JI8>rlz`#g~#G%#}w6{tS{yrTZCl8*qf z4;35zV4!QC~5&*-WBCtka zD~IFLC;2k!*by&gyoRRbon;132hT-mwMIo*PXfv2IW_qW&J`W z%uA(m-X?R2t*oQC@K#A${ zIQx}c$G+MM`#sk7bXX<*r?8{0>JFsR#z76WA8#7-brVd(k3CtU{r68iFmuU{TNXDd z_=DxSI#APDyE9qq&pF$hTn5CgS=#-ccS?+JRBEAX{F=IXs8dlGIQ>=1Tr@(8ehOgo z-!)(VWfun^_Y^JX&OXN*IcPz0%UI(Z9tvP1|TWC?fDHA}^o42-L=|A_# zP;_t7c+cq4Bj(qgc$4;iM%Q2Va9oL&U>y4k$0>BcnLJLB?Z}Gbl%0Z%j#HEOL9!d7 zU1S`cwS3|B1zo^Qoxki~5tzILqD(SQUDHfn?!Xxcck{z$e1&nby%^cTO7`GZQv-9w z=;!|wzrtcM#h6T;5{<>C$J3*j8B~Q(%(VP3(Pm0VVF4HuxvH?EkWdVM?H~AR2?^Z5 z!hArF5B3Waf^sIG5NnE!BE3`v70rhWlgZ+7@gQ^whHmKOw|3ssw{spuID_uWN`PB4 zgd0C-1Zf|F2V}}EM@<9gBgEJ>dHr96F>1!k^obg{F+1uMgeqJL{Ul+8e*uZSQ z!bP#NhaA2}`k5fb+WvKm6dUk+N|48)Ghzr1hSIxr10;79mlaEx;HwznCh` Date: Mon, 19 Jun 2023 17:07:39 +0900 Subject: [PATCH 162/468] =?UTF-8?q?[CHORE]=20=EC=97=B0=ED=95=84=20?= =?UTF-8?q?=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=88=98=EC=A0=95=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resource/Assets.xcassets/ic_pencil.imageset/Contents.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_pencil.imageset/Contents.json b/Manito/Manito/Global/Resource/Assets.xcassets/ic_pencil.imageset/Contents.json index fbfbe7756..8fca61360 100644 --- a/Manito/Manito/Global/Resource/Assets.xcassets/ic_pencil.imageset/Contents.json +++ b/Manito/Manito/Global/Resource/Assets.xcassets/ic_pencil.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "007aff 2.pdf", + "filename" : "ic_pencil.pdf", "idiom" : "universal" } ], From 516275ecff7810352df06ffe20da3d76d4241474 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 17:21:08 +0900 Subject: [PATCH 163/468] =?UTF-8?q?[ADD]=20=EB=AF=B8=EC=85=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20ActionSheet=20=EC=B6=94=EA=B0=80=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Literal/TextLiteral.swift | 3 +++ .../Screens/Detail-Ing/DetailingViewController.swift | 9 +++++++++ .../Manito/Screens/Detail-Ing/View/DetailingView.swift | 7 ++++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Global/Literal/TextLiteral.swift b/Manito/Manito/Global/Literal/TextLiteral.swift index 56ae17569..d86913e04 100644 --- a/Manito/Manito/Global/Literal/TextLiteral.swift +++ b/Manito/Manito/Global/Literal/TextLiteral.swift @@ -161,6 +161,9 @@ enum TextLiteral { static let detailIngViewControllerDoneExitAlertMessage: String = "나간 방은 다시 들어올 수 없어요" static let detailIngViewControllerDoneExitAlertAdmin: String = "방장이 방을 삭제하면\n 참여자들의 방도 삭제됩니다" static let detailIngViewControllerDetailInformatioin: String = "진행 정보" + static let detailIngViewControllerMissionEditTitle: String = "개별 미션 설정" + static let detailIngViewControllerSelfEditMissionTitle: String = "개별 미션 직접 설정" + static let detailIngViewControllerResetMissionTitle: String = "기본 미션으로 변경" // MARK: - CalendarView static let calendarViewAlertMaxTitle: String = "최대 선택 기간을 넘었어요" diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index 1810ae745..35bb6cc68 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -172,6 +172,15 @@ final class DetailingViewController: BaseViewController { } extension DetailingViewController: DetailingDelegate { + func editMissionButtonDidTap() { + self.makeActionSheet(title: TextLiteral.detailIngViewControllerMissionEditTitle, + actionTitles: [ + TextLiteral.detailIngViewControllerSelfEditMissionTitle, + TextLiteral.detailIngViewControllerResetMissionTitle, + TextLiteral.cancel], + actionStyle: [.default, .default, .cancel], actions: [nil, nil, nil]) + } + func listBackDidTap() { self.pushFriendListViewController() } diff --git a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift index a2347834f..4fff3e176 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift @@ -10,6 +10,7 @@ import UIKit import SnapKit protocol DetailingDelegate: AnyObject { + func editMissionButtonDidTap() func listBackDidTap() func letterBoxDidTap(type: String, mission: String, @@ -71,10 +72,10 @@ final class DetailingView: UIView { label.font = .font(.regular, ofSize: 14) return label }() - private let pencilButton: UIButton = { + private lazy var pencilButton: UIButton = { let button = UIButton(type: .system) - let action = UIAction { _ in - print("pencil") + let action = UIAction { [weak self] _ in + self?.delegate?.editMissionButtonDidTap() } button.addAction(action, for: .touchUpInside) button.setImage(ImageLiterals.icPencil, for: .normal) From 162916f922e64f7135adfbef294306725eaa3103 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 17:32:13 +0900 Subject: [PATCH 164/468] =?UTF-8?q?[CHORE]=20ActionSheet=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=97=B0=EA=B2=B0=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Ing/DetailingViewController.swift | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index 35bb6cc68..fdeafab97 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -94,6 +94,16 @@ final class DetailingViewController: BaseViewController { self.navigationController?.pushViewController(viewController, animated: true) } + private func presentEditMissionView() { + // FIXME: - view 연결 + print("view 연결") + } + + private func resetMission() { + // FIXME: - api 연결 해야함. + print("미션 되돌리기 API 연결") + } + // MARK: - network private func requestRoomInfo(completionHandler: @escaping ((Result) -> Void)) { @@ -173,12 +183,21 @@ final class DetailingViewController: BaseViewController { extension DetailingViewController: DetailingDelegate { func editMissionButtonDidTap() { + typealias AlertAction = ((UIAlertAction) -> ()) + let editMissionAction: AlertAction = { [weak self] _ in + self?.presentEditMissionView() + } + let resetAction: AlertAction = { [weak self] _ in + self?.resetMission() + } + self.makeActionSheet(title: TextLiteral.detailIngViewControllerMissionEditTitle, actionTitles: [ TextLiteral.detailIngViewControllerSelfEditMissionTitle, TextLiteral.detailIngViewControllerResetMissionTitle, TextLiteral.cancel], - actionStyle: [.default, .default, .cancel], actions: [nil, nil, nil]) + actionStyle: [.default, .default, .cancel], + actions: [editMissionAction, resetAction, nil]) } func listBackDidTap() { From 8d99a8a7c35342029a3d82a975d5e10603c4d1cf Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 18:04:36 +0900 Subject: [PATCH 165/468] =?UTF-8?q?[ADD]=20=EB=AF=B8=EC=85=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20View=20=EC=B6=94=EA=B0=80=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++ .../Detail-Ing/DetailingViewController.swift | 5 +- .../View/MissionEditViewController.swift | 59 +++++++++++++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index eef409a08..a10013116 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -52,6 +52,7 @@ 39D95265285B097800183B09 /* CalendarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39D95264285B097800183B09 /* CalendarView.swift */; }; 39E099AD287FC020004F464E /* LetterDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39E099AC287FC020004F464E /* LetterDTO.swift */; }; 39EE956D2A401ED400AF6857 /* DetailingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EE956C2A401ED400AF6857 /* DetailingView.swift */; }; + 39EE956F2A404A3800AF6857 /* MissionEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EE956E2A404A3800AF6857 /* MissionEditViewController.swift */; }; 39EEF65628CB3BB200437654 /* LoginProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65528CB3BB200437654 /* LoginProtocol.swift */; }; 39EEF65828CB3C1100437654 /* Login.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65728CB3C1100437654 /* Login.swift */; }; 39EEF65A28CB3C7B00437654 /* Token.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65928CB3C7B00437654 /* Token.swift */; }; @@ -235,6 +236,7 @@ 39E099AC287FC020004F464E /* LetterDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterDTO.swift; sourceTree = ""; }; 39E6321328BDE59C00CFC6C4 /* Manito.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Manito.entitlements; sourceTree = ""; }; 39EE956C2A401ED400AF6857 /* DetailingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailingView.swift; sourceTree = ""; }; + 39EE956E2A404A3800AF6857 /* MissionEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionEditViewController.swift; sourceTree = ""; }; 39EEF65528CB3BB200437654 /* LoginProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginProtocol.swift; sourceTree = ""; }; 39EEF65728CB3C1100437654 /* Login.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Login.swift; sourceTree = ""; }; 39EEF65928CB3C7B00437654 /* Token.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Token.swift; sourceTree = ""; }; @@ -512,6 +514,7 @@ isa = PBXGroup; children = ( 39EE956C2A401ED400AF6857 /* DetailingView.swift */, + 39EE956E2A404A3800AF6857 /* MissionEditViewController.swift */, ); path = View; sourceTree = ""; @@ -1240,6 +1243,7 @@ 7E7542B32923744300D725CB /* ToastPopupView.swift in Sources */, 39CD581B28C4BE8800496E91 /* DetailStartingAPI.swift in Sources */, 39C957D22879523200A04A2B /* Date+Extension.swift in Sources */, + 39EE956F2A404A3800AF6857 /* MissionEditViewController.swift in Sources */, B5F5250A2851A06700614FF7 /* DetailWaitViewController.swift in Sources */, 39C957D02879521400A04A2B /* String+Extension.swift in Sources */, 399D17AB2856C83B00F50D9D /* DetailEditViewController.swift in Sources */, diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index fdeafab97..3f5c2ac52 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -95,8 +95,9 @@ final class DetailingViewController: BaseViewController { } private func presentEditMissionView() { - // FIXME: - view 연결 - print("view 연결") + let viewController = MissionEditViewController() + viewController.modalPresentationStyle = .overCurrentContext + self.present(viewController, animated: true) } private func resetMission() { diff --git a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift new file mode 100644 index 000000000..f723d8a14 --- /dev/null +++ b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift @@ -0,0 +1,59 @@ +// +// MissionEditViewController.swift +// Manito +// +// Created by Mingwan Choi on 2023/06/19. +// + +import UIKit + +import SnapKit + +final class MissionEditViewController: BaseViewController { + + // MARK: - component + + private let backgroundView: UIView = { + let view = UIView() + view.clipsToBounds = true + view.layer.cornerRadius = 20 + view.layer.maskedCorners = CACornerMask(arrayLiteral: [.layerMinXMinYCorner, .layerMaxXMinYCorner]) + view.backgroundColor = .darkGrey004 + return view + }() + + // MARK: - life cycle + + override func viewDidLoad() { + super.viewDidLoad() + self.setupGesture() + } + + override func configureUI() { + super.configureUI() + self.view.backgroundColor = .darkGrey001.withAlphaComponent(0.5) + } + + override func setupLayout() { + self.view.addSubview(self.backgroundView) + self.backgroundView.snp.makeConstraints { + $0.leading.trailing.equalToSuperview() + $0.centerY.equalToSuperview() + $0.height.equalTo(120) + } + } + + // MARK: - func + + private func setupGesture() { + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(dismissViewController)) + self.view.addGestureRecognizer(tapGesture) + } + + // MARK: - selector + + @objc + private func dismissViewController() { + self.dismiss(animated: true) + } +} From f447fdc37da1f8fd7176fe5989fb822581e2f807 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 18:17:38 +0900 Subject: [PATCH 166/468] =?UTF-8?q?[ADD]=20mission=20textfield=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Ing/DetailingViewController.swift | 8 ++-- .../Detail-Ing/View/DetailingView.swift | 5 ++- .../View/MissionEditViewController.swift | 38 +++++++++++++++++++ 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index 3f5c2ac52..f893dbb31 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -94,8 +94,8 @@ final class DetailingViewController: BaseViewController { self.navigationController?.pushViewController(viewController, animated: true) } - private func presentEditMissionView() { - let viewController = MissionEditViewController() + private func presentEditMissionView(mission: String) { + let viewController = MissionEditViewController(mission: mission) viewController.modalPresentationStyle = .overCurrentContext self.present(viewController, animated: true) } @@ -183,10 +183,10 @@ final class DetailingViewController: BaseViewController { } extension DetailingViewController: DetailingDelegate { - func editMissionButtonDidTap() { + func editMissionButtonDidTap(mission: String) { typealias AlertAction = ((UIAlertAction) -> ()) let editMissionAction: AlertAction = { [weak self] _ in - self?.presentEditMissionView() + self?.presentEditMissionView(mission: mission) } let resetAction: AlertAction = { [weak self] _ in self?.resetMission() diff --git a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift index 4fff3e176..a3cdc86a6 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift @@ -10,7 +10,7 @@ import UIKit import SnapKit protocol DetailingDelegate: AnyObject { - func editMissionButtonDidTap() + func editMissionButtonDidTap(mission: String) func listBackDidTap() func letterBoxDidTap(type: String, mission: String, @@ -75,7 +75,8 @@ final class DetailingView: UIView { private lazy var pencilButton: UIButton = { let button = UIButton(type: .system) let action = UIAction { [weak self] _ in - self?.delegate?.editMissionButtonDidTap() + guard let mission = self?.missionContentsLabel.text else { return } + self?.delegate?.editMissionButtonDidTap(mission: mission) } button.addAction(action, for: .touchUpInside) button.setImage(ImageLiterals.icPencil, for: .normal) diff --git a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift index f723d8a14..2393634c3 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift @@ -11,6 +11,8 @@ import SnapKit final class MissionEditViewController: BaseViewController { + let mission: String + // MARK: - component private let backgroundView: UIView = { @@ -21,6 +23,35 @@ final class MissionEditViewController: BaseViewController { view.backgroundColor = .darkGrey004 return view }() + private lazy var missionTextField: UITextField = { + let textField = UITextField() + let attributes = [ + NSAttributedString.Key.font : UIFont.font(.regular, ofSize: 18) + ] + textField.backgroundColor = .darkGrey002 + textField.attributedPlaceholder = NSAttributedString(string: self.mission, attributes:attributes) + textField.font = .font(.regular, ofSize: 18) + textField.layer.cornerRadius = 10 + textField.layer.masksToBounds = true + textField.layer.borderWidth = 1 + textField.layer.borderColor = UIColor.white.cgColor + textField.textAlignment = .center + textField.returnKeyType = .done + textField.autocorrectionType = .no + textField.autocapitalizationType = .none + textField.becomeFirstResponder() + return textField + }() + + init(mission: String) { + self.mission = mission + super.init() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } // MARK: - life cycle @@ -41,6 +72,13 @@ final class MissionEditViewController: BaseViewController { $0.centerY.equalToSuperview() $0.height.equalTo(120) } + + self.view.addSubview(missionTextField) + self.missionTextField.snp.makeConstraints { + $0.leading.trailing.equalToSuperview().inset(20) + $0.center.equalToSuperview() + $0.height.equalTo(60) + } } // MARK: - func From bac64121d1159316a7e1d97463a219f8b2e1772b Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 21:25:11 +0900 Subject: [PATCH 167/468] =?UTF-8?q?[ADD]=20TextField=20=EC=9C=84=EC=B9=98?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Ing/DetailingViewController.swift | 1 + .../View/MissionEditViewController.swift | 26 ++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index f893dbb31..c58d29152 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -96,6 +96,7 @@ final class DetailingViewController: BaseViewController { private func presentEditMissionView(mission: String) { let viewController = MissionEditViewController(mission: mission) + viewController.modalTransitionStyle = .crossDissolve viewController.modalPresentationStyle = .overCurrentContext self.present(viewController, animated: true) } diff --git a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift index 2393634c3..7ed48f1df 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift @@ -58,22 +58,23 @@ final class MissionEditViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() self.setupGesture() + self.setupNotificationCenter() } override func configureUI() { super.configureUI() +// self.view.backgroundColor = .clear self.view.backgroundColor = .darkGrey001.withAlphaComponent(0.5) } override func setupLayout() { self.view.addSubview(self.backgroundView) self.backgroundView.snp.makeConstraints { - $0.leading.trailing.equalToSuperview() - $0.centerY.equalToSuperview() + $0.leading.trailing.bottom.equalToSuperview() $0.height.equalTo(120) } - self.view.addSubview(missionTextField) + self.backgroundView.addSubview(missionTextField) self.missionTextField.snp.makeConstraints { $0.leading.trailing.equalToSuperview().inset(20) $0.center.equalToSuperview() @@ -88,10 +89,29 @@ final class MissionEditViewController: BaseViewController { self.view.addGestureRecognizer(tapGesture) } + private func setupNotificationCenter() { + NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) + } + // MARK: - selector @objc private func dismissViewController() { self.dismiss(animated: true) } + + @objc private func keyboardWillShow(notification:NSNotification) { + if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { + UIView.animate(withDuration: 0.2, animations: { + self.backgroundView.transform = CGAffineTransform(translationX: 0, y: -keyboardSize.height + 30) + }) + } + } + + @objc private func keyboardWillHide(notification:NSNotification) { + UIView.animate(withDuration: 0.2, animations: { + self.backgroundView.transform = .identity + }) + } } From 3b5e16d12a7ea9f2ea4c6c01af74933066d69fd7 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 22:05:09 +0900 Subject: [PATCH 168/468] =?UTF-8?q?[CHORE]=20=EC=99=84=EB=A3=8C=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=20=EC=97=B0=EA=B2=B0=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Ing/View/MissionEditViewController.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift index 7ed48f1df..23ab2e174 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift @@ -40,6 +40,7 @@ final class MissionEditViewController: BaseViewController { textField.autocorrectionType = .no textField.autocapitalizationType = .none textField.becomeFirstResponder() + textField.delegate = self return textField }() @@ -63,7 +64,6 @@ final class MissionEditViewController: BaseViewController { override func configureUI() { super.configureUI() -// self.view.backgroundColor = .clear self.view.backgroundColor = .darkGrey001.withAlphaComponent(0.5) } @@ -115,3 +115,11 @@ final class MissionEditViewController: BaseViewController { }) } } + +extension MissionEditViewController: UITextFieldDelegate { + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + self.missionTextField.endEditing(true) + self.dismiss(animated: true) + return true + } +} From 4170aec8d77ea2bbf6f6cf953d0abc08294c465b Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 22:18:52 +0900 Subject: [PATCH 169/468] =?UTF-8?q?[ADD]=20=EB=AF=B8=EC=85=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20Alert=20=EC=B6=94=EA=B0=80=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Literal/TextLiteral.swift | 4 ++++ .../View/MissionEditViewController.swift | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Manito/Manito/Global/Literal/TextLiteral.swift b/Manito/Manito/Global/Literal/TextLiteral.swift index d86913e04..018113870 100644 --- a/Manito/Manito/Global/Literal/TextLiteral.swift +++ b/Manito/Manito/Global/Literal/TextLiteral.swift @@ -220,4 +220,8 @@ enum TextLiteral { // MARK: - InvitedCodeViewController static let invitedCodeViewCOntroller: String = "글자를 탭하여 코드를 복사하세요" + + // MARK: - MissionEditViewController + static let missionEditViewControllerChangeMissionAlertTitle: String = "" + static let missionEditViewControllerChangeMissionAlertMessage: String = "" } diff --git a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift index 23ab2e174..4d5de9b54 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift @@ -94,6 +94,20 @@ final class MissionEditViewController: BaseViewController { NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) } + private func didChangedTextField(_ text: String) { + guard !text.isEmpty else { + self.dismiss(animated: true) + return + } + self.makeRequestAlert(title: TextLiteral.missionEditViewControllerChangeMissionAlertTitle, + message: TextLiteral.missionEditViewControllerChangeMissionAlertMessage, + okTitle: TextLiteral.change, + okStyle: .default, + okAction: { [weak self] _ in + self?.dismiss(animated: true) + }) + } + // MARK: - selector @objc @@ -119,7 +133,8 @@ final class MissionEditViewController: BaseViewController { extension MissionEditViewController: UITextFieldDelegate { func textFieldShouldReturn(_ textField: UITextField) -> Bool { self.missionTextField.endEditing(true) - self.dismiss(animated: true) + guard let text = textField.text else { return true } + self.didChangedTextField(text) return true } } From 3f9c932d238d9956b593ea23697b25f75b2da0ff Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 22:44:58 +0900 Subject: [PATCH 170/468] =?UTF-8?q?[ADD]=20=EB=AF=B8=EC=85=98=20=EC=B5=9C?= =?UTF-8?q?=EB=8C=80=20=EA=B8=80=EC=9E=90=EC=88=98=20Label=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/MissionEditViewController.swift | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift index 4d5de9b54..128942f37 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift @@ -43,6 +43,13 @@ final class MissionEditViewController: BaseViewController { textField.delegate = self return textField }() + private let missionMaxLengthLabel: UILabel = { + let label = UILabel() + label.text = "0/18" + label.font = .font(.regular, ofSize: 16) + label.textColor = .white + return label + }() init(mission: String) { self.mission = mission @@ -70,16 +77,23 @@ final class MissionEditViewController: BaseViewController { override func setupLayout() { self.view.addSubview(self.backgroundView) self.backgroundView.snp.makeConstraints { - $0.leading.trailing.bottom.equalToSuperview() + $0.leading.trailing.equalToSuperview() + $0.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom).inset(-5) $0.height.equalTo(120) } - self.backgroundView.addSubview(missionTextField) + self.backgroundView.addSubview(self.missionTextField) self.missionTextField.snp.makeConstraints { + $0.top.equalToSuperview().inset(30) $0.leading.trailing.equalToSuperview().inset(20) - $0.center.equalToSuperview() $0.height.equalTo(60) } + + self.backgroundView.addSubview(self.missionMaxLengthLabel) + self.missionMaxLengthLabel.snp.makeConstraints { + $0.top.equalTo(self.missionTextField.snp.bottom).offset(4) + $0.trailing.equalTo(self.missionTextField.snp.trailing) + } } // MARK: - func @@ -137,4 +151,19 @@ extension MissionEditViewController: UITextFieldDelegate { self.didChangedTextField(text) return true } + + func textFieldDidChangeSelection(_ textField: UITextField) { + guard let text = textField.text else { return } + if text.count > 18 { + let endIndex = text.index(text.startIndex, offsetBy: 18) + let fixedText = text[text.startIndex.. Date: Mon, 19 Jun 2023 22:53:57 +0900 Subject: [PATCH 171/468] =?UTF-8?q?[CHORE]=20fixme=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Ing/View/MissionEditViewController.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift index 128942f37..bd8fac75b 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift @@ -118,6 +118,7 @@ final class MissionEditViewController: BaseViewController { okTitle: TextLiteral.change, okStyle: .default, okAction: { [weak self] _ in + // FIXME: - API 연결 후 작업해야함 self?.dismiss(animated: true) }) } From c3c7a32f6174314aa19be95e660fbeab387987c6 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 23:11:21 +0900 Subject: [PATCH 172/468] =?UTF-8?q?[FEAT]=20=EC=A7=84=ED=96=89=EC=A4=91?= =?UTF-8?q?=EC=9D=B8=20=EB=B0=A9=EA=B3=BC=20=EB=B0=A9=EC=9E=A5=EC=9D=BC?= =?UTF-8?q?=EB=95=8C=EB=A7=8C=20=EB=B3=B4=EC=9D=B4=EA=B2=8C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Ing/View/DetailingView.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift index a3cdc86a6..a0c277f77 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift @@ -431,7 +431,7 @@ final class DetailingView: UIView { self.periodLabel.text = "\(startDate.subStringToDate()) ~ \(endDate.subStringToDate())" self.manitteeAnimationLabel.text = manittee self.setupBadge(count: badgeCount) - + self.updateMissionEditButton(admin, type: self.roomType) if self.roomType == .PROCESSING { self.setupProcessingUI() guard let missionContent = room.mission?.content, @@ -507,6 +507,15 @@ final class DetailingView: UIView { self.manitteeAnimationLabel.alpha = value ? 1 : 0 } + private func updateMissionEditButton(_ isAdmin: Bool, type: RoomType) { + if type == .POST { + self.pencilButton.isHidden = true + } + if !isAdmin { + self.pencilButton.isHidden = true + } + } + // MARK: - selector @objc From 945869639c2b9d6f63b9d2bcb18362e6e82fcac2 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 23:19:21 +0900 Subject: [PATCH 173/468] =?UTF-8?q?[ADD]=20=EB=AF=B8=EC=85=98=20=EB=90=98?= =?UTF-8?q?=EB=8F=8C=EB=A6=AC=EA=B8=B0=20Alert=20=EC=B6=94=EA=B0=80=20(#46?= =?UTF-8?q?3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Literal/TextLiteral.swift | 3 +++ .../Screens/Detail-Ing/DetailingViewController.swift | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Global/Literal/TextLiteral.swift b/Manito/Manito/Global/Literal/TextLiteral.swift index 018113870..580a5eb91 100644 --- a/Manito/Manito/Global/Literal/TextLiteral.swift +++ b/Manito/Manito/Global/Literal/TextLiteral.swift @@ -164,6 +164,9 @@ enum TextLiteral { static let detailIngViewControllerMissionEditTitle: String = "개별 미션 설정" static let detailIngViewControllerSelfEditMissionTitle: String = "개별 미션 직접 설정" static let detailIngViewControllerResetMissionTitle: String = "기본 미션으로 변경" + static let detailIngViewControllerResetMissionAlertTitle: String = "개별 미션을 되돌리시겠습니까?" + static let detailIngViewControllerResetMissionAlertMessage: String = "기존에 주어지는 기본 미션으로 재설정됩니다." + static let detailIngViewControllerResetMissionAlertOkTitle: String = "되돌리기" // MARK: - CalendarView static let calendarViewAlertMaxTitle: String = "최대 선택 기간을 넘었어요" diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index c58d29152..119cdaa86 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -102,8 +102,14 @@ final class DetailingViewController: BaseViewController { } private func resetMission() { - // FIXME: - api 연결 해야함. - print("미션 되돌리기 API 연결") + self.makeRequestAlert(title: TextLiteral.detailIngViewControllerResetMissionAlertTitle, + message: TextLiteral.detailIngViewControllerResetMissionAlertMessage, + okTitle: TextLiteral.detailIngViewControllerResetMissionAlertOkTitle, + okStyle: .default, + okAction: { [weak self] _ in + // FIXME: - API 연결 + self?.dismiss(animated: true) + }) } // MARK: - network From 994878dcc4cfcddee2d1ecf6a4332d9c36e2f06d Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 23:26:49 +0900 Subject: [PATCH 174/468] =?UTF-8?q?[CHORE]=20TextLiteral=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Literal/TextLiteral.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Global/Literal/TextLiteral.swift b/Manito/Manito/Global/Literal/TextLiteral.swift index 580a5eb91..db7e7f70a 100644 --- a/Manito/Manito/Global/Literal/TextLiteral.swift +++ b/Manito/Manito/Global/Literal/TextLiteral.swift @@ -225,6 +225,6 @@ enum TextLiteral { static let invitedCodeViewCOntroller: String = "글자를 탭하여 코드를 복사하세요" // MARK: - MissionEditViewController - static let missionEditViewControllerChangeMissionAlertTitle: String = "" - static let missionEditViewControllerChangeMissionAlertMessage: String = "" + static let missionEditViewControllerChangeMissionAlertTitle: String = "개별 미션을 수정하시겠습니까?" + static let missionEditViewControllerChangeMissionAlertMessage: String = "기본 미션으로 변경을 통해\n되돌릴 수 있습니다." } From 8e8a7974350c44c5e52cf03fdf74854171465515 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 19 Jun 2023 23:28:37 +0900 Subject: [PATCH 175/468] =?UTF-8?q?[CHORE]=20dismiss=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index 119cdaa86..caf156f99 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -106,9 +106,8 @@ final class DetailingViewController: BaseViewController { message: TextLiteral.detailIngViewControllerResetMissionAlertMessage, okTitle: TextLiteral.detailIngViewControllerResetMissionAlertOkTitle, okStyle: .default, - okAction: { [weak self] _ in + okAction: { _ in // FIXME: - API 연결 - self?.dismiss(animated: true) }) } From ed689870e6620022b3bd30cf6c0048addc45c556 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 20 Jun 2023 21:46:33 +0900 Subject: [PATCH 176/468] =?UTF-8?q?[CHORE]=20Letter=20=EB=B6=80=EB=B6=84?= =?UTF-8?q?=20=ED=8C=8C=EC=9D=BC=20=EA=B5=AC=EC=A1=B0=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 80 +++++++++++++++---- .../Letter/Services/LetterService.swift | 8 ++ .../Letter/ViewModels/LetterViewModel.swift | 8 ++ .../Cells}/LetterCollectionViewCell.swift | 0 .../BottomOfSendLetterView.swift | 0 .../UIComponents}/CreateLetterPhotoView.swift | 0 .../UIComponents}/CreateLetterTextView.swift | 0 .../UIComponents}/IndividualMissionView.swift | 0 .../UIComponents}/LetterHeaderView.swift | 0 .../CreateLetterViewController.swift | 0 .../LetterImageViewController.swift | 0 .../LetterViewController+MailCompose.swift | 0 .../LetterViewController.swift | 0 .../Views}/CreateLetterView.swift | 0 .../Views}/LetterImageView.swift | 0 .../{View => Views/Views}/LetterView.swift | 0 16 files changed, 80 insertions(+), 16 deletions(-) create mode 100644 Manito/Manito/Screens/Letter/Services/LetterService.swift create mode 100644 Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift rename Manito/Manito/Screens/Letter/{Cell => Views/Cells}/LetterCollectionViewCell.swift (100%) rename Manito/Manito/Screens/Letter/{UIComponent => Views/UIComponents}/BottomOfSendLetterView.swift (100%) rename Manito/Manito/Screens/Letter/{UIComponent => Views/UIComponents}/CreateLetterPhotoView.swift (100%) rename Manito/Manito/Screens/Letter/{UIComponent => Views/UIComponents}/CreateLetterTextView.swift (100%) rename Manito/Manito/Screens/Letter/{UIComponent => Views/UIComponents}/IndividualMissionView.swift (100%) rename Manito/Manito/Screens/Letter/{UIComponent => Views/UIComponents}/LetterHeaderView.swift (100%) rename Manito/Manito/Screens/Letter/{ => Views/ViewControllers}/CreateLetterViewController.swift (100%) rename Manito/Manito/Screens/Letter/{ => Views/ViewControllers}/LetterImageViewController.swift (100%) rename Manito/Manito/Screens/Letter/{ => Views/ViewControllers}/LetterViewController+MailCompose.swift (100%) rename Manito/Manito/Screens/Letter/{ => Views/ViewControllers}/LetterViewController.swift (100%) rename Manito/Manito/Screens/Letter/{View => Views/Views}/CreateLetterView.swift (100%) rename Manito/Manito/Screens/Letter/{View => Views/Views}/LetterImageView.swift (100%) rename Manito/Manito/Screens/Letter/{View => Views/Views}/LetterView.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 1f4e93dd4..3c3a1a9d0 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -101,6 +101,8 @@ B5AE11F029D1E43B00F86FF8 /* OpenManittoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11EF29D1E43B00F86FF8 /* OpenManittoView.swift */; }; B5AE11F229D28CB500F86FF8 /* OpenManittoPopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11F129D28CB500F86FF8 /* OpenManittoPopupView.swift */; }; B5AE11F429D32EE700F86FF8 /* SelectManitteeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */; }; + B5B3C15D2A41D6EB00AABD6F /* LetterViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C15C2A41D6EB00AABD6F /* LetterViewModel.swift */; }; + B5B3C15F2A41D6F400AABD6F /* LetterService.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C15E2A41D6F400AABD6F /* LetterService.swift */; }; B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2AD285B2917006D880B /* Int+Extension.swift */; }; B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */; }; B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */; }; @@ -279,6 +281,8 @@ B5AE11EF29D1E43B00F86FF8 /* OpenManittoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoView.swift; sourceTree = ""; }; B5AE11F129D28CB500F86FF8 /* OpenManittoPopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoPopupView.swift; sourceTree = ""; }; B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeView.swift; sourceTree = ""; }; + B5B3C15C2A41D6EB00AABD6F /* LetterViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterViewModel.swift; sourceTree = ""; }; + B5B3C15E2A41D6F400AABD6F /* LetterService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterService.swift; sourceTree = ""; }; B5E1F2AD285B2917006D880B /* Int+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Extension.swift"; sourceTree = ""; }; B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeViewController.swift; sourceTree = ""; }; B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultStorage.swift; sourceTree = ""; }; @@ -566,14 +570,15 @@ path = Cell; sourceTree = ""; }; - B54741DE29A3A4BA00B75BA3 /* View */ = { + B54741DE29A3A4BA00B75BA3 /* Views */ = { isa = PBXGroup; children = ( - B5706BF329B710FC0093D198 /* LetterView.swift */, - B5706BE029ADC20A0093D198 /* CreateLetterView.swift */, - B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */, + B5B3C1592A41D69500AABD6F /* ViewControllers */, + B5B3C1582A41D67F00AABD6F /* Views */, + B5F5253228547CAF00614FF7 /* Cells */, + B5F5253328547EE000614FF7 /* UIComponents */, ); - path = View; + path = Views; sourceTree = ""; }; B54741E529A4945100B75BA3 /* Error */ = { @@ -610,6 +615,50 @@ path = View; sourceTree = ""; }; + B5B3C1572A41D65400AABD6F /* ViewModels */ = { + isa = PBXGroup; + children = ( + B5B3C15C2A41D6EB00AABD6F /* LetterViewModel.swift */, + ); + path = ViewModels; + sourceTree = ""; + }; + B5B3C1582A41D67F00AABD6F /* Views */ = { + isa = PBXGroup; + children = ( + B5706BF329B710FC0093D198 /* LetterView.swift */, + B5706BE029ADC20A0093D198 /* CreateLetterView.swift */, + B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */, + ); + path = Views; + sourceTree = ""; + }; + B5B3C1592A41D69500AABD6F /* ViewControllers */ = { + isa = PBXGroup; + children = ( + B5F5250D2851A07700614FF7 /* LetterViewController.swift */, + B5F31C4F28BF922E00F61D0F /* LetterViewController+MailCompose.swift */, + B50B1AF82856B2C60080992C /* CreateLetterViewController.swift */, + 39F1C12D28D756E600585B83 /* LetterImageViewController.swift */, + ); + path = ViewControllers; + sourceTree = ""; + }; + B5B3C15A2A41D6A600AABD6F /* Services */ = { + isa = PBXGroup; + children = ( + B5B3C15E2A41D6F400AABD6F /* LetterService.swift */, + ); + path = Services; + sourceTree = ""; + }; + B5B3C15B2A41D6D500AABD6F /* Protocols */ = { + isa = PBXGroup; + children = ( + ); + path = Protocols; + sourceTree = ""; + }; B5F31BAE28BE1C7900F61D0F /* Storage */ = { isa = PBXGroup; children = ( @@ -740,13 +789,10 @@ B5F524EA28519B4B00614FF7 /* Letter */ = { isa = PBXGroup; children = ( - B54741DE29A3A4BA00B75BA3 /* View */, - B5F5253228547CAF00614FF7 /* Cell */, - B5F5253328547EE000614FF7 /* UIComponent */, - B5F5250D2851A07700614FF7 /* LetterViewController.swift */, - B5F31C4F28BF922E00F61D0F /* LetterViewController+MailCompose.swift */, - B50B1AF82856B2C60080992C /* CreateLetterViewController.swift */, - 39F1C12D28D756E600585B83 /* LetterImageViewController.swift */, + B5B3C15B2A41D6D500AABD6F /* Protocols */, + B54741DE29A3A4BA00B75BA3 /* Views */, + B5B3C1572A41D65400AABD6F /* ViewModels */, + B5B3C15A2A41D6A600AABD6F /* Services */, ); path = Letter; sourceTree = ""; @@ -866,15 +912,15 @@ path = Utils; sourceTree = ""; }; - B5F5253228547CAF00614FF7 /* Cell */ = { + B5F5253228547CAF00614FF7 /* Cells */ = { isa = PBXGroup; children = ( B5F52536285481C800614FF7 /* LetterCollectionViewCell.swift */, ); - path = Cell; + path = Cells; sourceTree = ""; }; - B5F5253328547EE000614FF7 /* UIComponent */ = { + B5F5253328547EE000614FF7 /* UIComponents */ = { isa = PBXGroup; children = ( B5F5253428547F1900614FF7 /* LetterHeaderView.swift */, @@ -883,7 +929,7 @@ B50B1AFC2856C3500080992C /* CreateLetterTextView.swift */, B50B1AFE2856D3820080992C /* CreateLetterPhotoView.swift */, ); - path = UIComponent; + path = UIComponents; sourceTree = ""; }; B5F525462855D00B00614FF7 /* Network */ = { @@ -1247,6 +1293,7 @@ B5F525392854871E00614FF7 /* BottomOfSendLetterView.swift in Sources */, B5F525202851A21D00614FF7 /* UIViewController+Extension.swift in Sources */, 7ED845BA2876BE530075AC61 /* SettingViewTableCell.swift in Sources */, + B5B3C15F2A41D6F400AABD6F /* LetterService.swift in Sources */, B5AE11F229D28CB500F86FF8 /* OpenManittoPopupView.swift in Sources */, B517C04A28D1F7EC0008BED0 /* TokenEndPoint.swift in Sources */, 39C957DF2879A35300A04A2B /* RoomDTO.swift in Sources */, @@ -1288,6 +1335,7 @@ B5706BE129ADC20A0093D198 /* CreateLetterView.swift in Sources */, 39EEF66028CB3D6200437654 /* LoginDTO.swift in Sources */, 7E0C5C362855B22700F698D1 /* CreateNickNameViewController.swift in Sources */, + B5B3C15D2A41D6EB00AABD6F /* LetterViewModel.swift in Sources */, CB674C1C285966020063A6B7 /* InputInvitedCodeView.swift in Sources */, B50B1AF92856B2C60080992C /* CreateLetterViewController.swift in Sources */, B5F31C5028BF922E00F61D0F /* LetterViewController+MailCompose.swift in Sources */, diff --git a/Manito/Manito/Screens/Letter/Services/LetterService.swift b/Manito/Manito/Screens/Letter/Services/LetterService.swift new file mode 100644 index 000000000..5db2c19de --- /dev/null +++ b/Manito/Manito/Screens/Letter/Services/LetterService.swift @@ -0,0 +1,8 @@ +// +// LetterService.swift +// Manito +// +// Created by SHIN YOON AH on 2023/06/20. +// + +import Foundation diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift new file mode 100644 index 000000000..8f884a68e --- /dev/null +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -0,0 +1,8 @@ +// +// LetterViewModel.swift +// Manito +// +// Created by SHIN YOON AH on 2023/06/20. +// + +import Foundation diff --git a/Manito/Manito/Screens/Letter/Cell/LetterCollectionViewCell.swift b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift similarity index 100% rename from Manito/Manito/Screens/Letter/Cell/LetterCollectionViewCell.swift rename to Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift diff --git a/Manito/Manito/Screens/Letter/UIComponent/BottomOfSendLetterView.swift b/Manito/Manito/Screens/Letter/Views/UIComponents/BottomOfSendLetterView.swift similarity index 100% rename from Manito/Manito/Screens/Letter/UIComponent/BottomOfSendLetterView.swift rename to Manito/Manito/Screens/Letter/Views/UIComponents/BottomOfSendLetterView.swift diff --git a/Manito/Manito/Screens/Letter/UIComponent/CreateLetterPhotoView.swift b/Manito/Manito/Screens/Letter/Views/UIComponents/CreateLetterPhotoView.swift similarity index 100% rename from Manito/Manito/Screens/Letter/UIComponent/CreateLetterPhotoView.swift rename to Manito/Manito/Screens/Letter/Views/UIComponents/CreateLetterPhotoView.swift diff --git a/Manito/Manito/Screens/Letter/UIComponent/CreateLetterTextView.swift b/Manito/Manito/Screens/Letter/Views/UIComponents/CreateLetterTextView.swift similarity index 100% rename from Manito/Manito/Screens/Letter/UIComponent/CreateLetterTextView.swift rename to Manito/Manito/Screens/Letter/Views/UIComponents/CreateLetterTextView.swift diff --git a/Manito/Manito/Screens/Letter/UIComponent/IndividualMissionView.swift b/Manito/Manito/Screens/Letter/Views/UIComponents/IndividualMissionView.swift similarity index 100% rename from Manito/Manito/Screens/Letter/UIComponent/IndividualMissionView.swift rename to Manito/Manito/Screens/Letter/Views/UIComponents/IndividualMissionView.swift diff --git a/Manito/Manito/Screens/Letter/UIComponent/LetterHeaderView.swift b/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift similarity index 100% rename from Manito/Manito/Screens/Letter/UIComponent/LetterHeaderView.swift rename to Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift diff --git a/Manito/Manito/Screens/Letter/CreateLetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/CreateLetterViewController.swift similarity index 100% rename from Manito/Manito/Screens/Letter/CreateLetterViewController.swift rename to Manito/Manito/Screens/Letter/Views/ViewControllers/CreateLetterViewController.swift diff --git a/Manito/Manito/Screens/Letter/LetterImageViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterImageViewController.swift similarity index 100% rename from Manito/Manito/Screens/Letter/LetterImageViewController.swift rename to Manito/Manito/Screens/Letter/Views/ViewControllers/LetterImageViewController.swift diff --git a/Manito/Manito/Screens/Letter/LetterViewController+MailCompose.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController+MailCompose.swift similarity index 100% rename from Manito/Manito/Screens/Letter/LetterViewController+MailCompose.swift rename to Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController+MailCompose.swift diff --git a/Manito/Manito/Screens/Letter/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift similarity index 100% rename from Manito/Manito/Screens/Letter/LetterViewController.swift rename to Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift diff --git a/Manito/Manito/Screens/Letter/View/CreateLetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/CreateLetterView.swift similarity index 100% rename from Manito/Manito/Screens/Letter/View/CreateLetterView.swift rename to Manito/Manito/Screens/Letter/Views/Views/CreateLetterView.swift diff --git a/Manito/Manito/Screens/Letter/View/LetterImageView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterImageView.swift similarity index 100% rename from Manito/Manito/Screens/Letter/View/LetterImageView.swift rename to Manito/Manito/Screens/Letter/Views/Views/LetterImageView.swift diff --git a/Manito/Manito/Screens/Letter/View/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift similarity index 100% rename from Manito/Manito/Screens/Letter/View/LetterView.swift rename to Manito/Manito/Screens/Letter/Views/Views/LetterView.swift From bca99bb4d9a200af1a8a003792aace4b9cf8e6d8 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 20 Jun 2023 21:51:25 +0900 Subject: [PATCH 177/468] =?UTF-8?q?[ADD]=20ViewModelType=EA=B3=BC=20ViewMo?= =?UTF-8?q?del=20=EC=83=9D=EC=84=B1(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++++ .../Global/Protocol/ViewModelType.swift | 15 +++++++++++++ .../Letter/ViewModels/LetterViewModel.swift | 21 +++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 Manito/Manito/Global/Protocol/ViewModelType.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 3c3a1a9d0..4b4f1c110 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -103,6 +103,7 @@ B5AE11F429D32EE700F86FF8 /* SelectManitteeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */; }; B5B3C15D2A41D6EB00AABD6F /* LetterViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C15C2A41D6EB00AABD6F /* LetterViewModel.swift */; }; B5B3C15F2A41D6F400AABD6F /* LetterService.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C15E2A41D6F400AABD6F /* LetterService.swift */; }; + B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */; }; B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2AD285B2917006D880B /* Int+Extension.swift */; }; B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */; }; B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */; }; @@ -283,6 +284,7 @@ B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeView.swift; sourceTree = ""; }; B5B3C15C2A41D6EB00AABD6F /* LetterViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterViewModel.swift; sourceTree = ""; }; B5B3C15E2A41D6F400AABD6F /* LetterService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterService.swift; sourceTree = ""; }; + B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModelType.swift; sourceTree = ""; }; B5E1F2AD285B2917006D880B /* Int+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Extension.swift"; sourceTree = ""; }; B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeViewController.swift; sourceTree = ""; }; B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultStorage.swift; sourceTree = ""; }; @@ -857,6 +859,7 @@ B5F524F628519BC000614FF7 /* Protocol */ = { isa = PBXGroup; children = ( + B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */, ); path = Protocol; sourceTree = ""; @@ -1310,6 +1313,7 @@ B5F5251E2851A1C700614FF7 /* BaseTableViewCell.swift in Sources */, 39C957F6287D9ED000A04A2B /* NetworkRequest.swift in Sources */, 39EEF65C28CB3CD600437654 /* LoginAPI.swift in Sources */, + B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */, D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */, 39C957FE287DAB6D00A04A2B /* DetailIngEndPoint.swift in Sources */, B5F5251A2851A12600614FF7 /* BaseViewController.swift in Sources */, diff --git a/Manito/Manito/Global/Protocol/ViewModelType.swift b/Manito/Manito/Global/Protocol/ViewModelType.swift new file mode 100644 index 000000000..47c81c490 --- /dev/null +++ b/Manito/Manito/Global/Protocol/ViewModelType.swift @@ -0,0 +1,15 @@ +// +// ViewModelType.swift +// Manito +// +// Created by SHIN YOON AH on 2023/06/20. +// + +import Foundation + +protocol ViewModelType { + associatedtype Input + associatedtype Output + + func transform(from input: Input) -> Output +} diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift index 8f884a68e..7702a7e12 100644 --- a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -5,4 +5,25 @@ // Created by SHIN YOON AH on 2023/06/20. // +import Combine import Foundation + +final class LetterViewModel: ViewModelType { + + struct Input { + + } + + struct Output { + + } + + // MARK: - Public - func + + func transform(from input: Input) -> Output { + return Output() + } + + // MARK: - Private - func + +} From bc4a1a728feb6bde8a61e60d8c9577081aa26f2e Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 20 Jun 2023 22:27:18 +0900 Subject: [PATCH 178/468] =?UTF-8?q?[FEAT]=20Input,=20Output=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++++ Manito/Manito/Global/Protocol/Servicable.swift | 10 ++++++++++ Manito/Manito/Global/Protocol/ViewModelType.swift | 2 +- .../Letter/ViewModels/LetterViewModel.swift | 14 +++++++++++++- .../ViewControllers/LetterViewController.swift | 2 ++ 5 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 Manito/Manito/Global/Protocol/Servicable.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 4b4f1c110..36edb72b9 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -104,6 +104,7 @@ B5B3C15D2A41D6EB00AABD6F /* LetterViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C15C2A41D6EB00AABD6F /* LetterViewModel.swift */; }; B5B3C15F2A41D6F400AABD6F /* LetterService.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C15E2A41D6F400AABD6F /* LetterService.swift */; }; B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */; }; + B5B3C1632A41DBC400AABD6F /* Servicable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1622A41DBC400AABD6F /* Servicable.swift */; }; B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2AD285B2917006D880B /* Int+Extension.swift */; }; B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */; }; B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */; }; @@ -285,6 +286,7 @@ B5B3C15C2A41D6EB00AABD6F /* LetterViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterViewModel.swift; sourceTree = ""; }; B5B3C15E2A41D6F400AABD6F /* LetterService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterService.swift; sourceTree = ""; }; B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModelType.swift; sourceTree = ""; }; + B5B3C1622A41DBC400AABD6F /* Servicable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Servicable.swift; sourceTree = ""; }; B5E1F2AD285B2917006D880B /* Int+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Extension.swift"; sourceTree = ""; }; B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeViewController.swift; sourceTree = ""; }; B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultStorage.swift; sourceTree = ""; }; @@ -860,6 +862,7 @@ isa = PBXGroup; children = ( B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */, + B5B3C1622A41DBC400AABD6F /* Servicable.swift */, ); path = Protocol; sourceTree = ""; @@ -1304,6 +1307,7 @@ 39C957F4287D9EB400A04A2B /* APIService.swift in Sources */, B5F524CF28519AA000614FF7 /* AppDelegate.swift in Sources */, 435B17682913E71400212663 /* DetailingViewController.swift in Sources */, + B5B3C1632A41DBC400AABD6F /* Servicable.swift in Sources */, B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */, D7C4A1A92A0B895300C3AE4C /* ChooseCharacterView.swift in Sources */, 397A241828BA51B400454E4F /* DetailWaitProtocol.swift in Sources */, diff --git a/Manito/Manito/Global/Protocol/Servicable.swift b/Manito/Manito/Global/Protocol/Servicable.swift new file mode 100644 index 000000000..bcc5fc664 --- /dev/null +++ b/Manito/Manito/Global/Protocol/Servicable.swift @@ -0,0 +1,10 @@ +// +// Servicable.swift +// Manito +// +// Created by SHIN YOON AH on 2023/06/20. +// + +import Foundation + +protocol Servicable { } diff --git a/Manito/Manito/Global/Protocol/ViewModelType.swift b/Manito/Manito/Global/Protocol/ViewModelType.swift index 47c81c490..2b4a617e8 100644 --- a/Manito/Manito/Global/Protocol/ViewModelType.swift +++ b/Manito/Manito/Global/Protocol/ViewModelType.swift @@ -7,7 +7,7 @@ import Foundation -protocol ViewModelType { +protocol ViewModelType: AnyObject { associatedtype Input associatedtype Output diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift index 7702a7e12..86ecd8754 100644 --- a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -11,11 +11,23 @@ import Foundation final class LetterViewModel: ViewModelType { struct Input { - + let viewDidLoad: AnyPublisher + let segmentControlValueChanged: CurrentValueSubject + let refresh: PassthroughSubject } struct Output { + let letterSubject: PassthroughSubject + } + + // MARK: - property + + private let service: Servicable + + // MARK: - init + init(service: Servicable) { + self.service = service } // MARK: - Public - func diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index 5541412eb..d67384ada 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -25,6 +25,8 @@ final class LetterViewController: BaseViewController { // MARK: - property + private let viewModel: any ViewModelType + private var letterList: [Message] = [] { willSet(list) { self.letterView.updateLetterViewEmptyState(isHidden: !list.isEmpty) From 6fe90efa1b799bb11efe37fc713469cac1c29ad0 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 20 Jun 2023 22:54:19 +0900 Subject: [PATCH 179/468] =?UTF-8?q?[FEAT]=20ViewModel=EC=97=90=20=EC=84=9C?= =?UTF-8?q?=EB=B2=84=20=EC=97=B0=EA=B2=B0=20=EC=BD=94=EB=93=9C=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Letter/Services/LetterService.swift | 50 +++++++++++++++++++ .../Letter/ViewModels/LetterViewModel.swift | 31 ++++++++++-- .../LetterViewController.swift | 32 ------------ 3 files changed, 77 insertions(+), 36 deletions(-) diff --git a/Manito/Manito/Screens/Letter/Services/LetterService.swift b/Manito/Manito/Screens/Letter/Services/LetterService.swift index 5db2c19de..cb2a28ee5 100644 --- a/Manito/Manito/Screens/Letter/Services/LetterService.swift +++ b/Manito/Manito/Screens/Letter/Services/LetterService.swift @@ -6,3 +6,53 @@ // import Foundation + +protocol LetterServicable: Servicable { + func fetchSendLetter(roomId: String) async throws -> [Message] + func fetchReceiveLetter(roomId: String) async throws -> [Message] +} + +final class LetterService: LetterServicable { + + // MARK: - property + + private let api: LetterProtocol + + // MARK: - init + + init(api: LetterProtocol) { + self.api = api + } + + // MARK: - func + + func fetchSendLetter(roomId: String) async throws -> [Message] { + do { + let letterData = try await self.api.fetchSendLetter(roomId: roomId) + if let letterData { + return letterData.messages + } else { + throw NetworkError.serverError + } + } catch NetworkError.serverError { + throw NetworkError.serverError + } catch NetworkError.clientError(let message) { + throw NetworkError.clientError(message: message) + } + } + + func fetchReceiveLetter(roomId: String) async throws -> [Message] { + do { + let letterData = try await self.api.fetchReceiveLetter(roomId: roomId) + if let letterData { + return letterData.messages + } else { + throw NetworkError.serverError + } + } catch NetworkError.serverError { + throw NetworkError.serverError + } catch NetworkError.clientError(let message) { + throw NetworkError.clientError(message: message) + } + } +} diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift index 86ecd8754..f7fa10eb4 100644 --- a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -17,25 +17,48 @@ final class LetterViewModel: ViewModelType { } struct Output { - let letterSubject: PassthroughSubject + let messages: PassthroughSubject<[Message], Never> } // MARK: - property - private let service: Servicable + private let messageSubject: PassthroughSubject<[Message], Never> = PassthroughSubject() + + private let service: LetterServicable // MARK: - init - init(service: Servicable) { + init(service: LetterServicable) { self.service = service } // MARK: - Public - func func transform(from input: Input) -> Output { - return Output() + return Output(messages: self.messageSubject) } // MARK: - Private - func + private func fetchSendLetter(roomId: String) { + Task { + do { + let messages = try await self.service.fetchSendLetter(roomId: roomId) + self.messageSubject.send(messages) + } catch { + self.messageSubject.send([]) + } + } + } + + private func fetchReceivedLetter(roomId: String) { + Task { + do { + let messages = try await self.service.fetchReceiveLetter(roomId: roomId) + self.messageSubject.send(messages) + } catch { + self.messageSubject.send([]) + } + } + } } diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index d67384ada..b7991ac7b 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -112,39 +112,7 @@ final class LetterViewController: BaseViewController { // MARK: - network - private func fetchSendLetter(roomId: String, completionHandler: @escaping ((Result) -> Void)) { - Task { - do { - let letterData = try await self.letterSevice.fetchSendLetter(roomId: roomId) - if let letterData { - completionHandler(.success(letterData)) - } else { - completionHandler(.failure(.unknownError)) - } - } catch NetworkError.serverError { - completionHandler(.failure(.serverError)) - } catch NetworkError.clientError(let message) { - completionHandler(.failure(.clientError(message: message))) - } - } - } - private func fetchReceivedLetter(roomId: String, completionHandler: @escaping ((Result) -> Void)) { - Task { - do { - let letterData = try await self.letterSevice.fetchReceiveLetter(roomId: roomId) - if let letterData { - completionHandler(.success(letterData)) - } else { - completionHandler(.failure(.unknownError)) - } - } catch NetworkError.serverError { - completionHandler(.failure(.serverError)) - } catch NetworkError.clientError(let message) { - completionHandler(.failure(.clientError(message: message))) - } - } - } } // MARK: - LetterViewDelegate From 5b78746667851d6e972762f26e8387ca78b70f15 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 20 Jun 2023 23:00:45 +0900 Subject: [PATCH 180/468] =?UTF-8?q?[CHORE]=20fetchRoomInfo=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EB=B6=84=EB=A6=AC=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Ing/DetailingViewController.swift | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index caf156f99..57bf3ae93 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -53,14 +53,7 @@ final class DetailingViewController: BaseViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) self.setupLargeTitleToOriginal() - self.requestRoomInfo() { [weak self] result in - switch result { - case .success(let roomInformation): - self?.detailingView.updateDetailingView(room: roomInformation) - case .failure: - print("error") - } - } + self.requestRoomInformation() } // MARK: - func @@ -111,9 +104,20 @@ final class DetailingViewController: BaseViewController { }) } + private func requestRoomInformation() { + self.fetchRoomInformation() { [weak self] result in + switch result { + case .success(let roomInformation): + self?.detailingView.updateDetailingView(room: roomInformation) + case .failure: + print("error") + } + } + } + // MARK: - network - private func requestRoomInfo(completionHandler: @escaping ((Result) -> Void)) { + private func fetchRoomInformation(completionHandler: @escaping ((Result) -> Void)) { Task { do { let data = try await detailIngService.requestStartingRoomInfo(roomId: roomId) From 4adee5908107601ac4adb6ddc35025f3a28431e8 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 20 Jun 2023 23:04:31 +0900 Subject: [PATCH 181/468] =?UTF-8?q?[CHORE]=20mark=20=EC=A3=BC=EC=84=9D=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift | 2 ++ .../Screens/Detail-Ing/View/MissionEditViewController.swift | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift index a0c277f77..2e89f3420 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift @@ -226,6 +226,8 @@ final class DetailingView: UIView { }() private let guideView: GuideView = GuideView(type: .detailing) + // MARK: - init + override init(frame: CGRect) { super.init(frame: frame) self.setupLayout() diff --git a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift index bd8fac75b..e9d1bf650 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift @@ -11,6 +11,8 @@ import SnapKit final class MissionEditViewController: BaseViewController { + // MARK: - property + let mission: String // MARK: - component @@ -51,6 +53,8 @@ final class MissionEditViewController: BaseViewController { return label }() + // MARK: - init + init(mission: String) { self.mission = mission super.init() @@ -69,6 +73,8 @@ final class MissionEditViewController: BaseViewController { self.setupNotificationCenter() } + // MARK: - override + override func configureUI() { super.configureUI() self.view.backgroundColor = .darkGrey001.withAlphaComponent(0.5) From a2c40c3001fc27af95f8a098d281a88cd9b6fcf6 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 21 Jun 2023 00:01:18 +0900 Subject: [PATCH 182/468] =?UTF-8?q?[FEAT]=20ViewModel=20transform=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EA=B5=AC=EC=84=B1=20=EC=99=84=EB=A3=8C(#4?= =?UTF-8?q?65)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Letter/ViewModels/LetterViewModel.swift | 50 +++++++++++++++++-- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift index f7fa10eb4..b52ba63dc 100644 --- a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -10,19 +10,28 @@ import Foundation final class LetterViewModel: ViewModelType { + enum MessageType: Int { + case send = 0 + case received = 1 + } + struct Input { - let viewDidLoad: AnyPublisher - let segmentControlValueChanged: CurrentValueSubject + let viewDidLoad: AnyPublisher + let segmentControlValueChanged: CurrentValueSubject let refresh: PassthroughSubject } struct Output { let messages: PassthroughSubject<[Message], Never> + let index: PassthroughSubject } // MARK: - property private let messageSubject: PassthroughSubject<[Message], Never> = PassthroughSubject() + private let indexSubject: PassthroughSubject = PassthroughSubject() + + private var cancelBag: Set = Set() private let service: LetterServicable @@ -35,12 +44,43 @@ final class LetterViewModel: ViewModelType { // MARK: - Public - func func transform(from input: Input) -> Output { - return Output(messages: self.messageSubject) + let refreshWithType = input.refresh + .map { MessageType.send } + + Publishers.Merge3(input.viewDidLoad, input.segmentControlValueChanged, refreshWithType) + .sink(receiveValue: { [weak self] type in + self?.fetchMessages(with: type) + self?.sendCurrentIndex(at: type) + }) + .store(in: &self.cancelBag) + + return Output(messages: self.messageSubject, index: self.indexSubject) } // MARK: - Private - func - private func fetchSendLetter(roomId: String) { + private func sendCurrentIndex(at type: MessageType) { + let currentIndex = self.currentIndex(at: type) + self.indexSubject.send(currentIndex) + } + + private func fetchMessages(with type: MessageType) { + let roomId = "" // TODO: - roomId 넣기 + + switch type { + case .send: self.fetchSendMessages(roomId: roomId) + case .received: self.fetchReceivedMessages(roomId: roomId) + } + } +} + +// MARK: - Helper +extension LetterViewModel { + private func currentIndex(at type: MessageType) -> Int { + return type.rawValue + } + + private func fetchSendMessages(roomId: String) { Task { do { let messages = try await self.service.fetchSendLetter(roomId: roomId) @@ -51,7 +91,7 @@ final class LetterViewModel: ViewModelType { } } - private func fetchReceivedLetter(roomId: String) { + private func fetchReceivedMessages(roomId: String) { Task { do { let messages = try await self.service.fetchReceiveLetter(roomId: roomId) From 6bceee569c38c0999c8888109bd8d8b4a4fd62f4 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 21 Jun 2023 17:31:05 +0900 Subject: [PATCH 183/468] =?UTF-8?q?[FEAT]=20View=EC=97=90=20=EC=9E=88?= =?UTF-8?q?=EB=8A=94=20=EC=9A=94=EC=86=8C=EB=93=A4=EA=B3=BC=20ViewModel=20?= =?UTF-8?q?=EC=9A=94=EC=86=8C=EB=93=A4=20=EB=B0=94=EC=9D=B8=EB=94=A9=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 20 +- .../Global/Extension/Publisher+Combine.swift | 19 ++ .../Global/Extension/UIControl+Combine.swift | 76 +++++ .../Extension/UIViewController+Combine.swift | 18 + .../Global/Protocol/ViewModelType.swift | 2 +- .../Utils/CollectionViewDataSource.swift | 34 ++ .../Letter/Services/LetterService.swift | 17 +- .../Letter/ViewModels/LetterViewModel.swift | 38 ++- .../Cells/LetterCollectionViewCell.swift | 20 +- .../UIComponents/BottomOfSendLetterView.swift | 55 --- .../Views/UIComponents/LetterHeaderView.swift | 33 +- .../LetterViewController.swift | 315 ++++++++---------- .../Letter/Views/Views/LetterView.swift | 205 +++++++----- 13 files changed, 463 insertions(+), 389 deletions(-) create mode 100644 Manito/Manito/Global/Extension/Publisher+Combine.swift create mode 100644 Manito/Manito/Global/Extension/UIControl+Combine.swift create mode 100644 Manito/Manito/Global/Extension/UIViewController+Combine.swift create mode 100644 Manito/Manito/Global/Utils/CollectionViewDataSource.swift delete mode 100644 Manito/Manito/Screens/Letter/Views/UIComponents/BottomOfSendLetterView.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 36edb72b9..f7f2a7650 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -105,6 +105,10 @@ B5B3C15F2A41D6F400AABD6F /* LetterService.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C15E2A41D6F400AABD6F /* LetterService.swift */; }; B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */; }; B5B3C1632A41DBC400AABD6F /* Servicable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1622A41DBC400AABD6F /* Servicable.swift */; }; + B5B3C1652A427B5800AABD6F /* UIControl+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */; }; + B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */; }; + B5B3C1782A42CE9300AABD6F /* CollectionViewDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1772A42CE9300AABD6F /* CollectionViewDataSource.swift */; }; + B5B3C17A2A42EA6700AABD6F /* Publisher+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1792A42EA6700AABD6F /* Publisher+Combine.swift */; }; B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2AD285B2917006D880B /* Int+Extension.swift */; }; B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */; }; B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */; }; @@ -139,7 +143,6 @@ B5F5253128545E4C00614FF7 /* BackButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5253028545E4C00614FF7 /* BackButton.swift */; }; B5F5253528547F1900614FF7 /* LetterHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5253428547F1900614FF7 /* LetterHeaderView.swift */; }; B5F52537285481C800614FF7 /* LetterCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F52536285481C800614FF7 /* LetterCollectionViewCell.swift */; }; - B5F525392854871E00614FF7 /* BottomOfSendLetterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F525382854871E00614FF7 /* BottomOfSendLetterView.swift */; }; B5F5253B2854ABF200614FF7 /* MainButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5253A2854ABF200614FF7 /* MainButton.swift */; }; B5F5253D2854B8CB00614FF7 /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5253C2854B8CB00614FF7 /* UIView+Extension.swift */; }; B5F525422855C97900614FF7 /* UILabel+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F525412855C97900614FF7 /* UILabel+Extension.swift */; }; @@ -287,6 +290,10 @@ B5B3C15E2A41D6F400AABD6F /* LetterService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterService.swift; sourceTree = ""; }; B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModelType.swift; sourceTree = ""; }; B5B3C1622A41DBC400AABD6F /* Servicable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Servicable.swift; sourceTree = ""; }; + B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Combine.swift"; sourceTree = ""; }; + B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Combine.swift"; sourceTree = ""; }; + B5B3C1772A42CE9300AABD6F /* CollectionViewDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewDataSource.swift; sourceTree = ""; }; + B5B3C1792A42EA6700AABD6F /* Publisher+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Publisher+Combine.swift"; sourceTree = ""; }; B5E1F2AD285B2917006D880B /* Int+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Extension.swift"; sourceTree = ""; }; B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeViewController.swift; sourceTree = ""; }; B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultStorage.swift; sourceTree = ""; }; @@ -323,7 +330,6 @@ B5F5253028545E4C00614FF7 /* BackButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackButton.swift; sourceTree = ""; }; B5F5253428547F1900614FF7 /* LetterHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterHeaderView.swift; sourceTree = ""; }; B5F52536285481C800614FF7 /* LetterCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterCollectionViewCell.swift; sourceTree = ""; }; - B5F525382854871E00614FF7 /* BottomOfSendLetterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottomOfSendLetterView.swift; sourceTree = ""; }; B5F5253A2854ABF200614FF7 /* MainButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainButton.swift; sourceTree = ""; }; B5F5253C2854B8CB00614FF7 /* UIView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Extension.swift"; sourceTree = ""; }; B5F525412855C97900614FF7 /* UILabel+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UILabel+Extension.swift"; sourceTree = ""; }; @@ -842,6 +848,9 @@ 39C957CF2879521400A04A2B /* String+Extension.swift */, 39C957D12879523200A04A2B /* Date+Extension.swift */, 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */, + B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */, + B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */, + B5B3C1792A42EA6700AABD6F /* Publisher+Combine.swift */, ); path = Extension; sourceTree = ""; @@ -914,6 +923,7 @@ B5F525282851A2A400614FF7 /* Logger.swift */, B5FEE9DA28C8498A00DEA07E /* ImageCacheManager.swift */, B5FEE9DC28C849B400DEA07E /* UIImageView+Cache.swift */, + B5B3C1772A42CE9300AABD6F /* CollectionViewDataSource.swift */, ); path = Utils; sourceTree = ""; @@ -930,7 +940,6 @@ isa = PBXGroup; children = ( B5F5253428547F1900614FF7 /* LetterHeaderView.swift */, - B5F525382854871E00614FF7 /* BottomOfSendLetterView.swift */, B50B1AFA2856B5180080992C /* IndividualMissionView.swift */, B50B1AFC2856C3500080992C /* CreateLetterTextView.swift */, B50B1AFE2856D3820080992C /* CreateLetterPhotoView.swift */, @@ -1266,6 +1275,7 @@ 7E3058C82854B64D00489E6A /* InputPersonView.swift in Sources */, CBA15C94285CE1A80051EDE2 /* ChooseCharacterViewController.swift in Sources */, 39EEF65E28CB3CFE00437654 /* LoginEndPoint.swift in Sources */, + B5B3C17A2A42EA6700AABD6F /* Publisher+Combine.swift in Sources */, 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */, 39C957FC287DAAFA00A04A2B /* DetailWaitEndPoint.swift in Sources */, CB674C2128596A310063A6B7 /* CheckRoomViewController.swift in Sources */, @@ -1286,6 +1296,7 @@ 399D17AB2856C83B00F50D9D /* DetailEditViewController.swift in Sources */, 7E15F67E28B35B3D00441305 /* TextLiteral.swift in Sources */, 39C957DD2879A2B600A04A2B /* Room.swift in Sources */, + B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */, B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */, B5F525422855C97900614FF7 /* UILabel+Extension.swift in Sources */, CB21C33928C4C10200128D25 /* CharacterCollectionViewCell.swift in Sources */, @@ -1296,7 +1307,6 @@ B5F5253128545E4C00614FF7 /* BackButton.swift in Sources */, 39C957D628799AB900A04A2B /* HTTPMethod.swift in Sources */, 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */, - B5F525392854871E00614FF7 /* BottomOfSendLetterView.swift in Sources */, B5F525202851A21D00614FF7 /* UIViewController+Extension.swift in Sources */, 7ED845BA2876BE530075AC61 /* SettingViewTableCell.swift in Sources */, B5B3C15F2A41D6F400AABD6F /* LetterService.swift in Sources */, @@ -1359,6 +1369,7 @@ 39C95802287DACC300A04A2B /* RoomEndPoint.swift in Sources */, CB4C77E628C0D4EB007A1AD2 /* MainAPI.swift in Sources */, B5F524FD28519EEC00614FF7 /* UIColor+Extension.swift in Sources */, + B5B3C1782A42CE9300AABD6F /* CollectionViewDataSource.swift in Sources */, B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */, D7C4A1AD2A0DD8FA00C3AE4C /* SettingView.swift in Sources */, 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */, @@ -1373,6 +1384,7 @@ B5706BF629B9D4650093D198 /* GuideView.swift in Sources */, B50B1B41285B048A0080992C /* OpenManittoViewController.swift in Sources */, CB5AE3E6285AB76800382EA3 /* PeopleInfoView.swift in Sources */, + B5B3C1652A427B5800AABD6F /* UIControl+Combine.swift in Sources */, 39CD581F28C4C19100496E91 /* Memory.swift in Sources */, 39E099AD287FC020004F464E /* LetterDTO.swift in Sources */, B5F525222851A24100614FF7 /* UITableView+Extension.swift in Sources */, diff --git a/Manito/Manito/Global/Extension/Publisher+Combine.swift b/Manito/Manito/Global/Extension/Publisher+Combine.swift new file mode 100644 index 000000000..094084594 --- /dev/null +++ b/Manito/Manito/Global/Extension/Publisher+Combine.swift @@ -0,0 +1,19 @@ +// +// Publisher+Combine.swift +// Manito +// +// Created by SHIN YOON AH on 2023/06/21. +// + +import Combine +import Foundation + +// https://gist.github.com/pookjw/fbfba58d87563494b2fcc93077ccd4ff + +extension Publisher { + func withUnretained(_ owner: T) -> Publishers.CompactMap { + return compactMap { [weak owner] output in + owner == nil ? nil : (owner!, output) + } + } +} diff --git a/Manito/Manito/Global/Extension/UIControl+Combine.swift b/Manito/Manito/Global/Extension/UIControl+Combine.swift new file mode 100644 index 000000000..a5f2ac25e --- /dev/null +++ b/Manito/Manito/Global/Extension/UIControl+Combine.swift @@ -0,0 +1,76 @@ +// +// UIControl+Combine.swift +// Manito +// +// Created by SHIN YOON AH on 2023/06/21. +// + +import Combine +import UIKit + +extension UIControl { + func controlPublisher(for event: UIControl.Event) -> UIControl.EventPublisher { + return UIControl.EventPublisher(control: self, event: event) + } + + struct EventPublisher: Publisher { + typealias Output = UIControl + typealias Failure = Never + + let control: UIControl + let event: UIControl.Event + + func receive(subscriber: S) + where S: Subscriber, Never == S.Failure, UIControl == S.Input { + let subscription = EventSubscription( + control: self.control, + subscriber: subscriber, + event: self.event + ) + subscriber.receive(subscription: subscription) + } + } + + fileprivate class EventSubscription: Subscription + where EventSubscriber.Input == UIControl, EventSubscriber.Failure == Never { + + let control: UIControl + let event: UIControl.Event + var subscriber: EventSubscriber? + + init(control: UIControl, subscriber: EventSubscriber, event: UIControl.Event) { + self.control = control + self.subscriber = subscriber + self.event = event + + control.addTarget(self, action: #selector(self.eventDidOccur), for: event) + } + + func request(_ demand: Subscribers.Demand) {} + + func cancel() { + self.subscriber = nil + self.control.removeTarget(self, action: #selector(self.eventDidOccur), for: self.event) + } + + @objc func eventDidOccur() { + _ = self.subscriber?.receive(self.control) + } + } +} + +extension UIButton { + var tapPublisher: AnyPublisher { + self.controlPublisher(for: .touchUpInside) + .map { _ in Void() } + .eraseToAnyPublisher() + } +} + +extension UISegmentedControl { + var tapPublisher: AnyPublisher { + self.controlPublisher(for: .valueChanged) + .map { _ in Void() } + .eraseToAnyPublisher() + } +} diff --git a/Manito/Manito/Global/Extension/UIViewController+Combine.swift b/Manito/Manito/Global/Extension/UIViewController+Combine.swift new file mode 100644 index 000000000..16227fbce --- /dev/null +++ b/Manito/Manito/Global/Extension/UIViewController+Combine.swift @@ -0,0 +1,18 @@ +// +// UIViewController+Combine.swift +// Manito +// +// Created by SHIN YOON AH on 2023/06/21. +// + +import Combine +import UIKit + +extension UIViewController { + var viewDidLoadPublisher: AnyPublisher { + let selector = #selector(UIViewController.viewDidLoad) + return Just(selector) + .map { _ in Void() } + .eraseToAnyPublisher() + } +} diff --git a/Manito/Manito/Global/Protocol/ViewModelType.swift b/Manito/Manito/Global/Protocol/ViewModelType.swift index 2b4a617e8..47c81c490 100644 --- a/Manito/Manito/Global/Protocol/ViewModelType.swift +++ b/Manito/Manito/Global/Protocol/ViewModelType.swift @@ -7,7 +7,7 @@ import Foundation -protocol ViewModelType: AnyObject { +protocol ViewModelType { associatedtype Input associatedtype Output diff --git a/Manito/Manito/Global/Utils/CollectionViewDataSource.swift b/Manito/Manito/Global/Utils/CollectionViewDataSource.swift new file mode 100644 index 000000000..770fad4b8 --- /dev/null +++ b/Manito/Manito/Global/Utils/CollectionViewDataSource.swift @@ -0,0 +1,34 @@ +// +// CollectionViewDataSource.swift +// Manito +// +// Created by SHIN YOON AH on 2023/06/21. +// + +import UIKit + +final class CollectionViewDataSource: NSObject, UICollectionViewDataSource { + + private let identifier: String + private let items: [T] + private let configureCell: ((Cell, T) -> Void)? + + init(identifier: String, items: [T], configureCell: ((Cell, T) -> Void)? = nil) { + self.identifier = identifier + self.items = items + self.configureCell = configureCell + } + + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return self.items.count + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: self.identifier, for: indexPath) as? Cell else { return UICollectionViewCell() } + let item = self.items[indexPath.row] + + self.configureCell?(cell, item) + + return cell + } +} diff --git a/Manito/Manito/Screens/Letter/Services/LetterService.swift b/Manito/Manito/Screens/Letter/Services/LetterService.swift index cb2a28ee5..96c9a90ee 100644 --- a/Manito/Manito/Screens/Letter/Services/LetterService.swift +++ b/Manito/Manito/Screens/Letter/Services/LetterService.swift @@ -5,9 +5,12 @@ // Created by SHIN YOON AH on 2023/06/20. // +import Combine import Foundation protocol LetterServicable: Servicable { + var manitteeId: String? { get set } + func fetchSendLetter(roomId: String) async throws -> [Message] func fetchReceiveLetter(roomId: String) async throws -> [Message] } @@ -16,6 +19,8 @@ final class LetterService: LetterServicable { // MARK: - property + @Published var manitteeId: String? + private let api: LetterProtocol // MARK: - init @@ -24,12 +29,14 @@ final class LetterService: LetterServicable { self.api = api } - // MARK: - func + // MARK: - Public - func func fetchSendLetter(roomId: String) async throws -> [Message] { do { let letterData = try await self.api.fetchSendLetter(roomId: roomId) if let letterData { + self.setManitteeId(letterData.manittee?.id) + return letterData.messages } else { throw NetworkError.serverError @@ -45,6 +52,8 @@ final class LetterService: LetterServicable { do { let letterData = try await self.api.fetchReceiveLetter(roomId: roomId) if let letterData { + self.setManitteeId(letterData.manittee?.id) + return letterData.messages } else { throw NetworkError.serverError @@ -55,4 +64,10 @@ final class LetterService: LetterServicable { throw NetworkError.clientError(message: message) } } + + // MARK: - Private - func + + private func setManitteeId(_ id: String?) { + self.manitteeId = id + } } diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift index b52ba63dc..d6e32b5c2 100644 --- a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -10,42 +10,49 @@ import Foundation final class LetterViewModel: ViewModelType { + typealias MessageDetails = (roomId: String, mission: String, missionId: String, manitteId: String) + enum MessageType: Int { - case send = 0 + case sent = 0 case received = 1 } struct Input { let viewDidLoad: AnyPublisher - let segmentControlValueChanged: CurrentValueSubject + let segmentControlValueChanged: PassthroughSubject let refresh: PassthroughSubject } struct Output { - let messages: PassthroughSubject<[Message], Never> + let messages: PassthroughSubject<[Message], NetworkError> let index: PassthroughSubject } // MARK: - property - private let messageSubject: PassthroughSubject<[Message], Never> = PassthroughSubject() + private let messageSubject: PassthroughSubject<[Message], NetworkError> = PassthroughSubject() private let indexSubject: PassthroughSubject = PassthroughSubject() private var cancelBag: Set = Set() private let service: LetterServicable + private var messageDetails: MessageDetails // MARK: - init - init(service: LetterServicable) { + init(service: LetterServicable, + roomId: String, + mission: String, + missionId: String) { self.service = service + self.messageDetails = MessageDetails(roomId, mission, missionId, "") } // MARK: - Public - func func transform(from input: Input) -> Output { let refreshWithType = input.refresh - .map { MessageType.send } + .map { MessageType.sent } Publishers.Merge3(input.viewDidLoad, input.segmentControlValueChanged, refreshWithType) .sink(receiveValue: { [weak self] type in @@ -65,10 +72,10 @@ final class LetterViewModel: ViewModelType { } private func fetchMessages(with type: MessageType) { - let roomId = "" // TODO: - roomId 넣기 + let roomId = self.messageDetails.roomId switch type { - case .send: self.fetchSendMessages(roomId: roomId) + case .sent: self.fetchSendMessages(roomId: roomId) case .received: self.fetchReceivedMessages(roomId: roomId) } } @@ -85,8 +92,9 @@ extension LetterViewModel { do { let messages = try await self.service.fetchSendLetter(roomId: roomId) self.messageSubject.send(messages) - } catch { - self.messageSubject.send([]) + } catch(let error) { + guard let error = error as? NetworkError else { return } + self.messageSubject.send(completion: .failure(error)) } } } @@ -96,9 +104,15 @@ extension LetterViewModel { do { let messages = try await self.service.fetchReceiveLetter(roomId: roomId) self.messageSubject.send(messages) - } catch { - self.messageSubject.send([]) + } catch(let error) { + guard let error = error as? NetworkError else { return } + self.messageSubject.send(completion: .failure(error)) } } } + + private func setMessageDetail() { + guard let manitteeId = self.service.manitteeId else { return } + self.messageDetails.manitteId = manitteeId + } } diff --git a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift index 9ec4750a4..f4689674e 100644 --- a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift +++ b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift @@ -9,14 +9,9 @@ import UIKit import SnapKit -protocol LetterCollectionViewCellDelegate: AnyObject { - func didTapReportButton(content: String) - func didTapLetterImageView(imageURL: String) -} - final class LetterCollectionViewCell: BaseCollectionViewCell { - typealias ConfigurationData = (mission: String?, date: String, content: String?, imageURL: String?, isTodayLetter: Bool, canReport: Bool) + typealias ConfigurationData = (mission: String?, date: String, content: String?, imageURL: String?, isTodayLetter: Bool) // MARK: - ui component @@ -56,8 +51,7 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { // MARK: - property private var imageURL: String? - private weak var delegate: LetterCollectionViewCellDelegate? - + // MARK: - init override init(frame: CGRect) { @@ -118,7 +112,7 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { private func setupButtonAction() { let reportAction = UIAction { [weak self] _ in let content = self?.contentLabel.text ?? "글 내용 없음" - self?.delegate?.didTapReportButton(content: content) + } self.reportButton.addAction(reportAction, for: .touchUpInside) } @@ -140,10 +134,6 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { } } - func configureDelegation(_ delegate: LetterCollectionViewCellDelegate) { - self.delegate = delegate - } - func configureCell(_ data: ConfigurationData) { if let mission = data.mission { self.missionLabel.text = mission @@ -171,7 +161,7 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { } self.missionLabel.textColor = data.isTodayLetter ? .subOrange : .grey003 - self.reportButton.isHidden = !data.canReport +// self.reportButton.isHidden = !data.canReport } // MARK: - selector @@ -179,6 +169,6 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { @objc private func didTapLetterImageView() { guard let imageURL else { return } - self.delegate?.didTapLetterImageView(imageURL: imageURL) +// self.delegate?.didTapLetterImageView(imageURL: imageURL) } } diff --git a/Manito/Manito/Screens/Letter/Views/UIComponents/BottomOfSendLetterView.swift b/Manito/Manito/Screens/Letter/Views/UIComponents/BottomOfSendLetterView.swift deleted file mode 100644 index fd26bd335..000000000 --- a/Manito/Manito/Screens/Letter/Views/UIComponents/BottomOfSendLetterView.swift +++ /dev/null @@ -1,55 +0,0 @@ -// -// BottomOfSendLetterView.swift -// Manito -// -// Created by SHIN YOON AH on 2022/06/11. -// - -import UIKit - -import SnapKit - -final class BottomOfSendLetterView: UIView { - - // MARK: - ui component - - private let sendLetterButton: UIButton = { - let button = MainButton() - button.title = TextLiteral.sendLetterViewSendLetterButton - return button - }() - - // MARK: - init - - override init(frame: CGRect) { - super.init(frame: frame) - self.setupLayout() - self.configureUI() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - func - - private func setupLayout() { - self.snp.makeConstraints { - $0.height.equalTo(73) - } - - self.addSubview(self.sendLetterButton) - self.sendLetterButton.snp.makeConstraints { - $0.top.equalToSuperview().inset(13) - $0.centerX.equalToSuperview() - } - } - - private func configureUI() { - self.backgroundColor = .backgroundGrey - } - - func addAction(_ action: UIAction) { - self.sendLetterButton.addAction(action, for: .touchUpInside) - } -} diff --git a/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift b/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift index e218d21ab..5dae42c22 100644 --- a/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift +++ b/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift @@ -5,14 +5,11 @@ // Created by SHIN YOON AH on 2022/06/11. // +import Combine import UIKit import SnapKit -protocol LetterHeaderViewDelegate: AnyObject { - func selectedSegmentIndexDidChange(index: Int) -} - final class LetterHeaderView: UICollectionReusableView { // MARK: - ui component @@ -31,10 +28,6 @@ final class LetterHeaderView: UICollectionReusableView { control.backgroundColor = .darkGrey004 return control }() - - // MARK: - property - - private weak var delegate: LetterHeaderViewDelegate? // MARK: - init @@ -42,8 +35,6 @@ final class LetterHeaderView: UICollectionReusableView { super.init(frame: frame) self.setupLayout() self.configureUI() - self.setupSelectedSegmentIndex() - self.setupAction() } required init?(coder: NSCoder) { @@ -65,25 +56,7 @@ final class LetterHeaderView: UICollectionReusableView { self.backgroundColor = .backgroundGrey } - // TODO: - type으로 바뀌도록 수정 - private func setupSelectedSegmentIndex() { - self.segmentedControl.selectedSegmentIndex = 0 - } - - private func setupAction() { - let valueChangedAction = UIAction { [weak self] action in - guard let sender = action.sender as? UISegmentedControl else { return } - self?.segmentedControlIndexValueChanged(sender) - } - self.segmentedControl.addAction(valueChangedAction, for: .valueChanged) - } - - private func segmentedControlIndexValueChanged(_ segmentedControl: UISegmentedControl) { - let selectedSegmentIndex = segmentedControl.selectedSegmentIndex - self.delegate?.selectedSegmentIndexDidChange(index: selectedSegmentIndex) - } - - func configureDelegation(_ delegate: LetterHeaderViewDelegate) { - self.delegate = delegate + func tapPublisher() -> AnyPublisher { + return self.segmentedControl.tapPublisher } } diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index b7991ac7b..9014ea072 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -5,54 +5,37 @@ // Created by SHIN YOON AH on 2022/06/09. // +import Combine import UIKit final class LetterViewController: BaseViewController { - enum EntryPoint: Int { - case detail = 0, notification - } - - private enum InternalSize { - static let cellWidth: CGFloat = UIScreen.main.bounds.size.width - Size.leadingTrailingPadding * 2 - static let cellInset: UIEdgeInsets = UIEdgeInsets(top: 24.0, left: 16.0, bottom: 22.0, right: 16.0) - static let imageHeight: CGFloat = 204.0 - } - // MARK: - ui component private let letterView: LetterView = LetterView() + private var dataSource: CollectionViewDataSource! + // MARK: - property + private let messageTypeSubject: PassthroughSubject = PassthroughSubject() + private let refreshSubject: PassthroughSubject = PassthroughSubject() + + private var cancelBag: Set = Set() + private let viewModel: any ViewModelType + private var roomState: LetterView.RoomState + private var messageType: LetterView.MessageType + - private var letterList: [Message] = [] { - willSet(list) { - self.letterView.updateLetterViewEmptyState(isHidden: !list.isEmpty) - self.letterView.reloadCollectionViewData() - } - } - private let letterSevice: LetterAPI = LetterAPI(apiService: APIService()) - private var manitteeId: String? - private var roomState: String - private var roomId: String - private var mission: String - private var missionId: String - private var entryPoint: EntryPoint - // MARK: - init - init(roomState: String, - roomId: String, - mission: String, - missionId: String, - entryPoint: EntryPoint) { + init(viewModel: any ViewModelType, + roomState: LetterView.RoomState, + messageType: LetterView.MessageType) { + self.viewModel = viewModel self.roomState = roomState - self.roomId = roomId - self.mission = mission - self.missionId = missionId - self.entryPoint = entryPoint + self.messageType = messageType super.init() } @@ -69,180 +52,144 @@ final class LetterViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() - self.configureDelegation() - self.configureLetterType() - } - - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - self.letterView.configureNavigationController(self) + self.bindViewModel() + self.bindUI() } // MARK: - override override func configureUI() { super.configureUI() - // FIXME: - roomState를 Text말고 Enum으로 관리하도록 수정합니다. - if roomState == "PROCESSING" { - self.letterView.configureBottomArea() - } + self.letterView.configureLayout(with: self.roomState) + self.letterView.configureNavigationBar(of: self) } // MARK: - func - private func configureDelegation() { - self.letterView.configureDelegation(self) + private func bindViewModel() { + let output = self.transformedOutput() + + self.bindInputToViewModel() + self.bindOutputToViewModel(output) + } + + private func transformedOutput() -> LetterViewModel.Output? { + guard let viewModel = self.viewModel as? LetterViewModel else { return nil } + let input = LetterViewModel.Input( + viewDidLoad: self.viewDidLoadPublisher + .withUnretained(self) + .map { owner, _ in owner.messageType.rawValue } + .map { LetterViewModel.MessageType(rawValue: $0)! } + .eraseToAnyPublisher(), + segmentControlValueChanged: self.messageTypeSubject, + refresh: self.refreshSubject + ) + + return viewModel.transform(from: input) + } + + private func bindInputToViewModel() { + self.letterView.headerView.tapPublisher() + .withUnretained(self) + .sink(receiveValue: { owner, _ in + guard let type = LetterViewModel.MessageType(rawValue: owner.messageType.rawValue) else { return } + owner.messageTypeSubject.send(type) + }) + .store(in: &self.cancelBag) + } + + private func bindOutputToViewModel(_ output: LetterViewModel.Output?) { + guard let output = output else { return } + + output.messages + .withUnretained(self) + .map { owner, items in + owner.letterCollectionViewDataSource(items: items) + } + .catch { _ in return Just(nil)} + .withUnretained(self) + .receive(on: RunLoop.main) + .sink(receiveValue: { owner, dataSource in + guard let dataSource = dataSource else { + owner.showErrorAlert() + return + } + + owner.updateList(with: dataSource) + }) + .store(in: &self.cancelBag) + } + + private func bindUI() { + self.letterView.sendLetterButton.tapPublisher + .withUnretained(self) + .sink(receiveValue: { owner, _ in + // TODO: - create letter viewController 열기 +// guard let manitteeId else { return } +// let viewController = CreateLetterViewController(manitteeId: manitteeId, +// roomId: self.roomId, +// mission: self.mission, +// missionId: self.missionId) +// let navigationController = UINavigationController(rootViewController: viewController) +// viewController.configureDelegation(self) +// self.present(navigationController, animated: true) + }) + .store(in: &cancelBag) } - - private func configureLetterType() { - let entryIndex = self.entryPoint.rawValue - self.letterView.updateLetterType(to: .init(rawValue: entryIndex) ?? .sent) - } - - private func handleResponse(_ response: Result) { - switch response { - case .success(let data): - self.manitteeId = data.manittee?.id - self.letterList = data.messages - case .failure: - self.makeAlert(title: TextLiteral.letterViewControllerErrorTitle, - message: TextLiteral.letterViewControllerErrorDescription) - } - } - - // MARK: - network - - } -// MARK: - LetterViewDelegate -extension LetterViewController: LetterViewDelegate { - func presentCreateLetterViewController() { - guard let manitteeId else { return } - let viewController = CreateLetterViewController(manitteeId: manitteeId, - roomId: self.roomId, - mission: self.mission, - missionId: self.missionId) - let navigationController = UINavigationController(rootViewController: viewController) - viewController.configureDelegation(self) - self.present(navigationController, animated: true) +extension LetterViewController { + private func letterCollectionViewDataSource(items: [Message]) -> CollectionViewDataSource { + return CollectionViewDataSource(identifier: LetterCollectionViewCell.className, + items: items) { cell, item in + cell.configureCell((mission: item.mission, + date: item.date, + content: item.content, + imageURL: item.imageUrl, + isTodayLetter: item.isToday)) + } } - func fetchSentLetter() { - self.fetchSendLetter(roomId: self.roomId) { [weak self] response in - self?.handleResponse(response) - } + private func showErrorAlert() { + self.makeAlert(title: TextLiteral.letterViewControllerErrorTitle, + message: TextLiteral.letterViewControllerErrorDescription) } - func fetchReceivedLetter() { - self.fetchReceivedLetter(roomId: self.roomId) { [weak self] response in - self?.handleResponse(response) - } + private func updateList(with dataSource: CollectionViewDataSource) { + self.dataSource = dataSource + self.letterView.listCollectionView.dataSource = dataSource + self.letterView.listCollectionView.reloadData() } } // MARK: - CreateLetterViewControllerDelegate -extension LetterViewController: CreateLetterViewControllerDelegate { - func refreshLetterData() { - self.letterView.updateLetterType(to: .sent) - } -} +//extension LetterViewController: CreateLetterViewControllerDelegate { +// func refreshLetterData() { +// self.letterView.updateLetterType(to: .sent) +// } +//} // MARK: - LetterCollectionViewCellDelegate -extension LetterViewController: LetterCollectionViewCellDelegate { - func didTapReportButton(content: String) { - self.sendReportMail(userNickname: UserDefaultStorage.nickname ?? "", content: content) - } - - func didTapLetterImageView(imageURL: String) { - let viewController = LetterImageViewController(imageUrl: imageURL) - viewController.modalPresentationStyle = .fullScreen - viewController.modalTransitionStyle = .crossDissolve - self.present(viewController, animated: true) - } -} - -// MARK: - LetterHeaderViewDelegate -extension LetterViewController: LetterHeaderViewDelegate { - func selectedSegmentIndexDidChange(index: Int) { - self.letterView.updateLetterType(to: .init(rawValue: index) ?? .sent) - } -} - -// MARK: - UICollectionViewDataSource -extension LetterViewController: UICollectionViewDataSource { - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return self.letterList.count - } - - func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - let cell: LetterCollectionViewCell = collectionView.dequeueReusableCell(forIndexPath: indexPath) - let data = self.letterList[indexPath.item] - let canReport = self.letterView.letterType == .received - cell.configureCell((mission: data.mission, - date: data.date, - content: data.content, - imageURL: data.imageUrl, - isTodayLetter: data.isToday, - canReport: canReport)) - cell.configureDelegation(self) - return cell - } - +//extension LetterViewController: LetterCollectionViewCellDelegate { +// func didTapReportButton(content: String) { +// self.sendReportMail(userNickname: UserDefaultStorage.nickname ?? "", content: content) +// } +// +// func didTapLetterImageView(imageURL: String) { +// let viewController = LetterImageViewController(imageUrl: imageURL) +// viewController.modalPresentationStyle = .fullScreen +// viewController.modalTransitionStyle = .crossDissolve +// self.present(viewController, animated: true) +// } +//} + +private extension CollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { - switch kind { - case UICollectionView.elementKindSectionHeader: - guard let headerView = collectionView.dequeueReusableSupplementaryView( - ofKind: kind, - withReuseIdentifier: LetterHeaderView.className, - for: indexPath - ) as? LetterHeaderView else { return UICollectionReusableView() } - headerView.configureDelegation(self) - return headerView - default: - return UICollectionReusableView() - } - } -} - -// MARK: - UICollectionViewDelegateFlowLayout -extension LetterViewController: UICollectionViewDelegateFlowLayout { - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - var heights = [InternalSize.cellInset.top, InternalSize.cellInset.bottom] - - if let content = self.letterList[indexPath.item].content { - heights += [self.calculateCellContentViewHeight(by: content)] - } - - if let mission = self.letterList[indexPath.item].mission { - heights += [self.calculateCellContentViewHeight(by: mission) + 10] - } else { - let date = self.letterList[indexPath.item].date - heights += [self.calculateCellContentViewHeight(by: date) + 5] - } - - if self.letterList[indexPath.item].imageUrl != nil { - heights += [InternalSize.imageHeight] - } - - return CGSize(width: InternalSize.cellWidth, height: heights.reduce(0, +)) - } - - private func calculateCellContentViewHeight(by text: String) -> CGFloat { - let width = UIScreen.main.bounds.size.width - Size.leadingTrailingPadding * 2 - InternalSize.cellInset.left * 2 - let label = UILabel(frame: CGRect(origin: .zero, size: CGSize(width: width, height: .greatestFiniteMagnitude))) - label.text = text - label.font = .font(.regular, ofSize: 15) - label.numberOfLines = 0 - label.addLabelSpacing() - label.sizeToFit() - return label.frame.height - } -} - -// MARK: - UICollectionViewDelegate -extension LetterViewController: UICollectionViewDelegate { - func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { - self.letterView.scrollViewDidEndDraggingConfiguration() + guard let headerView = collectionView.dequeueReusableSupplementaryView( + ofKind: UICollectionView.elementKindSectionHeader, + withReuseIdentifier: LetterHeaderView.className, + for: indexPath + ) as? LetterHeaderView else { return UICollectionReusableView() } + return headerView } } diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index 47844e4a4..b601501c4 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -9,16 +9,16 @@ import UIKit import SnapKit -protocol LetterViewDelegate: AnyObject { - func presentCreateLetterViewController() - func fetchSentLetter() - func fetchReceivedLetter() -} - final class LetterView: UIView { - enum LetterType: Int { - case sent = 0, received = 1 + enum RoomState: String { + case PROCESSING + case POST + } + + enum MessageType: Int { + case sent = 0 + case received = 1 var bottomContentInset: CGFloat { return self == .received ? 0 : 73 } var isHiddenBottomArea: Bool { return self == .received } @@ -30,8 +30,11 @@ final class LetterView: UIView { } } - private enum InternalSize { + private enum ConstantSize { static let headerHeight: CGFloat = 66.0 + static let imageHeight: CGFloat = 204.0 + static let cellInset: UIEdgeInsets = UIEdgeInsets(top: 24.0, left: 16.0, bottom: 22.0, right: 16.0) + static let cellWidth: CGFloat = UIScreen.main.bounds.size.width - Size.leadingTrailingPadding * 2 static let collectionInset: UIEdgeInsets = UIEdgeInsets(top: 18.0, left: Size.leadingTrailingPadding, bottom: 18.0, @@ -40,18 +43,25 @@ final class LetterView: UIView { // MARK: - ui component - private let collectionViewFlowLayout: UICollectionViewFlowLayout = { + private let guideView: GuideView = GuideView(type: .letter) + private lazy var bottomView: UIView = { + let view = UIView() + view.backgroundColor = .backgroundGrey + return view + }() + private let listCollectionViewFlowLayout: UICollectionViewFlowLayout = { let flowLayout = UICollectionViewFlowLayout() flowLayout.scrollDirection = .vertical - flowLayout.sectionInset = InternalSize.collectionInset + flowLayout.sectionInset = ConstantSize.collectionInset flowLayout.minimumLineSpacing = 33 flowLayout.sectionHeadersPinToVisibleBounds = true flowLayout.headerReferenceSize = CGSize(width: UIScreen.main.bounds.size.width, - height: InternalSize.headerHeight) + height: ConstantSize.headerHeight) return flowLayout }() - private lazy var listCollectionView: UICollectionView = { - let collectionView = UICollectionView(frame: .zero, collectionViewLayout: self.collectionViewFlowLayout) + + lazy var listCollectionView: UICollectionView = { + let collectionView = UICollectionView(frame: .zero, collectionViewLayout: self.listCollectionViewFlowLayout) collectionView.backgroundColor = .clear collectionView.showsVerticalScrollIndicator = false collectionView.register(cell: LetterCollectionViewCell.self, @@ -61,7 +71,12 @@ final class LetterView: UIView { withReuseIdentifier: LetterHeaderView.className) return collectionView }() - private let emptyLabel: UILabel = { + lazy var sendLetterButton: UIButton = { + let button = MainButton() + button.title = TextLiteral.sendLetterViewSendLetterButton + return button + }() + let emptyLabel: UILabel = { let label = UILabel() label.numberOfLines = 2 label.font = .font(.regular, ofSize: 16) @@ -72,24 +87,13 @@ final class LetterView: UIView { label.addLabelSpacing(lineSpacing: 16) return label }() - private lazy var sendLetterView: BottomOfSendLetterView = BottomOfSendLetterView() - private let guideView: GuideView = GuideView(type: .letter) - - // MARK: - property - - private weak var delegate: LetterViewDelegate? - private(set) var letterType: LetterType = .sent { - willSet(type) { - self.updateLetterView(to: type) - } - } + let headerView: LetterHeaderView = LetterHeaderView() // MARK: - init override init(frame: CGRect) { super.init(frame: frame) self.setupLayout() - self.setupButtonAction() } @available(*, unavailable) @@ -98,7 +102,7 @@ final class LetterView: UIView { } deinit { - self.guideView.setupDisappearedConfiguration() + self.hideGuideView() } // MARK: - func @@ -115,18 +119,18 @@ final class LetterView: UIView { } } - private func setupBottomOfSendLetterView() { - self.addSubview(self.sendLetterView) - self.sendLetterView.snp.makeConstraints { + private func setupBottomViewLayout() { + self.addSubview(self.bottomView) + self.bottomView.snp.makeConstraints { $0.leading.trailing.bottom.equalTo(self.safeAreaLayoutGuide) + $0.height.equalTo(73) } - } - private func setupButtonAction() { - let presentCreateLetterAction = UIAction { [weak self] _ in - self?.delegate?.presentCreateLetterViewController() + self.bottomView.addSubview(self.sendLetterButton) + self.sendLetterButton.snp.makeConstraints { + $0.top.equalToSuperview().inset(13) + $0.centerX.equalToSuperview() } - self.sendLetterView.addAction(presentCreateLetterAction) } private func setupNavigationTitle(in viewController: UIViewController) { @@ -143,65 +147,92 @@ final class LetterView: UIView { self.guideView.hideGuideViewWhenTappedAround(in: navigationController, viewController) } - private func updateLetterView(to type: LetterType) { - self.updateEmptyLabel(to: type.emptyText) - self.updateListCollectionViewConfiguration(to: type) - self.updateLetter(to: type) - } - - private func updateEmptyLabel(to text: String) { - self.emptyLabel.text = text - } - - private func updateListCollectionViewConfiguration(to type: LetterType) { - let bottomInset: CGFloat = type.bottomContentInset - let yPoint = self.listCollectionView.adjustedContentInset.top + 1 - - self.sendLetterView.isHidden = type.isHiddenBottomArea - self.listCollectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: bottomInset, right: 0) - self.listCollectionView.setContentOffset(CGPoint(x: 0, y: -yPoint), animated: false) - self.listCollectionView.collectionViewLayout.invalidateLayout() - } +// private func updateLetterView(to type: LetterType) { +// self.updateEmptyLabel(to: type.emptyText) +// self.updateListCollectionViewConfiguration(to: type) +// self.updateLetter(to: type) +// } +// +// private func updateEmptyLabel(to text: String) { +// self.emptyLabel.text = text +// } +// +// private func updateListCollectionViewConfiguration(to type: LetterType) { +// let bottomInset: CGFloat = type.bottomContentInset +// let yPoint = self.listCollectionView.adjustedContentInset.top + 1 +// +// self.bottomView.isHidden = type.isHiddenBottomArea +// self.listCollectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: bottomInset, right: 0) +// self.listCollectionView.setContentOffset(CGPoint(x: 0, y: -yPoint), animated: false) +// self.listCollectionView.collectionViewLayout.invalidateLayout() +// } +// +// private func updateLetter(to type: LetterType) { +// switch type { +// case .sent: +// self.delegate?.fetchSentLetter() +// case .received: +// self.delegate?.fetchReceivedLetter() +// } +// } + + // TODO: - roomstate를 public한 enum으로 변경할 것 + func configureLayout(with state: RoomState) { + self.setupLayout() - private func updateLetter(to type: LetterType) { - switch type { - case .sent: - self.delegate?.fetchSentLetter() - case .received: - self.delegate?.fetchReceivedLetter() + if state == .PROCESSING { + self.setupBottomViewLayout() } } - func configureDelegation(_ delegate: UICollectionViewDataSource & UICollectionViewDelegate & LetterViewDelegate) { - self.listCollectionView.delegate = delegate - self.listCollectionView.dataSource = delegate - self.delegate = delegate - } - - func configureNavigationController(_ viewController: UIViewController) { + func configureNavigationBar(of viewController: UIViewController) { self.setupNavigationTitle(in: viewController) self.setupGuideView(in: viewController) } - func configureBottomArea() { - self.setupBottomOfSendLetterView() - } - - /// 원하는 타입(.sent, .received)을 넣으면 해당 타입으로 서버 통신을 진행합니다. - /// 서버 통신이 성공하면 ViewController에 있는 List를 통해서 뷰가 update 됩니다. - func updateLetterType(to type: LetterType) { - self.letterType = type - } - - func updateLetterViewEmptyState(isHidden: Bool) { - self.emptyLabel.isHidden = isHidden - } - - func reloadCollectionViewData() { - self.listCollectionView.reloadData() - } - - func scrollViewDidEndDraggingConfiguration() { + func hideGuideView() { self.guideView.setupDisappearedConfiguration() } } + +// MARK: - UICollectionViewDelegateFlowLayout +//extension LetterView: UICollectionViewDelegateFlowLayout { +// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { +// var heights = [ConstantSize.cellInset.top, ConstantSize.cellInset.bottom] +// +// if let content = self.letterList[indexPath.item].content { +// heights += [self.calculateCellContentViewHeight(by: content)] +// } +// +// if let mission = self.letterList[indexPath.item].mission { +// heights += [self.calculateCellContentViewHeight(by: mission) + 10] +// } else { +// let date = self.letterList[indexPath.item].date +// heights += [self.calculateCellContentViewHeight(by: date) + 5] +// } +// +// if self.letterList[indexPath.item].imageUrl != nil { +// heights += [ConstantSize.imageHeight] +// } +// +// return CGSize(width: ConstantSize.cellWidth, height: heights.reduce(0, +)) +// } +// +// private func calculateCellContentViewHeight(by text: String) -> CGFloat { +// let width = UIScreen.main.bounds.size.width - Size.leadingTrailingPadding * 2 - ConstantSize.cellInset.left * 2 +// let label = UILabel(frame: CGRect(origin: .zero, size: CGSize(width: width, height: .greatestFiniteMagnitude))) +// label.text = text +// label.font = .font(.regular, ofSize: 15) +// label.numberOfLines = 0 +// label.addLabelSpacing() +// label.sizeToFit() +// return label.frame.height +// } +//} + +// MARK: - UICollectionViewDelegate +//extension LetterView: UICollectionViewDelegate { +// func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { +// self.hideGuideView() +// } +//} From 002c0571bfe9b3d83b7d9a5325c69b8495ca67a1 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 21 Jun 2023 17:53:18 +0900 Subject: [PATCH 184/468] =?UTF-8?q?[FEAT]=20CreateLetterVC=20=EC=9D=B4?= =?UTF-8?q?=EB=8F=99=ED=95=98=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EB=B0=8F=20ViewModel=EA=B3=BC=20=EC=97=B0=EA=B2=B0?= =?UTF-8?q?(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Letter/ViewModels/LetterViewModel.swift | 23 ++++++--- .../Views/UIComponents/LetterHeaderView.swift | 12 +++-- .../LetterViewController.swift | 49 +++++++++++-------- 3 files changed, 54 insertions(+), 30 deletions(-) diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift index d6e32b5c2..571837228 100644 --- a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -10,7 +10,7 @@ import Foundation final class LetterViewModel: ViewModelType { - typealias MessageDetails = (roomId: String, mission: String, missionId: String, manitteId: String) + typealias MessageDetails = (roomId: String, mission: String, missionId: String, manitteeId: String) enum MessageType: Int { case sent = 0 @@ -21,11 +21,13 @@ final class LetterViewModel: ViewModelType { let viewDidLoad: AnyPublisher let segmentControlValueChanged: PassthroughSubject let refresh: PassthroughSubject + let sendLetterButtonDidTap: AnyPublisher } struct Output { let messages: PassthroughSubject<[Message], NetworkError> let index: PassthroughSubject + let messageDetails: AnyPublisher } // MARK: - property @@ -55,13 +57,22 @@ final class LetterViewModel: ViewModelType { .map { MessageType.sent } Publishers.Merge3(input.viewDidLoad, input.segmentControlValueChanged, refreshWithType) - .sink(receiveValue: { [weak self] type in - self?.fetchMessages(with: type) - self?.sendCurrentIndex(at: type) + .withUnretained(self) + .sink(receiveValue: { owner, type in + owner.fetchMessages(with: type) + owner.sendCurrentIndex(at: type) }) .store(in: &self.cancelBag) - return Output(messages: self.messageSubject, index: self.indexSubject) + let messagePublisher = input.sendLetterButtonDidTap + .withUnretained(self) + .map { owner, _ -> MessageDetails in + owner.setMessageDetail() + return owner.messageDetails + } + .eraseToAnyPublisher() + + return Output(messages: self.messageSubject, index: self.indexSubject, messageDetails: messagePublisher) } // MARK: - Private - func @@ -113,6 +124,6 @@ extension LetterViewModel { private func setMessageDetail() { guard let manitteeId = self.service.manitteeId else { return } - self.messageDetails.manitteId = manitteeId + self.messageDetails.manitteeId = manitteeId } } diff --git a/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift b/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift index 5dae42c22..17c2c52e6 100644 --- a/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift +++ b/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift @@ -42,6 +42,14 @@ final class LetterHeaderView: UICollectionReusableView { } // MARK: - func + + func tapPublisher() -> AnyPublisher { + return self.segmentedControl.tapPublisher + } + + func setValue(_ value: Int) { + self.segmentedControl.selectedSegmentIndex = value + } private func setupLayout() { self.addSubview(self.segmentedControl) @@ -55,8 +63,4 @@ final class LetterHeaderView: UICollectionReusableView { private func configureUI() { self.backgroundColor = .backgroundGrey } - - func tapPublisher() -> AnyPublisher { - return self.segmentedControl.tapPublisher - } } diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index 9014ea072..27a059fe0 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -82,7 +82,8 @@ final class LetterViewController: BaseViewController { .map { LetterViewModel.MessageType(rawValue: $0)! } .eraseToAnyPublisher(), segmentControlValueChanged: self.messageTypeSubject, - refresh: self.refreshSubject + refresh: self.refreshSubject, + sendLetterButtonDidTap: self.letterView.sendLetterButton.tapPublisher.eraseToAnyPublisher() ) return viewModel.transform(from: input) @@ -118,23 +119,30 @@ final class LetterViewController: BaseViewController { owner.updateList(with: dataSource) }) .store(in: &self.cancelBag) - } - private func bindUI() { - self.letterView.sendLetterButton.tapPublisher + output.index .withUnretained(self) - .sink(receiveValue: { owner, _ in - // TODO: - create letter viewController 열기 -// guard let manitteeId else { return } -// let viewController = CreateLetterViewController(manitteeId: manitteeId, -// roomId: self.roomId, -// mission: self.mission, -// missionId: self.missionId) -// let navigationController = UINavigationController(rootViewController: viewController) -// viewController.configureDelegation(self) -// self.present(navigationController, animated: true) + .sink(receiveValue: { owner, index in + owner.letterView.headerView.setValue(index) + }) + .store(in: &self.cancelBag) + + output.messageDetails + .withUnretained(self) + .sink(receiveValue: { owner, details in + let viewController = CreateLetterViewController(manitteeId: details.manitteeId, + roomId: details.roomId, + mission: details.mission, + missionId: details.missionId) + let navigationController = UINavigationController(rootViewController: viewController) + viewController.configureDelegation(self) + owner.present(navigationController, animated: true) }) - .store(in: &cancelBag) + .store(in: &self.cancelBag) + } + + private func bindUI() { + } } @@ -162,12 +170,13 @@ extension LetterViewController { } } +// TODO: - CreateLetter 부분에서 수정 더 진행해볼 예정 // MARK: - CreateLetterViewControllerDelegate -//extension LetterViewController: CreateLetterViewControllerDelegate { -// func refreshLetterData() { -// self.letterView.updateLetterType(to: .sent) -// } -//} +extension LetterViewController: CreateLetterViewControllerDelegate { + func refreshLetterData() { + self.letterView.updateLetterType(to: .sent) + } +} // MARK: - LetterCollectionViewCellDelegate //extension LetterViewController: LetterCollectionViewCellDelegate { From 3998f9e47538aa9e78a0989cbcd15c38a9d2b01e Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 21 Jun 2023 18:36:09 +0900 Subject: [PATCH 185/468] =?UTF-8?q?[FEAT]=20Cell=20=EC=95=88=EC=97=90=20?= =?UTF-8?q?=EC=9E=88=EB=8A=94=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20Tap?= =?UTF-8?q?=20=EC=A0=9C=EC=8A=A4=EC=B2=98=20=EA=B0=90=EC=A7=80=20=EB=B0=8F?= =?UTF-8?q?=20=EB=B0=94=EC=9D=B8=EB=94=A9(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++ .../Global/Extension/UIView+Combine.swift | 59 ++++++++++++++++++ .../Cells/LetterCollectionViewCell.swift | 61 ++++++------------- .../Views/UIComponents/LetterHeaderView.swift | 10 +-- .../LetterViewController.swift | 44 ++++++------- 5 files changed, 110 insertions(+), 68 deletions(-) create mode 100644 Manito/Manito/Global/Extension/UIView+Combine.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index f7f2a7650..a6d4b2c21 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -109,6 +109,7 @@ B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */; }; B5B3C1782A42CE9300AABD6F /* CollectionViewDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1772A42CE9300AABD6F /* CollectionViewDataSource.swift */; }; B5B3C17A2A42EA6700AABD6F /* Publisher+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1792A42EA6700AABD6F /* Publisher+Combine.swift */; }; + B5B3C1842A42F70C00AABD6F /* UIView+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1832A42F70C00AABD6F /* UIView+Combine.swift */; }; B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2AD285B2917006D880B /* Int+Extension.swift */; }; B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */; }; B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */; }; @@ -294,6 +295,7 @@ B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Combine.swift"; sourceTree = ""; }; B5B3C1772A42CE9300AABD6F /* CollectionViewDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewDataSource.swift; sourceTree = ""; }; B5B3C1792A42EA6700AABD6F /* Publisher+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Publisher+Combine.swift"; sourceTree = ""; }; + B5B3C1832A42F70C00AABD6F /* UIView+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Combine.swift"; sourceTree = ""; }; B5E1F2AD285B2917006D880B /* Int+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Extension.swift"; sourceTree = ""; }; B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeViewController.swift; sourceTree = ""; }; B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultStorage.swift; sourceTree = ""; }; @@ -851,6 +853,7 @@ B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */, B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */, B5B3C1792A42EA6700AABD6F /* Publisher+Combine.swift */, + B5B3C1832A42F70C00AABD6F /* UIView+Combine.swift */, ); path = Extension; sourceTree = ""; @@ -1307,6 +1310,7 @@ B5F5253128545E4C00614FF7 /* BackButton.swift in Sources */, 39C957D628799AB900A04A2B /* HTTPMethod.swift in Sources */, 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */, + B5B3C1842A42F70C00AABD6F /* UIView+Combine.swift in Sources */, B5F525202851A21D00614FF7 /* UIViewController+Extension.swift in Sources */, 7ED845BA2876BE530075AC61 /* SettingViewTableCell.swift in Sources */, B5B3C15F2A41D6F400AABD6F /* LetterService.swift in Sources */, diff --git a/Manito/Manito/Global/Extension/UIView+Combine.swift b/Manito/Manito/Global/Extension/UIView+Combine.swift new file mode 100644 index 000000000..0383f55dc --- /dev/null +++ b/Manito/Manito/Global/Extension/UIView+Combine.swift @@ -0,0 +1,59 @@ +// +// UIView+Combine.swift +// Manito +// +// Created by SHIN YOON AH on 2023/06/21. +// + +import Combine +import UIKit + +// https://0urtrees.tistory.com/365 + +extension UIGestureRecognizer { + struct GesturePublisher: Combine.Publisher where G: UIGestureRecognizer { + typealias Output = G + typealias Failure = Never + + let gestureRecognizer: G + let view: UIView + + func receive(subscriber: S) where S : Subscriber, Failure == S.Failure, Output == S.Input { + subscriber.receive( + subscription: Subscription(subscriber: subscriber, gestureRecognizer: gestureRecognizer, on: view) + ) + } + } + + class Subscription: Combine.Subscription where S.Input == G, S.Failure == Never { + var subscriber: S? + let gestureRecognizer: G + let view: UIView + + init(subscriber: S, gestureRecognizer: G, on view: UIView) { + self.subscriber = subscriber + self.gestureRecognizer = gestureRecognizer + self.view = view + gestureRecognizer.addTarget(self, action: #selector(handle)) + view.addGestureRecognizer(gestureRecognizer) + } + + @objc private func handle(_ gesture: UIGestureRecognizer) { + _ = subscriber?.receive(gestureRecognizer) + } + + func cancel() { + view.removeGestureRecognizer(gestureRecognizer) + } + + func request(_ demand: Subscribers.Demand) { } + } +} + +extension UIView { + var tapGesturePublisher: AnyPublisher { + return UITapGestureRecognizer.GesturePublisher(gestureRecognizer: .init(), view: self) + .map { _ in Void() } + .eraseToAnyPublisher() + } +} diff --git a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift index f4689674e..bc613482c 100644 --- a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift +++ b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift @@ -5,6 +5,7 @@ // Created by SHIN YOON AH on 2022/06/11. // +import Combine import UIKit import SnapKit @@ -50,21 +51,16 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { // MARK: - property - private var imageURL: String? - - // MARK: - init - - override init(frame: CGRect) { - super.init(frame: frame) - self.setupButtonAction() - self.setupImageTapGesture() + var reportButtonTapPublisher: AnyPublisher { + return self.reportButton.tapPublisher } - @available(*, unavailable) - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") + var imageViewTapGesturePublisher: AnyPublisher { + return self.photoImageView.tapGesturePublisher } + private var imageURL: String? + // MARK: - override override func prepareForReuse() { @@ -108,31 +104,6 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { } // MARK: - func - - private func setupButtonAction() { - let reportAction = UIAction { [weak self] _ in - let content = self?.contentLabel.text ?? "글 내용 없음" - - } - self.reportButton.addAction(reportAction, for: .touchUpInside) - } - - private func setupImageTapGesture() { - let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.didTapLetterImageView)) - self.photoImageView.addGestureRecognizer(tapGesture) - } - - private func initializeConfiguration() { - self.missionLabel.text = nil - self.contentLabel.text = nil - self.photoImageView.image = nil - self.missionLabel.snp.updateConstraints { - $0.bottom.equalTo(self.contentLabel.snp.top).offset(5) - } - self.photoImageView.snp.updateConstraints { - $0.height.equalTo(0) - } - } func configureCell(_ data: ConfigurationData) { if let mission = data.mission { @@ -151,7 +122,7 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { self.contentLabel.text = content self.contentLabel.addLabelSpacing() } - + if let imageURL = data.imageURL { self.imageURL = imageURL self.photoImageView.loadImageUrl(imageURL) @@ -164,11 +135,15 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { // self.reportButton.isHidden = !data.canReport } - // MARK: - selector - - @objc - private func didTapLetterImageView() { - guard let imageURL else { return } -// self.delegate?.didTapLetterImageView(imageURL: imageURL) + private func initializeConfiguration() { + self.missionLabel.text = nil + self.contentLabel.text = nil + self.photoImageView.image = nil + self.missionLabel.snp.updateConstraints { + $0.bottom.equalTo(self.contentLabel.snp.top).offset(5) + } + self.photoImageView.snp.updateConstraints { + $0.height.equalTo(0) + } } } diff --git a/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift b/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift index 17c2c52e6..a396ace9f 100644 --- a/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift +++ b/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift @@ -28,6 +28,12 @@ final class LetterHeaderView: UICollectionReusableView { control.backgroundColor = .darkGrey004 return control }() + + // MARK: - property + + var segmentedControlTapPublisher: AnyPublisher { + return self.segmentedControl.tapPublisher + } // MARK: - init @@ -43,10 +49,6 @@ final class LetterHeaderView: UICollectionReusableView { // MARK: - func - func tapPublisher() -> AnyPublisher { - return self.segmentedControl.tapPublisher - } - func setValue(_ value: Int) { self.segmentedControl.selectedSegmentIndex = value } diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index 27a059fe0..42b45ad2e 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -53,7 +53,6 @@ final class LetterViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() self.bindViewModel() - self.bindUI() } // MARK: - override @@ -83,7 +82,7 @@ final class LetterViewController: BaseViewController { .eraseToAnyPublisher(), segmentControlValueChanged: self.messageTypeSubject, refresh: self.refreshSubject, - sendLetterButtonDidTap: self.letterView.sendLetterButton.tapPublisher.eraseToAnyPublisher() + sendLetterButtonDidTap: self.letterView.sendLetterButton.tapPublisher ) return viewModel.transform(from: input) @@ -140,10 +139,6 @@ final class LetterViewController: BaseViewController { }) .store(in: &self.cancelBag) } - - private func bindUI() { - - } } extension LetterViewController { @@ -155,9 +150,30 @@ extension LetterViewController { content: item.content, imageURL: item.imageUrl, isTodayLetter: item.isToday)) + self.bindCell(cell, with: item) } } + private func bindCell(_ cell: LetterCollectionViewCell, with item: Message) { + cell.reportButtonTapPublisher + .withUnretained(self) + .sink(receiveValue: { owner, _ in +// owner.sendReportMail(userNickname: <#T##String#>, content: <#T##String#>) + }) + .store(in: &self.cancelBag) + + cell.imageViewTapGesturePublisher + .withUnretained(self) + .sink(receiveValue: { owner, _ in + guard let imageUrl = item.imageUrl else { return } + let viewController = LetterImageViewController(imageUrl: imageUrl) + viewController.modalPresentationStyle = .fullScreen + viewController.modalTransitionStyle = .crossDissolve + owner.present(viewController, animated: true) + }) + .store(in: &self.cancelBag) + } + private func showErrorAlert() { self.makeAlert(title: TextLiteral.letterViewControllerErrorTitle, message: TextLiteral.letterViewControllerErrorDescription) @@ -174,24 +190,10 @@ extension LetterViewController { // MARK: - CreateLetterViewControllerDelegate extension LetterViewController: CreateLetterViewControllerDelegate { func refreshLetterData() { - self.letterView.updateLetterType(to: .sent) +// self.letterView.updateLetterType(to: .sent) } } -// MARK: - LetterCollectionViewCellDelegate -//extension LetterViewController: LetterCollectionViewCellDelegate { -// func didTapReportButton(content: String) { -// self.sendReportMail(userNickname: UserDefaultStorage.nickname ?? "", content: content) -// } -// -// func didTapLetterImageView(imageURL: String) { -// let viewController = LetterImageViewController(imageUrl: imageURL) -// viewController.modalPresentationStyle = .fullScreen -// viewController.modalTransitionStyle = .crossDissolve -// self.present(viewController, animated: true) -// } -//} - private extension CollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { guard let headerView = collectionView.dequeueReusableSupplementaryView( From ff28fbb51fc60fba95873074c2706b9f5d09fb70 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 21 Jun 2023 19:01:36 +0900 Subject: [PATCH 186/468] =?UTF-8?q?[FEAT]=20report=20=EB=B6=80=EB=B6=84=20?= =?UTF-8?q?ViewModel=EA=B3=BC=20=EC=97=B0=EA=B2=B0=20=EC=99=84=EB=A3=8C(#4?= =?UTF-8?q?65)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Letter/Services/LetterService.swift | 8 +++ .../Letter/ViewModels/LetterViewModel.swift | 19 +++++-- .../LetterViewController.swift | 54 ++++++++++--------- .../Letter/Views/Views/LetterView.swift | 45 +++++++--------- 4 files changed, 71 insertions(+), 55 deletions(-) diff --git a/Manito/Manito/Screens/Letter/Services/LetterService.swift b/Manito/Manito/Screens/Letter/Services/LetterService.swift index 96c9a90ee..af883de96 100644 --- a/Manito/Manito/Screens/Letter/Services/LetterService.swift +++ b/Manito/Manito/Screens/Letter/Services/LetterService.swift @@ -10,9 +10,11 @@ import Foundation protocol LetterServicable: Servicable { var manitteeId: String? { get set } + var nickname: String { get set } func fetchSendLetter(roomId: String) async throws -> [Message] func fetchReceiveLetter(roomId: String) async throws -> [Message] + func loadNickname() } final class LetterService: LetterServicable { @@ -20,6 +22,7 @@ final class LetterService: LetterServicable { // MARK: - property @Published var manitteeId: String? + @Published var nickname: String = "" private let api: LetterProtocol @@ -65,9 +68,14 @@ final class LetterService: LetterServicable { } } + func loadNickname() { + self.nickname = UserDefaultStorage.nickname + } + // MARK: - Private - func private func setManitteeId(_ id: String?) { self.manitteeId = id } + } diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift index 571837228..63fb39a02 100644 --- a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -11,6 +11,7 @@ import Foundation final class LetterViewModel: ViewModelType { typealias MessageDetails = (roomId: String, mission: String, missionId: String, manitteeId: String) + typealias ReportDetails = (nickname: String, content: String) enum MessageType: Int { case sent = 0 @@ -19,15 +20,17 @@ final class LetterViewModel: ViewModelType { struct Input { let viewDidLoad: AnyPublisher - let segmentControlValueChanged: PassthroughSubject + let segmentControlValueChanged: AnyPublisher let refresh: PassthroughSubject let sendLetterButtonDidTap: AnyPublisher + let reportButtonDidTap: PassthroughSubject } struct Output { let messages: PassthroughSubject<[Message], NetworkError> let index: PassthroughSubject let messageDetails: AnyPublisher + let reportDetails: AnyPublisher } // MARK: - property @@ -67,12 +70,20 @@ final class LetterViewModel: ViewModelType { let messagePublisher = input.sendLetterButtonDidTap .withUnretained(self) .map { owner, _ -> MessageDetails in - owner.setMessageDetail() + owner.loadMessageDetails() return owner.messageDetails } .eraseToAnyPublisher() - return Output(messages: self.messageSubject, index: self.indexSubject, messageDetails: messagePublisher) + let reportPublisher = input.reportButtonDidTap + .withUnretained(self) + .map { owner, content -> ReportDetails in + owner.service.loadNickname() + return (owner.service.nickname, content) + } + .eraseToAnyPublisher() + + return Output(messages: self.messageSubject, index: self.indexSubject, messageDetails: messagePublisher, reportDetails: reportPublisher) } // MARK: - Private - func @@ -122,7 +133,7 @@ extension LetterViewModel { } } - private func setMessageDetail() { + private func loadMessageDetails() { guard let manitteeId = self.service.manitteeId else { return } self.messageDetails.manitteeId = manitteeId } diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index 42b45ad2e..71e4fbde5 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -18,7 +18,7 @@ final class LetterViewController: BaseViewController { // MARK: - property - private let messageTypeSubject: PassthroughSubject = PassthroughSubject() + private let reportSubject: PassthroughSubject = PassthroughSubject() private let refreshSubject: PassthroughSubject = PassthroughSubject() private var cancelBag: Set = Set() @@ -67,37 +67,34 @@ final class LetterViewController: BaseViewController { private func bindViewModel() { let output = self.transformedOutput() - - self.bindInputToViewModel() self.bindOutputToViewModel(output) } private func transformedOutput() -> LetterViewModel.Output? { guard let viewModel = self.viewModel as? LetterViewModel else { return nil } let input = LetterViewModel.Input( - viewDidLoad: self.viewDidLoadPublisher - .withUnretained(self) - .map { owner, _ in owner.messageType.rawValue } - .map { LetterViewModel.MessageType(rawValue: $0)! } - .eraseToAnyPublisher(), - segmentControlValueChanged: self.messageTypeSubject, + viewDidLoad: + self.viewDidLoadPublisher + .withUnretained(self) + .map { owner, _ in owner.messageType.rawValue } + .map { LetterViewModel.MessageType(rawValue: $0)! } + .eraseToAnyPublisher(), + segmentControlValueChanged: + self.letterView.headerView.segmentedControlTapPublisher + .withUnretained(self) + .map { owner, _ -> LetterViewModel.MessageType in + guard let type = LetterViewModel.MessageType(rawValue: owner.messageType.rawValue) else { return .sent } + return type + } + .eraseToAnyPublisher(), refresh: self.refreshSubject, - sendLetterButtonDidTap: self.letterView.sendLetterButton.tapPublisher + sendLetterButtonDidTap: self.letterView.sendLetterButton.tapPublisher, + reportButtonDidTap: self.reportSubject ) return viewModel.transform(from: input) } - private func bindInputToViewModel() { - self.letterView.headerView.tapPublisher() - .withUnretained(self) - .sink(receiveValue: { owner, _ in - guard let type = LetterViewModel.MessageType(rawValue: owner.messageType.rawValue) else { return } - owner.messageTypeSubject.send(type) - }) - .store(in: &self.cancelBag) - } - private func bindOutputToViewModel(_ output: LetterViewModel.Output?) { guard let output = output else { return } @@ -138,6 +135,13 @@ final class LetterViewController: BaseViewController { owner.present(navigationController, animated: true) }) .store(in: &self.cancelBag) + + output.reportDetails + .withUnretained(self) + .sink(receiveValue: { owner, details in + owner.sendReportMail(userNickname: details.nickname, content: details.content) + }) + .store(in: &self.cancelBag) } } @@ -158,7 +162,11 @@ extension LetterViewController { cell.reportButtonTapPublisher .withUnretained(self) .sink(receiveValue: { owner, _ in -// owner.sendReportMail(userNickname: <#T##String#>, content: <#T##String#>) + if let content = item.content { + owner.reportSubject.send(content) + } else { + owner.reportSubject.send("쪽지 내용 없음") + } }) .store(in: &self.cancelBag) @@ -186,11 +194,9 @@ extension LetterViewController { } } -// TODO: - CreateLetter 부분에서 수정 더 진행해볼 예정 -// MARK: - CreateLetterViewControllerDelegate extension LetterViewController: CreateLetterViewControllerDelegate { func refreshLetterData() { -// self.letterView.updateLetterType(to: .sent) + self.refreshSubject.send(()) } } diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index b601501c4..d6d63f70e 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -107,6 +107,24 @@ final class LetterView: UIView { // MARK: - func + // TODO: - roomstate를 public한 enum으로 변경할 것 + func configureLayout(with state: RoomState) { + self.setupLayout() + + if state == .PROCESSING { + self.setupBottomViewLayout() + } + } + + func configureNavigationBar(of viewController: UIViewController) { + self.setupNavigationTitle(in: viewController) + self.setupGuideView(in: viewController) + } + + func hideGuideView() { + self.guideView.setupDisappearedConfiguration() + } + private func setupLayout() { self.addSubview(self.listCollectionView) self.listCollectionView.snp.makeConstraints { @@ -166,33 +184,6 @@ final class LetterView: UIView { // self.listCollectionView.setContentOffset(CGPoint(x: 0, y: -yPoint), animated: false) // self.listCollectionView.collectionViewLayout.invalidateLayout() // } -// -// private func updateLetter(to type: LetterType) { -// switch type { -// case .sent: -// self.delegate?.fetchSentLetter() -// case .received: -// self.delegate?.fetchReceivedLetter() -// } -// } - - // TODO: - roomstate를 public한 enum으로 변경할 것 - func configureLayout(with state: RoomState) { - self.setupLayout() - - if state == .PROCESSING { - self.setupBottomViewLayout() - } - } - - func configureNavigationBar(of viewController: UIViewController) { - self.setupNavigationTitle(in: viewController) - self.setupGuideView(in: viewController) - } - - func hideGuideView() { - self.guideView.setupDisappearedConfiguration() - } } // MARK: - UICollectionViewDelegateFlowLayout From e055ca6c4192be0982309c49367635604ec29974 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 21 Jun 2023 20:11:12 +0900 Subject: [PATCH 187/468] =?UTF-8?q?[CHORE]=20=EC=9D=B4=EC=A0=84=20?= =?UTF-8?q?=EB=B7=B0=EC=97=90=EC=84=9C=20=EB=84=98=EC=96=B4=EA=B0=80?= =?UTF-8?q?=EB=8A=94=20=EB=B6=80=EB=B6=84=20=EC=88=98=EC=A0=95(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 8 ---- .../Detail-Ing/DetailingViewController.swift | 41 +++++++++++-------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index a6d4b2c21..aa7c85907 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -664,13 +664,6 @@ path = Services; sourceTree = ""; }; - B5B3C15B2A41D6D500AABD6F /* Protocols */ = { - isa = PBXGroup; - children = ( - ); - path = Protocols; - sourceTree = ""; - }; B5F31BAE28BE1C7900F61D0F /* Storage */ = { isa = PBXGroup; children = ( @@ -801,7 +794,6 @@ B5F524EA28519B4B00614FF7 /* Letter */ = { isa = PBXGroup; children = ( - B5B3C15B2A41D6D500AABD6F /* Protocols */, B54741DE29A3A4BA00B75BA3 /* Views */, B5B3C1572A41D65400AABD6F /* ViewModels */, B5B3C15A2A41D6A600AABD6F /* Services */, diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index 9bc563780..32d00733d 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -26,11 +26,13 @@ final class DetailingViewController: BaseViewController { private var manittoNickname: String = "" var letterViewController: UIViewController { guard let mission = missionContentsLabel.text else { return UIViewController() } - let viewController = LetterViewController(roomState: roomType.rawValue, - roomId: roomId, - mission: mission, - missionId: self.missionId, - entryPoint: .notification) + guard let roomType = LetterView.RoomState(rawValue: self.roomType.rawValue) else { return UIViewController() } + let service = LetterService(api: LetterAPI(apiService: APIService())) + let viewModel = LetterViewModel(service: service, + roomId: self.roomId, + mission: mission, + missionId: self.missionId) + let viewController = LetterViewController(viewModel: viewModel, roomState: roomType, messageType: .received) return viewController } @@ -141,13 +143,16 @@ final class DetailingViewController: BaseViewController { let action = UIAction { [weak self] _ in guard let roomType = self?.roomType, let roomId = self?.roomId, - let mission = self?.missionContentsLabel.text + let mission = self?.missionContentsLabel.text, + let missionId = self?.missionId else { return } - let letterViewController = LetterViewController(roomState: roomType.rawValue, - roomId: roomId, - mission: mission, - missionId: self?.missionId ?? "", - entryPoint: .detail) + guard let roomType = LetterView.RoomState(rawValue: roomType.rawValue) else { return } + let service = LetterService(api: LetterAPI(apiService: APIService())) + let viewModel = LetterViewModel(service: service, + roomId: roomId, + mission: mission, + missionId: missionId) + let letterViewController = LetterViewController(viewModel: viewModel, roomState: roomType, messageType: .sent) self?.navigationController?.pushViewController(letterViewController, animated: true) } button.addAction(action, for: .touchUpInside) @@ -493,12 +498,14 @@ final class DetailingViewController: BaseViewController { let mission = info.mission?.content, let missionId = info.mission?.id else { return } - let viewController = LetterViewController(roomState: state, - roomId: self.roomId, - mission: mission, - missionId: missionId.description, - entryPoint: .notification) - self.navigationController?.pushViewController(viewController, animated: true) + guard let roomType = LetterView.RoomState(rawValue: state) else { return } + let service = LetterService(api: LetterAPI(apiService: APIService())) + let viewModel = LetterViewModel(service: service, + roomId: self.roomId, + mission: mission, + missionId: missionId.description) + let letterViewController = LetterViewController(viewModel: viewModel, roomState: roomType, messageType: .received) + self.navigationController?.pushViewController(letterViewController, animated: true) } } } From 077ca3b346bb20fff7c67e3251d1f881c4af2549 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 15:37:49 +0900 Subject: [PATCH 188/468] =?UTF-8?q?[CHORE]=20withUnretained=EA=B0=80=20?= =?UTF-8?q?=EB=A9=94=EB=AA=A8=EB=A6=AC=EB=A6=AD=EC=9D=84=20=EB=B0=9C?= =?UTF-8?q?=EC=83=9D=EC=8B=9C=EC=BC=9C=EC=84=9C=20=EC=82=AD=EC=A0=9C=20?= =?UTF-8?q?=ED=9B=84=20=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 - .../Global/Extension/Publisher+Combine.swift | 19 --- .../Manito/Global/UIComponent/GuideView.swift | 8 +- .../Detail-Ing/DetailingViewController.swift | 24 ++-- .../Letter/ViewModels/LetterViewModel.swift | 58 ++++++--- .../Cells/LetterCollectionViewCell.swift | 40 +++--- .../Views/UIComponents/LetterHeaderView.swift | 11 +- .../LetterViewController.swift | 98 ++++++--------- .../Letter/Views/Views/LetterView.swift | 116 +++--------------- 9 files changed, 139 insertions(+), 239 deletions(-) delete mode 100644 Manito/Manito/Global/Extension/Publisher+Combine.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index aa7c85907..e975577ed 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -108,7 +108,6 @@ B5B3C1652A427B5800AABD6F /* UIControl+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */; }; B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */; }; B5B3C1782A42CE9300AABD6F /* CollectionViewDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1772A42CE9300AABD6F /* CollectionViewDataSource.swift */; }; - B5B3C17A2A42EA6700AABD6F /* Publisher+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1792A42EA6700AABD6F /* Publisher+Combine.swift */; }; B5B3C1842A42F70C00AABD6F /* UIView+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1832A42F70C00AABD6F /* UIView+Combine.swift */; }; B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2AD285B2917006D880B /* Int+Extension.swift */; }; B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */; }; @@ -294,7 +293,6 @@ B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Combine.swift"; sourceTree = ""; }; B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Combine.swift"; sourceTree = ""; }; B5B3C1772A42CE9300AABD6F /* CollectionViewDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewDataSource.swift; sourceTree = ""; }; - B5B3C1792A42EA6700AABD6F /* Publisher+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Publisher+Combine.swift"; sourceTree = ""; }; B5B3C1832A42F70C00AABD6F /* UIView+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Combine.swift"; sourceTree = ""; }; B5E1F2AD285B2917006D880B /* Int+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Extension.swift"; sourceTree = ""; }; B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeViewController.swift; sourceTree = ""; }; @@ -844,7 +842,6 @@ 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */, B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */, B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */, - B5B3C1792A42EA6700AABD6F /* Publisher+Combine.swift */, B5B3C1832A42F70C00AABD6F /* UIView+Combine.swift */, ); path = Extension; @@ -1270,7 +1267,6 @@ 7E3058C82854B64D00489E6A /* InputPersonView.swift in Sources */, CBA15C94285CE1A80051EDE2 /* ChooseCharacterViewController.swift in Sources */, 39EEF65E28CB3CFE00437654 /* LoginEndPoint.swift in Sources */, - B5B3C17A2A42EA6700AABD6F /* Publisher+Combine.swift in Sources */, 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */, 39C957FC287DAAFA00A04A2B /* DetailWaitEndPoint.swift in Sources */, CB674C2128596A310063A6B7 /* CheckRoomViewController.swift in Sources */, diff --git a/Manito/Manito/Global/Extension/Publisher+Combine.swift b/Manito/Manito/Global/Extension/Publisher+Combine.swift deleted file mode 100644 index 094084594..000000000 --- a/Manito/Manito/Global/Extension/Publisher+Combine.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// Publisher+Combine.swift -// Manito -// -// Created by SHIN YOON AH on 2023/06/21. -// - -import Combine -import Foundation - -// https://gist.github.com/pookjw/fbfba58d87563494b2fcc93077ccd4ff - -extension Publisher { - func withUnretained(_ owner: T) -> Publishers.CompactMap { - return compactMap { [weak owner] output in - owner == nil ? nil : (owner!, output) - } - } -} diff --git a/Manito/Manito/Global/UIComponent/GuideView.swift b/Manito/Manito/Global/UIComponent/GuideView.swift index ea35460e2..823b9e003 100644 --- a/Manito/Manito/Global/UIComponent/GuideView.swift +++ b/Manito/Manito/Global/UIComponent/GuideView.swift @@ -84,6 +84,10 @@ final class GuideView: UIView { self.guideLabel.applyColor(to: targetTitle, with: .subOrange) } + private func setupDisappearedConfiguration() { + self.guideBoxImageView.isHidden = true + } + func setupGuideViewLayout() { self.addSubview(self.guideButton) self.guideButton.snp.makeConstraints { @@ -144,10 +148,6 @@ final class GuideView: UIView { viewController.view.addGestureRecognizer(viewControllerTapGesture) } - func setupDisappearedConfiguration() { - self.guideBoxImageView.isHidden = true - } - // MARK: - selector @objc diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index 32d00733d..3ce8adfa6 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -26,13 +26,14 @@ final class DetailingViewController: BaseViewController { private var manittoNickname: String = "" var letterViewController: UIViewController { guard let mission = missionContentsLabel.text else { return UIViewController() } - guard let roomType = LetterView.RoomState(rawValue: self.roomType.rawValue) else { return UIViewController() } let service = LetterService(api: LetterAPI(apiService: APIService())) let viewModel = LetterViewModel(service: service, roomId: self.roomId, mission: mission, - missionId: self.missionId) - let viewController = LetterViewController(viewModel: viewModel, roomState: roomType, messageType: .received) + missionId: self.missionId, + roomState: self.roomType.rawValue, + messageType: .received) + let viewController = LetterViewController(viewModel: viewModel) return viewController } @@ -146,13 +147,14 @@ final class DetailingViewController: BaseViewController { let mission = self?.missionContentsLabel.text, let missionId = self?.missionId else { return } - guard let roomType = LetterView.RoomState(rawValue: roomType.rawValue) else { return } let service = LetterService(api: LetterAPI(apiService: APIService())) let viewModel = LetterViewModel(service: service, roomId: roomId, mission: mission, - missionId: missionId) - let letterViewController = LetterViewController(viewModel: viewModel, roomState: roomType, messageType: .sent) + missionId: missionId, + roomState: roomType.rawValue, + messageType: .sent) + let letterViewController = LetterViewController(viewModel: viewModel) self?.navigationController?.pushViewController(letterViewController, animated: true) } button.addAction(action, for: .touchUpInside) @@ -494,17 +496,17 @@ final class DetailingViewController: BaseViewController { do { let data = try await detailIngService.requestStartingRoomInfo(roomId: roomId) if let info = data { - guard let state = info.roomInformation?.state, - let mission = info.mission?.content, + guard let mission = info.mission?.content, let missionId = info.mission?.id else { return } - guard let roomType = LetterView.RoomState(rawValue: state) else { return } let service = LetterService(api: LetterAPI(apiService: APIService())) let viewModel = LetterViewModel(service: service, roomId: self.roomId, mission: mission, - missionId: missionId.description) - let letterViewController = LetterViewController(viewModel: viewModel, roomState: roomType, messageType: .received) + missionId: missionId.description, + roomState: roomType.rawValue, + messageType: .received) + let letterViewController = LetterViewController(viewModel: viewModel) self.navigationController?.pushViewController(letterViewController, animated: true) } } diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift index 63fb39a02..e31f99b58 100644 --- a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -18,8 +18,13 @@ final class LetterViewModel: ViewModelType { case received = 1 } + enum RoomState: String { + case processing = "PROCESSING" + case post = "POST" + } + struct Input { - let viewDidLoad: AnyPublisher + let viewDidLoad: AnyPublisher let segmentControlValueChanged: AnyPublisher let refresh: PassthroughSubject let sendLetterButtonDidTap: AnyPublisher @@ -31,6 +36,7 @@ final class LetterViewModel: ViewModelType { let index: PassthroughSubject let messageDetails: AnyPublisher let reportDetails: AnyPublisher + let roomState: AnyPublisher } // MARK: - property @@ -42,48 +48,68 @@ final class LetterViewModel: ViewModelType { private let service: LetterServicable private var messageDetails: MessageDetails + private let roomState: RoomState + private let messageType: MessageType // MARK: - init init(service: LetterServicable, roomId: String, mission: String, - missionId: String) { + missionId: String, + roomState: String, + messageType: MessageType) { self.service = service self.messageDetails = MessageDetails(roomId, mission, missionId, "") + self.roomState = RoomState(rawValue: roomState)! + self.messageType = messageType } // MARK: - Public - func func transform(from input: Input) -> Output { + let viewDidLoad = input.viewDidLoad + .share() + + let viewDidLoadType = viewDidLoad + .map { [weak self] in self?.messageType } + .map { $0! } + let refreshWithType = input.refresh .map { MessageType.sent } - Publishers.Merge3(input.viewDidLoad, input.segmentControlValueChanged, refreshWithType) - .withUnretained(self) - .sink(receiveValue: { owner, type in - owner.fetchMessages(with: type) - owner.sendCurrentIndex(at: type) + Publishers.Merge3(viewDidLoadType, input.segmentControlValueChanged, refreshWithType) + .sink(receiveValue: { [weak self] type in + self?.fetchMessages(with: type) + self?.sendCurrentIndex(at: type) }) .store(in: &self.cancelBag) let messagePublisher = input.sendLetterButtonDidTap - .withUnretained(self) - .map { owner, _ -> MessageDetails in - owner.loadMessageDetails() - return owner.messageDetails + .map { [weak self] _ -> MessageDetails in + self?.loadMessageDetails() + return (self?.messageDetails)! } .eraseToAnyPublisher() let reportPublisher = input.reportButtonDidTap - .withUnretained(self) - .map { owner, content -> ReportDetails in - owner.service.loadNickname() - return (owner.service.nickname, content) + .map { [weak self] content -> ReportDetails in + self?.service.loadNickname() + return ((self?.service.nickname)!, content) } .eraseToAnyPublisher() - return Output(messages: self.messageSubject, index: self.indexSubject, messageDetails: messagePublisher, reportDetails: reportPublisher) + let roomStatePublisher = viewDidLoad + .map { [weak self] in (self?.roomState)! } + .eraseToAnyPublisher() + + return Output( + messages: self.messageSubject, + index: self.indexSubject, + messageDetails: messagePublisher, + reportDetails: reportPublisher, + roomState: roomStatePublisher + ) } // MARK: - Private - func diff --git a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift index bc613482c..db5c9ac19 100644 --- a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift +++ b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift @@ -12,7 +12,7 @@ import SnapKit final class LetterCollectionViewCell: BaseCollectionViewCell { - typealias ConfigurationData = (mission: String?, date: String, content: String?, imageURL: String?, isTodayLetter: Bool) + typealias ConfigurationData = (mission: String?, date: String, content: String?, imageURL: String?, isTodayLetter: Bool, canReport: Bool) // MARK: - ui component @@ -105,17 +105,26 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { // MARK: - func + private func initializeConfiguration() { + self.missionLabel.text = nil + self.contentLabel.text = nil + self.photoImageView.image = nil + self.missionLabel.snp.updateConstraints { + $0.bottom.equalTo(self.contentLabel.snp.top).offset(5) + } + self.photoImageView.snp.updateConstraints { + $0.height.equalTo(0) + } + } +} + +// MARK: - Public - func +extension LetterCollectionViewCell { func configureCell(_ data: ConfigurationData) { if let mission = data.mission { self.missionLabel.text = mission - self.missionLabel.snp.updateConstraints { - $0.bottom.equalTo(self.contentLabel.snp.top).offset(20) - } } else { self.missionLabel.text = data.date - self.missionLabel.snp.updateConstraints { - $0.bottom.equalTo(self.contentLabel.snp.top).offset(5) - } } if let content = data.content { @@ -126,24 +135,9 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { if let imageURL = data.imageURL { self.imageURL = imageURL self.photoImageView.loadImageUrl(imageURL) - self.photoImageView.snp.updateConstraints { - $0.height.equalTo(204) - } } self.missionLabel.textColor = data.isTodayLetter ? .subOrange : .grey003 -// self.reportButton.isHidden = !data.canReport - } - - private func initializeConfiguration() { - self.missionLabel.text = nil - self.contentLabel.text = nil - self.photoImageView.image = nil - self.missionLabel.snp.updateConstraints { - $0.bottom.equalTo(self.contentLabel.snp.top).offset(5) - } - self.photoImageView.snp.updateConstraints { - $0.height.equalTo(0) - } + self.reportButton.isHidden = !data.canReport } } diff --git a/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift b/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift index a396ace9f..427572cfa 100644 --- a/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift +++ b/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift @@ -31,8 +31,11 @@ final class LetterHeaderView: UICollectionReusableView { // MARK: - property - var segmentedControlTapPublisher: AnyPublisher { + var segmentedControlTapPublisher: AnyPublisher { return self.segmentedControl.tapPublisher + .map { [weak self] in self?.segmentedControl.selectedSegmentIndex } + .map { $0! } + .eraseToAnyPublisher() } // MARK: - init @@ -49,10 +52,6 @@ final class LetterHeaderView: UICollectionReusableView { // MARK: - func - func setValue(_ value: Int) { - self.segmentedControl.selectedSegmentIndex = value - } - private func setupLayout() { self.addSubview(self.segmentedControl) self.segmentedControl.snp.makeConstraints { @@ -61,7 +60,7 @@ final class LetterHeaderView: UICollectionReusableView { $0.height.equalTo(40) } } - + private func configureUI() { self.backgroundColor = .backgroundGrey } diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index 71e4fbde5..d20b4d181 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -24,18 +24,11 @@ final class LetterViewController: BaseViewController { private var cancelBag: Set = Set() private let viewModel: any ViewModelType - private var roomState: LetterView.RoomState - private var messageType: LetterView.MessageType - // MARK: - init - init(viewModel: any ViewModelType, - roomState: LetterView.RoomState, - messageType: LetterView.MessageType) { + init(viewModel: any ViewModelType) { self.viewModel = viewModel - self.roomState = roomState - self.messageType = messageType super.init() } @@ -59,7 +52,6 @@ final class LetterViewController: BaseViewController { override func configureUI() { super.configureUI() - self.letterView.configureLayout(with: self.roomState) self.letterView.configureNavigationBar(of: self) } @@ -73,17 +65,11 @@ final class LetterViewController: BaseViewController { private func transformedOutput() -> LetterViewModel.Output? { guard let viewModel = self.viewModel as? LetterViewModel else { return nil } let input = LetterViewModel.Input( - viewDidLoad: - self.viewDidLoadPublisher - .withUnretained(self) - .map { owner, _ in owner.messageType.rawValue } - .map { LetterViewModel.MessageType(rawValue: $0)! } - .eraseToAnyPublisher(), + viewDidLoad: self.viewDidLoadPublisher, segmentControlValueChanged: self.letterView.headerView.segmentedControlTapPublisher - .withUnretained(self) - .map { owner, _ -> LetterViewModel.MessageType in - guard let type = LetterViewModel.MessageType(rawValue: owner.messageType.rawValue) else { return .sent } + .map { index -> LetterViewModel.MessageType in + guard let type = LetterViewModel.MessageType(rawValue: index) else { return .sent } return type } .eraseToAnyPublisher(), @@ -99,47 +85,52 @@ final class LetterViewController: BaseViewController { guard let output = output else { return } output.messages - .withUnretained(self) - .map { owner, items in - owner.letterCollectionViewDataSource(items: items) + .map { [weak self] items in + self?.letterCollectionViewDataSource(items: items) } .catch { _ in return Just(nil)} - .withUnretained(self) .receive(on: RunLoop.main) - .sink(receiveValue: { owner, dataSource in + .sink(receiveValue: { [weak self] dataSource in guard let dataSource = dataSource else { - owner.showErrorAlert() + self?.showErrorAlert() return } - owner.updateList(with: dataSource) - }) - .store(in: &self.cancelBag) - - output.index - .withUnretained(self) - .sink(receiveValue: { owner, index in - owner.letterView.headerView.setValue(index) + self?.updateList(with: dataSource) + // TODO: - view layout update(데이터 없으면 empty 멘트) }) .store(in: &self.cancelBag) output.messageDetails - .withUnretained(self) - .sink(receiveValue: { owner, details in + .sink(receiveValue: { [weak self] details in + guard let self = self else { return } let viewController = CreateLetterViewController(manitteeId: details.manitteeId, roomId: details.roomId, mission: details.mission, missionId: details.missionId) let navigationController = UINavigationController(rootViewController: viewController) viewController.configureDelegation(self) - owner.present(navigationController, animated: true) + self.present(navigationController, animated: true) }) .store(in: &self.cancelBag) output.reportDetails - .withUnretained(self) - .sink(receiveValue: { owner, details in - owner.sendReportMail(userNickname: details.nickname, content: details.content) + .sink(receiveValue: { [weak self] details in + self?.sendReportMail(userNickname: details.nickname, content: details.content) + }) + .store(in: &self.cancelBag) + + Publishers.CombineLatest(output.roomState, output.index) + .map { (state: $0, index: $1) } + .sink(receiveValue: { [weak self] result in + switch (result.state, result.index) { + case (.processing, 0): + self?.letterView.showBottomArea() + default: + self?.letterView.hideBottomArea() + } + // TODO: - cell report 보이게 안보이게 + // TODO: - Empty Label Text }) .store(in: &self.cancelBag) } @@ -148,36 +139,36 @@ final class LetterViewController: BaseViewController { extension LetterViewController { private func letterCollectionViewDataSource(items: [Message]) -> CollectionViewDataSource { return CollectionViewDataSource(identifier: LetterCollectionViewCell.className, - items: items) { cell, item in + items: items) { [weak self] cell, item in +// let canReport = self.messageType == .received cell.configureCell((mission: item.mission, date: item.date, content: item.content, imageURL: item.imageUrl, - isTodayLetter: item.isToday)) - self.bindCell(cell, with: item) + isTodayLetter: item.isToday, + canReport: true)) + self?.bindCell(cell, with: item) } } private func bindCell(_ cell: LetterCollectionViewCell, with item: Message) { cell.reportButtonTapPublisher - .withUnretained(self) - .sink(receiveValue: { owner, _ in + .sink(receiveValue: { [weak self] _ in if let content = item.content { - owner.reportSubject.send(content) + self?.reportSubject.send(content) } else { - owner.reportSubject.send("쪽지 내용 없음") + self?.reportSubject.send("쪽지 내용 없음") } }) .store(in: &self.cancelBag) cell.imageViewTapGesturePublisher - .withUnretained(self) - .sink(receiveValue: { owner, _ in + .sink(receiveValue: { [weak self] _ in guard let imageUrl = item.imageUrl else { return } let viewController = LetterImageViewController(imageUrl: imageUrl) viewController.modalPresentationStyle = .fullScreen viewController.modalTransitionStyle = .crossDissolve - owner.present(viewController, animated: true) + self?.present(viewController, animated: true) }) .store(in: &self.cancelBag) } @@ -199,14 +190,3 @@ extension LetterViewController: CreateLetterViewControllerDelegate { self.refreshSubject.send(()) } } - -private extension CollectionViewDataSource { - func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { - guard let headerView = collectionView.dequeueReusableSupplementaryView( - ofKind: UICollectionView.elementKindSectionHeader, - withReuseIdentifier: LetterHeaderView.className, - for: indexPath - ) as? LetterHeaderView else { return UICollectionReusableView() } - return headerView - } -} diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index d6d63f70e..3300353e0 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -11,30 +11,8 @@ import SnapKit final class LetterView: UIView { - enum RoomState: String { - case PROCESSING - case POST - } - - enum MessageType: Int { - case sent = 0 - case received = 1 - - var bottomContentInset: CGFloat { return self == .received ? 0 : 73 } - var isHiddenBottomArea: Bool { return self == .received } - var emptyText: String { - switch self { - case .sent: return TextLiteral.letterViewControllerEmptyViewTo - case .received: return TextLiteral.letterViewControllerEmptyViewFrom - } - } - } - private enum ConstantSize { static let headerHeight: CGFloat = 66.0 - static let imageHeight: CGFloat = 204.0 - static let cellInset: UIEdgeInsets = UIEdgeInsets(top: 24.0, left: 16.0, bottom: 22.0, right: 16.0) - static let cellWidth: CGFloat = UIScreen.main.bounds.size.width - Size.leadingTrailingPadding * 2 static let collectionInset: UIEdgeInsets = UIEdgeInsets(top: 18.0, left: Size.leadingTrailingPadding, bottom: 18.0, @@ -52,6 +30,7 @@ final class LetterView: UIView { private let listCollectionViewFlowLayout: UICollectionViewFlowLayout = { let flowLayout = UICollectionViewFlowLayout() flowLayout.scrollDirection = .vertical + flowLayout.estimatedItemSize = CGSize(width: 100, height: 100) flowLayout.sectionInset = ConstantSize.collectionInset flowLayout.minimumLineSpacing = 33 flowLayout.sectionHeadersPinToVisibleBounds = true @@ -89,8 +68,6 @@ final class LetterView: UIView { }() let headerView: LetterHeaderView = LetterHeaderView() - // MARK: - init - override init(frame: CGRect) { super.init(frame: frame) self.setupLayout() @@ -102,29 +79,30 @@ final class LetterView: UIView { } deinit { - self.hideGuideView() + self.removeGuideView() } // MARK: - func - // TODO: - roomstate를 public한 enum으로 변경할 것 - func configureLayout(with state: RoomState) { - self.setupLayout() - - if state == .PROCESSING { - self.setupBottomViewLayout() - } - } - func configureNavigationBar(of viewController: UIViewController) { self.setupNavigationTitle(in: viewController) self.setupGuideView(in: viewController) } - func hideGuideView() { - self.guideView.setupDisappearedConfiguration() + func showBottomArea() { + self.bottomView.isHidden = false } + func hideBottomArea() { + self.bottomView.isHidden = true + } + + func updateLetterView() { +// self.updateEmptyLabel(to: type.emptyText) + } +} + +extension LetterView { private func setupLayout() { self.addSubview(self.listCollectionView) self.listCollectionView.snp.makeConstraints { @@ -135,9 +113,7 @@ final class LetterView: UIView { self.emptyLabel.snp.makeConstraints { $0.center.equalToSuperview() } - } - private func setupBottomViewLayout() { self.addSubview(self.bottomView) self.bottomView.snp.makeConstraints { $0.leading.trailing.bottom.equalTo(self.safeAreaLayoutGuide) @@ -165,65 +141,11 @@ final class LetterView: UIView { self.guideView.hideGuideViewWhenTappedAround(in: navigationController, viewController) } -// private func updateLetterView(to type: LetterType) { -// self.updateEmptyLabel(to: type.emptyText) -// self.updateListCollectionViewConfiguration(to: type) -// self.updateLetter(to: type) -// } -// -// private func updateEmptyLabel(to text: String) { -// self.emptyLabel.text = text -// } -// -// private func updateListCollectionViewConfiguration(to type: LetterType) { -// let bottomInset: CGFloat = type.bottomContentInset -// let yPoint = self.listCollectionView.adjustedContentInset.top + 1 -// -// self.bottomView.isHidden = type.isHiddenBottomArea -// self.listCollectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: bottomInset, right: 0) -// self.listCollectionView.setContentOffset(CGPoint(x: 0, y: -yPoint), animated: false) -// self.listCollectionView.collectionViewLayout.invalidateLayout() -// } -} + private func removeGuideView() { + self.guideView.removeFromSuperview() + } -// MARK: - UICollectionViewDelegateFlowLayout -//extension LetterView: UICollectionViewDelegateFlowLayout { -// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { -// var heights = [ConstantSize.cellInset.top, ConstantSize.cellInset.bottom] +// private func createLayout() -> UICollectionViewLayout { // -// if let content = self.letterList[indexPath.item].content { -// heights += [self.calculateCellContentViewHeight(by: content)] -// } -// -// if let mission = self.letterList[indexPath.item].mission { -// heights += [self.calculateCellContentViewHeight(by: mission) + 10] -// } else { -// let date = self.letterList[indexPath.item].date -// heights += [self.calculateCellContentViewHeight(by: date) + 5] -// } -// -// if self.letterList[indexPath.item].imageUrl != nil { -// heights += [ConstantSize.imageHeight] -// } -// -// return CGSize(width: ConstantSize.cellWidth, height: heights.reduce(0, +)) -// } -// -// private func calculateCellContentViewHeight(by text: String) -> CGFloat { -// let width = UIScreen.main.bounds.size.width - Size.leadingTrailingPadding * 2 - ConstantSize.cellInset.left * 2 -// let label = UILabel(frame: CGRect(origin: .zero, size: CGSize(width: width, height: .greatestFiniteMagnitude))) -// label.text = text -// label.font = .font(.regular, ofSize: 15) -// label.numberOfLines = 0 -// label.addLabelSpacing() -// label.sizeToFit() -// return label.frame.height -// } -//} - -// MARK: - UICollectionViewDelegate -//extension LetterView: UICollectionViewDelegate { -// func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { -// self.hideGuideView() // } -//} +} From fe866dd378dc97ee826823d00c98e54b27a513f6 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 16:07:37 +0900 Subject: [PATCH 189/468] =?UTF-8?q?[FEAT]=20guideView=20remove=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EB=B6=80=EB=B6=84=20=EC=B6=94=EA=B0=80(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/UIComponent/GuideView.swift | 4 ++++ .../Views/ViewControllers/LetterViewController.swift | 5 +++++ .../Manito/Screens/Letter/Views/Views/LetterView.swift | 10 ++++------ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Manito/Manito/Global/UIComponent/GuideView.swift b/Manito/Manito/Global/UIComponent/GuideView.swift index 823b9e003..2e8d3bdd3 100644 --- a/Manito/Manito/Global/UIComponent/GuideView.swift +++ b/Manito/Manito/Global/UIComponent/GuideView.swift @@ -148,6 +148,10 @@ final class GuideView: UIView { viewController.view.addGestureRecognizer(viewControllerTapGesture) } + func removeGuideView() { + self.guideBoxImageView.removeFromSuperview() + } + // MARK: - selector @objc diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index d20b4d181..cdcee0de6 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -48,6 +48,11 @@ final class LetterViewController: BaseViewController { self.bindViewModel() } + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + self.letterView.removeGuideView() + } + // MARK: - override override func configureUI() { diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index 3300353e0..b6ba166ea 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -68,6 +68,8 @@ final class LetterView: UIView { }() let headerView: LetterHeaderView = LetterHeaderView() + // MARK: - init + override init(frame: CGRect) { super.init(frame: frame) self.setupLayout() @@ -97,8 +99,8 @@ final class LetterView: UIView { self.bottomView.isHidden = true } - func updateLetterView() { -// self.updateEmptyLabel(to: type.emptyText) + func removeGuideView() { + self.guideView.removeGuideView() } } @@ -141,10 +143,6 @@ extension LetterView { self.guideView.hideGuideViewWhenTappedAround(in: navigationController, viewController) } - private func removeGuideView() { - self.guideView.removeFromSuperview() - } - // private func createLayout() -> UICollectionViewLayout { // // } From 9e81f02f4de19406f3a128811eae2f8abb462d1e Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 17:14:33 +0900 Subject: [PATCH 190/468] =?UTF-8?q?[CHORE]=20DataSource=EA=B0=80=20?= =?UTF-8?q?=EC=95=84=EB=8B=8C=20DiffableDataSource=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 - .../Utils/CollectionViewDataSource.swift | 34 ----- Manito/Manito/Network/Models/Letter.swift | 2 +- Manito/Manito/Network/Models/Room.swift | 2 +- .../LetterViewController.swift | 122 +++++++++++++----- 5 files changed, 91 insertions(+), 73 deletions(-) delete mode 100644 Manito/Manito/Global/Utils/CollectionViewDataSource.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index e975577ed..505008204 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -107,7 +107,6 @@ B5B3C1632A41DBC400AABD6F /* Servicable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1622A41DBC400AABD6F /* Servicable.swift */; }; B5B3C1652A427B5800AABD6F /* UIControl+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */; }; B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */; }; - B5B3C1782A42CE9300AABD6F /* CollectionViewDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1772A42CE9300AABD6F /* CollectionViewDataSource.swift */; }; B5B3C1842A42F70C00AABD6F /* UIView+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1832A42F70C00AABD6F /* UIView+Combine.swift */; }; B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2AD285B2917006D880B /* Int+Extension.swift */; }; B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */; }; @@ -292,7 +291,6 @@ B5B3C1622A41DBC400AABD6F /* Servicable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Servicable.swift; sourceTree = ""; }; B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Combine.swift"; sourceTree = ""; }; B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Combine.swift"; sourceTree = ""; }; - B5B3C1772A42CE9300AABD6F /* CollectionViewDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionViewDataSource.swift; sourceTree = ""; }; B5B3C1832A42F70C00AABD6F /* UIView+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Combine.swift"; sourceTree = ""; }; B5E1F2AD285B2917006D880B /* Int+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Extension.swift"; sourceTree = ""; }; B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeViewController.swift; sourceTree = ""; }; @@ -915,7 +913,6 @@ B5F525282851A2A400614FF7 /* Logger.swift */, B5FEE9DA28C8498A00DEA07E /* ImageCacheManager.swift */, B5FEE9DC28C849B400DEA07E /* UIImageView+Cache.swift */, - B5B3C1772A42CE9300AABD6F /* CollectionViewDataSource.swift */, ); path = Utils; sourceTree = ""; @@ -1361,7 +1358,6 @@ 39C95802287DACC300A04A2B /* RoomEndPoint.swift in Sources */, CB4C77E628C0D4EB007A1AD2 /* MainAPI.swift in Sources */, B5F524FD28519EEC00614FF7 /* UIColor+Extension.swift in Sources */, - B5B3C1782A42CE9300AABD6F /* CollectionViewDataSource.swift in Sources */, B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */, D7C4A1AD2A0DD8FA00C3AE4C /* SettingView.swift in Sources */, 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */, diff --git a/Manito/Manito/Global/Utils/CollectionViewDataSource.swift b/Manito/Manito/Global/Utils/CollectionViewDataSource.swift deleted file mode 100644 index 770fad4b8..000000000 --- a/Manito/Manito/Global/Utils/CollectionViewDataSource.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// CollectionViewDataSource.swift -// Manito -// -// Created by SHIN YOON AH on 2023/06/21. -// - -import UIKit - -final class CollectionViewDataSource: NSObject, UICollectionViewDataSource { - - private let identifier: String - private let items: [T] - private let configureCell: ((Cell, T) -> Void)? - - init(identifier: String, items: [T], configureCell: ((Cell, T) -> Void)? = nil) { - self.identifier = identifier - self.items = items - self.configureCell = configureCell - } - - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return self.items.count - } - - func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - guard let cell = collectionView.dequeueReusableCell(withReuseIdentifier: self.identifier, for: indexPath) as? Cell else { return UICollectionViewCell() } - let item = self.items[indexPath.row] - - self.configureCell?(cell, item) - - return cell - } -} diff --git a/Manito/Manito/Network/Models/Letter.swift b/Manito/Manito/Network/Models/Letter.swift index 0c6657630..947261277 100644 --- a/Manito/Manito/Network/Models/Letter.swift +++ b/Manito/Manito/Network/Models/Letter.swift @@ -18,7 +18,7 @@ struct Manitte: Codable { var nickname: String? } -struct Message: Codable { +struct Message: Codable, Hashable { var id: Int? var content: String? var imageUrl: String? diff --git a/Manito/Manito/Network/Models/Room.swift b/Manito/Manito/Network/Models/Room.swift index 1abcf3fe6..a02a51001 100644 --- a/Manito/Manito/Network/Models/Room.swift +++ b/Manito/Manito/Network/Models/Room.swift @@ -145,7 +145,7 @@ struct RoomInfo: Decodable { } } -struct Mission: Codable { +struct Mission: Codable, Hashable { let id: Int? let content: String? } diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index cdcee0de6..33887c480 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -10,11 +10,16 @@ import UIKit final class LetterViewController: BaseViewController { + enum Section: CaseIterable { + case main + } + // MARK: - ui component private let letterView: LetterView = LetterView() - private var dataSource: CollectionViewDataSource! + private var dataSource: UICollectionViewDiffableDataSource! + private var snapShot: NSDiffableDataSourceSnapshot! // MARK: - property @@ -45,6 +50,7 @@ final class LetterViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() + self.configureDataSource() self.bindViewModel() } @@ -60,7 +66,7 @@ final class LetterViewController: BaseViewController { self.letterView.configureNavigationBar(of: self) } - // MARK: - func + // MARK: - func - bind private func bindViewModel() { let output = self.transformedOutput() @@ -90,18 +96,15 @@ final class LetterViewController: BaseViewController { guard let output = output else { return } output.messages - .map { [weak self] items in - self?.letterCollectionViewDataSource(items: items) - } - .catch { _ in return Just(nil)} .receive(on: RunLoop.main) - .sink(receiveValue: { [weak self] dataSource in - guard let dataSource = dataSource else { + .sink(receiveCompletion: { [weak self] completion in + switch completion { + case .failure(_): self?.showErrorAlert() - return + case .finished: return } - - self?.updateList(with: dataSource) + }, receiveValue: { [weak self] items in + self?.reloadMessageList(items) // TODO: - view layout update(데이터 없으면 empty 멘트) }) .store(in: &self.cancelBag) @@ -139,22 +142,6 @@ final class LetterViewController: BaseViewController { }) .store(in: &self.cancelBag) } -} - -extension LetterViewController { - private func letterCollectionViewDataSource(items: [Message]) -> CollectionViewDataSource { - return CollectionViewDataSource(identifier: LetterCollectionViewCell.className, - items: items) { [weak self] cell, item in -// let canReport = self.messageType == .received - cell.configureCell((mission: item.mission, - date: item.date, - content: item.content, - imageURL: item.imageUrl, - isTodayLetter: item.isToday, - canReport: true)) - self?.bindCell(cell, with: item) - } - } private func bindCell(_ cell: LetterCollectionViewCell, with item: Message) { cell.reportButtonTapPublisher @@ -177,19 +164,88 @@ extension LetterViewController { }) .store(in: &self.cancelBag) } +} + +// MARK: - DataSource +extension LetterViewController { + private func configureDataSource() { + self.dataSource = self.letterCollectionViewDataSource() + self.dataSource.supplementaryViewProvider = { [weak self] collectionView, kind, indexPath in + return self?.dataSourceSupplementaryView(collectionView: collectionView, + kind: kind, + indexPath: indexPath) + } + + self.configureSnapshot() + } + + private func letterCollectionViewDataSource() -> UICollectionViewDiffableDataSource { + let letterCellRegistration = UICollectionView.CellRegistration { + [weak self] cell, indexPath, item in + // TODO: - canReport안에 boolean 값!! + cell.configureCell((mission: item.mission, + date: item.date, + content: item.content, + imageURL: item.imageUrl, + isTodayLetter: item.isToday, + canReport: true)) + self?.bindCell(cell, with: item) + } + + return UICollectionViewDiffableDataSource( + collectionView: self.letterView.listCollectionView, + cellProvider: { collectionView, indexPath, item in + return collectionView.dequeueConfiguredReusableCell( + using: letterCellRegistration, + for: indexPath, + item: item + ) + } + ) + } + + private func dataSourceSupplementaryView(collectionView: UICollectionView, + kind: String, + indexPath: IndexPath) -> UICollectionReusableView? { + switch kind { + case UICollectionView.elementKindSectionHeader: + guard let headerView = collectionView.dequeueReusableSupplementaryView( + ofKind: kind, + withReuseIdentifier: LetterHeaderView.className, + for: indexPath + ) as? LetterHeaderView else { return UICollectionReusableView() } + return headerView + default: + return nil + } + } +} + +// MARK: - Snapshot +extension LetterViewController { + private func configureSnapshot() { + self.snapShot = NSDiffableDataSourceSnapshot() + self.snapShot.appendSections([.main]) + self.dataSource.apply(self.snapShot, animatingDifferences: true) + } + private func reloadMessageList(_ items: [Message]) { + let previousMessageData = self.snapShot.itemIdentifiers(inSection: .main) + self.snapShot.deleteItems(previousMessageData) + self.snapShot.appendItems(items, toSection: .main) + self.dataSource.apply(self.snapShot, animatingDifferences: true) + } +} + +// MARK: - Helper +extension LetterViewController { private func showErrorAlert() { self.makeAlert(title: TextLiteral.letterViewControllerErrorTitle, message: TextLiteral.letterViewControllerErrorDescription) } - - private func updateList(with dataSource: CollectionViewDataSource) { - self.dataSource = dataSource - self.letterView.listCollectionView.dataSource = dataSource - self.letterView.listCollectionView.reloadData() - } } +// MARK: - CreateLetterViewControllerDelegate extension LetterViewController: CreateLetterViewControllerDelegate { func refreshLetterData() { self.refreshSubject.send(()) From a832e2c72daaa95f5c0cae36188b04b62ea64f94 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 17:27:14 +0900 Subject: [PATCH 191/468] =?UTF-8?q?[CHORE]=20Header=20=EB=B0=94=EC=9D=B8?= =?UTF-8?q?=EB=94=A9=20=EB=B0=A9=EC=8B=9D=20=EB=B3=80=EA=B2=BD(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Letter/ViewModels/LetterViewModel.swift | 8 ++++++-- .../Views/UIComponents/LetterHeaderView.swift | 4 ++++ .../LetterViewController.swift | 20 ++++++++++++------- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift index e31f99b58..c121a4e59 100644 --- a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -25,7 +25,7 @@ final class LetterViewModel: ViewModelType { struct Input { let viewDidLoad: AnyPublisher - let segmentControlValueChanged: AnyPublisher + let segmentControlValueChanged: PassthroughSubject let refresh: PassthroughSubject let sendLetterButtonDidTap: AnyPublisher let reportButtonDidTap: PassthroughSubject @@ -75,10 +75,14 @@ final class LetterViewModel: ViewModelType { .map { [weak self] in self?.messageType } .map { $0! } + let segmentValueType = input.segmentControlValueChanged + .map { MessageType(rawValue: $0) } + .map { $0! } + let refreshWithType = input.refresh .map { MessageType.sent } - Publishers.Merge3(viewDidLoadType, input.segmentControlValueChanged, refreshWithType) + Publishers.Merge3(viewDidLoadType, segmentValueType, refreshWithType) .sink(receiveValue: { [weak self] type in self?.fetchMessages(with: type) self?.sendCurrentIndex(at: type) diff --git a/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift b/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift index 427572cfa..24b6785b3 100644 --- a/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift +++ b/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift @@ -52,6 +52,10 @@ final class LetterHeaderView: UICollectionReusableView { // MARK: - func + func setupHeaderSelectedIndex(at index: Int) { + self.segmentedControl.selectedSegmentIndex = index + } + private func setupLayout() { self.addSubview(self.segmentedControl) self.segmentedControl.snp.makeConstraints { diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index 33887c480..e5cb0faa5 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -23,6 +23,7 @@ final class LetterViewController: BaseViewController { // MARK: - property + private let segmentValueSubject: PassthroughSubject = PassthroughSubject() private let reportSubject: PassthroughSubject = PassthroughSubject() private let refreshSubject: PassthroughSubject = PassthroughSubject() @@ -77,13 +78,7 @@ final class LetterViewController: BaseViewController { guard let viewModel = self.viewModel as? LetterViewModel else { return nil } let input = LetterViewModel.Input( viewDidLoad: self.viewDidLoadPublisher, - segmentControlValueChanged: - self.letterView.headerView.segmentedControlTapPublisher - .map { index -> LetterViewModel.MessageType in - guard let type = LetterViewModel.MessageType(rawValue: index) else { return .sent } - return type - } - .eraseToAnyPublisher(), + segmentControlValueChanged: self.segmentValueSubject, refresh: self.refreshSubject, sendLetterButtonDidTap: self.letterView.sendLetterButton.tapPublisher, reportButtonDidTap: self.reportSubject @@ -164,6 +159,14 @@ final class LetterViewController: BaseViewController { }) .store(in: &self.cancelBag) } + + private func bindHeaderView(_ headerView: LetterHeaderView) { + headerView.segmentedControlTapPublisher + .sink(receiveValue: { [weak self] value in + self?.segmentValueSubject.send(value) + }) + .store(in: &self.cancelBag) + } } // MARK: - DataSource @@ -214,6 +217,9 @@ extension LetterViewController { withReuseIdentifier: LetterHeaderView.className, for: indexPath ) as? LetterHeaderView else { return UICollectionReusableView() } + + self.bindHeaderView(headerView) + return headerView default: return nil From cca8a6c716f25051496f247bca9ac9fc33ab0b46 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 18:40:21 +0900 Subject: [PATCH 192/468] =?UTF-8?q?[FIX]=20ViewDidLoad=20=EC=8B=9C?= =?UTF-8?q?=EC=97=90=20=EC=B4=88=EA=B8=B0=20=EC=84=A4=EC=A0=95=20=EB=90=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Letter/ViewModels/LetterViewModel.swift | 11 ++++------- .../Views/ViewControllers/LetterViewController.swift | 11 +++++++++-- .../Screens/Letter/Views/Views/LetterView.swift | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift index c121a4e59..204d46f32 100644 --- a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -33,7 +33,7 @@ final class LetterViewModel: ViewModelType { struct Output { let messages: PassthroughSubject<[Message], NetworkError> - let index: PassthroughSubject + let index: CurrentValueSubject let messageDetails: AnyPublisher let reportDetails: AnyPublisher let roomState: AnyPublisher @@ -42,7 +42,7 @@ final class LetterViewModel: ViewModelType { // MARK: - property private let messageSubject: PassthroughSubject<[Message], NetworkError> = PassthroughSubject() - private let indexSubject: PassthroughSubject = PassthroughSubject() + private lazy var indexSubject: CurrentValueSubject = CurrentValueSubject(self.messageType.rawValue) private var cancelBag: Set = Set() @@ -68,10 +68,7 @@ final class LetterViewModel: ViewModelType { // MARK: - Public - func func transform(from input: Input) -> Output { - let viewDidLoad = input.viewDidLoad - .share() - - let viewDidLoadType = viewDidLoad + let viewDidLoadType = input.viewDidLoad .map { [weak self] in self?.messageType } .map { $0! } @@ -103,7 +100,7 @@ final class LetterViewModel: ViewModelType { } .eraseToAnyPublisher() - let roomStatePublisher = viewDidLoad + let roomStatePublisher = input.viewDidLoad .map { [weak self] in (self?.roomState)! } .eraseToAnyPublisher() diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index e5cb0faa5..b0a2922f4 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -29,6 +29,8 @@ final class LetterViewController: BaseViewController { private var cancelBag: Set = Set() + private var viewModelOutput: LetterViewModel.Output? + private let viewModel: any ViewModelType // MARK: - init @@ -71,6 +73,7 @@ final class LetterViewController: BaseViewController { private func bindViewModel() { let output = self.transformedOutput() + self.viewModelOutput = output self.bindOutputToViewModel(output) } @@ -166,6 +169,12 @@ final class LetterViewController: BaseViewController { self?.segmentValueSubject.send(value) }) .store(in: &self.cancelBag) + + self.viewModelOutput?.index + .sink(receiveValue: { index in + headerView.setupHeaderSelectedIndex(at: index) + }) + .store(in: &self.cancelBag) } } @@ -217,9 +226,7 @@ extension LetterViewController { withReuseIdentifier: LetterHeaderView.className, for: indexPath ) as? LetterHeaderView else { return UICollectionReusableView() } - self.bindHeaderView(headerView) - return headerView default: return nil diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index b6ba166ea..6da88d3d0 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -66,7 +66,7 @@ final class LetterView: UIView { label.addLabelSpacing(lineSpacing: 16) return label }() - let headerView: LetterHeaderView = LetterHeaderView() + var headerView: LetterHeaderView? // MARK: - init From a4e0e24d28b9fcf08be8efa5f639056d1b8fe2bd Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 19:06:59 +0900 Subject: [PATCH 193/468] =?UTF-8?q?[CHORE]=20UICollectionViewLayout=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=20=EA=B5=AC=EC=84=B1=20=EC=99=84=EB=A3=8C(#4?= =?UTF-8?q?65)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Letter/Views/Views/LetterView.swift | 74 ++++++++++++++----- 1 file changed, 55 insertions(+), 19 deletions(-) diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index 6da88d3d0..239668635 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -13,10 +13,19 @@ final class LetterView: UIView { private enum ConstantSize { static let headerHeight: CGFloat = 66.0 - static let collectionInset: UIEdgeInsets = UIEdgeInsets(top: 18.0, - left: Size.leadingTrailingPadding, - bottom: 18.0, - right: Size.leadingTrailingPadding) + static let groupInterItemSpacing: CGFloat = 33.0 + static let contentInset: NSDirectionalEdgeInsets = NSDirectionalEdgeInsets( + top: 18.0, + leading: Size.leadingTrailingPadding, + bottom: 18.0, + trailing: Size.leadingTrailingPadding + ) + static let headerContentInset: NSDirectionalEdgeInsets = NSDirectionalEdgeInsets( + top: 0, + leading: Size.leadingTrailingPadding, + bottom: 0, + trailing: Size.leadingTrailingPadding + ) } // MARK: - ui component @@ -27,20 +36,9 @@ final class LetterView: UIView { view.backgroundColor = .backgroundGrey return view }() - private let listCollectionViewFlowLayout: UICollectionViewFlowLayout = { - let flowLayout = UICollectionViewFlowLayout() - flowLayout.scrollDirection = .vertical - flowLayout.estimatedItemSize = CGSize(width: 100, height: 100) - flowLayout.sectionInset = ConstantSize.collectionInset - flowLayout.minimumLineSpacing = 33 - flowLayout.sectionHeadersPinToVisibleBounds = true - flowLayout.headerReferenceSize = CGSize(width: UIScreen.main.bounds.size.width, - height: ConstantSize.headerHeight) - return flowLayout - }() lazy var listCollectionView: UICollectionView = { - let collectionView = UICollectionView(frame: .zero, collectionViewLayout: self.listCollectionViewFlowLayout) + let collectionView = UICollectionView(frame: .zero, collectionViewLayout: self.createLayout()) collectionView.backgroundColor = .clear collectionView.showsVerticalScrollIndicator = false collectionView.register(cell: LetterCollectionViewCell.self, @@ -142,8 +140,46 @@ extension LetterView { self.guideView.addGuideButton(in: viewController.navigationItem) self.guideView.hideGuideViewWhenTappedAround(in: navigationController, viewController) } +} -// private func createLayout() -> UICollectionViewLayout { -// -// } +// MARK: - UICollectionViewLayout +extension LetterView { + private func createLayout() -> UICollectionViewLayout { + let layout = UICollectionViewCompositionalLayout { index, environment -> NSCollectionLayoutSection? in + let itemSize = NSCollectionLayoutSize( + widthDimension: .fractionalWidth(1.0), + heightDimension: .estimated(100) + ) + let item = NSCollectionLayoutItem(layoutSize: itemSize) + + let groupSize = NSCollectionLayoutSize( + widthDimension: .fractionalWidth(1.0), + heightDimension: .fractionalHeight(1.0) + ) + let group = NSCollectionLayoutGroup.vertical(layoutSize: groupSize, subitems: [item]) + group.interItemSpacing = NSCollectionLayoutSpacing.fixed(ConstantSize.groupInterItemSpacing) + + let section = NSCollectionLayoutSection(group: group) + section.contentInsets = ConstantSize.contentInset + section.boundarySupplementaryItems = self.sectionHeader() + return section + } + + return layout + } + + private func sectionHeader() -> [NSCollectionLayoutBoundarySupplementaryItem] { + let headerSize = NSCollectionLayoutSize( + widthDimension: .fractionalWidth(1.0), + heightDimension: .absolute(ConstantSize.headerHeight) + ) + let header = NSCollectionLayoutBoundarySupplementaryItem( + layoutSize: headerSize, + elementKind: UICollectionView.elementKindSectionHeader, + alignment: .top + ) + header.contentInsets = ConstantSize.headerContentInset + header.pinToVisibleBounds = true + return [header] + } } From e7a1f304d93c013bc7f00ee2a59769186d95aab5 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 19:14:54 +0900 Subject: [PATCH 194/468] =?UTF-8?q?[CHORE]=20Header=20width=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Letter/Views/Views/LetterView.swift | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index 239668635..3114ca65a 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -12,6 +12,7 @@ import SnapKit final class LetterView: UIView { private enum ConstantSize { + static let headerWidth: CGFloat = UIScreen.main.bounds.size.width static let headerHeight: CGFloat = 66.0 static let groupInterItemSpacing: CGFloat = 33.0 static let contentInset: NSDirectionalEdgeInsets = NSDirectionalEdgeInsets( @@ -20,12 +21,7 @@ final class LetterView: UIView { bottom: 18.0, trailing: Size.leadingTrailingPadding ) - static let headerContentInset: NSDirectionalEdgeInsets = NSDirectionalEdgeInsets( - top: 0, - leading: Size.leadingTrailingPadding, - bottom: 0, - trailing: Size.leadingTrailingPadding - ) + static let headerContentInset: NSDirectionalEdgeInsets = NSDirectionalEdgeInsets.zero } // MARK: - ui component @@ -170,7 +166,7 @@ extension LetterView { private func sectionHeader() -> [NSCollectionLayoutBoundarySupplementaryItem] { let headerSize = NSCollectionLayoutSize( - widthDimension: .fractionalWidth(1.0), + widthDimension: .absolute(ConstantSize.headerWidth), heightDimension: .absolute(ConstantSize.headerHeight) ) let header = NSCollectionLayoutBoundarySupplementaryItem( From d46bca3d1734f70204033d1f4276713b1f6f4bfb Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 20:16:29 +0900 Subject: [PATCH 195/468] =?UTF-8?q?[FEAT]=20=EC=8A=A4=ED=81=AC=EB=A1=A4=20?= =?UTF-8?q?=EC=8B=9C=20GudieView=EA=B0=80=20hidden=EB=90=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=B2=98=EB=A6=AC=20=EC=B6=94=EA=B0=80(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++ .../Extension/UIScrollView+Combine.swift | 62 +++++++++++++++++++ .../Manito/Global/UIComponent/GuideView.swift | 10 +-- .../Letter/Views/Views/LetterView.swift | 19 +++++- 4 files changed, 87 insertions(+), 8 deletions(-) create mode 100644 Manito/Manito/Global/Extension/UIScrollView+Combine.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 505008204..216725aad 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -85,6 +85,7 @@ B50B1B3C285AD2B20080992C /* logo.gif in Resources */ = {isa = PBXBuildFile; fileRef = B50B1B3B285AD2B20080992C /* logo.gif */; }; B50B1B41285B048A0080992C /* OpenManittoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50B1B40285B048A0080992C /* OpenManittoViewController.swift */; }; B50B1B44285B146A0080992C /* OpenManittoCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50B1B43285B146A0080992C /* OpenManittoCollectionViewCell.swift */; }; + B50CEE912A445EB700CF1C76 /* UIScrollView+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */; }; B517C04A28D1F7EC0008BED0 /* TokenEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */; }; B517C04C28D1FE5F0008BED0 /* TokenAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */; }; B517C04E28D1FE660008BED0 /* TokenProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04D28D1FE660008BED0 /* TokenProtocol.swift */; }; @@ -269,6 +270,7 @@ B50B1B3B285AD2B20080992C /* logo.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = logo.gif; sourceTree = ""; }; B50B1B40285B048A0080992C /* OpenManittoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoViewController.swift; sourceTree = ""; }; B50B1B43285B146A0080992C /* OpenManittoCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoCollectionViewCell.swift; sourceTree = ""; }; + B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIScrollView+Combine.swift"; sourceTree = ""; }; B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenEndPoint.swift; sourceTree = ""; }; B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenAPI.swift; sourceTree = ""; }; B517C04D28D1FE660008BED0 /* TokenProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenProtocol.swift; sourceTree = ""; }; @@ -841,6 +843,7 @@ B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */, B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */, B5B3C1832A42F70C00AABD6F /* UIView+Combine.swift */, + B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */, ); path = Extension; sourceTree = ""; @@ -1307,6 +1310,7 @@ B5F524CF28519AA000614FF7 /* AppDelegate.swift in Sources */, 435B17682913E71400212663 /* DetailingViewController.swift in Sources */, B5B3C1632A41DBC400AABD6F /* Servicable.swift in Sources */, + B50CEE912A445EB700CF1C76 /* UIScrollView+Combine.swift in Sources */, B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */, D7C4A1A92A0B895300C3AE4C /* ChooseCharacterView.swift in Sources */, 397A241828BA51B400454E4F /* DetailWaitProtocol.swift in Sources */, diff --git a/Manito/Manito/Global/Extension/UIScrollView+Combine.swift b/Manito/Manito/Global/Extension/UIScrollView+Combine.swift new file mode 100644 index 000000000..b3c927938 --- /dev/null +++ b/Manito/Manito/Global/Extension/UIScrollView+Combine.swift @@ -0,0 +1,62 @@ +// +// UIScrollView+Combine.swift +// Manito +// +// Created by SHIN YOON AH on 2023/06/22. +// + +import Combine +import UIKit + +enum ScrollViewEvent { + case didScroll(scrollView: UIScrollView) +} + +extension UIScrollView { + func eventPublisher(for event: ScrollViewEvent) -> EventPublisher { + return EventPublisher(scrollView: self) + } + + struct EventPublisher: Publisher { + typealias Output = ScrollViewEvent + typealias Failure = Never + + let scrollView: UIScrollView + + func receive(subscriber: S) + where S : Subscriber, Self.Failure == S.Failure, Self.Output == S.Input { + let subscription = EventSubscription(target: subscriber) + subscriber.receive(subscription: subscription) + scrollView.delegate = subscription + } + } + + final class EventSubscription: NSObject, UIScrollViewDelegate, Subscription + where Target.Input == ScrollViewEvent { + + var target: Target? + + init(target: Target) { + self.target = target + } + + func request(_ demand: Subscribers.Demand) {} + + func cancel() { + target = nil + } + + func scrollViewDidScroll(_ scrollView: UIScrollView) { + _ = target?.receive(.didScroll(scrollView: scrollView)) + } + } +} + +extension UIScrollView { + var scrollPublisher: AnyPublisher { + eventPublisher(for: .didScroll(scrollView: self)) + .map { _ in Void() } + .eraseToAnyPublisher() + } +} + diff --git a/Manito/Manito/Global/UIComponent/GuideView.swift b/Manito/Manito/Global/UIComponent/GuideView.swift index 2e8d3bdd3..3f6bd5bdb 100644 --- a/Manito/Manito/Global/UIComponent/GuideView.swift +++ b/Manito/Manito/Global/UIComponent/GuideView.swift @@ -84,10 +84,6 @@ final class GuideView: UIView { self.guideLabel.applyColor(to: targetTitle, with: .subOrange) } - private func setupDisappearedConfiguration() { - self.guideBoxImageView.isHidden = true - } - func setupGuideViewLayout() { self.addSubview(self.guideButton) self.guideButton.snp.makeConstraints { @@ -152,12 +148,16 @@ final class GuideView: UIView { self.guideBoxImageView.removeFromSuperview() } + func hideGuideView() { + self.guideBoxImageView.isHidden = true + } + // MARK: - selector @objc func didTapAroundToHideGuideView() { if !self.guideButton.isTouchInside { - self.setupDisappearedConfiguration() + self.hideGuideView() } } } diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index 3114ca65a..5425bf4bd 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -5,6 +5,7 @@ // Created by SHIN YOON AH on 2023/03/07. // +import Combine import UIKit import SnapKit @@ -26,12 +27,12 @@ final class LetterView: UIView { // MARK: - ui component - private let guideView: GuideView = GuideView(type: .letter) private lazy var bottomView: UIView = { let view = UIView() view.backgroundColor = .backgroundGrey return view }() + private let guideView: GuideView = GuideView(type: .letter) lazy var listCollectionView: UICollectionView = { let collectionView = UICollectionView(frame: .zero, collectionViewLayout: self.createLayout()) @@ -60,13 +61,17 @@ final class LetterView: UIView { label.addLabelSpacing(lineSpacing: 16) return label }() - var headerView: LetterHeaderView? + + // MARK: - property + + private var cancelBag: Set = Set() // MARK: - init override init(frame: CGRect) { super.init(frame: frame) self.setupLayout() + self.bindUI() } @available(*, unavailable) @@ -123,6 +128,14 @@ extension LetterView { } } + private func bindUI() { + self.listCollectionView.scrollPublisher + .sink(receiveValue: { [weak self] in + self?.guideView.hideGuideView() + }) + .store(in: &self.cancelBag) + } + private func setupNavigationTitle(in viewController: UIViewController) { guard let navigationController = viewController.navigationController else { return } viewController.title = TextLiteral.letterViewControllerTitle @@ -150,7 +163,7 @@ extension LetterView { let groupSize = NSCollectionLayoutSize( widthDimension: .fractionalWidth(1.0), - heightDimension: .fractionalHeight(1.0) + heightDimension: .estimated(100) ) let group = NSCollectionLayoutGroup.vertical(layoutSize: groupSize, subitems: [item]) group.interItemSpacing = NSCollectionLayoutSpacing.fixed(ConstantSize.groupInterItemSpacing) From ce504996c5f0fe8dcf0011935c2717327b1a6d84 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 20:38:47 +0900 Subject: [PATCH 196/468] =?UTF-8?q?[FEAT]=20=EC=AA=BD=EC=A7=80=EA=B0=80=20?= =?UTF-8?q?=EC=97=86=EC=9D=84=20=EA=B2=BD=EC=9A=B0=EC=97=90=20EmptyView?= =?UTF-8?q?=EA=B0=80=20=EB=9C=A8=EB=8F=84=EB=A1=9D=20=EA=B5=AC=ED=98=84(#4?= =?UTF-8?q?65)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LetterViewController.swift | 45 ++++++++++++------- .../Letter/Views/Views/LetterView.swift | 11 ++++- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index b0a2922f4..77fa05e48 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -103,7 +103,7 @@ final class LetterViewController: BaseViewController { } }, receiveValue: { [weak self] items in self?.reloadMessageList(items) - // TODO: - view layout update(데이터 없으면 empty 멘트) + self?.letterView.updateEmptyArea(with: items) }) .store(in: &self.cancelBag) @@ -129,14 +129,9 @@ final class LetterViewController: BaseViewController { Publishers.CombineLatest(output.roomState, output.index) .map { (state: $0, index: $1) } .sink(receiveValue: { [weak self] result in - switch (result.state, result.index) { - case (.processing, 0): - self?.letterView.showBottomArea() - default: - self?.letterView.hideBottomArea() - } + self?.updateLetterViewEmptyArea(with: result.index) + self?.updateLetterViewBottomArea(with: result.state, result.index) // TODO: - cell report 보이게 안보이게 - // TODO: - Empty Label Text }) .store(in: &self.cancelBag) } @@ -178,6 +173,32 @@ final class LetterViewController: BaseViewController { } } +// MARK: - Helper +extension LetterViewController { + private func showErrorAlert() { + self.makeAlert(title: TextLiteral.letterViewControllerErrorTitle, + message: TextLiteral.letterViewControllerErrorDescription) + } + + private func updateLetterViewEmptyArea(with index: Int) { + switch index { + case 0: + self.letterView.updateEmptyArea(with: TextLiteral.letterViewControllerEmptyViewTo) + default: + self.letterView.updateEmptyArea(with: TextLiteral.letterViewControllerEmptyViewFrom) + } + } + + private func updateLetterViewBottomArea(with state: LetterViewModel.RoomState, _ index: Int) { + switch (state, index) { + case (.processing, 0): + self.letterView.showBottomArea() + default: + self.letterView.hideBottomArea() + } + } +} + // MARK: - DataSource extension LetterViewController { private func configureDataSource() { @@ -250,14 +271,6 @@ extension LetterViewController { } } -// MARK: - Helper -extension LetterViewController { - private func showErrorAlert() { - self.makeAlert(title: TextLiteral.letterViewControllerErrorTitle, - message: TextLiteral.letterViewControllerErrorDescription) - } -} - // MARK: - CreateLetterViewControllerDelegate extension LetterViewController: CreateLetterViewControllerDelegate { func refreshLetterData() { diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index 5425bf4bd..02a11723a 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -57,8 +57,8 @@ final class LetterView: UIView { label.text = TextLiteral.letterViewControllerEmptyViewTo label.isHidden = true label.textColor = .grey003 - label.textAlignment = .center label.addLabelSpacing(lineSpacing: 16) + label.textAlignment = .center return label }() @@ -90,6 +90,15 @@ final class LetterView: UIView { self.setupGuideView(in: viewController) } + func updateEmptyArea(with items: [Message]) { + let isEmpty = items.isEmpty + self.emptyLabel.isHidden = !isEmpty + } + + func updateEmptyArea(with text: String) { + self.emptyLabel.text = text + } + func showBottomArea() { self.bottomView.isHidden = false } From 55053ad9ad67a1275f13f450c8eacce6dbce5052 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 21:03:19 +0900 Subject: [PATCH 197/468] =?UTF-8?q?[FEAT]=20=EC=8B=A0=EA=B3=A0=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=88=A8=EA=B9=80=20=EC=97=AC=EB=B6=80=EB=A5=BC=20?= =?UTF-8?q?=EC=83=81=EB=8B=A8=20header=20value=EB=A1=9C=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Network/Models/Letter.swift | 11 ++++++----- .../Letter/ViewModels/LetterViewModel.swift | 19 +++++++++++++++++-- .../Cells/LetterCollectionViewCell.swift | 4 ++-- .../LetterViewController.swift | 8 +++----- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/Manito/Manito/Network/Models/Letter.swift b/Manito/Manito/Network/Models/Letter.swift index 947261277..efd9a5edc 100644 --- a/Manito/Manito/Network/Models/Letter.swift +++ b/Manito/Manito/Network/Models/Letter.swift @@ -19,11 +19,12 @@ struct Manitte: Codable { } struct Message: Codable, Hashable { - var id: Int? - var content: String? - var imageUrl: String? - var createdDate: String? - var missionInfo: Mission? + let id: Int? + let content: String? + let imageUrl: String? + let createdDate: String? + let missionInfo: Mission? + var canReport: Bool? var isToday: Bool { return Date().letterDateToString == createdDate diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift index 204d46f32..b623fe6c6 100644 --- a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -140,7 +140,8 @@ extension LetterViewModel { Task { do { let messages = try await self.service.fetchSendLetter(roomId: roomId) - self.messageSubject.send(messages) + let modifiedMessages = self.messageWithReportState(in: messages) + self.messageSubject.send(modifiedMessages) } catch(let error) { guard let error = error as? NetworkError else { return } self.messageSubject.send(completion: .failure(error)) @@ -152,7 +153,8 @@ extension LetterViewModel { Task { do { let messages = try await self.service.fetchReceiveLetter(roomId: roomId) - self.messageSubject.send(messages) + let modifiedMessages = self.messageWithReportState(in: messages) + self.messageSubject.send(modifiedMessages) } catch(let error) { guard let error = error as? NetworkError else { return } self.messageSubject.send(completion: .failure(error)) @@ -164,4 +166,17 @@ extension LetterViewModel { guard let manitteeId = self.service.manitteeId else { return } self.messageDetails.manitteeId = manitteeId } + + private func messageWithReportState(in messages: [Message]) -> [Message] { + if let messageType = MessageType(rawValue: self.indexSubject.value) { + let canReport = messageType == .received + return messages.map { item in + var item = item + item.canReport = canReport + return item + } + } + + return [] + } } diff --git a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift index db5c9ac19..320a5ad6f 100644 --- a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift +++ b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift @@ -12,7 +12,7 @@ import SnapKit final class LetterCollectionViewCell: BaseCollectionViewCell { - typealias ConfigurationData = (mission: String?, date: String, content: String?, imageURL: String?, isTodayLetter: Bool, canReport: Bool) + typealias ConfigurationData = (mission: String?, date: String, content: String?, imageURL: String?, isTodayLetter: Bool, canReport: Bool?) // MARK: - ui component @@ -138,6 +138,6 @@ extension LetterCollectionViewCell { } self.missionLabel.textColor = data.isTodayLetter ? .subOrange : .grey003 - self.reportButton.isHidden = !data.canReport + self.reportButton.isHidden = !(data.canReport ?? false) } } diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index 77fa05e48..548f2d48f 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -129,9 +129,7 @@ final class LetterViewController: BaseViewController { Publishers.CombineLatest(output.roomState, output.index) .map { (state: $0, index: $1) } .sink(receiveValue: { [weak self] result in - self?.updateLetterViewEmptyArea(with: result.index) self?.updateLetterViewBottomArea(with: result.state, result.index) - // TODO: - cell report 보이게 안보이게 }) .store(in: &self.cancelBag) } @@ -166,7 +164,8 @@ final class LetterViewController: BaseViewController { .store(in: &self.cancelBag) self.viewModelOutput?.index - .sink(receiveValue: { index in + .sink(receiveValue: { [weak self] index in + self?.updateLetterViewEmptyArea(with: index) headerView.setupHeaderSelectedIndex(at: index) }) .store(in: &self.cancelBag) @@ -215,13 +214,12 @@ extension LetterViewController { private func letterCollectionViewDataSource() -> UICollectionViewDiffableDataSource { let letterCellRegistration = UICollectionView.CellRegistration { [weak self] cell, indexPath, item in - // TODO: - canReport안에 boolean 값!! cell.configureCell((mission: item.mission, date: item.date, content: item.content, imageURL: item.imageUrl, isTodayLetter: item.isToday, - canReport: true)) + canReport: item.canReport)) self?.bindCell(cell, with: item) } From 18790ebccb17a37c1e5c0f0c2713d885e8529b13 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 22:22:52 +0900 Subject: [PATCH 198/468] =?UTF-8?q?[FEAT]=20=EC=A0=84=EC=B2=B4=20=EC=BD=9C?= =?UTF-8?q?=EB=A0=89=EC=85=98=20=EB=B7=B0=20Layout=20=EA=B5=AC=EC=84=B1=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Cells/LetterCollectionViewCell.swift | 66 ++++++++----------- .../Letter/Views/Views/LetterView.swift | 18 +++-- 2 files changed, 41 insertions(+), 43 deletions(-) diff --git a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift index 320a5ad6f..0f991a744 100644 --- a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift +++ b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift @@ -13,14 +13,29 @@ import SnapKit final class LetterCollectionViewCell: BaseCollectionViewCell { typealias ConfigurationData = (mission: String?, date: String, content: String?, imageURL: String?, isTodayLetter: Bool, canReport: Bool?) + + private enum ConstantSize { + static let contentSpacing: CGFloat = 10 + static let wholeSpacingWithImage: CGFloat = 14 + static let wholeSpacingWithoutImage: CGFloat = 18 + static let bottomInset: CGFloat = 22 + static let imageHeight: CGFloat = 204 + } // MARK: - ui component - private let stackView: UIStackView = { + private let contentStackView: UIStackView = { let stackView = UIStackView() - stackView.alignment = .center + stackView.alignment = .leading stackView.axis = .vertical - stackView.spacing = 25 + stackView.spacing = ConstantSize.contentSpacing + return stackView + }() + private let wholeStackView: UIStackView = { + let stackView = UIStackView() + stackView.alignment = .fill + stackView.axis = .vertical + stackView.spacing = ConstantSize.wholeSpacingWithImage return stackView }() private let missionLabel: UILabel = { @@ -59,37 +74,24 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { return self.photoImageView.tapGesturePublisher } - private var imageURL: String? - // MARK: - override - - override func prepareForReuse() { - self.initializeConfiguration() - } override func setupLayout() { - self.contentView.addSubview(self.stackView) - self.stackView.addArrangedSubview(self.photoImageView) - self.stackView.addArrangedSubview(self.contentLabel) - self.stackView.snp.makeConstraints { - $0.edges.equalToSuperview() - } - - self.contentLabel.snp.makeConstraints { - $0.leading.trailing.equalToSuperview().inset(11) - } - - self.photoImageView.snp.makeConstraints { - $0.height.equalTo(0) + self.contentView.addSubview(self.wholeStackView) + self.wholeStackView.snp.makeConstraints { $0.top.leading.trailing.equalToSuperview() + $0.bottom.equalToSuperview().inset(ConstantSize.bottomInset) } - self.contentView.addSubview(self.missionLabel) - self.missionLabel.snp.makeConstraints { - $0.leading.trailing.equalToSuperview().inset(11) - $0.bottom.equalTo(self.contentLabel.snp.top).offset(5) + self.wholeStackView.addArrangedSubview(self.photoImageView) + self.wholeStackView.addArrangedSubview(self.contentStackView) + self.photoImageView.snp.makeConstraints { + $0.height.equalTo(ConstantSize.imageHeight) } + self.contentStackView.addArrangedSubview(self.missionLabel) + self.contentStackView.addArrangedSubview(self.contentLabel) + self.contentView.addSubview(self.reportButton) self.reportButton.snp.makeConstraints { $0.top.equalTo(self.missionLabel.snp.top) @@ -105,17 +107,6 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { // MARK: - func - private func initializeConfiguration() { - self.missionLabel.text = nil - self.contentLabel.text = nil - self.photoImageView.image = nil - self.missionLabel.snp.updateConstraints { - $0.bottom.equalTo(self.contentLabel.snp.top).offset(5) - } - self.photoImageView.snp.updateConstraints { - $0.height.equalTo(0) - } - } } // MARK: - Public - func @@ -133,7 +124,6 @@ extension LetterCollectionViewCell { } if let imageURL = data.imageURL { - self.imageURL = imageURL self.photoImageView.loadImageUrl(imageURL) } diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index 02a11723a..58c09e9b5 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -16,12 +16,18 @@ final class LetterView: UIView { static let headerWidth: CGFloat = UIScreen.main.bounds.size.width static let headerHeight: CGFloat = 66.0 static let groupInterItemSpacing: CGFloat = 33.0 - static let contentInset: NSDirectionalEdgeInsets = NSDirectionalEdgeInsets( + static let sectionContentInset: NSDirectionalEdgeInsets = NSDirectionalEdgeInsets( top: 18.0, leading: Size.leadingTrailingPadding, bottom: 18.0, trailing: Size.leadingTrailingPadding ) + static let itemContentInset: NSDirectionalEdgeInsets = NSDirectionalEdgeInsets( + top: 0, + leading: 0, + bottom: 33.0, + trailing: 0 + ) static let headerContentInset: NSDirectionalEdgeInsets = NSDirectionalEdgeInsets.zero } @@ -169,17 +175,19 @@ extension LetterView { heightDimension: .estimated(100) ) let item = NSCollectionLayoutItem(layoutSize: itemSize) + item.contentInsets = ConstantSize.itemContentInset let groupSize = NSCollectionLayoutSize( widthDimension: .fractionalWidth(1.0), - heightDimension: .estimated(100) + heightDimension: .fractionalWidth(1.0) ) - let group = NSCollectionLayoutGroup.vertical(layoutSize: groupSize, subitems: [item]) - group.interItemSpacing = NSCollectionLayoutSpacing.fixed(ConstantSize.groupInterItemSpacing) + let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item]) + group.contentInsets = .zero let section = NSCollectionLayoutSection(group: group) - section.contentInsets = ConstantSize.contentInset + section.contentInsets = ConstantSize.sectionContentInset section.boundarySupplementaryItems = self.sectionHeader() + return section } From 649924a0a700067f338a3d8e2eaaccafbaf3349d Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 22:44:51 +0900 Subject: [PATCH 199/468] =?UTF-8?q?[CHORE]=20Dynamic=20Height=20Cell?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/Cells/LetterCollectionViewCell.swift | 14 ++++++++++---- .../Screens/Letter/Views/Views/LetterView.swift | 13 +++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift index 0f991a744..883da7352 100644 --- a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift +++ b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift @@ -16,8 +16,7 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { private enum ConstantSize { static let contentSpacing: CGFloat = 10 - static let wholeSpacingWithImage: CGFloat = 14 - static let wholeSpacingWithoutImage: CGFloat = 18 + static let wholeSpacing: CGFloat = 14 static let bottomInset: CGFloat = 22 static let imageHeight: CGFloat = 204 } @@ -26,16 +25,17 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { private let contentStackView: UIStackView = { let stackView = UIStackView() - stackView.alignment = .leading + stackView.alignment = .fill stackView.axis = .vertical stackView.spacing = ConstantSize.contentSpacing + stackView.layoutMargins = UIEdgeInsets(top: ConstantSize.wholeSpacing, left: 11, bottom: 0, right: 11) + stackView.isLayoutMarginsRelativeArrangement = true return stackView }() private let wholeStackView: UIStackView = { let stackView = UIStackView() stackView.alignment = .fill stackView.axis = .vertical - stackView.spacing = ConstantSize.wholeSpacingWithImage return stackView }() private let missionLabel: UILabel = { @@ -121,10 +121,16 @@ extension LetterCollectionViewCell { if let content = data.content { self.contentLabel.text = content self.contentLabel.addLabelSpacing() + self.contentLabel.isHidden = false + } else { + contentLabel.isHidden = true } if let imageURL = data.imageURL { + self.photoImageView.isHidden = false self.photoImageView.loadImageUrl(imageURL) + } else { + self.photoImageView.isHidden = true } self.missionLabel.textColor = data.isTodayLetter ? .subOrange : .grey003 diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index 58c09e9b5..c429924c4 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -15,19 +15,13 @@ final class LetterView: UIView { private enum ConstantSize { static let headerWidth: CGFloat = UIScreen.main.bounds.size.width static let headerHeight: CGFloat = 66.0 - static let groupInterItemSpacing: CGFloat = 33.0 + static let groupInterItemSpacing: NSCollectionLayoutSpacing = NSCollectionLayoutSpacing.fixed(33) static let sectionContentInset: NSDirectionalEdgeInsets = NSDirectionalEdgeInsets( top: 18.0, leading: Size.leadingTrailingPadding, bottom: 18.0, trailing: Size.leadingTrailingPadding ) - static let itemContentInset: NSDirectionalEdgeInsets = NSDirectionalEdgeInsets( - top: 0, - leading: 0, - bottom: 33.0, - trailing: 0 - ) static let headerContentInset: NSDirectionalEdgeInsets = NSDirectionalEdgeInsets.zero } @@ -172,17 +166,16 @@ extension LetterView { let layout = UICollectionViewCompositionalLayout { index, environment -> NSCollectionLayoutSection? in let itemSize = NSCollectionLayoutSize( widthDimension: .fractionalWidth(1.0), - heightDimension: .estimated(100) + heightDimension: .estimated(500) ) let item = NSCollectionLayoutItem(layoutSize: itemSize) - item.contentInsets = ConstantSize.itemContentInset let groupSize = NSCollectionLayoutSize( widthDimension: .fractionalWidth(1.0), heightDimension: .fractionalWidth(1.0) ) let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item]) - group.contentInsets = .zero + group.interItemSpacing = ConstantSize.groupInterItemSpacing let section = NSCollectionLayoutSection(group: group) section.contentInsets = ConstantSize.sectionContentInset From 9c3aa516e949b26133e22c96bbac993952146e6c Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 22:55:24 +0900 Subject: [PATCH 200/468] =?UTF-8?q?[FIX]=20Spacing=EC=9D=B4=20=EB=AC=B4?= =?UTF-8?q?=EB=84=88=EC=A7=80=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Letter/Views/Views/LetterView.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index c429924c4..de59463fd 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -15,7 +15,7 @@ final class LetterView: UIView { private enum ConstantSize { static let headerWidth: CGFloat = UIScreen.main.bounds.size.width static let headerHeight: CGFloat = 66.0 - static let groupInterItemSpacing: NSCollectionLayoutSpacing = NSCollectionLayoutSpacing.fixed(33) + static let groupInterItemSpacing: CGFloat = 33 static let sectionContentInset: NSDirectionalEdgeInsets = NSDirectionalEdgeInsets( top: 18.0, leading: Size.leadingTrailingPadding, @@ -116,7 +116,7 @@ extension LetterView { private func setupLayout() { self.addSubview(self.listCollectionView) self.listCollectionView.snp.makeConstraints { - $0.edges.equalTo(self.safeAreaLayoutGuide) + $0.edges.equalToSuperview() } self.addSubview(self.emptyLabel) @@ -172,14 +172,14 @@ extension LetterView { let groupSize = NSCollectionLayoutSize( widthDimension: .fractionalWidth(1.0), - heightDimension: .fractionalWidth(1.0) + heightDimension: .estimated(300) ) let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item]) - group.interItemSpacing = ConstantSize.groupInterItemSpacing let section = NSCollectionLayoutSection(group: group) section.contentInsets = ConstantSize.sectionContentInset section.boundarySupplementaryItems = self.sectionHeader() + section.interGroupSpacing = ConstantSize.groupInterItemSpacing return section } From 83cfe66d000e49d21368fcc630bc5050fdf9483d Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 23:04:01 +0900 Subject: [PATCH 201/468] =?UTF-8?q?[CHORE]=20=EC=85=80=20=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=20=ED=84=B0=EC=B9=98=20=EB=B0=A9=EC=8B=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 -- .../Global/Extension/UIView+Combine.swift | 59 ------------------- .../Cells/LetterCollectionViewCell.swift | 25 +++++++- 3 files changed, 23 insertions(+), 65 deletions(-) delete mode 100644 Manito/Manito/Global/Extension/UIView+Combine.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 216725aad..0ae2e7468 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -108,7 +108,6 @@ B5B3C1632A41DBC400AABD6F /* Servicable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1622A41DBC400AABD6F /* Servicable.swift */; }; B5B3C1652A427B5800AABD6F /* UIControl+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */; }; B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */; }; - B5B3C1842A42F70C00AABD6F /* UIView+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1832A42F70C00AABD6F /* UIView+Combine.swift */; }; B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2AD285B2917006D880B /* Int+Extension.swift */; }; B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */; }; B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */; }; @@ -293,7 +292,6 @@ B5B3C1622A41DBC400AABD6F /* Servicable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Servicable.swift; sourceTree = ""; }; B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Combine.swift"; sourceTree = ""; }; B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Combine.swift"; sourceTree = ""; }; - B5B3C1832A42F70C00AABD6F /* UIView+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Combine.swift"; sourceTree = ""; }; B5E1F2AD285B2917006D880B /* Int+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Extension.swift"; sourceTree = ""; }; B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeViewController.swift; sourceTree = ""; }; B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultStorage.swift; sourceTree = ""; }; @@ -842,7 +840,6 @@ 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */, B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */, B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */, - B5B3C1832A42F70C00AABD6F /* UIView+Combine.swift */, B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */, ); path = Extension; @@ -1298,7 +1295,6 @@ B5F5253128545E4C00614FF7 /* BackButton.swift in Sources */, 39C957D628799AB900A04A2B /* HTTPMethod.swift in Sources */, 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */, - B5B3C1842A42F70C00AABD6F /* UIView+Combine.swift in Sources */, B5F525202851A21D00614FF7 /* UIViewController+Extension.swift in Sources */, 7ED845BA2876BE530075AC61 /* SettingViewTableCell.swift in Sources */, B5B3C15F2A41D6F400AABD6F /* LetterService.swift in Sources */, diff --git a/Manito/Manito/Global/Extension/UIView+Combine.swift b/Manito/Manito/Global/Extension/UIView+Combine.swift deleted file mode 100644 index 0383f55dc..000000000 --- a/Manito/Manito/Global/Extension/UIView+Combine.swift +++ /dev/null @@ -1,59 +0,0 @@ -// -// UIView+Combine.swift -// Manito -// -// Created by SHIN YOON AH on 2023/06/21. -// - -import Combine -import UIKit - -// https://0urtrees.tistory.com/365 - -extension UIGestureRecognizer { - struct GesturePublisher: Combine.Publisher where G: UIGestureRecognizer { - typealias Output = G - typealias Failure = Never - - let gestureRecognizer: G - let view: UIView - - func receive(subscriber: S) where S : Subscriber, Failure == S.Failure, Output == S.Input { - subscriber.receive( - subscription: Subscription(subscriber: subscriber, gestureRecognizer: gestureRecognizer, on: view) - ) - } - } - - class Subscription: Combine.Subscription where S.Input == G, S.Failure == Never { - var subscriber: S? - let gestureRecognizer: G - let view: UIView - - init(subscriber: S, gestureRecognizer: G, on view: UIView) { - self.subscriber = subscriber - self.gestureRecognizer = gestureRecognizer - self.view = view - gestureRecognizer.addTarget(self, action: #selector(handle)) - view.addGestureRecognizer(gestureRecognizer) - } - - @objc private func handle(_ gesture: UIGestureRecognizer) { - _ = subscriber?.receive(gestureRecognizer) - } - - func cancel() { - view.removeGestureRecognizer(gestureRecognizer) - } - - func request(_ demand: Subscribers.Demand) { } - } -} - -extension UIView { - var tapGesturePublisher: AnyPublisher { - return UITapGestureRecognizer.GesturePublisher(gestureRecognizer: .init(), view: self) - .map { _ in Void() } - .eraseToAnyPublisher() - } -} diff --git a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift index 883da7352..f74eba42b 100644 --- a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift +++ b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift @@ -70,8 +70,18 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { return self.reportButton.tapPublisher } - var imageViewTapGesturePublisher: AnyPublisher { - return self.photoImageView.tapGesturePublisher + var imageViewTapGesturePublisher: PassthroughSubject = PassthroughSubject() + + // MARK: - init + + override init(frame: CGRect) { + super.init(frame: frame) + self.setupImageGesture() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") } // MARK: - override @@ -107,6 +117,17 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { // MARK: - func + private func setupImageGesture() { + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.didTapImage)) + self.photoImageView.addGestureRecognizer(tapGesture) + } + + // MARK: - selector + + @objc + private func didTapImage() { + self.imageViewTapGesturePublisher.send(()) + } } // MARK: - Public - func From 86f81d4e321ba2d298d0d9aee7f5bf3c64939347 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 23:23:34 +0900 Subject: [PATCH 202/468] =?UTF-8?q?[CHORE]=20StackView=EB=A5=BC=20?= =?UTF-8?q?=EC=9D=B4=EC=9A=A9=ED=95=98=EB=8A=94=20=EB=B0=A9=EC=8B=9D?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Cells/LetterCollectionViewCell.swift | 8 +++++- .../Letter/Views/Views/LetterView.swift | 26 +++++++++++++++---- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift index f74eba42b..b76e35751 100644 --- a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift +++ b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift @@ -19,6 +19,12 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { static let wholeSpacing: CGFloat = 14 static let bottomInset: CGFloat = 22 static let imageHeight: CGFloat = 204 + static let stackMargins: UIEdgeInsets = UIEdgeInsets( + top: ConstantSize.wholeSpacing, + left: 11, + bottom: 0, + right: 11 + ) } // MARK: - ui component @@ -28,7 +34,7 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { stackView.alignment = .fill stackView.axis = .vertical stackView.spacing = ConstantSize.contentSpacing - stackView.layoutMargins = UIEdgeInsets(top: ConstantSize.wholeSpacing, left: 11, bottom: 0, right: 11) + stackView.layoutMargins = ConstantSize.stackMargins stackView.isLayoutMarginsRelativeArrangement = true return stackView }() diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index de59463fd..93aa06b17 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -16,17 +16,31 @@ final class LetterView: UIView { static let headerWidth: CGFloat = UIScreen.main.bounds.size.width static let headerHeight: CGFloat = 66.0 static let groupInterItemSpacing: CGFloat = 33 + static let headerContentInset: NSDirectionalEdgeInsets = NSDirectionalEdgeInsets.zero static let sectionContentInset: NSDirectionalEdgeInsets = NSDirectionalEdgeInsets( top: 18.0, leading: Size.leadingTrailingPadding, bottom: 18.0, trailing: Size.leadingTrailingPadding ) - static let headerContentInset: NSDirectionalEdgeInsets = NSDirectionalEdgeInsets.zero + static let stackMargins: UIEdgeInsets = UIEdgeInsets( + top: 0, + left: 0, + bottom: 18, + right: 0 + ) } // MARK: - ui component + private let wholeStackView: UIStackView = { + let stackView = UIStackView() + stackView.axis = .vertical + stackView.spacing = 0 + stackView.alignment = .fill + stackView.layoutMargins = ConstantSize.stackMargins + return stackView + }() private lazy var bottomView: UIView = { let view = UIView() view.backgroundColor = .backgroundGrey @@ -101,10 +115,12 @@ final class LetterView: UIView { func showBottomArea() { self.bottomView.isHidden = false + self.wholeStackView.isLayoutMarginsRelativeArrangement = true } func hideBottomArea() { self.bottomView.isHidden = true + self.wholeStackView.isLayoutMarginsRelativeArrangement = false } func removeGuideView() { @@ -114,8 +130,8 @@ final class LetterView: UIView { extension LetterView { private func setupLayout() { - self.addSubview(self.listCollectionView) - self.listCollectionView.snp.makeConstraints { + self.addSubview(self.wholeStackView) + self.wholeStackView.snp.makeConstraints { $0.edges.equalToSuperview() } @@ -124,9 +140,9 @@ extension LetterView { $0.center.equalToSuperview() } - self.addSubview(self.bottomView) + self.wholeStackView.addArrangedSubview(self.listCollectionView) + self.wholeStackView.addArrangedSubview(self.bottomView) self.bottomView.snp.makeConstraints { - $0.leading.trailing.bottom.equalTo(self.safeAreaLayoutGuide) $0.height.equalTo(73) } From 8327994ab642e5694758cf273ed3991b8551ecbe Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 23:41:55 +0900 Subject: [PATCH 203/468] =?UTF-8?q?[CHORE]=20GuideView=20=EC=84=B8?= =?UTF-8?q?=ED=8C=85=ED=95=98=EB=8A=94=20=EB=A9=94=EC=84=9C=EB=93=9C=20?= =?UTF-8?q?=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/ViewControllers/LetterViewController.swift | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index 548f2d48f..8338408a5 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -57,18 +57,16 @@ final class LetterViewController: BaseViewController { self.bindViewModel() } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.letterView.configureNavigationBar(of: self) + } + override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) self.letterView.removeGuideView() } - // MARK: - override - - override func configureUI() { - super.configureUI() - self.letterView.configureNavigationBar(of: self) - } - // MARK: - func - bind private func bindViewModel() { From 54b88c055387df3a4176ed14d229497e06a57aec Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 23:50:00 +0900 Subject: [PATCH 204/468] =?UTF-8?q?[FIX]=20=EC=8B=A0=EA=B3=A0=20=EC=8B=9C?= =?UTF-8?q?=20=EB=82=B4=EC=9A=A9=EC=9D=B4=20=EC=9E=98=EB=AA=BB=20=EB=93=A4?= =?UTF-8?q?=EC=96=B4=EA=B0=80=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Letter/Views/Cells/LetterCollectionViewCell.swift | 4 +++- .../Letter/Views/ViewControllers/LetterViewController.swift | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift index b76e35751..8a3e6e52a 100644 --- a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift +++ b/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift @@ -72,8 +72,10 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { // MARK: - property - var reportButtonTapPublisher: AnyPublisher { + var reportButtonTapPublisher: AnyPublisher { return self.reportButton.tapPublisher + .map { [weak self] in self?.contentLabel.text } + .eraseToAnyPublisher() } var imageViewTapGesturePublisher: PassthroughSubject = PassthroughSubject() diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index 8338408a5..0e4664782 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -134,8 +134,8 @@ final class LetterViewController: BaseViewController { private func bindCell(_ cell: LetterCollectionViewCell, with item: Message) { cell.reportButtonTapPublisher - .sink(receiveValue: { [weak self] _ in - if let content = item.content { + .sink(receiveValue: { [weak self] content in + if let content { self?.reportSubject.send(content) } else { self?.reportSubject.send("쪽지 내용 없음") From 4954c101fe700d5b9564b7814b8e1c75e7773a49 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 22 Jun 2023 23:58:46 +0900 Subject: [PATCH 205/468] =?UTF-8?q?[CHORE]=20GuideView=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=ED=95=98=EB=8A=94=20=EB=B6=80=EB=B6=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/ViewControllers/LetterViewController.swift | 11 ++++------- .../Screens/Letter/Views/Views/LetterView.swift | 8 ++++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index 0e4664782..be1323e3d 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -57,14 +57,11 @@ final class LetterViewController: BaseViewController { self.bindViewModel() } - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - self.letterView.configureNavigationBar(of: self) - } + // MARK: - override - override func viewWillDisappear(_ animated: Bool) { - super.viewWillDisappear(animated) - self.letterView.removeGuideView() + override func configureUI() { + super.configureUI() + self.letterView.configureNavigationBar(of: self) } // MARK: - func - bind diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index 93aa06b17..4c7011ef4 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -122,10 +122,6 @@ final class LetterView: UIView { self.bottomView.isHidden = true self.wholeStackView.isLayoutMarginsRelativeArrangement = false } - - func removeGuideView() { - self.guideView.removeGuideView() - } } extension LetterView { @@ -174,6 +170,10 @@ extension LetterView { self.guideView.addGuideButton(in: viewController.navigationItem) self.guideView.hideGuideViewWhenTappedAround(in: navigationController, viewController) } + + private func removeGuideView() { + self.guideView.removeGuideView() + } } // MARK: - UICollectionViewLayout From 2fab4f82c863307d79938c1f3741228ba0b18188 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Fri, 23 Jun 2023 12:23:30 +0900 Subject: [PATCH 206/468] =?UTF-8?q?[CHORE]=20=EC=A0=84=EC=B2=B4=EC=A0=81?= =?UTF-8?q?=EC=9D=B8=20=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 -- .../Manito/Global/Protocol/Servicable.swift | 10 ----- .../Letter/Services/LetterService.swift | 2 +- .../LetterViewController.swift | 4 +- .../Letter/Views/Views/LetterView.swift | 37 +++++++++++-------- 5 files changed, 25 insertions(+), 32 deletions(-) delete mode 100644 Manito/Manito/Global/Protocol/Servicable.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 0ae2e7468..3ef2a34b7 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -105,7 +105,6 @@ B5B3C15D2A41D6EB00AABD6F /* LetterViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C15C2A41D6EB00AABD6F /* LetterViewModel.swift */; }; B5B3C15F2A41D6F400AABD6F /* LetterService.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C15E2A41D6F400AABD6F /* LetterService.swift */; }; B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */; }; - B5B3C1632A41DBC400AABD6F /* Servicable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1622A41DBC400AABD6F /* Servicable.swift */; }; B5B3C1652A427B5800AABD6F /* UIControl+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */; }; B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */; }; B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2AD285B2917006D880B /* Int+Extension.swift */; }; @@ -289,7 +288,6 @@ B5B3C15C2A41D6EB00AABD6F /* LetterViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterViewModel.swift; sourceTree = ""; }; B5B3C15E2A41D6F400AABD6F /* LetterService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterService.swift; sourceTree = ""; }; B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModelType.swift; sourceTree = ""; }; - B5B3C1622A41DBC400AABD6F /* Servicable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Servicable.swift; sourceTree = ""; }; B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Combine.swift"; sourceTree = ""; }; B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Combine.swift"; sourceTree = ""; }; B5E1F2AD285B2917006D880B /* Int+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Extension.swift"; sourceTree = ""; }; @@ -861,7 +859,6 @@ isa = PBXGroup; children = ( B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */, - B5B3C1622A41DBC400AABD6F /* Servicable.swift */, ); path = Protocol; sourceTree = ""; @@ -1305,7 +1302,6 @@ 39C957F4287D9EB400A04A2B /* APIService.swift in Sources */, B5F524CF28519AA000614FF7 /* AppDelegate.swift in Sources */, 435B17682913E71400212663 /* DetailingViewController.swift in Sources */, - B5B3C1632A41DBC400AABD6F /* Servicable.swift in Sources */, B50CEE912A445EB700CF1C76 /* UIScrollView+Combine.swift in Sources */, B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */, D7C4A1A92A0B895300C3AE4C /* ChooseCharacterView.swift in Sources */, diff --git a/Manito/Manito/Global/Protocol/Servicable.swift b/Manito/Manito/Global/Protocol/Servicable.swift deleted file mode 100644 index bcc5fc664..000000000 --- a/Manito/Manito/Global/Protocol/Servicable.swift +++ /dev/null @@ -1,10 +0,0 @@ -// -// Servicable.swift -// Manito -// -// Created by SHIN YOON AH on 2023/06/20. -// - -import Foundation - -protocol Servicable { } diff --git a/Manito/Manito/Screens/Letter/Services/LetterService.swift b/Manito/Manito/Screens/Letter/Services/LetterService.swift index af883de96..e954fd482 100644 --- a/Manito/Manito/Screens/Letter/Services/LetterService.swift +++ b/Manito/Manito/Screens/Letter/Services/LetterService.swift @@ -8,7 +8,7 @@ import Combine import Foundation -protocol LetterServicable: Servicable { +protocol LetterServicable { var manitteeId: String? { get set } var nickname: String { get set } diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index be1323e3d..382634e86 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -78,7 +78,7 @@ final class LetterViewController: BaseViewController { viewDidLoad: self.viewDidLoadPublisher, segmentControlValueChanged: self.segmentValueSubject, refresh: self.refreshSubject, - sendLetterButtonDidTap: self.letterView.sendLetterButton.tapPublisher, + sendLetterButtonDidTap: self.letterView.sendButtonTapPublisher, reportButtonDidTap: self.reportSubject ) @@ -219,7 +219,7 @@ extension LetterViewController { } return UICollectionViewDiffableDataSource( - collectionView: self.letterView.listCollectionView, + collectionView: self.letterView.collectionView(), cellProvider: { collectionView, indexPath, item in return collectionView.dequeueConfiguredReusableCell( using: letterCellRegistration, diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index 4c7011ef4..661913bbd 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -33,6 +33,7 @@ final class LetterView: UIView { // MARK: - ui component + private let guideView: GuideView = GuideView(type: .letter) private let wholeStackView: UIStackView = { let stackView = UIStackView() stackView.axis = .vertical @@ -46,25 +47,12 @@ final class LetterView: UIView { view.backgroundColor = .backgroundGrey return view }() - private let guideView: GuideView = GuideView(type: .letter) - - lazy var listCollectionView: UICollectionView = { - let collectionView = UICollectionView(frame: .zero, collectionViewLayout: self.createLayout()) - collectionView.backgroundColor = .clear - collectionView.showsVerticalScrollIndicator = false - collectionView.register(cell: LetterCollectionViewCell.self, - forCellWithReuseIdentifier: LetterCollectionViewCell.className) - collectionView.register(LetterHeaderView.self, - forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, - withReuseIdentifier: LetterHeaderView.className) - return collectionView - }() - lazy var sendLetterButton: UIButton = { + private lazy var sendLetterButton: UIButton = { let button = MainButton() button.title = TextLiteral.sendLetterViewSendLetterButton return button }() - let emptyLabel: UILabel = { + private let emptyLabel: UILabel = { let label = UILabel() label.numberOfLines = 2 label.font = .font(.regular, ofSize: 16) @@ -75,9 +63,24 @@ final class LetterView: UIView { label.textAlignment = .center return label }() + private lazy var listCollectionView: UICollectionView = { + let collectionView = UICollectionView(frame: .zero, collectionViewLayout: self.createLayout()) + collectionView.backgroundColor = .clear + collectionView.showsVerticalScrollIndicator = false + collectionView.register(cell: LetterCollectionViewCell.self, + forCellWithReuseIdentifier: LetterCollectionViewCell.className) + collectionView.register(LetterHeaderView.self, + forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, + withReuseIdentifier: LetterHeaderView.className) + return collectionView + }() // MARK: - property + var sendButtonTapPublisher: AnyPublisher { + return self.sendLetterButton.tapPublisher + } + private var cancelBag: Set = Set() // MARK: - init @@ -122,6 +125,10 @@ final class LetterView: UIView { self.bottomView.isHidden = true self.wholeStackView.isLayoutMarginsRelativeArrangement = false } + + func collectionView() -> UICollectionView { + return self.listCollectionView + } } extension LetterView { From dfa4675ac2edb64a6ea12c3856ae545ba1e1602a Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Fri, 23 Jun 2023 15:44:17 +0900 Subject: [PATCH 207/468] =?UTF-8?q?[FIX]=20=EC=83=81=EB=8B=A8=20=EA=B0=80?= =?UTF-8?q?=EC=9D=B4=EB=93=9C=20=EB=B7=B0=EA=B0=80=20=EC=95=88=EC=82=AC?= =?UTF-8?q?=EB=9D=BC=EC=A7=80=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewControllers/LetterViewController.swift | 11 +++++++---- .../Screens/Letter/Views/Views/LetterView.swift | 16 ++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index 382634e86..5333efead 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -57,13 +57,16 @@ final class LetterViewController: BaseViewController { self.bindViewModel() } - // MARK: - override - - override func configureUI() { - super.configureUI() + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) self.letterView.configureNavigationBar(of: self) } + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + self.letterView.removeGuideView() + } + // MARK: - func - bind private func bindViewModel() { diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index 661913bbd..3cdf30407 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -42,12 +42,12 @@ final class LetterView: UIView { stackView.layoutMargins = ConstantSize.stackMargins return stackView }() - private lazy var bottomView: UIView = { + private let bottomView: UIView = { let view = UIView() view.backgroundColor = .backgroundGrey return view }() - private lazy var sendLetterButton: UIButton = { + private let sendLetterButton: UIButton = { let button = MainButton() button.title = TextLiteral.sendLetterViewSendLetterButton return button @@ -96,10 +96,6 @@ final class LetterView: UIView { fatalError("init(coder:) has not been implemented") } - deinit { - self.removeGuideView() - } - // MARK: - func func configureNavigationBar(of viewController: UIViewController) { @@ -126,6 +122,10 @@ final class LetterView: UIView { self.wholeStackView.isLayoutMarginsRelativeArrangement = false } + func removeGuideView() { + self.guideView.removeGuideView() + } + func collectionView() -> UICollectionView { return self.listCollectionView } @@ -177,10 +177,6 @@ extension LetterView { self.guideView.addGuideButton(in: viewController.navigationItem) self.guideView.hideGuideViewWhenTappedAround(in: navigationController, viewController) } - - private func removeGuideView() { - self.guideView.removeGuideView() - } } // MARK: - UICollectionViewLayout From 49a075f53ab6651309091ca1e8b60a4178a9e838 Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 25 Jun 2023 20:08:04 +0900 Subject: [PATCH 208/468] =?UTF-8?q?[ADD]=20=EB=AF=B8=EC=85=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EB=84=A4=ED=8A=B8=EC=9B=8C=ED=81=AC=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80=20(#467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 16 +++++ .../Manito/Network/API/MissionEditAPI.swift | 23 ++++++++ .../EndPoint/MissionEditEndPoint.swift | 58 +++++++++++++++++++ .../Network/Models/Request/MissionDTO.swift | 12 ++++ .../Protocol/MisstionEditProtocol.swift | 12 ++++ 5 files changed, 121 insertions(+) create mode 100644 Manito/Manito/Network/API/MissionEditAPI.swift create mode 100644 Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift create mode 100644 Manito/Manito/Network/Models/Request/MissionDTO.swift create mode 100644 Manito/Manito/Network/Protocol/MisstionEditProtocol.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index a10013116..2d5b4371a 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -24,6 +24,10 @@ 398B1CCA2A13597600DEFCEC /* FSCalendar in Frameworks */ = {isa = PBXBuildFile; productRef = 398B1CC92A13597600DEFCEC /* FSCalendar */; }; 398B1CCC2A13599D00DEFCEC /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = 398B1CCB2A13599D00DEFCEC /* FirebaseAuth */; }; 399D17AB2856C83B00F50D9D /* DetailEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */; }; + 39A938912A48504200EC2CF2 /* MissionEditEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938902A48504200EC2CF2 /* MissionEditEndPoint.swift */; }; + 39A938932A4852CA00EC2CF2 /* MissionDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938922A4852CA00EC2CF2 /* MissionDTO.swift */; }; + 39A938952A48562500EC2CF2 /* MisstionEditProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938942A48562500EC2CF2 /* MisstionEditProtocol.swift */; }; + 39A938972A48565500EC2CF2 /* MissionEditAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938962A48565500EC2CF2 /* MissionEditAPI.swift */; }; 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */; }; 39C957D02879521400A04A2B /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CF2879521400A04A2B /* String+Extension.swift */; }; 39C957D22879523200A04A2B /* Date+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957D12879523200A04A2B /* Date+Extension.swift */; }; @@ -206,6 +210,10 @@ 398B1CB92A12415B00DEFCEC /* ManitoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ManitoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManitoTests.swift; sourceTree = ""; }; 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailEditViewController.swift; sourceTree = ""; }; + 39A938902A48504200EC2CF2 /* MissionEditEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionEditEndPoint.swift; sourceTree = ""; }; + 39A938922A4852CA00EC2CF2 /* MissionDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionDTO.swift; sourceTree = ""; }; + 39A938942A48562500EC2CF2 /* MisstionEditProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MisstionEditProtocol.swift; sourceTree = ""; }; + 39A938962A48565500EC2CF2 /* MissionEditAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionEditAPI.swift; sourceTree = ""; }; 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; 39C957CF2879521400A04A2B /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = ""; }; 39C957D12879523200A04A2B /* Date+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Extension.swift"; sourceTree = ""; }; @@ -425,6 +433,7 @@ 39EEF65B28CB3CD600437654 /* LoginAPI.swift */, D739C36428C7B75400161117 /* SettingAPI.swift */, B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */, + 39A938962A48565500EC2CF2 /* MissionEditAPI.swift */, ); path = API; sourceTree = ""; @@ -441,6 +450,7 @@ 39EEF65528CB3BB200437654 /* LoginProtocol.swift */, D739C36228C7B69D00161117 /* SettingProtocol.swift */, B517C04D28D1FE660008BED0 /* TokenProtocol.swift */, + 39A938942A48562500EC2CF2 /* MisstionEditProtocol.swift */, ); path = Protocol; sourceTree = ""; @@ -496,6 +506,7 @@ 39C95807287DB05C00A04A2B /* SettingEndPoint.swift */, 39EEF65D28CB3CFE00437654 /* LoginEndPoint.swift */, B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */, + 39A938902A48504200EC2CF2 /* MissionEditEndPoint.swift */, ); path = EndPoint; sourceTree = ""; @@ -506,6 +517,7 @@ 39C957DE2879A35300A04A2B /* RoomDTO.swift */, 39E099AC287FC020004F464E /* LetterDTO.swift */, 39EEF65F28CB3D6200437654 /* LoginDTO.swift */, + 39A938922A4852CA00EC2CF2 /* MissionDTO.swift */, ); path = Request; sourceTree = ""; @@ -1211,6 +1223,7 @@ buildActionMask = 2147483647; files = ( D75E8C7F28D76FFB004A6C41 /* LetterCountBadgeView.swift in Sources */, + 39A938912A48504200EC2CF2 /* MissionEditEndPoint.swift in Sources */, CBA4D7A62856D48C0018BDC2 /* RoomStateView.swift in Sources */, 333BF66628571CF00039F77F /* FriendCollectionViewCell.swift in Sources */, 39D95265285B097800183B09 /* CalendarView.swift in Sources */, @@ -1252,6 +1265,7 @@ B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */, B5F525422855C97900614FF7 /* UILabel+Extension.swift in Sources */, CB21C33928C4C10200128D25 /* CharacterCollectionViewCell.swift in Sources */, + 39A938952A48562500EC2CF2 /* MisstionEditProtocol.swift in Sources */, 39EEF65A28CB3C7B00437654 /* Token.swift in Sources */, 39C95804287DAD3000A04A2B /* LetterEndPoint.swift in Sources */, 7E77DB0828BF9D2400E95D4B /* RoomAPI.swift in Sources */, @@ -1269,6 +1283,7 @@ 39C95808287DB05C00A04A2B /* SettingEndPoint.swift in Sources */, 39C957F4287D9EB400A04A2B /* APIService.swift in Sources */, B5F524CF28519AA000614FF7 /* AppDelegate.swift in Sources */, + 39A938972A48565500EC2CF2 /* MissionEditAPI.swift in Sources */, 435B17682913E71400212663 /* DetailingViewController.swift in Sources */, B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */, D7C4A1A92A0B895300C3AE4C /* ChooseCharacterView.swift in Sources */, @@ -1358,6 +1373,7 @@ CB9592B22855C09A00847751 /* ManitoRoomCollectionCell.swift in Sources */, B5AE11F429D32EE700F86FF8 /* SelectManitteeView.swift in Sources */, 397A241428BA516B00454E4F /* DetailWaitAPI.swift in Sources */, + 39A938932A4852CA00EC2CF2 /* MissionDTO.swift in Sources */, B5F525242851A25400614FF7 /* UICollectionView+Extension.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Manito/Manito/Network/API/MissionEditAPI.swift b/Manito/Manito/Network/API/MissionEditAPI.swift new file mode 100644 index 000000000..1d166087c --- /dev/null +++ b/Manito/Manito/Network/API/MissionEditAPI.swift @@ -0,0 +1,23 @@ +// +// MissionEditAPI.swift +// Manito +// +// Created by Mingwan Choi on 2023/06/25. +// + +import Foundation + +struct MissionEditAPI: MissionEditProtocol { + private let apiService: Requestable + + init(apiService: Requestable) { + self.apiService = apiService + } + + func patchEditMission(roomId: String, body: MissionDTO) async throws -> String? { + let request = MissionEditEndPoint + .patchEditMission(roomId: roomId, body: body) + .createRequest() + return try await apiService.request(request) + } +} diff --git a/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift b/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift new file mode 100644 index 000000000..2b82a59f0 --- /dev/null +++ b/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift @@ -0,0 +1,58 @@ +// +// MissionEditEndPoint.swift +// Manito +// +// Created by Mingwan Choi on 2023/06/25. +// + +import Foundation + +enum MissionEditEndPoint: URLRepresentable { + case patchEditMission(roomId: String, body: MissionDTO) + var path: String { + switch self { + case .patchEditMission(let roomId, _): + return "/missions/\(roomId)" + } + } +} + +extension MissionEditEndPoint: EndPointable { + var requestTimeOut: Float { + return 20 + } + + var httpMethod: HTTPMethod { + switch self { + case .patchEditMission: + return .patch + } + } + + var requestBody: Data? { + switch self { + case .patchEditMission(_, let body): + return body.encode() + } + } + + var url: String { + switch self { + case .patchEditMission(let roomId, let body): + return self[.patchEditMission(roomId: roomId, body: body)] + } + } + + func createRequest() -> NetworkRequest { + var headers: [String: String] = [:] + headers["Content-Type"] = "application/json" + headers["authorization"] = "Bearer \(UserDefaultStorage.accessToken)" + + return NetworkRequest(url: self.url, + headers: headers, + reqBody: self.requestBody, + reqTimeout: self.requestTimeOut, + httpMethod: self.httpMethod + ) + } +} diff --git a/Manito/Manito/Network/Models/Request/MissionDTO.swift b/Manito/Manito/Network/Models/Request/MissionDTO.swift new file mode 100644 index 000000000..44844b942 --- /dev/null +++ b/Manito/Manito/Network/Models/Request/MissionDTO.swift @@ -0,0 +1,12 @@ +// +// MissionDTO.swift +// Manito +// +// Created by Mingwan Choi on 2023/06/25. +// + +import Foundation + +struct MissionDTO: Encodable { + let mission: String +} diff --git a/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift b/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift new file mode 100644 index 000000000..bab87505d --- /dev/null +++ b/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift @@ -0,0 +1,12 @@ +// +// MisstionEditProtocol.swift +// Manito +// +// Created by Mingwan Choi on 2023/06/25. +// + +import Foundation + +protocol MissionEditProtocol { + func patchEditMission(roomId: String, body: MissionDTO) async throws -> String? +} From 38ee4b6cc053ec737851a42520820794cbb8f6a8 Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 25 Jun 2023 20:27:46 +0900 Subject: [PATCH 209/468] =?UTF-8?q?[CHORE]=20roomId=20=EB=84=98=EA=B2=A8?= =?UTF-8?q?=EC=A3=BC=EA=B8=B0=20(#467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Ing/DetailingViewController.swift | 7 +++--- .../View/MissionEditViewController.swift | 24 ++++++++++++++++++- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index 57bf3ae93..10236b975 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -87,8 +87,8 @@ final class DetailingViewController: BaseViewController { self.navigationController?.pushViewController(viewController, animated: true) } - private func presentEditMissionView(mission: String) { - let viewController = MissionEditViewController(mission: mission) + private func presentEditMissionView(mission: String, roomId: String) { + let viewController = MissionEditViewController(mission: mission, roomId: roomId) viewController.modalTransitionStyle = .crossDissolve viewController.modalPresentationStyle = .overCurrentContext self.present(viewController, animated: true) @@ -196,7 +196,8 @@ extension DetailingViewController: DetailingDelegate { func editMissionButtonDidTap(mission: String) { typealias AlertAction = ((UIAlertAction) -> ()) let editMissionAction: AlertAction = { [weak self] _ in - self?.presentEditMissionView(mission: mission) + guard let roomId = self?.roomId else { return } + self?.presentEditMissionView(mission: mission, roomId: roomId) } let resetAction: AlertAction = { [weak self] _ in self?.resetMission() diff --git a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift index e9d1bf650..3ad50127f 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift @@ -14,6 +14,8 @@ final class MissionEditViewController: BaseViewController { // MARK: - property let mission: String + let roomId: String + private let missionEditService: MissionEditAPI = MissionEditAPI(apiService: APIService()) // MARK: - component @@ -55,8 +57,9 @@ final class MissionEditViewController: BaseViewController { // MARK: - init - init(mission: String) { + init(mission: String, roomId: String) { self.mission = mission + self.roomId = roomId super.init() } @@ -125,6 +128,14 @@ final class MissionEditViewController: BaseViewController { okStyle: .default, okAction: { [weak self] _ in // FIXME: - API 연결 후 작업해야함 + self?.patchEditMission { result in + switch result { + case .success(let mission): + print(mission) + case .failure: + print("error") + } + } self?.dismiss(animated: true) }) } @@ -149,6 +160,17 @@ final class MissionEditViewController: BaseViewController { self.backgroundView.transform = .identity }) } + + // MARK: - network + + private func patchEditMission(completionHandler: @escaping ((Result) -> Void)) { + print("roomId", self.roomId) +// Task { +// do { +// let data = try await self.missionEditService.patchEditMission(roomId: self.roomId, body: MissionDTO(mission: "테스트")) +// } +// } + } } extension MissionEditViewController: UITextFieldDelegate { From f4b61841e4879579da16f7dfce8bd6e362d3ca2c Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 25 Jun 2023 20:30:30 +0900 Subject: [PATCH 210/468] =?UTF-8?q?[CHORE]=20=EB=A7=88=EB=8B=88=EB=98=90?= =?UTF-8?q?=20=EA=B3=B5=EA=B0=9C=20=EB=B2=84=ED=8A=BC=20=EC=9C=84=EC=B9=98?= =?UTF-8?q?=20=EC=88=98=EC=A0=95(467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift index 2e89f3420..0c2506542 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift @@ -366,8 +366,7 @@ final class DetailingView: UIView { self.addSubview(self.manittoOpenButtonShadowView) self.manittoOpenButtonShadowView.snp.makeConstraints { $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalToSuperview().inset(7) - $0.centerX.equalToSuperview() + $0.bottom.equalToSuperview().inset(50) $0.height.equalTo(60) } From 22f30ff3e1ed57ac9aba2d6198ad64609474e224 Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 25 Jun 2023 21:24:16 +0900 Subject: [PATCH 211/468] =?UTF-8?q?[CHORE]=20=EA=B0=9C=EB=B0=9C=20?= =?UTF-8?q?=EC=84=9C=EB=B2=84=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Literal/URLLiteral.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Global/Literal/URLLiteral.swift b/Manito/Manito/Global/Literal/URLLiteral.swift index ec55de938..6b3a7e85f 100644 --- a/Manito/Manito/Global/Literal/URLLiteral.swift +++ b/Manito/Manito/Global/Literal/URLLiteral.swift @@ -12,7 +12,7 @@ enum URLLiteral { // MARK: - server url static let developmentUrl: String = "http://43.200.81.247:8080" - static let productionUrl: String = "https://dev.aenitto.shop" + static let productionUrl: String = "https://ckyeon.store" // MARK: - notion url From deb996b8b6d25724608547f888260d557fdedbab Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 25 Jun 2023 21:24:39 +0900 Subject: [PATCH 212/468] =?UTF-8?q?[CHORE]=20=EB=A6=AC=ED=84=B4=EA=B0=92?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20(#467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Network/API/MissionEditAPI.swift | 2 +- Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift | 2 +- Manito/Manito/Network/Models/Request/MissionDTO.swift | 2 +- Manito/Manito/Network/Protocol/MisstionEditProtocol.swift | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Network/API/MissionEditAPI.swift b/Manito/Manito/Network/API/MissionEditAPI.swift index 1d166087c..9eb2a5dbd 100644 --- a/Manito/Manito/Network/API/MissionEditAPI.swift +++ b/Manito/Manito/Network/API/MissionEditAPI.swift @@ -14,7 +14,7 @@ struct MissionEditAPI: MissionEditProtocol { self.apiService = apiService } - func patchEditMission(roomId: String, body: MissionDTO) async throws -> String? { + func patchEditMission(roomId: String, body: MissionDTO) async throws -> MissionDTO? { let request = MissionEditEndPoint .patchEditMission(roomId: roomId, body: body) .createRequest() diff --git a/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift b/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift index 2b82a59f0..85dc4cf3c 100644 --- a/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift +++ b/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift @@ -12,7 +12,7 @@ enum MissionEditEndPoint: URLRepresentable { var path: String { switch self { case .patchEditMission(let roomId, _): - return "/missions/\(roomId)" + return "/\(roomId)/individual-mission" } } } diff --git a/Manito/Manito/Network/Models/Request/MissionDTO.swift b/Manito/Manito/Network/Models/Request/MissionDTO.swift index 44844b942..175b5bde2 100644 --- a/Manito/Manito/Network/Models/Request/MissionDTO.swift +++ b/Manito/Manito/Network/Models/Request/MissionDTO.swift @@ -7,6 +7,6 @@ import Foundation -struct MissionDTO: Encodable { +struct MissionDTO: Codable { let mission: String } diff --git a/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift b/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift index bab87505d..f6b334d07 100644 --- a/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift +++ b/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift @@ -8,5 +8,5 @@ import Foundation protocol MissionEditProtocol { - func patchEditMission(roomId: String, body: MissionDTO) async throws -> String? + func patchEditMission(roomId: String, body: MissionDTO) async throws -> MissionDTO? } From dd794978d0c3daa007f76047d8c3fec132a76129 Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 25 Jun 2023 21:25:13 +0900 Subject: [PATCH 213/468] =?UTF-8?q?[CHORE]=20=EB=AF=B8=EC=85=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EB=84=A4=ED=8A=B8=EC=9B=8C=ED=81=AC=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EC=B6=94=EA=B0=80=20(#467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/MissionEditViewController.swift | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift index 3ad50127f..5f266f7ed 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift @@ -127,16 +127,17 @@ final class MissionEditViewController: BaseViewController { okTitle: TextLiteral.change, okStyle: .default, okAction: { [weak self] _ in - // FIXME: - API 연결 후 작업해야함 - self?.patchEditMission { result in + guard let missionText = self?.missionTextField.text else { return } + self?.patchEditMission(mission: missionText) { result in switch result { case .success(let mission): - print(mission) + DispatchQueue.main.async { + self?.dismiss(animated: true) + } case .failure: print("error") } } - self?.dismiss(animated: true) }) } @@ -163,13 +164,18 @@ final class MissionEditViewController: BaseViewController { // MARK: - network - private func patchEditMission(completionHandler: @escaping ((Result) -> Void)) { - print("roomId", self.roomId) -// Task { -// do { -// let data = try await self.missionEditService.patchEditMission(roomId: self.roomId, body: MissionDTO(mission: "테스트")) -// } -// } + private func patchEditMission(mission: String, completionHandler: @escaping ((Result) -> Void)) { + Task { + do { + let data = try await self.missionEditService.patchEditMission(roomId: self.roomId, + body: MissionDTO(mission: mission)) + if let data { + completionHandler(.success(data.mission)) + } else { + completionHandler(.failure(.unknownError)) + } + } + } } } From c00ebe409f1a53fe6a19b9ec1e957437d27a3795 Mon Sep 17 00:00:00 2001 From: chemi Date: Sun, 25 Jun 2023 22:11:25 +0900 Subject: [PATCH 214/468] =?UTF-8?q?[CHORE]=20=EB=AF=B8=EC=85=98=20UI=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20delegate=20=EC=B6=94=EA=B0=80=20(#467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Ing/DetailingViewController.swift | 7 +++++++ .../Manito/Screens/Detail-Ing/View/DetailingView.swift | 4 ++++ .../Detail-Ing/View/MissionEditViewController.swift | 10 ++++++++++ 3 files changed, 21 insertions(+) diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index 10236b975..8871734a6 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -91,6 +91,7 @@ final class DetailingViewController: BaseViewController { let viewController = MissionEditViewController(mission: mission, roomId: roomId) viewController.modalTransitionStyle = .crossDissolve viewController.modalPresentationStyle = .overCurrentContext + viewController.setDelegate(self) self.present(viewController, animated: true) } @@ -265,3 +266,9 @@ extension DetailingViewController: DetailingDelegate { self.openManittee(manitteeName: manitteeName) } } + +extension DetailingViewController: MissionEditDelegate { + func didChangeMission(mission: String) { + self.detailingView.updateMission(mission: mission) + } +} diff --git a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift index 0c2506542..8c5b21ba7 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift @@ -452,6 +452,10 @@ final class DetailingView: UIView { } } + func updateMission(mission: String) { + self.missionContentsLabel.text = mission + } + private func setupExitButton(admin: Bool) { if admin { let menu = UIMenu(options: [], children: [ diff --git a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift index 5f266f7ed..2206f6d54 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift @@ -9,6 +9,10 @@ import UIKit import SnapKit +protocol MissionEditDelegate: AnyObject { + func didChangeMission(mission: String) +} + final class MissionEditViewController: BaseViewController { // MARK: - property @@ -16,6 +20,7 @@ final class MissionEditViewController: BaseViewController { let mission: String let roomId: String private let missionEditService: MissionEditAPI = MissionEditAPI(apiService: APIService()) + private weak var delegate: MissionEditDelegate? // MARK: - component @@ -107,6 +112,10 @@ final class MissionEditViewController: BaseViewController { // MARK: - func + func setDelegate(_ delegate: DetailingViewController) { + self.delegate = delegate + } + private func setupGesture() { let tapGesture = UITapGestureRecognizer(target: self, action: #selector(dismissViewController)) self.view.addGestureRecognizer(tapGesture) @@ -132,6 +141,7 @@ final class MissionEditViewController: BaseViewController { switch result { case .success(let mission): DispatchQueue.main.async { + self?.delegate?.didChangeMission(mission: mission) self?.dismiss(animated: true) } case .failure: From d2d6e36e89e6e94df28175b07d65d4a67882c791 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 26 Jun 2023 16:32:58 +0900 Subject: [PATCH 215/468] =?UTF-8?q?[CHORE]=20url=20=EC=88=98=EC=A0=95=20(#?= =?UTF-8?q?467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Literal/URLLiteral.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Global/Literal/URLLiteral.swift b/Manito/Manito/Global/Literal/URLLiteral.swift index 6b3a7e85f..ec55de938 100644 --- a/Manito/Manito/Global/Literal/URLLiteral.swift +++ b/Manito/Manito/Global/Literal/URLLiteral.swift @@ -12,7 +12,7 @@ enum URLLiteral { // MARK: - server url static let developmentUrl: String = "http://43.200.81.247:8080" - static let productionUrl: String = "https://ckyeon.store" + static let productionUrl: String = "https://dev.aenitto.shop" // MARK: - notion url From 4468f7a7cab4e6512f5f704b9630dd25f664e344 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 26 Jun 2023 16:34:03 +0900 Subject: [PATCH 216/468] =?UTF-8?q?[CHORE]=20catch=20=EA=B5=AC=EB=AC=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Ing/View/MissionEditViewController.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift index 2206f6d54..d977abe6a 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift @@ -184,6 +184,10 @@ final class MissionEditViewController: BaseViewController { } else { completionHandler(.failure(.unknownError)) } + } catch NetworkError.serverError { + completionHandler(.failure(.serverError)) + } catch NetworkError.clientError(let message) { + completionHandler(.failure(.clientError(message: message))) } } } From b4714392f20cdc996bbb8dccbabc2a37a322f144 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 26 Jun 2023 16:50:45 +0900 Subject: [PATCH 217/468] =?UTF-8?q?[CHORE]=20=EB=AF=B8=EC=85=98=20?= =?UTF-8?q?=EB=90=98=EB=8F=8C=EB=A6=AC=EA=B8=B0=20=EB=84=A4=ED=8A=B8?= =?UTF-8?q?=EC=9B=8C=ED=81=AC=20=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?(#467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Network/API/MissionEditAPI.swift | 7 +++++++ .../Network/EndPoint/MissionEditEndPoint.swift | 14 ++++++++++++++ .../Network/Protocol/MisstionEditProtocol.swift | 3 ++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Manito/Manito/Network/API/MissionEditAPI.swift b/Manito/Manito/Network/API/MissionEditAPI.swift index 9eb2a5dbd..a022de633 100644 --- a/Manito/Manito/Network/API/MissionEditAPI.swift +++ b/Manito/Manito/Network/API/MissionEditAPI.swift @@ -20,4 +20,11 @@ struct MissionEditAPI: MissionEditProtocol { .createRequest() return try await apiService.request(request) } + + func fetchResetMission(roomId: String) async throws -> MissionDTO? { + let request = MissionEditEndPoint + .getResetMission(roomId: roomId) + .createRequest() + return try await apiService.request(request) + } } diff --git a/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift b/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift index 85dc4cf3c..0dd82b96e 100644 --- a/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift +++ b/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift @@ -9,10 +9,15 @@ import Foundation enum MissionEditEndPoint: URLRepresentable { case patchEditMission(roomId: String, body: MissionDTO) + case getResetMission(roomId: String) + var path: String { switch self { case .patchEditMission(let roomId, _): return "/\(roomId)/individual-mission" + + case .getResetMission(let roomId): + return "/\(roomId)/individual-mission/restore" } } } @@ -26,6 +31,9 @@ extension MissionEditEndPoint: EndPointable { switch self { case .patchEditMission: return .patch + + case .getResetMission: + return .get } } @@ -33,6 +41,9 @@ extension MissionEditEndPoint: EndPointable { switch self { case .patchEditMission(_, let body): return body.encode() + + case .getResetMission: + return nil } } @@ -40,6 +51,9 @@ extension MissionEditEndPoint: EndPointable { switch self { case .patchEditMission(let roomId, let body): return self[.patchEditMission(roomId: roomId, body: body)] + + case .getResetMission(let roomId): + return self[.getResetMission(roomId: roomId)] } } diff --git a/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift b/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift index f6b334d07..eba0e1a69 100644 --- a/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift +++ b/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift @@ -8,5 +8,6 @@ import Foundation protocol MissionEditProtocol { - func patchEditMission(roomId: String, body: MissionDTO) async throws -> MissionDTO? + func patchEditMission(roomId: String, body: MissionDTO) async throws -> MissionDTO? + func fetchResetMission(roomId: String) async throws -> MissionDTO? } From d7ee529b44ba19af9125ab96b164ebda0812bae8 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 26 Jun 2023 17:41:07 +0900 Subject: [PATCH 218/468] =?UTF-8?q?[CHORE]=20=EB=AF=B8=EC=85=98=20?= =?UTF-8?q?=EB=90=98=EB=8F=8C=EB=A6=AC=EA=B8=B0=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Ing/DetailingViewController.swift | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index 8871734a6..1e31df6f6 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -15,6 +15,7 @@ final class DetailingViewController: BaseViewController { private let detailIngService: DetailIngAPI = DetailIngAPI(apiService: APIService()) private let detailDoneService: DetailDoneAPI = DetailDoneAPI(apiService: APIService()) + private let missionEditService: MissionEditAPI = MissionEditAPI(apiService: APIService()) private let roomId: String private var missionId: String = "" @@ -100,8 +101,16 @@ final class DetailingViewController: BaseViewController { message: TextLiteral.detailIngViewControllerResetMissionAlertMessage, okTitle: TextLiteral.detailIngViewControllerResetMissionAlertOkTitle, okStyle: .default, - okAction: { _ in - // FIXME: - API 연결 + okAction: { [weak self] _ in + guard let roomId = self?.roomId else { return } + self?.requestResetMission(roomId: roomId) { result in + switch result { + case .success(let mission): + self?.detailingView.updateMission(mission: mission) + case .failure: + self?.makeAlert(title: "에러") + } + } }) } @@ -191,6 +200,21 @@ final class DetailingViewController: BaseViewController { } } } + + private func requestResetMission(roomId: String, completionHandler: @escaping ((Result) -> Void)) { + Task { + do { + let data = try await self.missionEditService.fetchResetMission(roomId: roomId) + if let mission = data { + completionHandler(.success(mission.mission)) + } + } catch NetworkError.serverError { + completionHandler(.failure(.serverError)) + } catch NetworkError.clientError(let message) { + completionHandler(.failure(.clientError(message: message))) + } + } + } } extension DetailingViewController: DetailingDelegate { From ef3c0b0eff054cd98be5d4b48b115b4643d2d10b Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 27 Jun 2023 18:21:36 +0900 Subject: [PATCH 219/468] =?UTF-8?q?[CHORE]=20nil=EC=9D=B4=20=EB=B0=9C?= =?UTF-8?q?=EC=83=9D=ED=95=A0=20=EC=88=98=EB=8F=84=20=EC=9E=88=EB=8A=94=20?= =?UTF-8?q?=EB=B6=80=EB=B6=84=EC=97=90=20map=EC=97=B0=EC=82=B0=EC=9E=90?= =?UTF-8?q?=EB=A5=BC=20compactMap=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=20=EC=A7=84=ED=96=89(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Letter/ViewModels/LetterViewModel.swift | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift index b623fe6c6..32dc1715f 100644 --- a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -69,12 +69,10 @@ final class LetterViewModel: ViewModelType { func transform(from input: Input) -> Output { let viewDidLoadType = input.viewDidLoad - .map { [weak self] in self?.messageType } - .map { $0! } + .compactMap { [weak self] in self?.messageType } let segmentValueType = input.segmentControlValueChanged - .map { MessageType(rawValue: $0) } - .map { $0! } + .compactMap { MessageType(rawValue: $0) } let refreshWithType = input.refresh .map { MessageType.sent } @@ -101,7 +99,7 @@ final class LetterViewModel: ViewModelType { .eraseToAnyPublisher() let roomStatePublisher = input.viewDidLoad - .map { [weak self] in (self?.roomState)! } + .compactMap { [weak self] in self?.roomState } .eraseToAnyPublisher() return Output( From fc7fef8db95d9dbf4523709819077829e134f144 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 27 Jun 2023 18:33:05 +0900 Subject: [PATCH 220/468] =?UTF-8?q?[CHORE]=20Schedular=EB=A5=BC=20RunLoop?= =?UTF-8?q?=EC=97=90=EC=84=9C=20DispatchQueue=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Letter/Views/ViewControllers/LetterViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index 5333efead..b146b33b3 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -92,7 +92,7 @@ final class LetterViewController: BaseViewController { guard let output = output else { return } output.messages - .receive(on: RunLoop.main) + .receive(on: DispatchQueue.main) .sink(receiveCompletion: { [weak self] completion in switch completion { case .failure(_): From 8a85a47a3352e109d7ccd9550d7a9828a7c98cec Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 27 Jun 2023 20:34:43 +0900 Subject: [PATCH 221/468] =?UTF-8?q?[CHORE]=20=EB=AF=B8=EC=85=98=EC=88=98?= =?UTF-8?q?=EC=A0=95VC=20=EC=9C=84=EC=B9=98=20=EC=88=98=EC=A0=95=20(#463)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 2 +- .../Detail-Ing/{View => }/MissionEditViewController.swift | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Manito/Manito/Screens/Detail-Ing/{View => }/MissionEditViewController.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index a10013116..f97ec9be9 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -514,7 +514,6 @@ isa = PBXGroup; children = ( 39EE956C2A401ED400AF6857 /* DetailingView.swift */, - 39EE956E2A404A3800AF6857 /* MissionEditViewController.swift */, ); path = View; sourceTree = ""; @@ -747,6 +746,7 @@ 435B17672913E71400212663 /* DetailingViewController.swift */, 33BDF5612856E03800564211 /* FriendListViewController.swift */, 333BF669285864CE0039F77F /* MemoryViewController.swift */, + 39EE956E2A404A3800AF6857 /* MissionEditViewController.swift */, ); path = "Detail-Ing"; sourceTree = ""; diff --git a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift similarity index 100% rename from Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift rename to Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift From 479b8c06cd6dd1b00d47bee95e59a4cb94a70b8e Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 27 Jun 2023 20:45:36 +0900 Subject: [PATCH 222/468] =?UTF-8?q?[CHORE]=20Error=EB=B0=9C=EC=83=9D=20?= =?UTF-8?q?=EC=8B=9C=20Alert=20=EC=B6=94=EA=B0=80=20(#467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Literal/TextLiteral.swift | 4 ++++ .../Manito/Screens/Detail-Ing/DetailingViewController.swift | 3 ++- .../Screens/Detail-Ing/View/MissionEditViewController.swift | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Global/Literal/TextLiteral.swift b/Manito/Manito/Global/Literal/TextLiteral.swift index db7e7f70a..09e73548e 100644 --- a/Manito/Manito/Global/Literal/TextLiteral.swift +++ b/Manito/Manito/Global/Literal/TextLiteral.swift @@ -167,6 +167,8 @@ enum TextLiteral { static let detailIngViewControllerResetMissionAlertTitle: String = "개별 미션을 되돌리시겠습니까?" static let detailIngViewControllerResetMissionAlertMessage: String = "기존에 주어지는 기본 미션으로 재설정됩니다." static let detailIngViewControllerResetMissionAlertOkTitle: String = "되돌리기" + static let detailIngViewControllerResetMissionErrorAlertOkTitle: String = "오류 발생" + static let detailIngViewControllerResetMissionErrorAlertOkMessage: String = "미션을 되돌릴 수 없습니다.\n다시 시도해주세요." // MARK: - CalendarView static let calendarViewAlertMaxTitle: String = "최대 선택 기간을 넘었어요" @@ -227,4 +229,6 @@ enum TextLiteral { // MARK: - MissionEditViewController static let missionEditViewControllerChangeMissionAlertTitle: String = "개별 미션을 수정하시겠습니까?" static let missionEditViewControllerChangeMissionAlertMessage: String = "기본 미션으로 변경을 통해\n되돌릴 수 있습니다." + static let missionEditViewControllerChangeMissionErrorAlertTitle: String = "오류 발생" + static let missionEditViewControllerChangeMissionErrorAlertMessage: String = "개별 미션을 수정 할 수 없습니다.\n다시 시도해주세요." } diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index 1e31df6f6..f71a2f525 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -108,7 +108,8 @@ final class DetailingViewController: BaseViewController { case .success(let mission): self?.detailingView.updateMission(mission: mission) case .failure: - self?.makeAlert(title: "에러") + self?.makeAlert(title: TextLiteral.detailIngViewControllerResetMissionErrorAlertOkTitle, + message: TextLiteral.detailIngViewControllerResetMissionErrorAlertOkMessage) } } }) diff --git a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift index d977abe6a..86c3c18aa 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/MissionEditViewController.swift @@ -145,7 +145,8 @@ final class MissionEditViewController: BaseViewController { self?.dismiss(animated: true) } case .failure: - print("error") + self?.makeAlert(title: TextLiteral.missionEditViewControllerChangeMissionErrorAlertTitle, + message: TextLiteral.missionEditViewControllerChangeMissionErrorAlertMessage) } } }) From 2d0c756d4cf63fad2e61b6e18cffc2c7492b4019 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 27 Jun 2023 20:49:09 +0900 Subject: [PATCH 223/468] =?UTF-8?q?[CHORE]=20=EB=AF=B8=EC=85=98=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=ED=99=94=20endPoint=20=EC=88=98=EC=A0=95=20(?= =?UTF-8?q?#467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Network/API/DetailStartingAPI.swift | 7 +++++++ Manito/Manito/Network/API/MissionEditAPI.swift | 7 ------- .../Network/EndPoint/DetailIngEndPoint.swift | 9 +++++++++ .../Network/EndPoint/MissionEditEndPoint.swift | 14 +------------- .../Network/Protocol/DetailStartingProtocol.swift | 1 + .../Network/Protocol/MisstionEditProtocol.swift | 1 - .../Detail-Ing/DetailingViewController.swift | 2 +- 7 files changed, 19 insertions(+), 22 deletions(-) diff --git a/Manito/Manito/Network/API/DetailStartingAPI.swift b/Manito/Manito/Network/API/DetailStartingAPI.swift index 8520b5c40..723c3bba7 100644 --- a/Manito/Manito/Network/API/DetailStartingAPI.swift +++ b/Manito/Manito/Network/API/DetailStartingAPI.swift @@ -27,4 +27,11 @@ struct DetailIngAPI: DetailStartingProtocol { .createRequest() return try await apiService.request(request) } + + func fetchResetMission(roomId: String) async throws -> MissionDTO? { + let request = DetailIngEndPoint + .getResetMission(roomId: roomId) + .createRequest() + return try await apiService.request(request) + } } diff --git a/Manito/Manito/Network/API/MissionEditAPI.swift b/Manito/Manito/Network/API/MissionEditAPI.swift index a022de633..9eb2a5dbd 100644 --- a/Manito/Manito/Network/API/MissionEditAPI.swift +++ b/Manito/Manito/Network/API/MissionEditAPI.swift @@ -20,11 +20,4 @@ struct MissionEditAPI: MissionEditProtocol { .createRequest() return try await apiService.request(request) } - - func fetchResetMission(roomId: String) async throws -> MissionDTO? { - let request = MissionEditEndPoint - .getResetMission(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } } diff --git a/Manito/Manito/Network/EndPoint/DetailIngEndPoint.swift b/Manito/Manito/Network/EndPoint/DetailIngEndPoint.swift index 1d3a38038..70ff7acc5 100644 --- a/Manito/Manito/Network/EndPoint/DetailIngEndPoint.swift +++ b/Manito/Manito/Network/EndPoint/DetailIngEndPoint.swift @@ -10,6 +10,7 @@ import Foundation enum DetailIngEndPoint: URLRepresentable { case requestWithFriend(roomId: String) case requestStartingRoomInfo(roomId: String) + case getResetMission(roomId: String) var path: String { switch self { @@ -17,6 +18,8 @@ enum DetailIngEndPoint: URLRepresentable { return "/rooms/\(roomId)/participants" case .requestStartingRoomInfo(let roomId): return "/rooms/\(roomId)" + case .getResetMission(let roomId): + return "/\(roomId)/individual-mission/restore" } } } @@ -32,6 +35,8 @@ extension DetailIngEndPoint: EndPointable { return .get case .requestStartingRoomInfo: return .get + case .getResetMission: + return .get } } @@ -41,6 +46,8 @@ extension DetailIngEndPoint: EndPointable { return nil case .requestStartingRoomInfo: return nil + case .getResetMission: + return nil } } @@ -50,6 +57,8 @@ extension DetailIngEndPoint: EndPointable { return self[.requestWithFriend(roomId: roomId)] case .requestStartingRoomInfo(let roomId): return self[.requestStartingRoomInfo(roomId: roomId)] + case .getResetMission(let roomId): + return self[.getResetMission(roomId: roomId)] } } diff --git a/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift b/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift index 0dd82b96e..143d5fbd6 100644 --- a/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift +++ b/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift @@ -9,15 +9,12 @@ import Foundation enum MissionEditEndPoint: URLRepresentable { case patchEditMission(roomId: String, body: MissionDTO) - case getResetMission(roomId: String) + var path: String { switch self { case .patchEditMission(let roomId, _): return "/\(roomId)/individual-mission" - - case .getResetMission(let roomId): - return "/\(roomId)/individual-mission/restore" } } } @@ -31,9 +28,6 @@ extension MissionEditEndPoint: EndPointable { switch self { case .patchEditMission: return .patch - - case .getResetMission: - return .get } } @@ -41,9 +35,6 @@ extension MissionEditEndPoint: EndPointable { switch self { case .patchEditMission(_, let body): return body.encode() - - case .getResetMission: - return nil } } @@ -51,9 +42,6 @@ extension MissionEditEndPoint: EndPointable { switch self { case .patchEditMission(let roomId, let body): return self[.patchEditMission(roomId: roomId, body: body)] - - case .getResetMission(let roomId): - return self[.getResetMission(roomId: roomId)] } } diff --git a/Manito/Manito/Network/Protocol/DetailStartingProtocol.swift b/Manito/Manito/Network/Protocol/DetailStartingProtocol.swift index 9f9232c36..0123cc5d4 100644 --- a/Manito/Manito/Network/Protocol/DetailStartingProtocol.swift +++ b/Manito/Manito/Network/Protocol/DetailStartingProtocol.swift @@ -10,4 +10,5 @@ import Foundation protocol DetailStartingProtocol { func requestStartingRoomInfo(roomId: String) async throws -> Room? func requestWithFriends(roomId: String) async throws -> FriendList? + func fetchResetMission(roomId: String) async throws -> MissionDTO? } diff --git a/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift b/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift index eba0e1a69..ef27e4421 100644 --- a/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift +++ b/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift @@ -9,5 +9,4 @@ import Foundation protocol MissionEditProtocol { func patchEditMission(roomId: String, body: MissionDTO) async throws -> MissionDTO? - func fetchResetMission(roomId: String) async throws -> MissionDTO? } diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index f71a2f525..bf97ff5a4 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -205,7 +205,7 @@ final class DetailingViewController: BaseViewController { private func requestResetMission(roomId: String, completionHandler: @escaping ((Result) -> Void)) { Task { do { - let data = try await self.missionEditService.fetchResetMission(roomId: roomId) + let data = try await self.detailIngService.fetchResetMission(roomId: roomId) if let mission = data { completionHandler(.success(mission.mission)) } From af36160136063d95b4c9ad7f83cabaf8e6928969 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 27 Jun 2023 21:56:38 +0900 Subject: [PATCH 224/468] =?UTF-8?q?[FIX]=20=EC=B4=88=EB=8C=80=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EB=B7=B0=20=EC=95=88=EB=9C=A8=EB=8A=94=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=20=ED=95=B4=EA=B2=B0=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 985482d97..cbc35ffa8 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -49,6 +49,7 @@ final class DetailWaitViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() + self.setupNotificationCenter() self.configureDelegation() self.configureNavigationController() self.fetchRoomInformationAtViewModel() @@ -129,6 +130,10 @@ final class DetailWaitViewController: BaseViewController { .store(in: &self.cancellable) } + private func setupNotificationCenter() { + NotificationCenter.default.addObserver(self, selector: #selector(self.didTapEnterButton), name: .createRoomInvitedCode, object: nil) + } + private func presentDetailEditViewController(isOnlyDateEdit: Bool) { guard let roominformation = self.detailWaitViewModel.roomInformation.value else { return } let viewController = DetailEditViewController(editMode: isOnlyDateEdit ? .date : .information, @@ -215,6 +220,28 @@ final class DetailWaitViewController: BaseViewController { message: TextLiteral.detailWaitViewControllerPastAlertMessage) } } + + // MARK: - selector + + @objc + private func didTapEnterButton() { + guard let roomInfo = self.detailWaitViewModel.roomInformation.value, + let title = roomInfo.roomInformation?.title, + let capacity = roomInfo.roomInformation?.capacity, + let startDate = roomInfo.roomInformation?.startDate, + let endDate = roomInfo.roomInformation?.endDate, + let invitationCode = roomInfo.invitation?.code + else { return } + let roomDto = RoomDTO(title: title, + capacity: capacity, + startDate: startDate, + endDate: endDate) + let viewController = InvitedCodeViewController(roomInfo: roomDto, + code: invitationCode) + viewController.modalPresentationStyle = .overCurrentContext + viewController.modalTransitionStyle = .crossDissolve + self.present(viewController, animated: true) + } } extension DetailWaitViewController: DetailWaitViewDelegate { From 86eed314d9d3b135e425ba2c8e48d9c4926beedc Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 27 Jun 2023 22:11:07 +0900 Subject: [PATCH 225/468] =?UTF-8?q?[FIX]=20=EC=AA=BD=EC=A7=80=20=EB=B3=B4?= =?UTF-8?q?=EB=82=BC=EB=95=8C=20=EB=AF=B8=EC=85=98=EC=97=90=20=EB=B0=98?= =?UTF-8?q?=EC=98=81=20=EC=95=88=EB=90=98=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0=20(#467)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Ing/DetailingViewController.swift | 15 +++++++-------- .../Detail-Ing/MissionEditViewController.swift | 12 ++++++------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index bf97ff5a4..1237dc3f1 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -15,7 +15,6 @@ final class DetailingViewController: BaseViewController { private let detailIngService: DetailIngAPI = DetailIngAPI(apiService: APIService()) private let detailDoneService: DetailDoneAPI = DetailDoneAPI(apiService: APIService()) - private let missionEditService: MissionEditAPI = MissionEditAPI(apiService: APIService()) private let roomId: String private var missionId: String = "" @@ -105,8 +104,8 @@ final class DetailingViewController: BaseViewController { guard let roomId = self?.roomId else { return } self?.requestResetMission(roomId: roomId) { result in switch result { - case .success(let mission): - self?.detailingView.updateMission(mission: mission) + case .success(): + self?.requestRoomInformation() case .failure: self?.makeAlert(title: TextLiteral.detailIngViewControllerResetMissionErrorAlertOkTitle, message: TextLiteral.detailIngViewControllerResetMissionErrorAlertOkMessage) @@ -202,12 +201,12 @@ final class DetailingViewController: BaseViewController { } } - private func requestResetMission(roomId: String, completionHandler: @escaping ((Result) -> Void)) { + private func requestResetMission(roomId: String, completionHandler: @escaping ((Result) -> Void)) { Task { do { let data = try await self.detailIngService.fetchResetMission(roomId: roomId) - if let mission = data { - completionHandler(.success(mission.mission)) + if let _ = data { + completionHandler(.success(())) } } catch NetworkError.serverError { completionHandler(.failure(.serverError)) @@ -293,7 +292,7 @@ extension DetailingViewController: DetailingDelegate { } extension DetailingViewController: MissionEditDelegate { - func didChangeMission(mission: String) { - self.detailingView.updateMission(mission: mission) + func didChangeMission() { + self.requestRoomInformation() } } diff --git a/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift index 86c3c18aa..9f519ad43 100644 --- a/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift @@ -10,7 +10,7 @@ import UIKit import SnapKit protocol MissionEditDelegate: AnyObject { - func didChangeMission(mission: String) + func didChangeMission() } final class MissionEditViewController: BaseViewController { @@ -139,9 +139,9 @@ final class MissionEditViewController: BaseViewController { guard let missionText = self?.missionTextField.text else { return } self?.patchEditMission(mission: missionText) { result in switch result { - case .success(let mission): + case .success(): DispatchQueue.main.async { - self?.delegate?.didChangeMission(mission: mission) + self?.delegate?.didChangeMission() self?.dismiss(animated: true) } case .failure: @@ -175,13 +175,13 @@ final class MissionEditViewController: BaseViewController { // MARK: - network - private func patchEditMission(mission: String, completionHandler: @escaping ((Result) -> Void)) { + private func patchEditMission(mission: String, completionHandler: @escaping ((Result) -> Void)) { Task { do { let data = try await self.missionEditService.patchEditMission(roomId: self.roomId, body: MissionDTO(mission: mission)) - if let data { - completionHandler(.success(data.mission)) + if let _ = data { + completionHandler(.success(())) } else { completionHandler(.failure(.unknownError)) } From ca50591bad42a64ecd68df39ae6d8601ca98c71f Mon Sep 17 00:00:00 2001 From: chemi Date: Wed, 28 Jun 2023 14:58:02 +0900 Subject: [PATCH 226/468] =?UTF-8?q?[CHORE]=20ViewModel=20Input=20Output=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=EC=88=98=EC=A0=95=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Network/Models/Room.swift | 12 ++ .../Detail-Wait/View/DetailEditView.swift | 6 +- .../ViewModel/DetailWaitViewModel.swift | 171 +++++++++++++----- 3 files changed, 136 insertions(+), 53 deletions(-) diff --git a/Manito/Manito/Network/Models/Room.swift b/Manito/Manito/Network/Models/Room.swift index 1abcf3fe6..cbb0227fd 100644 --- a/Manito/Manito/Network/Models/Room.swift +++ b/Manito/Manito/Network/Models/Room.swift @@ -75,6 +75,18 @@ struct Room: Decodable { } } +extension Room { + static let emptyRoom = Room( + roomInformation: nil, + participants: nil, + manittee: nil, + manitto: nil, + invitation: nil, + mission: nil, + admin: nil, + messages: nil) +} + struct Friend: Decodable { let colorIndex: Int? let name: String? diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 5aaafbe76..d61b10378 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -16,9 +16,9 @@ protocol DetailEditDelegate: AnyObject { final class DetailEditView: UIView { - enum EditMode { - case date - case information + enum EditMode: Int { + case date = 0 + case information = 1 } // MARK: - ui component diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index dcc0627af..73bf17893 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -10,47 +10,97 @@ import Foundation final class DetailWaitViewModel { + enum EditMode: Int { + case date = 0 + case information = 1 + } + + typealias EditRoomInformation = (roomInformation: Room, mode: EditMode) + // MARK: - property let roomIndex: Int private let detailWaitService: DetailWaitAPI - var roomInformation = CurrentValueSubject(nil) - lazy var editMenuButtonDidTap = PassthroughSubject() - lazy var deleteMenuButtonDidTap = PassthroughSubject() - lazy var leaveMenuButtonDidTap = PassthroughSubject() - var didPassedStartDate = PassthroughSubject() + private var cancellable = Set() + + private let roomInformationSubject = CurrentValueSubject(Room.emptyRoom) + private let manitteeNicknameSubject = PassthroughSubject() + private let deleteRoomSubject = PassthroughSubject() + private let leaveRoomSubject = PassthroughSubject() struct Input { + let viewDidLoad: AnyPublisher let codeCopyButtonDidTap: AnyPublisher let startButtonDidTap: AnyPublisher + let editMenuButtonDidTap: AnyPublisher + let deleteMenuButtonDidTap: AnyPublisher + let leaveMenuButtonDidTap: AnyPublisher } struct Output { - let roomInformationDidUpdate: AnyPublisher - let showToast: AnyPublisher - let startManitto: AnyPublisher - let presentEditView: AnyPublisher - let deleteRoom: AnyPublisher - let leaveRoom: AnyPublisher - let showStartDatePassedAlert: AnyPublisher + let roomInformation: CurrentValueSubject + let code: AnyPublisher + let manitteeNickname: PassthroughSubject + let editRoomInformation: AnyPublisher + let deleteRoom: PassthroughSubject + let leaveRoom: PassthroughSubject + let passedStartDate: AnyPublisher } func transform(_ input: Input) -> Output { - let showToastOutput = input.codeCopyButtonDidTap - .compactMap { self.roomInformation.value?.invitation?.code } + input.viewDidLoad + .sink(receiveValue: { [weak self] _ in + self?.requestWaitRoomInfo() + }) + .store(in: &self.cancellable) + + let codeOutput = input.codeCopyButtonDidTap + .map { [weak self] _ -> String in + guard let self else { return "" } + return self.makeCode() + } .eraseToAnyPublisher() - let startManittoOutput = input.startButtonDidTap - .throttle(for: 1, scheduler: DispatchQueue.main, latest: false) + input.startButtonDidTap + .sink(receiveValue: { [weak self] _ in + self?.requestStartManitto() + }) + .store(in: &self.cancellable) + + let editRoomInformationOutput = input.editMenuButtonDidTap + .map { [weak self] _ -> EditRoomInformation in + guard let self else { return (Room.emptyRoom, .information) } + return self.makeEditRoomInformation() + } + .eraseToAnyPublisher() + + input.deleteMenuButtonDidTap + .sink(receiveValue: { [weak self] _ in + self?.requestDeleteRoom() + }) + .store(in: &self.cancellable) + + input.leaveMenuButtonDidTap + .sink(receiveValue: { [weak self] _ in + self?.requestDeleteLeaveRoom() + }) + .store(in: &self.cancellable) + + let passedStartDateOutput = input.viewDidLoad + .map { [weak self] _ -> Bool in + guard let self else { return false } + return self.makeIsAdmin() + } .eraseToAnyPublisher() - return Output(roomInformationDidUpdate: self.roomInformation.eraseToAnyPublisher(), - showToast: showToastOutput, - startManitto: startManittoOutput, - presentEditView: self.editMenuButtonDidTap.eraseToAnyPublisher(), - deleteRoom: self.deleteMenuButtonDidTap.eraseToAnyPublisher(), - leaveRoom: self.leaveMenuButtonDidTap.eraseToAnyPublisher(), - showStartDatePassedAlert: self.didPassedStartDate.eraseToAnyPublisher() + return Output( + roomInformation: self.roomInformationSubject, + code: codeOutput, + manitteeNickname: self.manitteeNicknameSubject, + editRoomInformation: editRoomInformationOutput, + deleteRoom: self.deleteRoomSubject, + leaveRoom: self.leaveRoomSubject, + passedStartDate: passedStartDateOutput ) } @@ -63,79 +113,100 @@ final class DetailWaitViewModel { // MARK: - func - func fetchRoomInformation() { - requestWaitRoomInfo { [weak self] result in - switch result { - case .success(let roominformation): - self?.roomInformation.send(roominformation) - case .failure(let error): - print(error) - } - } + private func makeCode() -> String { + let roomInformation = self.roomInformationSubject.value + guard let code = roomInformation.invitation?.code else { return "" } + return code + } + + private func makeEditRoomInformation() -> EditRoomInformation { + let roomInformation = self.roomInformationSubject.value + let editMode: EditMode = .information + return (roomInformation, editMode) + } + + private func makeIsAdmin() -> Bool { + let roomInformation = self.roomInformationSubject.value + guard let isAdmin = roomInformation.admin else { return false } + return isAdmin } +// func fetchRoomInformation() { +// requestWaitRoomInfo { [weak self] result in +// switch result { +// case .success(let roominformation): +// self?.roomInformation.send(roominformation) +// case .failure(let error): +// print(error) +// } +// } +// } + // MARK: - network - private func requestWaitRoomInfo(completionHandler: @escaping ((Result) -> Void)) { + private func requestWaitRoomInfo() { Task { do { let data = try await self.detailWaitService.getWaitingRoomInfo(roomId: self.roomIndex.description) if let roomInformation = data { - completionHandler(.success(roomInformation)) + self.roomInformationSubject.send(roomInformation) } } catch NetworkError.serverError { - completionHandler(.failure(.serverError)) + self.roomInformationSubject.send(completion: .failure(.serverError)) } catch NetworkError.clientError(let message) { - completionHandler(.failure(.clientError(message: message))) + self.roomInformationSubject.send(completion: .failure(.clientError(message: message))) } } } - func requestStartManitto(completionHandler: @escaping ((Result) -> Void)) { + private func requestStartManitto() { Task { do { let data = try await self.detailWaitService.startManitto(roomId: self.roomIndex.description) if let manittee = data { guard let nickname = manittee.nickname else { return } - completionHandler(.success(nickname)) + self.manitteeNicknameSubject.send(nickname) } } catch NetworkError.serverError { - completionHandler(.failure(.serverError)) + self.manitteeNicknameSubject.send(completion: .failure(.serverError)) } catch NetworkError.clientError(let message) { - completionHandler(.failure(.clientError(message: message))) + self.manitteeNicknameSubject.send(completion: .failure(.clientError(message: message))) } } } - func requestDeleteRoom(completionHandler: @escaping ((Result) -> Void)) { + func requestDeleteRoom() { Task { do { let statusCode = try await self.detailWaitService.deleteRoom(roomId: self.roomIndex.description) switch statusCode { - case 200..<300: completionHandler(.success(())) + case 200..<300: + self.deleteRoomSubject.send(()) default: - completionHandler(.failure(.unknownError)) + self.deleteRoomSubject.send(completion: .failure(.unknownError)) } } catch NetworkError.serverError { - completionHandler(.failure(.serverError)) + self.deleteRoomSubject.send(completion: .failure(.serverError)) } catch NetworkError.clientError(let message) { - completionHandler(.failure(.clientError(message: message))) + self.deleteRoomSubject.send(completion: .failure(.clientError(message: message))) } } } - func requestDeleteLeaveRoom(completionHandler: @escaping ((Result) -> Void)) { + func requestDeleteLeaveRoom() { Task { do { let statusCode = try await self.detailWaitService.deleteLeaveRoom(roomId: self.roomIndex.description) switch statusCode { - case 200..<300: completionHandler(.success(())) - default: completionHandler(.failure(.unknownError)) + case 200..<300: + self.leaveRoomSubject.send(()) + default: + self.leaveRoomSubject.send(completion: .failure(.unknownError)) } } catch NetworkError.serverError { - completionHandler(.failure(.serverError)) + self.leaveRoomSubject.send(completion: .failure(.serverError)) } catch NetworkError.clientError(let message) { - completionHandler(.failure(.clientError(message: message))) + self.leaveRoomSubject.send(completion: .failure(.clientError(message: message))) } } } From 5605972e18f37026adbf3e033ef2bce30963cd41 Mon Sep 17 00:00:00 2001 From: chemi Date: Wed, 28 Jun 2023 20:58:13 +0900 Subject: [PATCH 227/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EA=B3=B5=EC=9C=A0=EB=A5=BC=20=EC=9C=84=ED=95=9C=20push=20(#185?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 298 ++++++++++++------ .../Detail-Wait/View/DetailWaitView.swift | 40 ++- .../ViewModel/DetailWaitViewModel.swift | 18 +- 3 files changed, 244 insertions(+), 112 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index cbc35ffa8..a8a8dbbbf 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -22,6 +22,9 @@ final class DetailWaitViewController: BaseViewController { // MARK: - property +// private let editMenuButtonSubject: PassthroughSubject +// private let deleteMenuButtonSubject: PassthroughSubject +// private let leaveMenuButtonSubject: PassthroughSubject private var cancellable = Set() private let detailWaitViewModel: DetailWaitViewModel @@ -50,94 +53,193 @@ final class DetailWaitViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() self.setupNotificationCenter() - self.configureDelegation() +// self.configureDelegation() self.configureNavigationController() - self.fetchRoomInformationAtViewModel() - self.setupBindings() + self.bindViewModel() +// self.fetchRoomInformationAtViewModel() +// self.setupBindings() } // MARK: - func - private func configureDelegation() { - self.detailWaitView.configureDelegation(self) - } +// private func configureDelegation() { +// self.detailWaitView.configureDelegation(self) +// } private func configureNavigationController() { guard let navigationController = self.navigationController else { return } self.detailWaitView.configureNavigationItem(navigationController) } - private func fetchRoomInformationAtViewModel() { - self.detailWaitViewModel.fetchRoomInformation() +// private func fetchRoomInformationAtViewModel() { +// self.detailWaitViewModel.fetchRoomInformation() +// } + + private func bindViewModel() { + let output = self.transformedOutput() + self.bindOutputToViewModel(output) } - private func setupBindings() { + private func transformedOutput() -> DetailWaitViewModel.Output { let input = DetailWaitViewModel.Input( + viewDidLoad: self.viewDidLoadPublisher, codeCopyButtonDidTap: self.detailWaitView.copyButton.tapPublisher, - startButtonDidTap: self.detailWaitView.startButton.tapPublisher - ) - let output = self.detailWaitViewModel.transform(input) - - output.roomInformationDidUpdate + startButtonDidTap: self.detailWaitView.startButton.tapPublisher, + editMenuButtonDidTap: self.detailWaitView.editMenuButtonSubject.eraseToAnyPublisher(), + deleteMenuButtonDidTap: self.detailWaitView.deleteMenuButtonSubject.eraseToAnyPublisher(), + leaveMenuButtonDidTap: self.detailWaitView.leaveMenuButtonSubject.eraseToAnyPublisher()) + return self.detailWaitViewModel.transform(input) + } + + private func bindOutputToViewModel(_ output: DetailWaitViewModel.Output) { + output.roomInformation .receive(on: DispatchQueue.main) - .sink(receiveValue: { [weak self] room in - if let room { - self?.detailWaitView.updateDetailWaitView(room: room) + .sink(receiveCompletion: { [weak self] result in + switch result { + case .finished: return + case .failure(_): + self?.makeAlert(title: "에러 발생") } + }, receiveValue: { [weak self] room in + self?.detailWaitView.updateDetailWaitView(room: room) }) .store(in: &self.cancellable) - output.showToast + output.code .receive(on: DispatchQueue.main) .sink(receiveValue: { [weak self] code in self?.showToastView(code: code) }) .store(in: &self.cancellable) - output.startManitto + output.manitteeNickname .receive(on: DispatchQueue.main) - .sink(receiveValue: { [weak self] _ in - self?.startManitto() + .sink(receiveCompletion: { [weak self] result in + switch result { + case .finished: return + case .failure(_): + self?.makeAlert(title: "에러 발생") + } + }, receiveValue: { [weak self] nickname in + self?.presentSelectManittoViewController(nickname: nickname) }) .store(in: &self.cancellable) - output.presentEditView + output.editRoomInformation .receive(on: DispatchQueue.main) - .sink(receiveValue: { [weak self] _ in - self?.presentDetailEditViewController(isOnlyDateEdit: false) + .sink(receiveValue: { [weak self] editInformation in + self?.showDetailEditViewController(roomInformation: editInformation.roomInformation, + mode: editInformation.mode) }) .store(in: &self.cancellable) output.deleteRoom .receive(on: DispatchQueue.main) - .sink(receiveValue: { [weak self] _ in + .sink(receiveCompletion: { [weak self] result in + switch result { + case .finished: return + case .failure(_): + self?.makeAlert(title: "오류 발생") + } + }, receiveValue: { [weak self] _ in self?.deleteRoom() }) .store(in: &self.cancellable) output.leaveRoom .receive(on: DispatchQueue.main) - .sink(receiveValue: { [weak self] _ in + .sink(receiveCompletion: { [weak self] result in + switch result { + case .finished: return + case .failure(_): + self?.makeAlert(title: "오류 발생") + } + }, receiveValue: { [weak self] _ in self?.leaveRoom() }) .store(in: &self.cancellable) - output.showStartDatePassedAlert + output.passedStartDate .receive(on: DispatchQueue.main) - .sink(receiveValue: { [weak self] value in - self?.showStartDatePassedAlert(isAdmin: value) + .sink(receiveValue: { [weak self] isAdmin in + self?.showStartDatePassedAlert(isAdmin: isAdmin) }) .store(in: &self.cancellable) } +// private func setupBindings() { +// let input = DetailWaitViewModel.Input( +// codeCopyButtonDidTap: self.detailWaitView.copyButton.tapPublisher, +// startButtonDidTap: self.detailWaitView.startButton.tapPublisher +// ) +// let output = self.detailWaitViewModel.transform(input) +// +// output.roomInformationDidUpdate +// .receive(on: DispatchQueue.main) +// .sink(receiveValue: { [weak self] room in +// if let room { +// self?.detailWaitView.updateDetailWaitView(room: room) +// } +// }) +// .store(in: &self.cancellable) +// +// output.showToast +// .receive(on: DispatchQueue.main) +// .sink(receiveValue: { [weak self] code in +// self?.showToastView(code: code) +// }) +// .store(in: &self.cancellable) +// +// output.startManitto +// .receive(on: DispatchQueue.main) +// .sink(receiveValue: { [weak self] _ in +// self?.startManitto() +// }) +// .store(in: &self.cancellable) +// +// output.presentEditView +// .receive(on: DispatchQueue.main) +// .sink(receiveValue: { [weak self] _ in +// self?.presentDetailEditViewController(isOnlyDateEdit: false) +// }) +// .store(in: &self.cancellable) +// +// output.deleteRoom +// .receive(on: DispatchQueue.main) +// .sink(receiveValue: { [weak self] _ in +// self?.deleteRoom() +// }) +// .store(in: &self.cancellable) +// +// output.leaveRoom +// .receive(on: DispatchQueue.main) +// .sink(receiveValue: { [weak self] _ in +// self?.leaveRoom() +// }) +// .store(in: &self.cancellable) +// +// output.showStartDatePassedAlert +// .receive(on: DispatchQueue.main) +// .sink(receiveValue: { [weak self] value in +// self?.showStartDatePassedAlert(isAdmin: value) +// }) +// .store(in: &self.cancellable) +// } + private func setupNotificationCenter() { NotificationCenter.default.addObserver(self, selector: #selector(self.didTapEnterButton), name: .createRoomInvitedCode, object: nil) } - private func presentDetailEditViewController(isOnlyDateEdit: Bool) { - guard let roominformation = self.detailWaitViewModel.roomInformation.value else { return } - let viewController = DetailEditViewController(editMode: isOnlyDateEdit ? .date : .information, - room: roominformation) +// private func presentDetailEditViewController(isOnlyDateEdit: Bool) { +// guard let roominformation = self.detailWaitViewModel.roomInformation.value else { return } +// let viewController = DetailEditViewController(editMode: isOnlyDateEdit ? .date : .information, +// room: roominformation) +// viewController.detailWaitDelegate = self +// self.present(viewController, animated: true) +// } + + private func showDetailEditViewController(roomInformation: Room, mode: DetailEditView.EditMode) { + let viewController = DetailEditViewController(editMode: mode, room: roomInformation) viewController.detailWaitDelegate = self self.present(viewController, animated: true) } @@ -156,36 +258,38 @@ final class DetailWaitViewController: BaseViewController { controller: self) } - private func startManitto() { - self.detailWaitViewModel.requestStartManitto() { [weak self] result in - DispatchQueue.main.async { - switch result { - case .success(let nickname): - self?.presentSelectManittoViewController(nickname: nickname) - case .failure: - self?.makeAlert(title: TextLiteral.errorAlertTitle, - message: TextLiteral.detailWaitViewControllerStartErrorMessage) - } - } - } - } +// private func startManitto() { +// self.detailWaitViewModel.requestStartManitto() { [weak self] result in +// DispatchQueue.main.async { +// switch result { +// case .success(let nickname): +// self?.presentSelectManittoViewController(nickname: nickname) +// case .failure: +// self?.makeAlert(title: TextLiteral.errorAlertTitle, +// message: TextLiteral.detailWaitViewControllerStartErrorMessage) +// } +// } +// } +// } private func deleteRoom() { self.makeRequestAlert(title: TextLiteral.datailWaitViewControllerDeleteTitle, message: TextLiteral.datailWaitViewControllerDeleteMessage, okTitle: TextLiteral.delete, okAction: { [weak self] _ in - self?.detailWaitViewModel.requestDeleteRoom() { result in - DispatchQueue.main.async { - switch result { - case .success: - self?.navigationController?.popViewController(animated: true) - case .failure: - self?.makeAlert(title: TextLiteral.errorAlertTitle, - message: TextLiteral.detailWaitViewControllerDeleteErrorMessage) - } - } - } +// self?.detailWaitView.deleteMenuButtonSubject.send(()) + self?.detailWaitViewModel.requestDeleteRoom() +// self?.detailWaitViewModel.requestDeleteRoom() { result in +// DispatchQueue.main.async { +// switch result { +// case .success: +// self?.navigationController?.popViewController(animated: true) +// case .failure: +// self?.makeAlert(title: TextLiteral.errorAlertTitle, +// message: TextLiteral.detailWaitViewControllerDeleteErrorMessage) +// } +// } +// } }) } @@ -194,17 +298,18 @@ final class DetailWaitViewController: BaseViewController { message: TextLiteral.datailWaitViewControllerExitMessage, okTitle: TextLiteral.leave, okAction: { [weak self] _ in - self?.detailWaitViewModel.requestDeleteLeaveRoom() { result in - DispatchQueue.main.async { - switch result { - case .success: - self?.navigationController?.popViewController(animated: true) - case .failure: - self?.makeAlert(title: TextLiteral.errorAlertTitle, - message: TextLiteral.detailWaitViewControllerLeaveErrorMessage) - } - } - } + self?.detailWaitView.leaveMenuButtonSubject.send(()) +// self?.detailWaitViewModel.requestDeleteLeaveRoom() { result in +// DispatchQueue.main.async { +// switch result { +// case .success: +// self?.navigationController?.popViewController(animated: true) +// case .failure: +// self?.makeAlert(title: TextLiteral.errorAlertTitle, +// message: TextLiteral.detailWaitViewControllerLeaveErrorMessage) +// } +// } +// } }) } @@ -213,8 +318,10 @@ final class DetailWaitViewController: BaseViewController { self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, message: TextLiteral.detailWaitViewControllerPastAdminAlertMessage, okAction: { [weak self] _ in - self?.presentDetailEditViewController(isOnlyDateEdit: true) } - ) + guard let roomInformation = self?.detailWaitViewModel.makeRoomInformation() else { return } + self?.showDetailEditViewController(roomInformation: roomInformation, mode: .date) + // self?.presentDetailEditViewController(isOnlyDateEdit: true) } + }) } else { self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, message: TextLiteral.detailWaitViewControllerPastAlertMessage) @@ -225,8 +332,8 @@ final class DetailWaitViewController: BaseViewController { @objc private func didTapEnterButton() { - guard let roomInfo = self.detailWaitViewModel.roomInformation.value, - let title = roomInfo.roomInformation?.title, + let roomInfo = self.detailWaitViewModel.makeRoomInformation() + guard let title = roomInfo.roomInformation?.title, let capacity = roomInfo.roomInformation?.capacity, let startDate = roomInfo.roomInformation?.startDate, let endDate = roomInfo.roomInformation?.endDate, @@ -244,28 +351,39 @@ final class DetailWaitViewController: BaseViewController { } } -extension DetailWaitViewController: DetailWaitViewDelegate { - func editButtonDidTap() { - self.detailWaitViewModel.editMenuButtonDidTap.send(()) - } - - func deleteButtonDidTap() { - self.detailWaitViewModel.deleteMenuButtonDidTap.send(()) - } - - func leaveButtonDidTap() { - self.detailWaitViewModel.leaveMenuButtonDidTap.send(()) - } - - func didPassStartDate(isAdmin: Bool) { - self.detailWaitViewModel.didPassedStartDate.send(isAdmin) - } -} +//extension DetailWaitViewController: DetailWaitViewDelegate { +// func editButtonDidTap() { +// self.detailWaitViewModel.editMenuButtonDidTap.send(()) +// } +// +// func deleteButtonDidTap() { +// self.detailWaitViewModel.deleteMenuButtonDidTap.send(()) +// } +// +// func leaveButtonDidTap() { +// self.detailWaitViewModel.leaveMenuButtonDidTap.send(()) +// } +// +// func didPassStartDate(isAdmin: Bool) { +// self.detailWaitViewModel.didPassedStartDate.send(isAdmin) +// } +//} extension DetailWaitViewController: DetailWaitViewControllerDelegate { func didTappedChangeButton() { - self.detailWaitViewModel.fetchRoomInformation() + // TODO: 여긴 뭐가 들어가야할까...?? +// self.detailWaitViewModel.fetchRoomInformation() ToastView.showToast(message: "방 정보 수정 완료", controller: self) } } + +// FIXME: - 듀나 PR 합쳐지면서 삭제 예정 +extension UIViewController { + var viewDidLoadPublisher: AnyPublisher { + let selector = #selector(UIViewController.viewDidLoad) + return Just(selector) + .map { _ in Void() } + .eraseToAnyPublisher() + } +} diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 0b95b6d52..d8253ad66 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -5,16 +5,17 @@ // Created by Mingwan Choi on 2023/04/14. // +import Combine import UIKit import SnapKit -protocol DetailWaitViewDelegate: AnyObject { - func editButtonDidTap() - func deleteButtonDidTap() - func leaveButtonDidTap() - func didPassStartDate(isAdmin: Bool) -} +//protocol DetailWaitViewDelegate: AnyObject { +// func editButtonDidTap() +// func deleteButtonDidTap() +// func leaveButtonDidTap() +// func didPassStartDate(isAdmin: Bool) +//} final class DetailWaitView: UIView { private enum UserStatus { @@ -36,6 +37,11 @@ final class DetailWaitView: UIView { } } + // UIMenu에 관한 Subject를 여기에 만들어야하나? + let editMenuButtonSubject = PassthroughSubject() + let deleteMenuButtonSubject = PassthroughSubject() + let leaveMenuButtonSubject = PassthroughSubject() + // MARK: - ui component private let moreButton: UIButton = { @@ -91,7 +97,7 @@ final class DetailWaitView: UIView { } } - private weak var delegate: DetailWaitViewDelegate? +// private weak var delegate: DetailWaitViewDelegate? // MARK: - init @@ -199,14 +205,17 @@ final class DetailWaitView: UIView { switch type { case .admin: children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in - self?.delegate?.editButtonDidTap() + self?.editMenuButtonSubject.send(()) +// self?.delegate?.editButtonDidTap() }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in - self?.delegate?.deleteButtonDidTap() + self?.deleteMenuButtonSubject.send(()) +// self?.delegate?.deleteButtonDidTap() }) ] case .member: children = [UIAction(title: TextLiteral.detailWaitViewControllerLeaveRoom, handler: { [weak self] _ in - self?.delegate?.leaveButtonDidTap() + self?.leaveMenuButtonSubject.send(()) +// self?.delegate?.leaveButtonDidTap() })] } let menu = UIMenu(children: children) @@ -215,7 +224,7 @@ final class DetailWaitView: UIView { private func showAlertWhenPastDate(_ isAdmin: Bool, isStart: Bool) { if !isStart { - self.delegate?.didPassStartDate(isAdmin: isAdmin) +// self.delegate?.didPassStartDate(isAdmin: isAdmin) } } @@ -226,9 +235,9 @@ final class DetailWaitView: UIView { } } - func configureDelegation(_ delegate: DetailWaitViewDelegate) { - self.delegate = delegate - } +// func configureDelegation(_ delegate: DetailWaitViewDelegate) { +// self.delegate = delegate +// } func configureNavigationItem(_ navigationController: UINavigationController) { let navigationItem = navigationController.topViewController?.navigationItem @@ -259,7 +268,8 @@ final class DetailWaitView: UIView { @objc private func presentEditViewController() { - self.delegate?.editButtonDidTap() + self.editMenuButtonSubject.send(()) +// self.delegate?.editButtonDidTap() } } diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 73bf17893..1a021d94c 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -10,12 +10,12 @@ import Foundation final class DetailWaitViewModel { - enum EditMode: Int { - case date = 0 - case information = 1 - } +// enum EditMode: Int { +// case date = 0 +// case information = 1 +// } - typealias EditRoomInformation = (roomInformation: Room, mode: EditMode) + typealias EditRoomInformation = (roomInformation: Room, mode: DetailEditView.EditMode) // MARK: - property @@ -27,7 +27,7 @@ final class DetailWaitViewModel { private let manitteeNicknameSubject = PassthroughSubject() private let deleteRoomSubject = PassthroughSubject() private let leaveRoomSubject = PassthroughSubject() - + // ??? subject가 두갠데..? 머지 struct Input { let viewDidLoad: AnyPublisher let codeCopyButtonDidTap: AnyPublisher @@ -113,6 +113,10 @@ final class DetailWaitViewModel { // MARK: - func + func makeRoomInformation() -> Room { + return self.roomInformationSubject.value + } + private func makeCode() -> String { let roomInformation = self.roomInformationSubject.value guard let code = roomInformation.invitation?.code else { return "" } @@ -121,7 +125,7 @@ final class DetailWaitViewModel { private func makeEditRoomInformation() -> EditRoomInformation { let roomInformation = self.roomInformationSubject.value - let editMode: EditMode = .information + let editMode: DetailEditView.EditMode = .information return (roomInformation, editMode) } From 6aa649ff57564d851412f5e33c668e14c60f0f65 Mon Sep 17 00:00:00 2001 From: chemi Date: Wed, 28 Jun 2023 22:03:39 +0900 Subject: [PATCH 228/468] =?UTF-8?q?[CHORE]=20=EB=B0=A9=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EC=8A=A4=ED=8A=B8=EB=A6=BC=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailWaitViewController.swift | 18 ++++++++++++++---- .../Detail-Wait/View/DetailWaitView.swift | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index a8a8dbbbf..3b1341c46 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -23,7 +23,7 @@ final class DetailWaitViewController: BaseViewController { // MARK: - property // private let editMenuButtonSubject: PassthroughSubject -// private let deleteMenuButtonSubject: PassthroughSubject + private let deleteMenuButtonSubject = PassthroughSubject() // private let leaveMenuButtonSubject: PassthroughSubject private var cancellable = Set() private let detailWaitViewModel: DetailWaitViewModel @@ -56,6 +56,7 @@ final class DetailWaitViewController: BaseViewController { // self.configureDelegation() self.configureNavigationController() self.bindViewModel() + self.setupBind() // self.fetchRoomInformationAtViewModel() // self.setupBindings() } @@ -86,7 +87,7 @@ final class DetailWaitViewController: BaseViewController { codeCopyButtonDidTap: self.detailWaitView.copyButton.tapPublisher, startButtonDidTap: self.detailWaitView.startButton.tapPublisher, editMenuButtonDidTap: self.detailWaitView.editMenuButtonSubject.eraseToAnyPublisher(), - deleteMenuButtonDidTap: self.detailWaitView.deleteMenuButtonSubject.eraseToAnyPublisher(), + deleteMenuButtonDidTap: self.deleteMenuButtonSubject.eraseToAnyPublisher(), leaveMenuButtonDidTap: self.detailWaitView.leaveMenuButtonSubject.eraseToAnyPublisher()) return self.detailWaitViewModel.transform(input) } @@ -142,7 +143,7 @@ final class DetailWaitViewController: BaseViewController { self?.makeAlert(title: "오류 발생") } }, receiveValue: { [weak self] _ in - self?.deleteRoom() + self?.navigationController?.popViewController(animated: true) }) .store(in: &self.cancellable) @@ -167,6 +168,14 @@ final class DetailWaitViewController: BaseViewController { .store(in: &self.cancellable) } + private func setupBind() { + detailWaitView.deleteMenuButtonSubject + .sink(receiveValue: { [weak self] _ in + self?.deleteRoom() + }) + .store(in: &self.cancellable) + } + // private func setupBindings() { // let input = DetailWaitViewModel.Input( // codeCopyButtonDidTap: self.detailWaitView.copyButton.tapPublisher, @@ -277,8 +286,9 @@ final class DetailWaitViewController: BaseViewController { message: TextLiteral.datailWaitViewControllerDeleteMessage, okTitle: TextLiteral.delete, okAction: { [weak self] _ in + self?.deleteMenuButtonSubject.send(()) // self?.detailWaitView.deleteMenuButtonSubject.send(()) - self?.detailWaitViewModel.requestDeleteRoom() +// self?.detailWaitViewModel.requestDeleteRoom() // self?.detailWaitViewModel.requestDeleteRoom() { result in // DispatchQueue.main.async { // switch result { diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index d8253ad66..0f6d32cef 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -205,7 +205,7 @@ final class DetailWaitView: UIView { switch type { case .admin: children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in - self?.editMenuButtonSubject.send(()) +// self?.editMenuButtonSubject.send(()) // self?.delegate?.editButtonDidTap() }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in self?.deleteMenuButtonSubject.send(()) From f0cb84358f84d679daadcb4c2ad41a0611435f91 Mon Sep 17 00:00:00 2001 From: chemi Date: Wed, 28 Jun 2023 22:08:10 +0900 Subject: [PATCH 229/468] =?UTF-8?q?[CHORE]=20=EC=B4=88=EB=8C=80=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EB=B3=B5=EC=82=AC=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0=20(#469)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index fe1bd7154..6ac1fef6a 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -115,6 +115,7 @@ final class DetailWaitView: UIView { override init(frame: CGRect) { super.init(frame: frame) self.setupLayout() + self.setupCopyButton() } @available(*, unavailable) @@ -173,7 +174,7 @@ final class DetailWaitView: UIView { } } - private func setupCopyButton(_ invitationCode: String) { + private func setupCopyButton() { let action = UIAction { [weak self] _ in self?.delegate?.codeCopyButtonDidTap() } From 015de2143f384da6e31d1ffe4e0eaac808f96cbd Mon Sep 17 00:00:00 2001 From: chemi Date: Wed, 28 Jun 2023 22:12:22 +0900 Subject: [PATCH 230/468] =?UTF-8?q?[CHORE]=20=EC=B4=88=EB=8C=80=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EB=B7=B0=20=EC=95=88=EB=9C=A8=EB=8A=94=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=ED=95=B4=EA=B2=B0=20(#469)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index ca2d38644..229dc9c13 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -52,10 +52,15 @@ final class DetailWaitViewController: BaseViewController { self.fetchRoomData() self.configureDelegation() self.configureNavigationController() + self.setupNotificationCenter() } // MARK: - func + private func setupNotificationCenter() { + NotificationCenter.default.addObserver(self, selector: #selector(self.didTapEnterButton), name: .createRoomInvitedCode, object: nil) + } + private func configureDelegation() { self.detailWaitView.configureDelegation(self) } @@ -100,6 +105,27 @@ final class DetailWaitViewController: BaseViewController { } } + // MARK: - selector + + @objc + private func didTapEnterButton() { + guard let room = self.roomInformation, + let code = room.invitation?.code, + let title = room.roomInformation?.title, + let capacity = room.roomInformation?.capacity, + let startDate = room.roomInformation?.startDate, + let endDate = room.roomInformation?.endDate + else { return } + let viewController = InvitedCodeViewController(roomInfo: RoomDTO(title: title, + capacity: capacity, + startDate: startDate, + endDate: endDate), + code: code) + viewController.modalPresentationStyle = .overCurrentContext + viewController.modalTransitionStyle = .crossDissolve + self.present(viewController, animated: true) + } + // MARK: - network private func requestWaitRoomInfo(completionHandler: @escaping ((Result) -> Void)) { From 3896d5082ab09bf15ce6469355a4bdbf13a78f07 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 29 Jun 2023 15:14:12 +0900 Subject: [PATCH 231/468] =?UTF-8?q?[FIX]=20=EC=BA=90=EB=A6=AD=ED=84=B0=20?= =?UTF-8?q?=EC=9D=B8=EB=8D=B1=EC=8A=A4=20=EC=84=A0=ED=83=9D=20=EC=95=88?= =?UTF-8?q?=EB=90=98=EB=8A=94=20=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20?= =?UTF-8?q?(#471)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Network/Models/Request/RoomDTO.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Manito/Manito/Network/Models/Request/RoomDTO.swift b/Manito/Manito/Network/Models/Request/RoomDTO.swift index 10f650530..b4394bd43 100644 --- a/Manito/Manito/Network/Models/Request/RoomDTO.swift +++ b/Manito/Manito/Network/Models/Request/RoomDTO.swift @@ -21,4 +21,8 @@ struct RoomDTO: Encodable { struct MemberDTO: Encodable { var colorIndex: Int + + enum CodingKeys: String, CodingKey { + case colorIndex = "colorIdx" + } } From 8670218896dc1ec1f3908c5f463eca1962e781c5 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 29 Jun 2023 18:02:54 +0900 Subject: [PATCH 232/468] =?UTF-8?q?[CHORE]=20conflict=20=ED=95=B4=EA=B2=B0?= =?UTF-8?q?=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailWaitViewController.swift | 11 +++-------- .../Screens/Detail-Wait/View/DetailWaitView.swift | 14 +++++++------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index b98693475..d5b3fb48b 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -59,7 +59,6 @@ final class DetailWaitViewController: BaseViewController { self.setupBind() // self.fetchRoomInformationAtViewModel() // self.setupBindings() - self.setupNotificationCenter() } // MARK: - func @@ -68,9 +67,9 @@ final class DetailWaitViewController: BaseViewController { NotificationCenter.default.addObserver(self, selector: #selector(self.didTapEnterButton), name: .createRoomInvitedCode, object: nil) } - private func configureDelegation() { - self.detailWaitView.configureDelegation(self) - } +// private func configureDelegation() { +// self.detailWaitView.configureDelegation(self) +// } private func configureNavigationController() { guard let navigationController = self.navigationController else { return } @@ -240,10 +239,6 @@ final class DetailWaitViewController: BaseViewController { // .store(in: &self.cancellable) // } - private func setupNotificationCenter() { - NotificationCenter.default.addObserver(self, selector: #selector(self.didTapEnterButton), name: .createRoomInvitedCode, object: nil) - } - // private func presentDetailEditViewController(isOnlyDateEdit: Bool) { // guard let roominformation = self.detailWaitViewModel.roomInformation.value else { return } // let viewController = DetailEditViewController(editMode: isOnlyDateEdit ? .date : .information, diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 8d432a912..e8b8df3ae 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -104,7 +104,7 @@ final class DetailWaitView: UIView { override init(frame: CGRect) { super.init(frame: frame) self.setupLayout() - self.setupCopyButton() +// self.setupCopyButton() } @available(*, unavailable) @@ -163,12 +163,12 @@ final class DetailWaitView: UIView { } } - private func setupCopyButton() { - let action = UIAction { [weak self] _ in - self?.delegate?.codeCopyButtonDidTap() - } - self.copyButton.addAction(action, for: .touchUpInside) - } +// private func setupCopyButton() { +// let action = UIAction { [weak self] _ in +// self?.delegate?.codeCopyButtonDidTap() +// } +// self.copyButton.addAction(action, for: .touchUpInside) +// } private func setupTitleViewData(title: String, state: String, dateRange: String) { self.titleView.setStartState(state: state) From 5d89724c8eb1d5d7fd127572a6581daa2966b3b5 Mon Sep 17 00:00:00 2001 From: chemi Date: Fri, 30 Jun 2023 13:59:58 +0900 Subject: [PATCH 233/468] =?UTF-8?q?[CHORE]=20=EC=8B=9C=EC=9E=91=20?= =?UTF-8?q?=EB=82=A0=EC=A7=9C=20=EC=A7=80=EB=82=AC=EC=9D=84=20=EB=95=8C=20?= =?UTF-8?q?alert=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 20 ++++++++++--------- .../Detail-Wait/View/DetailWaitView.swift | 2 +- .../ViewModel/DetailWaitViewModel.swift | 16 +++++++++------ 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index d5b3fb48b..941518f99 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -166,8 +166,8 @@ final class DetailWaitViewController: BaseViewController { output.passedStartDate .receive(on: DispatchQueue.main) - .sink(receiveValue: { [weak self] isAdmin in - self?.showStartDatePassedAlert(isAdmin: isAdmin) + .sink(receiveValue: { [weak self] (isPassedStartDate, isAdmin) in + self?.showStartDatePassedAlert(isPassedStartDate: isPassedStartDate, isAdmin: isAdmin) }) .store(in: &self.cancellable) } @@ -323,15 +323,17 @@ final class DetailWaitViewController: BaseViewController { }) } - private func showStartDatePassedAlert(isAdmin: Bool) { + private func showStartDatePassedAlert(isPassedStartDate: Bool, isAdmin: Bool) { if isAdmin { - self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, - message: TextLiteral.detailWaitViewControllerPastAdminAlertMessage, - okAction: { [weak self] _ in - guard let roomInformation = self?.detailWaitViewModel.makeRoomInformation() else { return } - self?.showDetailEditViewController(roomInformation: roomInformation, mode: .date) - // self?.presentDetailEditViewController(isOnlyDateEdit: true) } + if isPassedStartDate { + self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, + message: TextLiteral.detailWaitViewControllerPastAdminAlertMessage, + okAction: { [weak self] _ in + guard let roomInformation = self?.detailWaitViewModel.makeRoomInformation() else { return } + self?.showDetailEditViewController(roomInformation: roomInformation, mode: .date) + // self?.presentDetailEditViewController(isOnlyDateEdit: true) } }) + } } else { self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, message: TextLiteral.detailWaitViewControllerPastAlertMessage) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index e8b8df3ae..e42167fc6 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -213,7 +213,7 @@ final class DetailWaitView: UIView { switch type { case .admin: children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in -// self?.editMenuButtonSubject.send(()) + self?.editMenuButtonSubject.send(()) // self?.delegate?.editButtonDidTap() }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in self?.deleteMenuButtonSubject.send(()) diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 1a021d94c..2d20ebd8e 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -16,6 +16,7 @@ final class DetailWaitViewModel { // } typealias EditRoomInformation = (roomInformation: Room, mode: DetailEditView.EditMode) + typealias PassedStartDateAndIsOwner = (passStartDate: Bool, isOwner: Bool) // MARK: - property @@ -44,7 +45,7 @@ final class DetailWaitViewModel { let editRoomInformation: AnyPublisher let deleteRoom: PassthroughSubject let leaveRoom: PassthroughSubject - let passedStartDate: AnyPublisher + let passedStartDate: AnyPublisher } func transform(_ input: Input) -> Output { @@ -87,8 +88,9 @@ final class DetailWaitViewModel { .store(in: &self.cancellable) let passedStartDateOutput = input.viewDidLoad - .map { [weak self] _ -> Bool in - guard let self else { return false } + .delay(for: 0.5, scheduler: DispatchQueue.main) + .map { [weak self] _ -> PassedStartDateAndIsOwner in + guard let self else { return (false, false) } return self.makeIsAdmin() } .eraseToAnyPublisher() @@ -129,10 +131,12 @@ final class DetailWaitViewModel { return (roomInformation, editMode) } - private func makeIsAdmin() -> Bool { + private func makeIsAdmin() -> PassedStartDateAndIsOwner { let roomInformation = self.roomInformationSubject.value - guard let isAdmin = roomInformation.admin else { return false } - return isAdmin + guard let isAdmin = roomInformation.admin, + let isPassStartDate = roomInformation.roomInformation?.isStartDatePast else { return (false, false) } + + return (isPassStartDate, isAdmin) } // func fetchRoomInformation() { From fa4740e8b7eefd46466ecdc4bcc49cb852f8a305 Mon Sep 17 00:00:00 2001 From: chemi Date: Fri, 30 Jun 2023 17:31:49 +0900 Subject: [PATCH 234/468] =?UTF-8?q?[CHORE]=20=EB=B0=A9=20=EB=82=98?= =?UTF-8?q?=EA=B0=80=EA=B8=B0=20=EC=8A=A4=ED=8A=B8=EB=A6=BC=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailWaitViewController.swift | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 941518f99..c1dc58bf6 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -24,7 +24,7 @@ final class DetailWaitViewController: BaseViewController { // private let editMenuButtonSubject: PassthroughSubject private let deleteMenuButtonSubject = PassthroughSubject() -// private let leaveMenuButtonSubject: PassthroughSubject + private let leaveMenuButtonSubject = PassthroughSubject() private var cancellable = Set() private let detailWaitViewModel: DetailWaitViewModel @@ -92,7 +92,7 @@ final class DetailWaitViewController: BaseViewController { startButtonDidTap: self.detailWaitView.startButton.tapPublisher, editMenuButtonDidTap: self.detailWaitView.editMenuButtonSubject.eraseToAnyPublisher(), deleteMenuButtonDidTap: self.deleteMenuButtonSubject.eraseToAnyPublisher(), - leaveMenuButtonDidTap: self.detailWaitView.leaveMenuButtonSubject.eraseToAnyPublisher()) + leaveMenuButtonDidTap: self.leaveMenuButtonSubject.eraseToAnyPublisher()) return self.detailWaitViewModel.transform(input) } @@ -160,7 +160,7 @@ final class DetailWaitViewController: BaseViewController { self?.makeAlert(title: "오류 발생") } }, receiveValue: { [weak self] _ in - self?.leaveRoom() + self?.navigationController?.popViewController(animated: true) }) .store(in: &self.cancellable) @@ -178,6 +178,12 @@ final class DetailWaitViewController: BaseViewController { self?.deleteRoom() }) .store(in: &self.cancellable) + + detailWaitView.leaveMenuButtonSubject + .sink(receiveValue: { [weak self] _ in + self?.leaveRoom() + }) + .store(in: &self.cancellable) } // private func setupBindings() { @@ -308,7 +314,7 @@ final class DetailWaitViewController: BaseViewController { message: TextLiteral.datailWaitViewControllerExitMessage, okTitle: TextLiteral.leave, okAction: { [weak self] _ in - self?.detailWaitView.leaveMenuButtonSubject.send(()) + self?.leaveMenuButtonSubject.send(()) // self?.detailWaitViewModel.requestDeleteLeaveRoom() { result in // DispatchQueue.main.async { // switch result { From 0d3aa10575286f2471afaab76abcb0e4b5e143ab Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sun, 2 Jul 2023 21:57:28 +0900 Subject: [PATCH 235/468] =?UTF-8?q?[CHORE]=20package=20=EB=B2=84=EC=A0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xcshareddata/swiftpm/Package.resolved | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a5052b187..a3ff76c5d 100644 --- a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/kaishin/Gifu.git", "state" : { - "revision" : "51f2eab32903e336f590c013267cfa4d7f8b06c4", - "version" : "3.3.1" + "revision" : "82da0086dea14ca9afc9801234ad8dc4cd9e2738", + "version" : "3.4.1" } }, { @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleDataTransport.git", "state" : { - "revision" : "5056b15c5acbb90cd214fe4d6138bdf5a740e5a8", - "version" : "9.2.0" + "revision" : "f6b558e3f801f2cac336b04f615ce111fa9ddaa0", + "version" : "9.2.1" } }, { @@ -68,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleUtilities.git", "state" : { - "revision" : "68ea347bdb1a69e2d2ae2e25cd085b6ef92f64cb", - "version" : "7.9.0" + "revision" : "0543562f85620b5b7c510c6bcbef75b562a5127b", + "version" : "7.11.0" } }, { @@ -86,8 +86,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/gtm-session-fetcher.git", "state" : { - "revision" : "d4289da23e978f37c344ea6a386e5546e2466294", - "version" : "2.1.0" + "revision" : "5ccda3981422a84186387dbb763ba739178b529c", + "version" : "2.3.0" } }, { @@ -113,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/promises.git", "state" : { - "revision" : "3e4e743631e86c8c70dbc6efdc7beaa6e90fd3bb", - "version" : "2.1.1" + "revision" : "ec957ccddbcc710ccc64c9dcbd4c7006fcf8b73a", + "version" : "2.2.0" } }, { @@ -140,8 +140,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "88c7d15e1242fdb6ecbafbc7926426a19be1e98a", - "version" : "1.20.2" + "revision" : "0af9125c4eae12a4973fb66574c53a54962a9e1e", + "version" : "1.21.0" } } ], From b5a9cbef082926bc0098ef4cb70d0bbf98933de3 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 3 Jul 2023 15:23:09 +0900 Subject: [PATCH 236/468] =?UTF-8?q?[CHORE]=20test=20=EA=B0=92=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Network/Models/Room.swift | 66 ++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/Manito/Manito/Network/Models/Room.swift b/Manito/Manito/Network/Models/Room.swift index cbb0227fd..90726be68 100644 --- a/Manito/Manito/Network/Models/Room.swift +++ b/Manito/Manito/Network/Models/Room.swift @@ -85,6 +85,17 @@ extension Room { mission: nil, admin: nil, messages: nil) + + static let testRoom = Room( + roomInformation: RoomInfo.testRoomInfo, + participants: Participants.testParticipants, + manittee: Manittee.testManittee, + manitto: Manitto.testManitto, + invitation: Invitation.testInvitation, + didViewRoulette: false, + mission: Mission.testMission, + admin: false, + messages: Message1.testMessage) } struct Friend: Decodable { @@ -106,11 +117,29 @@ struct Participants: Decodable { } } -// MARK: - Member +extension Participants { + static let testParticipants = Participants( + count: 5, + members: User.testUserList) +} + +// MARK: - User struct User: Decodable { let id, nickname: String? } +extension User { + static let testUser = User( + id: "100", nickname: "유저1") + static let testUserList = [ + User(id: "100", nickname: "유저1"), + User(id: "200", nickname: "유저2"), + User(id: "300", nickname: "유저3"), + User(id: "400", nickname: "유저4"), + User(id: "500", nickname: "유저5") + ] +} + // MARK: - Room struct RoomInfo: Decodable { let id, capacity: Int? @@ -157,23 +186,58 @@ struct RoomInfo: Decodable { } } +extension RoomInfo { + static let testRoomInfo = RoomInfo( + id: 1, + capacity: 5, + title: "테스트타이틀", + startDate: "2023.01.01", + endDate: "2023.01.05", + state: "PRE") +} + +// MARK: - Mission struct Mission: Codable { let id: Int? let content: String? } +extension Mission { + static let testMission = Mission(id: 1, content: "테스트미션") +} + +// MARK: - Invitation struct Invitation: Decodable { let code: String? } +extension Invitation { + static let testInvitation = Invitation(code: "ABCDEF") +} + +// MARK: - Message1 struct Message1: Decodable { let count: Int? } +extension Message1 { + static let testMessage = Message1(count: 3) +} + +// MARK: - Manittee struct Manittee: Decodable { let nickname: String? } +extension Manittee { + static let testManittee = Manittee(nickname: "테스트마니띠") +} + +// MARK: - Manitto struct Manitto: Decodable { let nickname: String? } + +extension Manitto { + static let testManitto = Manitto(nickname: "테스트마니또") +} From 2b99bc1e6c0c68bd01663a099eadce129676791d Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 3 Jul 2023 15:24:08 +0900 Subject: [PATCH 237/468] =?UTF-8?q?[CHORE]=20=EC=A3=BC=EC=84=9D=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 138 +----------------- .../ViewModel/DetailWaitViewModel.swift | 13 +- 2 files changed, 4 insertions(+), 147 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index c1dc58bf6..ba7e3c11c 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -22,7 +22,6 @@ final class DetailWaitViewController: BaseViewController { // MARK: - property -// private let editMenuButtonSubject: PassthroughSubject private let deleteMenuButtonSubject = PassthroughSubject() private let leaveMenuButtonSubject = PassthroughSubject() private var cancellable = Set() @@ -53,12 +52,9 @@ final class DetailWaitViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() self.setupNotificationCenter() -// self.configureDelegation() self.configureNavigationController() self.bindViewModel() self.setupBind() -// self.fetchRoomInformationAtViewModel() -// self.setupBindings() } // MARK: - func @@ -67,19 +63,11 @@ final class DetailWaitViewController: BaseViewController { NotificationCenter.default.addObserver(self, selector: #selector(self.didTapEnterButton), name: .createRoomInvitedCode, object: nil) } -// private func configureDelegation() { -// self.detailWaitView.configureDelegation(self) -// } - private func configureNavigationController() { guard let navigationController = self.navigationController else { return } self.detailWaitView.configureNavigationItem(navigationController) } -// private func fetchRoomInformationAtViewModel() { -// self.detailWaitViewModel.fetchRoomInformation() -// } - private func bindViewModel() { let output = self.transformedOutput() self.bindOutputToViewModel(output) @@ -185,74 +173,7 @@ final class DetailWaitViewController: BaseViewController { }) .store(in: &self.cancellable) } - -// private func setupBindings() { -// let input = DetailWaitViewModel.Input( -// codeCopyButtonDidTap: self.detailWaitView.copyButton.tapPublisher, -// startButtonDidTap: self.detailWaitView.startButton.tapPublisher -// ) -// let output = self.detailWaitViewModel.transform(input) -// -// output.roomInformationDidUpdate -// .receive(on: DispatchQueue.main) -// .sink(receiveValue: { [weak self] room in -// if let room { -// self?.detailWaitView.updateDetailWaitView(room: room) -// } -// }) -// .store(in: &self.cancellable) -// -// output.showToast -// .receive(on: DispatchQueue.main) -// .sink(receiveValue: { [weak self] code in -// self?.showToastView(code: code) -// }) -// .store(in: &self.cancellable) -// -// output.startManitto -// .receive(on: DispatchQueue.main) -// .sink(receiveValue: { [weak self] _ in -// self?.startManitto() -// }) -// .store(in: &self.cancellable) -// -// output.presentEditView -// .receive(on: DispatchQueue.main) -// .sink(receiveValue: { [weak self] _ in -// self?.presentDetailEditViewController(isOnlyDateEdit: false) -// }) -// .store(in: &self.cancellable) -// -// output.deleteRoom -// .receive(on: DispatchQueue.main) -// .sink(receiveValue: { [weak self] _ in -// self?.deleteRoom() -// }) -// .store(in: &self.cancellable) -// -// output.leaveRoom -// .receive(on: DispatchQueue.main) -// .sink(receiveValue: { [weak self] _ in -// self?.leaveRoom() -// }) -// .store(in: &self.cancellable) -// -// output.showStartDatePassedAlert -// .receive(on: DispatchQueue.main) -// .sink(receiveValue: { [weak self] value in -// self?.showStartDatePassedAlert(isAdmin: value) -// }) -// .store(in: &self.cancellable) -// } - -// private func presentDetailEditViewController(isOnlyDateEdit: Bool) { -// guard let roominformation = self.detailWaitViewModel.roomInformation.value else { return } -// let viewController = DetailEditViewController(editMode: isOnlyDateEdit ? .date : .information, -// room: roominformation) -// viewController.detailWaitDelegate = self -// self.present(viewController, animated: true) -// } - + private func showDetailEditViewController(roomInformation: Room, mode: DetailEditView.EditMode) { let viewController = DetailEditViewController(editMode: mode, room: roomInformation) viewController.detailWaitDelegate = self @@ -273,39 +194,12 @@ final class DetailWaitViewController: BaseViewController { controller: self) } -// private func startManitto() { -// self.detailWaitViewModel.requestStartManitto() { [weak self] result in -// DispatchQueue.main.async { -// switch result { -// case .success(let nickname): -// self?.presentSelectManittoViewController(nickname: nickname) -// case .failure: -// self?.makeAlert(title: TextLiteral.errorAlertTitle, -// message: TextLiteral.detailWaitViewControllerStartErrorMessage) -// } -// } -// } -// } - private func deleteRoom() { self.makeRequestAlert(title: TextLiteral.datailWaitViewControllerDeleteTitle, message: TextLiteral.datailWaitViewControllerDeleteMessage, okTitle: TextLiteral.delete, okAction: { [weak self] _ in self?.deleteMenuButtonSubject.send(()) -// self?.detailWaitView.deleteMenuButtonSubject.send(()) -// self?.detailWaitViewModel.requestDeleteRoom() -// self?.detailWaitViewModel.requestDeleteRoom() { result in -// DispatchQueue.main.async { -// switch result { -// case .success: -// self?.navigationController?.popViewController(animated: true) -// case .failure: -// self?.makeAlert(title: TextLiteral.errorAlertTitle, -// message: TextLiteral.detailWaitViewControllerDeleteErrorMessage) -// } -// } -// } }) } @@ -315,17 +209,6 @@ final class DetailWaitViewController: BaseViewController { okTitle: TextLiteral.leave, okAction: { [weak self] _ in self?.leaveMenuButtonSubject.send(()) -// self?.detailWaitViewModel.requestDeleteLeaveRoom() { result in -// DispatchQueue.main.async { -// switch result { -// case .success: -// self?.navigationController?.popViewController(animated: true) -// case .failure: -// self?.makeAlert(title: TextLiteral.errorAlertTitle, -// message: TextLiteral.detailWaitViewControllerLeaveErrorMessage) -// } -// } -// } }) } @@ -337,7 +220,6 @@ final class DetailWaitViewController: BaseViewController { okAction: { [weak self] _ in guard let roomInformation = self?.detailWaitViewModel.makeRoomInformation() else { return } self?.showDetailEditViewController(roomInformation: roomInformation, mode: .date) - // self?.presentDetailEditViewController(isOnlyDateEdit: true) } }) } } else { @@ -369,24 +251,6 @@ final class DetailWaitViewController: BaseViewController { } } -//extension DetailWaitViewController: DetailWaitViewDelegate { -// func editButtonDidTap() { -// self.detailWaitViewModel.editMenuButtonDidTap.send(()) -// } -// -// func deleteButtonDidTap() { -// self.detailWaitViewModel.deleteMenuButtonDidTap.send(()) -// } -// -// func leaveButtonDidTap() { -// self.detailWaitViewModel.leaveMenuButtonDidTap.send(()) -// } -// -// func didPassStartDate(isAdmin: Bool) { -// self.detailWaitViewModel.didPassedStartDate.send(isAdmin) -// } -//} - extension DetailWaitViewController: DetailWaitViewControllerDelegate { func didTappedChangeButton() { // TODO: 여긴 뭐가 들어가야할까...?? diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 2d20ebd8e..a84deea3e 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -139,16 +139,9 @@ final class DetailWaitViewModel { return (isPassStartDate, isAdmin) } -// func fetchRoomInformation() { -// requestWaitRoomInfo { [weak self] result in -// switch result { -// case .success(let roominformation): -// self?.roomInformation.send(roominformation) -// case .failure(let error): -// print(error) -// } -// } -// } + func setRoomInformation(room: Room) { + self.roomInformationSubject.send(room) + } // MARK: - network From b634aee35c82852e7f28e6baed8d5e843b2b7ea0 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 3 Jul 2023 15:40:53 +0900 Subject: [PATCH 238/468] =?UTF-8?q?[CHORE]=20=EB=B0=A9=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EC=88=98=EC=A0=95=20stream=20=EC=97=B0=EA=B2=B0=20?= =?UTF-8?q?(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/DetailWaitViewController.swift | 7 ++++--- .../ViewModel/DetailWaitViewModel.swift | 15 +++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index ba7e3c11c..e27f8d673 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -24,6 +24,7 @@ final class DetailWaitViewController: BaseViewController { private let deleteMenuButtonSubject = PassthroughSubject() private let leaveMenuButtonSubject = PassthroughSubject() + private let changeButtonSubject = PassthroughSubject() private var cancellable = Set() private let detailWaitViewModel: DetailWaitViewModel @@ -80,7 +81,8 @@ final class DetailWaitViewController: BaseViewController { startButtonDidTap: self.detailWaitView.startButton.tapPublisher, editMenuButtonDidTap: self.detailWaitView.editMenuButtonSubject.eraseToAnyPublisher(), deleteMenuButtonDidTap: self.deleteMenuButtonSubject.eraseToAnyPublisher(), - leaveMenuButtonDidTap: self.leaveMenuButtonSubject.eraseToAnyPublisher()) + leaveMenuButtonDidTap: self.leaveMenuButtonSubject.eraseToAnyPublisher(), + changeButtonDidTap: self.changeButtonSubject.eraseToAnyPublisher()) return self.detailWaitViewModel.transform(input) } @@ -253,8 +255,7 @@ final class DetailWaitViewController: BaseViewController { extension DetailWaitViewController: DetailWaitViewControllerDelegate { func didTappedChangeButton() { - // TODO: 여긴 뭐가 들어가야할까...?? -// self.detailWaitViewModel.fetchRoomInformation() + self.changeButtonSubject.send() ToastView.showToast(message: "방 정보 수정 완료", controller: self) } diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index a84deea3e..2407a6900 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -10,11 +10,6 @@ import Foundation final class DetailWaitViewModel { -// enum EditMode: Int { -// case date = 0 -// case information = 1 -// } - typealias EditRoomInformation = (roomInformation: Room, mode: DetailEditView.EditMode) typealias PassedStartDateAndIsOwner = (passStartDate: Bool, isOwner: Bool) @@ -28,7 +23,8 @@ final class DetailWaitViewModel { private let manitteeNicknameSubject = PassthroughSubject() private let deleteRoomSubject = PassthroughSubject() private let leaveRoomSubject = PassthroughSubject() - // ??? subject가 두갠데..? 머지 + private let changeButtonSubject = PassthroughSubject() + struct Input { let viewDidLoad: AnyPublisher let codeCopyButtonDidTap: AnyPublisher @@ -36,6 +32,7 @@ final class DetailWaitViewModel { let editMenuButtonDidTap: AnyPublisher let deleteMenuButtonDidTap: AnyPublisher let leaveMenuButtonDidTap: AnyPublisher + let changeButtonDidTap: AnyPublisher } struct Output { @@ -94,6 +91,12 @@ final class DetailWaitViewModel { return self.makeIsAdmin() } .eraseToAnyPublisher() + + input.changeButtonDidTap + .sink(receiveValue: { [weak self] _ in + self?.requestWaitRoomInfo() + }) + .store(in: &self.cancellable) return Output( roomInformation: self.roomInformationSubject, From d0d59b4df0fce8c98e3673eb652f0d985ba9b65e Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 3 Jul 2023 15:49:11 +0900 Subject: [PATCH 239/468] =?UTF-8?q?[CHORE]=20=EC=A3=BC=EC=84=9D=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/View/DetailWaitView.swift | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index e42167fc6..719280fa0 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -10,13 +10,6 @@ import UIKit import SnapKit -//protocol DetailWaitViewDelegate: AnyObject { -// func editButtonDidTap() -// func deleteButtonDidTap() -// func leaveButtonDidTap() -// func didPassStartDate(isAdmin: Bool) -//} - final class DetailWaitView: UIView { private enum UserStatus { case admin @@ -37,7 +30,6 @@ final class DetailWaitView: UIView { } } - // UIMenu에 관한 Subject를 여기에 만들어야하나? let editMenuButtonSubject = PassthroughSubject() let deleteMenuButtonSubject = PassthroughSubject() let leaveMenuButtonSubject = PassthroughSubject() @@ -97,14 +89,11 @@ final class DetailWaitView: UIView { } } -// private weak var delegate: DetailWaitViewDelegate? - // MARK: - init override init(frame: CGRect) { super.init(frame: frame) self.setupLayout() -// self.setupCopyButton() } @available(*, unavailable) @@ -163,13 +152,6 @@ final class DetailWaitView: UIView { } } -// private func setupCopyButton() { -// let action = UIAction { [weak self] _ in -// self?.delegate?.codeCopyButtonDidTap() -// } -// self.copyButton.addAction(action, for: .touchUpInside) -// } - private func setupTitleViewData(title: String, state: String, dateRange: String) { self.titleView.setStartState(state: state) self.titleView.setupLabelData(title: title, dateRange: dateRange) @@ -214,16 +196,13 @@ final class DetailWaitView: UIView { case .admin: children = [UIAction(title: TextLiteral.modifiedRoomInfo, handler: { [weak self] _ in self?.editMenuButtonSubject.send(()) -// self?.delegate?.editButtonDidTap() }),UIAction(title: TextLiteral.detailWaitViewControllerDeleteRoom, handler: { [weak self] _ in self?.deleteMenuButtonSubject.send(()) -// self?.delegate?.deleteButtonDidTap() }) ] case .member: children = [UIAction(title: TextLiteral.detailWaitViewControllerLeaveRoom, handler: { [weak self] _ in self?.leaveMenuButtonSubject.send(()) -// self?.delegate?.leaveButtonDidTap() })] } let menu = UIMenu(children: children) @@ -243,10 +222,6 @@ final class DetailWaitView: UIView { } } -// func configureDelegation(_ delegate: DetailWaitViewDelegate) { -// self.delegate = delegate -// } - func configureNavigationItem(_ navigationController: UINavigationController) { let navigationItem = navigationController.topViewController?.navigationItem let moreButton = UIBarButtonItem(customView: self.moreButton) @@ -277,7 +252,6 @@ final class DetailWaitView: UIView { @objc private func presentEditViewController() { self.editMenuButtonSubject.send(()) -// self.delegate?.editButtonDidTap() } } From 8e427fb3928e83ac7b084947f22c2a416ba79492 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 3 Jul 2023 16:01:40 +0900 Subject: [PATCH 240/468] =?UTF-8?q?[CHORE]=20ViewModel=20room=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/ManitoTests/DetailWaitViewModelTest.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index 830628b32..1c24ab065 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -13,7 +13,16 @@ final class DetailWaitViewModelTest: XCTestCase { private let viewModel = DetailWaitViewModel(roomIndex: 1, detailWaitService: DetailWaitAPI(apiService: APIService())) - func testExistFetchRoomInformation() { - let _ = viewModel.fetchRoomInformation() + func testMakeRoomInformation() { + // given + let testRoom = Room.testRoom + self.viewModel.setRoomInformation(room: testRoom) + + // then + let room = self.viewModel.makeRoomInformation() + + // when + // FIXME: - Room 구조체 Equatable 프로토콜 채택 해야함. + XCTAssertEqual(testRoom.roomInformation?.title, room.roomInformation?.title) } } From 2a93f3afa90d07f60f3f0b82cf779c076d72ae0d Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 3 Jul 2023 16:28:08 +0900 Subject: [PATCH 241/468] =?UTF-8?q?[CHORE]=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xcshareddata/swiftpm/Package.resolved | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a5052b187..a3ff76c5d 100644 --- a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/kaishin/Gifu.git", "state" : { - "revision" : "51f2eab32903e336f590c013267cfa4d7f8b06c4", - "version" : "3.3.1" + "revision" : "82da0086dea14ca9afc9801234ad8dc4cd9e2738", + "version" : "3.4.1" } }, { @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleDataTransport.git", "state" : { - "revision" : "5056b15c5acbb90cd214fe4d6138bdf5a740e5a8", - "version" : "9.2.0" + "revision" : "f6b558e3f801f2cac336b04f615ce111fa9ddaa0", + "version" : "9.2.1" } }, { @@ -68,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleUtilities.git", "state" : { - "revision" : "68ea347bdb1a69e2d2ae2e25cd085b6ef92f64cb", - "version" : "7.9.0" + "revision" : "0543562f85620b5b7c510c6bcbef75b562a5127b", + "version" : "7.11.0" } }, { @@ -86,8 +86,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/gtm-session-fetcher.git", "state" : { - "revision" : "d4289da23e978f37c344ea6a386e5546e2466294", - "version" : "2.1.0" + "revision" : "5ccda3981422a84186387dbb763ba739178b529c", + "version" : "2.3.0" } }, { @@ -113,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/promises.git", "state" : { - "revision" : "3e4e743631e86c8c70dbc6efdc7beaa6e90fd3bb", - "version" : "2.1.1" + "revision" : "ec957ccddbcc710ccc64c9dcbd4c7006fcf8b73a", + "version" : "2.2.0" } }, { @@ -140,8 +140,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "88c7d15e1242fdb6ecbafbc7926426a19be1e98a", - "version" : "1.20.2" + "revision" : "0af9125c4eae12a4973fb66574c53a54962a9e1e", + "version" : "1.21.0" } } ], From 21f5bf0d191f759526c443d657a6a54c013acc16 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 3 Jul 2023 17:03:41 +0900 Subject: [PATCH 242/468] =?UTF-8?q?[FEAT]=20=EC=84=9C=EB=B9=84=EC=8A=A4?= =?UTF-8?q?=ED=83=88=ED=87=B4=20ui=20=EA=B5=AC=ED=98=84=20(#460)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Global/Literal/TextLiteral.swift | 1 + .../Setting/SettingViewController.swift | 4 +++ .../Screens/Setting/View/SettingView.swift | 26 +++++++++++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Global/Literal/TextLiteral.swift b/Manito/Manito/Global/Literal/TextLiteral.swift index 09e73548e..71450fd09 100644 --- a/Manito/Manito/Global/Literal/TextLiteral.swift +++ b/Manito/Manito/Global/Literal/TextLiteral.swift @@ -47,6 +47,7 @@ enum TextLiteral { static let settingViewControllerDeveloperInfoTitle: String = "개발자 정보" static let settingViewControllerHelpTitle: String = "문의하기" static let settingViewControllerLogoutTitle: String = "로그아웃" + static let settingViewControllerWithdrawalTitle: String = "서비스 탈퇴" // MARK: - CreateNickNameViewController static let createNickNameViewControllerTitle: String = "닉네임 설정" diff --git a/Manito/Manito/Screens/Setting/SettingViewController.swift b/Manito/Manito/Screens/Setting/SettingViewController.swift index 55059478c..4607b3501 100644 --- a/Manito/Manito/Screens/Setting/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/SettingViewController.swift @@ -84,4 +84,8 @@ extension SettingViewController: SettingViewDelegate { sceneDelegate.logout() }) } + + func withdrawalButtonDidTap() { + //FIXME: api 연결 예정 + } } diff --git a/Manito/Manito/Screens/Setting/View/SettingView.swift b/Manito/Manito/Screens/Setting/View/SettingView.swift index 72e5748db..e4d2c576b 100644 --- a/Manito/Manito/Screens/Setting/View/SettingView.swift +++ b/Manito/Manito/Screens/Setting/View/SettingView.swift @@ -16,6 +16,7 @@ protocol SettingViewDelegate: AnyObject { func developerInfoButtonDidTap() func helpButtonDidTap() func logoutButtonDidTap() + func withdrawalButtonDidTap() } final class SettingView: UIView { @@ -37,6 +38,12 @@ final class SettingView: UIView { tableView.dataSource = self return tableView }() + private let withdrawalButton: UIButton = { + let button = UIButton() + button.setTitle(TextLiteral.settingViewControllerWithdrawalTitle, for: .normal) + button.titleLabel?.font = .font(.regular, ofSize: 15) + return button + }() private let imageRow: ImageRowView = ImageRowView() @@ -50,6 +57,7 @@ final class SettingView: UIView { override init(frame: CGRect) { super.init(frame: frame) self.setupLayout() + self.setupButtonAction() self.configureModels() } @@ -73,11 +81,25 @@ final class SettingView: UIView { $0.top.equalTo(self.imageRow.snp.bottom) $0.centerX.equalToSuperview() $0.width.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalToSuperview() + $0.bottom.equalToSuperview().inset(50) + } + + self.addSubview(self.withdrawalButton) + self.withdrawalButton.snp.makeConstraints { + $0.top.equalTo(self.tableView.snp.bottom) + $0.centerX.equalToSuperview() } } - func configureModels() { + private func setupButtonAction() { + let withdrawalButtonDidTap = UIAction { [weak self] _ in + self?.delegate?.withdrawalButtonDidTap() + } + + self.withdrawalButton.addAction(withdrawalButtonDidTap, for: .touchUpInside) + } + + private func configureModels() { self.options.append(Option(title: TextLiteral.settingViewControllerChangeNickNameTitle, handler: { [weak self] in self?.delegate?.changNicknameButtonDidTap() })) From cf1941b22ee74cb257aadcd2fa649a5a3c88fef5 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 3 Jul 2023 17:18:41 +0900 Subject: [PATCH 243/468] =?UTF-8?q?[ADD]=20DetailWaitService=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 12 +++ .../DetailWaitViewController.swift | 2 +- .../Services/DetailWaitService.swift | 76 +++++++++++++++++++ .../ViewModel/DetailWaitViewModel.swift | 75 +++++++++--------- 4 files changed, 125 insertions(+), 40 deletions(-) create mode 100644 Manito/Manito/Screens/Detail-Wait/Services/DetailWaitService.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 1b1c0f952..dfd987b46 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -31,6 +31,7 @@ 39A938932A4852CA00EC2CF2 /* MissionDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938922A4852CA00EC2CF2 /* MissionDTO.swift */; }; 39A938952A48562500EC2CF2 /* MisstionEditProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938942A48562500EC2CF2 /* MisstionEditProtocol.swift */; }; 39A938972A48565500EC2CF2 /* MissionEditAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938962A48565500EC2CF2 /* MissionEditAPI.swift */; }; + 39BDDCC42A52BB4A005E0A71 /* DetailWaitService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39BDDCC32A52BB4A005E0A71 /* DetailWaitService.swift */; }; 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */; }; 39C957D02879521400A04A2B /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CF2879521400A04A2B /* String+Extension.swift */; }; 39C957D22879523200A04A2B /* Date+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957D12879523200A04A2B /* Date+Extension.swift */; }; @@ -220,6 +221,7 @@ 39A938922A4852CA00EC2CF2 /* MissionDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionDTO.swift; sourceTree = ""; }; 39A938942A48562500EC2CF2 /* MisstionEditProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MisstionEditProtocol.swift; sourceTree = ""; }; 39A938962A48565500EC2CF2 /* MissionEditAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionEditAPI.swift; sourceTree = ""; }; + 39BDDCC32A52BB4A005E0A71 /* DetailWaitService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitService.swift; sourceTree = ""; }; 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; 39C957CF2879521400A04A2B /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = ""; }; 39C957D12879523200A04A2B /* Date+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Extension.swift"; sourceTree = ""; }; @@ -485,6 +487,14 @@ name = Frameworks; sourceTree = ""; }; + 39BDDCC22A52BB34005E0A71 /* Services */ = { + isa = PBXGroup; + children = ( + 39BDDCC32A52BB4A005E0A71 /* DetailWaitService.swift */, + ); + path = Services; + sourceTree = ""; + }; 39C957CC2876E2BE00A04A2B /* Login */ = { isa = PBXGroup; children = ( @@ -756,6 +766,7 @@ B5F524E828519B2F00614FF7 /* Detail-Wait */ = { isa = PBXGroup; children = ( + 39BDDCC22A52BB34005E0A71 /* Services */, 395B5BC02A25E1F400CE1420 /* ViewModel */, 391612D629E92308004AE982 /* View */, 392EC77F2855D107006918A9 /* UIComponent */, @@ -1311,6 +1322,7 @@ D724AF5F28708D830003F280 /* ImageRowView.swift in Sources */, 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */, B5F5251E2851A1C700614FF7 /* BaseTableViewCell.swift in Sources */, + 39BDDCC42A52BB4A005E0A71 /* DetailWaitService.swift in Sources */, 39C957F6287D9ED000A04A2B /* NetworkRequest.swift in Sources */, 39EEF65C28CB3CD600437654 /* LoginAPI.swift in Sources */, D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */, diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index e27f8d673..4a0c3a802 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -31,7 +31,7 @@ final class DetailWaitViewController: BaseViewController { // MARK: - init init(roomIndex: Int) { - self.detailWaitViewModel = DetailWaitViewModel(roomIndex: roomIndex, detailWaitService: DetailWaitAPI(apiService: APIService())) + self.detailWaitViewModel = DetailWaitViewModel(roomIndex: roomIndex, detailWaitService: DetailWaitService(api: DetailWaitAPI(apiService: APIService()))) super.init() } diff --git a/Manito/Manito/Screens/Detail-Wait/Services/DetailWaitService.swift b/Manito/Manito/Screens/Detail-Wait/Services/DetailWaitService.swift new file mode 100644 index 000000000..a6e38fd2e --- /dev/null +++ b/Manito/Manito/Screens/Detail-Wait/Services/DetailWaitService.swift @@ -0,0 +1,76 @@ +// +// DetailWaitService.swift +// Manito +// +// Created by Mingwan Choi on 2023/07/03. +// + +import Foundation + +protocol DetailWaitServicable { + func fetchWaitingRoomInfo(roomId: String) async throws -> Room + func patchStartManitto(roomId: String) async throws -> Manittee + func deleteRoom(roomId: String) async throws -> Int + func deleteLeaveRoom(roomId: String) async throws -> Int +} + +final class DetailWaitService: DetailWaitServicable { + + private let api: DetailWaitProtocol + + init(api: DetailWaitProtocol) { + self.api = api + } + + func fetchWaitingRoomInfo(roomId: String) async throws -> Room { + do { + let roomData = try await self.api.getWaitingRoomInfo(roomId: roomId) + if let roomData { + return roomData + } else { + throw NetworkError.serverError + } + } catch NetworkError.serverError { + throw NetworkError.serverError + } catch NetworkError.clientError(let message) { + throw NetworkError.clientError(message: message) + } + } + + func patchStartManitto(roomId: String) async throws -> Manittee { + do { + let manitteeData = try await self.api.startManitto(roomId: roomId) + if let manitteeData { + return manitteeData + } else { + throw NetworkError.serverError + } + } catch NetworkError.serverError { + throw NetworkError.serverError + } catch NetworkError.clientError(let message) { + throw NetworkError.clientError(message: message) + } + } + + func deleteRoom(roomId: String) async throws -> Int { + do { + let statusCode = try await self.api.deleteRoom(roomId: roomId) + return statusCode + } catch NetworkError.serverError { + throw NetworkError.serverError + } catch NetworkError.clientError(let message) { + throw NetworkError.clientError(message: message) + } + } + + func deleteLeaveRoom(roomId: String) async throws -> Int { + do { + let statusCode = try await self.api.deleteLeaveRoom(roomId: roomId) + return statusCode + } catch NetworkError.serverError { + throw NetworkError.serverError + } catch NetworkError.clientError(let message) { + throw NetworkError.clientError(message: message) + } + } +} diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 2407a6900..310632264 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -16,7 +16,7 @@ final class DetailWaitViewModel { // MARK: - property let roomIndex: Int - private let detailWaitService: DetailWaitAPI + private let detailWaitService: DetailWaitServicable private var cancellable = Set() private let roomInformationSubject = CurrentValueSubject(Room.emptyRoom) @@ -48,7 +48,8 @@ final class DetailWaitViewModel { func transform(_ input: Input) -> Output { input.viewDidLoad .sink(receiveValue: { [weak self] _ in - self?.requestWaitRoomInfo() + guard let roomId = self?.roomIndex.description else { return } + self?.requestWaitRoomInfo(roomId: roomId) }) .store(in: &self.cancellable) @@ -61,7 +62,8 @@ final class DetailWaitViewModel { input.startButtonDidTap .sink(receiveValue: { [weak self] _ in - self?.requestStartManitto() + guard let roomId = self?.roomIndex.description else { return } + self?.requestStartManitto(roomId: roomId) }) .store(in: &self.cancellable) @@ -74,13 +76,15 @@ final class DetailWaitViewModel { input.deleteMenuButtonDidTap .sink(receiveValue: { [weak self] _ in - self?.requestDeleteRoom() + guard let roomId = self?.roomIndex.description else { return } + self?.requestDeleteRoom(roomId: roomId) }) .store(in: &self.cancellable) input.leaveMenuButtonDidTap .sink(receiveValue: { [weak self] _ in - self?.requestDeleteLeaveRoom() + guard let roomId = self?.roomIndex.description else { return } + self?.requestDeleteLeaveRoom(roomId: roomId) }) .store(in: &self.cancellable) @@ -94,7 +98,8 @@ final class DetailWaitViewModel { input.changeButtonDidTap .sink(receiveValue: { [weak self] _ in - self?.requestWaitRoomInfo() + guard let roomId = self?.roomIndex.description else { return } + self?.requestWaitRoomInfo(roomId: roomId) }) .store(in: &self.cancellable) @@ -111,7 +116,7 @@ final class DetailWaitViewModel { // MARK: - init - init(roomIndex: Int, detailWaitService: DetailWaitAPI) { + init(roomIndex: Int, detailWaitService: DetailWaitServicable) { self.roomIndex = roomIndex self.detailWaitService = detailWaitService } @@ -148,69 +153,61 @@ final class DetailWaitViewModel { // MARK: - network - private func requestWaitRoomInfo() { + private func requestWaitRoomInfo(roomId: String) { Task { do { - let data = try await self.detailWaitService.getWaitingRoomInfo(roomId: self.roomIndex.description) - if let roomInformation = data { - self.roomInformationSubject.send(roomInformation) - } - } catch NetworkError.serverError { - self.roomInformationSubject.send(completion: .failure(.serverError)) - } catch NetworkError.clientError(let message) { - self.roomInformationSubject.send(completion: .failure(.clientError(message: message))) + let room = try await self.detailWaitService.fetchWaitingRoomInfo(roomId: roomId) + self.roomInformationSubject.send(room) + } catch(let error) { + guard let error = error as? NetworkError else { return } + self.roomInformationSubject.send(completion: .failure(error)) } } } - private func requestStartManitto() { + private func requestStartManitto(roomId: String) { Task { do { - let data = try await self.detailWaitService.startManitto(roomId: self.roomIndex.description) - if let manittee = data { - guard let nickname = manittee.nickname else { return } - self.manitteeNicknameSubject.send(nickname) - } - } catch NetworkError.serverError { - self.manitteeNicknameSubject.send(completion: .failure(.serverError)) - } catch NetworkError.clientError(let message) { - self.manitteeNicknameSubject.send(completion: .failure(.clientError(message: message))) + let manittee = try await self.detailWaitService.patchStartManitto(roomId: roomId) + guard let nickname = manittee.nickname else { return } + self.manitteeNicknameSubject.send(nickname) + } catch(let error) { + guard let error = error as? NetworkError else { return } + self.manitteeNicknameSubject.send(completion: .failure(error)) } } } - func requestDeleteRoom() { + func requestDeleteRoom(roomId: String) { Task { do { - let statusCode = try await self.detailWaitService.deleteRoom(roomId: self.roomIndex.description) + let statusCode = try await self.detailWaitService.deleteRoom(roomId: roomId) switch statusCode { case 200..<300: self.deleteRoomSubject.send(()) - default: + default : self.deleteRoomSubject.send(completion: .failure(.unknownError)) } - } catch NetworkError.serverError { - self.deleteRoomSubject.send(completion: .failure(.serverError)) - } catch NetworkError.clientError(let message) { - self.deleteRoomSubject.send(completion: .failure(.clientError(message: message))) + } catch(let error) { + guard let error = error as? NetworkError else { return } + self.deleteRoomSubject.send(completion: .failure(error)) } } } - func requestDeleteLeaveRoom() { + func requestDeleteLeaveRoom(roomId: String) { Task { do { - let statusCode = try await self.detailWaitService.deleteLeaveRoom(roomId: self.roomIndex.description) + let statusCode = try await self.detailWaitService.deleteLeaveRoom(roomId: roomId) switch statusCode { case 200..<300: self.leaveRoomSubject.send(()) default: self.leaveRoomSubject.send(completion: .failure(.unknownError)) } - } catch NetworkError.serverError { - self.leaveRoomSubject.send(completion: .failure(.serverError)) - } catch NetworkError.clientError(let message) { - self.leaveRoomSubject.send(completion: .failure(.clientError(message: message))) + } catch(let error) { + guard let error = error as? NetworkError else { return } + self.leaveRoomSubject.send(completion: .failure(error)) } } } From ac2d1823106e041fb4c59643827b908f127ae8c6 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 3 Jul 2023 17:20:59 +0900 Subject: [PATCH 244/468] =?UTF-8?q?[CHORE]=20=EB=82=A0=EC=A7=9C=20?= =?UTF-8?q?=EC=A7=80=EB=82=AC=EC=9D=84=20=EB=95=8C=20=ED=91=9C=EC=8B=9C?= =?UTF-8?q?=EB=90=98=EB=8A=94=20Alert=20=ED=98=B8=EC=B6=9C=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=82=AD=EC=A0=9C=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/View/DetailWaitView.swift | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 719280fa0..afc112edd 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -160,7 +160,6 @@ final class DetailWaitView: UIView { private func setupRelatedViews(of userStatus: Bool, _ isStart: Bool) { self.showStartButtonForAdmin(userStatus) self.setExitButtonMenu(userStatus) - self.showAlertWhenPastDate(userStatus, isStart: isStart) self.setupTitleViewGesture(userStatus) } @@ -209,12 +208,6 @@ final class DetailWaitView: UIView { self.moreButton.menu = menu } - private func showAlertWhenPastDate(_ isAdmin: Bool, isStart: Bool) { - if !isStart { -// self.delegate?.didPassStartDate(isAdmin: isAdmin) - } - } - private func setupTitleViewGesture(_ isAdmin: Bool) { if isAdmin { let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.presentEditViewController)) From e5a713e959845198b4b12a09632d8ce455a85cf4 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 3 Jul 2023 17:53:59 +0900 Subject: [PATCH 245/468] =?UTF-8?q?[CHORE]=20EditMode=20=EB=B6=84=EB=A6=AC?= =?UTF-8?q?=20=EC=97=86=EC=95=A0=EA=B8=B0=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index d61b10378..5aaafbe76 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -16,9 +16,9 @@ protocol DetailEditDelegate: AnyObject { final class DetailEditView: UIView { - enum EditMode: Int { - case date = 0 - case information = 1 + enum EditMode { + case date + case information } // MARK: - ui component From 341e62c41c49ff3a814f73bae114266583a0b445 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 4 Jul 2023 20:54:03 +0900 Subject: [PATCH 246/468] =?UTF-8?q?[CHORE]=20ViewModel=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=9E=91=EC=84=B1=20?= =?UTF-8?q?(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManitoTests/DetailWaitViewModelTest.swift | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index 1c24ab065..a838931d8 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -5,13 +5,22 @@ // Created by Mingwan Choi on 2023/06/06. // +import Combine import XCTest @testable import Manito final class DetailWaitViewModelTest: XCTestCase { - private let viewModel = DetailWaitViewModel(roomIndex: 1, detailWaitService: DetailWaitAPI(apiService: APIService())) + private let viewModel = DetailWaitViewModel(roomIndex: 1, detailWaitService: DetailWaitService(api: DetailWaitAPI(apiService: APIService()))) + let testMockRoom = Room.testRoom + private var cancellable = Set() + + override func setUp() { + super.setUp() + self.viewModel.setRoomInformation(room: Room.testRoom) + self.cancellable = Set() + } func testMakeRoomInformation() { // given @@ -25,4 +34,37 @@ final class DetailWaitViewModelTest: XCTestCase { // FIXME: - Room 구조체 Equatable 프로토콜 채택 해야함. XCTAssertEqual(testRoom.roomInformation?.title, room.roomInformation?.title) } + + func testInputOutput() { + // given + let testViewDidLoadSubject = PassthroughSubject() + let testCodeCopyButtonDidTapSubject = PassthroughSubject() + let testStartButtonDidTapSubject = PassthroughSubject() + let testEditMenuButtonDidTapSubject = PassthroughSubject() + let testDeleteMenuButtonDidTapSubject = PassthroughSubject() + let testLeaveMenuButtonDidTapSubject = PassthroughSubject() + let testChangeButtonDidTapSubject = PassthroughSubject() + + let input = DetailWaitViewModel.Input( + viewDidLoad: testViewDidLoadSubject.eraseToAnyPublisher(), + codeCopyButtonDidTap: testCodeCopyButtonDidTapSubject.eraseToAnyPublisher(), + startButtonDidTap: testStartButtonDidTapSubject.eraseToAnyPublisher(), + editMenuButtonDidTap: testEditMenuButtonDidTapSubject.eraseToAnyPublisher(), + deleteMenuButtonDidTap: testDeleteMenuButtonDidTapSubject.eraseToAnyPublisher(), + leaveMenuButtonDidTap: testLeaveMenuButtonDidTapSubject.eraseToAnyPublisher(), + changeButtonDidTap: testChangeButtonDidTapSubject.eraseToAnyPublisher()) + + var outputCode: String = "" + // when + self.viewModel.setRoomInformation(room: testMockRoom) + let output = self.viewModel.transform(input) + testCodeCopyButtonDidTapSubject.send(()) + output.code + .sink { code in + outputCode = code + } + .store(in: &self.cancellable) + // then + XCTAssertEqual(outputCode, "ABCDEF") + } } From e75971040e1b64685606524952ffda49d76bb32a Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 4 Jul 2023 21:16:26 +0900 Subject: [PATCH 247/468] =?UTF-8?q?[CHORE]=20=EB=B2=84=ED=8A=BC=EC=97=90?= =?UTF-8?q?=20=EB=B0=91=EC=A4=84=20=EA=B5=AC=ED=98=84=20(#460)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Extension/UIButton+Extension.swift | 9 +++++++++ Manito/Manito/Screens/Setting/View/SettingView.swift | 1 + 2 files changed, 10 insertions(+) diff --git a/Manito/Manito/Global/Extension/UIButton+Extension.swift b/Manito/Manito/Global/Extension/UIButton+Extension.swift index 1d663e989..024654e46 100644 --- a/Manito/Manito/Global/Extension/UIButton+Extension.swift +++ b/Manito/Manito/Global/Extension/UIButton+Extension.swift @@ -19,4 +19,13 @@ extension UIButton { self.setBackgroundImage(backgroundImage, for: state) } + + func setUnderLine() { + guard let title = title(for: .normal) else { return } + let attributedString = NSMutableAttributedString(string: title) + attributedString.addAttribute(.underlineStyle, + value: NSUnderlineStyle.single.rawValue, + range: NSRange(location: 0, length: title.count)) + setAttributedTitle(attributedString, for: .normal) + } } diff --git a/Manito/Manito/Screens/Setting/View/SettingView.swift b/Manito/Manito/Screens/Setting/View/SettingView.swift index e4d2c576b..e0a0f0480 100644 --- a/Manito/Manito/Screens/Setting/View/SettingView.swift +++ b/Manito/Manito/Screens/Setting/View/SettingView.swift @@ -42,6 +42,7 @@ final class SettingView: UIView { let button = UIButton() button.setTitle(TextLiteral.settingViewControllerWithdrawalTitle, for: .normal) button.titleLabel?.font = .font(.regular, ofSize: 15) + button.setUnderLine() return button }() From 6bf272961a29501ae4c797ece13c4e3dd32c35c9 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 4 Jul 2023 21:49:56 +0900 Subject: [PATCH 248/468] =?UTF-8?q?[CHORE]=20=EB=B2=84=ED=8A=BC=20publishe?= =?UTF-8?q?r=20=EB=B3=80=EC=88=98=20=EC=B6=94=EA=B0=80=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/DetailWaitViewController.swift | 4 ++-- .../Manito/Screens/Detail-Wait/View/DetailWaitView.swift | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 4a0c3a802..cad1c2c03 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -77,8 +77,8 @@ final class DetailWaitViewController: BaseViewController { private func transformedOutput() -> DetailWaitViewModel.Output { let input = DetailWaitViewModel.Input( viewDidLoad: self.viewDidLoadPublisher, - codeCopyButtonDidTap: self.detailWaitView.copyButton.tapPublisher, - startButtonDidTap: self.detailWaitView.startButton.tapPublisher, + codeCopyButtonDidTap: self.detailWaitView.copyButtonPublisher, + startButtonDidTap: self.detailWaitView.startButtonPublisher, editMenuButtonDidTap: self.detailWaitView.editMenuButtonSubject.eraseToAnyPublisher(), deleteMenuButtonDidTap: self.deleteMenuButtonSubject.eraseToAnyPublisher(), leaveMenuButtonDidTap: self.leaveMenuButtonSubject.eraseToAnyPublisher(), diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index afc112edd..7c5ce9f3d 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -30,6 +30,8 @@ final class DetailWaitView: UIView { } } + var copyButtonPublisher: AnyPublisher + var startButtonPublisher: AnyPublisher let editMenuButtonSubject = PassthroughSubject() let deleteMenuButtonSubject = PassthroughSubject() let leaveMenuButtonSubject = PassthroughSubject() @@ -60,7 +62,7 @@ final class DetailWaitView: UIView { label.font = .font(.regular, ofSize: 14) return label }() - let copyButton: UIButton = { + private let copyButton: UIButton = { let button = UIButton(type: .system) button.setTitle(TextLiteral.copyCode, for: .normal) button.setTitleColor(.subBlue, for: .normal) @@ -76,7 +78,7 @@ final class DetailWaitView: UIView { tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") return tableView }() - let startButton: MainButton = MainButton() + private let startButton: MainButton = MainButton() // MARK: - property @@ -92,6 +94,8 @@ final class DetailWaitView: UIView { // MARK: - init override init(frame: CGRect) { + self.copyButtonPublisher = self.copyButton.tapPublisher + self.startButtonPublisher = self.startButton.tapPublisher super.init(frame: frame) self.setupLayout() } From 54a0bb3a52d7676d62efea06ba776a06fa82f975 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 4 Jul 2023 21:50:40 +0900 Subject: [PATCH 249/468] =?UTF-8?q?[CHORE]=20private=20=EC=A0=91=EA=B7=BC?= =?UTF-8?q?=20=EC=A0=9C=EC=96=B4=20=EC=B6=94=EA=B0=80=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 310632264..da8002619 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -178,7 +178,7 @@ final class DetailWaitViewModel { } } - func requestDeleteRoom(roomId: String) { + private func requestDeleteRoom(roomId: String) { Task { do { let statusCode = try await self.detailWaitService.deleteRoom(roomId: roomId) @@ -195,7 +195,7 @@ final class DetailWaitViewModel { } } - func requestDeleteLeaveRoom(roomId: String) { + private func requestDeleteLeaveRoom(roomId: String) { Task { do { let statusCode = try await self.detailWaitService.deleteLeaveRoom(roomId: roomId) From b2b042ba58bebbc265aa7bb04c7760194724f39b Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 4 Jul 2023 22:59:31 +0900 Subject: [PATCH 250/468] =?UTF-8?q?[CHORE]=20VC=EC=97=90=EC=84=9C=20VM=20?= =?UTF-8?q?=EC=9D=B8=EC=9E=90=EB=A1=9C=20=EC=B4=88=EA=B8=B0=ED=99=94=20(#1?= =?UTF-8?q?85)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChooseCharacter/ChooseCharacterViewController.swift | 3 ++- .../Screens/Detail-Wait/DetailWaitViewController.swift | 4 ++-- Manito/Manito/Screens/Main/MainViewController.swift | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index 4b74c6b19..668f72d75 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -95,7 +95,8 @@ final class ChooseCharacterViewController: BaseViewController { private func pushDetailWaitViewController(status: Status, roomId: Int) { guard let navigationController = self.presentingViewController as? UINavigationController else { return } - let viewController = DetailWaitViewController(roomIndex: roomId) + let viewController = DetailWaitViewController(viewModel: DetailWaitViewModel(roomIndex: roomId, + detailWaitService: DetailWaitService(api: DetailWaitAPI(apiService: APIService())))) switch status { case .createRoom: diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index cad1c2c03..6d9b03228 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -30,8 +30,8 @@ final class DetailWaitViewController: BaseViewController { // MARK: - init - init(roomIndex: Int) { - self.detailWaitViewModel = DetailWaitViewModel(roomIndex: roomIndex, detailWaitService: DetailWaitService(api: DetailWaitAPI(apiService: APIService()))) + init(viewModel: DetailWaitViewModel) { + self.detailWaitViewModel = viewModel super.init() } diff --git a/Manito/Manito/Screens/Main/MainViewController.swift b/Manito/Manito/Screens/Main/MainViewController.swift index cab529fd8..b4e260497 100644 --- a/Manito/Manito/Screens/Main/MainViewController.swift +++ b/Manito/Manito/Screens/Main/MainViewController.swift @@ -278,11 +278,14 @@ final class MainViewController: BaseViewController { } } + // FIXME: - roomIndex가 현재 item으로 설정되어 있고, index가 roomIndex로 설정되어있음. KTBQ2B private func pushDetailView(status: RoomStatus, roomIndex: Int, index: Int? = nil) { switch status { case .waiting: guard let index = index else { return } - let viewController = DetailWaitViewController(roomIndex: index) + let viewController = DetailWaitViewController(viewModel: DetailWaitViewModel(roomIndex: index, + detailWaitService: DetailWaitService(api: DetailWaitAPI(apiService: APIService())))) + self.navigationController?.pushViewController(viewController, animated: true) default: guard let roomId = rooms?[roomIndex].id?.description From 9bb5aa3146857e518f690b72255bfef671c4e979 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 4 Jul 2023 23:02:52 +0900 Subject: [PATCH 251/468] =?UTF-8?q?[CHORE]=20button=20publisher=EB=93=A4?= =?UTF-8?q?=20computed=20property=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 7c5ce9f3d..470094c00 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -30,8 +30,8 @@ final class DetailWaitView: UIView { } } - var copyButtonPublisher: AnyPublisher - var startButtonPublisher: AnyPublisher + lazy var copyButtonPublisher: AnyPublisher = self.copyButton.tapPublisher + lazy var startButtonPublisher: AnyPublisher = self.startButton.tapPublisher let editMenuButtonSubject = PassthroughSubject() let deleteMenuButtonSubject = PassthroughSubject() let leaveMenuButtonSubject = PassthroughSubject() @@ -94,8 +94,6 @@ final class DetailWaitView: UIView { // MARK: - init override init(frame: CGRect) { - self.copyButtonPublisher = self.copyButton.tapPublisher - self.startButtonPublisher = self.startButton.tapPublisher super.init(frame: frame) self.setupLayout() } From 09831394bbd99cb76eac614e108b3a51610bfe40 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 8 Jul 2023 19:15:47 +0900 Subject: [PATCH 252/468] =?UTF-8?q?[CHORE]=20=EC=B4=88=EB=8C=80=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20transfer=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManitoTests/DetailWaitViewModelTest.swift | 47 +++++++++---------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index a838931d8..40c025d96 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -13,13 +13,28 @@ import XCTest final class DetailWaitViewModelTest: XCTestCase { private let viewModel = DetailWaitViewModel(roomIndex: 1, detailWaitService: DetailWaitService(api: DetailWaitAPI(apiService: APIService()))) - let testMockRoom = Room.testRoom private var cancellable = Set() + private let testViewDidLoadSubject = PassthroughSubject() + private let testCodeCopyButtonDidTapSubject = PassthroughSubject() + private let testStartButtonDidTapSubject = PassthroughSubject() + private let testEditMenuButtonDidTapSubject = PassthroughSubject() + private let testDeleteMenuButtonDidTapSubject = PassthroughSubject() + private let testLeaveMenuButtonDidTapSubject = PassthroughSubject() + private let testChangeButtonDidTapSubject = PassthroughSubject() + private var output: DetailWaitViewModel.Output! override func setUp() { super.setUp() self.viewModel.setRoomInformation(room: Room.testRoom) - self.cancellable = Set() + let input = DetailWaitViewModel.Input( + viewDidLoad: testViewDidLoadSubject.eraseToAnyPublisher(), + codeCopyButtonDidTap: testCodeCopyButtonDidTapSubject.eraseToAnyPublisher(), + startButtonDidTap: testStartButtonDidTapSubject.eraseToAnyPublisher(), + editMenuButtonDidTap: testEditMenuButtonDidTapSubject.eraseToAnyPublisher(), + deleteMenuButtonDidTap: testDeleteMenuButtonDidTapSubject.eraseToAnyPublisher(), + leaveMenuButtonDidTap: testLeaveMenuButtonDidTapSubject.eraseToAnyPublisher(), + changeButtonDidTap: testChangeButtonDidTapSubject.eraseToAnyPublisher()) + self.output = self.viewModel.transform(input) } func testMakeRoomInformation() { @@ -35,36 +50,16 @@ final class DetailWaitViewModelTest: XCTestCase { XCTAssertEqual(testRoom.roomInformation?.title, room.roomInformation?.title) } - func testInputOutput() { + func testTransferInvitationCode() { // given - let testViewDidLoadSubject = PassthroughSubject() - let testCodeCopyButtonDidTapSubject = PassthroughSubject() - let testStartButtonDidTapSubject = PassthroughSubject() - let testEditMenuButtonDidTapSubject = PassthroughSubject() - let testDeleteMenuButtonDidTapSubject = PassthroughSubject() - let testLeaveMenuButtonDidTapSubject = PassthroughSubject() - let testChangeButtonDidTapSubject = PassthroughSubject() - - let input = DetailWaitViewModel.Input( - viewDidLoad: testViewDidLoadSubject.eraseToAnyPublisher(), - codeCopyButtonDidTap: testCodeCopyButtonDidTapSubject.eraseToAnyPublisher(), - startButtonDidTap: testStartButtonDidTapSubject.eraseToAnyPublisher(), - editMenuButtonDidTap: testEditMenuButtonDidTapSubject.eraseToAnyPublisher(), - deleteMenuButtonDidTap: testDeleteMenuButtonDidTapSubject.eraseToAnyPublisher(), - leaveMenuButtonDidTap: testLeaveMenuButtonDidTapSubject.eraseToAnyPublisher(), - changeButtonDidTap: testChangeButtonDidTapSubject.eraseToAnyPublisher()) - - var outputCode: String = "" + let checkCode = "ABCDEF" // when - self.viewModel.setRoomInformation(room: testMockRoom) - let output = self.viewModel.transform(input) - testCodeCopyButtonDidTapSubject.send(()) output.code .sink { code in - outputCode = code + XCTAssertEqual(code, checkCode) } .store(in: &self.cancellable) // then - XCTAssertEqual(outputCode, "ABCDEF") + testCodeCopyButtonDidTapSubject.send(()) } } From d360618bd215b7c0c22154b45889ce1805229cbb Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 10 Jul 2023 15:39:55 +0900 Subject: [PATCH 253/468] =?UTF-8?q?[CHORE]=20=EB=B0=A9=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EC=A1=B0=ED=9A=8C=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManitoTests/DetailWaitViewModelTest.swift | 94 ++++++++++++++++--- 1 file changed, 83 insertions(+), 11 deletions(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index 40c025d96..8cac6ce46 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -11,21 +11,28 @@ import XCTest final class DetailWaitViewModelTest: XCTestCase { - - private let viewModel = DetailWaitViewModel(roomIndex: 1, detailWaitService: DetailWaitService(api: DetailWaitAPI(apiService: APIService()))) - private var cancellable = Set() - private let testViewDidLoadSubject = PassthroughSubject() - private let testCodeCopyButtonDidTapSubject = PassthroughSubject() - private let testStartButtonDidTapSubject = PassthroughSubject() - private let testEditMenuButtonDidTapSubject = PassthroughSubject() - private let testDeleteMenuButtonDidTapSubject = PassthroughSubject() - private let testLeaveMenuButtonDidTapSubject = PassthroughSubject() - private let testChangeButtonDidTapSubject = PassthroughSubject() + private var viewModel: DetailWaitViewModel! + private var cancellable: Set! + private var testViewDidLoadSubject: PassthroughSubject! + private var testCodeCopyButtonDidTapSubject: PassthroughSubject! + private var testStartButtonDidTapSubject: PassthroughSubject! + private var testEditMenuButtonDidTapSubject: PassthroughSubject! + private var testDeleteMenuButtonDidTapSubject: PassthroughSubject! + private var testLeaveMenuButtonDidTapSubject: PassthroughSubject! + private var testChangeButtonDidTapSubject: PassthroughSubject! private var output: DetailWaitViewModel.Output! override func setUp() { super.setUp() - self.viewModel.setRoomInformation(room: Room.testRoom) + self.viewModel = DetailWaitViewModel(roomIndex: 1, detailWaitService: MockDetailWaitService()) + self.cancellable = Set() + self.testViewDidLoadSubject = PassthroughSubject() + self.testCodeCopyButtonDidTapSubject = PassthroughSubject() + self.testStartButtonDidTapSubject = PassthroughSubject() + self.testEditMenuButtonDidTapSubject = PassthroughSubject() + self.testDeleteMenuButtonDidTapSubject = PassthroughSubject() + self.testLeaveMenuButtonDidTapSubject = PassthroughSubject() + self.testChangeButtonDidTapSubject = PassthroughSubject() let input = DetailWaitViewModel.Input( viewDidLoad: testViewDidLoadSubject.eraseToAnyPublisher(), codeCopyButtonDidTap: testCodeCopyButtonDidTapSubject.eraseToAnyPublisher(), @@ -35,6 +42,19 @@ final class DetailWaitViewModelTest: XCTestCase { leaveMenuButtonDidTap: testLeaveMenuButtonDidTapSubject.eraseToAnyPublisher(), changeButtonDidTap: testChangeButtonDidTapSubject.eraseToAnyPublisher()) self.output = self.viewModel.transform(input) + self.viewModel.setRoomInformation(room: Room.testRoom) + } + + override func tearDown() { + self.viewModel = nil + self.cancellable = nil + self.testViewDidLoadSubject = nil + self.testCodeCopyButtonDidTapSubject = nil + self.testStartButtonDidTapSubject = nil + self.testEditMenuButtonDidTapSubject = nil + self.testDeleteMenuButtonDidTapSubject = nil + self.testLeaveMenuButtonDidTapSubject = nil + self.testChangeButtonDidTapSubject = nil } func testMakeRoomInformation() { @@ -62,4 +82,56 @@ final class DetailWaitViewModelTest: XCTestCase { // then testCodeCopyButtonDidTapSubject.send(()) } + + func testTransferRoomInformation() { + // given + let testTitle = "목타이틀" + let exception = XCTestExpectation(description: "async test") + var checkTitle = "" + // when + output.roomInformation + .sink(receiveCompletion: { result in + switch result { + case .failure: + break + case .finished: + break + } + }, receiveValue: { room in + guard let title = room.roomInformation?.title else { return } + checkTitle = title + exception.fulfill() + }) + .store(in: &self.cancellable) + // then + self.testViewDidLoadSubject.send(()) + wait(for: [exception], timeout: 2) + XCTAssertEqual(checkTitle, testTitle) + } +} + +final class MockDetailWaitService: DetailWaitServicable { + func fetchWaitingRoomInfo(roomId: String) async throws -> Manito.Room { + let room = Room(roomInformation: RoomInfo(id: 10, capacity: 10, title: "목타이틀", startDate: "", endDate: "", state: ""), + participants: Participants.testParticipants, + manittee: Manittee.testManittee, + manitto: Manitto.testManitto, + invitation: Invitation.testInvitation, + mission: Mission.testMission, + admin: true, + messages: Message1.testMessage) + return room + } + + func patchStartManitto(roomId: String) async throws -> Manito.Manittee { + return Manittee.testManittee + } + + func deleteRoom(roomId: String) async throws -> Int { + return 200 + } + + func deleteLeaveRoom(roomId: String) async throws -> Int { + return 200 + } } From 948bd17289b5c9aec2411bc9ee5838b09d4445c3 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 10 Jul 2023 16:10:20 +0900 Subject: [PATCH 254/468] =?UTF-8?q?[CHORE]=20startButton=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManitoTests/DetailWaitViewModelTest.swift | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index 8cac6ce46..47da57f2d 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -108,6 +108,31 @@ final class DetailWaitViewModelTest: XCTestCase { wait(for: [exception], timeout: 2) XCTAssertEqual(checkTitle, testTitle) } + + func testTranferStartButton() { + // given + let testManittee = "테스트마니띠" + let exception = XCTestExpectation(description: "startButton test") + var checkNickname = "" + // when + output.manitteeNickname + .sink(receiveCompletion: { result in + switch result { + case .finished: + break + case .failure: + XCTFail("fail") + } + }, receiveValue: { nickname in + checkNickname = nickname + exception.fulfill() + }) + .store(in: &self.cancellable) + // then + self.testStartButtonDidTapSubject.send(()) + wait(for: [exception], timeout: 2) + XCTAssertEqual(testManittee, checkNickname) + } } final class MockDetailWaitService: DetailWaitServicable { From b69e7774e01c316da63bf58d426d9d9a73749695 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 10 Jul 2023 16:25:35 +0900 Subject: [PATCH 255/468] =?UTF-8?q?[CHORE]=20Room=20=EA=B5=AC=EC=A1=B0?= =?UTF-8?q?=EC=B2=B4=20Equtable=20=ED=94=84=EB=A1=9C=ED=86=A0=EC=BD=9C=20?= =?UTF-8?q?=EC=B1=84=ED=83=9D=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Network/Models/Room.swift | 32 +++++++++++++++++-------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/Manito/Manito/Network/Models/Room.swift b/Manito/Manito/Network/Models/Room.swift index 90726be68..2010ece29 100644 --- a/Manito/Manito/Network/Models/Room.swift +++ b/Manito/Manito/Network/Models/Room.swift @@ -11,7 +11,7 @@ struct ParticipatingRooms: Decodable { let participatingRooms: [ParticipatingRoom]? } -struct ParticipatingRoom: Decodable { +struct ParticipatingRoom: Decodable, Equatable { let id: Int? let title: String? var state: String? @@ -19,7 +19,19 @@ struct ParticipatingRoom: Decodable { let startDate, endDate: String? } -struct Room: Decodable { +struct Room: Decodable, Equatable { + static func == (lhs: Room, rhs: Room) -> Bool { + return lhs.roomInformation == rhs.roomInformation && + lhs.participants == rhs.participants && + lhs.manittee == rhs.manittee && + lhs.manitto == rhs.manitto && + lhs.invitation == rhs.invitation && + lhs.didViewRoulette == rhs.didViewRoulette && + lhs.mission == rhs.mission && + lhs.admin == rhs.admin && + lhs.messages == rhs.messages + } + let roomInformation: RoomInfo? let participants: Participants? let manittee: Manittee? @@ -104,7 +116,7 @@ struct Friend: Decodable { } // MARK: - Participants -struct Participants: Decodable { +struct Participants: Decodable, Equatable { let count: Int? let members: [User]? @@ -124,7 +136,7 @@ extension Participants { } // MARK: - User -struct User: Decodable { +struct User: Decodable, Equatable { let id, nickname: String? } @@ -141,7 +153,7 @@ extension User { } // MARK: - Room -struct RoomInfo: Decodable { +struct RoomInfo: Decodable, Equatable { let id, capacity: Int? let title, startDate, endDate, state: String? @@ -197,7 +209,7 @@ extension RoomInfo { } // MARK: - Mission -struct Mission: Codable { +struct Mission: Codable, Equatable { let id: Int? let content: String? } @@ -207,7 +219,7 @@ extension Mission { } // MARK: - Invitation -struct Invitation: Decodable { +struct Invitation: Decodable, Equatable { let code: String? } @@ -216,7 +228,7 @@ extension Invitation { } // MARK: - Message1 -struct Message1: Decodable { +struct Message1: Decodable, Equatable { let count: Int? } @@ -225,7 +237,7 @@ extension Message1 { } // MARK: - Manittee -struct Manittee: Decodable { +struct Manittee: Decodable, Equatable { let nickname: String? } @@ -234,7 +246,7 @@ extension Manittee { } // MARK: - Manitto -struct Manitto: Decodable { +struct Manitto: Decodable, Equatable { let nickname: String? } From fc3f52032d753118c8a46ae66601579fdebdeb0c Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 10 Jul 2023 16:25:51 +0900 Subject: [PATCH 256/468] =?UTF-8?q?[CHORE]=20=EB=B0=A9=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EC=88=98=EC=A0=95=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=9E=91=EC=84=B1(185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManitoTests/DetailWaitViewModelTest.swift | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index 47da57f2d..6ae50599e 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -66,8 +66,7 @@ final class DetailWaitViewModelTest: XCTestCase { let room = self.viewModel.makeRoomInformation() // when - // FIXME: - Room 구조체 Equatable 프로토콜 채택 해야함. - XCTAssertEqual(testRoom.roomInformation?.title, room.roomInformation?.title) + XCTAssertEqual(testRoom, room) } func testTransferInvitationCode() { @@ -133,9 +132,37 @@ final class DetailWaitViewModelTest: XCTestCase { wait(for: [exception], timeout: 2) XCTAssertEqual(testManittee, checkNickname) } + + func testTransferEditRoom() { + // given + let exception = XCTestExpectation(description: "editButton test") + var checkRoom = Room.emptyRoom + var checkMode: DetailEditView.EditMode = .date + // when + output.editRoomInformation + .sink(receiveCompletion: { result in + switch result { + case .finished: + break + case .failure: + XCTFail("fail") + } + }, receiveValue: { (room, mode) in + checkRoom = room + checkMode = mode + exception.fulfill() + }) + .store(in: &self.cancellable) + // then + self.testEditMenuButtonDidTapSubject.send(()) + wait(for: [exception], timeout: 2) + XCTAssertEqual(checkMode, .information) + XCTAssertEqual(checkRoom, Room.testRoom) + } } final class MockDetailWaitService: DetailWaitServicable { + // FIXME: - network mocking 만들어야함. func fetchWaitingRoomInfo(roomId: String) async throws -> Manito.Room { let room = Room(roomInformation: RoomInfo(id: 10, capacity: 10, title: "목타이틀", startDate: "", endDate: "", state: ""), participants: Participants.testParticipants, From 9c402e1b4b0965023ca05e70e420f0bf11ee359f Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 10 Jul 2023 16:40:06 +0900 Subject: [PATCH 257/468] =?UTF-8?q?[CHORE]=20delete=20button=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=9E=91=EC=84=B1=20?= =?UTF-8?q?(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManitoTests/DetailWaitViewModelTest.swift | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index 6ae50599e..63efa83a7 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -24,7 +24,7 @@ final class DetailWaitViewModelTest: XCTestCase { override func setUp() { super.setUp() - self.viewModel = DetailWaitViewModel(roomIndex: 1, detailWaitService: MockDetailWaitService()) + self.viewModel = DetailWaitViewModel(roomIndex: 0, detailWaitService: MockDetailWaitService()) self.cancellable = Set() self.testViewDidLoadSubject = PassthroughSubject() self.testCodeCopyButtonDidTapSubject = PassthroughSubject() @@ -159,6 +159,30 @@ final class DetailWaitViewModelTest: XCTestCase { XCTAssertEqual(checkMode, .information) XCTAssertEqual(checkRoom, Room.testRoom) } + + func testTransferDeleteRoom() { + // given + let exception = XCTestExpectation(description: "deleteButton test") + var testBool = false + // when + output.deleteRoom + .sink(receiveCompletion: { result in + switch result { + case .finished: + break + case .failure: + XCTFail("fail") + } + }, receiveValue: { _ in + testBool = true + exception.fulfill() + }) + .store(in: &self.cancellable) + // then + self.testDeleteMenuButtonDidTapSubject.send(()) + wait(for: [exception], timeout: 2) + XCTAssertTrue(testBool) + } } final class MockDetailWaitService: DetailWaitServicable { From db148a7d8b7bd08cb38761ad9d1d7323a066656d Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 10 Jul 2023 16:45:37 +0900 Subject: [PATCH 258/468] =?UTF-8?q?[CHORE]=20leave=20button=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=9E=91=EC=84=B1=20?= =?UTF-8?q?(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManitoTests/DetailWaitViewModelTest.swift | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index 63efa83a7..49496b3fc 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -183,6 +183,30 @@ final class DetailWaitViewModelTest: XCTestCase { wait(for: [exception], timeout: 2) XCTAssertTrue(testBool) } + + func testTransferLeaveRoom() { + // given + let exception = XCTestExpectation(description: "leaveButton test") + var testBool = false + // when + output.leaveRoom + .sink(receiveCompletion: { result in + switch result { + case .finished: + break + case .failure: + XCTFail("fail") + } + }, receiveValue: { _ in + testBool = true + exception.fulfill() + }) + .store(in: &self.cancellable) + // then + self.testLeaveMenuButtonDidTapSubject.send(()) + wait(for: [exception], timeout: 2) + XCTAssertTrue(testBool) + } } final class MockDetailWaitService: DetailWaitServicable { From dab6ea89ac66aced50bc0da97d1a111e32db1024 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 10 Jul 2023 16:53:02 +0900 Subject: [PATCH 259/468] =?UTF-8?q?[CHORE]=20=EB=B3=80=EC=88=98=EB=AA=85?= =?UTF-8?q?=20=ED=86=B5=EC=9D=BC=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManitoTests/DetailWaitViewModelTest.swift | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index 49496b3fc..9647ff951 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -59,14 +59,14 @@ final class DetailWaitViewModelTest: XCTestCase { func testMakeRoomInformation() { // given - let testRoom = Room.testRoom - self.viewModel.setRoomInformation(room: testRoom) + let checkRoom = Room.testRoom + self.viewModel.setRoomInformation(room: checkRoom) // then - let room = self.viewModel.makeRoomInformation() + let testRoom = self.viewModel.makeRoomInformation() // when - XCTAssertEqual(testRoom, room) + XCTAssertEqual(checkRoom, testRoom) } func testTransferInvitationCode() { @@ -84,9 +84,16 @@ final class DetailWaitViewModelTest: XCTestCase { func testTransferRoomInformation() { // given - let testTitle = "목타이틀" + let checkRoom = Room(roomInformation: RoomInfo(id: 10, capacity: 10, title: "목타이틀", startDate: "", endDate: "", state: ""), + participants: Participants.testParticipants, + manittee: Manittee.testManittee, + manitto: Manitto.testManitto, + invitation: Invitation.testInvitation, + mission: Mission.testMission, + admin: true, + messages: Message1.testMessage) let exception = XCTestExpectation(description: "async test") - var checkTitle = "" + var testRoom = Room.emptyRoom // when output.roomInformation .sink(receiveCompletion: { result in @@ -97,22 +104,21 @@ final class DetailWaitViewModelTest: XCTestCase { break } }, receiveValue: { room in - guard let title = room.roomInformation?.title else { return } - checkTitle = title + testRoom = room exception.fulfill() }) .store(in: &self.cancellable) // then self.testViewDidLoadSubject.send(()) wait(for: [exception], timeout: 2) - XCTAssertEqual(checkTitle, testTitle) + XCTAssertEqual(checkRoom, testRoom) } func testTranferStartButton() { // given - let testManittee = "테스트마니띠" + let checkNickname = "테스트마니띠" let exception = XCTestExpectation(description: "startButton test") - var checkNickname = "" + var testNickname = "" // when output.manitteeNickname .sink(receiveCompletion: { result in @@ -123,21 +129,21 @@ final class DetailWaitViewModelTest: XCTestCase { XCTFail("fail") } }, receiveValue: { nickname in - checkNickname = nickname + testNickname = nickname exception.fulfill() }) .store(in: &self.cancellable) // then self.testStartButtonDidTapSubject.send(()) wait(for: [exception], timeout: 2) - XCTAssertEqual(testManittee, checkNickname) + XCTAssertEqual(testNickname, checkNickname) } func testTransferEditRoom() { // given + var testRoom = Room.emptyRoom + var testMode: DetailEditView.EditMode = .date let exception = XCTestExpectation(description: "editButton test") - var checkRoom = Room.emptyRoom - var checkMode: DetailEditView.EditMode = .date // when output.editRoomInformation .sink(receiveCompletion: { result in @@ -148,16 +154,16 @@ final class DetailWaitViewModelTest: XCTestCase { XCTFail("fail") } }, receiveValue: { (room, mode) in - checkRoom = room - checkMode = mode + testRoom = room + testMode = mode exception.fulfill() }) .store(in: &self.cancellable) // then self.testEditMenuButtonDidTapSubject.send(()) wait(for: [exception], timeout: 2) - XCTAssertEqual(checkMode, .information) - XCTAssertEqual(checkRoom, Room.testRoom) + XCTAssertEqual(testMode, .information) + XCTAssertEqual(testRoom, Room.testRoom) } func testTransferDeleteRoom() { From b21ef553e96c2130ec04e8243aeaacdfc2fe3302 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 10 Jul 2023 17:55:33 +0900 Subject: [PATCH 260/468] =?UTF-8?q?[CHORE]=20changeButton=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=9E=91=EC=84=B1=20?= =?UTF-8?q?(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManitoTests/DetailWaitViewModelTest.swift | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index 9647ff951..d876c8dc0 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -213,6 +213,28 @@ final class DetailWaitViewModelTest: XCTestCase { wait(for: [exception], timeout: 2) XCTAssertTrue(testBool) } + + func testTransferChnageButtonDidTap() { + // given + let checkRoom = Room(roomInformation: RoomInfo(id: 10, capacity: 10, title: "목타이틀", startDate: "", endDate: "", state: ""), + participants: Participants.testParticipants, + manittee: Manittee.testManittee, + manitto: Manitto.testManitto, + invitation: Invitation.testInvitation, + mission: Mission.testMission, + admin: true, + messages: Message1.testMessage) + let exception = XCTestExpectation(description: "leaveButton test") + var testRoom = Room.emptyRoom + // when + testChangeButtonDidTapSubject.send(()) + // then + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { + testRoom = self.viewModel.makeRoomInformation() + XCTAssertEqual(checkRoom, testRoom) + exception.fulfill() + } + } } final class MockDetailWaitService: DetailWaitServicable { From 011eef7b72fb65beacd6c1e646de3e2e8fd87f4b Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 10 Jul 2023 19:54:40 +0900 Subject: [PATCH 261/468] =?UTF-8?q?[CHORE]=20viewDidLoad=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EC=9E=91=EC=84=B1=20?= =?UTF-8?q?(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManitoTests/DetailWaitViewModelTest.swift | 43 ++++++++++++++----- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index d876c8dc0..8f7a9d3d7 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -200,7 +200,7 @@ final class DetailWaitViewModelTest: XCTestCase { switch result { case .finished: break - case .failure: + case .failure(let error): XCTFail("fail") } }, receiveValue: { _ in @@ -216,25 +216,46 @@ final class DetailWaitViewModelTest: XCTestCase { func testTransferChnageButtonDidTap() { // given - let checkRoom = Room(roomInformation: RoomInfo(id: 10, capacity: 10, title: "목타이틀", startDate: "", endDate: "", state: ""), - participants: Participants.testParticipants, - manittee: Manittee.testManittee, - manitto: Manitto.testManitto, - invitation: Invitation.testInvitation, - mission: Mission.testMission, - admin: true, - messages: Message1.testMessage) - let exception = XCTestExpectation(description: "leaveButton test") + let checkRoom = mockRoom + let exception = XCTestExpectation(description: "changeButton test") var testRoom = Room.emptyRoom // when testChangeButtonDidTapSubject.send(()) // then - DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { + DispatchQueue.global().asyncAfter(deadline: .now() + 0.1) { testRoom = self.viewModel.makeRoomInformation() XCTAssertEqual(checkRoom, testRoom) exception.fulfill() } } + + func testTransferViewDidLoad() { + // given + let checkRoom = mockRoom + let expectation = XCTestExpectation(description: "viewDidLoad test") + var testRoom = Room.emptyRoom + // when + testViewDidLoadSubject.send() + // then + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { + testRoom = self.viewModel.makeRoomInformation() + expectation.fulfill() + XCTAssertEqual(checkRoom, testRoom) + } + } +} + +extension DetailWaitViewModelTest { + var mockRoom: Room { + return Room(roomInformation: RoomInfo(id: 10, capacity: 10, title: "목타이틀", startDate: "", endDate: "", state: ""), + participants: Participants.testParticipants, + manittee: Manittee.testManittee, + manitto: Manitto.testManitto, + invitation: Invitation.testInvitation, + mission: Mission.testMission, + admin: true, + messages: Message1.testMessage) + } } final class MockDetailWaitService: DetailWaitServicable { From 630091e10709bdbb057647bff736b9de8f5a9149 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 10 Jul 2023 19:56:00 +0900 Subject: [PATCH 262/468] =?UTF-8?q?[CHORE]=20=EC=98=A4=ED=83=80=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManitoTests/DetailWaitViewModelTest.swift | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index 8f7a9d3d7..e6a221576 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -92,7 +92,7 @@ final class DetailWaitViewModelTest: XCTestCase { mission: Mission.testMission, admin: true, messages: Message1.testMessage) - let exception = XCTestExpectation(description: "async test") + let expectation = XCTestExpectation(description: "async test") var testRoom = Room.emptyRoom // when output.roomInformation @@ -105,19 +105,19 @@ final class DetailWaitViewModelTest: XCTestCase { } }, receiveValue: { room in testRoom = room - exception.fulfill() + expectation.fulfill() }) .store(in: &self.cancellable) // then self.testViewDidLoadSubject.send(()) - wait(for: [exception], timeout: 2) + wait(for: [expectation], timeout: 2) XCTAssertEqual(checkRoom, testRoom) } func testTranferStartButton() { // given let checkNickname = "테스트마니띠" - let exception = XCTestExpectation(description: "startButton test") + let expectation = XCTestExpectation(description: "startButton test") var testNickname = "" // when output.manitteeNickname @@ -130,12 +130,12 @@ final class DetailWaitViewModelTest: XCTestCase { } }, receiveValue: { nickname in testNickname = nickname - exception.fulfill() + expectation.fulfill() }) .store(in: &self.cancellable) // then self.testStartButtonDidTapSubject.send(()) - wait(for: [exception], timeout: 2) + wait(for: [expectation], timeout: 2) XCTAssertEqual(testNickname, checkNickname) } @@ -143,7 +143,7 @@ final class DetailWaitViewModelTest: XCTestCase { // given var testRoom = Room.emptyRoom var testMode: DetailEditView.EditMode = .date - let exception = XCTestExpectation(description: "editButton test") + let expectation = XCTestExpectation(description: "editButton test") // when output.editRoomInformation .sink(receiveCompletion: { result in @@ -156,19 +156,19 @@ final class DetailWaitViewModelTest: XCTestCase { }, receiveValue: { (room, mode) in testRoom = room testMode = mode - exception.fulfill() + expectation.fulfill() }) .store(in: &self.cancellable) // then self.testEditMenuButtonDidTapSubject.send(()) - wait(for: [exception], timeout: 2) + wait(for: [expectation], timeout: 2) XCTAssertEqual(testMode, .information) XCTAssertEqual(testRoom, Room.testRoom) } func testTransferDeleteRoom() { // given - let exception = XCTestExpectation(description: "deleteButton test") + let expectation = XCTestExpectation(description: "deleteButton test") var testBool = false // when output.deleteRoom @@ -181,18 +181,18 @@ final class DetailWaitViewModelTest: XCTestCase { } }, receiveValue: { _ in testBool = true - exception.fulfill() + expectation.fulfill() }) .store(in: &self.cancellable) // then self.testDeleteMenuButtonDidTapSubject.send(()) - wait(for: [exception], timeout: 2) + wait(for: [expectation], timeout: 2) XCTAssertTrue(testBool) } func testTransferLeaveRoom() { // given - let exception = XCTestExpectation(description: "leaveButton test") + let expectation = XCTestExpectation(description: "leaveButton test") var testBool = false // when output.leaveRoom @@ -200,24 +200,24 @@ final class DetailWaitViewModelTest: XCTestCase { switch result { case .finished: break - case .failure(let error): + case .failure: XCTFail("fail") } }, receiveValue: { _ in testBool = true - exception.fulfill() + expectation.fulfill() }) .store(in: &self.cancellable) // then self.testLeaveMenuButtonDidTapSubject.send(()) - wait(for: [exception], timeout: 2) + wait(for: [expectation], timeout: 2) XCTAssertTrue(testBool) } func testTransferChnageButtonDidTap() { // given let checkRoom = mockRoom - let exception = XCTestExpectation(description: "changeButton test") + let expectation = XCTestExpectation(description: "changeButton test") var testRoom = Room.emptyRoom // when testChangeButtonDidTapSubject.send(()) @@ -225,7 +225,7 @@ final class DetailWaitViewModelTest: XCTestCase { DispatchQueue.global().asyncAfter(deadline: .now() + 0.1) { testRoom = self.viewModel.makeRoomInformation() XCTAssertEqual(checkRoom, testRoom) - exception.fulfill() + expectation.fulfill() } } From 59026f4ca4b2a2d1668790162c9aa671f6edef55 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 10 Jul 2023 20:40:52 +0900 Subject: [PATCH 263/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManitoTests/DetailWaitViewModelTest.swift | 71 +++++++++++-------- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index e6a221576..8f0cb945f 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -72,30 +72,28 @@ final class DetailWaitViewModelTest: XCTestCase { func testTransferInvitationCode() { // given let checkCode = "ABCDEF" + var testCode = "" + // when - output.code + self.output.code .sink { code in - XCTAssertEqual(code, checkCode) + testCode = code } .store(in: &self.cancellable) + self.testCodeCopyButtonDidTapSubject.send(()) + // then - testCodeCopyButtonDidTapSubject.send(()) + XCTAssertEqual(checkCode, testCode) } func testTransferRoomInformation() { // given - let checkRoom = Room(roomInformation: RoomInfo(id: 10, capacity: 10, title: "목타이틀", startDate: "", endDate: "", state: ""), - participants: Participants.testParticipants, - manittee: Manittee.testManittee, - manitto: Manitto.testManitto, - invitation: Invitation.testInvitation, - mission: Mission.testMission, - admin: true, - messages: Message1.testMessage) - let expectation = XCTestExpectation(description: "async test") + let checkRoom = mockRoom + let expectation = XCTestExpectation(description: "roomInformation test") var testRoom = Room.emptyRoom + // when - output.roomInformation + self.output.roomInformation .sink(receiveCompletion: { result in switch result { case .failure: @@ -108,8 +106,9 @@ final class DetailWaitViewModelTest: XCTestCase { expectation.fulfill() }) .store(in: &self.cancellable) - // then self.testViewDidLoadSubject.send(()) + + // then wait(for: [expectation], timeout: 2) XCTAssertEqual(checkRoom, testRoom) } @@ -119,8 +118,9 @@ final class DetailWaitViewModelTest: XCTestCase { let checkNickname = "테스트마니띠" let expectation = XCTestExpectation(description: "startButton test") var testNickname = "" + // when - output.manitteeNickname + self.output.manitteeNickname .sink(receiveCompletion: { result in switch result { case .finished: @@ -133,19 +133,23 @@ final class DetailWaitViewModelTest: XCTestCase { expectation.fulfill() }) .store(in: &self.cancellable) - // then self.testStartButtonDidTapSubject.send(()) + + // then wait(for: [expectation], timeout: 2) - XCTAssertEqual(testNickname, checkNickname) + XCTAssertEqual(checkNickname, testNickname) } func testTransferEditRoom() { // given + let checkRoom = Room.testRoom + let checkMode: DetailEditView.EditMode = .information + let expectation = XCTestExpectation(description: "editButton test") var testRoom = Room.emptyRoom var testMode: DetailEditView.EditMode = .date - let expectation = XCTestExpectation(description: "editButton test") + // when - output.editRoomInformation + self.output.editRoomInformation .sink(receiveCompletion: { result in switch result { case .finished: @@ -159,19 +163,21 @@ final class DetailWaitViewModelTest: XCTestCase { expectation.fulfill() }) .store(in: &self.cancellable) - // then self.testEditMenuButtonDidTapSubject.send(()) + + // then wait(for: [expectation], timeout: 2) - XCTAssertEqual(testMode, .information) - XCTAssertEqual(testRoom, Room.testRoom) + XCTAssertEqual(checkRoom, testRoom) + XCTAssertEqual(checkMode, testMode) } func testTransferDeleteRoom() { // given let expectation = XCTestExpectation(description: "deleteButton test") var testBool = false + // when - output.deleteRoom + self.output.deleteRoom .sink(receiveCompletion: { result in switch result { case .finished: @@ -184,8 +190,9 @@ final class DetailWaitViewModelTest: XCTestCase { expectation.fulfill() }) .store(in: &self.cancellable) - // then self.testDeleteMenuButtonDidTapSubject.send(()) + + // then wait(for: [expectation], timeout: 2) XCTAssertTrue(testBool) } @@ -194,8 +201,9 @@ final class DetailWaitViewModelTest: XCTestCase { // given let expectation = XCTestExpectation(description: "leaveButton test") var testBool = false + // when - output.leaveRoom + self.output.leaveRoom .sink(receiveCompletion: { result in switch result { case .finished: @@ -208,8 +216,9 @@ final class DetailWaitViewModelTest: XCTestCase { expectation.fulfill() }) .store(in: &self.cancellable) - // then self.testLeaveMenuButtonDidTapSubject.send(()) + + // then wait(for: [expectation], timeout: 2) XCTAssertTrue(testBool) } @@ -219,13 +228,15 @@ final class DetailWaitViewModelTest: XCTestCase { let checkRoom = mockRoom let expectation = XCTestExpectation(description: "changeButton test") var testRoom = Room.emptyRoom + // when - testChangeButtonDidTapSubject.send(()) + self.testChangeButtonDidTapSubject.send(()) + // then DispatchQueue.global().asyncAfter(deadline: .now() + 0.1) { testRoom = self.viewModel.makeRoomInformation() - XCTAssertEqual(checkRoom, testRoom) expectation.fulfill() + XCTAssertEqual(checkRoom, testRoom) } } @@ -234,8 +245,10 @@ final class DetailWaitViewModelTest: XCTestCase { let checkRoom = mockRoom let expectation = XCTestExpectation(description: "viewDidLoad test") var testRoom = Room.emptyRoom + // when - testViewDidLoadSubject.send() + self.testViewDidLoadSubject.send() + // then DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { testRoom = self.viewModel.makeRoomInformation() From 0724ec7195429303fc4e452da932a3ac4f3662e3 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 11 Jul 2023 16:46:51 +0900 Subject: [PATCH 264/468] =?UTF-8?q?[CHORE]=20fatalError=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/ManitoTests/DetailWaitViewModelTest.swift | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index 8f0cb945f..a6e6bd783 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -12,6 +12,7 @@ import XCTest final class DetailWaitViewModelTest: XCTestCase { private var viewModel: DetailWaitViewModel! + private var service: MockDetailWaitService! private var cancellable: Set! private var testViewDidLoadSubject: PassthroughSubject! private var testCodeCopyButtonDidTapSubject: PassthroughSubject! @@ -24,7 +25,8 @@ final class DetailWaitViewModelTest: XCTestCase { override func setUp() { super.setUp() - self.viewModel = DetailWaitViewModel(roomIndex: 0, detailWaitService: MockDetailWaitService()) + self.service = MockDetailWaitService() + self.viewModel = DetailWaitViewModel(roomIndex: 0, detailWaitService: self.service) self.cancellable = Set() self.testViewDidLoadSubject = PassthroughSubject() self.testCodeCopyButtonDidTapSubject = PassthroughSubject() @@ -46,6 +48,7 @@ final class DetailWaitViewModelTest: XCTestCase { } override func tearDown() { + super.tearDown() self.viewModel = nil self.cancellable = nil self.testViewDidLoadSubject = nil @@ -233,11 +236,12 @@ final class DetailWaitViewModelTest: XCTestCase { self.testChangeButtonDidTapSubject.send(()) // then - DispatchQueue.global().asyncAfter(deadline: .now() + 0.1) { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { testRoom = self.viewModel.makeRoomInformation() expectation.fulfill() - XCTAssertEqual(checkRoom, testRoom) } + wait(for: [expectation], timeout: 2) + XCTAssertEqual(checkRoom, testRoom) } func testTransferViewDidLoad() { @@ -253,8 +257,9 @@ final class DetailWaitViewModelTest: XCTestCase { DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { testRoom = self.viewModel.makeRoomInformation() expectation.fulfill() - XCTAssertEqual(checkRoom, testRoom) } + wait(for: [expectation], timeout: 2) + XCTAssertEqual(checkRoom, testRoom) } } From cb1820ef840c37f205ad206786db80bb40233108 Mon Sep 17 00:00:00 2001 From: Mingwan Choi Date: Tue, 11 Jul 2023 18:39:10 +0900 Subject: [PATCH 265/468] =?UTF-8?q?[SETTING]=20Test=20=EC=9E=90=EB=8F=99?= =?UTF-8?q?=ED=99=94=20CI=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ce3b6aa5..d1cbbe644 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,5 +19,5 @@ jobs: - name: Firefighter Build Tests run: | - xcodebuild build -project ./Manito/Manito.xcodeproj -scheme Manito -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" + xcodebuild clean test -project ./Manito/Manito.xcodeproj -scheme Manito -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" xcpretty --color --simple From 14ab13de969f19ea369e2ce6838231bdbb23e1ad Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 11 Jul 2023 18:42:53 +0900 Subject: [PATCH 266/468] =?UTF-8?q?[CHORE]=20Test=20CI=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=20=EC=BB=A4=EB=B0=8B=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/ManitoTests/ManitoTests.swift | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Manito/ManitoTests/ManitoTests.swift b/Manito/ManitoTests/ManitoTests.swift index e9d485745..b555c2b06 100644 --- a/Manito/ManitoTests/ManitoTests.swift +++ b/Manito/ManitoTests/ManitoTests.swift @@ -11,25 +11,20 @@ import XCTest final class ManitoTests: XCTestCase { override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. + } override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. + } func testExample() throws { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - // Any test you write for XCTest can be annotated as throws and async. - // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. - // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. + } func testPerformanceExample() throws { - // This is an example of a performance test case. measure { - // Put the code you want to measure the time of here. + } } From 115d8519f209a5320add76569c700e65093c973e Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 11 Jul 2023 18:55:11 +0900 Subject: [PATCH 267/468] =?UTF-8?q?[CHORE]=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EA=B0=80=20=EC=8B=A4=ED=8C=A8=ED=95=A0=20=EB=95=8C=20Action?= =?UTF-8?q?=EC=9D=B4=20=EC=9E=A1=EB=8A=94=EC=A7=80=20=ED=99=95=EC=9D=B8=20?= =?UTF-8?q?(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/ManitoTests/DetailWaitViewModelTest.swift | 2 +- Manito/ManitoTests/ManitoTests.swift | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index a6e6bd783..a8f9aa7d3 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -118,7 +118,7 @@ final class DetailWaitViewModelTest: XCTestCase { func testTranferStartButton() { // given - let checkNickname = "테스트마니띠" + let checkNickname = "테스트마니띠123" let expectation = XCTestExpectation(description: "startButton test") var testNickname = "" diff --git a/Manito/ManitoTests/ManitoTests.swift b/Manito/ManitoTests/ManitoTests.swift index b555c2b06..e9d485745 100644 --- a/Manito/ManitoTests/ManitoTests.swift +++ b/Manito/ManitoTests/ManitoTests.swift @@ -11,20 +11,25 @@ import XCTest final class ManitoTests: XCTestCase { override func setUpWithError() throws { - + // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDownWithError() throws { - + // Put teardown code here. This method is called after the invocation of each test method in the class. } func testExample() throws { - + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + // Any test you write for XCTest can be annotated as throws and async. + // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. + // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. } func testPerformanceExample() throws { + // This is an example of a performance test case. measure { - + // Put the code you want to measure the time of here. } } From 34fa281f2ba104c2a47363af8d942d6604e1e543 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 11 Jul 2023 19:15:17 +0900 Subject: [PATCH 268/468] =?UTF-8?q?[CHORE]=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EA=B0=80=20=EC=84=B1=EA=B3=B5=ED=95=A0=20=EB=95=8C=20Action=20?= =?UTF-8?q?=EC=84=B1=EA=B3=B5=ED=95=98=EB=8A=94=EC=A7=80=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/ManitoTests/DetailWaitViewModelTest.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index a8f9aa7d3..a6e6bd783 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -118,7 +118,7 @@ final class DetailWaitViewModelTest: XCTestCase { func testTranferStartButton() { // given - let checkNickname = "테스트마니띠123" + let checkNickname = "테스트마니띠" let expectation = XCTestExpectation(description: "startButton test") var testNickname = "" From 8993c5f7f091df7e5684c6f97fd1920d80958dcf Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 11 Jul 2023 19:27:07 +0900 Subject: [PATCH 269/468] =?UTF-8?q?[CHORE]=20=EB=B9=8C=EB=93=9C=20?= =?UTF-8?q?=EC=8B=A4=ED=8C=A8=EC=8B=9C=EC=97=90=20Action=EC=9D=B4=20?= =?UTF-8?q?=EC=8B=A4=ED=8C=A8=ED=95=98=EB=8A=94=EC=A7=80=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/DetailWaitViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 6d9b03228..de538f46c 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -47,7 +47,7 @@ final class DetailWaitViewController: BaseViewController { // MARK: - life cycle override func loadView() { - self.view = self.detailWaitView + self.view = self.detailWaitView1 } override func viewDidLoad() { From 11e9ae64725abc7e036f7127dbfd6146453fd336 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 11 Jul 2023 19:32:31 +0900 Subject: [PATCH 270/468] =?UTF-8?q?[CHORE]=20=EB=B9=8C=EB=93=9C=20?= =?UTF-8?q?=EC=84=B1=EA=B3=B5=EC=8B=9C=EC=97=90=20Action=20=EC=84=B1?= =?UTF-8?q?=EA=B3=B5=ED=95=98=EB=8A=94=EC=A7=80=20=ED=99=95=EC=9D=B8=20(#1?= =?UTF-8?q?85)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/DetailWaitViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index de538f46c..6d9b03228 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -47,7 +47,7 @@ final class DetailWaitViewController: BaseViewController { // MARK: - life cycle override func loadView() { - self.view = self.detailWaitView1 + self.view = self.detailWaitView } override func viewDidLoad() { From 8fbf6c47971b4ec1ffb8548562a75c1e279cd642 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 13 Jul 2023 11:58:14 +0900 Subject: [PATCH 271/468] =?UTF-8?q?[CHORE]=20self=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Detail-Wait/DetailWaitViewController.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 6d9b03228..15e81898c 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -163,13 +163,13 @@ final class DetailWaitViewController: BaseViewController { } private func setupBind() { - detailWaitView.deleteMenuButtonSubject + self.detailWaitView.deleteMenuButtonSubject .sink(receiveValue: { [weak self] _ in self?.deleteRoom() }) .store(in: &self.cancellable) - detailWaitView.leaveMenuButtonSubject + self.detailWaitView.leaveMenuButtonSubject .sink(receiveValue: { [weak self] _ in self?.leaveRoom() }) From f91d5d877a41127a10754fe1c5df4d42898f4350 Mon Sep 17 00:00:00 2001 From: Mingwan Choi Date: Mon, 24 Jul 2023 16:28:16 +0900 Subject: [PATCH 272/468] =?UTF-8?q?[SETTING]=20Action=20=EB=B9=8C=EB=93=9C?= =?UTF-8?q?=20=ED=99=95=EC=9D=B8=20CI=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d1cbbe644..5ce3b6aa5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,5 +19,5 @@ jobs: - name: Firefighter Build Tests run: | - xcodebuild clean test -project ./Manito/Manito.xcodeproj -scheme Manito -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" + xcodebuild build -project ./Manito/Manito.xcodeproj -scheme Manito -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" xcpretty --color --simple From 7ed48e5228e89c4ddacb928a3fadd5bfc9b51cb4 Mon Sep 17 00:00:00 2001 From: Mingwan Choi Date: Mon, 24 Jul 2023 16:40:47 +0900 Subject: [PATCH 273/468] =?UTF-8?q?[SETTING]=20XCTest=20CI=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/XCTestBuild.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/XCTestBuild.yml diff --git a/.github/workflows/XCTestBuild.yml b/.github/workflows/XCTestBuild.yml new file mode 100644 index 000000000..0ae54d5a2 --- /dev/null +++ b/.github/workflows/XCTestBuild.yml @@ -0,0 +1,19 @@ +# This workflow will build a Swift project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift + +name: XCTestCI +on: + push: + branches: [ develop, main ] + pull_request: + branches: [ develop, release, hotfix, feature, main ] +jobs: + build: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + + - name: Firefighter Build Tests + run: | + xcodebuild clean test -project ./Manito/Manito.xcodeproj -scheme Manito -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" + xcpretty --color --simple From 452fba2a27bb230983cc0dd17526a14c4b65d1b7 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 25 Jul 2023 21:44:44 +0900 Subject: [PATCH 274/468] =?UTF-8?q?[FEAT]=20Publisher=20Extension=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80(#475)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++ .../Extension/Publisher+Extension.swift | 39 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 Manito/Manito/Global/Extension/Publisher+Extension.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index c0a3d2aeb..258d71e6b 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -92,6 +92,7 @@ B50B1B41285B048A0080992C /* OpenManittoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50B1B40285B048A0080992C /* OpenManittoViewController.swift */; }; B50B1B44285B146A0080992C /* OpenManittoCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50B1B43285B146A0080992C /* OpenManittoCollectionViewCell.swift */; }; B50CEE912A445EB700CF1C76 /* UIScrollView+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */; }; + B50CEEC02A6FF82600CF1C76 /* Publisher+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50CEEBF2A6FF82600CF1C76 /* Publisher+Extension.swift */; }; B517C04A28D1F7EC0008BED0 /* TokenEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */; }; B517C04C28D1FE5F0008BED0 /* TokenAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */; }; B517C04E28D1FE660008BED0 /* TokenProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04D28D1FE660008BED0 /* TokenProtocol.swift */; }; @@ -282,6 +283,7 @@ B50B1B40285B048A0080992C /* OpenManittoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoViewController.swift; sourceTree = ""; }; B50B1B43285B146A0080992C /* OpenManittoCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoCollectionViewCell.swift; sourceTree = ""; }; B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIScrollView+Combine.swift"; sourceTree = ""; }; + B50CEEBF2A6FF82600CF1C76 /* Publisher+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Publisher+Extension.swift"; sourceTree = ""; }; B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenEndPoint.swift; sourceTree = ""; }; B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenAPI.swift; sourceTree = ""; }; B517C04D28D1FE660008BED0 /* TokenProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenProtocol.swift; sourceTree = ""; }; @@ -867,6 +869,7 @@ B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */, B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */, B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */, + B50CEEBF2A6FF82600CF1C76 /* Publisher+Extension.swift */, ); path = Extension; sourceTree = ""; @@ -1346,6 +1349,7 @@ 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */, B5F5251E2851A1C700614FF7 /* BaseTableViewCell.swift in Sources */, 39C957F6287D9ED000A04A2B /* NetworkRequest.swift in Sources */, + B50CEEC02A6FF82600CF1C76 /* Publisher+Extension.swift in Sources */, 39EEF65C28CB3CD600437654 /* LoginAPI.swift in Sources */, B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */, D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */, diff --git a/Manito/Manito/Global/Extension/Publisher+Extension.swift b/Manito/Manito/Global/Extension/Publisher+Extension.swift new file mode 100644 index 000000000..927afe311 --- /dev/null +++ b/Manito/Manito/Global/Extension/Publisher+Extension.swift @@ -0,0 +1,39 @@ +// +// Publisher+Extension.swift +// Manito +// +// Created by SHIN YOON AH on 2023/07/25. +// +// https://github.com/boostcampwm-2022/iOS09-burstcamp/blob/develop/burstcamp/burstcamp/Util/Extension/AsyncCompatible/Publisher%2BAsync.swift + +import Combine + +extension Publisher { + func asyncMap(_ transform: @escaping (Output) async -> T) + -> Publishers.FlatMap, Self> { + self.flatMap { value in + Future { promise in + Task { + let output = await transform(value) + promise(.success(output)) + } + } + } + } + + func asyncMap(_ transform: @escaping (Output) async throws -> T) + -> Publishers.FlatMap, Self> { + self.flatMap { value in + Future { promise in + Task { + do { + let output = try await transform(value) + promise(.success(output)) + } catch { + promise(.failure(error)) + } + } + } + } + } +} From b4dd0428ed91871dc6de779eadef37abc90e704c Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 25 Jul 2023 22:14:12 +0900 Subject: [PATCH 275/468] =?UTF-8?q?[CHORE]=20ViewModel=EB=A5=BC=20asyncMap?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95(#475)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extension/Publisher+Extension.swift | 17 ++++ .../Letter/ViewModels/LetterViewModel.swift | 88 ++++++++----------- 2 files changed, 54 insertions(+), 51 deletions(-) diff --git a/Manito/Manito/Global/Extension/Publisher+Extension.swift b/Manito/Manito/Global/Extension/Publisher+Extension.swift index 927afe311..4ad40896d 100644 --- a/Manito/Manito/Global/Extension/Publisher+Extension.swift +++ b/Manito/Manito/Global/Extension/Publisher+Extension.swift @@ -36,4 +36,21 @@ extension Publisher { } } } + + func asyncMap( + _ transform: @escaping (Output) async throws -> T) + -> Publishers.FlatMap, Publishers.SetFailureType> { + flatMap { value in + Future { promise in + Task { + do { + let output = try await transform(value) + promise(.success(output)) + } catch { + promise(.failure(error)) + } + } + } + } + } } diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift index 32dc1715f..b81576bf8 100644 --- a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -32,8 +32,8 @@ final class LetterViewModel: ViewModelType { } struct Output { - let messages: PassthroughSubject<[Message], NetworkError> - let index: CurrentValueSubject + let messages: AnyPublisher<[Message]?, Error> + let index: AnyPublisher let messageDetails: AnyPublisher let reportDetails: AnyPublisher let roomState: AnyPublisher @@ -41,9 +41,6 @@ final class LetterViewModel: ViewModelType { // MARK: - property - private let messageSubject: PassthroughSubject<[Message], NetworkError> = PassthroughSubject() - private lazy var indexSubject: CurrentValueSubject = CurrentValueSubject(self.messageType.rawValue) - private var cancelBag: Set = Set() private let service: LetterServicable @@ -77,14 +74,22 @@ final class LetterViewModel: ViewModelType { let refreshWithType = input.refresh .map { MessageType.sent } - Publishers.Merge3(viewDidLoadType, segmentValueType, refreshWithType) - .sink(receiveValue: { [weak self] type in - self?.fetchMessages(with: type) + let mergePublisher = Publishers.Merge3(viewDidLoadType, segmentValueType, refreshWithType) + .share() + + let messagesPublisher = mergePublisher + .asyncMap { [weak self] type in + try await self?.fetchMessages(with: type) + } + .eraseToAnyPublisher() + + let currentIndexPublisher = mergePublisher + .compactMap { [weak self] type in self?.sendCurrentIndex(at: type) - }) - .store(in: &self.cancelBag) + } + .eraseToAnyPublisher() - let messagePublisher = input.sendLetterButtonDidTap + let messageDetailsPublisher = input.sendLetterButtonDidTap .map { [weak self] _ -> MessageDetails in self?.loadMessageDetails() return (self?.messageDetails)! @@ -103,9 +108,9 @@ final class LetterViewModel: ViewModelType { .eraseToAnyPublisher() return Output( - messages: self.messageSubject, - index: self.indexSubject, - messageDetails: messagePublisher, + messages: messagesPublisher, + index: currentIndexPublisher, + messageDetails: messageDetailsPublisher, reportDetails: reportPublisher, roomState: roomStatePublisher ) @@ -113,17 +118,19 @@ final class LetterViewModel: ViewModelType { // MARK: - Private - func - private func sendCurrentIndex(at type: MessageType) { + private func sendCurrentIndex(at type: MessageType) -> Int { let currentIndex = self.currentIndex(at: type) - self.indexSubject.send(currentIndex) + return currentIndex } - private func fetchMessages(with type: MessageType) { + private func fetchMessages(with type: MessageType) async throws -> [Message] { let roomId = self.messageDetails.roomId switch type { - case .sent: self.fetchSendMessages(roomId: roomId) - case .received: self.fetchReceivedMessages(roomId: roomId) + case .sent: + return try await self.fetchSendMessages(roomId: roomId, type: type) + case .received: + return try await self.fetchReceivedMessages(roomId: roomId, type: type) } } } @@ -134,30 +141,14 @@ extension LetterViewModel { return type.rawValue } - private func fetchSendMessages(roomId: String) { - Task { - do { - let messages = try await self.service.fetchSendLetter(roomId: roomId) - let modifiedMessages = self.messageWithReportState(in: messages) - self.messageSubject.send(modifiedMessages) - } catch(let error) { - guard let error = error as? NetworkError else { return } - self.messageSubject.send(completion: .failure(error)) - } - } + private func fetchSendMessages(roomId: String, type: MessageType) async throws -> [Message] { + let messages = try await self.service.fetchSendLetter(roomId: roomId) + return self.insertReportState(type, in: messages) } - private func fetchReceivedMessages(roomId: String) { - Task { - do { - let messages = try await self.service.fetchReceiveLetter(roomId: roomId) - let modifiedMessages = self.messageWithReportState(in: messages) - self.messageSubject.send(modifiedMessages) - } catch(let error) { - guard let error = error as? NetworkError else { return } - self.messageSubject.send(completion: .failure(error)) - } - } + private func fetchReceivedMessages(roomId: String, type: MessageType) async throws -> [Message] { + let messages = try await self.service.fetchReceiveLetter(roomId: roomId) + return self.insertReportState(type, in: messages) } private func loadMessageDetails() { @@ -165,16 +156,11 @@ extension LetterViewModel { self.messageDetails.manitteeId = manitteeId } - private func messageWithReportState(in messages: [Message]) -> [Message] { - if let messageType = MessageType(rawValue: self.indexSubject.value) { - let canReport = messageType == .received - return messages.map { item in - var item = item - item.canReport = canReport - return item - } + private func insertReportState(_ type: MessageType, in messages: [Message]) -> [Message] { + return messages.map { item in + var item = item + item.canReport = (type == .received) + return item } - - return [] } } From 705c692f28672d7384fceea4b5ce0344a0790421 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 25 Jul 2023 22:20:08 +0900 Subject: [PATCH 276/468] =?UTF-8?q?[CHORE]=20ViewController=20=EB=B6=80?= =?UTF-8?q?=EB=B6=84=EC=97=90=20=EC=9E=88=EB=8A=94=20asyncMap=EC=97=90=20?= =?UTF-8?q?=EC=98=81=ED=96=A5=20=EB=B0=9B=EB=8A=94=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD(#475)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewControllers/LetterViewController.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index b146b33b3..cea1ca2a4 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -100,8 +100,7 @@ final class LetterViewController: BaseViewController { case .finished: return } }, receiveValue: { [weak self] items in - self?.reloadMessageList(items) - self?.letterView.updateEmptyArea(with: items) + self?.handleMessageList(items) }) .store(in: &self.cancelBag) @@ -177,6 +176,16 @@ extension LetterViewController { message: TextLiteral.letterViewControllerErrorDescription) } + private func handleMessageList(_ messages: [Message]?) { + guard let messages else { + self.showErrorAlert() + return + } + + self.reloadMessageList(messages) + self.letterView.updateEmptyArea(with: messages) + } + private func updateLetterViewEmptyArea(with index: Int) { switch index { case 0: From 6f9d845cbd56304c3551dbbf9ef0af8b3156dfed Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 25 Jul 2023 22:52:54 +0900 Subject: [PATCH 277/468] =?UTF-8?q?[CHORE]=20share=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EC=A0=9C=EA=B1=B0(#475)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift index b81576bf8..fae832bab 100644 --- a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -75,7 +75,6 @@ final class LetterViewModel: ViewModelType { .map { MessageType.sent } let mergePublisher = Publishers.Merge3(viewDidLoadType, segmentValueType, refreshWithType) - .share() let messagesPublisher = mergePublisher .asyncMap { [weak self] type in From 349d176b5bf7d4dbcd50b71976ae924d66b1a094 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 29 Jul 2023 15:30:06 +0900 Subject: [PATCH 278/468] =?UTF-8?q?[CHORE]=20=EB=93=80=EB=82=98=20PR=20?= =?UTF-8?q?=EB=A8=B8=EC=A7=80=EC=97=90=20=EB=94=B0=EB=9D=BC=20extension=20?= =?UTF-8?q?=ED=95=98=EB=82=98=EB=A1=9C=20=ED=86=B5=EC=9D=BC=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 - .../Extension/UIControl+Extension.swift | 99 ------------------- .../DetailWaitViewController.swift | 10 -- 3 files changed, 113 deletions(-) delete mode 100644 Manito/Manito/Global/Extension/UIControl+Extension.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 69bed5cdf..f401c625a 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -17,7 +17,6 @@ 392EC7812855D17D006918A9 /* DetailWaitTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392EC7802855D17D006918A9 /* DetailWaitTitleView.swift */; }; 395B5BC22A25E20000CE1420 /* DetailWaitViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */; }; 395B5BCC2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */; }; - 395B5BD62A34A3C200CE1420 /* UIControl+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395B5BD52A34A3C200CE1420 /* UIControl+Extension.swift */; }; 397A241028BA494100454E4F /* APIEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957F0287D984900A04A2B /* APIEnvironment.swift */; }; 397A241428BA516B00454E4F /* DetailWaitAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241328BA516B00454E4F /* DetailWaitAPI.swift */; }; 397A241828BA51B400454E4F /* DetailWaitProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */; }; @@ -215,7 +214,6 @@ 392EC7802855D17D006918A9 /* DetailWaitTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitTitleView.swift; sourceTree = ""; }; 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitViewModel.swift; sourceTree = ""; }; 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitViewModelTest.swift; sourceTree = ""; }; - 395B5BD52A34A3C200CE1420 /* UIControl+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Extension.swift"; sourceTree = ""; }; 397A241328BA516B00454E4F /* DetailWaitAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitAPI.swift; sourceTree = ""; }; 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitProtocol.swift; sourceTree = ""; }; 397A241928BA532A00454E4F /* FriendList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendList.swift; sourceTree = ""; }; @@ -891,7 +889,6 @@ 39C957CF2879521400A04A2B /* String+Extension.swift */, 39C957D12879523200A04A2B /* Date+Extension.swift */, 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */, - 395B5BD52A34A3C200CE1420 /* UIControl+Extension.swift */, B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */, B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */, B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */, @@ -1302,7 +1299,6 @@ buildActionMask = 2147483647; files = ( D75E8C7F28D76FFB004A6C41 /* LetterCountBadgeView.swift in Sources */, - 395B5BD62A34A3C200CE1420 /* UIControl+Extension.swift in Sources */, 39A938912A48504200EC2CF2 /* MissionEditEndPoint.swift in Sources */, CBA4D7A62856D48C0018BDC2 /* RoomStateView.swift in Sources */, 333BF66628571CF00039F77F /* FriendCollectionViewCell.swift in Sources */, diff --git a/Manito/Manito/Global/Extension/UIControl+Extension.swift b/Manito/Manito/Global/Extension/UIControl+Extension.swift deleted file mode 100644 index cc2989705..000000000 --- a/Manito/Manito/Global/Extension/UIControl+Extension.swift +++ /dev/null @@ -1,99 +0,0 @@ -// -// UIControl+Extension.swift -// Manito -// -// Created by Mingwan Choi on 2023/06/10. -// - -import Combine -import UIKit - -extension UIControl { - func controlPublisher(for event: UIControl.Event) -> UIControl.EventPublisher { - return UIControl.EventPublisher(control: self, event: event) - } - - // Publisher - struct EventPublisher: Publisher { - typealias Output = UIControl - typealias Failure = Never - - let control: UIControl - let event: UIControl.Event - - func receive(subscriber: S) - where S: Subscriber, Never == S.Failure, UIControl == S.Input { - let subscription = EventSubscription( - control: control, - subscriber: subscriber, - event: event - ) - subscriber.receive(subscription: subscription) - } - } - - // Subscription - fileprivate class EventSubscription: Subscription - where EventSubscriber.Input == UIControl, EventSubscriber.Failure == Never { - - let control: UIControl - let event: UIControl.Event - var subscriber: EventSubscriber? - - init(control: UIControl, subscriber: EventSubscriber, event: UIControl.Event) { - self.control = control - self.subscriber = subscriber - self.event = event - - control.addTarget(self, action: #selector(eventDidOccur), for: event) - } - - func request(_ demand: Subscribers.Demand) {} - - func cancel() { - subscriber = nil - control.removeTarget(self, action: #selector(eventDidOccur), for: event) - } - - @objc func eventDidOccur() { - _ = subscriber?.receive(control) - } - } -} - -extension UITextField { - var textPublisher: AnyPublisher { - controlPublisher(for: .editingChanged) - .map { $0 as! UITextField } - .map { $0.text! } - .eraseToAnyPublisher() - } -} - -extension UIButton { - var tapPublisher: AnyPublisher { - controlPublisher(for: .touchUpInside) - .map { _ in } - .eraseToAnyPublisher() - } -} - -extension UISegmentedControl { - var selectionPublisher: AnyPublisher { - controlPublisher(for: .valueChanged) - .map { $0 as! UISegmentedControl } - .map { $0.selectedSegmentIndex } - .eraseToAnyPublisher() - } -} - -extension UISlider { - var valuePublisher: AnyPublisher { - controlPublisher(for: .valueChanged) - .map { $0 as! UISlider } - .map { $0.value } - .eraseToAnyPublisher() - } -} - -//출처:https://velog.io/@aurora_97/Combine-UIKit%EC%97%90%EC%84%9C-Combine-%ED%8E%B8%ED%95%98%EA%B2%8C-%EC%93%B0%EA%B8%B0 diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 15e81898c..d95b6e108 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -260,13 +260,3 @@ extension DetailWaitViewController: DetailWaitViewControllerDelegate { controller: self) } } - -// FIXME: - 듀나 PR 합쳐지면서 삭제 예정 -extension UIViewController { - var viewDidLoadPublisher: AnyPublisher { - let selector = #selector(UIViewController.viewDidLoad) - return Just(selector) - .map { _ in Void() } - .eraseToAnyPublisher() - } -} From c4e947282a28b7808d2cc5be9f2ccd4bf60c66ee Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 29 Jul 2023 15:30:24 +0900 Subject: [PATCH 279/468] =?UTF-8?q?[CHORE]=20Mission=20=EA=B5=AC=EC=A1=B0?= =?UTF-8?q?=EC=B2=B4=20Hasable=20=EC=B1=84=ED=83=9D=20(#185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Network/Models/Room.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Network/Models/Room.swift b/Manito/Manito/Network/Models/Room.swift index 2010ece29..6be0dffdd 100644 --- a/Manito/Manito/Network/Models/Room.swift +++ b/Manito/Manito/Network/Models/Room.swift @@ -209,7 +209,7 @@ extension RoomInfo { } // MARK: - Mission -struct Mission: Codable, Equatable { +struct Mission: Codable, Equatable, Hashable { let id: Int? let content: String? } From 02b41eccebcf13f93da5ef4b31a5805e6cc8bbe5 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 29 Jul 2023 18:45:42 +0900 Subject: [PATCH 280/468] =?UTF-8?q?[ADD]=20URL=20Info=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=20(#477)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 8 +++++++ .../Global/Extension/URLInfo+Extension.swift | 24 +++++++++++++++++++ Manito/Manito/Global/Literal/URLInfo.plist | 10 ++++++++ 3 files changed, 42 insertions(+) create mode 100644 Manito/Manito/Global/Extension/URLInfo+Extension.swift create mode 100644 Manito/Manito/Global/Literal/URLInfo.plist diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index c0a3d2aeb..c623aa696 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -11,6 +11,8 @@ 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 333BF669285864CE0039F77F /* MemoryViewController.swift */; }; 33BDF5622856E03800564211 /* FriendListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33BDF5612856E03800564211 /* FriendListViewController.swift */; }; 39018F4228C4708A00C78DBA /* UIButton+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */; }; + 3915D54B2A7516A2002D6C25 /* URLInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3915D54A2A7516A2002D6C25 /* URLInfo.plist */; }; + 3915D54D2A7516E9002D6C25 /* URLInfo+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3915D54C2A7516E9002D6C25 /* URLInfo+Extension.swift */; }; 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391612D729E9231B004AE982 /* DetailWaitView.swift */; }; 391B3003286198C200421F1D /* Size.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391B3002286198C200421F1D /* Size.swift */; }; 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392EC77D2855C388006918A9 /* SettingButton.swift */; }; @@ -205,6 +207,8 @@ 333BF669285864CE0039F77F /* MemoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryViewController.swift; sourceTree = ""; }; 33BDF5612856E03800564211 /* FriendListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendListViewController.swift; sourceTree = ""; }; 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+Extension.swift"; sourceTree = ""; }; + 3915D54A2A7516A2002D6C25 /* URLInfo.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = URLInfo.plist; sourceTree = ""; }; + 3915D54C2A7516E9002D6C25 /* URLInfo+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URLInfo+Extension.swift"; sourceTree = ""; }; 391612D729E9231B004AE982 /* DetailWaitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitView.swift; sourceTree = ""; }; 391B3002286198C200421F1D /* Size.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Size.swift; sourceTree = ""; }; 392EC77D2855C388006918A9 /* SettingButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingButton.swift; sourceTree = ""; }; @@ -867,6 +871,7 @@ B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */, B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */, B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */, + 3915D54C2A7516E9002D6C25 /* URLInfo+Extension.swift */, ); path = Extension; sourceTree = ""; @@ -909,6 +914,7 @@ CB7B23A728C4ECA8004A4CF3 /* Character.swift */, 7E15F67D28B35B3D00441305 /* TextLiteral.swift */, D777D2C828C7780E008655BD /* URLLiteral.swift */, + 3915D54A2A7516A2002D6C25 /* URLInfo.plist */, ); path = Literal; sourceTree = ""; @@ -1245,6 +1251,7 @@ 39FFE33628F45E44008442EE /* GoogleService-Info.plist in Resources */, B50B1B3C285AD2B20080992C /* logo.gif in Resources */, 7E0C5C382855B73100F698D1 /* Splash.storyboard in Resources */, + 3915D54B2A7516A2002D6C25 /* URLInfo.plist in Resources */, B5F524DB28519AA100614FF7 /* LaunchScreen.storyboard in Resources */, B5F524D828519AA100614FF7 /* Assets.xcassets in Resources */, B55BCEB628D99F8600AF7E45 /* Settings.bundle in Resources */, @@ -1393,6 +1400,7 @@ D7C4A1AD2A0DD8FA00C3AE4C /* SettingView.swift in Sources */, 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */, D7C4A1B02A0E522800C3AE4C /* SettingViewController+MailComposeViewControllerDelegate.swift in Sources */, + 3915D54D2A7516E9002D6C25 /* URLInfo+Extension.swift in Sources */, 33BDF5622856E03800564211 /* FriendListViewController.swift in Sources */, B5F5250E2851A07700614FF7 /* LetterViewController.swift in Sources */, B5F5251C2851A19A00614FF7 /* BaseCollectionViewCell.swift in Sources */, diff --git a/Manito/Manito/Global/Extension/URLInfo+Extension.swift b/Manito/Manito/Global/Extension/URLInfo+Extension.swift new file mode 100644 index 000000000..ddd6221c7 --- /dev/null +++ b/Manito/Manito/Global/Extension/URLInfo+Extension.swift @@ -0,0 +1,24 @@ +// +// URLInfo+Extension.swift +// Manito +// +// Created by Mingwan Choi on 2023/07/29. +// + +import Foundation + +extension Bundle { + var productionURL: String { + guard let file = self.path(forResource: "URLInfo", ofType: "plist") else { return "URLInfo 파일이 없습니다." } + guard let resource = NSDictionary(contentsOfFile: file) else { return "" } + guard let key = resource["Production URL"] as? String else { fatalError("Production URL을 입력해 주세요") } + return key + } + + var developmentURL: String { + guard let file = self.path(forResource: "URLInfo", ofType: "plist") else { return "URLInfo 파일이 없습니다." } + guard let resource = NSDictionary(contentsOfFile: file) else { return "" } + guard let key = resource["Development URL"] as? String else { fatalError("Development URL을 입력해 주세요") } + return key + } +} diff --git a/Manito/Manito/Global/Literal/URLInfo.plist b/Manito/Manito/Global/Literal/URLInfo.plist new file mode 100644 index 000000000..050a08730 --- /dev/null +++ b/Manito/Manito/Global/Literal/URLInfo.plist @@ -0,0 +1,10 @@ + + + + + Development URL + Development URL을 입력해주세요. + Production URL + Production URL을 입력해주세요. + + From 14124916b48294e4a2073fc6eca46d6d3cd55337 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 29 Jul 2023 18:51:21 +0900 Subject: [PATCH 281/468] =?UTF-8?q?[CHORE]=20URL=20Literal=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#477)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Literal/URLLiteral.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Global/Literal/URLLiteral.swift b/Manito/Manito/Global/Literal/URLLiteral.swift index ec55de938..82b34b3e7 100644 --- a/Manito/Manito/Global/Literal/URLLiteral.swift +++ b/Manito/Manito/Global/Literal/URLLiteral.swift @@ -11,8 +11,8 @@ enum URLLiteral { // MARK: - server url - static let developmentUrl: String = "http://43.200.81.247:8080" - static let productionUrl: String = "https://dev.aenitto.shop" + static let developmentUrl: String = Bundle.main.developmentURL + static let productionUrl: String = Bundle.main.productionURL // MARK: - notion url From c8265afab367ec3d334a78deaeee9bd13ebc8c67 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Sun, 30 Jul 2023 14:53:00 +0900 Subject: [PATCH 282/468] =?UTF-8?q?[ADD]=20MTNetwork=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=B6=94=EA=B0=80(#479)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 258d71e6b..6ef1dcbc6 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -297,6 +297,7 @@ B5706BE029ADC20A0093D198 /* CreateLetterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateLetterView.swift; sourceTree = ""; }; B5706BF329B710FC0093D198 /* LetterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterView.swift; sourceTree = ""; }; B5706BF529B9D4650093D198 /* GuideView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuideView.swift; sourceTree = ""; }; + B57CB2EF2A7631AF00474042 /* MTNetwork */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = MTNetwork; path = "../../../../공부중/URLSession-Example/URLSession_Example/Package/MTNetwork"; sourceTree = ""; }; B5AE11EF29D1E43B00F86FF8 /* OpenManittoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoView.swift; sourceTree = ""; }; B5AE11F129D28CB500F86FF8 /* OpenManittoPopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoPopupView.swift; sourceTree = ""; }; B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeView.swift; sourceTree = ""; }; @@ -639,6 +640,14 @@ path = Letter; sourceTree = ""; }; + B57CB2ED2A7630BD00474042 /* Packages */ = { + isa = PBXGroup; + children = ( + B57CB2EF2A7631AF00474042 /* MTNetwork */, + ); + path = Packages; + sourceTree = ""; + }; B5AE11EE29D1E38D00F86FF8 /* View */ = { isa = PBXGroup; children = ( @@ -701,6 +710,7 @@ B55BCEB528D99F8600AF7E45 /* Settings.bundle */, B5F524CD28519AA000614FF7 /* Manito */, 398B1CBA2A12415C00DEFCEC /* ManitoTests */, + B57CB2ED2A7630BD00474042 /* Packages */, B5F524CC28519AA000614FF7 /* Products */, 398B1CC82A13597600DEFCEC /* Frameworks */, ); From 2b2af19c57b103df42d0d578cdcc44f51dd539b1 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Sun, 30 Jul 2023 14:57:07 +0900 Subject: [PATCH 283/468] =?UTF-8?q?[CHORE]=20Package=20Path=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD(#479)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 14 +- Manito/Packages/MTNetwork/.gitignore | 9 + .../xcshareddata/xcschemes/MTNetwork.xcscheme | 98 ++++++++ Manito/Packages/MTNetwork/Package.swift | 25 ++ Manito/Packages/MTNetwork/README.md | 175 +++++++++++++ .../Sources/MTNetwork/EndPoint.swift | 67 +++++ .../Sources/MTNetwork/HTTPHeader.swift | 121 +++++++++ .../Sources/MTNetwork/HTTPMethod.swift | 16 ++ .../Sources/MTNetwork/HTTPTask.swift | 29 +++ .../MTNetwork/Sources/MTNetwork/MTError.swift | 124 ++++++++++ .../Sources/MTNetwork/MultipartFormData.swift | 44 ++++ .../MTNetwork/MultipartFormDataWrapper.swift | 200 +++++++++++++++ .../Sources/MTNetwork/NetworkLogger.swift | 229 ++++++++++++++++++ .../Sources/MTNetwork/Providable.swift | 13 + .../Sources/MTNetwork/Provider.swift | 106 ++++++++ .../Sources/MTNetwork/Requestable.swift | 37 +++ .../Sources/MTNetwork/Response.swift | 63 +++++ .../Sources/MTNetwork/URL+MTNetwork.swift | 21 ++ .../MTNetwork/URLRequest+MTNetwork.swift | 66 +++++ .../Tests/MTNetworkTests/MTNetworkTests.swift | 10 + 20 files changed, 1457 insertions(+), 10 deletions(-) create mode 100644 Manito/Packages/MTNetwork/.gitignore create mode 100644 Manito/Packages/MTNetwork/.swiftpm/xcode/xcshareddata/xcschemes/MTNetwork.xcscheme create mode 100644 Manito/Packages/MTNetwork/Package.swift create mode 100644 Manito/Packages/MTNetwork/README.md create mode 100644 Manito/Packages/MTNetwork/Sources/MTNetwork/EndPoint.swift create mode 100644 Manito/Packages/MTNetwork/Sources/MTNetwork/HTTPHeader.swift create mode 100644 Manito/Packages/MTNetwork/Sources/MTNetwork/HTTPMethod.swift create mode 100644 Manito/Packages/MTNetwork/Sources/MTNetwork/HTTPTask.swift create mode 100644 Manito/Packages/MTNetwork/Sources/MTNetwork/MTError.swift create mode 100644 Manito/Packages/MTNetwork/Sources/MTNetwork/MultipartFormData.swift create mode 100644 Manito/Packages/MTNetwork/Sources/MTNetwork/MultipartFormDataWrapper.swift create mode 100644 Manito/Packages/MTNetwork/Sources/MTNetwork/NetworkLogger.swift create mode 100644 Manito/Packages/MTNetwork/Sources/MTNetwork/Providable.swift create mode 100644 Manito/Packages/MTNetwork/Sources/MTNetwork/Provider.swift create mode 100644 Manito/Packages/MTNetwork/Sources/MTNetwork/Requestable.swift create mode 100644 Manito/Packages/MTNetwork/Sources/MTNetwork/Response.swift create mode 100644 Manito/Packages/MTNetwork/Sources/MTNetwork/URL+MTNetwork.swift create mode 100644 Manito/Packages/MTNetwork/Sources/MTNetwork/URLRequest+MTNetwork.swift create mode 100644 Manito/Packages/MTNetwork/Tests/MTNetworkTests/MTNetworkTests.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 6ef1dcbc6..faeebeed3 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -106,6 +106,7 @@ B5706BE129ADC20A0093D198 /* CreateLetterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5706BE029ADC20A0093D198 /* CreateLetterView.swift */; }; B5706BF429B710FC0093D198 /* LetterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5706BF329B710FC0093D198 /* LetterView.swift */; }; B5706BF629B9D4650093D198 /* GuideView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5706BF529B9D4650093D198 /* GuideView.swift */; }; + B57CB2F12A76330E00474042 /* Packages in Resources */ = {isa = PBXBuildFile; fileRef = B57CB2F02A76330D00474042 /* Packages */; }; B5AE11F029D1E43B00F86FF8 /* OpenManittoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11EF29D1E43B00F86FF8 /* OpenManittoView.swift */; }; B5AE11F229D28CB500F86FF8 /* OpenManittoPopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11F129D28CB500F86FF8 /* OpenManittoPopupView.swift */; }; B5AE11F429D32EE700F86FF8 /* SelectManitteeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */; }; @@ -297,7 +298,7 @@ B5706BE029ADC20A0093D198 /* CreateLetterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateLetterView.swift; sourceTree = ""; }; B5706BF329B710FC0093D198 /* LetterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterView.swift; sourceTree = ""; }; B5706BF529B9D4650093D198 /* GuideView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuideView.swift; sourceTree = ""; }; - B57CB2EF2A7631AF00474042 /* MTNetwork */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = MTNetwork; path = "../../../../공부중/URLSession-Example/URLSession_Example/Package/MTNetwork"; sourceTree = ""; }; + B57CB2F02A76330D00474042 /* Packages */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Packages; sourceTree = ""; }; B5AE11EF29D1E43B00F86FF8 /* OpenManittoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoView.swift; sourceTree = ""; }; B5AE11F129D28CB500F86FF8 /* OpenManittoPopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoPopupView.swift; sourceTree = ""; }; B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeView.swift; sourceTree = ""; }; @@ -640,14 +641,6 @@ path = Letter; sourceTree = ""; }; - B57CB2ED2A7630BD00474042 /* Packages */ = { - isa = PBXGroup; - children = ( - B57CB2EF2A7631AF00474042 /* MTNetwork */, - ); - path = Packages; - sourceTree = ""; - }; B5AE11EE29D1E38D00F86FF8 /* View */ = { isa = PBXGroup; children = ( @@ -710,7 +703,7 @@ B55BCEB528D99F8600AF7E45 /* Settings.bundle */, B5F524CD28519AA000614FF7 /* Manito */, 398B1CBA2A12415C00DEFCEC /* ManitoTests */, - B57CB2ED2A7630BD00474042 /* Packages */, + B57CB2F02A76330D00474042 /* Packages */, B5F524CC28519AA000614FF7 /* Products */, 398B1CC82A13597600DEFCEC /* Frameworks */, ); @@ -1262,6 +1255,7 @@ B5F524D828519AA100614FF7 /* Assets.xcassets in Resources */, B55BCEB628D99F8600AF7E45 /* Settings.bundle in Resources */, B5F525162851A0F600614FF7 /* DetailIng.storyboard in Resources */, + B57CB2F12A76330E00474042 /* Packages in Resources */, B55BCEC828F5AFD500AF7E45 /* joystick.gif in Resources */, B5F5250428519F7A00614FF7 /* DungGeunMo.otf in Resources */, CB2F0FCC28A5468C005F04C8 /* gifTto.gif in Resources */, diff --git a/Manito/Packages/MTNetwork/.gitignore b/Manito/Packages/MTNetwork/.gitignore new file mode 100644 index 000000000..3b2981208 --- /dev/null +++ b/Manito/Packages/MTNetwork/.gitignore @@ -0,0 +1,9 @@ +.DS_Store +/.build +/Packages +/*.xcodeproj +xcuserdata/ +DerivedData/ +.swiftpm/config/registries.json +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +.netrc diff --git a/Manito/Packages/MTNetwork/.swiftpm/xcode/xcshareddata/xcschemes/MTNetwork.xcscheme b/Manito/Packages/MTNetwork/.swiftpm/xcode/xcshareddata/xcschemes/MTNetwork.xcscheme new file mode 100644 index 000000000..37d6ea1ef --- /dev/null +++ b/Manito/Packages/MTNetwork/.swiftpm/xcode/xcshareddata/xcschemes/MTNetwork.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Manito/Packages/MTNetwork/Package.swift b/Manito/Packages/MTNetwork/Package.swift new file mode 100644 index 000000000..ccd96c7b0 --- /dev/null +++ b/Manito/Packages/MTNetwork/Package.swift @@ -0,0 +1,25 @@ +// swift-tools-version: 5.7 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "MTNetwork", + platforms: [ + .iOS(.v15) + ], + products: [ + .library( + name: "MTNetwork", + targets: ["MTNetwork"]), + ], + dependencies: [ ], + targets: [ + .target( + name: "MTNetwork", + dependencies: []), + .testTarget( + name: "MTNetworkTests", + dependencies: ["MTNetwork"]), + ] +) diff --git a/Manito/Packages/MTNetwork/README.md b/Manito/Packages/MTNetwork/README.md new file mode 100644 index 000000000..9f7703736 --- /dev/null +++ b/Manito/Packages/MTNetwork/README.md @@ -0,0 +1,175 @@ +# MTNetwork + +더 많은 케이스들을 적용할 수 있는 네트워크 라이브러리가 될 수 있도록 계속 업데이트하겠습니다.🙇‍♂️ + +![MTNetwork](https://github.com/YoonAh-dev/URLSession-Example/assets/55099365/613184e4-feea-4a5d-bf33-7fd2cd857cb5) + +## Requestable + +Requestable은 프로젝트에서 사용하던 EndPointable이 하던 일을 합니다. Moya에 있는 [TargetType](https://github.com/Moya/Moya/blob/master/Sources/Moya/TargetType.swift) 프로토콜을 참고했습니다. + +Requestable은 **URLRequest에 담을 요청에 필요한 내용들**을 가지고 있습니다. Requestable를 준수하는 타입은 요구 사항에 있는 내용들을 채워줘야 합니다. + +**(작성 예시)** + +```swift +import Foundation +import MTNetwork + +enum PhotoRequest { + case fetchImages(query: [String: Any]) +} + +extension PhotoRequest: Requestable { + + var baseURL: URL { + return APIEnvironment.baseURL + } + + var path: String { + switch self { + case .fetchImages: + return "/photos" + } + } + + var method: MTNetwork.HTTPMethod { + switch self { + case .fetchImages: + return .get + } + } + + var task: MTNetwork.HTTPTask { + switch self { + case let .fetchImages(query): + return .requestParameters(query) + } + } + + var headers: MTNetwork.HTTPHeaders { + switch self { + case .fetchImages: + let token = "\(KeyProvider.appKey(of: .clientId))" + let authorization = HTTPHeader.authorization(token) + return HTTPHeaders([authorization]) + } + } + + var requestTimeout: Float { + return 20 + } + + var sampleData: Data? { + return Data() + } + +} +``` + +
+ +Requestable에 있는 프로퍼티 중 3가지는 MTNetwork 패키지 내부에 있는 커스텀 타입을 가집니다. + +HTTPMethod, HTTPHeaders, HTTPTask 입니다. HTTPHeaders는 Alamofire에 있는 **[HTTPHeaders](https://github.com/Alamofire/Alamofire/blob/master/Source/HTTPHeaders.swift)** 타입을 참고했습니다. HTTPTask는 Moya에 있는 **[Task](https://github.com/Moya/Moya/blob/master/Sources/Moya/Task.swift)** 타입을 참고했습니다. + +### **HTTPMethod** + +기본적인 **HTTPMethod** 값을 가지고 있습니다. + +```swift +public enum HTTPMethod: String { + case get = "GET" + case post = "POST" + case put = "PUT" + case patch = "PATCH" + case delete = "DELETE" +} +``` + +### **HTTPHeaders** + +HTTPHeader 타입을 배열로 가지고 있습니다. HTTPHeader는 헤더 필드에 들어가는 값을 name, value로 받습니다. dictionary 메서드를 사용해서 URLRequest의 allHTTPHeaderFields 프로퍼티에 Dictionary 형식으로 넣어줍니다. + +```swift +public struct HTTPHeader { + + /// Name of the header. + let name: String + + /// Value of the header. + let value: String + + public init(name: String, value: String) { + self.name = name + self.value = value + } +} +``` + +### **HTTPTask** + +HTTPTask에는 6가지 케이스가 존재합니다.(케이스 추가 예정) + +| Type | Description | +| --- | --- | +| requestPlain | 추가 데이터가 없는 상황에서 사용합니다.

예시) Query Parameter가 없는 GET 요청 | +| requestJSONEncodable(Encodable) | Encodable를 준수하는 데이터를 Request body로 보내야 하는 상황에서 사용합니다.

예시) Encodable를 따르는 User 구조체를 요청 바디로 넣어서 POST 요청 | +| requestParameters(_ parameters: [String: Any]) | Dictionary 형식의 Query Parameter를 URL QueryItem으로 추가해야 하는 상황에서 사용합니다.

예시) 정렬 형식을 [”order_by”: “popular”] 쿼리 파라미터로 설정해서 GET 요청 | +| requestCompositeParameters(body: Encodable, query: [String: Any]) | request body와 URL QueryItem를 모두 사용해야 하는 상황에서 사용합니다.

예시) [”user_id”: “mtnetwork123”] 쿼리 파라미터를 가진 URL로 User 구조체를 요청 바디로 넣어서 PATCH 요청 | +| uploadMultipart([MultipartFormData]) | multipart/form-data 타입일 때, MultipartFormData를 Request body로 보내야 하는 상황에서 사용합니다.

예시) 이미지 데이터를 요청 바디로 넣어서 POST 요청 | +| uploadCompositeMultipart([MultipartFormData], query: [String: Any]) | multipart/form-data 타입일 때, MultipartFormData를 Request body로 보내면서 쿼리 파라미터를 보내야 하는 상황에서 사용합니다.

예시) [”user_id”: “mtnetwork123”] 쿼리 파라미터를 가진 URL로 이미지 데이터를 요청 바디로 넣어서 PUT 요청 | + +
+ +## EndPoint + +EndPoint는 Requestable를 준수하는 타입을 URLRequest 타입으로 만들기 전에 한 번 더 감싸주는 역할 합니다. EndPoint 내부에 있는 `urlRequest` 메서드를 사용해서 URLRequest 타입으로 EndPoint를 변환합니다. + +urlRequest 메서드 내부에서는 URLRequest 인스턴스 내부에 있는 프로퍼티에 적절한 값을 설정해줍니다. httpBody, queryItems 값은 HTTPTask 별로 나누어서 설정해줍니다. + +### URLRequest+MTNetwork + +URLRequest를 확장하여 encode 메서드를 총 3개 추가했습니다. + +- Encodable를 준수하는 타입을 받아서 **Data 타입으로 변환하여 httpBody에 넣어주는** encode 메서드 +- Parameter를 받아서 **URLComponent의 queryItems에 넣어주는** encode 메서드 +- MultipartFormData를 받아서 **Data 타입으로 변환하여 httpBody에 넣어주는** encode 메서드 + +
+ +## Providable + +Providable 프로토콜을 준수하는 Provider는 `request` 메서드를 가집니다. 해당 메서드는 Request 요청을 생성하여 URLSession에 요청을 태워보내고 Response 데이터를 받습니다. Response 데이터는 200대 상태 코드가 들어오면 반환됩니다. 그 외의 코드가 들어오면 MTError가 반환됩니다. + +request 메서드 내부에서 EndPoint와 URLSession를 생성합니다. URLSession은 URLSessionConfiguration.default를 URLSessionConfiguration으로 가집니다. 다른 타입의 URLSessionConfiguration를 추가하게 되면 Session 타입을 선택할 수 있도록 개발해보겠습니다. 🙇‍♂️ + +
+ +## Response + +Response 타입은 네트워크 응답 관련 내용들을 담고 있습니다. + +statusCode, HTTPURLResponse, Data 정보를 가지고 있기 때문에 사용자가 원하는 값을 가져다가 사용할 수 있습니다. + +```swift +public struct Response { + + /// The status code of the response. + public let statusCode: Int + + /// The HTTPURLResponse object. + public let response: HTTPURLResponse? + + /// The response data. + public let data: Data + + /// A text description of the `Response`. + public var description: String { + return "Status Code: \(self.statusCode), Data Length: \(self.data.count)" + } + +} +``` + +내부에 있는 `decode` 메서드를 사용해서 Response data를 Decodable를 준수하는 타입으로 디코딩할 수 있습니다. diff --git a/Manito/Packages/MTNetwork/Sources/MTNetwork/EndPoint.swift b/Manito/Packages/MTNetwork/Sources/MTNetwork/EndPoint.swift new file mode 100644 index 000000000..9e6472bcd --- /dev/null +++ b/Manito/Packages/MTNetwork/Sources/MTNetwork/EndPoint.swift @@ -0,0 +1,67 @@ +// +// EndPoint.swift +// +// +// Created by SHIN YOON AH on 2023/05/17. +// + +import Foundation + +public struct EndPoint { + + /// A string representation of the URL for the request. + let url: String + + /// The HTTP method for the request. + let method: HTTPMethod + + /// The `Task` for the request. + let task: HTTPTask + + /// The HTTP header fields for the request. + let httpHeaderFields: HTTPHeaders? + + public init( + url: String, + method: HTTPMethod, + task: HTTPTask, + httpHeaderFields: HTTPHeaders? + ) { + self.url = url + self.method = method + self.task = task + self.httpHeaderFields = httpHeaderFields + } +} + +public extension EndPoint { + + /// Returns the `Endpoint` converted to a `URLRequest` if valid. Throws an error otherwise. + func urlRequest() throws -> URLRequest { + guard let url = URL(string: self.url) else { + let error = NSError(domain: "\(#file) :: \(#function) :: \(#line)", code: 404) + throw MTError.invalidURL(error: error) + } + + var request = URLRequest(url: url) + request.httpMethod = self.method.rawValue + request.allHTTPHeaderFields = self.httpHeaderFields?.dictionary + + switch task { + case .requestPlain: + return request + case let .requestJSONEncodable(encodable): + return try request.encode(encodable: encodable) + case let .requestParameters(parameters): + return try request.encode(parameters: parameters) + case let .requestCompositeParameters(body, query): + var bodyfulRequest = try request.encode(encodable: body) + return try bodyfulRequest.encode(parameters: query) + case let .uploadMultipart(data): + return try request.encode(data: data) + case let .uploadCompositeMultipart(data, query): + var multipartRequest = try request.encode(data: data) + return try multipartRequest.encode(parameters: query) + } + } +} diff --git a/Manito/Packages/MTNetwork/Sources/MTNetwork/HTTPHeader.swift b/Manito/Packages/MTNetwork/Sources/MTNetwork/HTTPHeader.swift new file mode 100644 index 000000000..3f6c5afa8 --- /dev/null +++ b/Manito/Packages/MTNetwork/Sources/MTNetwork/HTTPHeader.swift @@ -0,0 +1,121 @@ +// +// HTTPHeader.swift +// +// +// Created by SHIN YOON AH on 2023/05/18. +// + +import Foundation + +public struct HTTPHeaders { + + private var headers: [HTTPHeader] = [] + + public init() {} + + public init(_ headers: [HTTPHeader]) { + self.init() + + headers.forEach { self.update($0) } + } + + /// Case-insensitively updates or appends the provided `HTTPHeader` into the instance. + public mutating func update(_ header: HTTPHeader) { + guard let index = self.headers.index(of: header.name) else { + self.headers.append(header) + return + } + + self.headers.replaceSubrange(index...index, with: [header]) + } + + /// Case-insensitively removes an `HTTPHeader`, if it exists, from the instance. + public mutating func remove(name: String) { + guard let index = self.headers.index(of: name) else { return } + + self.headers.remove(at: index) + } + + public var dictionary: [String: String] { + let element = self.headers.map { ($0.name, $0.value) } + + return Dictionary(element, uniquingKeysWith: { _, last in last }) + } +} + +extension Array where Element == HTTPHeader { + /// Case-insensitively finds the index of an `HTTPHeader` with the provided name, if it exists. + func index(of name: String) -> Int? { + let lowercasedName = name.lowercased() + return firstIndex { $0.name.lowercased() == lowercasedName } + } +} + +public struct HTTPHeader { + + /// Name of the header. + let name: String + + /// Value of the header. + let value: String + + public init(name: String, value: String) { + self.name = name + self.value = value + } +} + +extension HTTPHeader: CustomStringConvertible { + public var description: String { + return "\(self.name): \(self.value)" + } +} + +extension HTTPHeader { + + // MARK: - Public - Header Field + + public static func accept(_ value: String) -> HTTPHeader { + HTTPHeader(name: "Accept", value: value) + } + + public static func acceptCharset(_ value: String) -> HTTPHeader { + HTTPHeader(name: "Accept-Charset", value: value) + } + + public static func acceptLanguage(_ value: String) -> HTTPHeader { + HTTPHeader(name: "Accept-Language", value: value) + } + + public static func acceptEncoding(_ value: String) -> HTTPHeader { + HTTPHeader(name: "Accept-Encoding", value: value) + } + + public static func authorization(_ value: String) -> HTTPHeader { + HTTPHeader(name: "Authorization", value: value) + } + + public static func contentDisposition(_ value: String) -> HTTPHeader { + HTTPHeader(name: "Content-Disposition", value: value) + } + + public static func contentType(_ value: String) -> HTTPHeader { + HTTPHeader(name: "Content-Type", value: value) + } + + public static func userAgent(_ value: String) -> HTTPHeader { + HTTPHeader(name: "User-Agent", value: value) + } + + // MARK: - Public - Authorization + + public static func authorization(username: String, password: String) -> HTTPHeader { + let credential = Data("\(username):\(password)".utf8).base64EncodedString() + + return self.authorization("Basic \(credential)") + } + + public static func authorization(bearerToken: String) -> HTTPHeader { + return self.authorization("Bearer \(bearerToken)") + } +} diff --git a/Manito/Packages/MTNetwork/Sources/MTNetwork/HTTPMethod.swift b/Manito/Packages/MTNetwork/Sources/MTNetwork/HTTPMethod.swift new file mode 100644 index 000000000..7aab5620a --- /dev/null +++ b/Manito/Packages/MTNetwork/Sources/MTNetwork/HTTPMethod.swift @@ -0,0 +1,16 @@ +// +// HTTPMethod.swift +// +// +// Created by SHIN YOON AH on 2023/05/17. +// + +import Foundation + +public enum HTTPMethod: String { + case get = "GET" + case post = "POST" + case put = "PUT" + case patch = "PATCH" + case delete = "DELETE" +} diff --git a/Manito/Packages/MTNetwork/Sources/MTNetwork/HTTPTask.swift b/Manito/Packages/MTNetwork/Sources/MTNetwork/HTTPTask.swift new file mode 100644 index 000000000..8a7d1046f --- /dev/null +++ b/Manito/Packages/MTNetwork/Sources/MTNetwork/HTTPTask.swift @@ -0,0 +1,29 @@ +// +// HTTPTask.swift +// +// +// Created by SHIN YOON AH on 2023/05/17. +// + +import Foundation + +public enum HTTPTask { + + /// A request with no additional data. + case requestPlain + + /// A request body set with `Encodable` type + case requestJSONEncodable(Encodable) + + /// A `URL` queryItem set with parameters. + case requestParameters(_ parameters: [String: Any]) + + /// A requests body set with encoded parameters combined with url parameters. + case requestCompositeParameters(body: Encodable, query: [String: Any]) + + /// A "multipart/form-data" upload task. + case uploadMultipart([MultipartFormData]) + + /// A "multipart/form-data" upload task combined with url parameters. + case uploadCompositeMultipart([MultipartFormData], query: [String: Any]) +} diff --git a/Manito/Packages/MTNetwork/Sources/MTNetwork/MTError.swift b/Manito/Packages/MTNetwork/Sources/MTNetwork/MTError.swift new file mode 100644 index 000000000..291567922 --- /dev/null +++ b/Manito/Packages/MTNetwork/Sources/MTNetwork/MTError.swift @@ -0,0 +1,124 @@ +// +// MTError.swift +// +// +// Created by SHIN YOON AH on 2023/05/17. +// + +import Foundation + +public enum MTError: Error { + + /// failed to create a valid `URL`. + case invalidURL(error: Error) + + /// failed to encode multipart form data. + case multipartEncodingFailed(reason: MultipartEncodingFailureReason) + + /// failed to encode parameter. + case parameterEncodingFailed(reason: ParameterEncodingFailureReason) + + /// failed to decode response. + case responseDecodingFailed(Response) + + /// failed to response a valid `HTTPURLResponse`. + case invalidResponse + + /// response failed with an invalid HTTP status code. + case statusCode(reason: StatusCodeReason) + + /// The underlying reason the `.multipartEncodingFailed` error occurred. + public enum MultipartEncodingFailureReason { + case invalidData + case dataEncodingFailure + } + + /// The underlying reason the `.parameterEncodingFailed` error occurred. + public enum ParameterEncodingFailureReason { + case missingURL + case jsonEncodingFailure(error: Error) + } + + /// The underlying reason the `.statusCode` error occurred. + public enum StatusCodeReason { + case noRedirect(Response) + case clientError(Response) + case serverError(Response) + case invalidStatus(Response) + } +} + +extension MTError { + public var response: MTNetwork.Response? { + switch self { + case .invalidURL: return nil + case .multipartEncodingFailed: return nil + case .parameterEncodingFailed: return nil + case .responseDecodingFailed(let response): return response + case .invalidResponse: return nil + case .statusCode(let reason): + switch reason { + case .noRedirect(let response): return response + case .clientError(let response): return response + case .serverError(let response): return response + case .invalidStatus(let response): return response + } + } + } +} + +extension MTError: LocalizedError { + public var errorDescription: String? { + switch self { + case .invalidURL(let error): + return "⛔️ 유효하지 않은 URL 입니다. URL를 확인해주세요.\n" + "⛔️ error: \(error.localizedDescription)" + case .multipartEncodingFailed(let reason): + return reason.errorDescription + case .parameterEncodingFailed(let reason): + return reason.errorDescription + case .responseDecodingFailed: + return "⛔️ response를 decode할 수 없습니다.\n" + case .statusCode(let reason): + return reason.errorDescription + case .invalidResponse: + return "⛔️ 유효하지 않은 HTTPURLResponse 입니다.\n" + } + } +} + +extension MTError.MultipartEncodingFailureReason: LocalizedError { + public var errorDescription: String? { + switch self { + case .invalidData: + return "⛔️ 유효하지 않은 데이터입니다." + case .dataEncodingFailure: + return "⛔️ response를 decode할 수 없습니다." + } + } +} + +extension MTError.ParameterEncodingFailureReason: LocalizedError { + public var errorDescription: String? { + switch self { + case .missingURL: + return "⛔️ missing URL로 URLRequest가 encode 되었습니다." + case .jsonEncodingFailure(let error): + return "⛔️ JSON 형식으로 encode할 수 없습니다.\n" + "⛔️ error: \(error.localizedDescription)" + } + } +} + +extension MTError.StatusCodeReason: LocalizedError { + public var errorDescription: String? { + switch self { + case .noRedirect: + return "⛔️ 300..<400 코드가 들어왔습니다." + case .clientError: + return "⛔️ 400..<500 코드가 들어왔습니다." + case .serverError: + return "⛔️ server에서 문제가 발생했습니다." + case .invalidStatus: + return "⛔️ 유효하지 않은 상태 코드가 들어왔습니다." + } + } +} diff --git a/Manito/Packages/MTNetwork/Sources/MTNetwork/MultipartFormData.swift b/Manito/Packages/MTNetwork/Sources/MTNetwork/MultipartFormData.swift new file mode 100644 index 000000000..44c864958 --- /dev/null +++ b/Manito/Packages/MTNetwork/Sources/MTNetwork/MultipartFormData.swift @@ -0,0 +1,44 @@ +// +// MultipartFormData.swift +// +// +// Created by SHIN YOON AH on 2023/05/18. +// + +import Foundation + +public struct MultipartFormData { + + public enum FormDataProvider { + case data(Data) + case parameter([String: Any]) + } + + /// The method being used for providing form data. + let provider: FormDataProvider + + /// The name. + let name: String + + /// The file name. + let filename: String? + + /// The MIME type + let mimeType: String? + + /// Verify that this is the first data. + var hasInitialBoundary: Bool + + public init( + provider: FormDataProvider, + name: String = "", + filename: String? = nil, + mimeType: String? = nil + ) { + self.provider = provider + self.name = name + self.filename = filename + self.mimeType = mimeType + self.hasInitialBoundary = false + } +} diff --git a/Manito/Packages/MTNetwork/Sources/MTNetwork/MultipartFormDataWrapper.swift b/Manito/Packages/MTNetwork/Sources/MTNetwork/MultipartFormDataWrapper.swift new file mode 100644 index 000000000..dbd432e89 --- /dev/null +++ b/Manito/Packages/MTNetwork/Sources/MTNetwork/MultipartFormDataWrapper.swift @@ -0,0 +1,200 @@ +// +// MultipartFormDataWrapper.swift +// +// +// Created by SHIN YOON AH on 2023/05/18. +// + +import Foundation + +open class MultipartFormDataWrapper { + + private enum EncodingCharacters { + static let crlf = "\r\n" + } + + private enum BoundaryGenerator { + enum BoundaryType { + case inital, encapsulated, final + } + + static func randomBoundary() -> String { + let first = UInt32.random(in: UInt32.min...UInt32.max) + let second = UInt32.random(in: UInt32.min...UInt32.max) + + return String(format: "mtnetwork.boundary.%08x%08x", first, second) + } + + static func boundaryData(forBoundaryType boundaryType: BoundaryType, boundary: String) -> Data { + let boundaryText: String + + switch boundaryType { + case .inital: + boundaryText = "--\(boundary)\(EncodingCharacters.crlf)" + case .encapsulated: + boundaryText = "\(EncodingCharacters.crlf)--\(boundary)\(EncodingCharacters.crlf)" + case .final: + boundaryText = "\(EncodingCharacters.crlf)--\(boundary)--\(EncodingCharacters.crlf)" + } + + return Data(boundaryText.utf8) + } + } + + lazy var contentType: String = "multipart/form-data; boundary=\(self.boundary)" + + let boundary: String + var bodyPart: [MultipartFormData] + + init(data: [MultipartFormData], boundary: String? = nil) { + self.boundary = boundary ?? BoundaryGenerator.randomBoundary() + self.bodyPart = data + } +} + +extension MultipartFormDataWrapper { + func encode() throws -> Data { + var encoded = Data() + + let data = try self.applyMultipartFormData() + encoded.append(data) + + let finalData = self.finalBoundaryData() + encoded.append(finalData) + + return encoded + } +} + +extension MultipartFormDataWrapper { + + // MARK: - Private - Handle MultipartFormData Provider + + private func applyMultipartFormData() throws -> Data { + var encoded = Data() + + if !self.bodyPart.isEmpty { + self.bodyPart[0].hasInitialBoundary = true + } else { + throw MTError.multipartEncodingFailed(reason: .invalidData) + } + + for body in self.bodyPart { + switch body.provider { + case .data(let data): + let data = self.append(data: data, + name: body.name, + filename: body.filename, + mimeType: body.mimeType, + hasInitialBoundary: body.hasInitialBoundary) + encoded.append(data) + case .parameter(let parameters): + let data = self.append(parameters: parameters, + hasInitialBoundary: body.hasInitialBoundary) + encoded.append(data) + } + } + + return encoded + } + + // MARK: - Private - Append Data + + private func append(data: Data, + name: String, + filename: String? = nil, + mimeType: String? = nil, + hasInitialBoundary: Bool = false) -> Data { + var encoded = Data() + + let initialData = hasInitialBoundary ? self.initialBoundaryData() : self.encapsulatedBoundaryData() + encoded.append(initialData) + + let contentHeader = self.contentHeaders(withName: name, filename: filename, mimeType: mimeType) + encoded.append(contentHeader) + + encoded.append(data) + + return encoded + } + + private func append(parameters: [String: Any], hasInitialBoundary: Bool = false) -> Data { + var encoded = Data() + + let initialData = hasInitialBoundary ? self.initialBoundaryData() : self.encapsulatedBoundaryData() + encoded.append(initialData) + + for (index, (key, value)) in parameters.enumerated() { + if !index.isZero { + let encapsulatedData = self.encapsulatedBoundaryData() + encoded.append(encapsulatedData) + } + + let contentHeader = self.parameterHeaders(withName: key) + encoded.append(contentHeader) + + encoded.append("\(value)") + } + + return encoded + } + + // MARK: - Private - Boundary Encoding + + private func initialBoundaryData() -> Data { + BoundaryGenerator.boundaryData(forBoundaryType: .inital, boundary: self.boundary) + } + + private func encapsulatedBoundaryData() -> Data { + BoundaryGenerator.boundaryData(forBoundaryType: .encapsulated, boundary: self.boundary) + } + + private func finalBoundaryData() -> Data { + BoundaryGenerator.boundaryData(forBoundaryType: .final, boundary: self.boundary) + } + + // MARK: - Private - Content Headers + + private func contentHeaders(withName name: String, filename: String? = nil, mimeType: String? = nil) -> Data { + var encoded = Data() + + var disposition = "form-data; name=\"\(name)\"" + if let fileName = filename, let mimeType = mimeType { + if let type = mimeType.split(separator: "/").last.map({ String($0) }) { + disposition += "; filename=\"\(fileName).\(type)\"" + } else { + disposition += "; filename=\"\(fileName)\"" + } + } + encoded.append("Content-Disposition: \(disposition)\(EncodingCharacters.crlf)") + + if let mimeType = mimeType { + encoded.append("Content-Type: \(mimeType)\(EncodingCharacters.crlf)\(EncodingCharacters.crlf)") + } + + return encoded + } + + private func parameterHeaders(withName name: String) -> Data { + var encoded = Data() + + let disposition = "form-data; name=\"\(name)\"" + encoded.append("Content-Disposition: \(disposition)\(EncodingCharacters.crlf)\(EncodingCharacters.crlf)") + + return encoded + } +} + +fileprivate extension Data { + mutating func append(_ string: String) { + if let data = string.data(using: .utf8) { + self.append(data) + } + } +} + +fileprivate extension Int { + var isZero: Bool { + return self == 0 + } +} diff --git a/Manito/Packages/MTNetwork/Sources/MTNetwork/NetworkLogger.swift b/Manito/Packages/MTNetwork/Sources/MTNetwork/NetworkLogger.swift new file mode 100644 index 000000000..1d53146b7 --- /dev/null +++ b/Manito/Packages/MTNetwork/Sources/MTNetwork/NetworkLogger.swift @@ -0,0 +1,229 @@ +// +// NetworkLogger.swift +// +// +// Created by SHIN YOON AH on 2023/05/18. +// + +import Foundation + +public struct NetworkLogger { + + let configuration: Configuration + + public init(configuration: Configuration = Configuration()) { + self.configuration = configuration + } +} + +extension NetworkLogger { + public func willSend(_ urlRequest: URLRequest, _ request: Requestable) { + self.logNetworkRequest(urlRequest, request) { output in + self.configuration.output(request, output) + } + } + + public func didReceive(_ result: Result, _ request: Requestable) { + switch result { + case .success(let success): + self.configuration.output(request, self.logNetworkResponse(success, request)) + case .failure(let failure): + self.configuration.output(request, self.logNetworkError(failure, request)) + } + } + + public func measure(_ timeInterval: TimeInterval, _ request: Requestable) { + let time = self.configuration.formatter.entry("⏰ Network Time", String(timeInterval), request) + print(time) + } + + public func decodingError(_ error: MTError, _ context: DecodingError.Context? = nil, _ type: Any? = nil) { + self.configuration.output(nil, self.logDecodingError(error, context, type)) + } +} + +private extension NetworkLogger { + func logNetworkRequest(_ urlRequest: URLRequest, _ request: Requestable, completion: @escaping ([String]) -> Void) { + var output: [String] = [] + + output.append(self.configuration.formatter.entry("⬆ Request", urlRequest.description, request)) + + var allHeaders: [String: String] = [:] + if let headerFields = urlRequest.allHTTPHeaderFields { + allHeaders.merge(headerFields) { $1 } + } + output.append(self.configuration.formatter.entry("⬆ Request Headers", allHeaders.description, request)) + + if let bodyStreams = urlRequest.httpBodyStream { + output.append(self.configuration.formatter.entry("⬆ Request BodyStreams", bodyStreams.description, request)) + } + + if let body = urlRequest.httpBody { + switch request.task { + case .uploadMultipart(let data), .uploadCompositeMultipart(let data, _): + let body = self.multipartFormDataBody(data) + output.append(self.configuration.formatter.entry("⬆ Request Body", body.joined(separator: "\n"), request)) + default: + let body = self.configuration.formatter.requestData(body) + output.append(self.configuration.formatter.entry("⬆ Request Body", body, request)) + } + } + + if let method = urlRequest.httpMethod { + output.append(self.configuration.formatter.entry("⬆ HTTP Request Method", method, request)) + } + + completion(output) + } + + func logNetworkResponse(_ response: Response, _ request: Requestable) -> [String] { + var output: [String] = [] + + if let httpResponse = response.response { + output.append(self.configuration.formatter.entry("⬇ Response", httpResponse.description, request)) + } else { + output.append(self.configuration.formatter.entry("⬇ Response", "Received empty network response for \(request).", request)) + } + + let responseBody = response.data + let body = self.configuration.formatter.responseData(responseBody) + output.append(self.configuration.formatter.entry("⬇ Response Body", body, request)) + + return output + } + + func logNetworkError(_ error: MTError, _ request: Requestable) -> [String] { + var output: [String] = [] + + if let response = error.response { + output += self.logNetworkResponse(response, request) + } else { + output.append(self.configuration.formatter.entry("❌ Error", "Error calling \(request) : \(error)", request)) + } + + if let description = error.errorDescription { + output.append(self.configuration.formatter.entry("❌ Error Message", description, request)) + } + + return output + } + + private func logDecodingError(_ error: MTError, _ context: DecodingError.Context? = nil, _ type: Any? = nil) -> [String] { + var output: [String] = [] + + if let description = error.errorDescription { + let description = NetworkLogger.Configuration.Formatter.defaultEntryFormatter(identifier: "❌ Error Description", message: description) + output.append(description) + } + + if let context = context { + var contextDescription = "" + if let type = type { + contextDescription += "Type \(type) mismatch" + "\n" + } + contextDescription += context.debugDescription + "\n" + context.codingPath.debugDescription + + let debugDescription = NetworkLogger.Configuration.Formatter.defaultEntryFormatter(identifier: "❌ Decoding Context", message: contextDescription) + output.append(debugDescription) + } + + return output + } + + // MARK: - Private - MultipartFormData Body + + private func multipartFormDataBody(_ data: [MultipartFormData]) -> [String] { + var body: [String] = [] + + for datum in data { + let convertedData = self.convertMultipartDatum(datum) + body.append(convertedData) + } + + return body + } + + // MARK: - Private - Convert Multipart + + private func convertMultipartDatum(_ datum: MultipartFormData) -> String { + switch datum.provider { + case .data: + return "💦 Data is still difficult to encode." + case .parameter(let parameter): + do { + let data = try JSONSerialization.data(withJSONObject: parameter) + return self.configuration.formatter.requestData(data) + } catch { + return "⛔️ Failed To Convert Parameter Dictionary To Data" + } + } + } +} + +public extension NetworkLogger { + struct Configuration { + + public typealias OutputType = (_ request: Requestable?, _ items: [String]) -> Void + + public let formatter: Formatter + public let output: OutputType + + public init( + formatter: Formatter = Formatter(), + output: @escaping OutputType = defaultOutput + ) { + self.formatter = formatter + self.output = output + } + + // MARK: - Default + + public static func defaultOutput(request: Requestable?, items: [String]) { + for item in items { + print(item, separator: ",", terminator: "\n") + } + } + } +} + +extension NetworkLogger.Configuration { + public struct Formatter { + + public typealias DataFormatterType = (Data) -> (String) + public typealias EntryFormatterType = (_ identifier: String, _ message: String, _ request: Requestable) -> String + + private static let divider = "==============================\n" + private static let dateFormatString = "dd/MM/yyyy HH:mm:ss" + + public let entry: EntryFormatterType + public let requestData: DataFormatterType + public var responseData: DataFormatterType + + public init( + entry: @escaping EntryFormatterType = defaultEntryFormatter, + requestData: @escaping DataFormatterType = defaultDataFormatter, + responseData: @escaping DataFormatterType = defaultDataFormatter + ) { + self.entry = entry + self.requestData = requestData + self.responseData = responseData + } + + // MARK: - Defaults + + public static func defaultDataFormatter(_ data: Data) -> String { + return String(data: data, encoding: .utf8) ?? "⛔️ String으로 Data를 인코딩할 수 없습니다." + } + + public static func defaultEntryFormatter(identifier: String, message: String, request: Requestable? = nil) -> String { + let date = defaultEntryDateFormatter.string(from: Date()) + return divider + "MTNetwork_Logger: [\(date)]\n\(identifier):\n\(message)" + } + + public static var defaultEntryDateFormatter: DateFormatter = { + let formatter = DateFormatter() + formatter.dateFormat = dateFormatString + return formatter + }() + } +} diff --git a/Manito/Packages/MTNetwork/Sources/MTNetwork/Providable.swift b/Manito/Packages/MTNetwork/Sources/MTNetwork/Providable.swift new file mode 100644 index 000000000..d1c3e9618 --- /dev/null +++ b/Manito/Packages/MTNetwork/Sources/MTNetwork/Providable.swift @@ -0,0 +1,13 @@ +// +// Providable.swift +// +// +// Created by SHIN YOON AH on 2023/05/17. +// + +import Foundation + +public protocol Providable { + associatedtype T: Requestable + mutating func request(_ request: T, didMeasureTime: Bool) async throws -> Response +} diff --git a/Manito/Packages/MTNetwork/Sources/MTNetwork/Provider.swift b/Manito/Packages/MTNetwork/Sources/MTNetwork/Provider.swift new file mode 100644 index 000000000..016b199ed --- /dev/null +++ b/Manito/Packages/MTNetwork/Sources/MTNetwork/Provider.swift @@ -0,0 +1,106 @@ +// +// Provider.swift +// +// +// Created by SHIN YOON AH on 2023/05/17. +// + +import Foundation + +public struct Provider: Providable { + + /// measure Network Time + private var requestStartTime: Date? + + public init() { + self.requestStartTime = nil + } + + public mutating func request(_ request: T, didMeasureTime: Bool = false) async throws -> Response { + self.requestStartTime = didMeasureTime ? Date() : nil + + let endpoint = self.endpoint(request) + let urlRequest = try endpoint.urlRequest() + + self.willSend(urlRequest, request) + + let session = self.defaultSession(timeout: request.requestTimeout) + + let (data, response) = try await session.data(for: urlRequest) + + guard let httpResponse = response as? HTTPURLResponse else { + throw MTError.invalidResponse + } + + let responseData = self.response(data, response: httpResponse) + + switch httpResponse.statusCode { + case (200..<300): + self.didReceive(.success(responseData), request) + return responseData + case (300..<400): + throw self.error(MTError.statusCode(reason: .noRedirect(responseData)), request) + case (400..<500): + throw self.error(MTError.statusCode(reason: .clientError(responseData)), request) + case (500..<600): + throw self.error(MTError.statusCode(reason: .serverError(responseData)), request) + default: + throw self.error(MTError.statusCode(reason: .invalidStatus(responseData)), request) + } + } +} + +extension Provider { + fileprivate func endpoint(_ request: Requestable) -> EndPoint { + return EndPoint(url: URL(request: request).absoluteString, + method: request.method, + task: request.task, + httpHeaderFields: request.headers) + } + + fileprivate func defaultSession(timeout: Float) -> URLSession { + let configuration = URLSessionConfiguration.default + configuration.timeoutIntervalForRequest = TimeInterval(timeout) + configuration.timeoutIntervalForResource = TimeInterval(timeout) + + return URLSession(configuration: configuration) + } + + fileprivate func response(_ data: Data, response: HTTPURLResponse) -> Response { + let statusCode = response.statusCode + return Response(statusCode: statusCode, + response: response, + data: data) + } + + fileprivate mutating func error(_ error: MTError, _ request: Requestable) -> MTError { + self.didReceive(.failure(error), request) + return error + } +} + +extension Provider { + + // MARK: - Private - Logger + + private func willSend(_ urlRequest: URLRequest, _ request: Requestable) { + NetworkLogger().willSend(urlRequest, request) + } + + private mutating func didReceive(_ result: Result, _ request: Requestable) { + switch result { + case .success(let success): + NetworkLogger().didReceive(.success(success), request) + case .failure(let failure): + NetworkLogger().didReceive(.failure(failure), request) + } + self.measure(request) + } + + private mutating func measure(_ request: Requestable) { + if let requestStartTime = self.requestStartTime { + NetworkLogger().measure(Date().timeIntervalSince(requestStartTime), request) + } + self.requestStartTime = nil + } +} diff --git a/Manito/Packages/MTNetwork/Sources/MTNetwork/Requestable.swift b/Manito/Packages/MTNetwork/Sources/MTNetwork/Requestable.swift new file mode 100644 index 000000000..d0b464676 --- /dev/null +++ b/Manito/Packages/MTNetwork/Sources/MTNetwork/Requestable.swift @@ -0,0 +1,37 @@ +// +// Requestable.swift +// +// +// Created by SHIN YOON AH on 2023/05/17. +// + +import Foundation + +public protocol Requestable { + + /// Request's base `URL`. + var baseURL: URL { get } + + /// The path to be appended to `baseURL` to form the full `URL` + var path: String { get } + + /// The HTTP method used in the request. + var method: HTTPMethod { get } + + /// The type of HTTP task to be performed. + var task: HTTPTask { get } + + /// The headers to be used in the request. + var headers: HTTPHeaders { get } + + /// The timeout interval of the request. Default is `60.0` + var requestTimeout: Float { get } + + /// Provides stub data for use in testing. Default is `Data()` + var sampleData: Data? { get } +} + +extension Requestable { + var requestTimeout: Float { 60.0 } + var sampleData: Data? { Data() } +} diff --git a/Manito/Packages/MTNetwork/Sources/MTNetwork/Response.swift b/Manito/Packages/MTNetwork/Sources/MTNetwork/Response.swift new file mode 100644 index 000000000..921945603 --- /dev/null +++ b/Manito/Packages/MTNetwork/Sources/MTNetwork/Response.swift @@ -0,0 +1,63 @@ +// +// Response.swift +// +// +// Created by SHIN YOON AH on 2023/05/17. +// + +import Foundation + +public struct Response { + + /// The status code of the response. + public let statusCode: Int + + /// The HTTPURLResponse object. + public let response: HTTPURLResponse? + + /// The response data. + public let data: Data + + /// A text description of the `Response`. + public var description: String { + return "Status Code: \(self.statusCode), Data Length: \(self.data.count)" + } + +} + +public extension Response { + /// Decode the data in Response to the desired type + func decode() throws -> T { + do { + let decoder = JSONDecoder() + decoder.keyDecodingStrategy = .convertFromSnakeCase + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = "yyyy-mm-dd" + decoder.dateDecodingStrategy = .formatted(dateFormatter) + + let response = try decoder.decode(T.self, from: self.data) + return response + } catch DecodingError.dataCorrupted(let context) { + throw self.error(context) + } catch DecodingError.keyNotFound(_, let context) { + throw self.error(context) + } catch DecodingError.typeMismatch(let type, let context) { + throw self.error(context, type) + } catch DecodingError.valueNotFound(let type, let context) { + throw self.error(context, type) + } catch { + throw self.error() + } + } +} + +extension Response { + + // MARK: - Private - Logger + + private func error(_ context: DecodingError.Context? = nil, _ type: Any? = nil) -> Error { + let mtError = MTError.responseDecodingFailed(self) + NetworkLogger().decodingError(mtError, context, type) + return mtError + } +} diff --git a/Manito/Packages/MTNetwork/Sources/MTNetwork/URL+MTNetwork.swift b/Manito/Packages/MTNetwork/Sources/MTNetwork/URL+MTNetwork.swift new file mode 100644 index 000000000..46003ade8 --- /dev/null +++ b/Manito/Packages/MTNetwork/Sources/MTNetwork/URL+MTNetwork.swift @@ -0,0 +1,21 @@ +// +// URL+MTNetwork.swift +// +// +// Created by SHIN YOON AH on 2023/05/17. +// + +import Foundation + +public extension URL { + + /// Create URL with path + init(request: T) { + let path = request.path + if path.isEmpty { + self = request.baseURL + } else { + self = URL(string: request.baseURL.absoluteString + path)! + } + } +} diff --git a/Manito/Packages/MTNetwork/Sources/MTNetwork/URLRequest+MTNetwork.swift b/Manito/Packages/MTNetwork/Sources/MTNetwork/URLRequest+MTNetwork.swift new file mode 100644 index 000000000..1ce7329f9 --- /dev/null +++ b/Manito/Packages/MTNetwork/Sources/MTNetwork/URLRequest+MTNetwork.swift @@ -0,0 +1,66 @@ +// +// URLRequest+MTNetwork.swift +// +// +// Created by SHIN YOON AH on 2023/05/17. +// + +import Foundation + +public extension URLRequest { + + typealias Parameters = [String: Any] + + /// Encodes the type that complies with the `Encodable` protocol into `Data`. + /// Use `Data` as HTTP Body. + mutating func encode(encodable: Encodable) throws -> URLRequest { + do { + let bodyData = try JSONEncoder().encode(encodable) + self.httpBody = bodyData + + let contentTypeHeaderField = "Content-Type" + if self.value(forHTTPHeaderField: contentTypeHeaderField) == nil { + self.setValue("application/json", forHTTPHeaderField: contentTypeHeaderField) + } + + return self + } catch let error { + throw MTError.parameterEncodingFailed(reason: .jsonEncodingFailure(error: error)) + } + } + + /// Insert parameter into URL Query. + mutating func encode(parameters: Parameters) throws -> URLRequest { + guard let url = self.url else { + throw MTError.parameterEncodingFailed(reason: .missingURL) + } + + if var urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false), !parameters.isEmpty { + let queryItems: [URLQueryItem] = parameters.compactMap { URLQueryItem(name: $0, value: "\($1)") } + urlComponents.queryItems = queryItems + self.url = urlComponents.url! + + return self + } else { + return self + } + } + + /// Encodes the `MultipartFormData` type into `Data`. + /// Use `Data` as HTTP Body. + mutating func encode(data: [MultipartFormData]) throws -> URLRequest { + do { + let multipartformWrapper = MultipartFormDataWrapper(data: data) + let body = try multipartformWrapper.encode() + self.httpBody = body + + let contentTypeHeaderField = "Content-Type" + let contentTypeHeaderValue = multipartformWrapper.contentType + self.setValue(contentTypeHeaderValue, forHTTPHeaderField: contentTypeHeaderField) + + return self + } catch { + throw MTError.multipartEncodingFailed(reason: .dataEncodingFailure) + } + } +} diff --git a/Manito/Packages/MTNetwork/Tests/MTNetworkTests/MTNetworkTests.swift b/Manito/Packages/MTNetwork/Tests/MTNetworkTests/MTNetworkTests.swift new file mode 100644 index 000000000..c3af42bd7 --- /dev/null +++ b/Manito/Packages/MTNetwork/Tests/MTNetworkTests/MTNetworkTests.swift @@ -0,0 +1,10 @@ +import XCTest +@testable import MTNetwork + +final class MTNetworkTests: XCTestCase { + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct + // results. + } +} From 3b2140874b1a99b18ea64e8647511d650c6c3364 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Sun, 30 Jul 2023 15:40:44 +0900 Subject: [PATCH 284/468] =?UTF-8?q?[ADD]=20MTNetwork=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=EB=9F=AC=EB=A6=AC=20App=20=EB=82=B4=EB=B6=80=20?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=EB=A1=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80(#479)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 21 +++- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++ .../xcshareddata/xcschemes/MTNetwork.xcscheme | 98 ------------------- .../Tests/MTNetworkTests/MTNetworkTests.swift | 1 + 4 files changed, 26 insertions(+), 102 deletions(-) create mode 100644 Manito/Packages/MTNetwork/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 Manito/Packages/MTNetwork/.swiftpm/xcode/xcshareddata/xcschemes/MTNetwork.xcscheme diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index faeebeed3..c3dc9be2d 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -96,6 +96,7 @@ B517C04A28D1F7EC0008BED0 /* TokenEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */; }; B517C04C28D1FE5F0008BED0 /* TokenAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */; }; B517C04E28D1FE660008BED0 /* TokenProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04D28D1FE660008BED0 /* TokenProtocol.swift */; }; + B53AD35E2A763CC400B83B33 /* MTNetwork in Frameworks */ = {isa = PBXBuildFile; productRef = B53AD35D2A763CC400B83B33 /* MTNetwork */; }; B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */; }; B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741E929A494E200B75BA3 /* LetterImageError.swift */; }; B55B482229C3723B00CFFDAD /* URLRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55B482129C3723B00CFFDAD /* URLRepresentable.swift */; }; @@ -106,7 +107,6 @@ B5706BE129ADC20A0093D198 /* CreateLetterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5706BE029ADC20A0093D198 /* CreateLetterView.swift */; }; B5706BF429B710FC0093D198 /* LetterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5706BF329B710FC0093D198 /* LetterView.swift */; }; B5706BF629B9D4650093D198 /* GuideView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5706BF529B9D4650093D198 /* GuideView.swift */; }; - B57CB2F12A76330E00474042 /* Packages in Resources */ = {isa = PBXBuildFile; fileRef = B57CB2F02A76330D00474042 /* Packages */; }; B5AE11F029D1E43B00F86FF8 /* OpenManittoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11EF29D1E43B00F86FF8 /* OpenManittoView.swift */; }; B5AE11F229D28CB500F86FF8 /* OpenManittoPopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11F129D28CB500F86FF8 /* OpenManittoPopupView.swift */; }; B5AE11F429D32EE700F86FF8 /* SelectManitteeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */; }; @@ -298,7 +298,7 @@ B5706BE029ADC20A0093D198 /* CreateLetterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateLetterView.swift; sourceTree = ""; }; B5706BF329B710FC0093D198 /* LetterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterView.swift; sourceTree = ""; }; B5706BF529B9D4650093D198 /* GuideView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuideView.swift; sourceTree = ""; }; - B57CB2F02A76330D00474042 /* Packages */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Packages; sourceTree = ""; }; + B57CB3032A763C1600474042 /* MTNetwork */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = MTNetwork; sourceTree = ""; }; B5AE11EF29D1E43B00F86FF8 /* OpenManittoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoView.swift; sourceTree = ""; }; B5AE11F129D28CB500F86FF8 /* OpenManittoPopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoPopupView.swift; sourceTree = ""; }; B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeView.swift; sourceTree = ""; }; @@ -403,6 +403,7 @@ 39FFE33428F457AF008442EE /* FirebaseMessaging in Frameworks */, B50B1B0428596C900080992C /* SnapKit in Frameworks */, B50B1B0728596CB10080992C /* FSCalendar in Frameworks */, + B53AD35E2A763CC400B83B33 /* MTNetwork in Frameworks */, B50B1B33285AC0970080992C /* Gifu in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -641,6 +642,14 @@ path = Letter; sourceTree = ""; }; + B57CB3022A763BB200474042 /* Packages */ = { + isa = PBXGroup; + children = ( + B57CB3032A763C1600474042 /* MTNetwork */, + ); + path = Packages; + sourceTree = ""; + }; B5AE11EE29D1E38D00F86FF8 /* View */ = { isa = PBXGroup; children = ( @@ -703,7 +712,7 @@ B55BCEB528D99F8600AF7E45 /* Settings.bundle */, B5F524CD28519AA000614FF7 /* Manito */, 398B1CBA2A12415C00DEFCEC /* ManitoTests */, - B57CB2F02A76330D00474042 /* Packages */, + B57CB3022A763BB200474042 /* Packages */, B5F524CC28519AA000614FF7 /* Products */, 398B1CC82A13597600DEFCEC /* Frameworks */, ); @@ -1184,6 +1193,7 @@ B50B1B32285AC0970080992C /* Gifu */, CB6637E72959CBC60050BD04 /* SkeletonView */, 39FFE33328F457AF008442EE /* FirebaseMessaging */, + B53AD35D2A763CC400B83B33 /* MTNetwork */, ); productName = Manito; productReference = B5F524CB28519AA000614FF7 /* Manito.app */; @@ -1255,7 +1265,6 @@ B5F524D828519AA100614FF7 /* Assets.xcassets in Resources */, B55BCEB628D99F8600AF7E45 /* Settings.bundle in Resources */, B5F525162851A0F600614FF7 /* DetailIng.storyboard in Resources */, - B57CB2F12A76330E00474042 /* Packages in Resources */, B55BCEC828F5AFD500AF7E45 /* joystick.gif in Resources */, B5F5250428519F7A00614FF7 /* DungGeunMo.otf in Resources */, CB2F0FCC28A5468C005F04C8 /* gifTto.gif in Resources */, @@ -1816,6 +1825,10 @@ package = B50B1B31285AC0970080992C /* XCRemoteSwiftPackageReference "Gifu" */; productName = Gifu; }; + B53AD35D2A763CC400B83B33 /* MTNetwork */ = { + isa = XCSwiftPackageProductDependency; + productName = MTNetwork; + }; CB6637E72959CBC60050BD04 /* SkeletonView */ = { isa = XCSwiftPackageProductDependency; package = CB6637E62959CBC60050BD04 /* XCRemoteSwiftPackageReference "SkeletonView" */; diff --git a/Manito/Packages/MTNetwork/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Manito/Packages/MTNetwork/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/Manito/Packages/MTNetwork/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Manito/Packages/MTNetwork/.swiftpm/xcode/xcshareddata/xcschemes/MTNetwork.xcscheme b/Manito/Packages/MTNetwork/.swiftpm/xcode/xcshareddata/xcschemes/MTNetwork.xcscheme deleted file mode 100644 index 37d6ea1ef..000000000 --- a/Manito/Packages/MTNetwork/.swiftpm/xcode/xcshareddata/xcschemes/MTNetwork.xcscheme +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Manito/Packages/MTNetwork/Tests/MTNetworkTests/MTNetworkTests.swift b/Manito/Packages/MTNetwork/Tests/MTNetworkTests/MTNetworkTests.swift index c3af42bd7..179445210 100644 --- a/Manito/Packages/MTNetwork/Tests/MTNetworkTests/MTNetworkTests.swift +++ b/Manito/Packages/MTNetwork/Tests/MTNetworkTests/MTNetworkTests.swift @@ -6,5 +6,6 @@ final class MTNetworkTests: XCTestCase { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct // results. + XCTAssertEqual(MTNetwork().text, "Hello, World!") } } From 92025b446a1228278ad0b2f804c846731d4ad83a Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 1 Aug 2023 15:02:36 +0900 Subject: [PATCH 285/468] =?UTF-8?q?[CHORE]=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=20=EB=B2=84=EC=A0=84=20=EC=97=85=EA=B7=B8=EB=A0=88=EC=9D=B4?= =?UTF-8?q?=EB=93=9C=20(#474)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xcshareddata/swiftpm/Package.resolved | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a5052b187..a3ff76c5d 100644 --- a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/kaishin/Gifu.git", "state" : { - "revision" : "51f2eab32903e336f590c013267cfa4d7f8b06c4", - "version" : "3.3.1" + "revision" : "82da0086dea14ca9afc9801234ad8dc4cd9e2738", + "version" : "3.4.1" } }, { @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleDataTransport.git", "state" : { - "revision" : "5056b15c5acbb90cd214fe4d6138bdf5a740e5a8", - "version" : "9.2.0" + "revision" : "f6b558e3f801f2cac336b04f615ce111fa9ddaa0", + "version" : "9.2.1" } }, { @@ -68,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleUtilities.git", "state" : { - "revision" : "68ea347bdb1a69e2d2ae2e25cd085b6ef92f64cb", - "version" : "7.9.0" + "revision" : "0543562f85620b5b7c510c6bcbef75b562a5127b", + "version" : "7.11.0" } }, { @@ -86,8 +86,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/gtm-session-fetcher.git", "state" : { - "revision" : "d4289da23e978f37c344ea6a386e5546e2466294", - "version" : "2.1.0" + "revision" : "5ccda3981422a84186387dbb763ba739178b529c", + "version" : "2.3.0" } }, { @@ -113,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/promises.git", "state" : { - "revision" : "3e4e743631e86c8c70dbc6efdc7beaa6e90fd3bb", - "version" : "2.1.1" + "revision" : "ec957ccddbcc710ccc64c9dcbd4c7006fcf8b73a", + "version" : "2.2.0" } }, { @@ -140,8 +140,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "88c7d15e1242fdb6ecbafbc7926426a19be1e98a", - "version" : "1.20.2" + "revision" : "0af9125c4eae12a4973fb66574c53a54962a9e1e", + "version" : "1.21.0" } } ], From 4dbb23617f3ca3b664d239a320f50bcc74ec4c49 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 1 Aug 2023 21:12:15 +0900 Subject: [PATCH 286/468] =?UTF-8?q?[FEAT]=20API=20=EC=97=B0=EA=B2=B0=20(#4?= =?UTF-8?q?74)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Network/API/SettingAPI.swift | 7 ++++ .../Network/EndPoint/SettingEndPoint.swift | 9 ++++++ .../Network/Foundation/APIEnvironment.swift | 2 +- .../Network/Protocol/SettingProtocol.swift | 1 + .../Setting/SettingViewController.swift | 32 +++++++++++++++++-- 5 files changed, 48 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Network/API/SettingAPI.swift b/Manito/Manito/Network/API/SettingAPI.swift index 5ca294455..d12b7506e 100644 --- a/Manito/Manito/Network/API/SettingAPI.swift +++ b/Manito/Manito/Network/API/SettingAPI.swift @@ -20,4 +20,11 @@ struct SettingAPI: SettingProtocol { .createRequest() return try await apiService.request(request) } + + func deleteMember() async throws -> Int { + let request = SettingEndPoint + .deleteMember + .createRequest() + return try await apiService.request(request) + } } diff --git a/Manito/Manito/Network/EndPoint/SettingEndPoint.swift b/Manito/Manito/Network/EndPoint/SettingEndPoint.swift index fa970455f..119706ca5 100644 --- a/Manito/Manito/Network/EndPoint/SettingEndPoint.swift +++ b/Manito/Manito/Network/EndPoint/SettingEndPoint.swift @@ -9,11 +9,14 @@ import Foundation enum SettingEndPoint: URLRepresentable { case editUserInfo(nickNameDto: NicknameDTO) + case deleteMember var path: String { switch self { case .editUserInfo: return "/members/nickname" + case .deleteMember: + return "/members" } } } @@ -27,6 +30,8 @@ extension SettingEndPoint: EndPointable { switch self { case .editUserInfo: return .put + case .deleteMember: + return .delete } } @@ -35,6 +40,8 @@ extension SettingEndPoint: EndPointable { case .editUserInfo(let setting): let body = setting return body.encode() + case .deleteMember: + return nil } } @@ -42,6 +49,8 @@ extension SettingEndPoint: EndPointable { switch self { case .editUserInfo(let nicknameDTO): return self[.editUserInfo(nickNameDto: nicknameDTO)] + case .deleteMember: + return self[.deleteMember] } } diff --git a/Manito/Manito/Network/Foundation/APIEnvironment.swift b/Manito/Manito/Network/Foundation/APIEnvironment.swift index aa5fe350c..39e646c9a 100644 --- a/Manito/Manito/Network/Foundation/APIEnvironment.swift +++ b/Manito/Manito/Network/Foundation/APIEnvironment.swift @@ -13,7 +13,7 @@ enum APIEnvironment: String { case none = "" static func baseURL(_ version: Self = v1) -> String { - return URLLiteral.productionUrl + "/api\(version.rawValue)" + return URLLiteral.developmentUrl + "/api\(version.rawValue)" } static let boundary: String = "com.TeamFirefighter.Manito" diff --git a/Manito/Manito/Network/Protocol/SettingProtocol.swift b/Manito/Manito/Network/Protocol/SettingProtocol.swift index 0270e5b7d..ef8a309de 100644 --- a/Manito/Manito/Network/Protocol/SettingProtocol.swift +++ b/Manito/Manito/Network/Protocol/SettingProtocol.swift @@ -9,4 +9,5 @@ import Foundation protocol SettingProtocol { func putChangeNickname(body: NicknameDTO) async throws -> String? + func deleteMember() async throws -> Int } diff --git a/Manito/Manito/Screens/Setting/SettingViewController.swift b/Manito/Manito/Screens/Setting/SettingViewController.swift index 4607b3501..83dff1413 100644 --- a/Manito/Manito/Screens/Setting/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/SettingViewController.swift @@ -15,6 +15,8 @@ final class SettingViewController: BaseViewController { private let settingView: SettingView = SettingView() + private let settingService: SettingAPI = SettingAPI(apiService: APIService()) + // MARK: - init deinit { @@ -46,9 +48,28 @@ final class SettingViewController: BaseViewController { private func configureNavigationBar() { self.navigationController?.navigationBar.prefersLargeTitles = false } + + private func requestDeleteMember(completionHandler: @escaping ((Result) -> Void)) { + Task { + do { + let statusCode = try await settingService.deleteMember() + switch statusCode { + case 200..<300: completionHandler(.success(())) + default: + print(statusCode) + completionHandler(.failure(.unknownError)) + } + } catch NetworkError.serverError { + print("server Error") + } catch NetworkError.encodingError { + print("encoding Error") + } catch NetworkError.clientError(let message) { + print("client Error: \(String(describing: message))") + } + } + } } - // MARK: - Extensions extension SettingViewController: SettingViewDelegate { @@ -86,6 +107,13 @@ extension SettingViewController: SettingViewDelegate { } func withdrawalButtonDidTap() { - //FIXME: api 연결 예정 + self.requestDeleteMember() { [weak self] result in + switch result { + case .success: + self?.navigationController?.popViewController(animated: true) + case .failure: + print("error") + } + } } } From 219704764656ba2434eb49e08015ff043ddafa01 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Wed, 2 Aug 2023 14:37:52 +0900 Subject: [PATCH 287/468] =?UTF-8?q?[CHORE]=20spm=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20=EB=B2=84=EC=A0=84=20=EC=97=85=20(403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xcshareddata/swiftpm/Package.resolved | 24 +++++++++---------- .../CreateRoom/View/CreateRoomView.swift | 8 +++++++ 2 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift diff --git a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a5052b187..a3ff76c5d 100644 --- a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/kaishin/Gifu.git", "state" : { - "revision" : "51f2eab32903e336f590c013267cfa4d7f8b06c4", - "version" : "3.3.1" + "revision" : "82da0086dea14ca9afc9801234ad8dc4cd9e2738", + "version" : "3.4.1" } }, { @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleDataTransport.git", "state" : { - "revision" : "5056b15c5acbb90cd214fe4d6138bdf5a740e5a8", - "version" : "9.2.0" + "revision" : "f6b558e3f801f2cac336b04f615ce111fa9ddaa0", + "version" : "9.2.1" } }, { @@ -68,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleUtilities.git", "state" : { - "revision" : "68ea347bdb1a69e2d2ae2e25cd085b6ef92f64cb", - "version" : "7.9.0" + "revision" : "0543562f85620b5b7c510c6bcbef75b562a5127b", + "version" : "7.11.0" } }, { @@ -86,8 +86,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/gtm-session-fetcher.git", "state" : { - "revision" : "d4289da23e978f37c344ea6a386e5546e2466294", - "version" : "2.1.0" + "revision" : "5ccda3981422a84186387dbb763ba739178b529c", + "version" : "2.3.0" } }, { @@ -113,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/promises.git", "state" : { - "revision" : "3e4e743631e86c8c70dbc6efdc7beaa6e90fd3bb", - "version" : "2.1.1" + "revision" : "ec957ccddbcc710ccc64c9dcbd4c7006fcf8b73a", + "version" : "2.2.0" } }, { @@ -140,8 +140,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "88c7d15e1242fdb6ecbafbc7926426a19be1e98a", - "version" : "1.20.2" + "revision" : "0af9125c4eae12a4973fb66574c53a54962a9e1e", + "version" : "1.21.0" } } ], diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift new file mode 100644 index 000000000..f18c26b3d --- /dev/null +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -0,0 +1,8 @@ +// +// CreateRoomView.swift +// Manito +// +// Created by 이성호 on 2023/08/02. +// + +import Foundation From 90f11f9d0909b60c7b240c5436aa8bea0e45ae9c Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Wed, 2 Aug 2023 14:39:55 +0900 Subject: [PATCH 288/468] =?UTF-8?q?[ADD]=20CreateRoomView=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 12 ++++++++ .../CreateRoom/View/CreateRoomView.swift | 29 ++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index f0b0500ac..2b3169a95 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -181,6 +181,7 @@ CBA4D7A42856CE9F0018BDC2 /* CreateRoomCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBA4D7A32856CE9F0018BDC2 /* CreateRoomCollectionViewCell.swift */; }; CBA4D7A62856D48C0018BDC2 /* RoomStateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBA4D7A52856D48C0018BDC2 /* RoomStateView.swift */; }; CBBFF77C287AE491006A5964 /* DeveloperInfoViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBBFF77B287AE491006A5964 /* DeveloperInfoViewCell.swift */; }; + D70220232A7A22EC0024BACD /* CreateRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D70220222A7A22EC0024BACD /* CreateRoomView.swift */; }; D724AF5D287088310003F280 /* SettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5C287088310003F280 /* SettingViewController.swift */; }; D724AF5F28708D830003F280 /* ImageRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5E28708D830003F280 /* ImageRowView.swift */; }; D739C36328C7B69D00161117 /* SettingProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D739C36228C7B69D00161117 /* SettingProtocol.swift */; }; @@ -379,6 +380,7 @@ CBA4D7A32856CE9F0018BDC2 /* CreateRoomCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomCollectionViewCell.swift; sourceTree = ""; }; CBA4D7A52856D48C0018BDC2 /* RoomStateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomStateView.swift; sourceTree = ""; }; CBBFF77B287AE491006A5964 /* DeveloperInfoViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeveloperInfoViewCell.swift; sourceTree = ""; }; + D70220222A7A22EC0024BACD /* CreateRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomView.swift; sourceTree = ""; }; D724AF5C287088310003F280 /* SettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewController.swift; sourceTree = ""; }; D724AF5E28708D830003F280 /* ImageRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageRowView.swift; sourceTree = ""; }; D739C36228C7B69D00161117 /* SettingProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingProtocol.swift; sourceTree = ""; }; @@ -805,6 +807,7 @@ B5F524E528519ACA00614FF7 /* CreateRoom */ = { isa = PBXGroup; children = ( + D70220212A7A22DC0024BACD /* View */, 7E3058C42854B45300489E6A /* UIComponent */, B5F525052851A05500614FF7 /* CreateRoomViewController.swift */, ); @@ -1135,6 +1138,14 @@ path = Cell; sourceTree = ""; }; + D70220212A7A22DC0024BACD /* View */ = { + isa = PBXGroup; + children = ( + D70220222A7A22EC0024BACD /* CreateRoomView.swift */, + ); + path = View; + sourceTree = ""; + }; D724AF5B287088110003F280 /* Setting */ = { isa = PBXGroup; children = ( @@ -1480,6 +1491,7 @@ CB5AE3E4285AAF7400382EA3 /* RoomInfoView.swift in Sources */, B5FEE9DD28C849B400DEA07E /* UIImageView+Cache.swift in Sources */, CB9592B22855C09A00847751 /* ManitoRoomCollectionCell.swift in Sources */, + D70220232A7A22EC0024BACD /* CreateRoomView.swift in Sources */, B5AE11F429D32EE700F86FF8 /* SelectManitteeView.swift in Sources */, 397A241428BA516B00454E4F /* DetailWaitAPI.swift in Sources */, 39A938932A4852CA00EC2CF2 /* MissionDTO.swift in Sources */, diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index f18c26b3d..5c7aaab9a 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -5,4 +5,31 @@ // Created by 이성호 on 2023/08/02. // -import Foundation +import UIKit + +import SnapKit + +final class CreateRoomView: UIView { + // MARK: - ui component + + // MARK: - property + + // MARK: - init + + override init(frame: CGRect) { + super.init(frame: frame) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - life cycle + + // MARK: - override + + // MARK: - func + + // MARK: - selector +} From 8dcf553db79aac7899ac3c3d5203d53a444134a8 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Wed, 2 Aug 2023 15:52:18 +0900 Subject: [PATCH 289/468] =?UTF-8?q?[REFACTOR]=20CreateRoomView=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 16 +- .../CreateRoom/CreateRoomViewController.swift | 303 ++---------------- ...View.swift => InputParticipantsView.swift} | 2 +- ...putNameView.swift => InputTitleView.swift} | 4 +- .../CreateRoom/View/CreateRoomView.swift | 158 ++++++++- 5 files changed, 186 insertions(+), 297 deletions(-) rename Manito/Manito/Screens/CreateRoom/UIComponent/{InputPersonView.swift => InputParticipantsView.swift} (98%) rename Manito/Manito/Screens/CreateRoom/UIComponent/{InputNameView.swift => InputTitleView.swift} (97%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 2b3169a95..895d9522f 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -76,8 +76,8 @@ 7E0C5C362855B22700F698D1 /* CreateNickNameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E0C5C352855B22700F698D1 /* CreateNickNameViewController.swift */; }; 7E0C5C382855B73100F698D1 /* Splash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7E0C5C372855B73100F698D1 /* Splash.storyboard */; }; 7E15F67E28B35B3D00441305 /* TextLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E15F67D28B35B3D00441305 /* TextLiteral.swift */; }; - 7E3058C62854B47F00489E6A /* InputNameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C52854B47F00489E6A /* InputNameView.swift */; }; - 7E3058C82854B64D00489E6A /* InputPersonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C72854B64D00489E6A /* InputPersonView.swift */; }; + 7E3058C62854B47F00489E6A /* InputTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C52854B47F00489E6A /* InputTitleView.swift */; }; + 7E3058C82854B64D00489E6A /* InputParticipantsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C72854B64D00489E6A /* InputParticipantsView.swift */; }; 7E3058CA2854B7A900489E6A /* InputDateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C92854B7A900489E6A /* InputDateView.swift */; }; 7E7542B32923744300D725CB /* ToastPopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E7542B22923744300D725CB /* ToastPopupView.swift */; }; 7E77DB0428BF9A6700E95D4B /* RoomProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E77DB0328BF9A6700E95D4B /* RoomProtocol.swift */; }; @@ -277,8 +277,8 @@ 7E0C5C352855B22700F698D1 /* CreateNickNameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateNickNameViewController.swift; sourceTree = ""; }; 7E0C5C372855B73100F698D1 /* Splash.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Splash.storyboard; sourceTree = ""; }; 7E15F67D28B35B3D00441305 /* TextLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextLiteral.swift; sourceTree = ""; }; - 7E3058C52854B47F00489E6A /* InputNameView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputNameView.swift; sourceTree = ""; }; - 7E3058C72854B64D00489E6A /* InputPersonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputPersonView.swift; sourceTree = ""; }; + 7E3058C52854B47F00489E6A /* InputTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputTitleView.swift; sourceTree = ""; }; + 7E3058C72854B64D00489E6A /* InputParticipantsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputParticipantsView.swift; sourceTree = ""; }; 7E3058C92854B7A900489E6A /* InputDateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputDateView.swift; sourceTree = ""; }; 7E7542B22923744300D725CB /* ToastPopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToastPopupView.swift; sourceTree = ""; }; 7E77DB0328BF9A6700E95D4B /* RoomProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomProtocol.swift; sourceTree = ""; }; @@ -587,8 +587,8 @@ 7E3058C42854B45300489E6A /* UIComponent */ = { isa = PBXGroup; children = ( - 7E3058C52854B47F00489E6A /* InputNameView.swift */, - 7E3058C72854B64D00489E6A /* InputPersonView.swift */, + 7E3058C52854B47F00489E6A /* InputTitleView.swift */, + 7E3058C72854B64D00489E6A /* InputParticipantsView.swift */, 7E3058C92854B7A900489E6A /* InputDateView.swift */, D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */, D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */, @@ -1348,7 +1348,7 @@ CBBFF77C287AE491006A5964 /* DeveloperInfoViewCell.swift in Sources */, B517C04E28D1FE660008BED0 /* TokenProtocol.swift in Sources */, 392EC7812855D17D006918A9 /* DetailWaitTitleView.swift in Sources */, - 7E3058C82854B64D00489E6A /* InputPersonView.swift in Sources */, + 7E3058C82854B64D00489E6A /* InputParticipantsView.swift in Sources */, CBA15C94285CE1A80051EDE2 /* ChooseCharacterViewController.swift in Sources */, 39EEF65E28CB3CFE00437654 /* LoginEndPoint.swift in Sources */, 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */, @@ -1359,7 +1359,7 @@ B50B1AFB2856B5180080992C /* IndividualMissionView.swift in Sources */, B5F525492855D01D00614FF7 /* Letter.swift in Sources */, B5F524FB28519C2A00614FF7 /* MainViewController.swift in Sources */, - 7E3058C62854B47F00489E6A /* InputNameView.swift in Sources */, + 7E3058C62854B47F00489E6A /* InputTitleView.swift in Sources */, B5F5250128519EFB00614FF7 /* ImageLiteral.swift in Sources */, 39C957D828799DB900A04A2B /* NetworkError.swift in Sources */, 39F1C12E28D756E600585B83 /* LetterImageViewController.swift in Sources */, diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index a2287a21f..718c885fa 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -11,54 +11,11 @@ import SnapKit final class CreateRoomViewController: BaseViewController { - private enum RoomState: Int { - case inputName = 0 - case inputPerson = 1 - case inputDate = 2 - case checkRoom = 3 - } - // MARK: - ui component - private let titleLabel: UILabel = { - let label = UILabel() - label.text = TextLiteral.createRoom - label.font = .font(.regular, ofSize: 34) - return label - }() - private let closeButton: UIButton = { - let button = UIButton(type: .system) - button.setImage(ImageLiterals.btnXmark, for: .normal) - button.tintColor = .grey001 - return button - }() - private let nextButton: MainButton = { - let button = MainButton() - button.title = TextLiteral.next - button.isDisabled = true - return button - }() - private let backButton: UIButton = { - let button = UIButton() - button.setImage(ImageLiterals.icBack, for: .normal) - button.setTitle(" " + TextLiteral.previous, for: .normal) - button.titleLabel?.font = .font(.regular, ofSize: 14) - button.tintColor = .white - button.isHidden = true - return button - }() - private let nameView: InputNameView = InputNameView() - private let personView: InputPersonView = InputPersonView() - private let dateView: InputDateView = InputDateView() - private let checkView: CheckRoomView = CheckRoomView() - - // MARK: - property + private lazy var createRoomView: CreateRoomView = CreateRoomView() - private let roomService: RoomProtocol = RoomAPI(apiService: APIService()) - private var name: String = "" - private var person: Int = 0 - private var notiIndex: RoomState = .inputName - private var roomInfo: RoomDTO? + // MARK: - property // MARK: - init @@ -68,13 +25,15 @@ final class CreateRoomViewController: BaseViewController { // MARK: - life cycle + override func loadView() { + self.view = self.createRoomView + } + override func viewDidLoad() { super.viewDidLoad() - self.detectStartableStatus() - self.setupNotificationCenter() - self.setInputViewIsHidden() - self.setupAction() + self.configureDelegation() } + // FIXME: 플로우 연결 하면서 변경 될 예정 override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) @@ -83,253 +42,31 @@ final class CreateRoomViewController: BaseViewController { // MARK: - override - override func setupLayout() { - self.view.addSubview(self.titleLabel) - self.titleLabel.snp.makeConstraints { - $0.top.equalTo(self.view.safeAreaLayoutGuide).inset(66) - $0.leading.equalTo(self.view.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) - } - - self.view.addSubview(self.closeButton) - self.closeButton.snp.makeConstraints { - $0.top.equalTo(self.view.safeAreaLayoutGuide).inset(9) - $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - } - - self.view.addSubview(self.backButton) - self.backButton.snp.makeConstraints { - $0.top.equalTo(self.closeButton) - $0.leading.equalTo(self.view.safeAreaLayoutGuide) - $0.height.equalTo(44) - } - - self.view.addSubview(self.nextButton) - self.nextButton.snp.makeConstraints { - $0.leading.trailing.equalTo(self.view.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) - $0.bottom.equalTo(self.view.safeAreaLayoutGuide).inset(23) - $0.height.equalTo(60) - } - - self.view.addSubview(self.nameView) - self.nameView.snp.makeConstraints { - $0.top.equalTo(self.titleLabel.snp.bottom).offset(66) - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalTo(self.nextButton.snp.top) - } - - self.view.addSubview(self.personView) - self.personView.snp.makeConstraints { - $0.top.equalTo(self.titleLabel.snp.bottom).offset(66) - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalTo(self.nextButton.snp.top) - } - - self.view.addSubview(self.dateView) - self.dateView.snp.makeConstraints { - $0.top.equalTo(self.titleLabel.snp.bottom).offset(66) - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalTo(self.nextButton.snp.top) - } - - self.view.addSubview(self.checkView) - self.checkView.snp.makeConstraints { - $0.top.equalTo(self.titleLabel.snp.bottom).offset(66) - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalTo(self.nextButton.snp.top) - } - - self.view.bringSubviewToFront(self.nextButton) - } - override func configureUI() { super.configureUI() self.navigationController?.navigationBar.isHidden = true } override func endEditingView() { - if !self.nextButton.isTouchInside { - self.view.endEditing(true) - } + self.createRoomView.endEditingView() } // MARK: - func - private func setupAction() { - let closeAction = UIAction { [weak self] _ in - self?.didTapCloseButton() - } - self.closeButton.addAction(closeAction, for: .touchUpInside) - - let nextAction = UIAction { [weak self] _ in - self?.didTapNextButton() - } - self.nextButton.addAction(nextAction, for: .touchUpInside) - - let backAction = UIAction { [weak self] _ in - self?.didTapBackButton() - } - self.backButton.addAction(backAction, for: .touchUpInside) - } - - private func didTapBackButton() { - self.notiIndex = RoomState.init(rawValue: self.notiIndex.rawValue - 1) ?? RoomState.inputName - self.changedInputView() - } - - private func didTapCloseButton() { - DispatchQueue.main.async { - self.dismiss(animated: true) - } - } - - private func didTapNextButton() { - switch self.notiIndex { - case .inputName: - guard let text = self.nameView.roomsNameTextField.text else { return } - self.name = text - self.setDataInCheckView(name: self.name) - self.changeNotiIndex() - self.changedInputView() - self.nameView.roomsNameTextField.resignFirstResponder() - case .inputPerson: - self.person = Int(self.personView.personSlider.value) - self.setDataInCheckView(person: self.person) - self.changeNotiIndex() - self.changedInputView() - case .inputDate: - self.setDataInCheckView(date: "\(dateView.calendarView.getTempStartDate()) ~ \(dateView.calendarView.getTempEndDate())") - self.changeNotiIndex() - self.changedInputView() - case .checkRoom: - self.roomInfo = RoomDTO(title: self.name, - capacity: self.person, - startDate: "20\(self.dateView.calendarView.getTempStartDate())", - endDate: "20\(self.dateView.calendarView.getTempEndDate())") - let viewController = ChooseCharacterViewController(statusMode: .createRoom, roomId: nil) - viewController.roomInfo = self.roomInfo - self.navigationController?.pushViewController(viewController, animated: true) - } - } - - private func detectStartableStatus() { - self.nameView.changeNextButtonEnableStatus = { [weak self] isEnabled in - self?.nextButton.isDisabled = !isEnabled - } - - self.dateView.calendarView.changeButtonState = { [weak self] isEnabled in - self?.nextButton.isDisabled = !isEnabled - } - } - - private func changedInputView() { - switch self.notiIndex { - case .inputName: - self.setInputNameView() - case .inputPerson: - self.setInputPersonView() - case .inputDate: - self.setInputDateView() - case .checkRoom: - self.setCheckRoomView() - } - } - - private func setInputNameView() { - self.backButton.isHidden = true - self.nameView.fadeIn(duration: 0.3) - self.nameView.isHidden = false - self.personView.fadeOut() - self.personView.isHidden = true - } - - private func setInputPersonView() { - self.nextButton.isDisabled = false - self.backButton.isHidden = false - self.nameView.fadeOut() - self.nameView.isHidden = true - self.personView.fadeIn(duration: 0.3) - self.personView.isHidden = false - self.dateView.fadeOut() - self.dateView.isHidden = true - } - - private func setInputDateView() { - self.dateView.calendarView.setupButtonState() - self.personView.fadeOut() - self.personView.isHidden = true - self.dateView.fadeIn(duration: 0.3) - self.dateView.isHidden = false - self.checkView.fadeOut() - self.checkView.isHidden = true + private func configureDelegation() { + self.createRoomView.configureDelegate(self) } - - private func setCheckRoomView() { - self.dateView.fadeOut() - self.dateView.isHidden = true - self.checkView.fadeIn(duration: 0.3) - self.checkView.isHidden = false - } - - private func setDataInCheckView(name: String = "", person: Int = 0, date: String = "" ) { - switch self.notiIndex { - case .inputName: - self.checkView.name = name - case .inputPerson: - self.checkView.participants = person - case .inputDate: - self.checkView.dateRange = date - default: - return - } - } - private func changeNotiIndex() { - switch self.notiIndex { - case .inputName: - self.notiIndex = .inputPerson - case .inputPerson: - self.notiIndex = .inputDate - case .inputDate: - self.notiIndex = .checkRoom - default: - return - } - } - - private func setInputViewIsHidden() { - self.personView.alpha = 0.0 - self.personView.isHidden = true - self.dateView.alpha = 0.0 - self.dateView.isHidden = true - self.checkView.alpha = 0.0 - self.checkView.isHidden = true - } - - private func setupNotificationCenter() { - NotificationCenter.default.addObserver(self, - selector: #selector(keyboardWillShow), - name: UIResponder.keyboardWillShowNotification, - object: nil) - NotificationCenter.default.addObserver(self, - selector: #selector(keyboardWillHide), - name: UIResponder.keyboardWillHideNotification, - object: nil) +} + +extension CreateRoomViewController: CreateRoomViewDelegate { + func didTapCloseButton() { + self.dismiss(animated: true) } - // MARK: - selector + func pushChooseCharacterViewController(roomInfo: RoomDTO?) { + let viewController = ChooseCharacterViewController(statusMode: .createRoom, roomId: nil) + viewController.roomInfo = roomInfo - @objc - private func keyboardWillShow(notification: NSNotification) { - if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { - UIView.animate(withDuration: 0.2, animations: { - self.nextButton.transform = CGAffineTransform(translationX: 0, y: -keyboardSize.height + 30) - }) - } - } - - @objc - private func keyboardWillHide(notification: NSNotification) { - UIView.animate(withDuration: 0.2, animations: { - self.nextButton.transform = .identity - }) + self.navigationController?.pushViewController(viewController, animated: true) } } diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputPersonView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputParticipantsView.swift similarity index 98% rename from Manito/Manito/Screens/CreateRoom/UIComponent/InputPersonView.swift rename to Manito/Manito/Screens/CreateRoom/UIComponent/InputParticipantsView.swift index 9a36f5eec..f9362c681 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputPersonView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputParticipantsView.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -final class InputPersonView: UIView { +final class InputParticipantsView: UIView { // MARK: - ui component diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputNameView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift similarity index 97% rename from Manito/Manito/Screens/CreateRoom/UIComponent/InputNameView.swift rename to Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift index d3a998d70..945d59bde 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputNameView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -final class InputNameView: UIView { +final class InputTitleView: UIView { // MARK: - ui component @@ -95,7 +95,7 @@ final class InputNameView: UIView { } } -extension InputNameView: UITextFieldDelegate { +extension InputTitleView: UITextFieldDelegate { func textFieldShouldReturn(_ textField: UITextField) -> Bool { textField.resignFirstResponder() } diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index 5c7aaab9a..6cec35546 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -9,15 +9,68 @@ import UIKit import SnapKit +protocol CreateRoomViewDelegate: AnyObject { + func didTapCloseButton() + func pushChooseCharacterViewController(roomInfo: RoomDTO?) +} + final class CreateRoomView: UIView { + + private enum CreateRoomStep: Int { + case inputTitle = 0 + case inputParticipants = 1 + case inputDate = 2 + case checkRoom = 3 + } + // MARK: - ui component + private let titleLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.createRoom + label.font = .font(.regular, ofSize: 34) + return label + }() + private let closeButton: UIButton = { + let button = UIButton(type: .system) + button.setImage(ImageLiterals.btnXmark, for: .normal) + button.tintColor = .grey001 + return button + }() + private let nextButton: MainButton = { + let button = MainButton() + button.title = TextLiteral.next + button.isDisabled = true + return button + }() + private let backButton: UIButton = { + let button = UIButton() + button.setImage(ImageLiterals.icBack, for: .normal) + button.setTitle(" " + TextLiteral.previous, for: .normal) + button.titleLabel?.font = .font(.regular, ofSize: 14) + button.tintColor = .white + button.isHidden = true + return button + }() + private let roomTitleView: InputTitleView = InputTitleView() + private let roomParticipantsView: InputParticipantsView = InputParticipantsView() + private let roomDateView: InputDateView = InputDateView() + private let roomDataCheckView: CheckRoomView = CheckRoomView() + // MARK: - property + private var title: String = "" + private var participants: Int = 0 + private var roomStep: CreateRoomStep = .inputTitle + private var roomInfo: RoomDTO? + private weak var delegate: CreateRoomViewDelegate? + // MARK: - init override init(frame: CGRect) { super.init(frame: frame) + self.setupLayout() + self.setupAction() } @available(*, unavailable) @@ -25,11 +78,110 @@ final class CreateRoomView: UIView { fatalError("init(coder:) has not been implemented") } - // MARK: - life cycle + // MARK: - func - // MARK: - override + private func setupLayout() { + self.addSubview(self.titleLabel) + self.titleLabel.snp.makeConstraints { + $0.top.equalTo(self.safeAreaLayoutGuide).inset(66) + $0.leading.equalTo(self.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) + } + + self.addSubview(self.closeButton) + self.closeButton.snp.makeConstraints { + $0.top.equalTo(self.safeAreaLayoutGuide).inset(9) + $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + } + + self.addSubview(self.backButton) + self.backButton.snp.makeConstraints { + $0.top.equalTo(self.closeButton) + $0.leading.equalTo(self.safeAreaLayoutGuide) + $0.height.equalTo(44) + } + + self.addSubview(self.nextButton) + self.nextButton.snp.makeConstraints { + $0.leading.trailing.equalTo(self.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) + $0.bottom.equalTo(self.safeAreaLayoutGuide).inset(23) + $0.height.equalTo(60) + } + + self.addSubview(self.roomTitleView) + self.addSubview(self.roomParticipantsView) + self.addSubview(self.roomDateView) + self.addSubview(self.roomDataCheckView) + + [self.roomTitleView, self.roomParticipantsView, self.roomDateView, self.roomDataCheckView] + .forEach { + $0.snp.makeConstraints { + $0.top.equalTo(self.titleLabel.snp.bottom).offset(66) + $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.bottom.equalTo(self.nextButton.snp.top) + } + } + + self.bringSubviewToFront(self.nextButton) + } - // MARK: - func + private func setupAction() { + let closeAction = UIAction { [weak self] _ in + self?.delegate?.didTapCloseButton() + } + self.closeButton.addAction(closeAction, for: .touchUpInside) + + let nextAction = UIAction { [weak self] _ in +// self?.didTapNextButton() + } + self.nextButton.addAction(nextAction, for: .touchUpInside) + + let backAction = UIAction { [weak self] _ in +// self?.didTapBackButton() + } + self.backButton.addAction(backAction, for: .touchUpInside) + } + + private func changePreviousRoomIndex() { + self.roomStep = CreateRoomStep.init(rawValue: self.roomStep.rawValue - 1)! + + } + + private func setupNotificationCenter() { + NotificationCenter.default.addObserver(self, + selector: #selector(keyboardWillShow), + name: UIResponder.keyboardWillShowNotification, + object: nil) + NotificationCenter.default.addObserver(self, + selector: #selector(keyboardWillHide), + name: UIResponder.keyboardWillHideNotification, + object: nil) + } + + func configureDelegate(_ delegate: CreateRoomViewDelegate) { + self.delegate = delegate + } + + func endEditingView() { + if !self.nextButton.isTouchInside { + self.endEditing(true) + } + } // MARK: - selector + + @objc + private func keyboardWillShow(notification: NSNotification) { + if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { + UIView.animate(withDuration: 0.2, animations: { + self.nextButton.transform = CGAffineTransform(translationX: 0, y: -keyboardSize.height + 30) + }) + } + } + + @objc + private func keyboardWillHide(notification: NSNotification) { + UIView.animate(withDuration: 0.2, animations: { + self.nextButton.transform = .identity + }) + } } From 53bdfac827369a0e813819751707f7a8914669b1 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Wed, 2 Aug 2023 22:09:46 +0900 Subject: [PATCH 290/468] =?UTF-8?q?[FEAT]=20Step=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=9E=91=EC=84=B1=20?= =?UTF-8?q?(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreateRoom/CreateRoomViewController.swift | 4 ++ .../CreateRoom/View/CreateRoomView.swift | 52 ++++++++++++++----- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index 718c885fa..93c94f653 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -11,12 +11,16 @@ import SnapKit final class CreateRoomViewController: BaseViewController { + + // MARK: - ui component private lazy var createRoomView: CreateRoomView = CreateRoomView() // MARK: - property + + // MARK: - init deinit { diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index 6cec35546..725c06197 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -17,10 +17,7 @@ protocol CreateRoomViewDelegate: AnyObject { final class CreateRoomView: UIView { private enum CreateRoomStep: Int { - case inputTitle = 0 - case inputParticipants = 1 - case inputDate = 2 - case checkRoom = 3 + case inputTitle = 0, inputParticipants, inputDate, checkRoom } // MARK: - ui component @@ -61,9 +58,14 @@ final class CreateRoomView: UIView { private var title: String = "" private var participants: Int = 0 - private var roomStep: CreateRoomStep = .inputTitle private var roomInfo: RoomDTO? private weak var delegate: CreateRoomViewDelegate? + private var roomStep: CreateRoomStep? = .inputTitle { + willSet(step) { + guard let stepIndex = step?.rawValue else { return } + self.manageStepView(step: stepIndex) + } + } // MARK: - init @@ -71,6 +73,7 @@ final class CreateRoomView: UIView { super.init(frame: frame) self.setupLayout() self.setupAction() + self.detectStartableStatus() } @available(*, unavailable) @@ -131,21 +134,16 @@ final class CreateRoomView: UIView { self.closeButton.addAction(closeAction, for: .touchUpInside) let nextAction = UIAction { [weak self] _ in -// self?.didTapNextButton() + self?.moveToNextStep() } self.nextButton.addAction(nextAction, for: .touchUpInside) let backAction = UIAction { [weak self] _ in -// self?.didTapBackButton() + self?.moveToPreviousStep() } self.backButton.addAction(backAction, for: .touchUpInside) } - private func changePreviousRoomIndex() { - self.roomStep = CreateRoomStep.init(rawValue: self.roomStep.rawValue - 1)! - - } - private func setupNotificationCenter() { NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), @@ -157,6 +155,32 @@ final class CreateRoomView: UIView { object: nil) } + private func moveToNextStep() { + guard let stepIndex = self.roomStep?.rawValue, + let nextStepIndex = CreateRoomStep(rawValue: stepIndex + 1) else { return } + self.roomStep = nextStepIndex + } + + private func moveToPreviousStep() { + guard let stepIndex = self.roomStep?.rawValue, + let previousStepIndex = CreateRoomStep(rawValue: stepIndex - 1) else { return } + self.roomStep = previousStepIndex + } + + private func detectStartableStatus() { + self.roomTitleView.changeNextButtonEnableStatus = { [weak self] isEnabled in + self?.nextButton.isDisabled = !isEnabled + } + + self.roomDateView.calendarView.changeButtonState = { [weak self] isEnabled in + self?.nextButton.isDisabled = !isEnabled + } + } + + private func setupHiddenStepView(at step: Int) { + + } + func configureDelegate(_ delegate: CreateRoomViewDelegate) { self.delegate = delegate } @@ -167,6 +191,10 @@ final class CreateRoomView: UIView { } } + func manageStepView(step: Int) { + + } + // MARK: - selector @objc From 55ecc91e642cea94b523740003d21432650bf30e Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 7 Aug 2023 16:12:57 +0900 Subject: [PATCH 291/468] =?UTF-8?q?[REFACTOR]=20=EB=8B=A4=EC=9D=8C=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=20=ED=81=B4=EB=A6=AD=EC=8B=9C=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EB=B3=80=EA=B2=BD=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 8 +- ...RoomView.swift => CheckRoomInfoView.swift} | 2 +- .../CreateRoom/View/CreateRoomView.swift | 97 +++++++++++++++++-- 3 files changed, 95 insertions(+), 12 deletions(-) rename Manito/Manito/Screens/CreateRoom/UIComponent/{CheckRoomView.swift => CheckRoomInfoView.swift} (98%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 895d9522f..ef3df5792 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -190,7 +190,7 @@ D75E8C7F28D76FFB004A6C41 /* LetterCountBadgeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D75E8C7E28D76FFB004A6C41 /* LetterCountBadgeView.swift */; }; D77224DF285DDAB7008B760B /* Notification+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D77224DE285DDAB7008B760B /* Notification+Extension.swift */; }; D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = D777D2C828C7780E008655BD /* URLLiteral.swift */; }; - D7B6C97C2858B2D40024F326 /* CheckRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */; }; + D7B6C97C2858B2D40024F326 /* CheckRoomInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B6C97B2858B2D40024F326 /* CheckRoomInfoView.swift */; }; D7C4A1A72A0B2EB000C3AE4C /* CharacterCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */; }; D7C4A1A92A0B895300C3AE4C /* ChooseCharacterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */; }; D7C4A1AB2A0D1AA400C3AE4C /* ParticipateRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1AA2A0D1AA400C3AE4C /* ParticipateRoomView.swift */; }; @@ -389,7 +389,7 @@ D75E8C7E28D76FFB004A6C41 /* LetterCountBadgeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterCountBadgeView.swift; sourceTree = ""; }; D77224DE285DDAB7008B760B /* Notification+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Notification+Extension.swift"; sourceTree = ""; }; D777D2C828C7780E008655BD /* URLLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLLiteral.swift; sourceTree = ""; }; - D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckRoomView.swift; sourceTree = ""; }; + D7B6C97B2858B2D40024F326 /* CheckRoomInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckRoomInfoView.swift; sourceTree = ""; }; D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterCollectionView.swift; sourceTree = ""; }; D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooseCharacterView.swift; sourceTree = ""; }; D7C4A1AA2A0D1AA400C3AE4C /* ParticipateRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipateRoomView.swift; sourceTree = ""; }; @@ -590,7 +590,7 @@ 7E3058C52854B47F00489E6A /* InputTitleView.swift */, 7E3058C72854B64D00489E6A /* InputParticipantsView.swift */, 7E3058C92854B7A900489E6A /* InputDateView.swift */, - D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */, + D7B6C97B2858B2D40024F326 /* CheckRoomInfoView.swift */, D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */, ); path = UIComponent; @@ -1441,7 +1441,7 @@ B5F31C5028BF922E00F61D0F /* LetterViewController+MailCompose.swift in Sources */, 7E3058CA2854B7A900489E6A /* InputDateView.swift in Sources */, B5F31C5428BFA70100F61D0F /* LetterProtocol.swift in Sources */, - D7B6C97C2858B2D40024F326 /* CheckRoomView.swift in Sources */, + D7B6C97C2858B2D40024F326 /* CheckRoomInfoView.swift in Sources */, B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */, B5F31BB228BE1CD700F61D0F /* UserDefaultHandler.swift in Sources */, 39CD581D28C4C03C00496E91 /* DetailDoneProtocol.swift in Sources */, diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift similarity index 98% rename from Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomView.swift rename to Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift index 4302f4ec4..5109c52e0 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -final class CheckRoomView: UIView { +final class CheckRoomInfoView: UIView { // MARK: - ui component diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index 725c06197..7c6648459 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -52,12 +52,10 @@ final class CreateRoomView: UIView { private let roomTitleView: InputTitleView = InputTitleView() private let roomParticipantsView: InputParticipantsView = InputParticipantsView() private let roomDateView: InputDateView = InputDateView() - private let roomDataCheckView: CheckRoomView = CheckRoomView() + private let roomInfoView: CheckRoomInfoView = CheckRoomInfoView() // MARK: - property - private var title: String = "" - private var participants: Int = 0 private var roomInfo: RoomDTO? private weak var delegate: CreateRoomViewDelegate? private var roomStep: CreateRoomStep? = .inputTitle { @@ -74,6 +72,7 @@ final class CreateRoomView: UIView { self.setupLayout() self.setupAction() self.detectStartableStatus() + self.configureUI() } @available(*, unavailable) @@ -113,9 +112,9 @@ final class CreateRoomView: UIView { self.addSubview(self.roomTitleView) self.addSubview(self.roomParticipantsView) self.addSubview(self.roomDateView) - self.addSubview(self.roomDataCheckView) + self.addSubview(self.roomInfoView) - [self.roomTitleView, self.roomParticipantsView, self.roomDateView, self.roomDataCheckView] + [self.roomTitleView, self.roomParticipantsView, self.roomDateView, self.roomInfoView] .forEach { $0.snp.makeConstraints { $0.top.equalTo(self.titleLabel.snp.bottom).offset(66) @@ -134,6 +133,7 @@ final class CreateRoomView: UIView { self.closeButton.addAction(closeAction, for: .touchUpInside) let nextAction = UIAction { [weak self] _ in + self?.runActionAtStep(at: self?.roomStep?.rawValue ?? 0) self?.moveToNextStep() } self.nextButton.addAction(nextAction, for: .touchUpInside) @@ -178,7 +178,77 @@ final class CreateRoomView: UIView { } private func setupHiddenStepView(at step: Int) { - + self.roomTitleView.isHidden = !(step == 0) + self.roomParticipantsView.isHidden = !(step == 1) + self.roomDateView.isHidden = !(step == 2) + self.roomInfoView.isHidden = !(step == 3) + } + + private func setupHiddenBackButton(at step: Int) { + self.backButton.isHidden = !(step == 1 || step == 2 || step == 3) + } + + private func setupRoomTitleViewAnimation() { + self.roomParticipantsView.fadeOut() + self.roomTitleView.fadeIn() + } + + private func setupRoomParticipatesViewAnimation() { + self.roomTitleView.fadeOut() + self.roomParticipantsView.fadeIn() + self.roomDateView.fadeOut() + } + + private func setupRoomDateViewAnimation() { + self.roomParticipantsView.fadeOut() + self.roomDateView.fadeIn() + self.roomInfoView.fadeOut() + } + + private func setupRoomDataCheckViewAnimation() { + self.roomDateView.fadeOut() + self.roomInfoView.fadeIn() + } + + private func runActionAtStep(at step: Int) { + switch step { + case 0: + self.setupTitle() + case 1: + self.setupParticipates() + self.disabledNextButton() + case 2: + self.setupDate() + case 3: + print("") + default: + break + } + } + + private func setupTitle() { + guard let title = self.roomTitleView.roomsNameTextField.text else { return } + self.roomInfoView.name = title + } + + private func setupParticipates() { + let participates = Int(self.roomParticipantsView.personSlider.value) + self.roomInfoView.participants = participates + } + + private func setupDate() { + let startDate = self.roomDateView.calendarView.getTempStartDate() + let endDate = self.roomDateView.calendarView.getTempEndDate() + let roomDateRange = "\(startDate) ~ \(endDate)" + self.roomInfoView.dateRange = roomDateRange + } + + private func disabledNextButton() { + self.nextButton.isDisabled = true + } + + private func configureUI() { + self.roomStep = .inputTitle } func configureDelegate(_ delegate: CreateRoomViewDelegate) { @@ -192,7 +262,20 @@ final class CreateRoomView: UIView { } func manageStepView(step: Int) { - + self.setupHiddenStepView(at: step) + self.setupHiddenBackButton(at: step) + switch step { + case 0: + self.setupRoomTitleViewAnimation() + case 1: + self.setupRoomParticipatesViewAnimation() + case 2: + self.setupRoomDateViewAnimation() + case 3: + self.setupRoomDataCheckViewAnimation() + default: + break + } } // MARK: - selector From 0ac62627cdab743759d12b6c85dcf74d13179634 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:26:54 +0900 Subject: [PATCH 292/468] =?UTF-8?q?[REFACTOR]=20API=20=EC=97=B0=EA=B2=B0?= =?UTF-8?q?=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreateRoom/CreateRoomViewController.swift | 48 ++++++++++++++++--- .../CreateRoom/View/CreateRoomView.swift | 40 ++++++++++++---- 2 files changed, 72 insertions(+), 16 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index 93c94f653..cf914f307 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -19,7 +19,7 @@ final class CreateRoomViewController: BaseViewController { // MARK: - property - + private let roomService: RoomProtocol = RoomAPI(apiService: APIService()) // MARK: - init @@ -60,6 +60,37 @@ final class CreateRoomViewController: BaseViewController { private func configureDelegation() { self.createRoomView.configureDelegate(self) } + + private func pushDetailWaitViewController(roomId: Int) { + guard let navigationController = self.presentingViewController as? UINavigationController else { return } + + let viewController = DetailWaitViewController(viewModel: DetailWaitViewModel(roomIndex: roomId, + detailWaitService: DetailWaitService(api: DetailWaitAPI(apiService: APIService())))) + + navigationController.popViewController(animated: true) + navigationController.pushViewController(viewController, animated: false) + + self.dismiss(animated: true) { + NotificationCenter.default.post(name: .createRoomInvitedCode, object: nil) + } + } + + // MARK: - network + + private func requestCreateRoom(room: CreateRoomDTO) { + Task { + do { + guard let roomId = try await self.roomService.postCreateRoom(body: room) else { return } + self.pushDetailWaitViewController(roomId: roomId) + } catch NetworkError.serverError { + print("server Error") + } catch NetworkError.encodingError { + print("encoding Error") + } catch NetworkError.clientError(let message) { + print("client Error: \(String(describing: message))") + } + } + } } extension CreateRoomViewController: CreateRoomViewDelegate { @@ -67,10 +98,15 @@ extension CreateRoomViewController: CreateRoomViewDelegate { self.dismiss(animated: true) } - func pushChooseCharacterViewController(roomInfo: RoomDTO?) { - let viewController = ChooseCharacterViewController(statusMode: .createRoom, roomId: nil) - viewController.roomInfo = roomInfo - - self.navigationController?.pushViewController(viewController, animated: true) + func requestCreateRoom(roomInfo: RoomInfo, colorIndex: Int) { + guard let roomTitle = roomInfo.title, + let roomCapacity = roomInfo.capacity, + let roomStartDate = roomInfo.startDate, + let roomEndDate = roomInfo.endDate else { return } + self.requestCreateRoom(room: CreateRoomDTO(room: RoomDTO(title: roomTitle, + capacity: roomCapacity, + startDate: roomStartDate, + endDate: roomEndDate), + member: MemberDTO(colorIndex: colorIndex))) } } diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index 7c6648459..9c4a4e5be 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -11,13 +11,13 @@ import SnapKit protocol CreateRoomViewDelegate: AnyObject { func didTapCloseButton() - func pushChooseCharacterViewController(roomInfo: RoomDTO?) + func requestCreateRoom(roomInfo: RoomInfo, colorIndex: Int) } final class CreateRoomView: UIView { private enum CreateRoomStep: Int { - case inputTitle = 0, inputParticipants, inputDate, checkRoom + case inputTitle = 0, inputParticipants, inputDate, checkRoom, chooseCharacter } // MARK: - ui component @@ -53,10 +53,11 @@ final class CreateRoomView: UIView { private let roomParticipantsView: InputParticipantsView = InputParticipantsView() private let roomDateView: InputDateView = InputDateView() private let roomInfoView: CheckRoomInfoView = CheckRoomInfoView() + private let characterCollectionView: CharacterCollectionView = CharacterCollectionView() // MARK: - property - private var roomInfo: RoomDTO? + private var roomInfo: RoomInfo? private weak var delegate: CreateRoomViewDelegate? private var roomStep: CreateRoomStep? = .inputTitle { willSet(step) { @@ -113,8 +114,9 @@ final class CreateRoomView: UIView { self.addSubview(self.roomParticipantsView) self.addSubview(self.roomDateView) self.addSubview(self.roomInfoView) + self.addSubview(self.characterCollectionView) - [self.roomTitleView, self.roomParticipantsView, self.roomDateView, self.roomInfoView] + [self.roomTitleView, self.roomParticipantsView, self.roomDateView, self.roomInfoView, self.characterCollectionView] .forEach { $0.snp.makeConstraints { $0.top.equalTo(self.titleLabel.snp.bottom).offset(66) @@ -182,10 +184,11 @@ final class CreateRoomView: UIView { self.roomParticipantsView.isHidden = !(step == 1) self.roomDateView.isHidden = !(step == 2) self.roomInfoView.isHidden = !(step == 3) + self.characterCollectionView.isHidden = !(step == 4) } private func setupHiddenBackButton(at step: Int) { - self.backButton.isHidden = !(step == 1 || step == 2 || step == 3) + self.backButton.isHidden = !(step == 1 || step == 2 || step == 3 || step == 4) } private func setupRoomTitleViewAnimation() { @@ -208,6 +211,12 @@ final class CreateRoomView: UIView { private func setupRoomDataCheckViewAnimation() { self.roomDateView.fadeOut() self.roomInfoView.fadeIn() + self.characterCollectionView.fadeOut() + } + + private func setupChooseCharacterViewAnimation() { + self.roomInfoView.fadeOut() + self.characterCollectionView.fadeIn() } private func runActionAtStep(at step: Int) { @@ -220,7 +229,16 @@ final class CreateRoomView: UIView { case 2: self.setupDate() case 3: - print("") + break + case 4: + let colorIndex = self.characterCollectionView.characterIndex + self.delegate?.requestCreateRoom(roomInfo: RoomInfo(id: nil, + capacity: self.roomInfoView.participants, + title: self.roomInfoView.name, + startDate: "20\(self.roomDateView.calendarView.getTempStartDate())", + endDate: "20\(self.roomDateView.calendarView.getTempEndDate())", + state: nil), + colorIndex: colorIndex) default: break } @@ -235,6 +253,10 @@ final class CreateRoomView: UIView { let participates = Int(self.roomParticipantsView.personSlider.value) self.roomInfoView.participants = participates } + + private func disabledNextButton() { + self.nextButton.isDisabled = true + } private func setupDate() { let startDate = self.roomDateView.calendarView.getTempStartDate() @@ -243,10 +265,6 @@ final class CreateRoomView: UIView { self.roomInfoView.dateRange = roomDateRange } - private func disabledNextButton() { - self.nextButton.isDisabled = true - } - private func configureUI() { self.roomStep = .inputTitle } @@ -273,6 +291,8 @@ final class CreateRoomView: UIView { self.setupRoomDateViewAnimation() case 3: self.setupRoomDataCheckViewAnimation() + case 4: + self.setupChooseCharacterViewAnimation() default: break } From 3fa03dea873c61f20cb86520b4dccd8d4853a571 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:31:48 +0900 Subject: [PATCH 293/468] =?UTF-8?q?[CHORE]=20=EB=B3=80=EC=88=98=EB=AA=85?= =?UTF-8?q?=20capacity=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 8 ++--- .../CreateRoom/CreateRoomViewController.swift | 2 -- .../UIComponent/CheckRoomInfoView.swift | 4 +-- ...antsView.swift => InputCapacityView.swift} | 2 +- .../CreateRoom/View/CreateRoomView.swift | 34 +++++++++---------- 5 files changed, 24 insertions(+), 26 deletions(-) rename Manito/Manito/Screens/CreateRoom/UIComponent/{InputParticipantsView.swift => InputCapacityView.swift} (98%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index ef3df5792..94af5b7cf 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -77,7 +77,7 @@ 7E0C5C382855B73100F698D1 /* Splash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7E0C5C372855B73100F698D1 /* Splash.storyboard */; }; 7E15F67E28B35B3D00441305 /* TextLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E15F67D28B35B3D00441305 /* TextLiteral.swift */; }; 7E3058C62854B47F00489E6A /* InputTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C52854B47F00489E6A /* InputTitleView.swift */; }; - 7E3058C82854B64D00489E6A /* InputParticipantsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C72854B64D00489E6A /* InputParticipantsView.swift */; }; + 7E3058C82854B64D00489E6A /* InputCapacityView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C72854B64D00489E6A /* InputCapacityView.swift */; }; 7E3058CA2854B7A900489E6A /* InputDateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C92854B7A900489E6A /* InputDateView.swift */; }; 7E7542B32923744300D725CB /* ToastPopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E7542B22923744300D725CB /* ToastPopupView.swift */; }; 7E77DB0428BF9A6700E95D4B /* RoomProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E77DB0328BF9A6700E95D4B /* RoomProtocol.swift */; }; @@ -278,7 +278,7 @@ 7E0C5C372855B73100F698D1 /* Splash.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Splash.storyboard; sourceTree = ""; }; 7E15F67D28B35B3D00441305 /* TextLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextLiteral.swift; sourceTree = ""; }; 7E3058C52854B47F00489E6A /* InputTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputTitleView.swift; sourceTree = ""; }; - 7E3058C72854B64D00489E6A /* InputParticipantsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputParticipantsView.swift; sourceTree = ""; }; + 7E3058C72854B64D00489E6A /* InputCapacityView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputCapacityView.swift; sourceTree = ""; }; 7E3058C92854B7A900489E6A /* InputDateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputDateView.swift; sourceTree = ""; }; 7E7542B22923744300D725CB /* ToastPopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToastPopupView.swift; sourceTree = ""; }; 7E77DB0328BF9A6700E95D4B /* RoomProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomProtocol.swift; sourceTree = ""; }; @@ -588,7 +588,7 @@ isa = PBXGroup; children = ( 7E3058C52854B47F00489E6A /* InputTitleView.swift */, - 7E3058C72854B64D00489E6A /* InputParticipantsView.swift */, + 7E3058C72854B64D00489E6A /* InputCapacityView.swift */, 7E3058C92854B7A900489E6A /* InputDateView.swift */, D7B6C97B2858B2D40024F326 /* CheckRoomInfoView.swift */, D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */, @@ -1348,7 +1348,7 @@ CBBFF77C287AE491006A5964 /* DeveloperInfoViewCell.swift in Sources */, B517C04E28D1FE660008BED0 /* TokenProtocol.swift in Sources */, 392EC7812855D17D006918A9 /* DetailWaitTitleView.swift in Sources */, - 7E3058C82854B64D00489E6A /* InputParticipantsView.swift in Sources */, + 7E3058C82854B64D00489E6A /* InputCapacityView.swift in Sources */, CBA15C94285CE1A80051EDE2 /* ChooseCharacterViewController.swift in Sources */, 39EEF65E28CB3CFE00437654 /* LoginEndPoint.swift in Sources */, 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */, diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index cf914f307..ce2c66d29 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -11,8 +11,6 @@ import SnapKit final class CreateRoomViewController: BaseViewController { - - // MARK: - ui component private lazy var createRoomView: CreateRoomView = CreateRoomView() diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift index 5109c52e0..ed8e6c298 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift @@ -44,12 +44,12 @@ final class CheckRoomInfoView: UIView { self.dateLabel.text = newValue } } - var name: String = "" { + var title: String = "" { willSet { self.nameLabel.text = newValue } } - var participants: Int = 0 { + var capacity: Int = 0 { willSet { self.personLabel.text = "\(newValue.description)" + TextLiteral.per } diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputParticipantsView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift similarity index 98% rename from Manito/Manito/Screens/CreateRoom/UIComponent/InputParticipantsView.swift rename to Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift index f9362c681..17a61b3c6 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputParticipantsView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -final class InputParticipantsView: UIView { +final class InputCapacityView: UIView { // MARK: - ui component diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index 9c4a4e5be..df4c2f4a8 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -17,7 +17,7 @@ protocol CreateRoomViewDelegate: AnyObject { final class CreateRoomView: UIView { private enum CreateRoomStep: Int { - case inputTitle = 0, inputParticipants, inputDate, checkRoom, chooseCharacter + case inputTitle = 0, inputCapacity, inputDate, checkRoom, chooseCharacter } // MARK: - ui component @@ -50,7 +50,7 @@ final class CreateRoomView: UIView { return button }() private let roomTitleView: InputTitleView = InputTitleView() - private let roomParticipantsView: InputParticipantsView = InputParticipantsView() + private let roomCapacityView: InputCapacityView = InputCapacityView() private let roomDateView: InputDateView = InputDateView() private let roomInfoView: CheckRoomInfoView = CheckRoomInfoView() private let characterCollectionView: CharacterCollectionView = CharacterCollectionView() @@ -111,12 +111,12 @@ final class CreateRoomView: UIView { } self.addSubview(self.roomTitleView) - self.addSubview(self.roomParticipantsView) + self.addSubview(self.roomCapacityView) self.addSubview(self.roomDateView) self.addSubview(self.roomInfoView) self.addSubview(self.characterCollectionView) - [self.roomTitleView, self.roomParticipantsView, self.roomDateView, self.roomInfoView, self.characterCollectionView] + [self.roomTitleView, self.roomCapacityView, self.roomDateView, self.roomInfoView, self.characterCollectionView] .forEach { $0.snp.makeConstraints { $0.top.equalTo(self.titleLabel.snp.bottom).offset(66) @@ -181,7 +181,7 @@ final class CreateRoomView: UIView { private func setupHiddenStepView(at step: Int) { self.roomTitleView.isHidden = !(step == 0) - self.roomParticipantsView.isHidden = !(step == 1) + self.roomCapacityView.isHidden = !(step == 1) self.roomDateView.isHidden = !(step == 2) self.roomInfoView.isHidden = !(step == 3) self.characterCollectionView.isHidden = !(step == 4) @@ -192,18 +192,18 @@ final class CreateRoomView: UIView { } private func setupRoomTitleViewAnimation() { - self.roomParticipantsView.fadeOut() + self.roomCapacityView.fadeOut() self.roomTitleView.fadeIn() } - private func setupRoomParticipatesViewAnimation() { + private func setupRoomCapacityViewAnimation() { self.roomTitleView.fadeOut() - self.roomParticipantsView.fadeIn() + self.roomCapacityView.fadeIn() self.roomDateView.fadeOut() } private func setupRoomDateViewAnimation() { - self.roomParticipantsView.fadeOut() + self.roomCapacityView.fadeOut() self.roomDateView.fadeIn() self.roomInfoView.fadeOut() } @@ -224,7 +224,7 @@ final class CreateRoomView: UIView { case 0: self.setupTitle() case 1: - self.setupParticipates() + self.setupCapacity() self.disabledNextButton() case 2: self.setupDate() @@ -233,8 +233,8 @@ final class CreateRoomView: UIView { case 4: let colorIndex = self.characterCollectionView.characterIndex self.delegate?.requestCreateRoom(roomInfo: RoomInfo(id: nil, - capacity: self.roomInfoView.participants, - title: self.roomInfoView.name, + capacity: self.roomInfoView.capacity, + title: self.roomInfoView.title, startDate: "20\(self.roomDateView.calendarView.getTempStartDate())", endDate: "20\(self.roomDateView.calendarView.getTempEndDate())", state: nil), @@ -246,12 +246,12 @@ final class CreateRoomView: UIView { private func setupTitle() { guard let title = self.roomTitleView.roomsNameTextField.text else { return } - self.roomInfoView.name = title + self.roomInfoView.title = title } - private func setupParticipates() { - let participates = Int(self.roomParticipantsView.personSlider.value) - self.roomInfoView.participants = participates + private func setupCapacity() { + let capacity = Int(self.roomCapacityView.personSlider.value) + self.roomInfoView.capacity = capacity } private func disabledNextButton() { @@ -286,7 +286,7 @@ final class CreateRoomView: UIView { case 0: self.setupRoomTitleViewAnimation() case 1: - self.setupRoomParticipatesViewAnimation() + self.setupRoomCapacityViewAnimation() case 2: self.setupRoomDateViewAnimation() case 3: From 8f46b3dfb4b7f6f5a380a8886a6fb4e2d0d1ef26 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 7 Aug 2023 22:10:01 +0900 Subject: [PATCH 294/468] =?UTF-8?q?[REFACTOR]=20=EB=B7=B0=EB=A5=BC=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC=ED=95=A8=EC=97=90=20=EB=94=B0=EB=A5=B8=20sta?= =?UTF-8?q?tus=20=EC=BD=94=EB=93=9C=20=EC=82=AD=EC=A0=9C=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChooseCharacterViewController.swift | 63 +++---------------- .../ParticipateRoomViewController.swift | 2 +- 2 files changed, 9 insertions(+), 56 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index 668f72d75..7367228df 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -10,11 +10,6 @@ import UIKit import SnapKit final class ChooseCharacterViewController: BaseViewController { - // FIXME: Status 삭제예정 - enum Status { - case createRoom - case enterRoom - } // MARK: - ui component @@ -23,16 +18,12 @@ final class ChooseCharacterViewController: BaseViewController { // MARK: - property private let roomService: RoomProtocol = RoomAPI(apiService: APIService()) - // FIXME: 삭제예정 - private var statusMode: Status - private var roomId: Int? - // FIXME: private 변경 예정 - var roomInfo: RoomDTO? + private let roomId: Int? + private var roomInfo: RoomDTO? // MARK: - init - init(statusMode: Status, roomId: Int?) { - self.statusMode = statusMode + init(roomId: Int?) { self.roomId = roomId super.init() } @@ -78,40 +69,17 @@ final class ChooseCharacterViewController: BaseViewController { } private func didTapEnterButton(characterIndex: Int) { - // FIXME: statusMode 삭제 이후 enterRoom 변경 예정 - switch self.statusMode { - case .createRoom: - guard let roomInfo = self.roomInfo else { return } - self.requestCreateRoom(room: CreateRoomDTO(room: RoomDTO(title: roomInfo.title, - capacity: roomInfo.capacity, - startDate: roomInfo.startDate, - endDate: roomInfo.endDate) , - member: MemberDTO(colorIndex: characterIndex))) - case .enterRoom: - self.requestJoinRoom(characterIndex: characterIndex) - } + self.requestJoinRoom(characterIndex: characterIndex) } - private func pushDetailWaitViewController(status: Status, roomId: Int) { + private func pushDetailWaitViewController(roomId: Int) { guard let navigationController = self.presentingViewController as? UINavigationController else { return } let viewController = DetailWaitViewController(viewModel: DetailWaitViewModel(roomIndex: roomId, detailWaitService: DetailWaitService(api: DetailWaitAPI(apiService: APIService())))) - - switch status { - case .createRoom: - navigationController.popViewController(animated: true) - navigationController.pushViewController(viewController, animated: false) - - self.dismiss(animated: true) { - NotificationCenter.default.post(name: .createRoomInvitedCode, object: nil) - } - case .enterRoom: - self.dismiss(animated: true) { - navigationController.pushViewController(viewController, animated: true) - } + self.dismiss(animated: true) { + navigationController.pushViewController(viewController, animated: true) } - } private func makeAlertWhenAlreadyJoin() { @@ -129,7 +97,7 @@ final class ChooseCharacterViewController: BaseViewController { let status = try await self.roomService.dispatchJoinRoom(roodId: roomId.description, dto: MemberDTO(colorIndex: characterIndex)) if status == 201 { - self.pushDetailWaitViewController(status: .enterRoom, roomId: roomId) + self.pushDetailWaitViewController(roomId: roomId) } } catch NetworkError.serverError { print("server Error") @@ -141,21 +109,6 @@ final class ChooseCharacterViewController: BaseViewController { } } } - - private func requestCreateRoom(room: CreateRoomDTO) { - Task { - do { - guard let roomId = try await self.roomService.postCreateRoom(body: room) else { return } - self.pushDetailWaitViewController(status: .createRoom, roomId: roomId) - } catch NetworkError.serverError { - print("server Error") - } catch NetworkError.encodingError { - print("encoding Error") - } catch NetworkError.clientError(let message) { - print("client Error: \(String(describing: message))") - } - } - } } extension ChooseCharacterViewController: ChooseCharacterViewDelegate { diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift index ec026c061..788295efa 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift @@ -93,6 +93,6 @@ extension ParticipateRoomViewController: ParticipateRoomViewDelegate { } func observeNextNotification(roomId: Int) { - self.navigationController?.pushViewController(ChooseCharacterViewController(statusMode: .enterRoom, roomId: roomId), animated: true) + self.navigationController?.pushViewController(ChooseCharacterViewController(roomId: roomId), animated: true) } } From 66753733568a1156ff2ca5f3348435b167b8a330 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 7 Aug 2023 23:36:47 +0900 Subject: [PATCH 295/468] =?UTF-8?q?[CHORE]=20api=20=EC=97=B0=EA=B2=B0=20(#?= =?UTF-8?q?474)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Network/EndPoint/SettingEndPoint.swift | 28 ++++++++++++------- .../Setting/SettingViewController.swift | 14 ++++++---- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/Manito/Manito/Network/EndPoint/SettingEndPoint.swift b/Manito/Manito/Network/EndPoint/SettingEndPoint.swift index 119706ca5..ed903d05e 100644 --- a/Manito/Manito/Network/EndPoint/SettingEndPoint.swift +++ b/Manito/Manito/Network/EndPoint/SettingEndPoint.swift @@ -55,15 +55,23 @@ extension SettingEndPoint: EndPointable { } func createRequest() -> NetworkRequest { - var headers: [String: String] = [:] - headers["Content-Type"] = "application/json" - headers["authorization"] = "Bearer \(UserDefaultStorage.accessToken)" - - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) + switch self { + case .editUserInfo(_): + var headers: [String: String] = [:] + headers["Content-Type"] = "application/json" + headers["authorization"] = "Bearer \(UserDefaultStorage.accessToken)" + + return NetworkRequest(url: self.url, + headers: headers, + reqBody: self.requestBody, + reqTimeout: self.requestTimeOut, + httpMethod: self.httpMethod + ) + case .deleteMember: + return NetworkRequest(url: self.url, + reqBody: self.requestBody, + reqTimeout: self.requestTimeOut, + httpMethod: self.httpMethod) + } } } diff --git a/Manito/Manito/Screens/Setting/SettingViewController.swift b/Manito/Manito/Screens/Setting/SettingViewController.swift index 83dff1413..388469af4 100644 --- a/Manito/Manito/Screens/Setting/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/SettingViewController.swift @@ -107,12 +107,14 @@ extension SettingViewController: SettingViewDelegate { } func withdrawalButtonDidTap() { - self.requestDeleteMember() { [weak self] result in - switch result { - case .success: - self?.navigationController?.popViewController(animated: true) - case .failure: - print("error") + self.makeRequestAlert(title: "경고", message: "회원탈퇴 시 지금까지 내용이 전부 삭제됩니다. \n 탈퇴 하시겠습니까?", okTitle: "탈퇴") { [weak self] _ in + self?.requestDeleteMember() { [weak self] result in + switch result { + case .success: + self?.navigationController?.popViewController(animated: true) + case .failure: + print("error") + } } } } From bf7bde894340ea0ff20f2acc582557e318a715a0 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 8 Aug 2023 16:30:21 +0900 Subject: [PATCH 296/468] =?UTF-8?q?[CHORE]=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EC=98=AC=EB=9D=BC=EC=98=A4=EB=8A=94=20=EC=95=A0=EB=8B=88?= =?UTF-8?q?=EB=A9=94=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index df4c2f4a8..516e5a81a 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -72,6 +72,7 @@ final class CreateRoomView: UIView { super.init(frame: frame) self.setupLayout() self.setupAction() + self.setupNotificationCenter() self.detectStartableStatus() self.configureUI() } @@ -223,6 +224,7 @@ final class CreateRoomView: UIView { switch step { case 0: self.setupTitle() + self.endEditing(true) case 1: self.setupCapacity() self.disabledNextButton() From 7ee915ad9908b33f5120ca0cd27647679496afc4 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 8 Aug 2023 16:33:25 +0900 Subject: [PATCH 297/468] =?UTF-8?q?[CHORE]=20lazy=20var=20->=20let=20?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index ce2c66d29..3835125ee 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -13,7 +13,7 @@ final class CreateRoomViewController: BaseViewController { // MARK: - ui component - private lazy var createRoomView: CreateRoomView = CreateRoomView() + private let createRoomView: CreateRoomView = CreateRoomView() // MARK: - property From 6216ad0cc09938964d0ea60b9e7d1ad0ee250404 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Fri, 11 Aug 2023 15:34:41 +0900 Subject: [PATCH 298/468] =?UTF-8?q?[CHORE]=20Input,=20Output=20=ED=8B=80?= =?UTF-8?q?=EC=9E=A1=EA=B8=B0=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 12 ++++++ .../ViewModel/CreateRoomViewModel.swift | 42 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 94af5b7cf..64b0be2fd 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -190,6 +190,7 @@ D75E8C7F28D76FFB004A6C41 /* LetterCountBadgeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D75E8C7E28D76FFB004A6C41 /* LetterCountBadgeView.swift */; }; D77224DF285DDAB7008B760B /* Notification+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D77224DE285DDAB7008B760B /* Notification+Extension.swift */; }; D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = D777D2C828C7780E008655BD /* URLLiteral.swift */; }; + D79E9D8A2A826E0200C031F0 /* CreateRoomViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D79E9D892A826E0200C031F0 /* CreateRoomViewModel.swift */; }; D7B6C97C2858B2D40024F326 /* CheckRoomInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B6C97B2858B2D40024F326 /* CheckRoomInfoView.swift */; }; D7C4A1A72A0B2EB000C3AE4C /* CharacterCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */; }; D7C4A1A92A0B895300C3AE4C /* ChooseCharacterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */; }; @@ -389,6 +390,7 @@ D75E8C7E28D76FFB004A6C41 /* LetterCountBadgeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterCountBadgeView.swift; sourceTree = ""; }; D77224DE285DDAB7008B760B /* Notification+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Notification+Extension.swift"; sourceTree = ""; }; D777D2C828C7780E008655BD /* URLLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLLiteral.swift; sourceTree = ""; }; + D79E9D892A826E0200C031F0 /* CreateRoomViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomViewModel.swift; sourceTree = ""; }; D7B6C97B2858B2D40024F326 /* CheckRoomInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckRoomInfoView.swift; sourceTree = ""; }; D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterCollectionView.swift; sourceTree = ""; }; D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooseCharacterView.swift; sourceTree = ""; }; @@ -807,6 +809,7 @@ B5F524E528519ACA00614FF7 /* CreateRoom */ = { isa = PBXGroup; children = ( + D79E9D882A826D7900C031F0 /* ViewModel */, D70220212A7A22DC0024BACD /* View */, 7E3058C42854B45300489E6A /* UIComponent */, B5F525052851A05500614FF7 /* CreateRoomViewController.swift */, @@ -1183,6 +1186,14 @@ path = Component; sourceTree = ""; }; + D79E9D882A826D7900C031F0 /* ViewModel */ = { + isa = PBXGroup; + children = ( + D79E9D892A826E0200C031F0 /* CreateRoomViewModel.swift */, + ); + path = ViewModel; + sourceTree = ""; + }; D7C4A1AE2A0E51F500C3AE4C /* View */ = { isa = PBXGroup; children = ( @@ -1341,6 +1352,7 @@ 39C957ED287AE4D100A04A2B /* MainEndPoint.swift in Sources */, 39C957EF287AEBB400A04A2B /* Endpointable.swift in Sources */, B5F525292851A2A400614FF7 /* Logger.swift in Sources */, + D79E9D8A2A826E0200C031F0 /* CreateRoomViewModel.swift in Sources */, B50B1AFF2856D3820080992C /* CreateLetterPhotoView.swift in Sources */, 397A241A28BA532A00454E4F /* FriendList.swift in Sources */, B5F31C5628BFA87700F61D0F /* Requestable.swift in Sources */, diff --git a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift new file mode 100644 index 000000000..6cb807dcb --- /dev/null +++ b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift @@ -0,0 +1,42 @@ +// +// CreateRoomViewModel.swift +// Manito +// +// Created by 이성호 on 2023/08/08. +// + +import Combine +import Foundation + +final class CreateRoomViewModel { + + // MARK: - property + + private var cancellable = Set() + + struct Input { + let textFieldValueChanged: PassthroughSubject + } + + struct Output { + let title: AnyPublisher + } + + func transform(_ input: Input) -> Output { + + let title = input.textFieldValueChanged + .eraseToAnyPublisher() + + + return Output(title: title) + } + // MARK: - init + + + + // MARK: - func + + + + // MARK: - network +} From d9f2a63236069bd3199cd4c273eefc55f4fb9002 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Fri, 11 Aug 2023 17:26:59 +0900 Subject: [PATCH 299/468] =?UTF-8?q?[CHORE]=20=EC=95=88=EC=93=B0=EC=9D=B4?= =?UTF-8?q?=EB=8A=94=20=ED=95=A8=EC=88=98=20=EC=82=AD=EC=A0=9C,=20?= =?UTF-8?q?=EB=93=A4=EC=97=AC=EC=93=B0=EA=B8=B0=20=EC=A0=9C=EA=B1=B0=20(#4?= =?UTF-8?q?03)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChooseCharacter/ChooseCharacterViewController.swift | 6 +----- Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index 7367228df..1d8cfb57c 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -68,10 +68,6 @@ final class ChooseCharacterViewController: BaseViewController { self.chooseCharacterView.configureNavigationItem(navigationController) } - private func didTapEnterButton(characterIndex: Int) { - self.requestJoinRoom(characterIndex: characterIndex) - } - private func pushDetailWaitViewController(roomId: Int) { guard let navigationController = self.presentingViewController as? UINavigationController else { return } @@ -121,6 +117,6 @@ extension ChooseCharacterViewController: ChooseCharacterViewDelegate { } func joinButtonDidTap(characterIndex: Int) { - self.didTapEnterButton(characterIndex: characterIndex) + self.requestJoinRoom(characterIndex: characterIndex) } } diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index 516e5a81a..26f74dd65 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -17,7 +17,7 @@ protocol CreateRoomViewDelegate: AnyObject { final class CreateRoomView: UIView { private enum CreateRoomStep: Int { - case inputTitle = 0, inputCapacity, inputDate, checkRoom, chooseCharacter + case inputTitle = 0, inputCapacity, inputDate, checkRoom, chooseCharacter } // MARK: - ui component From 8d2aeb334c6ba87f4ed3f4ea27b6cad0fbc4a963 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 15 Aug 2023 23:44:35 +0900 Subject: [PATCH 300/468] =?UTF-8?q?[ADD]=20xcconfig=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80(#484)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Configuration/Dev/Dev.xcconfig | 9 ++++++++ Manito/Configuration/Prod/Prod.xcconfig | 9 ++++++++ Manito/Manito.xcodeproj/project.pbxproj | 28 +++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 Manito/Configuration/Dev/Dev.xcconfig create mode 100644 Manito/Configuration/Prod/Prod.xcconfig diff --git a/Manito/Configuration/Dev/Dev.xcconfig b/Manito/Configuration/Dev/Dev.xcconfig new file mode 100644 index 000000000..53551a43d --- /dev/null +++ b/Manito/Configuration/Dev/Dev.xcconfig @@ -0,0 +1,9 @@ +// +// Dev.xcconfig +// Manito +// +// Created by SHIN YOON AH on 2023/08/15. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 diff --git a/Manito/Configuration/Prod/Prod.xcconfig b/Manito/Configuration/Prod/Prod.xcconfig new file mode 100644 index 000000000..74dfd9045 --- /dev/null +++ b/Manito/Configuration/Prod/Prod.xcconfig @@ -0,0 +1,9 @@ +// +// Prod.xcconfig +// Manito +// +// Created by SHIN YOON AH on 2023/08/15. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index f0b0500ac..c49a8aca6 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -298,6 +298,8 @@ B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenEndPoint.swift; sourceTree = ""; }; B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenAPI.swift; sourceTree = ""; }; B517C04D28D1FE660008BED0 /* TokenProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenProtocol.swift; sourceTree = ""; }; + B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Dev.xcconfig; sourceTree = ""; }; + B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Prod.xcconfig; sourceTree = ""; }; B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterImageView.swift; sourceTree = ""; }; B54741E929A494E200B75BA3 /* LetterImageError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterImageError.swift; sourceTree = ""; }; B55B482129C3723B00CFFDAD /* URLRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLRepresentable.swift; sourceTree = ""; }; @@ -634,6 +636,31 @@ path = Cell; sourceTree = ""; }; + B53AD40F2A8BC69700B83B33 /* Configuration */ = { + isa = PBXGroup; + children = ( + B53AD4112A8BC6A400B83B33 /* Dev */, + B53AD4102A8BC69E00B83B33 /* Prod */, + ); + path = Configuration; + sourceTree = ""; + }; + B53AD4102A8BC69E00B83B33 /* Prod */ = { + isa = PBXGroup; + children = ( + B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */, + ); + path = Prod; + sourceTree = ""; + }; + B53AD4112A8BC6A400B83B33 /* Dev */ = { + isa = PBXGroup; + children = ( + B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */, + ); + path = Dev; + sourceTree = ""; + }; B54741DE29A3A4BA00B75BA3 /* Views */ = { isa = PBXGroup; children = ( @@ -737,6 +764,7 @@ isa = PBXGroup; children = ( B55BCEB528D99F8600AF7E45 /* Settings.bundle */, + B53AD40F2A8BC69700B83B33 /* Configuration */, B5F524CD28519AA000614FF7 /* Manito */, 398B1CBA2A12415C00DEFCEC /* ManitoTests */, B57CB3022A763BB200474042 /* Packages */, From f2a30f9ebe352f36083ae085c79db80262a58444 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 16 Aug 2023 12:30:08 +0900 Subject: [PATCH 301/468] =?UTF-8?q?[ADD]=20Configurations=20=EC=98=81?= =?UTF-8?q?=EC=97=AD=EC=97=90=20Configuration=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C(#484)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Configuration/Dev/Dev.xcconfig | 2 ++ Manito/Configuration/Prod/Prod.xcconfig | 2 ++ Manito/Manito.xcodeproj/project.pbxproj | 48 ++++++++++++++----------- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/Manito/Configuration/Dev/Dev.xcconfig b/Manito/Configuration/Dev/Dev.xcconfig index 53551a43d..21eb6793b 100644 --- a/Manito/Configuration/Dev/Dev.xcconfig +++ b/Manito/Configuration/Dev/Dev.xcconfig @@ -7,3 +7,5 @@ // Configuration settings file format documentation can be found at: // https://help.apple.com/xcode/#/dev745c5c974 + +BUNDLE_DISPLAY_NAME = 애니또테스트 diff --git a/Manito/Configuration/Prod/Prod.xcconfig b/Manito/Configuration/Prod/Prod.xcconfig index 74dfd9045..70ecc1f91 100644 --- a/Manito/Configuration/Prod/Prod.xcconfig +++ b/Manito/Configuration/Prod/Prod.xcconfig @@ -7,3 +7,5 @@ // Configuration settings file format documentation can be found at: // https://help.apple.com/xcode/#/dev745c5c974 + +BUNDLE_DISPLAY_NAME = 애니또 diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index c49a8aca6..deedc4f10 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -1545,8 +1545,9 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - 398B1CBF2A12415C00DEFCEC /* Debug */ = { + 398B1CBF2A12415C00DEFCEC /* Dev */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; @@ -1566,10 +1567,11 @@ TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Manito.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Manito"; }; - name = Debug; + name = Dev; }; - 398B1CC02A12415C00DEFCEC /* Release */ = { + 398B1CC02A12415C00DEFCEC /* Prod */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; @@ -1589,10 +1591,11 @@ TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Manito.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Manito"; }; - name = Release; + name = Prod; }; - B5F524DD28519AA100614FF7 /* Debug */ = { + B5F524DD28519AA100614FF7 /* Dev */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -1650,10 +1653,11 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; - name = Debug; + name = Dev; }; - B5F524DE28519AA100614FF7 /* Release */ = { + B5F524DE28519AA100614FF7 /* Prod */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -1705,10 +1709,11 @@ SWIFT_OPTIMIZATION_LEVEL = "-O"; VALIDATE_PRODUCT = YES; }; - name = Release; + name = Prod; }; - B5F524E028519AA100614FF7 /* Debug */ = { + B5F524E028519AA100614FF7 /* Dev */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -1743,10 +1748,11 @@ SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; - name = Debug; + name = Dev; }; - B5F524E128519AA100614FF7 /* Release */ = { + B5F524E128519AA100614FF7 /* Prod */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -1781,7 +1787,7 @@ SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; - name = Release; + name = Prod; }; /* End XCBuildConfiguration section */ @@ -1789,29 +1795,29 @@ 398B1CC12A12415C00DEFCEC /* Build configuration list for PBXNativeTarget "ManitoTests" */ = { isa = XCConfigurationList; buildConfigurations = ( - 398B1CBF2A12415C00DEFCEC /* Debug */, - 398B1CC02A12415C00DEFCEC /* Release */, + 398B1CBF2A12415C00DEFCEC /* Dev */, + 398B1CC02A12415C00DEFCEC /* Prod */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; + defaultConfigurationName = Prod; }; B5F524C628519AA000614FF7 /* Build configuration list for PBXProject "Manito" */ = { isa = XCConfigurationList; buildConfigurations = ( - B5F524DD28519AA100614FF7 /* Debug */, - B5F524DE28519AA100614FF7 /* Release */, + B5F524DD28519AA100614FF7 /* Dev */, + B5F524DE28519AA100614FF7 /* Prod */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; + defaultConfigurationName = Prod; }; B5F524DF28519AA100614FF7 /* Build configuration list for PBXNativeTarget "Manito" */ = { isa = XCConfigurationList; buildConfigurations = ( - B5F524E028519AA100614FF7 /* Debug */, - B5F524E128519AA100614FF7 /* Release */, + B5F524E028519AA100614FF7 /* Dev */, + B5F524E128519AA100614FF7 /* Prod */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; + defaultConfigurationName = Prod; }; /* End XCConfigurationList section */ From 828bfbdbe13893d09c53bf6745b668bcebfa0811 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 16 Aug 2023 12:37:31 +0900 Subject: [PATCH 302/468] =?UTF-8?q?[FEAT]=20Configuration=EC=97=90=20?= =?UTF-8?q?=EB=94=B0=EB=9D=BC=EC=84=9C=20display=20name=EC=9D=B4=20?= =?UTF-8?q?=EB=8B=A4=EB=A5=B4=EA=B2=8C=20=EB=82=98=ED=83=80=EB=82=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95(#484)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 6 +- .../{Manito.xcscheme => Manito-Dev.xcscheme} | 10 +-- .../xcschemes/Manito-Prod.xcscheme | 77 +++++++++++++++++++ .../xcschemes/MTNetworkTests.xcscheme | 53 +++++++++++++ 4 files changed, 139 insertions(+), 7 deletions(-) rename Manito/Manito.xcodeproj/xcshareddata/xcschemes/{Manito.xcscheme => Manito-Dev.xcscheme} (94%) create mode 100644 Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito-Prod.xcscheme create mode 100644 Manito/Packages/MTNetwork/.swiftpm/xcode/xcshareddata/xcschemes/MTNetworkTests.xcscheme diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index deedc4f10..76692e813 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -1725,7 +1725,7 @@ DEVELOPMENT_TEAM = HF8GHZB58X; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Manito/Global/Supports/Info.plist; - INFOPLIST_KEY_CFBundleDisplayName = "애니또"; + INFOPLIST_KEY_CFBundleDisplayName = "$(BUNDLE_DISPLAY_NAME)"; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.lifestyle"; INFOPLIST_KEY_NSCameraUsageDescription = "'마니또'가 마니띠에게 전송할 사진을 위해 사용자의 카메라에 접근하려고 합니다."; INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "'애니또'가 사용자의 앨범에 접근하려고 합니다. 쪽지에 있는 사진을 앨범에 저장하세요."; @@ -1741,6 +1741,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.5.0; + OTHER_SWIFT_FLAGS = "-DDEV"; PRODUCT_BUNDLE_IDENTIFIER = com.TeamFirefighter.Manito; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1764,7 +1765,7 @@ DEVELOPMENT_TEAM = HF8GHZB58X; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Manito/Global/Supports/Info.plist; - INFOPLIST_KEY_CFBundleDisplayName = "애니또"; + INFOPLIST_KEY_CFBundleDisplayName = "$(BUNDLE_DISPLAY_NAME)"; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.lifestyle"; INFOPLIST_KEY_NSCameraUsageDescription = "'마니또'가 마니띠에게 전송할 사진을 위해 사용자의 카메라에 접근하려고 합니다."; INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "'애니또'가 사용자의 앨범에 접근하려고 합니다. 쪽지에 있는 사진을 앨범에 저장하세요."; @@ -1780,6 +1781,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.5.0; + OTHER_SWIFT_FLAGS = "-DPROD"; PRODUCT_BUNDLE_IDENTIFIER = com.TeamFirefighter.Manito; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito.xcscheme b/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito-Dev.xcscheme similarity index 94% rename from Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito.xcscheme rename to Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito-Dev.xcscheme index 0e99ce95e..7719f96ec 100644 --- a/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito.xcscheme +++ b/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito-Dev.xcscheme @@ -23,7 +23,7 @@ @@ -42,7 +42,7 @@ + buildConfiguration = "Dev"> diff --git a/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito-Prod.xcscheme b/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito-Prod.xcscheme new file mode 100644 index 000000000..5dc19be77 --- /dev/null +++ b/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito-Prod.xcscheme @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Manito/Packages/MTNetwork/.swiftpm/xcode/xcshareddata/xcschemes/MTNetworkTests.xcscheme b/Manito/Packages/MTNetwork/.swiftpm/xcode/xcshareddata/xcschemes/MTNetworkTests.xcscheme new file mode 100644 index 000000000..f00dcdb6c --- /dev/null +++ b/Manito/Packages/MTNetwork/.swiftpm/xcode/xcshareddata/xcschemes/MTNetworkTests.xcscheme @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + From 937da9dde53d70003f8bf0020812b165caec192f Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 16 Aug 2023 13:23:38 +0900 Subject: [PATCH 303/468] =?UTF-8?q?[FEAT]=20=ED=98=84=EC=9E=AC=20Configura?= =?UTF-8?q?tion=EC=97=90=20=EB=A7=9E=EC=B6=B0=EC=84=9C=20=EB=8B=A4?= =?UTF-8?q?=EB=A5=B8=20baseURL=EB=A5=BC=20=EA=B0=80=EC=A7=80=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EA=B5=AC=ED=98=84(#484)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Literal/URLLiteral.swift | 9 ++++++--- Manito/Manito/Network/Foundation/APIEnvironment.swift | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Global/Literal/URLLiteral.swift b/Manito/Manito/Global/Literal/URLLiteral.swift index 82b34b3e7..588c7e15a 100644 --- a/Manito/Manito/Global/Literal/URLLiteral.swift +++ b/Manito/Manito/Global/Literal/URLLiteral.swift @@ -10,9 +10,12 @@ import Foundation enum URLLiteral { // MARK: - server url - - static let developmentUrl: String = Bundle.main.developmentURL - static let productionUrl: String = Bundle.main.productionURL + + #if DEV + static let baseURL = Bundle.main.developmentURL + #elseif PROD + static let baseURL = Bundle.main.productionURL + #endif // MARK: - notion url diff --git a/Manito/Manito/Network/Foundation/APIEnvironment.swift b/Manito/Manito/Network/Foundation/APIEnvironment.swift index aa5fe350c..077ae7f8e 100644 --- a/Manito/Manito/Network/Foundation/APIEnvironment.swift +++ b/Manito/Manito/Network/Foundation/APIEnvironment.swift @@ -13,7 +13,7 @@ enum APIEnvironment: String { case none = "" static func baseURL(_ version: Self = v1) -> String { - return URLLiteral.productionUrl + "/api\(version.rawValue)" + return URLLiteral.baseURL + "/api\(version.rawValue)" } static let boundary: String = "com.TeamFirefighter.Manito" From 08bf62972ff2454950192e6f258ccaae537b1133 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 16 Aug 2023 13:33:22 +0900 Subject: [PATCH 304/468] =?UTF-8?q?[FEAT]=20GoogleService=20Info=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EB=B6=84=EB=A6=AC(#484)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dev/GoogleService-Info-Dev.plist | 34 +++++++++++++++++++ .../Prod/GoogleService-Info-Prod.plist} | 0 Manito/Manito.xcodeproj/project.pbxproj | 8 ++--- 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 Manito/Configuration/Dev/GoogleService-Info-Dev.plist rename Manito/{Manito/Global/Supports/GoogleService-Info.plist => Configuration/Prod/GoogleService-Info-Prod.plist} (100%) diff --git a/Manito/Configuration/Dev/GoogleService-Info-Dev.plist b/Manito/Configuration/Dev/GoogleService-Info-Dev.plist new file mode 100644 index 000000000..f3eec8c79 --- /dev/null +++ b/Manito/Configuration/Dev/GoogleService-Info-Dev.plist @@ -0,0 +1,34 @@ + + + + + CLIENT_ID + 127402077581-1vseg29m3he1bbe7a4of2o5ctmti41do.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.127402077581-1vseg29m3he1bbe7a4of2o5ctmti41do + API_KEY + AIzaSyDEDRvAR6vtuGe1PWtEexLlsUvuFUk1xRU + GCM_SENDER_ID + 127402077581 + PLIST_VERSION + 1 + BUNDLE_ID + com.TeamFirefighter.Manito + PROJECT_ID + aenitto-develop + STORAGE_BUCKET + aenitto-develop.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:127402077581:ios:38169c06a3af4fc9ace1c4 + + \ No newline at end of file diff --git a/Manito/Manito/Global/Supports/GoogleService-Info.plist b/Manito/Configuration/Prod/GoogleService-Info-Prod.plist similarity index 100% rename from Manito/Manito/Global/Supports/GoogleService-Info.plist rename to Manito/Configuration/Prod/GoogleService-Info-Prod.plist diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 76692e813..85f9c5f7e 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -71,7 +71,6 @@ 39F1C12E28D756E600585B83 /* LetterImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39F1C12D28D756E600585B83 /* LetterImageViewController.swift */; }; 39FFE32828EEFFFE008442EE /* MoreButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39FFE32728EEFFFE008442EE /* MoreButton.swift */; }; 39FFE33428F457AF008442EE /* FirebaseMessaging in Frameworks */ = {isa = PBXBuildFile; productRef = 39FFE33328F457AF008442EE /* FirebaseMessaging */; }; - 39FFE33628F45E44008442EE /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 39FFE33528F45E44008442EE /* GoogleService-Info.plist */; }; 435B17682913E71400212663 /* DetailingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 435B17672913E71400212663 /* DetailingViewController.swift */; }; 7E0C5C362855B22700F698D1 /* CreateNickNameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E0C5C352855B22700F698D1 /* CreateNickNameViewController.swift */; }; 7E0C5C382855B73100F698D1 /* Splash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7E0C5C372855B73100F698D1 /* Splash.storyboard */; }; @@ -271,7 +270,7 @@ 39EEF65F28CB3D6200437654 /* LoginDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginDTO.swift; sourceTree = ""; }; 39F1C12D28D756E600585B83 /* LetterImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterImageViewController.swift; sourceTree = ""; }; 39FFE32728EEFFFE008442EE /* MoreButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreButton.swift; sourceTree = ""; }; - 39FFE33528F45E44008442EE /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; + 39FFE33528F45E44008442EE /* GoogleService-Info-Prod.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Prod.plist"; sourceTree = ""; }; 435B17672913E71400212663 /* DetailingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailingViewController.swift; sourceTree = ""; }; 7E0C5C352855B22700F698D1 /* CreateNickNameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateNickNameViewController.swift; sourceTree = ""; }; 7E0C5C372855B73100F698D1 /* Splash.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Splash.storyboard; sourceTree = ""; }; @@ -300,6 +299,7 @@ B517C04D28D1FE660008BED0 /* TokenProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenProtocol.swift; sourceTree = ""; }; B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Dev.xcconfig; sourceTree = ""; }; B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Prod.xcconfig; sourceTree = ""; }; + B53AD41D2A8C88E100B83B33 /* GoogleService-Info-Dev.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Dev.plist"; sourceTree = ""; }; B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterImageView.swift; sourceTree = ""; }; B54741E929A494E200B75BA3 /* LetterImageError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterImageError.swift; sourceTree = ""; }; B55B482129C3723B00CFFDAD /* URLRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLRepresentable.swift; sourceTree = ""; }; @@ -649,6 +649,7 @@ isa = PBXGroup; children = ( B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */, + 39FFE33528F45E44008442EE /* GoogleService-Info-Prod.plist */, ); path = Prod; sourceTree = ""; @@ -657,6 +658,7 @@ isa = PBXGroup; children = ( B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */, + B53AD41D2A8C88E100B83B33 /* GoogleService-Info-Dev.plist */, ); path = Dev; sourceTree = ""; @@ -949,7 +951,6 @@ children = ( 39E6321328BDE59C00CFC6C4 /* Manito.entitlements */, B5F524DC28519AA100614FF7 /* Info.plist */, - 39FFE33528F45E44008442EE /* GoogleService-Info.plist */, B5F524CE28519AA000614FF7 /* AppDelegate.swift */, B5F524D028519AA000614FF7 /* SceneDelegate.swift */, ); @@ -1317,7 +1318,6 @@ files = ( CB2F0FCB28A5468C005F04C8 /* gifMa.gif in Resources */, CB2F0FCD28A5468C005F04C8 /* gifNi.gif in Resources */, - 39FFE33628F45E44008442EE /* GoogleService-Info.plist in Resources */, B50B1B3C285AD2B20080992C /* logo.gif in Resources */, 7E0C5C382855B73100F698D1 /* Splash.storyboard in Resources */, 3915D54B2A7516A2002D6C25 /* URLInfo.plist in Resources */, From 906ab6e8c4943ce375b9190dd1a8d1db22995915 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 16 Aug 2023 13:54:58 +0900 Subject: [PATCH 305/468] =?UTF-8?q?[FEAT]=20GoogleService=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EA=B4=80=EB=A0=A8=20Run=20Script=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1(#484)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dev/GoogleService-Info-Dev.plist | 12 +++++----- .../Prod/GoogleService-Info-Prod.plist | 12 +++++----- Manito/Manito.xcodeproj/project.pbxproj | 23 +++++++++++++++++++ 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/Manito/Configuration/Dev/GoogleService-Info-Dev.plist b/Manito/Configuration/Dev/GoogleService-Info-Dev.plist index f3eec8c79..bb28de329 100644 --- a/Manito/Configuration/Dev/GoogleService-Info-Dev.plist +++ b/Manito/Configuration/Dev/GoogleService-Info-Dev.plist @@ -19,16 +19,16 @@ STORAGE_BUCKET aenitto-develop.appspot.com IS_ADS_ENABLED - + IS_ANALYTICS_ENABLED - + IS_APPINVITE_ENABLED - + IS_GCM_ENABLED - + IS_SIGNIN_ENABLED - + GOOGLE_APP_ID 1:127402077581:ios:38169c06a3af4fc9ace1c4 - \ No newline at end of file + diff --git a/Manito/Configuration/Prod/GoogleService-Info-Prod.plist b/Manito/Configuration/Prod/GoogleService-Info-Prod.plist index cb16b6241..5a08b5d14 100644 --- a/Manito/Configuration/Prod/GoogleService-Info-Prod.plist +++ b/Manito/Configuration/Prod/GoogleService-Info-Prod.plist @@ -19,16 +19,16 @@ STORAGE_BUCKET aenitto-350c7.appspot.com IS_ADS_ENABLED - + IS_ANALYTICS_ENABLED - + IS_APPINVITE_ENABLED - + IS_GCM_ENABLED - + IS_SIGNIN_ENABLED - + GOOGLE_APP_ID 1:1096284073075:ios:274e5e836bf912e806ce06 - \ No newline at end of file + diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 85f9c5f7e..32c8577c4 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -1241,6 +1241,7 @@ B5F524C728519AA000614FF7 /* Sources */, B5F524C828519AA000614FF7 /* Frameworks */, B5F524C928519AA000614FF7 /* Resources */, + B53AD41E2A8C892800B83B33 /* GoogleService-Info.plist */, ); buildRules = ( ); @@ -1335,6 +1336,28 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + B53AD41E2A8C892800B83B33 /* GoogleService-Info.plist */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "GoogleService-Info.plist"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/${PRODUCT_NAME}.app/GoogleService-Info.plist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\ncase \"${CONFIGURATION}\" in\n \"Dev\" )\ncp -r \"$SRCROOT/Configuration/Dev/GoogleService-Info-Dev.plist\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist\" ;;\n \"Prod\" )\ncp -r \"$SRCROOT/Configuration/Prod/GoogleService-Info-Prod.plist\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist\" ;;\n*)\n;;\nesac\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 398B1CB52A12415B00DEFCEC /* Sources */ = { isa = PBXSourcesBuildPhase; From 698a7af7000923efa78384356bb222195f912e0b Mon Sep 17 00:00:00 2001 From: Yoonah Shin Date: Wed, 16 Aug 2023 15:28:47 +0900 Subject: [PATCH 306/468] =?UTF-8?q?[DOCS]=20=20build.yml=EC=97=90=EC=84=9C?= =?UTF-8?q?=20build=20scheme=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ce3b6aa5..d31879d39 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,5 +19,5 @@ jobs: - name: Firefighter Build Tests run: | - xcodebuild build -project ./Manito/Manito.xcodeproj -scheme Manito -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" + xcodebuild build -project ./Manito/Manito.xcodeproj -scheme Manito-Prod -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" xcpretty --color --simple From 65227c40bef32b8299897a01c2fc8ab08d3c8a70 Mon Sep 17 00:00:00 2001 From: Yoonah Shin Date: Wed, 16 Aug 2023 15:36:09 +0900 Subject: [PATCH 307/468] =?UTF-8?q?[DOCS]=20=EC=9D=B4=EC=A0=84=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20build=20scheme=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d31879d39..5ce3b6aa5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,5 +19,5 @@ jobs: - name: Firefighter Build Tests run: | - xcodebuild build -project ./Manito/Manito.xcodeproj -scheme Manito-Prod -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" + xcodebuild build -project ./Manito/Manito.xcodeproj -scheme Manito -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" xcpretty --color --simple From d5371e0baf0fc3a29a8d9ddf23753141f95e831f Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 16 Aug 2023 16:09:54 +0900 Subject: [PATCH 308/468] =?UTF-8?q?[DOCS]=20Build=20Scheme=EB=A5=BC=20Mani?= =?UTF-8?q?to-Prod=EB=A1=9C=20=EB=B3=80=EA=B2=BD(#484)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/XCTestBuild.yml | 2 +- .github/workflows/build.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/XCTestBuild.yml b/.github/workflows/XCTestBuild.yml index 0ae54d5a2..8211cfeab 100644 --- a/.github/workflows/XCTestBuild.yml +++ b/.github/workflows/XCTestBuild.yml @@ -15,5 +15,5 @@ jobs: - name: Firefighter Build Tests run: | - xcodebuild clean test -project ./Manito/Manito.xcodeproj -scheme Manito -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" + xcodebuild clean test -project ./Manito/Manito.xcodeproj -scheme Manito-Prod -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" xcpretty --color --simple diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ce3b6aa5..d31879d39 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,5 +19,5 @@ jobs: - name: Firefighter Build Tests run: | - xcodebuild build -project ./Manito/Manito.xcodeproj -scheme Manito -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" + xcodebuild build -project ./Manito/Manito.xcodeproj -scheme Manito-Prod -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" xcpretty --color --simple From 5cef6514e738f77b91750531839c587992675e93 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 21 Aug 2023 10:26:00 +0900 Subject: [PATCH 309/468] =?UTF-8?q?[REFACTOR]=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81=20-=20case=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EC=9D=B4=EB=A6=84=EC=9C=BC=EB=A1=9C=20=EB=82=98?= =?UTF-8?q?=EB=88=84=EA=B8=B0,=20step=20=EA=B4=80=EB=A0=A8=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreateRoom/View/CreateRoomView.swift | 108 +++++++++++------- 1 file changed, 68 insertions(+), 40 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index 26f74dd65..454c3a88c 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -16,8 +16,8 @@ protocol CreateRoomViewDelegate: AnyObject { final class CreateRoomView: UIView { - private enum CreateRoomStep: Int { - case inputTitle = 0, inputCapacity, inputDate, checkRoom, chooseCharacter + fileprivate enum CreateRoomStep { + case inputTitle, inputCapacity, inputDate, checkRoom, chooseCharacter } // MARK: - ui component @@ -59,10 +59,9 @@ final class CreateRoomView: UIView { private var roomInfo: RoomInfo? private weak var delegate: CreateRoomViewDelegate? - private var roomStep: CreateRoomStep? = .inputTitle { + private var roomStep: CreateRoomStep = .inputTitle { willSet(step) { - guard let stepIndex = step?.rawValue else { return } - self.manageStepView(step: stepIndex) + self.manageStepView(step: step) } } @@ -136,13 +135,18 @@ final class CreateRoomView: UIView { self.closeButton.addAction(closeAction, for: .touchUpInside) let nextAction = UIAction { [weak self] _ in - self?.runActionAtStep(at: self?.roomStep?.rawValue ?? 0) - self?.moveToNextStep() + guard let currentStep = self?.roomStep else { return } + guard let nextStep = self?.moveToNextStep(currentStep: currentStep) else { return } + + self?.runActionAtStep(at: currentStep) + self?.roomStep = nextStep } self.nextButton.addAction(nextAction, for: .touchUpInside) let backAction = UIAction { [weak self] _ in - self?.moveToPreviousStep() + guard let currentStep = self?.roomStep else { return } + guard let previousStep = self?.moveToPreviousStep(currentStep: currentStep) else { return } + self?.roomStep = previousStep } self.backButton.addAction(backAction, for: .touchUpInside) } @@ -158,16 +162,12 @@ final class CreateRoomView: UIView { object: nil) } - private func moveToNextStep() { - guard let stepIndex = self.roomStep?.rawValue, - let nextStepIndex = CreateRoomStep(rawValue: stepIndex + 1) else { return } - self.roomStep = nextStepIndex + private func moveToNextStep(currentStep: CreateRoomStep) -> CreateRoomStep { + return currentStep.nextStep() } - private func moveToPreviousStep() { - guard let stepIndex = self.roomStep?.rawValue, - let previousStepIndex = CreateRoomStep(rawValue: stepIndex - 1) else { return } - self.roomStep = previousStepIndex + private func moveToPreviousStep(currentStep: CreateRoomStep) -> CreateRoomStep { + return currentStep.previousStep() } private func detectStartableStatus() { @@ -180,16 +180,16 @@ final class CreateRoomView: UIView { } } - private func setupHiddenStepView(at step: Int) { - self.roomTitleView.isHidden = !(step == 0) - self.roomCapacityView.isHidden = !(step == 1) - self.roomDateView.isHidden = !(step == 2) - self.roomInfoView.isHidden = !(step == 3) - self.characterCollectionView.isHidden = !(step == 4) + private func setupHiddenStepView(at step: CreateRoomStep) { + self.roomTitleView.isHidden = !(step == .inputTitle) + self.roomCapacityView.isHidden = !(step == .inputCapacity) + self.roomDateView.isHidden = !(step == .inputDate) + self.roomInfoView.isHidden = !(step == .checkRoom) + self.characterCollectionView.isHidden = !(step == .chooseCharacter) } - private func setupHiddenBackButton(at step: Int) { - self.backButton.isHidden = !(step == 1 || step == 2 || step == 3 || step == 4) + private func setupHiddenBackButton(at step: CreateRoomStep) { + self.backButton.isHidden = !(step == .inputCapacity || step == .inputDate || step == .checkRoom || step == .chooseCharacter) } private func setupRoomTitleViewAnimation() { @@ -220,19 +220,19 @@ final class CreateRoomView: UIView { self.characterCollectionView.fadeIn() } - private func runActionAtStep(at step: Int) { + private func runActionAtStep(at step: CreateRoomStep) { switch step { - case 0: + case .inputTitle: self.setupTitle() self.endEditing(true) - case 1: + case .inputCapacity: self.setupCapacity() self.disabledNextButton() - case 2: + case .inputDate: self.setupDate() - case 3: + case .checkRoom: break - case 4: + case .chooseCharacter: let colorIndex = self.characterCollectionView.characterIndex self.delegate?.requestCreateRoom(roomInfo: RoomInfo(id: nil, capacity: self.roomInfoView.capacity, @@ -241,8 +241,6 @@ final class CreateRoomView: UIView { endDate: "20\(self.roomDateView.calendarView.getTempEndDate())", state: nil), colorIndex: colorIndex) - default: - break } } @@ -281,22 +279,20 @@ final class CreateRoomView: UIView { } } - func manageStepView(step: Int) { + private func manageStepView(step: CreateRoomStep) { self.setupHiddenStepView(at: step) self.setupHiddenBackButton(at: step) switch step { - case 0: + case .inputTitle: self.setupRoomTitleViewAnimation() - case 1: + case .inputCapacity: self.setupRoomCapacityViewAnimation() - case 2: + case .inputDate: self.setupRoomDateViewAnimation() - case 3: + case .checkRoom: self.setupRoomDataCheckViewAnimation() - case 4: + case .chooseCharacter: self.setupChooseCharacterViewAnimation() - default: - break } } @@ -318,3 +314,35 @@ final class CreateRoomView: UIView { }) } } + +private extension CreateRoomView.CreateRoomStep { + func nextStep() -> Self { + switch self { + case .inputTitle: + return .inputCapacity + case .inputCapacity: + return .inputDate + case .inputDate: + return .checkRoom + case .checkRoom: + return .chooseCharacter + case .chooseCharacter: + return .chooseCharacter + } + } + + func previousStep() -> Self { + switch self { + case .inputTitle: + return .inputTitle + case .inputCapacity: + return .inputTitle + case .inputDate: + return .inputCapacity + case .checkRoom: + return .inputDate + case .chooseCharacter: + return .checkRoom + } + } +} From 14e7550cfd5b4c307d719061dbc3ae84c4a05363 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 21 Aug 2023 10:27:11 +0900 Subject: [PATCH 310/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20-=20setLayout=20->=20setupLayo?= =?UTF-8?q?ut=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift index ed8e6c298..799d8c46d 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift @@ -59,7 +59,7 @@ final class CheckRoomInfoView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setLayout() + self.setupLayout() } @available(*, unavailable) @@ -69,7 +69,7 @@ final class CheckRoomInfoView: UIView { // MARK: - func - private func setLayout() { + private func setupLayout() { self.addSubview(self.nameLabel) self.nameLabel.snp.makeConstraints { $0.top.equalToSuperview().inset(40) From 7433af626327c2d6fba250259d323847f02c1db0 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 21 Aug 2023 10:30:14 +0900 Subject: [PATCH 311/468] =?UTF-8?q?[CHORE]=20=ED=8F=B4=EB=8D=94=20?= =?UTF-8?q?=EC=9C=84=EC=B9=98=20=ED=86=B5=EC=9D=BC=ED=95=98=EA=B8=B0=20(#4?= =?UTF-8?q?03)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 10 +++++++++- .../{UIComponent => View}/ChooseCharacterView.swift | 0 2 files changed, 9 insertions(+), 1 deletion(-) rename Manito/Manito/Screens/ChooseCharacter/{UIComponent => View}/ChooseCharacterView.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 94af5b7cf..68b3e94a2 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -1105,6 +1105,7 @@ CBA15C91285CE1880051EDE2 /* ChooseCharacter */ = { isa = PBXGroup; children = ( + D7B83FD32A92F55200BFD8FF /* View */, CBA15C92285CE18F0051EDE2 /* UIComponent */, CBA15C93285CE1A80051EDE2 /* ChooseCharacterViewController.swift */, ); @@ -1115,7 +1116,6 @@ isa = PBXGroup; children = ( CB21C33828C4C10200128D25 /* CharacterCollectionViewCell.swift */, - D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */, ); path = UIComponent; sourceTree = ""; @@ -1183,6 +1183,14 @@ path = Component; sourceTree = ""; }; + D7B83FD32A92F55200BFD8FF /* View */ = { + isa = PBXGroup; + children = ( + D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */, + ); + path = View; + sourceTree = ""; + }; D7C4A1AE2A0E51F500C3AE4C /* View */ = { isa = PBXGroup; children = ( diff --git a/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift b/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift similarity index 100% rename from Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift rename to Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift From a8041e76ff0751cb1ffd81e974fac7ceee816242 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 21 Aug 2023 10:32:03 +0900 Subject: [PATCH 312/468] =?UTF-8?q?[CHORE]=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EB=B3=80=EC=88=98=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/ChooseCharacter/ChooseCharacterViewController.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index 1d8cfb57c..0d66f4bba 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -19,7 +19,6 @@ final class ChooseCharacterViewController: BaseViewController { private let roomService: RoomProtocol = RoomAPI(apiService: APIService()) private let roomId: Int? - private var roomInfo: RoomDTO? // MARK: - init From 38d4b705e619d7e985b7244c088e75e1e7959d45 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 21 Aug 2023 11:20:05 +0900 Subject: [PATCH 313/468] =?UTF-8?q?[CHORE]=20internal=EB=A1=9C=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=EB=90=9C=20=EA=B0=92=EB=93=A4=20private=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/ChooseCharacterView.swift | 2 +- .../UIComponent/CharacterCollectionView.swift | 6 ++++- .../UIComponent/CheckRoomInfoView.swift | 26 ++++++++++++++++--- .../UIComponent/InputCapacityView.swift | 7 ++++- .../UIComponent/InputTitleView.swift | 7 ++++- .../CreateRoom/View/CreateRoomView.swift | 16 ++++++------ 6 files changed, 49 insertions(+), 15 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift b/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift index f33e79636..d0123815a 100644 --- a/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift +++ b/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift @@ -104,7 +104,7 @@ final class ChooseCharacterView: UIView { self?.delegate?.closeButtonDidTap() } let didTapJoinButton = UIAction { [weak self] _ in - self?.delegate?.joinButtonDidTap(characterIndex: self?.manittoCollectionView.characterIndex ?? 0) + self?.delegate?.joinButtonDidTap(characterIndex: self?.manittoCollectionView.getCharacterIndex() ?? 0) } self.backButton.addAction(didTapBackButton, for: .touchUpInside) diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift index eafd46644..92db77e30 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift @@ -45,7 +45,7 @@ final class CharacterCollectionView: UIView { // MARK: - property - var characterIndex: Int = 0 + private var characterIndex: Int = 0 // MARK: - init @@ -67,6 +67,10 @@ final class CharacterCollectionView: UIView { $0.edges.equalToSuperview() } } + + func getCharacterIndex() -> Int { + return self.characterIndex + } } extension CharacterCollectionView: UICollectionViewDataSource { diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift index 799d8c46d..9619e1a51 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift @@ -39,17 +39,17 @@ final class CheckRoomInfoView: UIView { // MARK: - property - var dateRange = "" { + private var dateRange = "" { willSet { self.dateLabel.text = newValue } } - var title: String = "" { + private var title: String = "" { willSet { self.nameLabel.text = newValue } } - var capacity: Int = 0 { + private var capacity: Int = 0 { willSet { self.personLabel.text = "\(newValue.description)" + TextLiteral.per } @@ -95,4 +95,24 @@ final class CheckRoomInfoView: UIView { $0.width.height.equalTo(60) } } + + func setupTitle(title: String) { + self.title = title + } + + func getTitle() -> String { + return self.title + } + + func setupCapacity(capacity: Int) { + self.capacity = capacity + } + + func getCapacity() -> Int { + return self.capacity + } + + func setupDateRange(range: String) { + self.dateRange = range + } } diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift index 17a61b3c6..84eb3421d 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift @@ -37,7 +37,7 @@ final class InputCapacityView: UIView { label.font = .font(.regular, ofSize: 24) return label }() - lazy var personSlider: UISlider = { + private lazy var personSlider: UISlider = { let slider = UISlider() slider.value = 1 slider.minimumValue = 4 @@ -120,6 +120,11 @@ final class InputCapacityView: UIView { } } + func getSliderValue() -> Int { + let value = Int(self.personSlider.value) + return value + } + // MARK: - selector @objc diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift index 945d59bde..917c1c133 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift @@ -13,7 +13,7 @@ final class InputTitleView: UIView { // MARK: - ui component - lazy var roomsNameTextField: UITextField = { + private lazy var roomsNameTextField: UITextField = { let textField = UITextField() let attributes = [ NSAttributedString.Key.font : UIFont.font(.regular, ofSize: 18) @@ -93,6 +93,11 @@ final class InputTitleView: UIView { } } } + + func getTextFieldContent() -> String { + guard let text = self.roomsNameTextField.text else { return "" } + return text + } } extension InputTitleView: UITextFieldDelegate { diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index 454c3a88c..46e0ae9a3 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -233,10 +233,10 @@ final class CreateRoomView: UIView { case .checkRoom: break case .chooseCharacter: - let colorIndex = self.characterCollectionView.characterIndex + let colorIndex = self.characterCollectionView.getCharacterIndex() self.delegate?.requestCreateRoom(roomInfo: RoomInfo(id: nil, - capacity: self.roomInfoView.capacity, - title: self.roomInfoView.title, + capacity: self.roomInfoView.getCapacity(), + title: self.roomInfoView.getTitle(), startDate: "20\(self.roomDateView.calendarView.getTempStartDate())", endDate: "20\(self.roomDateView.calendarView.getTempEndDate())", state: nil), @@ -245,13 +245,13 @@ final class CreateRoomView: UIView { } private func setupTitle() { - guard let title = self.roomTitleView.roomsNameTextField.text else { return } - self.roomInfoView.title = title + let title = self.roomTitleView.getTextFieldContent() + self.roomInfoView.setupTitle(title: title) } private func setupCapacity() { - let capacity = Int(self.roomCapacityView.personSlider.value) - self.roomInfoView.capacity = capacity + let capacity = self.roomCapacityView.getSliderValue() + self.roomInfoView.setupCapacity(capacity: capacity) } private func disabledNextButton() { @@ -262,7 +262,7 @@ final class CreateRoomView: UIView { let startDate = self.roomDateView.calendarView.getTempStartDate() let endDate = self.roomDateView.calendarView.getTempEndDate() let roomDateRange = "\(startDate) ~ \(endDate)" - self.roomInfoView.dateRange = roomDateRange + self.roomInfoView.setupDateRange(range: roomDateRange) } private func configureUI() { From 78db27431b7c104a86e0c5c2283cd2ff5258b9a0 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 21 Aug 2023 11:21:11 +0900 Subject: [PATCH 314/468] =?UTF-8?q?[CHORE]=20setLayout=20->=20setupLayout?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/CreateRoom/UIComponent/InputCapacityView.swift | 4 ++-- .../Manito/Screens/CreateRoom/UIComponent/InputDateView.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift index 84eb3421d..562e6b372 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift @@ -64,7 +64,7 @@ final class InputCapacityView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setLayout() + self.setupLayout() } @available(*, unavailable) @@ -74,7 +74,7 @@ final class InputCapacityView: UIView { // MARK: - func - private func setLayout() { + private func setupLayout() { self.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { $0.top.leading.trailing.equalToSuperview() diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputDateView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputDateView.swift index 86abde8ec..35073c558 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputDateView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputDateView.swift @@ -32,7 +32,7 @@ final class InputDateView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setLayout() + self.setupLayout() } @available(*, unavailable) @@ -42,7 +42,7 @@ final class InputDateView: UIView { // MARK: - func - private func setLayout() { + private func setupLayout() { self.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { $0.top.leading.trailing.equalToSuperview() From 27d1393399d68f359ed49b26069ab5c23de645b4 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 21 Aug 2023 16:00:50 +0900 Subject: [PATCH 315/468] =?UTF-8?q?[FEAT]=20textField=20=EA=B8=80=EC=9E=90?= =?UTF-8?q?=20=EC=88=98=EC=97=90=20=EB=94=B0=EB=A5=B8=20label=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreateRoom/CreateRoomViewController.swift | 25 +++++++++++++++++++ .../UIComponent/InputTitleView.swift | 8 +++--- .../CreateRoom/View/CreateRoomView.swift | 2 +- .../ViewModel/CreateRoomViewModel.swift | 14 ++++++----- 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index 3835125ee..db21dea91 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -5,6 +5,7 @@ // Created by SHIN YOON AH on 2022/06/09. // +import Combine import UIKit import SnapKit @@ -19,6 +20,9 @@ final class CreateRoomViewController: BaseViewController { private let roomService: RoomProtocol = RoomAPI(apiService: APIService()) + private var cancellable = Set() + private let createRoomViewModel: CreateRoomViewModel = CreateRoomViewModel() + // MARK: - init deinit { @@ -34,6 +38,7 @@ final class CreateRoomViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() self.configureDelegation() + self.bindViewModel() } // FIXME: 플로우 연결 하면서 변경 될 예정 @@ -73,6 +78,26 @@ final class CreateRoomViewController: BaseViewController { } } + private func bindViewModel() { + let output = self.transformedOutput() + self.bindOutputToViewModel(output) + } + + private func transformedOutput() -> CreateRoomViewModel.Output { + let input = CreateRoomViewModel.Input( + textFieldText: self.createRoomView.roomTitleView.textFieldPublisher.eraseToAnyPublisher()) + return self.createRoomViewModel.transform(input) + } + + private func bindOutputToViewModel(_ output: CreateRoomViewModel.Output) { + output.textCount + .receive(on: DispatchQueue.main) + .sink(receiveValue: { [weak self] count in + self?.createRoomView.roomTitleView.setCounter(count: count) + }) + .store(in: &cancellable) + } + // MARK: - network private func requestCreateRoom(room: CreateRoomDTO) { diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift index 917c1c133..e2b86b634 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift @@ -5,6 +5,7 @@ // Created by LeeSungHo on 2022/06/11. // +import Combine import UIKit import SnapKit @@ -41,8 +42,9 @@ final class InputTitleView: UIView { // MARK: - property - var changeNextButtonEnableStatus: ((Bool) -> ())? private var maxLength: Int = 8 + var changeNextButtonEnableStatus: ((Bool) -> ())? + let textFieldPublisher = PassthroughSubject() // MARK: - init @@ -72,7 +74,7 @@ final class InputTitleView: UIView { } } - private func setCounter(count: Int) { + func setCounter(count: Int) { if count <= maxLength { self.roomsTextLimitLabel.text = "\(count)/\(self.maxLength)" } else { @@ -106,7 +108,7 @@ extension InputTitleView: UITextFieldDelegate { } func textFieldDidChangeSelection(_ textField: UITextField) { - self.setCounter(count: textField.text?.count ?? 0) + self.textFieldPublisher.send(textField.text ?? "") self.checkMaxLength(textField: self.roomsNameTextField, maxLength: self.maxLength) let hasText = textField.hasText diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index 46e0ae9a3..abcf5466b 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -49,7 +49,7 @@ final class CreateRoomView: UIView { button.isHidden = true return button }() - private let roomTitleView: InputTitleView = InputTitleView() + let roomTitleView: InputTitleView = InputTitleView() private let roomCapacityView: InputCapacityView = InputCapacityView() private let roomDateView: InputDateView = InputDateView() private let roomInfoView: CheckRoomInfoView = CheckRoomInfoView() diff --git a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift index 6cb807dcb..6bd157a3a 100644 --- a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift +++ b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift @@ -15,21 +15,23 @@ final class CreateRoomViewModel { private var cancellable = Set() struct Input { - let textFieldValueChanged: PassthroughSubject + let textFieldText: AnyPublisher } struct Output { - let title: AnyPublisher + let textCount: AnyPublisher } func transform(_ input: Input) -> Output { - - let title = input.textFieldValueChanged + let textCount = input.textFieldText + .map { text in + return text.count + } .eraseToAnyPublisher() - - return Output(title: title) + return Output(textCount: textCount) } + // MARK: - init From 72cb00485cb15ab7f326aee4178a7b36bd96815d Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 21 Aug 2023 17:28:51 +0900 Subject: [PATCH 316/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20-=20set=20->=20update,=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=EB=AA=85=20=EB=B3=80=EA=B2=BD=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/ChooseCharacterView.swift | 2 +- .../UIComponent/CharacterCollectionView.swift | 2 +- .../UIComponent/CheckRoomInfoView.swift | 10 ++-- .../UIComponent/InputCapacityView.swift | 2 +- .../UIComponent/InputTitleView.swift | 2 +- .../CreateRoom/View/CreateRoomView.swift | 56 +++++++++---------- 6 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift b/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift index d0123815a..d37d7bd13 100644 --- a/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift +++ b/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift @@ -104,7 +104,7 @@ final class ChooseCharacterView: UIView { self?.delegate?.closeButtonDidTap() } let didTapJoinButton = UIAction { [weak self] _ in - self?.delegate?.joinButtonDidTap(characterIndex: self?.manittoCollectionView.getCharacterIndex() ?? 0) + self?.delegate?.joinButtonDidTap(characterIndex: self?.manittoCollectionView.selectedCharacterIndex() ?? 0) } self.backButton.addAction(didTapBackButton, for: .touchUpInside) diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift index 92db77e30..fad0b762e 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift @@ -68,7 +68,7 @@ final class CharacterCollectionView: UIView { } } - func getCharacterIndex() -> Int { + func selectedCharacterIndex() -> Int { return self.characterIndex } } diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift index 9619e1a51..625f2901f 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift @@ -96,23 +96,23 @@ final class CheckRoomInfoView: UIView { } } - func setupTitle(title: String) { + func updateRoomTitle(title: String) { self.title = title } - func getTitle() -> String { + func roomTitle() -> String { return self.title } - func setupCapacity(capacity: Int) { + func updateRoomCapacity(capacity: Int) { self.capacity = capacity } - func getCapacity() -> Int { + func roomCapacity() -> Int { return self.capacity } - func setupDateRange(range: String) { + func updateRoomDateRange(range: String) { self.dateRange = range } } diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift index 562e6b372..ec134122f 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift @@ -120,7 +120,7 @@ final class InputCapacityView: UIView { } } - func getSliderValue() -> Int { + func sliderValue() -> Int { let value = Int(self.personSlider.value) return value } diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift index 917c1c133..35cef99d3 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift @@ -94,7 +94,7 @@ final class InputTitleView: UIView { } } - func getTextFieldContent() -> String { + func textFieldText() -> String { guard let text = self.roomsNameTextField.text else { return "" } return text } diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index 46e0ae9a3..ec13581c4 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -180,7 +180,7 @@ final class CreateRoomView: UIView { } } - private func setupHiddenStepView(at step: CreateRoomStep) { + private func updateHiddenStepView(at step: CreateRoomStep) { self.roomTitleView.isHidden = !(step == .inputTitle) self.roomCapacityView.isHidden = !(step == .inputCapacity) self.roomDateView.isHidden = !(step == .inputDate) @@ -188,34 +188,34 @@ final class CreateRoomView: UIView { self.characterCollectionView.isHidden = !(step == .chooseCharacter) } - private func setupHiddenBackButton(at step: CreateRoomStep) { + private func updateHiddenBackButton(at step: CreateRoomStep) { self.backButton.isHidden = !(step == .inputCapacity || step == .inputDate || step == .checkRoom || step == .chooseCharacter) } - private func setupRoomTitleViewAnimation() { + private func updateRoomTitleViewAnimation() { self.roomCapacityView.fadeOut() self.roomTitleView.fadeIn() } - private func setupRoomCapacityViewAnimation() { + private func updateRoomCapacityViewAnimation() { self.roomTitleView.fadeOut() self.roomCapacityView.fadeIn() self.roomDateView.fadeOut() } - private func setupRoomDateViewAnimation() { + private func updateRoomDateViewAnimation() { self.roomCapacityView.fadeOut() self.roomDateView.fadeIn() self.roomInfoView.fadeOut() } - private func setupRoomDataCheckViewAnimation() { + private func updateRoomDataCheckViewAnimation() { self.roomDateView.fadeOut() self.roomInfoView.fadeIn() self.characterCollectionView.fadeOut() } - private func setupChooseCharacterViewAnimation() { + private func updateChooseCharacterViewAnimation() { self.roomInfoView.fadeOut() self.characterCollectionView.fadeIn() } @@ -223,20 +223,20 @@ final class CreateRoomView: UIView { private func runActionAtStep(at step: CreateRoomStep) { switch step { case .inputTitle: - self.setupTitle() + self.updateRoomTitle() self.endEditing(true) case .inputCapacity: - self.setupCapacity() + self.updateRoomCapacity() self.disabledNextButton() case .inputDate: - self.setupDate() + self.updateRoomDate() case .checkRoom: break case .chooseCharacter: - let colorIndex = self.characterCollectionView.getCharacterIndex() + let colorIndex = self.characterCollectionView.selectedCharacterIndex() self.delegate?.requestCreateRoom(roomInfo: RoomInfo(id: nil, - capacity: self.roomInfoView.getCapacity(), - title: self.roomInfoView.getTitle(), + capacity: self.roomInfoView.roomCapacity(), + title: self.roomInfoView.roomTitle(), startDate: "20\(self.roomDateView.calendarView.getTempStartDate())", endDate: "20\(self.roomDateView.calendarView.getTempEndDate())", state: nil), @@ -244,25 +244,25 @@ final class CreateRoomView: UIView { } } - private func setupTitle() { - let title = self.roomTitleView.getTextFieldContent() - self.roomInfoView.setupTitle(title: title) + private func updateRoomTitle() { + let title = self.roomTitleView.textFieldText() + self.roomInfoView.updateRoomTitle(title: title) } - private func setupCapacity() { - let capacity = self.roomCapacityView.getSliderValue() - self.roomInfoView.setupCapacity(capacity: capacity) + private func updateRoomCapacity() { + let capacity = self.roomCapacityView.sliderValue() + self.roomInfoView.updateRoomCapacity(capacity: capacity) } private func disabledNextButton() { self.nextButton.isDisabled = true } - private func setupDate() { + private func updateRoomDate() { let startDate = self.roomDateView.calendarView.getTempStartDate() let endDate = self.roomDateView.calendarView.getTempEndDate() let roomDateRange = "\(startDate) ~ \(endDate)" - self.roomInfoView.setupDateRange(range: roomDateRange) + self.roomInfoView.updateRoomDateRange(range: roomDateRange) } private func configureUI() { @@ -280,19 +280,19 @@ final class CreateRoomView: UIView { } private func manageStepView(step: CreateRoomStep) { - self.setupHiddenStepView(at: step) - self.setupHiddenBackButton(at: step) + self.updateHiddenStepView(at: step) + self.updateHiddenBackButton(at: step) switch step { case .inputTitle: - self.setupRoomTitleViewAnimation() + self.updateRoomTitleViewAnimation() case .inputCapacity: - self.setupRoomCapacityViewAnimation() + self.updateRoomCapacityViewAnimation() case .inputDate: - self.setupRoomDateViewAnimation() + self.updateRoomDateViewAnimation() case .checkRoom: - self.setupRoomDataCheckViewAnimation() + self.updateRoomDataCheckViewAnimation() case .chooseCharacter: - self.setupChooseCharacterViewAnimation() + self.updateChooseCharacterViewAnimation() } } From e37de4008ecab40daf01cb177185b2927f1c8e9e Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 21 Aug 2023 17:39:16 +0900 Subject: [PATCH 317/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20-=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=EB=AA=85=20=EC=A4=84=EC=9D=B4=EA=B8=B0=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/CreateRoom/View/CreateRoomView.swift | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index ec13581c4..d3f65bde6 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -136,7 +136,7 @@ final class CreateRoomView: UIView { let nextAction = UIAction { [weak self] _ in guard let currentStep = self?.roomStep else { return } - guard let nextStep = self?.moveToNextStep(currentStep: currentStep) else { return } + guard let nextStep = self?.moveToNextStep(from: currentStep) else { return } self?.runActionAtStep(at: currentStep) self?.roomStep = nextStep @@ -145,7 +145,7 @@ final class CreateRoomView: UIView { let backAction = UIAction { [weak self] _ in guard let currentStep = self?.roomStep else { return } - guard let previousStep = self?.moveToPreviousStep(currentStep: currentStep) else { return } + guard let previousStep = self?.moveToPreviousStep(from: currentStep) else { return } self?.roomStep = previousStep } self.backButton.addAction(backAction, for: .touchUpInside) @@ -162,12 +162,12 @@ final class CreateRoomView: UIView { object: nil) } - private func moveToNextStep(currentStep: CreateRoomStep) -> CreateRoomStep { - return currentStep.nextStep() + private func moveToNextStep(from step: CreateRoomStep) -> CreateRoomStep { + return step.next() } - private func moveToPreviousStep(currentStep: CreateRoomStep) -> CreateRoomStep { - return currentStep.previousStep() + private func moveToPreviousStep(from step: CreateRoomStep) -> CreateRoomStep { + return step.previous() } private func detectStartableStatus() { @@ -316,7 +316,7 @@ final class CreateRoomView: UIView { } private extension CreateRoomView.CreateRoomStep { - func nextStep() -> Self { + func next() -> Self { switch self { case .inputTitle: return .inputCapacity @@ -331,7 +331,7 @@ private extension CreateRoomView.CreateRoomStep { } } - func previousStep() -> Self { + func previous() -> Self { switch self { case .inputTitle: return .inputTitle From 19027452527a6f5792a9402d004f89164b7223d6 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 21 Aug 2023 21:48:24 +0900 Subject: [PATCH 318/468] =?UTF-8?q?[FEAT]=20sliderValue=EB=B3=80=ED=99=94?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20label=20=EB=B3=80=EA=B2=BD=20(?= =?UTF-8?q?#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/CreateRoom/CreateRoomViewController.swift | 11 ++++++++++- .../CreateRoom/UIComponent/InputCapacityView.swift | 11 +++++++++-- .../Screens/CreateRoom/View/CreateRoomView.swift | 2 +- .../CreateRoom/ViewModel/CreateRoomViewModel.swift | 11 ++++++++++- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index db21dea91..89d191584 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -85,7 +85,8 @@ final class CreateRoomViewController: BaseViewController { private func transformedOutput() -> CreateRoomViewModel.Output { let input = CreateRoomViewModel.Input( - textFieldText: self.createRoomView.roomTitleView.textFieldPublisher.eraseToAnyPublisher()) + textFieldText: self.createRoomView.roomTitleView.textFieldPublisher.eraseToAnyPublisher(), + sliderValueDidChanged: self.createRoomView.roomCapacityView.sliderPublisher.eraseToAnyPublisher()) return self.createRoomViewModel.transform(input) } @@ -96,6 +97,14 @@ final class CreateRoomViewController: BaseViewController { self?.createRoomView.roomTitleView.setCounter(count: count) }) .store(in: &cancellable) + + output.capacity + .receive(on: DispatchQueue.main) + .sink(receiveValue: { [weak self] capacity in + self?.createRoomView.roomCapacityView.updateCapacity(capacity: capacity) + + }) + .store(in: &cancellable) } // MARK: - network diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift index ec134122f..dc4383b0c 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift @@ -5,6 +5,7 @@ // Created by LeeSungHo on 2022/06/11. // +import Combine import UIKit import SnapKit @@ -60,6 +61,8 @@ final class InputCapacityView: UIView { return label }() + let sliderPublisher = PassthroughSubject() + // MARK: - init override init(frame: CGRect) { @@ -125,11 +128,15 @@ final class InputCapacityView: UIView { return value } + func updateCapacity(capacity: Int) { + self.personLabel.text = TextLiteral.x + " \(capacity)인" + } + // MARK: - selector @objc private func didSlideSlider(_ slider: UISlider) { - let value = slider.value - self.personLabel.text = TextLiteral.x + " \(Int(value))인" + let value = Int(slider.value) + self.sliderPublisher.send(value) } } diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index ccdf560a8..cef3bc16d 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -50,7 +50,7 @@ final class CreateRoomView: UIView { return button }() let roomTitleView: InputTitleView = InputTitleView() - private let roomCapacityView: InputCapacityView = InputCapacityView() + let roomCapacityView: InputCapacityView = InputCapacityView() private let roomDateView: InputDateView = InputDateView() private let roomInfoView: CheckRoomInfoView = CheckRoomInfoView() private let characterCollectionView: CharacterCollectionView = CharacterCollectionView() diff --git a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift index 6bd157a3a..47501a96c 100644 --- a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift +++ b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift @@ -16,10 +16,12 @@ final class CreateRoomViewModel { struct Input { let textFieldText: AnyPublisher + let sliderValueDidChanged: AnyPublisher } struct Output { let textCount: AnyPublisher + let capacity: AnyPublisher } func transform(_ input: Input) -> Output { @@ -29,7 +31,14 @@ final class CreateRoomViewModel { } .eraseToAnyPublisher() - return Output(textCount: textCount) + let capacity = input.sliderValueDidChanged + .map { value in + return Int(value) + } + .eraseToAnyPublisher() + + return Output(textCount: textCount, + capacity: capacity) } // MARK: - init From 8c2929f5dcc5bdde9772d5e233bf06acbefd3712 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 21 Aug 2023 21:49:34 +0900 Subject: [PATCH 319/468] =?UTF-8?q?[CHORE]=20=EB=B3=80=EC=88=98=EB=AA=85?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/CreateRoom/CreateRoomViewController.swift | 2 +- .../Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index 89d191584..57684394b 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -85,7 +85,7 @@ final class CreateRoomViewController: BaseViewController { private func transformedOutput() -> CreateRoomViewModel.Output { let input = CreateRoomViewModel.Input( - textFieldText: self.createRoomView.roomTitleView.textFieldPublisher.eraseToAnyPublisher(), + textFieldTextDidChanged: self.createRoomView.roomTitleView.textFieldPublisher.eraseToAnyPublisher(), sliderValueDidChanged: self.createRoomView.roomCapacityView.sliderPublisher.eraseToAnyPublisher()) return self.createRoomViewModel.transform(input) } diff --git a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift index 47501a96c..9b8f80a8e 100644 --- a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift +++ b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift @@ -15,7 +15,7 @@ final class CreateRoomViewModel { private var cancellable = Set() struct Input { - let textFieldText: AnyPublisher + let textFieldTextDidChanged: AnyPublisher let sliderValueDidChanged: AnyPublisher } @@ -25,7 +25,7 @@ final class CreateRoomViewModel { } func transform(_ input: Input) -> Output { - let textCount = input.textFieldText + let textCount = input.textFieldTextDidChanged .map { text in return text.count } From e0527fe1dadbdbede4d35fa407b1d6e7ce7dc729 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 22 Aug 2023 16:29:03 +0900 Subject: [PATCH 320/468] =?UTF-8?q?[CHORE]=20Header=20=EB=A0=88=EC=9D=B4?= =?UTF-8?q?=EC=95=84=EC=9B=83=20=EB=B6=80=EB=B6=84=EC=97=90=20weak=20self?= =?UTF-8?q?=20=ED=82=A4=EC=9B=8C=EB=93=9C=20=EC=B6=94=EA=B0=80(#486)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Letter/Views/UIComponents/LetterHeaderView.swift | 3 +-- Manito/Manito/Screens/Letter/Views/Views/LetterView.swift | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift b/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift index 24b6785b3..ddc993a37 100644 --- a/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift +++ b/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift @@ -33,8 +33,7 @@ final class LetterHeaderView: UICollectionReusableView { var segmentedControlTapPublisher: AnyPublisher { return self.segmentedControl.tapPublisher - .map { [weak self] in self?.segmentedControl.selectedSegmentIndex } - .map { $0! } + .compactMap { [weak self] in self?.segmentedControl.selectedSegmentIndex } .eraseToAnyPublisher() } diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index 3cdf30407..837c56cb6 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -182,7 +182,7 @@ extension LetterView { // MARK: - UICollectionViewLayout extension LetterView { private func createLayout() -> UICollectionViewLayout { - let layout = UICollectionViewCompositionalLayout { index, environment -> NSCollectionLayoutSection? in + let layout = UICollectionViewCompositionalLayout { [weak self] index, environment -> NSCollectionLayoutSection? in let itemSize = NSCollectionLayoutSize( widthDimension: .fractionalWidth(1.0), heightDimension: .estimated(500) @@ -197,7 +197,7 @@ extension LetterView { let section = NSCollectionLayoutSection(group: group) section.contentInsets = ConstantSize.sectionContentInset - section.boundarySupplementaryItems = self.sectionHeader() + section.boundarySupplementaryItems = self?.sectionHeader() ?? [] section.interGroupSpacing = ConstantSize.groupInterItemSpacing return section From 234e00b6f1d8f8d5ee205d0ecc3fe0ce806f3309 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 22 Aug 2023 18:12:05 +0900 Subject: [PATCH 321/468] =?UTF-8?q?[CHORE]=20wait=20=EC=8B=9C=EA=B0=84=202?= =?UTF-8?q?=EC=B4=88=EC=97=90=EC=84=9C=205=EC=B4=88=EB=A1=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#488)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/ManitoTests/DetailWaitViewModelTest.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index a6e6bd783..641a2275e 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -112,7 +112,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testViewDidLoadSubject.send(()) // then - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertEqual(checkRoom, testRoom) } @@ -139,7 +139,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testStartButtonDidTapSubject.send(()) // then - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertEqual(checkNickname, testNickname) } @@ -169,7 +169,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testEditMenuButtonDidTapSubject.send(()) // then - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertEqual(checkRoom, testRoom) XCTAssertEqual(checkMode, testMode) } @@ -196,7 +196,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testDeleteMenuButtonDidTapSubject.send(()) // then - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertTrue(testBool) } @@ -222,7 +222,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testLeaveMenuButtonDidTapSubject.send(()) // then - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertTrue(testBool) } @@ -240,7 +240,7 @@ final class DetailWaitViewModelTest: XCTestCase { testRoom = self.viewModel.makeRoomInformation() expectation.fulfill() } - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertEqual(checkRoom, testRoom) } @@ -258,7 +258,7 @@ final class DetailWaitViewModelTest: XCTestCase { testRoom = self.viewModel.makeRoomInformation() expectation.fulfill() } - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertEqual(checkRoom, testRoom) } } From 829982ce14304a12ed7fd1d75b5c91b67881b418 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 22 Aug 2023 20:37:35 +0900 Subject: [PATCH 322/468] =?UTF-8?q?[FEAT]=20buttonDidTap=20mvvm=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreateRoom/CreateRoomViewController.swift | 10 ++- .../CreateRoom/View/CreateRoomView.swift | 62 ++++++++++++++++--- .../ViewModel/CreateRoomViewModel.swift | 11 +++- 3 files changed, 73 insertions(+), 10 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index 57684394b..554e55f0b 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -86,7 +86,8 @@ final class CreateRoomViewController: BaseViewController { private func transformedOutput() -> CreateRoomViewModel.Output { let input = CreateRoomViewModel.Input( textFieldTextDidChanged: self.createRoomView.roomTitleView.textFieldPublisher.eraseToAnyPublisher(), - sliderValueDidChanged: self.createRoomView.roomCapacityView.sliderPublisher.eraseToAnyPublisher()) + sliderValueDidChanged: self.createRoomView.roomCapacityView.sliderPublisher.eraseToAnyPublisher(), + nextButtonDidTap: self.createRoomView.nextButtonDidTapPublisher.eraseToAnyPublisher()) return self.createRoomViewModel.transform(input) } @@ -105,6 +106,13 @@ final class CreateRoomViewController: BaseViewController { }) .store(in: &cancellable) + + output.currentStep + .receive(on: DispatchQueue.main) + .sink(receiveValue: { [weak self] currentStep in + self?.createRoomView.nextButtonDidTap(step: currentStep) + }) + .store(in: &cancellable) } // MARK: - network diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index cef3bc16d..7c1eaabbe 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -5,6 +5,7 @@ // Created by 이성호 on 2023/08/02. // +import Combine import UIKit import SnapKit @@ -16,9 +17,9 @@ protocol CreateRoomViewDelegate: AnyObject { final class CreateRoomView: UIView { - fileprivate enum CreateRoomStep { - case inputTitle, inputCapacity, inputDate, checkRoom, chooseCharacter - } +// fileprivate enum CreateRoomStep { +// case inputTitle, inputCapacity, inputDate, checkRoom, chooseCharacter +// } // MARK: - ui component @@ -55,6 +56,8 @@ final class CreateRoomView: UIView { private let roomInfoView: CheckRoomInfoView = CheckRoomInfoView() private let characterCollectionView: CharacterCollectionView = CharacterCollectionView() + let nextButtonDidTapPublisher = PassthroughSubject() + // MARK: - property private var roomInfo: RoomInfo? @@ -136,10 +139,11 @@ final class CreateRoomView: UIView { let nextAction = UIAction { [weak self] _ in guard let currentStep = self?.roomStep else { return } - guard let nextStep = self?.moveToNextStep(from: currentStep) else { return } - - self?.runActionAtStep(at: currentStep) - self?.roomStep = nextStep +// guard let nextStep = self?.moveToNextStep(from: currentStep) else { return } +// +// self?.runActionAtStep(at: currentStep) +// self?.roomStep = nextStep + self?.nextButtonDidTapPublisher.send(currentStep) } self.nextButton.addAction(nextAction, for: .touchUpInside) @@ -279,6 +283,13 @@ final class CreateRoomView: UIView { } } + func nextButtonDidTap(step: CreateRoomStep) { + let nextStep = self.moveToNextStep(from: step) + + self.runActionAtStep(at: step) + self.roomStep = nextStep + } + private func manageStepView(step: CreateRoomStep) { self.updateHiddenStepView(at: step) self.updateHiddenBackButton(at: step) @@ -315,7 +326,41 @@ final class CreateRoomView: UIView { } } -private extension CreateRoomView.CreateRoomStep { +//private extension CreateRoomView.CreateRoomStep { +// func next() -> Self { +// switch self { +// case .inputTitle: +// return .inputCapacity +// case .inputCapacity: +// return .inputDate +// case .inputDate: +// return .checkRoom +// case .checkRoom: +// return .chooseCharacter +// case .chooseCharacter: +// return .chooseCharacter +// } +// } +// +// func previous() -> Self { +// switch self { +// case .inputTitle: +// return .inputTitle +// case .inputCapacity: +// return .inputTitle +// case .inputDate: +// return .inputCapacity +// case .checkRoom: +// return .inputDate +// case .chooseCharacter: +// return .checkRoom +// } +// } +//} + +enum CreateRoomStep { + case inputTitle, inputCapacity, inputDate, checkRoom, chooseCharacter + func next() -> Self { switch self { case .inputTitle: @@ -346,3 +391,4 @@ private extension CreateRoomView.CreateRoomStep { } } } + diff --git a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift index 9b8f80a8e..3a5799041 100644 --- a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift +++ b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift @@ -17,11 +17,13 @@ final class CreateRoomViewModel { struct Input { let textFieldTextDidChanged: AnyPublisher let sliderValueDidChanged: AnyPublisher + let nextButtonDidTap: AnyPublisher } struct Output { let textCount: AnyPublisher let capacity: AnyPublisher + let currentStep: AnyPublisher } func transform(_ input: Input) -> Output { @@ -37,8 +39,15 @@ final class CreateRoomViewModel { } .eraseToAnyPublisher() + let step = input.nextButtonDidTap + .map { currentStep -> CreateRoomStep in + return currentStep + } + .eraseToAnyPublisher() + return Output(textCount: textCount, - capacity: capacity) + capacity: capacity, + currentStep: step) } // MARK: - init From 5963f37afb1246dd370d2809de099ba6c85e6a69 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 22 Aug 2023 21:32:05 +0900 Subject: [PATCH 323/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20-=20private(set)=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=20(#403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChooseCharacter/View/ChooseCharacterView.swift | 2 +- .../UIComponent/CharacterCollectionView.swift | 6 +----- .../CreateRoom/UIComponent/CheckRoomInfoView.swift | 12 ++---------- .../Screens/CreateRoom/View/CreateRoomView.swift | 6 +++--- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift b/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift index d37d7bd13..f33e79636 100644 --- a/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift +++ b/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift @@ -104,7 +104,7 @@ final class ChooseCharacterView: UIView { self?.delegate?.closeButtonDidTap() } let didTapJoinButton = UIAction { [weak self] _ in - self?.delegate?.joinButtonDidTap(characterIndex: self?.manittoCollectionView.selectedCharacterIndex() ?? 0) + self?.delegate?.joinButtonDidTap(characterIndex: self?.manittoCollectionView.characterIndex ?? 0) } self.backButton.addAction(didTapBackButton, for: .touchUpInside) diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift index fad0b762e..b8aef22fd 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift @@ -45,7 +45,7 @@ final class CharacterCollectionView: UIView { // MARK: - property - private var characterIndex: Int = 0 + private(set) var characterIndex: Int = 0 // MARK: - init @@ -67,10 +67,6 @@ final class CharacterCollectionView: UIView { $0.edges.equalToSuperview() } } - - func selectedCharacterIndex() -> Int { - return self.characterIndex - } } extension CharacterCollectionView: UICollectionViewDataSource { diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift index 625f2901f..eace7ab0b 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift @@ -44,12 +44,12 @@ final class CheckRoomInfoView: UIView { self.dateLabel.text = newValue } } - private var title: String = "" { + private(set) var title: String = "" { willSet { self.nameLabel.text = newValue } } - private var capacity: Int = 0 { + private(set) var capacity: Int = 0 { willSet { self.personLabel.text = "\(newValue.description)" + TextLiteral.per } @@ -100,18 +100,10 @@ final class CheckRoomInfoView: UIView { self.title = title } - func roomTitle() -> String { - return self.title - } - func updateRoomCapacity(capacity: Int) { self.capacity = capacity } - func roomCapacity() -> Int { - return self.capacity - } - func updateRoomDateRange(range: String) { self.dateRange = range } diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index d3f65bde6..082f2bfcf 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -233,10 +233,10 @@ final class CreateRoomView: UIView { case .checkRoom: break case .chooseCharacter: - let colorIndex = self.characterCollectionView.selectedCharacterIndex() + let colorIndex = self.characterCollectionView.characterIndex self.delegate?.requestCreateRoom(roomInfo: RoomInfo(id: nil, - capacity: self.roomInfoView.roomCapacity(), - title: self.roomInfoView.roomTitle(), + capacity: self.roomInfoView.capacity, + title: self.roomInfoView.title, startDate: "20\(self.roomDateView.calendarView.getTempStartDate())", endDate: "20\(self.roomDateView.calendarView.getTempEndDate())", state: nil), From 45296ad1f1f5f3f4e0f3afa3a274f81265d987ee Mon Sep 17 00:00:00 2001 From: Mingwan Choi Date: Tue, 22 Aug 2023 22:31:29 +0900 Subject: [PATCH 324/468] =?UTF-8?q?[DOCS]=20self-hosted=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/XCTestBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/XCTestBuild.yml b/.github/workflows/XCTestBuild.yml index 0ae54d5a2..53a9f2c0d 100644 --- a/.github/workflows/XCTestBuild.yml +++ b/.github/workflows/XCTestBuild.yml @@ -9,7 +9,7 @@ on: branches: [ develop, release, hotfix, feature, main ] jobs: build: - runs-on: macos-latest + runs-on: self-hosted steps: - uses: actions/checkout@v2 From ba4f3f3ea874a0b1dc5732571293cff08fe06783 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 22 Aug 2023 22:45:33 +0900 Subject: [PATCH 325/468] =?UTF-8?q?[CHORE]=202=EC=B4=88=EB=A1=9C=20?= =?UTF-8?q?=EB=8B=A4=EC=8B=9C=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20(#488)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/ManitoTests/DetailWaitViewModelTest.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index 641a2275e..a6e6bd783 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -112,7 +112,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testViewDidLoadSubject.send(()) // then - wait(for: [expectation], timeout: 5) + wait(for: [expectation], timeout: 2) XCTAssertEqual(checkRoom, testRoom) } @@ -139,7 +139,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testStartButtonDidTapSubject.send(()) // then - wait(for: [expectation], timeout: 5) + wait(for: [expectation], timeout: 2) XCTAssertEqual(checkNickname, testNickname) } @@ -169,7 +169,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testEditMenuButtonDidTapSubject.send(()) // then - wait(for: [expectation], timeout: 5) + wait(for: [expectation], timeout: 2) XCTAssertEqual(checkRoom, testRoom) XCTAssertEqual(checkMode, testMode) } @@ -196,7 +196,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testDeleteMenuButtonDidTapSubject.send(()) // then - wait(for: [expectation], timeout: 5) + wait(for: [expectation], timeout: 2) XCTAssertTrue(testBool) } @@ -222,7 +222,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testLeaveMenuButtonDidTapSubject.send(()) // then - wait(for: [expectation], timeout: 5) + wait(for: [expectation], timeout: 2) XCTAssertTrue(testBool) } @@ -240,7 +240,7 @@ final class DetailWaitViewModelTest: XCTestCase { testRoom = self.viewModel.makeRoomInformation() expectation.fulfill() } - wait(for: [expectation], timeout: 5) + wait(for: [expectation], timeout: 2) XCTAssertEqual(checkRoom, testRoom) } @@ -258,7 +258,7 @@ final class DetailWaitViewModelTest: XCTestCase { testRoom = self.viewModel.makeRoomInformation() expectation.fulfill() } - wait(for: [expectation], timeout: 5) + wait(for: [expectation], timeout: 2) XCTAssertEqual(checkRoom, testRoom) } } From 560efe76fc61233d197ad8172221d4fe51586995 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 22 Aug 2023 23:14:19 +0900 Subject: [PATCH 326/468] =?UTF-8?q?[CHORE]=205=EC=B4=88=EB=A1=9C=20?= =?UTF-8?q?=EB=8B=A4=EC=8B=9C=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20(#448)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/ManitoTests/DetailWaitViewModelTest.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index a6e6bd783..641a2275e 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -112,7 +112,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testViewDidLoadSubject.send(()) // then - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertEqual(checkRoom, testRoom) } @@ -139,7 +139,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testStartButtonDidTapSubject.send(()) // then - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertEqual(checkNickname, testNickname) } @@ -169,7 +169,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testEditMenuButtonDidTapSubject.send(()) // then - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertEqual(checkRoom, testRoom) XCTAssertEqual(checkMode, testMode) } @@ -196,7 +196,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testDeleteMenuButtonDidTapSubject.send(()) // then - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertTrue(testBool) } @@ -222,7 +222,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testLeaveMenuButtonDidTapSubject.send(()) // then - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertTrue(testBool) } @@ -240,7 +240,7 @@ final class DetailWaitViewModelTest: XCTestCase { testRoom = self.viewModel.makeRoomInformation() expectation.fulfill() } - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertEqual(checkRoom, testRoom) } @@ -258,7 +258,7 @@ final class DetailWaitViewModelTest: XCTestCase { testRoom = self.viewModel.makeRoomInformation() expectation.fulfill() } - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertEqual(checkRoom, testRoom) } } From 7978ed4a54b3a5fea840742e7d2179ab6dcbe284 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 23 Aug 2023 20:58:00 +0900 Subject: [PATCH 327/468] =?UTF-8?q?[ADD]=20MTNetwork=20=EB=AA=A8=EB=93=88?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 66 +++- .../xcshareddata/swiftpm/Package.resolved | 24 +- .../MTNetwork.xcodeproj/project.pbxproj | 352 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + 5 files changed, 438 insertions(+), 19 deletions(-) create mode 100644 Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.pbxproj create mode 100644 Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index f08785f87..de8e87049 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -100,7 +100,6 @@ B517C04A28D1F7EC0008BED0 /* TokenEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */; }; B517C04C28D1FE5F0008BED0 /* TokenAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */; }; B517C04E28D1FE660008BED0 /* TokenProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04D28D1FE660008BED0 /* TokenProtocol.swift */; }; - B53AD35E2A763CC400B83B33 /* MTNetwork in Frameworks */ = {isa = PBXBuildFile; productRef = B53AD35D2A763CC400B83B33 /* MTNetwork */; }; B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */; }; B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741E929A494E200B75BA3 /* LetterImageError.swift */; }; B55B482229C3723B00CFFDAD /* URLRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55B482129C3723B00CFFDAD /* URLRepresentable.swift */; }; @@ -119,6 +118,8 @@ B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */; }; B5B3C1652A427B5800AABD6F /* UIControl+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */; }; B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */; }; + B5B6E4C42A962B2C0082FC7B /* MTNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5B6E4C32A962B0A0082FC7B /* MTNetwork.framework */; }; + B5B6E4C52A962B2C0082FC7B /* MTNetwork.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B5B6E4C32A962B0A0082FC7B /* MTNetwork.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2AD285B2917006D880B /* Int+Extension.swift */; }; B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */; }; B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */; }; @@ -205,8 +206,29 @@ remoteGlobalIDString = B5F524CA28519AA000614FF7; remoteInfo = Manito; }; + B5B6E4C22A962B0A0082FC7B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B5B6E4BE2A962B0A0082FC7B /* MTNetwork.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = B5B6E4B22A962AB00082FC7B; + remoteInfo = MTNetwork; + }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + B5B6E4C62A962B2D0082FC7B /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + B5B6E4C52A962B2C0082FC7B /* MTNetwork.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 333BF66528571CF00039F77F /* FriendCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendCollectionViewCell.swift; sourceTree = ""; }; 333BF669285864CE0039F77F /* MemoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryViewController.swift; sourceTree = ""; }; @@ -320,6 +342,7 @@ B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModelType.swift; sourceTree = ""; }; B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Combine.swift"; sourceTree = ""; }; B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Combine.swift"; sourceTree = ""; }; + B5B6E4BE2A962B0A0082FC7B /* MTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MTNetwork.xcodeproj; path = MTNetwork/MTNetwork.xcodeproj; sourceTree = ""; }; B5E1F2AD285B2917006D880B /* Int+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Extension.swift"; sourceTree = ""; }; B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeViewController.swift; sourceTree = ""; }; B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultStorage.swift; sourceTree = ""; }; @@ -417,7 +440,7 @@ 39FFE33428F457AF008442EE /* FirebaseMessaging in Frameworks */, B50B1B0428596C900080992C /* SnapKit in Frameworks */, B50B1B0728596CB10080992C /* FSCalendar in Frameworks */, - B53AD35E2A763CC400B83B33 /* MTNetwork in Frameworks */, + B5B6E4C42A962B2C0082FC7B /* MTNetwork.framework in Frameworks */, B50B1B33285AC0970080992C /* Gifu in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -755,6 +778,22 @@ path = Services; sourceTree = ""; }; + B5B6E4A72A9629D60082FC7B /* Modules */ = { + isa = PBXGroup; + children = ( + B5B6E4BE2A962B0A0082FC7B /* MTNetwork.xcodeproj */, + ); + path = Modules; + sourceTree = ""; + }; + B5B6E4BF2A962B0A0082FC7B /* Products */ = { + isa = PBXGroup; + children = ( + B5B6E4C32A962B0A0082FC7B /* MTNetwork.framework */, + ); + name = Products; + sourceTree = ""; + }; B5F31BAE28BE1C7900F61D0F /* Storage */ = { isa = PBXGroup; children = ( @@ -771,6 +810,7 @@ B53AD40F2A8BC69700B83B33 /* Configuration */, B5F524CD28519AA000614FF7 /* Manito */, 398B1CBA2A12415C00DEFCEC /* ManitoTests */, + B5B6E4A72A9629D60082FC7B /* Modules */, B57CB3022A763BB200474042 /* Packages */, B5F524CC28519AA000614FF7 /* Products */, 398B1CC82A13597600DEFCEC /* Frameworks */, @@ -1261,6 +1301,7 @@ B5F524C828519AA000614FF7 /* Frameworks */, B5F524C928519AA000614FF7 /* Resources */, B53AD41E2A8C892800B83B33 /* GoogleService-Info.plist */, + B5B6E4C62A962B2D0082FC7B /* Embed Frameworks */, ); buildRules = ( ); @@ -1273,7 +1314,6 @@ B50B1B32285AC0970080992C /* Gifu */, CB6637E72959CBC60050BD04 /* SkeletonView */, 39FFE33328F457AF008442EE /* FirebaseMessaging */, - B53AD35D2A763CC400B83B33 /* MTNetwork */, ); productName = Manito; productReference = B5F524CB28519AA000614FF7 /* Manito.app */; @@ -1316,6 +1356,12 @@ ); productRefGroup = B5F524CC28519AA000614FF7 /* Products */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = B5B6E4BF2A962B0A0082FC7B /* Products */; + ProjectRef = B5B6E4BE2A962B0A0082FC7B /* MTNetwork.xcodeproj */; + }, + ); projectRoot = ""; targets = ( B5F524CA28519AA000614FF7 /* Manito */, @@ -1324,6 +1370,16 @@ }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + B5B6E4C32A962B0A0082FC7B /* MTNetwork.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = MTNetwork.framework; + remoteRef = B5B6E4C22A962B0A0082FC7B /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXResourcesBuildPhase section */ 398B1CB72A12415B00DEFCEC /* Resources */ = { isa = PBXResourcesBuildPhase; @@ -1940,10 +1996,6 @@ package = B50B1B31285AC0970080992C /* XCRemoteSwiftPackageReference "Gifu" */; productName = Gifu; }; - B53AD35D2A763CC400B83B33 /* MTNetwork */ = { - isa = XCSwiftPackageProductDependency; - productName = MTNetwork; - }; CB6637E72959CBC60050BD04 /* SkeletonView */ = { isa = XCSwiftPackageProductDependency; package = CB6637E62959CBC60050BD04 /* XCRemoteSwiftPackageReference "SkeletonView" */; diff --git a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a3ff76c5d..a5052b187 100644 --- a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/kaishin/Gifu.git", "state" : { - "revision" : "82da0086dea14ca9afc9801234ad8dc4cd9e2738", - "version" : "3.4.1" + "revision" : "51f2eab32903e336f590c013267cfa4d7f8b06c4", + "version" : "3.3.1" } }, { @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleDataTransport.git", "state" : { - "revision" : "f6b558e3f801f2cac336b04f615ce111fa9ddaa0", - "version" : "9.2.1" + "revision" : "5056b15c5acbb90cd214fe4d6138bdf5a740e5a8", + "version" : "9.2.0" } }, { @@ -68,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleUtilities.git", "state" : { - "revision" : "0543562f85620b5b7c510c6bcbef75b562a5127b", - "version" : "7.11.0" + "revision" : "68ea347bdb1a69e2d2ae2e25cd085b6ef92f64cb", + "version" : "7.9.0" } }, { @@ -86,8 +86,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/gtm-session-fetcher.git", "state" : { - "revision" : "5ccda3981422a84186387dbb763ba739178b529c", - "version" : "2.3.0" + "revision" : "d4289da23e978f37c344ea6a386e5546e2466294", + "version" : "2.1.0" } }, { @@ -113,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/promises.git", "state" : { - "revision" : "ec957ccddbcc710ccc64c9dcbd4c7006fcf8b73a", - "version" : "2.2.0" + "revision" : "3e4e743631e86c8c70dbc6efdc7beaa6e90fd3bb", + "version" : "2.1.1" } }, { @@ -140,8 +140,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "0af9125c4eae12a4973fb66574c53a54962a9e1e", - "version" : "1.21.0" + "revision" : "88c7d15e1242fdb6ecbafbc7926426a19be1e98a", + "version" : "1.20.2" } } ], diff --git a/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.pbxproj b/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.pbxproj new file mode 100644 index 000000000..512c3088b --- /dev/null +++ b/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.pbxproj @@ -0,0 +1,352 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + B53A35A42A962B8E00B720BC /* MTNetwork in Frameworks */ = {isa = PBXBuildFile; productRef = B53A35A32A962B8E00B720BC /* MTNetwork */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + B5B6E4B22A962AB00082FC7B /* MTNetwork.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MTNetwork.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + B5B6E4C72A962B5C0082FC7B /* Packages */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Packages; path = ../../Packages; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + B5B6E4AF2A962AB00082FC7B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + B53A35A42A962B8E00B720BC /* MTNetwork in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + B53A35A22A962B8E00B720BC /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; + B5B6E4A82A962AB00082FC7B = { + isa = PBXGroup; + children = ( + B5B6E4C72A962B5C0082FC7B /* Packages */, + B5B6E4B32A962AB00082FC7B /* Products */, + B53A35A22A962B8E00B720BC /* Frameworks */, + ); + sourceTree = ""; + }; + B5B6E4B32A962AB00082FC7B /* Products */ = { + isa = PBXGroup; + children = ( + B5B6E4B22A962AB00082FC7B /* MTNetwork.framework */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + B5B6E4AD2A962AB00082FC7B /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + B5B6E4B12A962AB00082FC7B /* MTNetwork */ = { + isa = PBXNativeTarget; + buildConfigurationList = B5B6E4B92A962AB00082FC7B /* Build configuration list for PBXNativeTarget "MTNetwork" */; + buildPhases = ( + B5B6E4AD2A962AB00082FC7B /* Headers */, + B5B6E4AE2A962AB00082FC7B /* Sources */, + B5B6E4AF2A962AB00082FC7B /* Frameworks */, + B5B6E4B02A962AB00082FC7B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = MTNetwork; + packageProductDependencies = ( + B53A35A32A962B8E00B720BC /* MTNetwork */, + ); + productName = MTNetwork; + productReference = B5B6E4B22A962AB00082FC7B /* MTNetwork.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + B5B6E4A92A962AB00082FC7B /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastUpgradeCheck = 1430; + TargetAttributes = { + B5B6E4B12A962AB00082FC7B = { + CreatedOnToolsVersion = 14.3.1; + }; + }; + }; + buildConfigurationList = B5B6E4AC2A962AB00082FC7B /* Build configuration list for PBXProject "MTNetwork" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = B5B6E4A82A962AB00082FC7B; + productRefGroup = B5B6E4B32A962AB00082FC7B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + B5B6E4B12A962AB00082FC7B /* MTNetwork */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + B5B6E4B02A962AB00082FC7B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + B5B6E4AE2A962AB00082FC7B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + B5B6E4B72A962AB00082FC7B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.4; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + B5B6E4B82A962AB00082FC7B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.4; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + B5B6E4BA2A962AB00082FC7B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20"; + PRODUCT_BUNDLE_IDENTIFIER = com.TeamFirefighter.MTNetwork; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + B5B6E4BB2A962AB00082FC7B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20"; + PRODUCT_BUNDLE_IDENTIFIER = com.TeamFirefighter.MTNetwork; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + B5B6E4AC2A962AB00082FC7B /* Build configuration list for PBXProject "MTNetwork" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B5B6E4B72A962AB00082FC7B /* Debug */, + B5B6E4B82A962AB00082FC7B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B5B6E4B92A962AB00082FC7B /* Build configuration list for PBXNativeTarget "MTNetwork" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B5B6E4BA2A962AB00082FC7B /* Debug */, + B5B6E4BB2A962AB00082FC7B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCSwiftPackageProductDependency section */ + B53A35A32A962B8E00B720BC /* MTNetwork */ = { + isa = XCSwiftPackageProductDependency; + productName = MTNetwork; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = B5B6E4A92A962AB00082FC7B /* Project object */; +} diff --git a/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..919434a62 --- /dev/null +++ b/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + From fb805a409a626b245ac90694e80c068702ef76c6 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 23 Aug 2023 21:10:45 +0900 Subject: [PATCH 328/468] =?UTF-8?q?[DEL]=20MTNetwork=20=EB=AA=A8=EB=93=88?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 52 +-- .../MTNetwork.xcodeproj/project.pbxproj | 352 ------------------ .../contents.xcworkspacedata | 7 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - 4 files changed, 7 insertions(+), 412 deletions(-) delete mode 100644 Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.pbxproj delete mode 100644 Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index de8e87049..9c870964e 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -100,6 +100,7 @@ B517C04A28D1F7EC0008BED0 /* TokenEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */; }; B517C04C28D1FE5F0008BED0 /* TokenAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */; }; B517C04E28D1FE660008BED0 /* TokenProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04D28D1FE660008BED0 /* TokenProtocol.swift */; }; + B53A35AD2A962E9C00B720BC /* MTNetwork in Frameworks */ = {isa = PBXBuildFile; productRef = B53A35AC2A962E9C00B720BC /* MTNetwork */; }; B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */; }; B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741E929A494E200B75BA3 /* LetterImageError.swift */; }; B55B482229C3723B00CFFDAD /* URLRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55B482129C3723B00CFFDAD /* URLRepresentable.swift */; }; @@ -118,8 +119,6 @@ B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */; }; B5B3C1652A427B5800AABD6F /* UIControl+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */; }; B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */; }; - B5B6E4C42A962B2C0082FC7B /* MTNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5B6E4C32A962B0A0082FC7B /* MTNetwork.framework */; }; - B5B6E4C52A962B2C0082FC7B /* MTNetwork.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B5B6E4C32A962B0A0082FC7B /* MTNetwork.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2AD285B2917006D880B /* Int+Extension.swift */; }; B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */; }; B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */; }; @@ -206,13 +205,6 @@ remoteGlobalIDString = B5F524CA28519AA000614FF7; remoteInfo = Manito; }; - B5B6E4C22A962B0A0082FC7B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = B5B6E4BE2A962B0A0082FC7B /* MTNetwork.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = B5B6E4B22A962AB00082FC7B; - remoteInfo = MTNetwork; - }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -222,7 +214,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - B5B6E4C52A962B2C0082FC7B /* MTNetwork.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -342,7 +333,6 @@ B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModelType.swift; sourceTree = ""; }; B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Combine.swift"; sourceTree = ""; }; B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Combine.swift"; sourceTree = ""; }; - B5B6E4BE2A962B0A0082FC7B /* MTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MTNetwork.xcodeproj; path = MTNetwork/MTNetwork.xcodeproj; sourceTree = ""; }; B5E1F2AD285B2917006D880B /* Int+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Extension.swift"; sourceTree = ""; }; B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeViewController.swift; sourceTree = ""; }; B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultStorage.swift; sourceTree = ""; }; @@ -440,7 +430,7 @@ 39FFE33428F457AF008442EE /* FirebaseMessaging in Frameworks */, B50B1B0428596C900080992C /* SnapKit in Frameworks */, B50B1B0728596CB10080992C /* FSCalendar in Frameworks */, - B5B6E4C42A962B2C0082FC7B /* MTNetwork.framework in Frameworks */, + B53A35AD2A962E9C00B720BC /* MTNetwork in Frameworks */, B50B1B33285AC0970080992C /* Gifu in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -778,22 +768,6 @@ path = Services; sourceTree = ""; }; - B5B6E4A72A9629D60082FC7B /* Modules */ = { - isa = PBXGroup; - children = ( - B5B6E4BE2A962B0A0082FC7B /* MTNetwork.xcodeproj */, - ); - path = Modules; - sourceTree = ""; - }; - B5B6E4BF2A962B0A0082FC7B /* Products */ = { - isa = PBXGroup; - children = ( - B5B6E4C32A962B0A0082FC7B /* MTNetwork.framework */, - ); - name = Products; - sourceTree = ""; - }; B5F31BAE28BE1C7900F61D0F /* Storage */ = { isa = PBXGroup; children = ( @@ -810,7 +784,6 @@ B53AD40F2A8BC69700B83B33 /* Configuration */, B5F524CD28519AA000614FF7 /* Manito */, 398B1CBA2A12415C00DEFCEC /* ManitoTests */, - B5B6E4A72A9629D60082FC7B /* Modules */, B57CB3022A763BB200474042 /* Packages */, B5F524CC28519AA000614FF7 /* Products */, 398B1CC82A13597600DEFCEC /* Frameworks */, @@ -1314,6 +1287,7 @@ B50B1B32285AC0970080992C /* Gifu */, CB6637E72959CBC60050BD04 /* SkeletonView */, 39FFE33328F457AF008442EE /* FirebaseMessaging */, + B53A35AC2A962E9C00B720BC /* MTNetwork */, ); productName = Manito; productReference = B5F524CB28519AA000614FF7 /* Manito.app */; @@ -1356,12 +1330,6 @@ ); productRefGroup = B5F524CC28519AA000614FF7 /* Products */; projectDirPath = ""; - projectReferences = ( - { - ProductGroup = B5B6E4BF2A962B0A0082FC7B /* Products */; - ProjectRef = B5B6E4BE2A962B0A0082FC7B /* MTNetwork.xcodeproj */; - }, - ); projectRoot = ""; targets = ( B5F524CA28519AA000614FF7 /* Manito */, @@ -1370,16 +1338,6 @@ }; /* End PBXProject section */ -/* Begin PBXReferenceProxy section */ - B5B6E4C32A962B0A0082FC7B /* MTNetwork.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = MTNetwork.framework; - remoteRef = B5B6E4C22A962B0A0082FC7B /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - /* Begin PBXResourcesBuildPhase section */ 398B1CB72A12415B00DEFCEC /* Resources */ = { isa = PBXResourcesBuildPhase; @@ -1996,6 +1954,10 @@ package = B50B1B31285AC0970080992C /* XCRemoteSwiftPackageReference "Gifu" */; productName = Gifu; }; + B53A35AC2A962E9C00B720BC /* MTNetwork */ = { + isa = XCSwiftPackageProductDependency; + productName = MTNetwork; + }; CB6637E72959CBC60050BD04 /* SkeletonView */ = { isa = XCSwiftPackageProductDependency; package = CB6637E62959CBC60050BD04 /* XCRemoteSwiftPackageReference "SkeletonView" */; diff --git a/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.pbxproj b/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.pbxproj deleted file mode 100644 index 512c3088b..000000000 --- a/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.pbxproj +++ /dev/null @@ -1,352 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 56; - objects = { - -/* Begin PBXBuildFile section */ - B53A35A42A962B8E00B720BC /* MTNetwork in Frameworks */ = {isa = PBXBuildFile; productRef = B53A35A32A962B8E00B720BC /* MTNetwork */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - B5B6E4B22A962AB00082FC7B /* MTNetwork.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MTNetwork.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - B5B6E4C72A962B5C0082FC7B /* Packages */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Packages; path = ../../Packages; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - B5B6E4AF2A962AB00082FC7B /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - B53A35A42A962B8E00B720BC /* MTNetwork in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - B53A35A22A962B8E00B720BC /* Frameworks */ = { - isa = PBXGroup; - children = ( - ); - name = Frameworks; - sourceTree = ""; - }; - B5B6E4A82A962AB00082FC7B = { - isa = PBXGroup; - children = ( - B5B6E4C72A962B5C0082FC7B /* Packages */, - B5B6E4B32A962AB00082FC7B /* Products */, - B53A35A22A962B8E00B720BC /* Frameworks */, - ); - sourceTree = ""; - }; - B5B6E4B32A962AB00082FC7B /* Products */ = { - isa = PBXGroup; - children = ( - B5B6E4B22A962AB00082FC7B /* MTNetwork.framework */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - B5B6E4AD2A962AB00082FC7B /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - B5B6E4B12A962AB00082FC7B /* MTNetwork */ = { - isa = PBXNativeTarget; - buildConfigurationList = B5B6E4B92A962AB00082FC7B /* Build configuration list for PBXNativeTarget "MTNetwork" */; - buildPhases = ( - B5B6E4AD2A962AB00082FC7B /* Headers */, - B5B6E4AE2A962AB00082FC7B /* Sources */, - B5B6E4AF2A962AB00082FC7B /* Frameworks */, - B5B6E4B02A962AB00082FC7B /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = MTNetwork; - packageProductDependencies = ( - B53A35A32A962B8E00B720BC /* MTNetwork */, - ); - productName = MTNetwork; - productReference = B5B6E4B22A962AB00082FC7B /* MTNetwork.framework */; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - B5B6E4A92A962AB00082FC7B /* Project object */ = { - isa = PBXProject; - attributes = { - BuildIndependentTargetsInParallel = 1; - LastUpgradeCheck = 1430; - TargetAttributes = { - B5B6E4B12A962AB00082FC7B = { - CreatedOnToolsVersion = 14.3.1; - }; - }; - }; - buildConfigurationList = B5B6E4AC2A962AB00082FC7B /* Build configuration list for PBXProject "MTNetwork" */; - compatibilityVersion = "Xcode 14.0"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = B5B6E4A82A962AB00082FC7B; - productRefGroup = B5B6E4B32A962AB00082FC7B /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - B5B6E4B12A962AB00082FC7B /* MTNetwork */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - B5B6E4B02A962AB00082FC7B /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - B5B6E4AE2A962AB00082FC7B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - B5B6E4B72A962AB00082FC7B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 16.4; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - B5B6E4B82A962AB00082FC7B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 16.4; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - SDKROOT = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - B5B6E4BA2A962AB00082FC7B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = YES; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_NSHumanReadableCopyright = ""; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MARKETING_VERSION = 1.0; - MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; - MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20"; - PRODUCT_BUNDLE_IDENTIFIER = com.TeamFirefighter.MTNetwork; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SKIP_INSTALL = YES; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - B5B6E4BB2A962AB00082FC7B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_MODULE_VERIFIER = YES; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_NSHumanReadableCopyright = ""; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MARKETING_VERSION = 1.0; - MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; - MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20"; - PRODUCT_BUNDLE_IDENTIFIER = com.TeamFirefighter.MTNetwork; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SKIP_INSTALL = YES; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - B5B6E4AC2A962AB00082FC7B /* Build configuration list for PBXProject "MTNetwork" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - B5B6E4B72A962AB00082FC7B /* Debug */, - B5B6E4B82A962AB00082FC7B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - B5B6E4B92A962AB00082FC7B /* Build configuration list for PBXNativeTarget "MTNetwork" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - B5B6E4BA2A962AB00082FC7B /* Debug */, - B5B6E4BB2A962AB00082FC7B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - -/* Begin XCSwiftPackageProductDependency section */ - B53A35A32A962B8E00B720BC /* MTNetwork */ = { - isa = XCSwiftPackageProductDependency; - productName = MTNetwork; - }; -/* End XCSwiftPackageProductDependency section */ - }; - rootObject = B5B6E4A92A962AB00082FC7B /* Project object */; -} diff --git a/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a62..000000000 --- a/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003..000000000 --- a/Manito/Modules/MTNetwork/MTNetwork.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - From 1f4a79493bc883c7d7d48f3506aab63046c30173 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 23 Aug 2023 21:18:50 +0900 Subject: [PATCH 329/468] =?UTF-8?q?[CHORE]=20Network=20Foundation=20?= =?UTF-8?q?=EC=88=98=EC=A0=95(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 44 ++-------- Manito/Manito/Global/Literal/URLLiteral.swift | 8 -- .../Network/Foundation/APIEnvironment.swift | 16 ++-- .../Network/Foundation/APIService.swift | 81 ------------------- .../Network/Foundation/Endpointable.swift | 15 ---- .../Network/Foundation/HTTPMethod.swift | 16 ---- .../Foundation/Key+Extension.swift} | 4 +- .../Foundation/Key.plist} | 0 .../Network/Foundation/NetworkError.swift | 15 ---- .../Network/Foundation/NetworkRequest.swift | 38 --------- .../Network/Foundation/Requestable.swift | 16 ---- .../Network/Foundation/URLRepresentable.swift | 18 ----- 12 files changed, 16 insertions(+), 255 deletions(-) delete mode 100644 Manito/Manito/Network/Foundation/APIService.swift delete mode 100644 Manito/Manito/Network/Foundation/Endpointable.swift delete mode 100644 Manito/Manito/Network/Foundation/HTTPMethod.swift rename Manito/Manito/{Global/Extension/URLInfo+Extension.swift => Network/Foundation/Key+Extension.swift} (72%) rename Manito/Manito/{Global/Literal/URLInfo.plist => Network/Foundation/Key.plist} (100%) delete mode 100644 Manito/Manito/Network/Foundation/NetworkError.swift delete mode 100644 Manito/Manito/Network/Foundation/NetworkRequest.swift delete mode 100644 Manito/Manito/Network/Foundation/Requestable.swift delete mode 100644 Manito/Manito/Network/Foundation/URLRepresentable.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 9c870964e..f8ef2d17c 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -11,8 +11,8 @@ 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 333BF669285864CE0039F77F /* MemoryViewController.swift */; }; 33BDF5622856E03800564211 /* FriendListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33BDF5612856E03800564211 /* FriendListViewController.swift */; }; 39018F4228C4708A00C78DBA /* UIButton+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */; }; - 3915D54B2A7516A2002D6C25 /* URLInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3915D54A2A7516A2002D6C25 /* URLInfo.plist */; }; - 3915D54D2A7516E9002D6C25 /* URLInfo+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3915D54C2A7516E9002D6C25 /* URLInfo+Extension.swift */; }; + 3915D54B2A7516A2002D6C25 /* Key.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3915D54A2A7516A2002D6C25 /* Key.plist */; }; + 3915D54D2A7516E9002D6C25 /* Key+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */; }; 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391612D729E9231B004AE982 /* DetailWaitView.swift */; }; 391B3003286198C200421F1D /* Size.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391B3002286198C200421F1D /* Size.swift */; }; 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392EC77D2855C388006918A9 /* SettingButton.swift */; }; @@ -36,15 +36,10 @@ 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */; }; 39C957D02879521400A04A2B /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CF2879521400A04A2B /* String+Extension.swift */; }; 39C957D22879523200A04A2B /* Date+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957D12879523200A04A2B /* Date+Extension.swift */; }; - 39C957D628799AB900A04A2B /* HTTPMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957D528799AB900A04A2B /* HTTPMethod.swift */; }; - 39C957D828799DB900A04A2B /* NetworkError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957D728799DB900A04A2B /* NetworkError.swift */; }; 39C957DD2879A2B600A04A2B /* Room.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957DC2879A2B600A04A2B /* Room.swift */; }; 39C957DF2879A35300A04A2B /* RoomDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957DE2879A35300A04A2B /* RoomDTO.swift */; }; 39C957E12879A3CF00A04A2B /* DailyMission.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957E02879A3CF00A04A2B /* DailyMission.swift */; }; 39C957ED287AE4D100A04A2B /* MainEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957EC287AE4D100A04A2B /* MainEndPoint.swift */; }; - 39C957EF287AEBB400A04A2B /* Endpointable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957EE287AEBB400A04A2B /* Endpointable.swift */; }; - 39C957F4287D9EB400A04A2B /* APIService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957F3287D9EB400A04A2B /* APIService.swift */; }; - 39C957F6287D9ED000A04A2B /* NetworkRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957F5287D9ED000A04A2B /* NetworkRequest.swift */; }; 39C957FC287DAAFA00A04A2B /* DetailWaitEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957FB287DAAFA00A04A2B /* DetailWaitEndPoint.swift */; }; 39C957FE287DAB6D00A04A2B /* DetailIngEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957FD287DAB6D00A04A2B /* DetailIngEndPoint.swift */; }; 39C95800287DAC2900A04A2B /* DetailDoneEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957FF287DAC2900A04A2B /* DetailDoneEndPoint.swift */; }; @@ -103,7 +98,6 @@ B53A35AD2A962E9C00B720BC /* MTNetwork in Frameworks */ = {isa = PBXBuildFile; productRef = B53A35AC2A962E9C00B720BC /* MTNetwork */; }; B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */; }; B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741E929A494E200B75BA3 /* LetterImageError.swift */; }; - B55B482229C3723B00CFFDAD /* URLRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55B482129C3723B00CFFDAD /* URLRepresentable.swift */; }; B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55BCEB328D8449E00AF7E45 /* MemoryCollectionViewCell.swift */; }; B55BCEB628D99F8600AF7E45 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = B55BCEB528D99F8600AF7E45 /* Settings.bundle */; }; B55BCEC628F5AFB200AF7E45 /* capsule.gif in Resources */ = {isa = PBXBuildFile; fileRef = B55BCEC528F5AFB200AF7E45 /* capsule.gif */; }; @@ -126,7 +120,6 @@ B5F31C5028BF922E00F61D0F /* LetterViewController+MailCompose.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31C4F28BF922E00F61D0F /* LetterViewController+MailCompose.swift */; }; B5F31C5228BFA64F00F61D0F /* LetterAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31C5128BFA64F00F61D0F /* LetterAPI.swift */; }; B5F31C5428BFA70100F61D0F /* LetterProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31C5328BFA70100F61D0F /* LetterProtocol.swift */; }; - B5F31C5628BFA87700F61D0F /* Requestable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31C5528BFA87700F61D0F /* Requestable.swift */; }; B5F524CF28519AA000614FF7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F524CE28519AA000614FF7 /* AppDelegate.swift */; }; B5F524D128519AA000614FF7 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F524D028519AA000614FF7 /* SceneDelegate.swift */; }; B5F524D628519AA000614FF7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B5F524D428519AA000614FF7 /* Main.storyboard */; }; @@ -225,8 +218,8 @@ 333BF669285864CE0039F77F /* MemoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryViewController.swift; sourceTree = ""; }; 33BDF5612856E03800564211 /* FriendListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendListViewController.swift; sourceTree = ""; }; 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+Extension.swift"; sourceTree = ""; }; - 3915D54A2A7516A2002D6C25 /* URLInfo.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = URLInfo.plist; sourceTree = ""; }; - 3915D54C2A7516E9002D6C25 /* URLInfo+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URLInfo+Extension.swift"; sourceTree = ""; }; + 3915D54A2A7516A2002D6C25 /* Key.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Key.plist; sourceTree = ""; }; + 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Key+Extension.swift"; sourceTree = ""; }; 391612D729E9231B004AE982 /* DetailWaitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitView.swift; sourceTree = ""; }; 391B3002286198C200421F1D /* Size.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Size.swift; sourceTree = ""; }; 392EC77D2855C388006918A9 /* SettingButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingButton.swift; sourceTree = ""; }; @@ -248,16 +241,11 @@ 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; 39C957CF2879521400A04A2B /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = ""; }; 39C957D12879523200A04A2B /* Date+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Extension.swift"; sourceTree = ""; }; - 39C957D528799AB900A04A2B /* HTTPMethod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPMethod.swift; sourceTree = ""; }; - 39C957D728799DB900A04A2B /* NetworkError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkError.swift; sourceTree = ""; }; 39C957DC2879A2B600A04A2B /* Room.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Room.swift; sourceTree = ""; }; 39C957DE2879A35300A04A2B /* RoomDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDTO.swift; sourceTree = ""; }; 39C957E02879A3CF00A04A2B /* DailyMission.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyMission.swift; sourceTree = ""; }; 39C957EC287AE4D100A04A2B /* MainEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainEndPoint.swift; sourceTree = ""; }; - 39C957EE287AEBB400A04A2B /* Endpointable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Endpointable.swift; sourceTree = ""; }; 39C957F0287D984900A04A2B /* APIEnvironment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIEnvironment.swift; sourceTree = ""; }; - 39C957F3287D9EB400A04A2B /* APIService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIService.swift; sourceTree = ""; }; - 39C957F5287D9ED000A04A2B /* NetworkRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkRequest.swift; sourceTree = ""; }; 39C957FB287DAAFA00A04A2B /* DetailWaitEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitEndPoint.swift; sourceTree = ""; }; 39C957FD287DAB6D00A04A2B /* DetailIngEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailIngEndPoint.swift; sourceTree = ""; }; 39C957FF287DAC2900A04A2B /* DetailDoneEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailDoneEndPoint.swift; sourceTree = ""; }; @@ -316,7 +304,6 @@ B53AD41D2A8C88E100B83B33 /* GoogleService-Info-Dev.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Dev.plist"; sourceTree = ""; }; B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterImageView.swift; sourceTree = ""; }; B54741E929A494E200B75BA3 /* LetterImageError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterImageError.swift; sourceTree = ""; }; - B55B482129C3723B00CFFDAD /* URLRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLRepresentable.swift; sourceTree = ""; }; B55BCEB328D8449E00AF7E45 /* MemoryCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryCollectionViewCell.swift; sourceTree = ""; }; B55BCEB528D99F8600AF7E45 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = ""; }; B55BCEC528F5AFB200AF7E45 /* capsule.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = capsule.gif; sourceTree = ""; }; @@ -340,7 +327,6 @@ B5F31C4F28BF922E00F61D0F /* LetterViewController+MailCompose.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LetterViewController+MailCompose.swift"; sourceTree = ""; }; B5F31C5128BFA64F00F61D0F /* LetterAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterAPI.swift; sourceTree = ""; }; B5F31C5328BFA70100F61D0F /* LetterProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterProtocol.swift; sourceTree = ""; }; - B5F31C5528BFA87700F61D0F /* Requestable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Requestable.swift; sourceTree = ""; }; B5F524CB28519AA000614FF7 /* Manito.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Manito.app; sourceTree = BUILT_PRODUCTS_DIR; }; B5F524CE28519AA000614FF7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; B5F524D028519AA000614FF7 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -542,14 +528,9 @@ 39C957D328799A8200A04A2B /* Foundation */ = { isa = PBXGroup; children = ( - 39C957D528799AB900A04A2B /* HTTPMethod.swift */, - 39C957D728799DB900A04A2B /* NetworkError.swift */, - 39C957EE287AEBB400A04A2B /* Endpointable.swift */, + 3915D54A2A7516A2002D6C25 /* Key.plist */, + 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */, 39C957F0287D984900A04A2B /* APIEnvironment.swift */, - 39C957F3287D9EB400A04A2B /* APIService.swift */, - 39C957F5287D9ED000A04A2B /* NetworkRequest.swift */, - B5F31C5528BFA87700F61D0F /* Requestable.swift */, - B55B482129C3723B00CFFDAD /* URLRepresentable.swift */, ); path = Foundation; sourceTree = ""; @@ -956,7 +937,6 @@ B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */, B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */, B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */, - 3915D54C2A7516E9002D6C25 /* URLInfo+Extension.swift */, B50CEEBF2A6FF82600CF1C76 /* Publisher+Extension.swift */, ); path = Extension; @@ -999,7 +979,6 @@ CB7B23A728C4ECA8004A4CF3 /* Character.swift */, 7E15F67D28B35B3D00441305 /* TextLiteral.swift */, D777D2C828C7780E008655BD /* URLLiteral.swift */, - 3915D54A2A7516A2002D6C25 /* URLInfo.plist */, ); path = Literal; sourceTree = ""; @@ -1354,7 +1333,7 @@ CB2F0FCD28A5468C005F04C8 /* gifNi.gif in Resources */, B50B1B3C285AD2B20080992C /* logo.gif in Resources */, 7E0C5C382855B73100F698D1 /* Splash.storyboard in Resources */, - 3915D54B2A7516A2002D6C25 /* URLInfo.plist in Resources */, + 3915D54B2A7516A2002D6C25 /* Key.plist in Resources */, B5F524DB28519AA100614FF7 /* LaunchScreen.storyboard in Resources */, B5F524D828519AA100614FF7 /* Assets.xcassets in Resources */, B55BCEB628D99F8600AF7E45 /* Settings.bundle in Resources */, @@ -1412,11 +1391,9 @@ 39D95265285B097800183B09 /* CalendarView.swift in Sources */, 39EEF65828CB3C1100437654 /* Login.swift in Sources */, 39C957ED287AE4D100A04A2B /* MainEndPoint.swift in Sources */, - 39C957EF287AEBB400A04A2B /* Endpointable.swift in Sources */, B5F525292851A2A400614FF7 /* Logger.swift in Sources */, B50B1AFF2856D3820080992C /* CreateLetterPhotoView.swift in Sources */, 397A241A28BA532A00454E4F /* FriendList.swift in Sources */, - B5F31C5628BFA87700F61D0F /* Requestable.swift in Sources */, 397A241028BA494100454E4F /* APIEnvironment.swift in Sources */, CBBFF77C287AE491006A5964 /* DeveloperInfoViewCell.swift in Sources */, B517C04E28D1FE660008BED0 /* TokenProtocol.swift in Sources */, @@ -1434,7 +1411,6 @@ B5F524FB28519C2A00614FF7 /* MainViewController.swift in Sources */, 7E3058C62854B47F00489E6A /* InputTitleView.swift in Sources */, B5F5250128519EFB00614FF7 /* ImageLiteral.swift in Sources */, - 39C957D828799DB900A04A2B /* NetworkError.swift in Sources */, 39F1C12E28D756E600585B83 /* LetterImageViewController.swift in Sources */, 7E7542B32923744300D725CB /* ToastPopupView.swift in Sources */, 39CD581B28C4BE8800496E91 /* DetailStartingAPI.swift in Sources */, @@ -1456,7 +1432,6 @@ 7E77DB0828BF9D2400E95D4B /* RoomAPI.swift in Sources */, B50B1B44285B146A0080992C /* OpenManittoCollectionViewCell.swift in Sources */, B5F5253128545E4C00614FF7 /* BackButton.swift in Sources */, - 39C957D628799AB900A04A2B /* HTTPMethod.swift in Sources */, 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */, B5F525202851A21D00614FF7 /* UIViewController+Extension.swift in Sources */, 7ED845BA2876BE530075AC61 /* SettingViewTableCell.swift in Sources */, @@ -1466,7 +1441,6 @@ 39C957DF2879A35300A04A2B /* RoomDTO.swift in Sources */, 39EE956D2A401ED400AF6857 /* DetailingView.swift in Sources */, 39C95808287DB05C00A04A2B /* SettingEndPoint.swift in Sources */, - 39C957F4287D9EB400A04A2B /* APIService.swift in Sources */, B5F524CF28519AA000614FF7 /* AppDelegate.swift in Sources */, 39A938972A48565500EC2CF2 /* MissionEditAPI.swift in Sources */, 435B17682913E71400212663 /* DetailingViewController.swift in Sources */, @@ -1479,7 +1453,6 @@ 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */, B5F5251E2851A1C700614FF7 /* BaseTableViewCell.swift in Sources */, 39BDDCC42A52BB4A005E0A71 /* DetailWaitService.swift in Sources */, - 39C957F6287D9ED000A04A2B /* NetworkRequest.swift in Sources */, B50CEEC02A6FF82600CF1C76 /* Publisher+Extension.swift in Sources */, 39EEF65C28CB3CD600437654 /* LoginAPI.swift in Sources */, B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */, @@ -1529,7 +1502,7 @@ D7C4A1AD2A0DD8FA00C3AE4C /* SettingView.swift in Sources */, 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */, D7C4A1B02A0E522800C3AE4C /* SettingViewController+MailComposeViewControllerDelegate.swift in Sources */, - 3915D54D2A7516E9002D6C25 /* URLInfo+Extension.swift in Sources */, + 3915D54D2A7516E9002D6C25 /* Key+Extension.swift in Sources */, 33BDF5622856E03800564211 /* FriendListViewController.swift in Sources */, B5F5250E2851A07700614FF7 /* LetterViewController.swift in Sources */, B5F5251C2851A19A00614FF7 /* BaseCollectionViewCell.swift in Sources */, @@ -1555,7 +1528,6 @@ CB358C0228A564080084D001 /* SettingDeveloperInfoViewController.swift in Sources */, CB7B23A828C4ECA8004A4CF3 /* Character.swift in Sources */, 39C957E12879A3CF00A04A2B /* DailyMission.swift in Sources */, - B55B482229C3723B00CFFDAD /* URLRepresentable.swift in Sources */, B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */, 39CD582128C4C3E800496E91 /* DetailDoneAPI.swift in Sources */, D724AF5D287088310003F280 /* SettingViewController.swift in Sources */, diff --git a/Manito/Manito/Global/Literal/URLLiteral.swift b/Manito/Manito/Global/Literal/URLLiteral.swift index 588c7e15a..9fdcae7a6 100644 --- a/Manito/Manito/Global/Literal/URLLiteral.swift +++ b/Manito/Manito/Global/Literal/URLLiteral.swift @@ -8,15 +8,7 @@ import Foundation enum URLLiteral { - - // MARK: - server url - #if DEV - static let baseURL = Bundle.main.developmentURL - #elseif PROD - static let baseURL = Bundle.main.productionURL - #endif - // MARK: - notion url static let personalInfomationUrl: String = "https://torpid-spy-8e4.notion.site/767e80eea1734539aead3b814016b361" diff --git a/Manito/Manito/Network/Foundation/APIEnvironment.swift b/Manito/Manito/Network/Foundation/APIEnvironment.swift index 077ae7f8e..677e491b4 100644 --- a/Manito/Manito/Network/Foundation/APIEnvironment.swift +++ b/Manito/Manito/Network/Foundation/APIEnvironment.swift @@ -7,14 +7,10 @@ import Foundation -enum APIEnvironment: String { - case v1 = "/v1" - case v2 = "/v2" - case none = "" - - static func baseURL(_ version: Self = v1) -> String { - return URLLiteral.baseURL + "/api\(version.rawValue)" - } - - static let boundary: String = "com.TeamFirefighter.Manito" +enum APIEnvironment { + #if DEV + static let baseURL = Bundle.main.developmentURL + #elseif PROD + static let baseURL = Bundle.main.productionURL + #endif } diff --git a/Manito/Manito/Network/Foundation/APIService.swift b/Manito/Manito/Network/Foundation/APIService.swift deleted file mode 100644 index 7bc2f6460..000000000 --- a/Manito/Manito/Network/Foundation/APIService.swift +++ /dev/null @@ -1,81 +0,0 @@ -// -// APIService.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -final class APIService: Requestable { - - var requestTimeOut: Float = 30 - - func request(_ request: NetworkRequest) async throws -> T? { - let (data, httpResponse) = try await requestDataToUrl(request) - - switch httpResponse.statusCode { - case (200..<300): - let decoder = JSONDecoder() - let baseModelData: T? = try decoder.decode(T.self, from: data) - return baseModelData - case (300..<500): - throw NetworkError.clientError(message: httpResponse.statusCode.description) - default: - throw NetworkError.serverError - } - } - - func request(_ request: NetworkRequest) async throws -> Int { - let (_, httpResponse) = try await requestDataToUrl(request) - - switch httpResponse.statusCode { - case (200..<300): - return httpResponse.statusCode - case (300..<500): - throw NetworkError.clientError(message: httpResponse.statusCode.description) - default: - throw NetworkError.serverError - } - } - - func requestCreateRoom(_ request: NetworkRequest) async throws -> Int? { - let (_, httpResponse) = try await requestDataToUrl(request) - - switch httpResponse.statusCode { - case (200..<300): - let responseUrl = httpResponse.value(forHTTPHeaderField: "Location") - return responseUrl?.roomId - case (300..<500): - throw NetworkError.clientError(message: httpResponse.statusCode.description) - default: - throw NetworkError.serverError - } - } -} - -extension APIService { - typealias URLResponse = (Data, HTTPURLResponse) - - private func requestDataToUrl(_ request: NetworkRequest) async throws -> URLResponse { - let sessionConfig = URLSessionConfiguration.default - sessionConfig.timeoutIntervalForRequest = TimeInterval(request.requestTimeOut ?? requestTimeOut) - guard let encodedUrl = request.url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed), - let url = URL(string: encodedUrl) else { - throw NetworkError.encodingError - } - print("encodedUrl = \(encodedUrl)") - - let (data, response) = try await URLSession.shared.data(for: request.buildURLRequest(with: url)) - guard let httpResponse = response as? HTTPURLResponse else { throw NetworkError.serverError } - - return (data, httpResponse) - } -} - -private extension String { - var roomId: Int? { - guard let id = self.split(separator: "/").last.map({ Int($0) }) else { return nil } - return id - } -} diff --git a/Manito/Manito/Network/Foundation/Endpointable.swift b/Manito/Manito/Network/Foundation/Endpointable.swift deleted file mode 100644 index 65b655ae2..000000000 --- a/Manito/Manito/Network/Foundation/Endpointable.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// Endpointable.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/10. -// - -import Foundation - -protocol EndPointable { - var requestTimeOut: Float { get } - var httpMethod: HTTPMethod { get } - var requestBody: Data? { get } - var url: String { get } -} diff --git a/Manito/Manito/Network/Foundation/HTTPMethod.swift b/Manito/Manito/Network/Foundation/HTTPMethod.swift deleted file mode 100644 index dad051491..000000000 --- a/Manito/Manito/Network/Foundation/HTTPMethod.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// HTTPMethod.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/09. -// - -import Foundation - -enum HTTPMethod: String { - case get = "GET" - case post = "POST" - case put = "PUT" - case patch = "PATCH" - case delete = "DELETE" -} diff --git a/Manito/Manito/Global/Extension/URLInfo+Extension.swift b/Manito/Manito/Network/Foundation/Key+Extension.swift similarity index 72% rename from Manito/Manito/Global/Extension/URLInfo+Extension.swift rename to Manito/Manito/Network/Foundation/Key+Extension.swift index ddd6221c7..2377d8796 100644 --- a/Manito/Manito/Global/Extension/URLInfo+Extension.swift +++ b/Manito/Manito/Network/Foundation/Key+Extension.swift @@ -9,14 +9,14 @@ import Foundation extension Bundle { var productionURL: String { - guard let file = self.path(forResource: "URLInfo", ofType: "plist") else { return "URLInfo 파일이 없습니다." } + guard let file = self.path(forResource: "Key", ofType: "plist") else { return "Key 파일이 없습니다." } guard let resource = NSDictionary(contentsOfFile: file) else { return "" } guard let key = resource["Production URL"] as? String else { fatalError("Production URL을 입력해 주세요") } return key } var developmentURL: String { - guard let file = self.path(forResource: "URLInfo", ofType: "plist") else { return "URLInfo 파일이 없습니다." } + guard let file = self.path(forResource: "Key", ofType: "plist") else { return "Key 파일이 없습니다." } guard let resource = NSDictionary(contentsOfFile: file) else { return "" } guard let key = resource["Development URL"] as? String else { fatalError("Development URL을 입력해 주세요") } return key diff --git a/Manito/Manito/Global/Literal/URLInfo.plist b/Manito/Manito/Network/Foundation/Key.plist similarity index 100% rename from Manito/Manito/Global/Literal/URLInfo.plist rename to Manito/Manito/Network/Foundation/Key.plist diff --git a/Manito/Manito/Network/Foundation/NetworkError.swift b/Manito/Manito/Network/Foundation/NetworkError.swift deleted file mode 100644 index 090a138cc..000000000 --- a/Manito/Manito/Network/Foundation/NetworkError.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// NetworkError.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/09. -// - -import Foundation - -enum NetworkError: Error { - case encodingError - case clientError(message: String?) - case serverError - case unknownError -} diff --git a/Manito/Manito/Network/Foundation/NetworkRequest.swift b/Manito/Manito/Network/Foundation/NetworkRequest.swift deleted file mode 100644 index b02d247be..000000000 --- a/Manito/Manito/Network/Foundation/NetworkRequest.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// NetworkRequest.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -struct NetworkRequest { - let url: String - let headers: [String: String]? - let body: Data? - let requestTimeOut: Float? - let httpMethod: HTTPMethod - - init(url: String, - headers: [String: String]? = nil, - reqBody: Data? = nil, - reqTimeout: Float? = nil, - httpMethod: HTTPMethod - ) { - self.url = url - self.headers = headers - self.body = reqBody - self.requestTimeOut = reqTimeout - self.httpMethod = httpMethod - } - - func buildURLRequest(with url: URL) -> URLRequest { - var urlRequest = URLRequest(url: url) - urlRequest.setValue("Bearer " + UserDefaultStorage.accessToken, forHTTPHeaderField: "Authorization") - urlRequest.httpMethod = httpMethod.rawValue - urlRequest.allHTTPHeaderFields = headers ?? [:] - urlRequest.httpBody = body - return urlRequest - } -} diff --git a/Manito/Manito/Network/Foundation/Requestable.swift b/Manito/Manito/Network/Foundation/Requestable.swift deleted file mode 100644 index 060a824f5..000000000 --- a/Manito/Manito/Network/Foundation/Requestable.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// Requestable.swift -// Manito -// -// Created by SHIN YOON AH on 2022/08/31. -// - -import Foundation - -protocol Requestable { - var requestTimeOut: Float { get } - - func request(_ request: NetworkRequest) async throws -> T? - func request(_ request: NetworkRequest) async throws -> Int - func requestCreateRoom(_ request: NetworkRequest) async throws -> Int? -} diff --git a/Manito/Manito/Network/Foundation/URLRepresentable.swift b/Manito/Manito/Network/Foundation/URLRepresentable.swift deleted file mode 100644 index bd82f5793..000000000 --- a/Manito/Manito/Network/Foundation/URLRepresentable.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// URLRepresentable.swift -// Manito -// -// Created by SHIN YOON AH on 2023/03/17. -// - -import Foundation - -protocol URLRepresentable { - var path: String { get } -} - -extension URLRepresentable { - subscript(_ `case`: Self, version: APIEnvironment = .v1) -> String { - return APIEnvironment.baseURL(version) + "\(`case`.path)" - } -} From bfd7f4cb970de2e60c73b0ea159d84f7afb14ab7 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 23 Aug 2023 21:22:46 +0900 Subject: [PATCH 330/468] =?UTF-8?q?[MOVE]=20UserDefault=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=98=AE=EA=B9=80(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 30 ++++++++++++------- .../UserDefaultHandler.swift | 0 .../UserDefaultStorage.swift | 0 3 files changed, 19 insertions(+), 11 deletions(-) rename Manito/Manito/{Network/Storage => Service/UserDefaultService}/UserDefaultHandler.swift (100%) rename Manito/Manito/{Network/Storage => Service/UserDefaultService}/UserDefaultStorage.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index f8ef2d17c..65fc6f9a6 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -632,6 +632,23 @@ path = Cell; sourceTree = ""; }; + B53A35B22A9630FE00B720BC /* Service */ = { + isa = PBXGroup; + children = ( + B53A35B32A96310700B720BC /* UserDefaultService */, + ); + path = Service; + sourceTree = ""; + }; + B53A35B32A96310700B720BC /* UserDefaultService */ = { + isa = PBXGroup; + children = ( + B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */, + B5F31BB128BE1CD700F61D0F /* UserDefaultHandler.swift */, + ); + path = UserDefaultService; + sourceTree = ""; + }; B53AD40F2A8BC69700B83B33 /* Configuration */ = { isa = PBXGroup; children = ( @@ -749,15 +766,6 @@ path = Services; sourceTree = ""; }; - B5F31BAE28BE1C7900F61D0F /* Storage */ = { - isa = PBXGroup; - children = ( - B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */, - B5F31BB128BE1CD700F61D0F /* UserDefaultHandler.swift */, - ); - path = Storage; - sourceTree = ""; - }; B5F524C228519AA000614FF7 = { isa = PBXGroup; children = ( @@ -786,6 +794,7 @@ B5F525462855D00B00614FF7 /* Network */, B5F524E328519AC300614FF7 /* Screens */, B5F524E428519AC600614FF7 /* Global */, + B53A35B22A9630FE00B720BC /* Service */, ); path = Manito; sourceTree = ""; @@ -1034,11 +1043,10 @@ B5F525462855D00B00614FF7 /* Network */ = { isa = PBXGroup; children = ( - B5F31BAE28BE1C7900F61D0F /* Storage */, + 39C957D328799A8200A04A2B /* Foundation */, 397A241528BA519200454E4F /* Protocol */, 397A241128BA513E00454E4F /* API */, 39C957EA287AE45900A04A2B /* EndPoint */, - 39C957D328799A8200A04A2B /* Foundation */, B5F525472855D01200614FF7 /* Models */, ); path = Network; diff --git a/Manito/Manito/Network/Storage/UserDefaultHandler.swift b/Manito/Manito/Service/UserDefaultService/UserDefaultHandler.swift similarity index 100% rename from Manito/Manito/Network/Storage/UserDefaultHandler.swift rename to Manito/Manito/Service/UserDefaultService/UserDefaultHandler.swift diff --git a/Manito/Manito/Network/Storage/UserDefaultStorage.swift b/Manito/Manito/Service/UserDefaultService/UserDefaultStorage.swift similarity index 100% rename from Manito/Manito/Network/Storage/UserDefaultStorage.swift rename to Manito/Manito/Service/UserDefaultService/UserDefaultStorage.swift From b59a2e341c2b02369bda4bfabe2c2dda345ff523 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 23 Aug 2023 22:27:44 +0900 Subject: [PATCH 331/468] =?UTF-8?q?[CHORE]=20EndPoint=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EC=88=98=EC=A0=95(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 34 ++--- .../Network/EndPoint/DetailDoneEndPoint.swift | 90 ------------- .../Network/EndPoint/DetailIngEndPoint.swift | 72 ----------- .../Network/EndPoint/DetailRoomEndPoint.swift | 117 +++++++++++++++++ .../Network/EndPoint/DetailWaitEndPoint.swift | 108 ---------------- .../EndPoint/InteractionEndPoint.swift | 55 -------- .../Network/EndPoint/LetterEndPoint.swift | 120 ++++++------------ .../Network/EndPoint/LoginEndPoint.swift | 50 ++++---- .../Network/EndPoint/MainEndPoint.swift | 58 ++++----- .../EndPoint/MissionEditEndPoint.swift | 60 --------- .../Network/EndPoint/RoomEndPoint.swift | 80 ------------ .../EndPoint/RoomParticipationEndPoint.swift | 72 +++++++++++ .../Network/EndPoint/SettingEndPoint.swift | 61 +++++---- .../Network/EndPoint/TokenEndPoint.swift | 48 ++++--- .../Network/Foundation/APIEnvironment.swift | 4 +- 15 files changed, 345 insertions(+), 684 deletions(-) delete mode 100644 Manito/Manito/Network/EndPoint/DetailDoneEndPoint.swift delete mode 100644 Manito/Manito/Network/EndPoint/DetailIngEndPoint.swift create mode 100644 Manito/Manito/Network/EndPoint/DetailRoomEndPoint.swift delete mode 100644 Manito/Manito/Network/EndPoint/DetailWaitEndPoint.swift delete mode 100644 Manito/Manito/Network/EndPoint/InteractionEndPoint.swift delete mode 100644 Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift delete mode 100644 Manito/Manito/Network/EndPoint/RoomEndPoint.swift create mode 100644 Manito/Manito/Network/EndPoint/RoomParticipationEndPoint.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 65fc6f9a6..b6f953316 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -28,7 +28,6 @@ 398B1CCA2A13597600DEFCEC /* FSCalendar in Frameworks */ = {isa = PBXBuildFile; productRef = 398B1CC92A13597600DEFCEC /* FSCalendar */; }; 398B1CCC2A13599D00DEFCEC /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = 398B1CCB2A13599D00DEFCEC /* FirebaseAuth */; }; 399D17AB2856C83B00F50D9D /* DetailEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */; }; - 39A938912A48504200EC2CF2 /* MissionEditEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938902A48504200EC2CF2 /* MissionEditEndPoint.swift */; }; 39A938932A4852CA00EC2CF2 /* MissionDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938922A4852CA00EC2CF2 /* MissionDTO.swift */; }; 39A938952A48562500EC2CF2 /* MisstionEditProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938942A48562500EC2CF2 /* MisstionEditProtocol.swift */; }; 39A938972A48565500EC2CF2 /* MissionEditAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938962A48565500EC2CF2 /* MissionEditAPI.swift */; }; @@ -40,12 +39,8 @@ 39C957DF2879A35300A04A2B /* RoomDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957DE2879A35300A04A2B /* RoomDTO.swift */; }; 39C957E12879A3CF00A04A2B /* DailyMission.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957E02879A3CF00A04A2B /* DailyMission.swift */; }; 39C957ED287AE4D100A04A2B /* MainEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957EC287AE4D100A04A2B /* MainEndPoint.swift */; }; - 39C957FC287DAAFA00A04A2B /* DetailWaitEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957FB287DAAFA00A04A2B /* DetailWaitEndPoint.swift */; }; - 39C957FE287DAB6D00A04A2B /* DetailIngEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957FD287DAB6D00A04A2B /* DetailIngEndPoint.swift */; }; - 39C95800287DAC2900A04A2B /* DetailDoneEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957FF287DAC2900A04A2B /* DetailDoneEndPoint.swift */; }; - 39C95802287DACC300A04A2B /* RoomEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95801287DACC300A04A2B /* RoomEndPoint.swift */; }; + 39C95802287DACC300A04A2B /* RoomParticipationEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95801287DACC300A04A2B /* RoomParticipationEndPoint.swift */; }; 39C95804287DAD3000A04A2B /* LetterEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95803287DAD3000A04A2B /* LetterEndPoint.swift */; }; - 39C95806287DAE5700A04A2B /* InteractionEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95805287DAE5700A04A2B /* InteractionEndPoint.swift */; }; 39C95808287DB05C00A04A2B /* SettingEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95807287DB05C00A04A2B /* SettingEndPoint.swift */; }; 39C9580A287DC03500A04A2B /* Encodable+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95809287DC03500A04A2B /* Encodable+Extension.swift */; }; 39CD581928C4BD9D00496E91 /* DetailStartingProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CD581828C4BD9D00496E91 /* DetailStartingProtocol.swift */; }; @@ -96,6 +91,7 @@ B517C04C28D1FE5F0008BED0 /* TokenAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */; }; B517C04E28D1FE660008BED0 /* TokenProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04D28D1FE660008BED0 /* TokenProtocol.swift */; }; B53A35AD2A962E9C00B720BC /* MTNetwork in Frameworks */ = {isa = PBXBuildFile; productRef = B53A35AC2A962E9C00B720BC /* MTNetwork */; }; + B53A35B72A963F2100B720BC /* DetailRoomEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35B62A963F2100B720BC /* DetailRoomEndPoint.swift */; }; B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */; }; B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741E929A494E200B75BA3 /* LetterImageError.swift */; }; B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55BCEB328D8449E00AF7E45 /* MemoryCollectionViewCell.swift */; }; @@ -233,7 +229,6 @@ 398B1CB92A12415B00DEFCEC /* ManitoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ManitoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManitoTests.swift; sourceTree = ""; }; 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailEditViewController.swift; sourceTree = ""; }; - 39A938902A48504200EC2CF2 /* MissionEditEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionEditEndPoint.swift; sourceTree = ""; }; 39A938922A4852CA00EC2CF2 /* MissionDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionDTO.swift; sourceTree = ""; }; 39A938942A48562500EC2CF2 /* MisstionEditProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MisstionEditProtocol.swift; sourceTree = ""; }; 39A938962A48565500EC2CF2 /* MissionEditAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionEditAPI.swift; sourceTree = ""; }; @@ -246,12 +241,8 @@ 39C957E02879A3CF00A04A2B /* DailyMission.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyMission.swift; sourceTree = ""; }; 39C957EC287AE4D100A04A2B /* MainEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainEndPoint.swift; sourceTree = ""; }; 39C957F0287D984900A04A2B /* APIEnvironment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIEnvironment.swift; sourceTree = ""; }; - 39C957FB287DAAFA00A04A2B /* DetailWaitEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitEndPoint.swift; sourceTree = ""; }; - 39C957FD287DAB6D00A04A2B /* DetailIngEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailIngEndPoint.swift; sourceTree = ""; }; - 39C957FF287DAC2900A04A2B /* DetailDoneEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailDoneEndPoint.swift; sourceTree = ""; }; - 39C95801287DACC300A04A2B /* RoomEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomEndPoint.swift; sourceTree = ""; }; + 39C95801287DACC300A04A2B /* RoomParticipationEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomParticipationEndPoint.swift; sourceTree = ""; }; 39C95803287DAD3000A04A2B /* LetterEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterEndPoint.swift; sourceTree = ""; }; - 39C95805287DAE5700A04A2B /* InteractionEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InteractionEndPoint.swift; sourceTree = ""; }; 39C95807287DB05C00A04A2B /* SettingEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingEndPoint.swift; sourceTree = ""; }; 39C95809287DC03500A04A2B /* Encodable+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Encodable+Extension.swift"; sourceTree = ""; }; 39CD581828C4BD9D00496E91 /* DetailStartingProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailStartingProtocol.swift; sourceTree = ""; }; @@ -299,6 +290,7 @@ B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenEndPoint.swift; sourceTree = ""; }; B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenAPI.swift; sourceTree = ""; }; B517C04D28D1FE660008BED0 /* TokenProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenProtocol.swift; sourceTree = ""; }; + B53A35B62A963F2100B720BC /* DetailRoomEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailRoomEndPoint.swift; sourceTree = ""; }; B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Dev.xcconfig; sourceTree = ""; }; B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Prod.xcconfig; sourceTree = ""; }; B53AD41D2A8C88E100B83B33 /* GoogleService-Info-Dev.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Dev.plist"; sourceTree = ""; }; @@ -539,16 +531,12 @@ isa = PBXGroup; children = ( 39C957EC287AE4D100A04A2B /* MainEndPoint.swift */, - 39C957FB287DAAFA00A04A2B /* DetailWaitEndPoint.swift */, - 39C957FD287DAB6D00A04A2B /* DetailIngEndPoint.swift */, - 39C957FF287DAC2900A04A2B /* DetailDoneEndPoint.swift */, - 39C95801287DACC300A04A2B /* RoomEndPoint.swift */, + B53A35B62A963F2100B720BC /* DetailRoomEndPoint.swift */, + 39C95801287DACC300A04A2B /* RoomParticipationEndPoint.swift */, 39C95803287DAD3000A04A2B /* LetterEndPoint.swift */, - 39C95805287DAE5700A04A2B /* InteractionEndPoint.swift */, 39C95807287DB05C00A04A2B /* SettingEndPoint.swift */, 39EEF65D28CB3CFE00437654 /* LoginEndPoint.swift */, B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */, - 39A938902A48504200EC2CF2 /* MissionEditEndPoint.swift */, ); path = EndPoint; sourceTree = ""; @@ -1044,9 +1032,9 @@ isa = PBXGroup; children = ( 39C957D328799A8200A04A2B /* Foundation */, + 39C957EA287AE45900A04A2B /* EndPoint */, 397A241528BA519200454E4F /* Protocol */, 397A241128BA513E00454E4F /* API */, - 39C957EA287AE45900A04A2B /* EndPoint */, B5F525472855D01200614FF7 /* Models */, ); path = Network; @@ -1393,7 +1381,6 @@ buildActionMask = 2147483647; files = ( D75E8C7F28D76FFB004A6C41 /* LetterCountBadgeView.swift in Sources */, - 39A938912A48504200EC2CF2 /* MissionEditEndPoint.swift in Sources */, CBA4D7A62856D48C0018BDC2 /* RoomStateView.swift in Sources */, 333BF66628571CF00039F77F /* FriendCollectionViewCell.swift in Sources */, 39D95265285B097800183B09 /* CalendarView.swift in Sources */, @@ -1410,7 +1397,6 @@ CBA15C94285CE1A80051EDE2 /* ChooseCharacterViewController.swift in Sources */, 39EEF65E28CB3CFE00437654 /* LoginEndPoint.swift in Sources */, 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */, - 39C957FC287DAAFA00A04A2B /* DetailWaitEndPoint.swift in Sources */, CB674C2128596A310063A6B7 /* CheckRoomViewController.swift in Sources */, 39EEF65628CB3BB200437654 /* LoginProtocol.swift in Sources */, 39C9580A287DC03500A04A2B /* Encodable+Extension.swift in Sources */, @@ -1465,7 +1451,6 @@ 39EEF65C28CB3CD600437654 /* LoginAPI.swift in Sources */, B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */, D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */, - 39C957FE287DAB6D00A04A2B /* DetailIngEndPoint.swift in Sources */, B5F5251A2851A12600614FF7 /* BaseViewController.swift in Sources */, B5AE11F029D1E43B00F86FF8 /* OpenManittoView.swift in Sources */, CB4C77E428C0D4C9007A1AD2 /* MainProtocol.swift in Sources */, @@ -1480,7 +1465,6 @@ B5F31C5228BFA64F00F61D0F /* LetterAPI.swift in Sources */, D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */, 391B3003286198C200421F1D /* Size.swift in Sources */, - 39C95800287DAC2900A04A2B /* DetailDoneEndPoint.swift in Sources */, B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */, 7E77DB0428BF9A6700E95D4B /* RoomProtocol.swift in Sources */, D739C36328C7B69D00161117 /* SettingProtocol.swift in Sources */, @@ -1502,13 +1486,14 @@ CB9592B52855D52700847751 /* CommonMissionView.swift in Sources */, CBA4D7A42856CE9F0018BDC2 /* CreateRoomCollectionViewCell.swift in Sources */, D7C4A1A72A0B2EB000C3AE4C /* CharacterCollectionView.swift in Sources */, - 39C95802287DACC300A04A2B /* RoomEndPoint.swift in Sources */, + 39C95802287DACC300A04A2B /* RoomParticipationEndPoint.swift in Sources */, 395B5BC22A25E20000CE1420 /* DetailWaitViewModel.swift in Sources */, CB4C77E628C0D4EB007A1AD2 /* MainAPI.swift in Sources */, B5F524FD28519EEC00614FF7 /* UIColor+Extension.swift in Sources */, B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */, D7C4A1AD2A0DD8FA00C3AE4C /* SettingView.swift in Sources */, 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */, + B53A35B72A963F2100B720BC /* DetailRoomEndPoint.swift in Sources */, D7C4A1B02A0E522800C3AE4C /* SettingViewController+MailComposeViewControllerDelegate.swift in Sources */, 3915D54D2A7516E9002D6C25 /* Key+Extension.swift in Sources */, 33BDF5622856E03800564211 /* FriendListViewController.swift in Sources */, @@ -1530,7 +1515,6 @@ B5FEE9DB28C8498A00DEA07E /* ImageCacheManager.swift in Sources */, 39CD581928C4BD9D00496E91 /* DetailStartingProtocol.swift in Sources */, B5F5253528547F1900614FF7 /* LetterHeaderView.swift in Sources */, - 39C95806287DAE5700A04A2B /* InteractionEndPoint.swift in Sources */, B5F52537285481C800614FF7 /* LetterCollectionViewCell.swift in Sources */, 7E77DB0628BF9C0600E95D4B /* VerificationCode.swift in Sources */, CB358C0228A564080084D001 /* SettingDeveloperInfoViewController.swift in Sources */, diff --git a/Manito/Manito/Network/EndPoint/DetailDoneEndPoint.swift b/Manito/Manito/Network/EndPoint/DetailDoneEndPoint.swift deleted file mode 100644 index b69d166fa..000000000 --- a/Manito/Manito/Network/EndPoint/DetailDoneEndPoint.swift +++ /dev/null @@ -1,90 +0,0 @@ -// -// DetailDoneEndPoint.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -enum DetailDoneEndPoint: URLRepresentable { - case requestWithFriend(roomId: String) - case requestMemory(roomId: String) - case requestDoneRoomInfo(roomId: String) - case requestExitRoom(roomId: String) - case requestDeleteRoom(roomId: String) - - var path: String { - switch self { - case .requestWithFriend(let roomId): - return "/rooms/\(roomId)/participants" - case .requestMemory(let roomId): - return "/rooms/\(roomId)/memories" - case .requestDoneRoomInfo(let roomId): - return "/rooms/\(roomId)" - case .requestExitRoom(let roomId): - return "/rooms/\(roomId)/participants" - case .requestDeleteRoom(let roomId): - return "/rooms/\(roomId)" - } - } -} - -extension DetailDoneEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .requestWithFriend: - return .get - case .requestMemory: - return .get - case .requestDoneRoomInfo: - return .get - case .requestExitRoom: - return .delete - case .requestDeleteRoom: - return .delete - } - } - - var requestBody: Data? { - switch self { - case .requestWithFriend: - return nil - case .requestMemory: - return nil - case .requestDoneRoomInfo: - return nil - case .requestExitRoom: - return nil - case .requestDeleteRoom: - return nil - } - } - - var url: String { - switch self { - case .requestWithFriend(let roomId): - return self[.requestWithFriend(roomId: roomId)] - case .requestMemory(let roomId): - return self[.requestMemory(roomId: roomId)] - case .requestDoneRoomInfo(let roomId): - return self[.requestDoneRoomInfo(roomId: roomId)] - case .requestExitRoom(let roomId): - return self[.requestExitRoom(roomId: roomId)] - case .requestDeleteRoom(let roomId): - return self[.requestDeleteRoom(roomId: roomId)] - } - } - - func createRequest() -> NetworkRequest { - return NetworkRequest(url: self.url, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) - } -} diff --git a/Manito/Manito/Network/EndPoint/DetailIngEndPoint.swift b/Manito/Manito/Network/EndPoint/DetailIngEndPoint.swift deleted file mode 100644 index 70ff7acc5..000000000 --- a/Manito/Manito/Network/EndPoint/DetailIngEndPoint.swift +++ /dev/null @@ -1,72 +0,0 @@ -// -// DetailIngEndPoint.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -enum DetailIngEndPoint: URLRepresentable { - case requestWithFriend(roomId: String) - case requestStartingRoomInfo(roomId: String) - case getResetMission(roomId: String) - - var path: String { - switch self { - case .requestWithFriend(let roomId): - return "/rooms/\(roomId)/participants" - case .requestStartingRoomInfo(let roomId): - return "/rooms/\(roomId)" - case .getResetMission(let roomId): - return "/\(roomId)/individual-mission/restore" - } - } -} - -extension DetailIngEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .requestWithFriend: - return .get - case .requestStartingRoomInfo: - return .get - case .getResetMission: - return .get - } - } - - var requestBody: Data? { - switch self { - case .requestWithFriend: - return nil - case .requestStartingRoomInfo: - return nil - case .getResetMission: - return nil - } - } - - var url: String { - switch self { - case .requestWithFriend(let roomId): - return self[.requestWithFriend(roomId: roomId)] - case .requestStartingRoomInfo(let roomId): - return self[.requestStartingRoomInfo(roomId: roomId)] - case .getResetMission(let roomId): - return self[.getResetMission(roomId: roomId)] - } - } - - func createRequest() -> NetworkRequest { - return NetworkRequest(url: self.url, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) - } -} diff --git a/Manito/Manito/Network/EndPoint/DetailRoomEndPoint.swift b/Manito/Manito/Network/EndPoint/DetailRoomEndPoint.swift new file mode 100644 index 000000000..ceedef95c --- /dev/null +++ b/Manito/Manito/Network/EndPoint/DetailRoomEndPoint.swift @@ -0,0 +1,117 @@ +// +// DetailRoomEndPoint.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/23. +// + +import Foundation + +import MTNetwork + +enum DetailRoomEndPoint { + case fetchWithFriend(roomId: String) + case fetchRoomInfo(roomId: String) + case fetchResetMission(roomId: String) + case fetchMemory(roomId: String) + case patchStartManitto(roomId: String) + case patchEditMission(roomId: String, body: MissionDTO) + case putRoomInfo(roomId: String, roomInfo: RoomDTO) + case deleteRoom(roomId: String) + case deleteLeaveRoom(roomId: String) +} + +extension DetailRoomEndPoint: Requestable { + var baseURL: URL { + return APIEnvironment.baseURL + } + + var path: String { + switch self { + case .fetchWithFriend(let roomId): + return "/v1/rooms/\(roomId)/participants" + case .fetchRoomInfo(let roomId): + return "/v1/rooms/\(roomId)" + case .fetchResetMission(let roomId): + return "/v1/\(roomId)/individual-mission/restore" + case .fetchMemory(let roomId): + return "/v1/rooms/\(roomId)/memories" + case .patchStartManitto(let roomId): + return "/v1/rooms/\(roomId)/state" + case .patchEditMission(let roomId, _): + return "/v1/\(roomId)/individual-mission" + case .putRoomInfo(let roomId, _): + return "/v1/rooms/\(roomId)" + case .deleteRoom(let roomId): + return "/v1/rooms/\(roomId)" + case .deleteLeaveRoom(let roomId): + return "/v1/rooms/\(roomId)/participants" + } + } + + var method: HTTPMethod { + switch self { + case .fetchWithFriend: + return .get + case .fetchRoomInfo: + return .get + case .fetchResetMission: + return .get + case .fetchMemory: + return .get + case .patchStartManitto: + return .patch + case .patchEditMission: + return .patch + case .putRoomInfo: + return .put + case .deleteRoom: + return .delete + case .deleteLeaveRoom: + return .delete + } + } + + var task: HTTPTask { + switch self { + case .fetchWithFriend: + return .requestPlain + case .fetchRoomInfo: + return .requestPlain + case .fetchResetMission: + return .requestPlain + case .fetchMemory: + return .requestPlain + case .patchStartManitto: + return .requestPlain + case .patchEditMission(_, let body): + return .requestJSONEncodable(body) + case .putRoomInfo(_, let roomInfo): + let body = ["title": roomInfo.title, + "capacity": roomInfo.capacity.description, + "startDate": roomInfo.startDate, + "endDate": roomInfo.endDate] + return .requestJSONEncodable(body) + case .deleteRoom: + return .requestPlain + case .deleteLeaveRoom: + return .requestPlain + } + } + + var headers: HTTPHeaders { + let headers: [HTTPHeader] = [ + HTTPHeader.contentType("application/json"), + HTTPHeader.authorization(bearerToken: UserDefaultStorage.accessToken) + ] + return HTTPHeaders(headers) + } + + var requestTimeout: Float { + return 10 + } + + var sampleData: Data? { + return nil + } +} diff --git a/Manito/Manito/Network/EndPoint/DetailWaitEndPoint.swift b/Manito/Manito/Network/EndPoint/DetailWaitEndPoint.swift deleted file mode 100644 index aec356b48..000000000 --- a/Manito/Manito/Network/EndPoint/DetailWaitEndPoint.swift +++ /dev/null @@ -1,108 +0,0 @@ -// -// DetailWaitEndPoint.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -enum DetailWaitEndPoint: URLRepresentable { - case fetchWithFriend(roomId: String) - case fetchWaitingRoomInfo(roomId: String) - case patchStartManitto(roomId: String) - case putRoomInfo(roomId: String, roomInfo: RoomDTO) - case deleteRoom(roomId: String) - case deleteLeaveRoom(roomId: String) - - var path: String { - switch self { - case .fetchWithFriend(let roomId): - return "/rooms/\(roomId)/participants" - case .fetchWaitingRoomInfo(let roomId): - return "/rooms/\(roomId)" - case .patchStartManitto(let roomId): - return "/rooms/\(roomId)/state" - case .putRoomInfo(let roomId, _): - return "/rooms/\(roomId)" - case .deleteRoom(let roomId): - return "/rooms/\(roomId)" - case .deleteLeaveRoom(let roomId): - return "/rooms/\(roomId)/participants" - } - } -} - -extension DetailWaitEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .fetchWithFriend: - return .get - case .fetchWaitingRoomInfo: - return .get - case .patchStartManitto: - return .patch - case .putRoomInfo: - return .put - case .deleteRoom: - return .delete - case .deleteLeaveRoom: - return .delete - } - } - - var requestBody: Data? { - switch self { - case .fetchWithFriend: - return nil - case .fetchWaitingRoomInfo: - return nil - case .patchStartManitto: - return nil - case .putRoomInfo(_, let roomInfo): - let body = ["title": roomInfo.title, - "capacity": roomInfo.capacity.description, - "startDate": roomInfo.startDate, - "endDate": roomInfo.endDate] - return body.encode() - case .deleteRoom: - return nil - case .deleteLeaveRoom: - return nil - } - } - - var url: String { - switch self { - case .fetchWithFriend(let roomId): - return self[.fetchWithFriend(roomId: roomId)] - case .fetchWaitingRoomInfo(let roomId): - return self[.fetchWaitingRoomInfo(roomId: roomId)] - case .patchStartManitto(let roomId): - return self[.patchStartManitto(roomId: roomId)] - case .putRoomInfo(let roomId, let roomInfo): - return self[.putRoomInfo(roomId: roomId, roomInfo: roomInfo)] - case .deleteRoom(let roomId): - return self[.deleteRoom(roomId: roomId)] - case .deleteLeaveRoom(let roomId): - return self[.deleteLeaveRoom(roomId: roomId)] - } - } - - func createRequest() -> NetworkRequest { - var headers: [String: String] = [:] - headers["Content-Type"] = "application/json" - headers["authorization"] = "Bearer \(UserDefaultStorage.accessToken)" - - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) - } -} diff --git a/Manito/Manito/Network/EndPoint/InteractionEndPoint.swift b/Manito/Manito/Network/EndPoint/InteractionEndPoint.swift deleted file mode 100644 index 865be28ce..000000000 --- a/Manito/Manito/Network/EndPoint/InteractionEndPoint.swift +++ /dev/null @@ -1,55 +0,0 @@ -// -// InteractionEndPoint.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -enum InteractionEndPoint: URLRepresentable { - case mixRandomManitto(roomId: String) - case openManitto - - var path: String { - switch self { - case .mixRandomManitto(let roomId): - return "/rooms/\(roomId)/relations" - case .openManitto: - return "/relations/my-manitto" - } - } -} - -extension InteractionEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .mixRandomManitto: - return .post - case .openManitto: - return .get - } - } - - var requestBody: Data? { - switch self { - case .mixRandomManitto: - return nil - case .openManitto: - return nil - } - } - - var url: String { - switch self { - case .mixRandomManitto(let roomId): - return self[.mixRandomManitto(roomId: roomId), .none] - case .openManitto: - return self[.openManitto, .none] - } - } -} diff --git a/Manito/Manito/Network/EndPoint/LetterEndPoint.swift b/Manito/Manito/Network/EndPoint/LetterEndPoint.swift index 33f733ba1..9e67859f9 100644 --- a/Manito/Manito/Network/EndPoint/LetterEndPoint.swift +++ b/Manito/Manito/Network/EndPoint/LetterEndPoint.swift @@ -7,32 +7,34 @@ import Foundation -enum LetterEndPoint: URLRepresentable { +import MTNetwork + +enum LetterEndPoint { case dispatchLetter(roomId: String, image: Data?, letter: LetterDTO, missionId: String) case fetchSendLetter(roomId: String) case fetchReceiveLetter(roomId: String) case patchReadMessage(roomId: String, status: String) +} + +extension LetterEndPoint: Requestable { + var baseURL: URL { + return APIEnvironment.baseURL + } var path: String { switch self { case .dispatchLetter(let roomId, _, _, _): - return "/rooms/\(roomId)/messages-separate" + return "/v1/rooms/\(roomId)/messages-separate" case .fetchSendLetter(let roomId): - return "/rooms/\(roomId)/messages-sent" + return "/v2/rooms/\(roomId)/messages-sent" case .fetchReceiveLetter(let roomId): - return "/rooms/\(roomId)/messages-received" + return "/v2/rooms/\(roomId)/messages-received" case .patchReadMessage(let roomId, _): - return "/rooms/\(roomId)/messages/status" + return "/v1/rooms/\(roomId)/messages/status" } } -} - -extension LetterEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - var httpMethod: HTTPMethod { + var method: HTTPMethod { switch self { case .dispatchLetter: return .post @@ -45,91 +47,53 @@ extension LetterEndPoint: EndPointable { } } - var requestBody: Data? { + var task: HTTPTask { switch self { case .dispatchLetter(_, let image, let letter, let missionId): + var multipartData: [MultipartFormData] = [] + if let image { + let imageData = MultipartFormData(provider: .data(image), + name: "image", + filename: "\(arc4random()).jpeg", + mimeType: "image/jpeg") + multipartData.append(imageData) + } let parameters: [String: String?] = ["manitteeId": letter.manitteeId, "messageContent": letter.messageContent, "missionId": missionId] - let dataBody = createDataBody(withParameters: parameters, - media: image ?? nil, - boundary: APIEnvironment.boundary) - return dataBody + let parametersData = MultipartFormData(provider: .parameter(parameters)) + multipartData.append(parametersData) + return .uploadMultipart(multipartData) case .fetchSendLetter: - return nil + return .requestPlain case .fetchReceiveLetter: - return nil + return .requestPlain case .patchReadMessage(_, let status): let body = ["status": status] - return body.encode() + return .requestJSONEncodable(body) } } - var url: String { - switch self { - case .dispatchLetter(let roomId, let image, let letterDTO, let missionId): - return self[.dispatchLetter(roomId: roomId, image: image, letter: letterDTO, missionId: missionId)] - case .fetchSendLetter(let roomId): - return self[.fetchSendLetter(roomId: roomId), .v2] - case .fetchReceiveLetter(let roomId): - return self[.fetchReceiveLetter(roomId: roomId), .v2] - case .patchReadMessage(let roomId, let status): - return self[.patchReadMessage(roomId: roomId, status: status)] - } - } - - func createRequest() -> NetworkRequest { - var headers: [String: String] = [:] + var headers: HTTPHeaders { + var headers: [HTTPHeader] = [ + HTTPHeader.authorization(bearerToken: UserDefaultStorage.accessToken) + ] switch self { case .dispatchLetter: - headers["Content-Type"] = "multipart/form-data; boundary=\(APIEnvironment.boundary)" + let contentType = HTTPHeader.contentType("multipart/form-data") + headers.append(contentType) default: - headers["Content-Type"] = "application/json" + let contentType = HTTPHeader.contentType("application/json") + headers.append(contentType) } - headers["Authorization"] = "Bearer \(UserDefaultStorage.accessToken)" - - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod) + return HTTPHeaders(headers) } -} - -// MARK: - Multipart Form Data Helper Method -extension LetterEndPoint { - func createDataBody(withParameters params: [String: String?], - media: Data?, - boundary: String) -> Data { - let lineBreak = "\r\n" - var body = Data() - - for (key, value) in params { - guard let value = value else { continue } - body.append("--\(boundary + lineBreak)") - body.append("Content-Disposition: form-data; name=\"\(key)\"\(lineBreak + lineBreak)") - body.append("\(value + lineBreak)") - } - if let media = media { - let mediaKey = "image" - body.append("--\(boundary + lineBreak)") - body.append("Content-Disposition: form-data; name=\"\(mediaKey)\"; filename=\"\(arc4random()).jpeg\"\(lineBreak)") - body.append("Content-Type: image/jpeg\(lineBreak + lineBreak)") - body.append(media) - body.append(lineBreak) - } - - body.append("--\(boundary)--\(lineBreak)") - - return body + var requestTimeout: Float { + return 10 } -} -extension Data { - mutating func append(_ string: String) { - if let data = string.data(using: .utf8) { - append(data) - } + var sampleData: Data? { + return nil } } diff --git a/Manito/Manito/Network/EndPoint/LoginEndPoint.swift b/Manito/Manito/Network/EndPoint/LoginEndPoint.swift index 7a0735c92..19d811159 100644 --- a/Manito/Manito/Network/EndPoint/LoginEndPoint.swift +++ b/Manito/Manito/Network/EndPoint/LoginEndPoint.swift @@ -7,52 +7,50 @@ import Foundation -enum LoginEndPoint: URLRepresentable { - case dispatchAppleLogin(body: LoginDTO) +import MTNetwork + +enum LoginEndPoint { + case dispatchAppleLogin(loginDTO: LoginDTO) +} + +extension LoginEndPoint: Requestable { + var baseURL: URL { + return APIEnvironment.baseURL + } var path: String { switch self { case .dispatchAppleLogin: - return "/login" + return "/v2/login" } } -} - -extension LoginEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - var httpMethod: HTTPMethod { + var method: HTTPMethod { switch self { case .dispatchAppleLogin: return .post } } - var requestBody: Data? { + var task: HTTPTask { switch self { case .dispatchAppleLogin(let body): - return body.encode() + return .requestJSONEncodable(body) } } - var url: String { - switch self { - case .dispatchAppleLogin(let loginDTO): - return self[.dispatchAppleLogin(body: loginDTO), .v2] - } + var headers: HTTPHeaders { + let headers: [HTTPHeader] = [ + HTTPHeader.contentType("application/json"), + ] + return HTTPHeaders(headers) } - func createRequest() -> NetworkRequest { - var headers: [String: String] = [:] - headers["Content-Type"] = "application/json" + var requestTimeout: Float { + return 10 + } - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) + var sampleData: Data? { + return nil } } diff --git a/Manito/Manito/Network/EndPoint/MainEndPoint.swift b/Manito/Manito/Network/EndPoint/MainEndPoint.swift index e39747c79..a1345d264 100644 --- a/Manito/Manito/Network/EndPoint/MainEndPoint.swift +++ b/Manito/Manito/Network/EndPoint/MainEndPoint.swift @@ -7,26 +7,28 @@ import Foundation -enum MainEndPoint: URLRepresentable { +import MTNetwork + +enum MainEndPoint { case fetchCommonMission case fetchManittoList +} + +extension MainEndPoint: Requestable { + var baseURL: URL { + return APIEnvironment.baseURL + } var path: String { switch self { case .fetchCommonMission: - return "/missions/common" + return "/v1/missions/common" case .fetchManittoList: - return "/rooms" + return "/v1/rooms" } } -} - -extension MainEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - var httpMethod: HTTPMethod { + var method: HTTPMethod { switch self { case .fetchCommonMission: return .get @@ -35,34 +37,28 @@ extension MainEndPoint: EndPointable { } } - var requestBody: Data? { + var task: HTTPTask { switch self { case .fetchCommonMission: - return nil + return .requestPlain case .fetchManittoList: - return nil + return .requestPlain } } - var url: String { - switch self { - case .fetchCommonMission: - return self[.fetchCommonMission] - case .fetchManittoList: - return self[.fetchManittoList] - } + var headers: HTTPHeaders { + let headers: [HTTPHeader] = [ + HTTPHeader.contentType("application/json"), + HTTPHeader.authorization(bearerToken: UserDefaultStorage.accessToken) + ] + return HTTPHeaders(headers) } - func createRequest() -> NetworkRequest { - var headers: [String: String] = [:] - headers["Content-Type"] = "application/json" - headers["authorization"] = "Bearer \(UserDefaultStorage.accessToken)" - - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) + var requestTimeout: Float { + return 10 + } + + var sampleData: Data? { + return nil } } diff --git a/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift b/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift deleted file mode 100644 index 143d5fbd6..000000000 --- a/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift +++ /dev/null @@ -1,60 +0,0 @@ -// -// MissionEditEndPoint.swift -// Manito -// -// Created by Mingwan Choi on 2023/06/25. -// - -import Foundation - -enum MissionEditEndPoint: URLRepresentable { - case patchEditMission(roomId: String, body: MissionDTO) - - - var path: String { - switch self { - case .patchEditMission(let roomId, _): - return "/\(roomId)/individual-mission" - } - } -} - -extension MissionEditEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .patchEditMission: - return .patch - } - } - - var requestBody: Data? { - switch self { - case .patchEditMission(_, let body): - return body.encode() - } - } - - var url: String { - switch self { - case .patchEditMission(let roomId, let body): - return self[.patchEditMission(roomId: roomId, body: body)] - } - } - - func createRequest() -> NetworkRequest { - var headers: [String: String] = [:] - headers["Content-Type"] = "application/json" - headers["authorization"] = "Bearer \(UserDefaultStorage.accessToken)" - - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) - } -} diff --git a/Manito/Manito/Network/EndPoint/RoomEndPoint.swift b/Manito/Manito/Network/EndPoint/RoomEndPoint.swift deleted file mode 100644 index 99336e9b4..000000000 --- a/Manito/Manito/Network/EndPoint/RoomEndPoint.swift +++ /dev/null @@ -1,80 +0,0 @@ -// -// RoomEndPoint.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -enum RoomEndPoint: URLRepresentable { - case dispatchCreateRoom(roomInfo: CreateRoomDTO) - case fetchVerifyCode(code: String) - case dispatchJoinRoom(roomId: String, roomDto: MemberDTO) - - var path: String { - switch self { - case .dispatchCreateRoom: - return "/rooms" - case .fetchVerifyCode: - return "/invitations/verification" - case .dispatchJoinRoom(let roomId, _): - return "/rooms/\(roomId)/participants" - } - } -} - -extension RoomEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .dispatchCreateRoom: - return .post - case .fetchVerifyCode: - return .post - case .dispatchJoinRoom: - return .post - } - } - - var requestBody: Data? { - switch self { - case .dispatchCreateRoom(let roomInfo): - let body = roomInfo - return body.encode() - case .fetchVerifyCode(let code): - let body = ["invitationCode": code] - return body.encode() - case .dispatchJoinRoom(_, let roomDto): - let body = roomDto - return body.encode() - } - } - - var url: String { - switch self { - case .dispatchCreateRoom(let roomInfo): - return self[.dispatchCreateRoom(roomInfo: roomInfo)] - case .fetchVerifyCode(let code): - return self[.fetchVerifyCode(code: code)] - case .dispatchJoinRoom(let roomId, let roomDTO): - return self[.dispatchJoinRoom(roomId: roomId, roomDto: roomDTO)] - } - } - - func createRequest() -> NetworkRequest { - var headers: [String: String] = [:] - headers["Content-Type"] = "application/json" - headers["authorization"] = "Bearer \(UserDefaultStorage.accessToken)" - - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) - } -} diff --git a/Manito/Manito/Network/EndPoint/RoomParticipationEndPoint.swift b/Manito/Manito/Network/EndPoint/RoomParticipationEndPoint.swift new file mode 100644 index 000000000..53e433ba2 --- /dev/null +++ b/Manito/Manito/Network/EndPoint/RoomParticipationEndPoint.swift @@ -0,0 +1,72 @@ +// +// RoomEndPoint.swift +// Manito +// +// Created by Mingwan Choi on 2022/07/12. +// + +import Foundation + +import MTNetwork + +enum RoomParticipationEndPoint { + case dispatchCreateRoom(roomInfo: CreateRoomDTO) + case dispatchVerifyCode(code: String) + case dispatchJoinRoom(roomId: String, roomDto: MemberDTO) +} + +extension RoomParticipationEndPoint: Requestable { + var baseURL: URL { + return APIEnvironment.baseURL + } + + var path: String { + switch self { + case .dispatchCreateRoom: + return "/v1/rooms" + case .dispatchVerifyCode: + return "/v1/invitations/verification" + case .dispatchJoinRoom(let roomId, _): + return "/v1/rooms/\(roomId)/participants" + } + } + + var method: HTTPMethod { + switch self { + case .dispatchCreateRoom: + return .post + case .dispatchVerifyCode: + return .post + case .dispatchJoinRoom: + return .post + } + } + + var task: HTTPTask { + switch self { + case .dispatchCreateRoom(let roomInfo): + return .requestJSONEncodable(roomInfo) + case .dispatchVerifyCode(let code): + let body = ["invitationCode": code] + return .requestJSONEncodable(body) + case .dispatchJoinRoom(_, let roomDto): + return .requestJSONEncodable(roomDto) + } + } + + var headers: HTTPHeaders { + let headers: [HTTPHeader] = [ + HTTPHeader.contentType("application/json"), + HTTPHeader.authorization(bearerToken: UserDefaultStorage.accessToken) + ] + return HTTPHeaders(headers) + } + + var requestTimeout: Float { + return 10 + } + + var sampleData: Data? { + return nil + } +} diff --git a/Manito/Manito/Network/EndPoint/SettingEndPoint.swift b/Manito/Manito/Network/EndPoint/SettingEndPoint.swift index fa970455f..00526b658 100644 --- a/Manito/Manito/Network/EndPoint/SettingEndPoint.swift +++ b/Manito/Manito/Network/EndPoint/SettingEndPoint.swift @@ -7,54 +7,51 @@ import Foundation -enum SettingEndPoint: URLRepresentable { - case editUserInfo(nickNameDto: NicknameDTO) +import MTNetwork - var path: String { - switch self { - case .editUserInfo: - return "/members/nickname" - } - } +enum SettingEndPoint { + case putUserInfo(nicknameDTO: NicknameDTO) } -extension SettingEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 +extension SettingEndPoint: Requestable { + var baseURL: URL { + return APIEnvironment.baseURL } - var httpMethod: HTTPMethod { + var path: String { switch self { - case .editUserInfo: - return .put + case .putUserInfo: + return "/v1/members/nickname" } } - var requestBody: Data? { + var method: HTTPMethod { switch self { - case .editUserInfo(let setting): - let body = setting - return body.encode() + case .putUserInfo: + return .put } } - var url: String { + var task: HTTPTask { switch self { - case .editUserInfo(let nicknameDTO): - return self[.editUserInfo(nickNameDto: nicknameDTO)] + case .putUserInfo(let nicknameDTO): + return .requestJSONEncodable(nicknameDTO) } } - func createRequest() -> NetworkRequest { - var headers: [String: String] = [:] - headers["Content-Type"] = "application/json" - headers["authorization"] = "Bearer \(UserDefaultStorage.accessToken)" - - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) + var headers: HTTPHeaders { + let headers: [HTTPHeader] = [ + HTTPHeader.contentType("application/json"), + HTTPHeader.authorization(bearerToken: UserDefaultStorage.accessToken) + ] + return HTTPHeaders(headers) + } + + var requestTimeout: Float { + return 10 + } + + var sampleData: Data? { + return nil } } diff --git a/Manito/Manito/Network/EndPoint/TokenEndPoint.swift b/Manito/Manito/Network/EndPoint/TokenEndPoint.swift index 7bec96344..ed5fbccbc 100644 --- a/Manito/Manito/Network/EndPoint/TokenEndPoint.swift +++ b/Manito/Manito/Network/EndPoint/TokenEndPoint.swift @@ -7,54 +7,52 @@ import Foundation -enum TokenEndPoint: URLRepresentable { +import MTNetwork + +enum TokenEndPoint { case patchRefreshToken(body: Token) +} + +extension TokenEndPoint: Requestable { + var baseURL: URL { + return APIEnvironment.baseURL + } var path: String { switch self { case .patchRefreshToken: - return "/auth/reissue" + return "/v1/auth/reissue" } } -} -extension TokenEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { + var method: HTTPMethod { switch self { case .patchRefreshToken: return .patch } } - var requestBody: Data? { + var task: HTTPTask { switch self { case .patchRefreshToken(let body): let body = ["accessToken": body.accessToken, "refreshToken": body.refreshToken] - return body.encode() + return .requestJSONEncodable(body) } } - var url: String { - switch self { - case .patchRefreshToken(let body): - return self[.patchRefreshToken(body: body)] - } + var headers: HTTPHeaders { + let headers: [HTTPHeader] = [ + HTTPHeader.contentType("application/json"), + ] + return HTTPHeaders(headers) } - func createRequest() -> NetworkRequest { - var headers: [String: String] = [:] - headers["Content-Type"] = "application/json" + var requestTimeout: Float { + return 10 + } - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) + var sampleData: Data? { + return nil } } diff --git a/Manito/Manito/Network/Foundation/APIEnvironment.swift b/Manito/Manito/Network/Foundation/APIEnvironment.swift index 677e491b4..06fa9e7c6 100644 --- a/Manito/Manito/Network/Foundation/APIEnvironment.swift +++ b/Manito/Manito/Network/Foundation/APIEnvironment.swift @@ -9,8 +9,8 @@ import Foundation enum APIEnvironment { #if DEV - static let baseURL = Bundle.main.developmentURL + static let baseURL: URL = URL(string: Bundle.main.developmentURL)! #elseif PROD - static let baseURL = Bundle.main.productionURL + static let baseURL: URL = URL(string: Bundle.main.productionURL)! #endif } From a6a2254bd4b6041dad056d4f84a430ddb95bd4eb Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 23 Aug 2023 22:32:50 +0900 Subject: [PATCH 332/468] =?UTF-8?q?[MOVE]=20Data=20=EB=B0=91=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20Network=20=ED=8C=8C=EC=9D=BC=20=EC=9D=B4=EB=8F=99(#?= =?UTF-8?q?490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 10 +++++++++- .../Manito/{ => Data}/Network/API/DetailDoneAPI.swift | 0 .../{ => Data}/Network/API/DetailStartingAPI.swift | 0 .../Manito/{ => Data}/Network/API/DetailWaitAPI.swift | 0 Manito/Manito/{ => Data}/Network/API/LetterAPI.swift | 0 Manito/Manito/{ => Data}/Network/API/LoginAPI.swift | 0 Manito/Manito/{ => Data}/Network/API/MainAPI.swift | 0 .../Manito/{ => Data}/Network/API/MissionEditAPI.swift | 0 Manito/Manito/{ => Data}/Network/API/RoomAPI.swift | 0 Manito/Manito/{ => Data}/Network/API/SettingAPI.swift | 0 Manito/Manito/{ => Data}/Network/API/TokenAPI.swift | 0 .../Network/EndPoint/DetailRoomEndPoint.swift | 0 .../{ => Data}/Network/EndPoint/LetterEndPoint.swift | 0 .../{ => Data}/Network/EndPoint/LoginEndPoint.swift | 0 .../{ => Data}/Network/EndPoint/MainEndPoint.swift | 0 .../Network/EndPoint/RoomParticipationEndPoint.swift | 0 .../{ => Data}/Network/EndPoint/SettingEndPoint.swift | 0 .../{ => Data}/Network/EndPoint/TokenEndPoint.swift | 0 .../{ => Data}/Network/Foundation/APIEnvironment.swift | 0 .../{ => Data}/Network/Foundation/Key+Extension.swift | 0 Manito/Manito/{ => Data}/Network/Foundation/Key.plist | 0 .../{ => Data}/Network/Models/DailyMission.swift | 0 .../Manito/{ => Data}/Network/Models/FriendList.swift | 0 Manito/Manito/{ => Data}/Network/Models/Letter.swift | 0 Manito/Manito/{ => Data}/Network/Models/Login.swift | 0 Manito/Manito/{ => Data}/Network/Models/Memory.swift | 0 .../Manito/{ => Data}/Network/Models/NicknameDTO.swift | 0 .../{ => Data}/Network/Models/Request/LetterDTO.swift | 0 .../{ => Data}/Network/Models/Request/LoginDTO.swift | 0 .../{ => Data}/Network/Models/Request/MissionDTO.swift | 0 .../{ => Data}/Network/Models/Request/RoomDTO.swift | 0 Manito/Manito/{ => Data}/Network/Models/Room.swift | 0 Manito/Manito/{ => Data}/Network/Models/Token.swift | 0 .../{ => Data}/Network/Models/VerificationCode.swift | 0 .../Network/Protocol/DetailDoneProtocol.swift | 0 .../Network/Protocol/DetailStartingProtocol.swift | 0 .../Network/Protocol/DetailWaitProtocol.swift | 0 .../{ => Data}/Network/Protocol/LetterProtocol.swift | 0 .../{ => Data}/Network/Protocol/LoginProtocol.swift | 0 .../{ => Data}/Network/Protocol/MainProtocol.swift | 0 .../Network/Protocol/MisstionEditProtocol.swift | 0 .../{ => Data}/Network/Protocol/RoomProtocol.swift | 0 .../{ => Data}/Network/Protocol/SettingProtocol.swift | 0 .../{ => Data}/Network/Protocol/TokenProtocol.swift | 0 44 files changed, 9 insertions(+), 1 deletion(-) rename Manito/Manito/{ => Data}/Network/API/DetailDoneAPI.swift (100%) rename Manito/Manito/{ => Data}/Network/API/DetailStartingAPI.swift (100%) rename Manito/Manito/{ => Data}/Network/API/DetailWaitAPI.swift (100%) rename Manito/Manito/{ => Data}/Network/API/LetterAPI.swift (100%) rename Manito/Manito/{ => Data}/Network/API/LoginAPI.swift (100%) rename Manito/Manito/{ => Data}/Network/API/MainAPI.swift (100%) rename Manito/Manito/{ => Data}/Network/API/MissionEditAPI.swift (100%) rename Manito/Manito/{ => Data}/Network/API/RoomAPI.swift (100%) rename Manito/Manito/{ => Data}/Network/API/SettingAPI.swift (100%) rename Manito/Manito/{ => Data}/Network/API/TokenAPI.swift (100%) rename Manito/Manito/{ => Data}/Network/EndPoint/DetailRoomEndPoint.swift (100%) rename Manito/Manito/{ => Data}/Network/EndPoint/LetterEndPoint.swift (100%) rename Manito/Manito/{ => Data}/Network/EndPoint/LoginEndPoint.swift (100%) rename Manito/Manito/{ => Data}/Network/EndPoint/MainEndPoint.swift (100%) rename Manito/Manito/{ => Data}/Network/EndPoint/RoomParticipationEndPoint.swift (100%) rename Manito/Manito/{ => Data}/Network/EndPoint/SettingEndPoint.swift (100%) rename Manito/Manito/{ => Data}/Network/EndPoint/TokenEndPoint.swift (100%) rename Manito/Manito/{ => Data}/Network/Foundation/APIEnvironment.swift (100%) rename Manito/Manito/{ => Data}/Network/Foundation/Key+Extension.swift (100%) rename Manito/Manito/{ => Data}/Network/Foundation/Key.plist (100%) rename Manito/Manito/{ => Data}/Network/Models/DailyMission.swift (100%) rename Manito/Manito/{ => Data}/Network/Models/FriendList.swift (100%) rename Manito/Manito/{ => Data}/Network/Models/Letter.swift (100%) rename Manito/Manito/{ => Data}/Network/Models/Login.swift (100%) rename Manito/Manito/{ => Data}/Network/Models/Memory.swift (100%) rename Manito/Manito/{ => Data}/Network/Models/NicknameDTO.swift (100%) rename Manito/Manito/{ => Data}/Network/Models/Request/LetterDTO.swift (100%) rename Manito/Manito/{ => Data}/Network/Models/Request/LoginDTO.swift (100%) rename Manito/Manito/{ => Data}/Network/Models/Request/MissionDTO.swift (100%) rename Manito/Manito/{ => Data}/Network/Models/Request/RoomDTO.swift (100%) rename Manito/Manito/{ => Data}/Network/Models/Room.swift (100%) rename Manito/Manito/{ => Data}/Network/Models/Token.swift (100%) rename Manito/Manito/{ => Data}/Network/Models/VerificationCode.swift (100%) rename Manito/Manito/{ => Data}/Network/Protocol/DetailDoneProtocol.swift (100%) rename Manito/Manito/{ => Data}/Network/Protocol/DetailStartingProtocol.swift (100%) rename Manito/Manito/{ => Data}/Network/Protocol/DetailWaitProtocol.swift (100%) rename Manito/Manito/{ => Data}/Network/Protocol/LetterProtocol.swift (100%) rename Manito/Manito/{ => Data}/Network/Protocol/LoginProtocol.swift (100%) rename Manito/Manito/{ => Data}/Network/Protocol/MainProtocol.swift (100%) rename Manito/Manito/{ => Data}/Network/Protocol/MisstionEditProtocol.swift (100%) rename Manito/Manito/{ => Data}/Network/Protocol/RoomProtocol.swift (100%) rename Manito/Manito/{ => Data}/Network/Protocol/SettingProtocol.swift (100%) rename Manito/Manito/{ => Data}/Network/Protocol/TokenProtocol.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index b6f953316..bf8933e95 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -637,6 +637,14 @@ path = UserDefaultService; sourceTree = ""; }; + B53A35B82A9640EB00B720BC /* Data */ = { + isa = PBXGroup; + children = ( + B5F525462855D00B00614FF7 /* Network */, + ); + path = Data; + sourceTree = ""; + }; B53AD40F2A8BC69700B83B33 /* Configuration */ = { isa = PBXGroup; children = ( @@ -779,7 +787,7 @@ B5F524CD28519AA000614FF7 /* Manito */ = { isa = PBXGroup; children = ( - B5F525462855D00B00614FF7 /* Network */, + B53A35B82A9640EB00B720BC /* Data */, B5F524E328519AC300614FF7 /* Screens */, B5F524E428519AC600614FF7 /* Global */, B53A35B22A9630FE00B720BC /* Service */, diff --git a/Manito/Manito/Network/API/DetailDoneAPI.swift b/Manito/Manito/Data/Network/API/DetailDoneAPI.swift similarity index 100% rename from Manito/Manito/Network/API/DetailDoneAPI.swift rename to Manito/Manito/Data/Network/API/DetailDoneAPI.swift diff --git a/Manito/Manito/Network/API/DetailStartingAPI.swift b/Manito/Manito/Data/Network/API/DetailStartingAPI.swift similarity index 100% rename from Manito/Manito/Network/API/DetailStartingAPI.swift rename to Manito/Manito/Data/Network/API/DetailStartingAPI.swift diff --git a/Manito/Manito/Network/API/DetailWaitAPI.swift b/Manito/Manito/Data/Network/API/DetailWaitAPI.swift similarity index 100% rename from Manito/Manito/Network/API/DetailWaitAPI.swift rename to Manito/Manito/Data/Network/API/DetailWaitAPI.swift diff --git a/Manito/Manito/Network/API/LetterAPI.swift b/Manito/Manito/Data/Network/API/LetterAPI.swift similarity index 100% rename from Manito/Manito/Network/API/LetterAPI.swift rename to Manito/Manito/Data/Network/API/LetterAPI.swift diff --git a/Manito/Manito/Network/API/LoginAPI.swift b/Manito/Manito/Data/Network/API/LoginAPI.swift similarity index 100% rename from Manito/Manito/Network/API/LoginAPI.swift rename to Manito/Manito/Data/Network/API/LoginAPI.swift diff --git a/Manito/Manito/Network/API/MainAPI.swift b/Manito/Manito/Data/Network/API/MainAPI.swift similarity index 100% rename from Manito/Manito/Network/API/MainAPI.swift rename to Manito/Manito/Data/Network/API/MainAPI.swift diff --git a/Manito/Manito/Network/API/MissionEditAPI.swift b/Manito/Manito/Data/Network/API/MissionEditAPI.swift similarity index 100% rename from Manito/Manito/Network/API/MissionEditAPI.swift rename to Manito/Manito/Data/Network/API/MissionEditAPI.swift diff --git a/Manito/Manito/Network/API/RoomAPI.swift b/Manito/Manito/Data/Network/API/RoomAPI.swift similarity index 100% rename from Manito/Manito/Network/API/RoomAPI.swift rename to Manito/Manito/Data/Network/API/RoomAPI.swift diff --git a/Manito/Manito/Network/API/SettingAPI.swift b/Manito/Manito/Data/Network/API/SettingAPI.swift similarity index 100% rename from Manito/Manito/Network/API/SettingAPI.swift rename to Manito/Manito/Data/Network/API/SettingAPI.swift diff --git a/Manito/Manito/Network/API/TokenAPI.swift b/Manito/Manito/Data/Network/API/TokenAPI.swift similarity index 100% rename from Manito/Manito/Network/API/TokenAPI.swift rename to Manito/Manito/Data/Network/API/TokenAPI.swift diff --git a/Manito/Manito/Network/EndPoint/DetailRoomEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/DetailRoomEndPoint.swift similarity index 100% rename from Manito/Manito/Network/EndPoint/DetailRoomEndPoint.swift rename to Manito/Manito/Data/Network/EndPoint/DetailRoomEndPoint.swift diff --git a/Manito/Manito/Network/EndPoint/LetterEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift similarity index 100% rename from Manito/Manito/Network/EndPoint/LetterEndPoint.swift rename to Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift diff --git a/Manito/Manito/Network/EndPoint/LoginEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/LoginEndPoint.swift similarity index 100% rename from Manito/Manito/Network/EndPoint/LoginEndPoint.swift rename to Manito/Manito/Data/Network/EndPoint/LoginEndPoint.swift diff --git a/Manito/Manito/Network/EndPoint/MainEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/MainEndPoint.swift similarity index 100% rename from Manito/Manito/Network/EndPoint/MainEndPoint.swift rename to Manito/Manito/Data/Network/EndPoint/MainEndPoint.swift diff --git a/Manito/Manito/Network/EndPoint/RoomParticipationEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/RoomParticipationEndPoint.swift similarity index 100% rename from Manito/Manito/Network/EndPoint/RoomParticipationEndPoint.swift rename to Manito/Manito/Data/Network/EndPoint/RoomParticipationEndPoint.swift diff --git a/Manito/Manito/Network/EndPoint/SettingEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/SettingEndPoint.swift similarity index 100% rename from Manito/Manito/Network/EndPoint/SettingEndPoint.swift rename to Manito/Manito/Data/Network/EndPoint/SettingEndPoint.swift diff --git a/Manito/Manito/Network/EndPoint/TokenEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift similarity index 100% rename from Manito/Manito/Network/EndPoint/TokenEndPoint.swift rename to Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift diff --git a/Manito/Manito/Network/Foundation/APIEnvironment.swift b/Manito/Manito/Data/Network/Foundation/APIEnvironment.swift similarity index 100% rename from Manito/Manito/Network/Foundation/APIEnvironment.swift rename to Manito/Manito/Data/Network/Foundation/APIEnvironment.swift diff --git a/Manito/Manito/Network/Foundation/Key+Extension.swift b/Manito/Manito/Data/Network/Foundation/Key+Extension.swift similarity index 100% rename from Manito/Manito/Network/Foundation/Key+Extension.swift rename to Manito/Manito/Data/Network/Foundation/Key+Extension.swift diff --git a/Manito/Manito/Network/Foundation/Key.plist b/Manito/Manito/Data/Network/Foundation/Key.plist similarity index 100% rename from Manito/Manito/Network/Foundation/Key.plist rename to Manito/Manito/Data/Network/Foundation/Key.plist diff --git a/Manito/Manito/Network/Models/DailyMission.swift b/Manito/Manito/Data/Network/Models/DailyMission.swift similarity index 100% rename from Manito/Manito/Network/Models/DailyMission.swift rename to Manito/Manito/Data/Network/Models/DailyMission.swift diff --git a/Manito/Manito/Network/Models/FriendList.swift b/Manito/Manito/Data/Network/Models/FriendList.swift similarity index 100% rename from Manito/Manito/Network/Models/FriendList.swift rename to Manito/Manito/Data/Network/Models/FriendList.swift diff --git a/Manito/Manito/Network/Models/Letter.swift b/Manito/Manito/Data/Network/Models/Letter.swift similarity index 100% rename from Manito/Manito/Network/Models/Letter.swift rename to Manito/Manito/Data/Network/Models/Letter.swift diff --git a/Manito/Manito/Network/Models/Login.swift b/Manito/Manito/Data/Network/Models/Login.swift similarity index 100% rename from Manito/Manito/Network/Models/Login.swift rename to Manito/Manito/Data/Network/Models/Login.swift diff --git a/Manito/Manito/Network/Models/Memory.swift b/Manito/Manito/Data/Network/Models/Memory.swift similarity index 100% rename from Manito/Manito/Network/Models/Memory.swift rename to Manito/Manito/Data/Network/Models/Memory.swift diff --git a/Manito/Manito/Network/Models/NicknameDTO.swift b/Manito/Manito/Data/Network/Models/NicknameDTO.swift similarity index 100% rename from Manito/Manito/Network/Models/NicknameDTO.swift rename to Manito/Manito/Data/Network/Models/NicknameDTO.swift diff --git a/Manito/Manito/Network/Models/Request/LetterDTO.swift b/Manito/Manito/Data/Network/Models/Request/LetterDTO.swift similarity index 100% rename from Manito/Manito/Network/Models/Request/LetterDTO.swift rename to Manito/Manito/Data/Network/Models/Request/LetterDTO.swift diff --git a/Manito/Manito/Network/Models/Request/LoginDTO.swift b/Manito/Manito/Data/Network/Models/Request/LoginDTO.swift similarity index 100% rename from Manito/Manito/Network/Models/Request/LoginDTO.swift rename to Manito/Manito/Data/Network/Models/Request/LoginDTO.swift diff --git a/Manito/Manito/Network/Models/Request/MissionDTO.swift b/Manito/Manito/Data/Network/Models/Request/MissionDTO.swift similarity index 100% rename from Manito/Manito/Network/Models/Request/MissionDTO.swift rename to Manito/Manito/Data/Network/Models/Request/MissionDTO.swift diff --git a/Manito/Manito/Network/Models/Request/RoomDTO.swift b/Manito/Manito/Data/Network/Models/Request/RoomDTO.swift similarity index 100% rename from Manito/Manito/Network/Models/Request/RoomDTO.swift rename to Manito/Manito/Data/Network/Models/Request/RoomDTO.swift diff --git a/Manito/Manito/Network/Models/Room.swift b/Manito/Manito/Data/Network/Models/Room.swift similarity index 100% rename from Manito/Manito/Network/Models/Room.swift rename to Manito/Manito/Data/Network/Models/Room.swift diff --git a/Manito/Manito/Network/Models/Token.swift b/Manito/Manito/Data/Network/Models/Token.swift similarity index 100% rename from Manito/Manito/Network/Models/Token.swift rename to Manito/Manito/Data/Network/Models/Token.swift diff --git a/Manito/Manito/Network/Models/VerificationCode.swift b/Manito/Manito/Data/Network/Models/VerificationCode.swift similarity index 100% rename from Manito/Manito/Network/Models/VerificationCode.swift rename to Manito/Manito/Data/Network/Models/VerificationCode.swift diff --git a/Manito/Manito/Network/Protocol/DetailDoneProtocol.swift b/Manito/Manito/Data/Network/Protocol/DetailDoneProtocol.swift similarity index 100% rename from Manito/Manito/Network/Protocol/DetailDoneProtocol.swift rename to Manito/Manito/Data/Network/Protocol/DetailDoneProtocol.swift diff --git a/Manito/Manito/Network/Protocol/DetailStartingProtocol.swift b/Manito/Manito/Data/Network/Protocol/DetailStartingProtocol.swift similarity index 100% rename from Manito/Manito/Network/Protocol/DetailStartingProtocol.swift rename to Manito/Manito/Data/Network/Protocol/DetailStartingProtocol.swift diff --git a/Manito/Manito/Network/Protocol/DetailWaitProtocol.swift b/Manito/Manito/Data/Network/Protocol/DetailWaitProtocol.swift similarity index 100% rename from Manito/Manito/Network/Protocol/DetailWaitProtocol.swift rename to Manito/Manito/Data/Network/Protocol/DetailWaitProtocol.swift diff --git a/Manito/Manito/Network/Protocol/LetterProtocol.swift b/Manito/Manito/Data/Network/Protocol/LetterProtocol.swift similarity index 100% rename from Manito/Manito/Network/Protocol/LetterProtocol.swift rename to Manito/Manito/Data/Network/Protocol/LetterProtocol.swift diff --git a/Manito/Manito/Network/Protocol/LoginProtocol.swift b/Manito/Manito/Data/Network/Protocol/LoginProtocol.swift similarity index 100% rename from Manito/Manito/Network/Protocol/LoginProtocol.swift rename to Manito/Manito/Data/Network/Protocol/LoginProtocol.swift diff --git a/Manito/Manito/Network/Protocol/MainProtocol.swift b/Manito/Manito/Data/Network/Protocol/MainProtocol.swift similarity index 100% rename from Manito/Manito/Network/Protocol/MainProtocol.swift rename to Manito/Manito/Data/Network/Protocol/MainProtocol.swift diff --git a/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift b/Manito/Manito/Data/Network/Protocol/MisstionEditProtocol.swift similarity index 100% rename from Manito/Manito/Network/Protocol/MisstionEditProtocol.swift rename to Manito/Manito/Data/Network/Protocol/MisstionEditProtocol.swift diff --git a/Manito/Manito/Network/Protocol/RoomProtocol.swift b/Manito/Manito/Data/Network/Protocol/RoomProtocol.swift similarity index 100% rename from Manito/Manito/Network/Protocol/RoomProtocol.swift rename to Manito/Manito/Data/Network/Protocol/RoomProtocol.swift diff --git a/Manito/Manito/Network/Protocol/SettingProtocol.swift b/Manito/Manito/Data/Network/Protocol/SettingProtocol.swift similarity index 100% rename from Manito/Manito/Network/Protocol/SettingProtocol.swift rename to Manito/Manito/Data/Network/Protocol/SettingProtocol.swift diff --git a/Manito/Manito/Network/Protocol/TokenProtocol.swift b/Manito/Manito/Data/Network/Protocol/TokenProtocol.swift similarity index 100% rename from Manito/Manito/Network/Protocol/TokenProtocol.swift rename to Manito/Manito/Data/Network/Protocol/TokenProtocol.swift From 8faf4b3086c342626caef983a31d5dbe4f732af0 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 23 Aug 2023 23:15:15 +0900 Subject: [PATCH 333/468] =?UTF-8?q?[FEAT]=20=EB=9D=BC=EC=9D=B4=EB=B8=8C?= =?UTF-8?q?=EB=9F=AC=EB=A6=AC=20=ED=8C=A8=ED=82=A4=EC=A7=80=20=EC=97=85?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=8A=B8(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xcshareddata/swiftpm/Package.resolved | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a5052b187..f825ebc64 100644 --- a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/kaishin/Gifu.git", "state" : { - "revision" : "51f2eab32903e336f590c013267cfa4d7f8b06c4", - "version" : "3.3.1" + "revision" : "82da0086dea14ca9afc9801234ad8dc4cd9e2738", + "version" : "3.4.1" } }, { @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleDataTransport.git", "state" : { - "revision" : "5056b15c5acbb90cd214fe4d6138bdf5a740e5a8", - "version" : "9.2.0" + "revision" : "aae45a320fd0d11811820335b1eabc8753902a40", + "version" : "9.2.5" } }, { @@ -68,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleUtilities.git", "state" : { - "revision" : "68ea347bdb1a69e2d2ae2e25cd085b6ef92f64cb", - "version" : "7.9.0" + "revision" : "c38ce365d77b04a9a300c31061c5227589e5597b", + "version" : "7.11.5" } }, { @@ -86,8 +86,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/gtm-session-fetcher.git", "state" : { - "revision" : "d4289da23e978f37c344ea6a386e5546e2466294", - "version" : "2.1.0" + "revision" : "5ccda3981422a84186387dbb763ba739178b529c", + "version" : "2.3.0" } }, { @@ -113,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/promises.git", "state" : { - "revision" : "3e4e743631e86c8c70dbc6efdc7beaa6e90fd3bb", - "version" : "2.1.1" + "revision" : "e70e889c0196c76d22759eb50d6a0270ca9f1d9e", + "version" : "2.3.1" } }, { @@ -140,8 +140,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "88c7d15e1242fdb6ecbafbc7926426a19be1e98a", - "version" : "1.20.2" + "revision" : "ce20dc083ee485524b802669890291c0d8090170", + "version" : "1.22.1" } } ], From d283aa967d6c9be7d1061252e68aeb07adc9dd40 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Wed, 23 Aug 2023 23:34:48 +0900 Subject: [PATCH 334/468] =?UTF-8?q?[FEAT]=20dateRange=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=20combine=20=EB=B3=80=EA=B2=BD=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 18 ++++++-- .../CreateRoom/CreateRoomViewController.swift | 30 ++++++++++--- .../Services/CreateRoomService.swift | 37 +++++++++++++++ .../CreateRoom/View/CreateRoomView.swift | 34 +++++++------- .../ViewModel/CreateRoomViewModel.swift | 45 ++++++++++++++++--- .../Screens/Main/MainViewController.swift | 2 +- 6 files changed, 133 insertions(+), 33 deletions(-) create mode 100644 Manito/Manito/Screens/CreateRoom/Services/CreateRoomService.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 17a2afdd8..48c1b907f 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -192,6 +192,7 @@ D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = D777D2C828C7780E008655BD /* URLLiteral.swift */; }; D79E9D8A2A826E0200C031F0 /* CreateRoomViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D79E9D892A826E0200C031F0 /* CreateRoomViewModel.swift */; }; D7B6C97C2858B2D40024F326 /* CheckRoomInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B6C97B2858B2D40024F326 /* CheckRoomInfoView.swift */; }; + D7B83FD62A95A48700BFD8FF /* CreateRoomService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B83FD52A95A48700BFD8FF /* CreateRoomService.swift */; }; D7C4A1A72A0B2EB000C3AE4C /* CharacterCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */; }; D7C4A1A92A0B895300C3AE4C /* ChooseCharacterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */; }; D7C4A1AB2A0D1AA400C3AE4C /* ParticipateRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1AA2A0D1AA400C3AE4C /* ParticipateRoomView.swift */; }; @@ -392,6 +393,7 @@ D777D2C828C7780E008655BD /* URLLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLLiteral.swift; sourceTree = ""; }; D79E9D892A826E0200C031F0 /* CreateRoomViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomViewModel.swift; sourceTree = ""; }; D7B6C97B2858B2D40024F326 /* CheckRoomInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckRoomInfoView.swift; sourceTree = ""; }; + D7B83FD52A95A48700BFD8FF /* CreateRoomService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomService.swift; sourceTree = ""; }; D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterCollectionView.swift; sourceTree = ""; }; D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooseCharacterView.swift; sourceTree = ""; }; D7C4A1AA2A0D1AA400C3AE4C /* ParticipateRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipateRoomView.swift; sourceTree = ""; }; @@ -809,6 +811,7 @@ B5F524E528519ACA00614FF7 /* CreateRoom */ = { isa = PBXGroup; children = ( + D7B83FD42A95A46F00BFD8FF /* Services */, D79E9D882A826D7900C031F0 /* ViewModel */, D70220212A7A22DC0024BACD /* View */, 7E3058C42854B45300489E6A /* UIComponent */, @@ -1186,6 +1189,14 @@ path = Component; sourceTree = ""; }; + D79E9D882A826D7900C031F0 /* ViewModel */ = { + isa = PBXGroup; + children = ( + D79E9D892A826E0200C031F0 /* CreateRoomViewModel.swift */, + ); + path = ViewModel; + sourceTree = ""; + }; D7B83FD32A92F55200BFD8FF /* View */ = { isa = PBXGroup; children = ( @@ -1194,12 +1205,12 @@ path = View; sourceTree = ""; }; - D79E9D882A826D7900C031F0 /* ViewModel */ = { + D7B83FD42A95A46F00BFD8FF /* Services */ = { isa = PBXGroup; children = ( - D79E9D892A826E0200C031F0 /* CreateRoomViewModel.swift */, + D7B83FD52A95A48700BFD8FF /* CreateRoomService.swift */, ); - path = ViewModel; + path = Services; sourceTree = ""; }; D7C4A1AE2A0E51F500C3AE4C /* View */ = { @@ -1445,6 +1456,7 @@ B5F524FF28519EF300614FF7 /* UIFont+Extension.swift in Sources */, B5F31C5228BFA64F00F61D0F /* LetterAPI.swift in Sources */, D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */, + D7B83FD62A95A48700BFD8FF /* CreateRoomService.swift in Sources */, 391B3003286198C200421F1D /* Size.swift in Sources */, 39C95800287DAC2900A04A2B /* DetailDoneEndPoint.swift in Sources */, B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */, diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index 554e55f0b..73dc7b805 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -21,10 +21,20 @@ final class CreateRoomViewController: BaseViewController { private let roomService: RoomProtocol = RoomAPI(apiService: APIService()) private var cancellable = Set() - private let createRoomViewModel: CreateRoomViewModel = CreateRoomViewModel() + private let createRoomViewModel: CreateRoomViewModel // MARK: - init + init(viewModel: CreateRoomViewModel) { + self.createRoomViewModel = viewModel + super.init() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + deinit { print("\(#file) is dead") } @@ -87,15 +97,17 @@ final class CreateRoomViewController: BaseViewController { let input = CreateRoomViewModel.Input( textFieldTextDidChanged: self.createRoomView.roomTitleView.textFieldPublisher.eraseToAnyPublisher(), sliderValueDidChanged: self.createRoomView.roomCapacityView.sliderPublisher.eraseToAnyPublisher(), + calendarDateDidTap: self.createRoomView.calendarDidTapPublisher.eraseToAnyPublisher(), nextButtonDidTap: self.createRoomView.nextButtonDidTapPublisher.eraseToAnyPublisher()) - return self.createRoomViewModel.transform(input) + return self.createRoomViewModel.transform(from: input) } private func bindOutputToViewModel(_ output: CreateRoomViewModel.Output) { - output.textCount + output.title .receive(on: DispatchQueue.main) - .sink(receiveValue: { [weak self] count in - self?.createRoomView.roomTitleView.setCounter(count: count) + .sink(receiveValue: { [weak self] title in + self?.createRoomView.roomTitleView.setCounter(count: title.count) + self?.createRoomView.roomInfoView.updateRoomTitle(title: title) }) .store(in: &cancellable) @@ -103,10 +115,18 @@ final class CreateRoomViewController: BaseViewController { .receive(on: DispatchQueue.main) .sink(receiveValue: { [weak self] capacity in self?.createRoomView.roomCapacityView.updateCapacity(capacity: capacity) + self?.createRoomView.roomInfoView.updateRoomCapacity(capacity: capacity) }) .store(in: &cancellable) + output.date + .receive(on: DispatchQueue.main) + .sink(receiveValue: { [weak self] range in + self?.createRoomView.roomInfoView.updateRoomDateRange(range: range) + }) + .store(in: &cancellable) + output.currentStep .receive(on: DispatchQueue.main) .sink(receiveValue: { [weak self] currentStep in diff --git a/Manito/Manito/Screens/CreateRoom/Services/CreateRoomService.swift b/Manito/Manito/Screens/CreateRoom/Services/CreateRoomService.swift new file mode 100644 index 000000000..e41705f8b --- /dev/null +++ b/Manito/Manito/Screens/CreateRoom/Services/CreateRoomService.swift @@ -0,0 +1,37 @@ +// +// CreateRoomService.swift +// Manito +// +// Created by 이성호 on 2023/08/23. +// + +import Foundation + +protocol CreateRoomSeviceable { + func postCreateRoom(body: CreateRoomDTO) async throws -> Int +} + +final class CreateRoomService: CreateRoomSeviceable { + + private let api: RoomProtocol + + init(api: RoomProtocol) { + self.api = api + } + + func postCreateRoom(body: CreateRoomDTO) async throws -> Int { + do { + let roomId = try await self.api.postCreateRoom(body: body) + if let roomId { + return roomId + } + else { + throw NetworkError.serverError + } + } catch NetworkError.serverError { + throw NetworkError.serverError + } catch NetworkError.clientError(let message) { + throw NetworkError.clientError(message: message) + } + } +} diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index b8fb7cfa8..a873d4e03 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -52,10 +52,11 @@ final class CreateRoomView: UIView { }() let roomTitleView: InputTitleView = InputTitleView() let roomCapacityView: InputCapacityView = InputCapacityView() - private let roomDateView: InputDateView = InputDateView() - private let roomInfoView: CheckRoomInfoView = CheckRoomInfoView() - private let characterCollectionView: CharacterCollectionView = CharacterCollectionView() + let roomDateView: InputDateView = InputDateView() + let roomInfoView: CheckRoomInfoView = CheckRoomInfoView() + let characterCollectionView: CharacterCollectionView = CharacterCollectionView() + let calendarDidTapPublisher = PassthroughSubject() let nextButtonDidTapPublisher = PassthroughSubject() // MARK: - property @@ -227,24 +228,23 @@ final class CreateRoomView: UIView { private func runActionAtStep(at step: CreateRoomStep) { switch step { case .inputTitle: - self.updateRoomTitle() self.endEditing(true) case .inputCapacity: - self.updateRoomCapacity() self.disabledNextButton() case .inputDate: - self.updateRoomDate() + self.sendDateRangeSubject() case .checkRoom: break case .chooseCharacter: - let colorIndex = self.characterCollectionView.characterIndex - self.delegate?.requestCreateRoom(roomInfo: RoomInfo(id: nil, - capacity: self.roomInfoView.capacity, - title: self.roomInfoView.title, - startDate: "20\(self.roomDateView.calendarView.getTempStartDate())", - endDate: "20\(self.roomDateView.calendarView.getTempEndDate())", - state: nil), - colorIndex: colorIndex) +// let colorIndex = self.characterCollectionView.characterIndex +// self.delegate?.requestCreateRoom(roomInfo: RoomInfo(id: nil, +// capacity: self.roomInfoView.capacity, +// title: self.roomInfoView.title, +// startDate: "20\(self.roomDateView.calendarView.getTempStartDate())", +// endDate: "20\(self.roomDateView.calendarView.getTempEndDate())", +// state: nil), +// colorIndex: colorIndex) + break } } @@ -261,12 +261,12 @@ final class CreateRoomView: UIView { private func disabledNextButton() { self.nextButton.isDisabled = true } - - private func updateRoomDate() { + + private func sendDateRangeSubject() { let startDate = self.roomDateView.calendarView.getTempStartDate() let endDate = self.roomDateView.calendarView.getTempEndDate() let roomDateRange = "\(startDate) ~ \(endDate)" - self.roomInfoView.updateRoomDateRange(range: roomDateRange) + self.calendarDidTapPublisher.send(roomDateRange) } private func configureUI() { diff --git a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift index 3a5799041..fa8d9a9a1 100644 --- a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift +++ b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift @@ -8,28 +8,33 @@ import Combine import Foundation -final class CreateRoomViewModel { +final class CreateRoomViewModel: ViewModelType { // MARK: - property + private let createRoomService: CreateRoomService private var cancellable = Set() + private let roomIdSubject = PassthroughSubject() + struct Input { let textFieldTextDidChanged: AnyPublisher let sliderValueDidChanged: AnyPublisher + let calendarDateDidTap: AnyPublisher let nextButtonDidTap: AnyPublisher } struct Output { - let textCount: AnyPublisher + let title: AnyPublisher let capacity: AnyPublisher + let date: AnyPublisher let currentStep: AnyPublisher } - func transform(_ input: Input) -> Output { - let textCount = input.textFieldTextDidChanged + func transform(from input: Input) -> Output { + let text = input.textFieldTextDidChanged .map { text in - return text.count + return text } .eraseToAnyPublisher() @@ -39,24 +44,50 @@ final class CreateRoomViewModel { } .eraseToAnyPublisher() + let date = input.calendarDateDidTap + .map { date in + return date + } + .eraseToAnyPublisher() + let step = input.nextButtonDidTap .map { currentStep -> CreateRoomStep in + if currentStep == .chooseCharacter { + // viewModel 에 request api 만들고 실행 여기서 + + print("네트워크 통신") + } return currentStep } .eraseToAnyPublisher() - return Output(textCount: textCount, + return Output(title: text, capacity: capacity, + date: date, currentStep: step) } // MARK: - init - + init(createRoomService: CreateRoomService) { + self.createRoomService = createRoomService + } // MARK: - func // MARK: - network + + private func requestCreateRoom(room: CreateRoomDTO) { + Task { + do { + let roomId = try await self.createRoomService.postCreateRoom(body: room) + self.roomIdSubject.send(roomId) + } catch(let error) { + guard let error = error as? NetworkError else { return } + self.roomIdSubject.send(completion: .failure(error)) + } + } + } } diff --git a/Manito/Manito/Screens/Main/MainViewController.swift b/Manito/Manito/Screens/Main/MainViewController.swift index b4e260497..5a683f57c 100644 --- a/Manito/Manito/Screens/Main/MainViewController.swift +++ b/Manito/Manito/Screens/Main/MainViewController.swift @@ -242,7 +242,7 @@ final class MainViewController: BaseViewController { let createRoom = UIAlertAction(title: TextLiteral.createRoom, style: .default, handler: { [weak self] _ in - let createVC = CreateRoomViewController() + let createVC = CreateRoomViewController(viewModel: CreateRoomViewModel(createRoomService: CreateRoomService(api: RoomAPI(apiService: APIService())))) let navigationController = UINavigationController(rootViewController: createVC) navigationController.modalPresentationStyle = .overFullScreen DispatchQueue.main.async { From b3b94ab715cff7866e8b1ff2bd4cb7cfb8537057 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 11:14:55 +0900 Subject: [PATCH 335/468] =?UTF-8?q?[ADD]=20MainRepository=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 20 ++++++++----- Manito/Manito/Data/Network/API/MainAPI.swift | 30 ------------------- .../Data/Network/Protocol/MainProtocol.swift | 13 -------- .../Data/Repository/MainRepository.swift | 30 +++++++++++++++++++ 4 files changed, 42 insertions(+), 51 deletions(-) delete mode 100644 Manito/Manito/Data/Network/API/MainAPI.swift delete mode 100644 Manito/Manito/Data/Network/Protocol/MainProtocol.swift create mode 100644 Manito/Manito/Data/Repository/MainRepository.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index bf8933e95..0c0d16472 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -92,6 +92,7 @@ B517C04E28D1FE660008BED0 /* TokenProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04D28D1FE660008BED0 /* TokenProtocol.swift */; }; B53A35AD2A962E9C00B720BC /* MTNetwork in Frameworks */ = {isa = PBXBuildFile; productRef = B53A35AC2A962E9C00B720BC /* MTNetwork */; }; B53A35B72A963F2100B720BC /* DetailRoomEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35B62A963F2100B720BC /* DetailRoomEndPoint.swift */; }; + B53A35C02A96F21A00B720BC /* MainRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35BF2A96F21A00B720BC /* MainRepository.swift */; }; B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */; }; B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741E929A494E200B75BA3 /* LetterImageError.swift */; }; B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55BCEB328D8449E00AF7E45 /* MemoryCollectionViewCell.swift */; }; @@ -153,8 +154,6 @@ CB2F0FCC28A5468C005F04C8 /* gifTto.gif in Resources */ = {isa = PBXBuildFile; fileRef = CB2F0FC928A5468C005F04C8 /* gifTto.gif */; }; CB2F0FCD28A5468C005F04C8 /* gifNi.gif in Resources */ = {isa = PBXBuildFile; fileRef = CB2F0FCA28A5468C005F04C8 /* gifNi.gif */; }; CB358C0228A564080084D001 /* SettingDeveloperInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB358C0128A564080084D001 /* SettingDeveloperInfoViewController.swift */; }; - CB4C77E428C0D4C9007A1AD2 /* MainProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB4C77E328C0D4C9007A1AD2 /* MainProtocol.swift */; }; - CB4C77E628C0D4EB007A1AD2 /* MainAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB4C77E528C0D4EB007A1AD2 /* MainAPI.swift */; }; CB5AE3E4285AAF7400382EA3 /* RoomInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB5AE3E3285AAF7400382EA3 /* RoomInfoView.swift */; }; CB5AE3E6285AB76800382EA3 /* PeopleInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB5AE3E5285AB76800382EA3 /* PeopleInfoView.swift */; }; CB637A3B28595C1200FF1240 /* ParticipateRoomViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB637A3A28595C1200FF1240 /* ParticipateRoomViewController.swift */; }; @@ -291,6 +290,7 @@ B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenAPI.swift; sourceTree = ""; }; B517C04D28D1FE660008BED0 /* TokenProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenProtocol.swift; sourceTree = ""; }; B53A35B62A963F2100B720BC /* DetailRoomEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailRoomEndPoint.swift; sourceTree = ""; }; + B53A35BF2A96F21A00B720BC /* MainRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainRepository.swift; sourceTree = ""; }; B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Dev.xcconfig; sourceTree = ""; }; B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Prod.xcconfig; sourceTree = ""; }; B53AD41D2A8C88E100B83B33 /* GoogleService-Info-Dev.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Dev.plist"; sourceTree = ""; }; @@ -358,8 +358,6 @@ CB2F0FC928A5468C005F04C8 /* gifTto.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = gifTto.gif; sourceTree = ""; }; CB2F0FCA28A5468C005F04C8 /* gifNi.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = gifNi.gif; sourceTree = ""; }; CB358C0128A564080084D001 /* SettingDeveloperInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingDeveloperInfoViewController.swift; sourceTree = ""; }; - CB4C77E328C0D4C9007A1AD2 /* MainProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainProtocol.swift; sourceTree = ""; }; - CB4C77E528C0D4EB007A1AD2 /* MainAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainAPI.swift; sourceTree = ""; }; CB5AE3E3285AAF7400382EA3 /* RoomInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomInfoView.swift; sourceTree = ""; }; CB5AE3E5285AB76800382EA3 /* PeopleInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PeopleInfoView.swift; sourceTree = ""; }; CB637A3A28595C1200FF1240 /* ParticipateRoomViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipateRoomViewController.swift; sourceTree = ""; }; @@ -458,7 +456,6 @@ 7E77DB0728BF9D2400E95D4B /* RoomAPI.swift */, 39CD581A28C4BE8800496E91 /* DetailStartingAPI.swift */, 39CD582028C4C3E800496E91 /* DetailDoneAPI.swift */, - CB4C77E528C0D4EB007A1AD2 /* MainAPI.swift */, B5F31C5128BFA64F00F61D0F /* LetterAPI.swift */, 39EEF65B28CB3CD600437654 /* LoginAPI.swift */, D739C36428C7B75400161117 /* SettingAPI.swift */, @@ -475,7 +472,6 @@ 7E77DB0328BF9A6700E95D4B /* RoomProtocol.swift */, 39CD581828C4BD9D00496E91 /* DetailStartingProtocol.swift */, 39CD581C28C4C03B00496E91 /* DetailDoneProtocol.swift */, - CB4C77E328C0D4C9007A1AD2 /* MainProtocol.swift */, B5F31C5328BFA70100F61D0F /* LetterProtocol.swift */, 39EEF65528CB3BB200437654 /* LoginProtocol.swift */, D739C36228C7B69D00161117 /* SettingProtocol.swift */, @@ -640,11 +636,20 @@ B53A35B82A9640EB00B720BC /* Data */ = { isa = PBXGroup; children = ( + B53A35BE2A96F1F900B720BC /* Repository */, B5F525462855D00B00614FF7 /* Network */, ); path = Data; sourceTree = ""; }; + B53A35BE2A96F1F900B720BC /* Repository */ = { + isa = PBXGroup; + children = ( + B53A35BF2A96F21A00B720BC /* MainRepository.swift */, + ); + path = Repository; + sourceTree = ""; + }; B53AD40F2A8BC69700B83B33 /* Configuration */ = { isa = PBXGroup; children = ( @@ -1458,10 +1463,10 @@ B50CEEC02A6FF82600CF1C76 /* Publisher+Extension.swift in Sources */, 39EEF65C28CB3CD600437654 /* LoginAPI.swift in Sources */, B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */, + B53A35C02A96F21A00B720BC /* MainRepository.swift in Sources */, D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */, B5F5251A2851A12600614FF7 /* BaseViewController.swift in Sources */, B5AE11F029D1E43B00F86FF8 /* OpenManittoView.swift in Sources */, - CB4C77E428C0D4C9007A1AD2 /* MainProtocol.swift in Sources */, CB85DE1F28A76F3400399109 /* SettingDeveloperInfoHeaderView.swift in Sources */, B5706BF429B710FC0093D198 /* LetterView.swift in Sources */, D739C36528C7B75400161117 /* SettingAPI.swift in Sources */, @@ -1496,7 +1501,6 @@ D7C4A1A72A0B2EB000C3AE4C /* CharacterCollectionView.swift in Sources */, 39C95802287DACC300A04A2B /* RoomParticipationEndPoint.swift in Sources */, 395B5BC22A25E20000CE1420 /* DetailWaitViewModel.swift in Sources */, - CB4C77E628C0D4EB007A1AD2 /* MainAPI.swift in Sources */, B5F524FD28519EEC00614FF7 /* UIColor+Extension.swift in Sources */, B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */, D7C4A1AD2A0DD8FA00C3AE4C /* SettingView.swift in Sources */, diff --git a/Manito/Manito/Data/Network/API/MainAPI.swift b/Manito/Manito/Data/Network/API/MainAPI.swift deleted file mode 100644 index 17ad2c003..000000000 --- a/Manito/Manito/Data/Network/API/MainAPI.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// MainAPI.swift -// Manito -// -// Created by COBY_PRO on 2022/09/01. -// - -import Foundation - -struct MainAPI: MainProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func fetchCommonMission() async throws -> DailyMission? { - let request = MainEndPoint - .fetchCommonMission - .createRequest() - return try await apiService.request(request) - } - - func fetchManittoList() async throws -> ParticipatingRooms? { - let request = MainEndPoint - .fetchManittoList - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Data/Network/Protocol/MainProtocol.swift b/Manito/Manito/Data/Network/Protocol/MainProtocol.swift deleted file mode 100644 index 205482da0..000000000 --- a/Manito/Manito/Data/Network/Protocol/MainProtocol.swift +++ /dev/null @@ -1,13 +0,0 @@ -// -// MainProtocal.swift -// Manito -// -// Created by COBY_PRO on 2022/09/01. -// - -import Foundation - -protocol MainProtocol { - func fetchCommonMission() async throws -> DailyMission? - func fetchManittoList() async throws -> ParticipatingRooms? -} diff --git a/Manito/Manito/Data/Repository/MainRepository.swift b/Manito/Manito/Data/Repository/MainRepository.swift new file mode 100644 index 000000000..a10c5b0be --- /dev/null +++ b/Manito/Manito/Data/Repository/MainRepository.swift @@ -0,0 +1,30 @@ +// +// MainRepository.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +import MTNetwork + +protocol MainRepository { + func fetchCommonMission() async throws -> DailyMission? + func fetchManittoList() async throws -> ParticipatingRooms? +} + +final class MainRepositoryImpl: MainRepository { + + private var provider = Provider() + + func fetchCommonMission() async throws -> DailyMission? { + let response = try await self.provider.request(.fetchCommonMission) + return try response.decode() + } + + func fetchManittoList() async throws -> ParticipatingRooms? { + let response = try await self.provider.request(.fetchManittoList) + return try response.decode() + } +} From 940ee0f291e15a7d7f477373fee03c628aa0c487 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 11:23:30 +0900 Subject: [PATCH 336/468] =?UTF-8?q?[ADD]=20DetailRoomRepository=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 36 ++-------- .../Data/Network/API/DetailDoneAPI.swift | 51 ------------- .../Data/Network/API/DetailStartingAPI.swift | 37 ---------- .../Data/Network/API/DetailWaitAPI.swift | 58 --------------- .../Data/Network/API/MissionEditAPI.swift | 23 ------ .../Network/Protocol/DetailDoneProtocol.swift | 16 ----- .../Protocol/DetailStartingProtocol.swift | 14 ---- .../Network/Protocol/DetailWaitProtocol.swift | 17 ----- .../Protocol/MisstionEditProtocol.swift | 12 ---- .../Repository/DetailRoomRepository.swift | 72 +++++++++++++++++++ 10 files changed, 76 insertions(+), 260 deletions(-) delete mode 100644 Manito/Manito/Data/Network/API/DetailDoneAPI.swift delete mode 100644 Manito/Manito/Data/Network/API/DetailStartingAPI.swift delete mode 100644 Manito/Manito/Data/Network/API/DetailWaitAPI.swift delete mode 100644 Manito/Manito/Data/Network/API/MissionEditAPI.swift delete mode 100644 Manito/Manito/Data/Network/Protocol/DetailDoneProtocol.swift delete mode 100644 Manito/Manito/Data/Network/Protocol/DetailStartingProtocol.swift delete mode 100644 Manito/Manito/Data/Network/Protocol/DetailWaitProtocol.swift delete mode 100644 Manito/Manito/Data/Network/Protocol/MisstionEditProtocol.swift create mode 100644 Manito/Manito/Data/Repository/DetailRoomRepository.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 0c0d16472..5be0720a1 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -20,8 +20,6 @@ 395B5BC22A25E20000CE1420 /* DetailWaitViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */; }; 395B5BCC2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */; }; 397A241028BA494100454E4F /* APIEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957F0287D984900A04A2B /* APIEnvironment.swift */; }; - 397A241428BA516B00454E4F /* DetailWaitAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241328BA516B00454E4F /* DetailWaitAPI.swift */; }; - 397A241828BA51B400454E4F /* DetailWaitProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */; }; 397A241A28BA532A00454E4F /* FriendList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241928BA532A00454E4F /* FriendList.swift */; }; 398B1C9B29F10B0300DEFCEC /* DetailEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 398B1C9A29F10B0300DEFCEC /* DetailEditView.swift */; }; 398B1CBC2A12415C00DEFCEC /* ManitoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */; }; @@ -29,8 +27,6 @@ 398B1CCC2A13599D00DEFCEC /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = 398B1CCB2A13599D00DEFCEC /* FirebaseAuth */; }; 399D17AB2856C83B00F50D9D /* DetailEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */; }; 39A938932A4852CA00EC2CF2 /* MissionDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938922A4852CA00EC2CF2 /* MissionDTO.swift */; }; - 39A938952A48562500EC2CF2 /* MisstionEditProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938942A48562500EC2CF2 /* MisstionEditProtocol.swift */; }; - 39A938972A48565500EC2CF2 /* MissionEditAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938962A48565500EC2CF2 /* MissionEditAPI.swift */; }; 39BDDCC42A52BB4A005E0A71 /* DetailWaitService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39BDDCC32A52BB4A005E0A71 /* DetailWaitService.swift */; }; 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */; }; 39C957D02879521400A04A2B /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CF2879521400A04A2B /* String+Extension.swift */; }; @@ -43,11 +39,7 @@ 39C95804287DAD3000A04A2B /* LetterEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95803287DAD3000A04A2B /* LetterEndPoint.swift */; }; 39C95808287DB05C00A04A2B /* SettingEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95807287DB05C00A04A2B /* SettingEndPoint.swift */; }; 39C9580A287DC03500A04A2B /* Encodable+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95809287DC03500A04A2B /* Encodable+Extension.swift */; }; - 39CD581928C4BD9D00496E91 /* DetailStartingProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CD581828C4BD9D00496E91 /* DetailStartingProtocol.swift */; }; - 39CD581B28C4BE8800496E91 /* DetailStartingAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CD581A28C4BE8800496E91 /* DetailStartingAPI.swift */; }; - 39CD581D28C4C03C00496E91 /* DetailDoneProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CD581C28C4C03B00496E91 /* DetailDoneProtocol.swift */; }; 39CD581F28C4C19100496E91 /* Memory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CD581E28C4C19100496E91 /* Memory.swift */; }; - 39CD582128C4C3E800496E91 /* DetailDoneAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CD582028C4C3E800496E91 /* DetailDoneAPI.swift */; }; 39D95265285B097800183B09 /* CalendarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39D95264285B097800183B09 /* CalendarView.swift */; }; 39E099AD287FC020004F464E /* LetterDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39E099AC287FC020004F464E /* LetterDTO.swift */; }; 39EE956D2A401ED400AF6857 /* DetailingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EE956C2A401ED400AF6857 /* DetailingView.swift */; }; @@ -93,6 +85,7 @@ B53A35AD2A962E9C00B720BC /* MTNetwork in Frameworks */ = {isa = PBXBuildFile; productRef = B53A35AC2A962E9C00B720BC /* MTNetwork */; }; B53A35B72A963F2100B720BC /* DetailRoomEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35B62A963F2100B720BC /* DetailRoomEndPoint.swift */; }; B53A35C02A96F21A00B720BC /* MainRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35BF2A96F21A00B720BC /* MainRepository.swift */; }; + B53A35C42A96F50100B720BC /* DetailRoomRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35C32A96F50100B720BC /* DetailRoomRepository.swift */; }; B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */; }; B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741E929A494E200B75BA3 /* LetterImageError.swift */; }; B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55BCEB328D8449E00AF7E45 /* MemoryCollectionViewCell.swift */; }; @@ -221,16 +214,12 @@ 392EC7802855D17D006918A9 /* DetailWaitTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitTitleView.swift; sourceTree = ""; }; 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitViewModel.swift; sourceTree = ""; }; 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitViewModelTest.swift; sourceTree = ""; }; - 397A241328BA516B00454E4F /* DetailWaitAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitAPI.swift; sourceTree = ""; }; - 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitProtocol.swift; sourceTree = ""; }; 397A241928BA532A00454E4F /* FriendList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendList.swift; sourceTree = ""; }; 398B1C9A29F10B0300DEFCEC /* DetailEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailEditView.swift; sourceTree = ""; }; 398B1CB92A12415B00DEFCEC /* ManitoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ManitoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManitoTests.swift; sourceTree = ""; }; 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailEditViewController.swift; sourceTree = ""; }; 39A938922A4852CA00EC2CF2 /* MissionDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionDTO.swift; sourceTree = ""; }; - 39A938942A48562500EC2CF2 /* MisstionEditProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MisstionEditProtocol.swift; sourceTree = ""; }; - 39A938962A48565500EC2CF2 /* MissionEditAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionEditAPI.swift; sourceTree = ""; }; 39BDDCC32A52BB4A005E0A71 /* DetailWaitService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitService.swift; sourceTree = ""; }; 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; 39C957CF2879521400A04A2B /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = ""; }; @@ -244,11 +233,7 @@ 39C95803287DAD3000A04A2B /* LetterEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterEndPoint.swift; sourceTree = ""; }; 39C95807287DB05C00A04A2B /* SettingEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingEndPoint.swift; sourceTree = ""; }; 39C95809287DC03500A04A2B /* Encodable+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Encodable+Extension.swift"; sourceTree = ""; }; - 39CD581828C4BD9D00496E91 /* DetailStartingProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailStartingProtocol.swift; sourceTree = ""; }; - 39CD581A28C4BE8800496E91 /* DetailStartingAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailStartingAPI.swift; sourceTree = ""; }; - 39CD581C28C4C03B00496E91 /* DetailDoneProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailDoneProtocol.swift; sourceTree = ""; }; 39CD581E28C4C19100496E91 /* Memory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Memory.swift; sourceTree = ""; }; - 39CD582028C4C3E800496E91 /* DetailDoneAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailDoneAPI.swift; sourceTree = ""; }; 39D95264285B097800183B09 /* CalendarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarView.swift; sourceTree = ""; }; 39E099AC287FC020004F464E /* LetterDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterDTO.swift; sourceTree = ""; }; 39E6321328BDE59C00CFC6C4 /* Manito.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Manito.entitlements; sourceTree = ""; }; @@ -291,6 +276,7 @@ B517C04D28D1FE660008BED0 /* TokenProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenProtocol.swift; sourceTree = ""; }; B53A35B62A963F2100B720BC /* DetailRoomEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailRoomEndPoint.swift; sourceTree = ""; }; B53A35BF2A96F21A00B720BC /* MainRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainRepository.swift; sourceTree = ""; }; + B53A35C32A96F50100B720BC /* DetailRoomRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailRoomRepository.swift; sourceTree = ""; }; B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Dev.xcconfig; sourceTree = ""; }; B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Prod.xcconfig; sourceTree = ""; }; B53AD41D2A8C88E100B83B33 /* GoogleService-Info-Dev.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Dev.plist"; sourceTree = ""; }; @@ -452,15 +438,11 @@ 397A241128BA513E00454E4F /* API */ = { isa = PBXGroup; children = ( - 397A241328BA516B00454E4F /* DetailWaitAPI.swift */, 7E77DB0728BF9D2400E95D4B /* RoomAPI.swift */, - 39CD581A28C4BE8800496E91 /* DetailStartingAPI.swift */, - 39CD582028C4C3E800496E91 /* DetailDoneAPI.swift */, B5F31C5128BFA64F00F61D0F /* LetterAPI.swift */, 39EEF65B28CB3CD600437654 /* LoginAPI.swift */, D739C36428C7B75400161117 /* SettingAPI.swift */, B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */, - 39A938962A48565500EC2CF2 /* MissionEditAPI.swift */, ); path = API; sourceTree = ""; @@ -468,15 +450,11 @@ 397A241528BA519200454E4F /* Protocol */ = { isa = PBXGroup; children = ( - 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */, 7E77DB0328BF9A6700E95D4B /* RoomProtocol.swift */, - 39CD581828C4BD9D00496E91 /* DetailStartingProtocol.swift */, - 39CD581C28C4C03B00496E91 /* DetailDoneProtocol.swift */, B5F31C5328BFA70100F61D0F /* LetterProtocol.swift */, 39EEF65528CB3BB200437654 /* LoginProtocol.swift */, D739C36228C7B69D00161117 /* SettingProtocol.swift */, B517C04D28D1FE660008BED0 /* TokenProtocol.swift */, - 39A938942A48562500EC2CF2 /* MisstionEditProtocol.swift */, ); path = Protocol; sourceTree = ""; @@ -646,6 +624,7 @@ isa = PBXGroup; children = ( B53A35BF2A96F21A00B720BC /* MainRepository.swift */, + B53A35C32A96F50100B720BC /* DetailRoomRepository.swift */, ); path = Repository; sourceTree = ""; @@ -1420,7 +1399,6 @@ B5F5250128519EFB00614FF7 /* ImageLiteral.swift in Sources */, 39F1C12E28D756E600585B83 /* LetterImageViewController.swift in Sources */, 7E7542B32923744300D725CB /* ToastPopupView.swift in Sources */, - 39CD581B28C4BE8800496E91 /* DetailStartingAPI.swift in Sources */, 39C957D22879523200A04A2B /* Date+Extension.swift in Sources */, 39EE956F2A404A3800AF6857 /* MissionEditViewController.swift in Sources */, B5F5250A2851A06700614FF7 /* DetailWaitViewController.swift in Sources */, @@ -1433,7 +1411,6 @@ B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */, B5F525422855C97900614FF7 /* UILabel+Extension.swift in Sources */, CB21C33928C4C10200128D25 /* CharacterCollectionViewCell.swift in Sources */, - 39A938952A48562500EC2CF2 /* MisstionEditProtocol.swift in Sources */, 39EEF65A28CB3C7B00437654 /* Token.swift in Sources */, 39C95804287DAD3000A04A2B /* LetterEndPoint.swift in Sources */, 7E77DB0828BF9D2400E95D4B /* RoomAPI.swift in Sources */, @@ -1449,12 +1426,10 @@ 39EE956D2A401ED400AF6857 /* DetailingView.swift in Sources */, 39C95808287DB05C00A04A2B /* SettingEndPoint.swift in Sources */, B5F524CF28519AA000614FF7 /* AppDelegate.swift in Sources */, - 39A938972A48565500EC2CF2 /* MissionEditAPI.swift in Sources */, 435B17682913E71400212663 /* DetailingViewController.swift in Sources */, B50CEE912A445EB700CF1C76 /* UIScrollView+Combine.swift in Sources */, B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */, D7C4A1A92A0B895300C3AE4C /* ChooseCharacterView.swift in Sources */, - 397A241828BA51B400454E4F /* DetailWaitProtocol.swift in Sources */, 7EA25C2728C4FEA800746AEA /* ChangeNickNameViewController.swift in Sources */, D724AF5F28708D830003F280 /* ImageRowView.swift in Sources */, 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */, @@ -1495,7 +1470,6 @@ D7B6C97C2858B2D40024F326 /* CheckRoomInfoView.swift in Sources */, B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */, B5F31BB228BE1CD700F61D0F /* UserDefaultHandler.swift in Sources */, - 39CD581D28C4C03C00496E91 /* DetailDoneProtocol.swift in Sources */, CB9592B52855D52700847751 /* CommonMissionView.swift in Sources */, CBA4D7A42856CE9F0018BDC2 /* CreateRoomCollectionViewCell.swift in Sources */, D7C4A1A72A0B2EB000C3AE4C /* CharacterCollectionView.swift in Sources */, @@ -1525,15 +1499,14 @@ B5F5253B2854ABF200614FF7 /* MainButton.swift in Sources */, B50B1B2A285AB7650080992C /* SplashViewController.swift in Sources */, B5FEE9DB28C8498A00DEA07E /* ImageCacheManager.swift in Sources */, - 39CD581928C4BD9D00496E91 /* DetailStartingProtocol.swift in Sources */, B5F5253528547F1900614FF7 /* LetterHeaderView.swift in Sources */, B5F52537285481C800614FF7 /* LetterCollectionViewCell.swift in Sources */, 7E77DB0628BF9C0600E95D4B /* VerificationCode.swift in Sources */, + B53A35C42A96F50100B720BC /* DetailRoomRepository.swift in Sources */, CB358C0228A564080084D001 /* SettingDeveloperInfoViewController.swift in Sources */, CB7B23A828C4ECA8004A4CF3 /* Character.swift in Sources */, 39C957E12879A3CF00A04A2B /* DailyMission.swift in Sources */, B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */, - 39CD582128C4C3E800496E91 /* DetailDoneAPI.swift in Sources */, D724AF5D287088310003F280 /* SettingViewController.swift in Sources */, B5F5253D2854B8CB00614FF7 /* UIView+Extension.swift in Sources */, 39018F4228C4708A00C78DBA /* UIButton+Extension.swift in Sources */, @@ -1542,7 +1515,6 @@ CB9592B22855C09A00847751 /* ManitoRoomCollectionCell.swift in Sources */, D70220232A7A22EC0024BACD /* CreateRoomView.swift in Sources */, B5AE11F429D32EE700F86FF8 /* SelectManitteeView.swift in Sources */, - 397A241428BA516B00454E4F /* DetailWaitAPI.swift in Sources */, 39A938932A4852CA00EC2CF2 /* MissionDTO.swift in Sources */, B5F525242851A25400614FF7 /* UICollectionView+Extension.swift in Sources */, ); diff --git a/Manito/Manito/Data/Network/API/DetailDoneAPI.swift b/Manito/Manito/Data/Network/API/DetailDoneAPI.swift deleted file mode 100644 index 7a924b644..000000000 --- a/Manito/Manito/Data/Network/API/DetailDoneAPI.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// DetailEndAPI.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/04. -// - -import Foundation - -struct DetailDoneAPI: DetailDoneProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func requestMemory(roomId: String) async throws -> Memory? { - let request = DetailDoneEndPoint - .requestMemory(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func requestDoneRoomInfo(roomId: String) async throws -> Room? { - let request = DetailDoneEndPoint - .requestDoneRoomInfo(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func requestWithFriends(roomId: String) async throws -> FriendList? { - let request = DetailDoneEndPoint - .requestWithFriend(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func requestExitRoom(roomId: String) async throws -> Int { - let request = DetailDoneEndPoint - .requestExitRoom(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func requestDeleteRoom(roomId: String) async throws -> Int { - let request = DetailDoneEndPoint - .requestDeleteRoom(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Data/Network/API/DetailStartingAPI.swift b/Manito/Manito/Data/Network/API/DetailStartingAPI.swift deleted file mode 100644 index 723c3bba7..000000000 --- a/Manito/Manito/Data/Network/API/DetailStartingAPI.swift +++ /dev/null @@ -1,37 +0,0 @@ -// -// DetailIngAPI.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/04. -// - -import Foundation - -struct DetailIngAPI: DetailStartingProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func requestStartingRoomInfo(roomId: String) async throws -> Room? { - let request = DetailIngEndPoint - .requestStartingRoomInfo(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func requestWithFriends(roomId: String) async throws -> FriendList? { - let request = DetailIngEndPoint - .requestWithFriend(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func fetchResetMission(roomId: String) async throws -> MissionDTO? { - let request = DetailIngEndPoint - .getResetMission(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Data/Network/API/DetailWaitAPI.swift b/Manito/Manito/Data/Network/API/DetailWaitAPI.swift deleted file mode 100644 index c9443ddf0..000000000 --- a/Manito/Manito/Data/Network/API/DetailWaitAPI.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// DetailWaitAPI.swift -// Manito -// -// Created by Mingwan Choi on 2022/08/27. -// - -import Foundation - -struct DetailWaitAPI: DetailWaitProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func getWithFriend(roomId: String) async throws -> FriendList? { - let request = DetailWaitEndPoint - .fetchWithFriend(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func getWaitingRoomInfo(roomId: String) async throws -> Room? { - let request = DetailWaitEndPoint - .fetchWaitingRoomInfo(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func startManitto(roomId: String) async throws -> Manittee? { - let request = DetailWaitEndPoint - .patchStartManitto(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func editRoomInfo(roomId: String, roomInfo: RoomDTO) async throws -> Int { - let request = DetailWaitEndPoint - .putRoomInfo(roomId: roomId, roomInfo: roomInfo) - .createRequest() - return try await apiService.request(request) - } - - func deleteRoom(roomId: String) async throws -> Int { - let request = DetailWaitEndPoint - .deleteRoom(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func deleteLeaveRoom(roomId: String) async throws -> Int { - let request = DetailWaitEndPoint - .deleteLeaveRoom(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Data/Network/API/MissionEditAPI.swift b/Manito/Manito/Data/Network/API/MissionEditAPI.swift deleted file mode 100644 index 9eb2a5dbd..000000000 --- a/Manito/Manito/Data/Network/API/MissionEditAPI.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// MissionEditAPI.swift -// Manito -// -// Created by Mingwan Choi on 2023/06/25. -// - -import Foundation - -struct MissionEditAPI: MissionEditProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func patchEditMission(roomId: String, body: MissionDTO) async throws -> MissionDTO? { - let request = MissionEditEndPoint - .patchEditMission(roomId: roomId, body: body) - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Data/Network/Protocol/DetailDoneProtocol.swift b/Manito/Manito/Data/Network/Protocol/DetailDoneProtocol.swift deleted file mode 100644 index 0f071e014..000000000 --- a/Manito/Manito/Data/Network/Protocol/DetailDoneProtocol.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// DetailEndProtocol.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/04. -// - -import Foundation - -protocol DetailDoneProtocol { - func requestMemory(roomId: String) async throws -> Memory? - func requestDoneRoomInfo(roomId: String) async throws -> Room? - func requestWithFriends(roomId: String) async throws -> FriendList? - func requestExitRoom(roomId: String) async throws -> Int - func requestDeleteRoom(roomId: String) async throws -> Int -} diff --git a/Manito/Manito/Data/Network/Protocol/DetailStartingProtocol.swift b/Manito/Manito/Data/Network/Protocol/DetailStartingProtocol.swift deleted file mode 100644 index 0123cc5d4..000000000 --- a/Manito/Manito/Data/Network/Protocol/DetailStartingProtocol.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// DetailIngProtocol.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/04. -// - -import Foundation - -protocol DetailStartingProtocol { - func requestStartingRoomInfo(roomId: String) async throws -> Room? - func requestWithFriends(roomId: String) async throws -> FriendList? - func fetchResetMission(roomId: String) async throws -> MissionDTO? -} diff --git a/Manito/Manito/Data/Network/Protocol/DetailWaitProtocol.swift b/Manito/Manito/Data/Network/Protocol/DetailWaitProtocol.swift deleted file mode 100644 index 7b1a74165..000000000 --- a/Manito/Manito/Data/Network/Protocol/DetailWaitProtocol.swift +++ /dev/null @@ -1,17 +0,0 @@ -// -// DetailWaitProtocol.swift -// Manito -// -// Created by Mingwan Choi on 2022/08/27. -// - -import Foundation - -protocol DetailWaitProtocol { - func getWithFriend(roomId: String) async throws -> FriendList? - func getWaitingRoomInfo(roomId: String) async throws -> Room? - func startManitto(roomId: String) async throws -> Manittee? - func editRoomInfo(roomId: String, roomInfo: RoomDTO) async throws -> Int - func deleteRoom(roomId: String) async throws -> Int - func deleteLeaveRoom(roomId: String) async throws -> Int -} diff --git a/Manito/Manito/Data/Network/Protocol/MisstionEditProtocol.swift b/Manito/Manito/Data/Network/Protocol/MisstionEditProtocol.swift deleted file mode 100644 index ef27e4421..000000000 --- a/Manito/Manito/Data/Network/Protocol/MisstionEditProtocol.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// MisstionEditProtocol.swift -// Manito -// -// Created by Mingwan Choi on 2023/06/25. -// - -import Foundation - -protocol MissionEditProtocol { - func patchEditMission(roomId: String, body: MissionDTO) async throws -> MissionDTO? -} diff --git a/Manito/Manito/Data/Repository/DetailRoomRepository.swift b/Manito/Manito/Data/Repository/DetailRoomRepository.swift new file mode 100644 index 000000000..9f7533eb1 --- /dev/null +++ b/Manito/Manito/Data/Repository/DetailRoomRepository.swift @@ -0,0 +1,72 @@ +// +// DetailRoomRepository.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +import MTNetwork + +protocol DetailRoomRepository { + func fetchWithFriend(roomId: String) async throws -> FriendList? + func fetchRoomInfo(roomId: String) async throws -> Room? + func fetchResetMission(roomId: String) async throws -> MissionDTO? + func fetchMemory(roomId: String) async throws -> Memory? + func patchStartManitto(roomId: String) async throws -> Manittee? + func patchEditMission(roomId: String, body: MissionDTO) async throws -> MissionDTO? + func putRoomInfo(roomId: String, roomInfo: RoomDTO) async throws -> Int + func deleteRoom(roomId: String) async throws -> Int + func deleteLeaveRoom(roomId: String) async throws -> Int +} + +final class DetailRoomRepositoryImpl: DetailRoomRepository { + + private var provider = Provider() + + func fetchWithFriend(roomId: String) async throws -> FriendList? { + let response = try await self.provider.request(.fetchWithFriend(roomId: roomId)) + return try response.decode() + } + + func fetchRoomInfo(roomId: String) async throws -> Room? { + let response = try await self.provider.request(.fetchRoomInfo(roomId: roomId)) + return try response.decode() + } + + func fetchResetMission(roomId: String) async throws -> MissionDTO? { + let response = try await self.provider.request(.fetchResetMission(roomId: roomId)) + return try response.decode() + } + + func fetchMemory(roomId: String) async throws -> Memory? { + let response = try await self.provider.request(.fetchMemory(roomId: roomId)) + return try response.decode() + } + + func patchStartManitto(roomId: String) async throws -> Manittee? { + let response = try await self.provider.request(.patchStartManitto(roomId: roomId)) + return try response.decode() + } + + func patchEditMission(roomId: String, body: MissionDTO) async throws -> MissionDTO? { + let response = try await self.provider.request(.patchEditMission(roomId: roomId, body: body)) + return try response.decode() + } + + func putRoomInfo(roomId: String, roomInfo: RoomDTO) async throws -> Int { + let response = try await self.provider.request(.putRoomInfo(roomId: roomId, roomInfo: roomInfo)) + return try response.decode() + } + + func deleteRoom(roomId: String) async throws -> Int { + let response = try await self.provider.request(.deleteRoom(roomId: roomId)) + return try response.decode() + } + + func deleteLeaveRoom(roomId: String) async throws -> Int { + let response = try await self.provider.request(.deleteLeaveRoom(roomId: roomId)) + return try response.decode() + } +} From 50f4e60a13bd0ff8a0311f12b94ec164073a80b8 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 11:30:03 +0900 Subject: [PATCH 337/468] =?UTF-8?q?[ADD]=20RoomParticipationRepository=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 12 ++---- Manito/Manito/Data/Network/API/RoomAPI.swift | 37 ------------------- .../EndPoint/RoomParticipationEndPoint.swift | 2 +- .../Data/Network/Protocol/RoomProtocol.swift | 14 ------- .../RoomParticipationRepository.swift | 36 ++++++++++++++++++ 5 files changed, 41 insertions(+), 60 deletions(-) delete mode 100644 Manito/Manito/Data/Network/API/RoomAPI.swift delete mode 100644 Manito/Manito/Data/Network/Protocol/RoomProtocol.swift create mode 100644 Manito/Manito/Data/Repository/RoomParticipationRepository.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 5be0720a1..958cdf0c6 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -61,9 +61,7 @@ 7E3058C82854B64D00489E6A /* InputCapacityView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C72854B64D00489E6A /* InputCapacityView.swift */; }; 7E3058CA2854B7A900489E6A /* InputDateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C92854B7A900489E6A /* InputDateView.swift */; }; 7E7542B32923744300D725CB /* ToastPopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E7542B22923744300D725CB /* ToastPopupView.swift */; }; - 7E77DB0428BF9A6700E95D4B /* RoomProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E77DB0328BF9A6700E95D4B /* RoomProtocol.swift */; }; 7E77DB0628BF9C0600E95D4B /* VerificationCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E77DB0528BF9C0600E95D4B /* VerificationCode.swift */; }; - 7E77DB0828BF9D2400E95D4B /* RoomAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E77DB0728BF9D2400E95D4B /* RoomAPI.swift */; }; 7EA25C2728C4FEA800746AEA /* ChangeNickNameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */; }; 7ED845BA2876BE530075AC61 /* SettingViewTableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ED845B92876BE530075AC61 /* SettingViewTableCell.swift */; }; B50B1AF92856B2C60080992C /* CreateLetterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50B1AF82856B2C60080992C /* CreateLetterViewController.swift */; }; @@ -86,6 +84,7 @@ B53A35B72A963F2100B720BC /* DetailRoomEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35B62A963F2100B720BC /* DetailRoomEndPoint.swift */; }; B53A35C02A96F21A00B720BC /* MainRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35BF2A96F21A00B720BC /* MainRepository.swift */; }; B53A35C42A96F50100B720BC /* DetailRoomRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35C32A96F50100B720BC /* DetailRoomRepository.swift */; }; + B53A35C62A96F6DB00B720BC /* RoomParticipationRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35C52A96F6DB00B720BC /* RoomParticipationRepository.swift */; }; B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */; }; B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741E929A494E200B75BA3 /* LetterImageError.swift */; }; B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55BCEB328D8449E00AF7E45 /* MemoryCollectionViewCell.swift */; }; @@ -256,9 +255,7 @@ 7E3058C72854B64D00489E6A /* InputCapacityView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputCapacityView.swift; sourceTree = ""; }; 7E3058C92854B7A900489E6A /* InputDateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputDateView.swift; sourceTree = ""; }; 7E7542B22923744300D725CB /* ToastPopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToastPopupView.swift; sourceTree = ""; }; - 7E77DB0328BF9A6700E95D4B /* RoomProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomProtocol.swift; sourceTree = ""; }; 7E77DB0528BF9C0600E95D4B /* VerificationCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerificationCode.swift; sourceTree = ""; }; - 7E77DB0728BF9D2400E95D4B /* RoomAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomAPI.swift; sourceTree = ""; }; 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangeNickNameViewController.swift; sourceTree = ""; }; 7ED845B92876BE530075AC61 /* SettingViewTableCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewTableCell.swift; sourceTree = ""; }; B50B1AF82856B2C60080992C /* CreateLetterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateLetterViewController.swift; sourceTree = ""; }; @@ -277,6 +274,7 @@ B53A35B62A963F2100B720BC /* DetailRoomEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailRoomEndPoint.swift; sourceTree = ""; }; B53A35BF2A96F21A00B720BC /* MainRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainRepository.swift; sourceTree = ""; }; B53A35C32A96F50100B720BC /* DetailRoomRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailRoomRepository.swift; sourceTree = ""; }; + B53A35C52A96F6DB00B720BC /* RoomParticipationRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomParticipationRepository.swift; sourceTree = ""; }; B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Dev.xcconfig; sourceTree = ""; }; B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Prod.xcconfig; sourceTree = ""; }; B53AD41D2A8C88E100B83B33 /* GoogleService-Info-Dev.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Dev.plist"; sourceTree = ""; }; @@ -438,7 +436,6 @@ 397A241128BA513E00454E4F /* API */ = { isa = PBXGroup; children = ( - 7E77DB0728BF9D2400E95D4B /* RoomAPI.swift */, B5F31C5128BFA64F00F61D0F /* LetterAPI.swift */, 39EEF65B28CB3CD600437654 /* LoginAPI.swift */, D739C36428C7B75400161117 /* SettingAPI.swift */, @@ -450,7 +447,6 @@ 397A241528BA519200454E4F /* Protocol */ = { isa = PBXGroup; children = ( - 7E77DB0328BF9A6700E95D4B /* RoomProtocol.swift */, B5F31C5328BFA70100F61D0F /* LetterProtocol.swift */, 39EEF65528CB3BB200437654 /* LoginProtocol.swift */, D739C36228C7B69D00161117 /* SettingProtocol.swift */, @@ -625,6 +621,7 @@ children = ( B53A35BF2A96F21A00B720BC /* MainRepository.swift */, B53A35C32A96F50100B720BC /* DetailRoomRepository.swift */, + B53A35C52A96F6DB00B720BC /* RoomParticipationRepository.swift */, ); path = Repository; sourceTree = ""; @@ -1386,6 +1383,7 @@ B517C04E28D1FE660008BED0 /* TokenProtocol.swift in Sources */, 392EC7812855D17D006918A9 /* DetailWaitTitleView.swift in Sources */, 7E3058C82854B64D00489E6A /* InputCapacityView.swift in Sources */, + B53A35C62A96F6DB00B720BC /* RoomParticipationRepository.swift in Sources */, CBA15C94285CE1A80051EDE2 /* ChooseCharacterViewController.swift in Sources */, 39EEF65E28CB3CFE00437654 /* LoginEndPoint.swift in Sources */, 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */, @@ -1413,7 +1411,6 @@ CB21C33928C4C10200128D25 /* CharacterCollectionViewCell.swift in Sources */, 39EEF65A28CB3C7B00437654 /* Token.swift in Sources */, 39C95804287DAD3000A04A2B /* LetterEndPoint.swift in Sources */, - 7E77DB0828BF9D2400E95D4B /* RoomAPI.swift in Sources */, B50B1B44285B146A0080992C /* OpenManittoCollectionViewCell.swift in Sources */, B5F5253128545E4C00614FF7 /* BackButton.swift in Sources */, 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */, @@ -1454,7 +1451,6 @@ D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */, 391B3003286198C200421F1D /* Size.swift in Sources */, B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */, - 7E77DB0428BF9A6700E95D4B /* RoomProtocol.swift in Sources */, D739C36328C7B69D00161117 /* SettingProtocol.swift in Sources */, B5F525262851A26D00614FF7 /* NSObject+Extension.swift in Sources */, 39FFE32828EEFFFE008442EE /* MoreButton.swift in Sources */, diff --git a/Manito/Manito/Data/Network/API/RoomAPI.swift b/Manito/Manito/Data/Network/API/RoomAPI.swift deleted file mode 100644 index dd0a86ffb..000000000 --- a/Manito/Manito/Data/Network/API/RoomAPI.swift +++ /dev/null @@ -1,37 +0,0 @@ -// -// RoomAPI.swift -// Manito -// -// Created by LeeSungHo on 2022/08/31. -// - -import Foundation - -struct RoomAPI: RoomProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func postCreateRoom(body: CreateRoomDTO) async throws -> Int? { - let request = RoomEndPoint - .dispatchCreateRoom(roomInfo: body) - .createRequest() - return try await apiService.requestCreateRoom(request) - } - - func dispatchVerification(body: String) async throws -> VerificationCode? { - let request = RoomEndPoint - .fetchVerifyCode(code: body) - .createRequest() - return try await apiService.request(request) - } - - func dispatchJoinRoom(roodId: String, dto: MemberDTO) async throws -> Int { - let request = RoomEndPoint - .dispatchJoinRoom(roomId: roodId, roomDto: dto) - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Data/Network/EndPoint/RoomParticipationEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/RoomParticipationEndPoint.swift index 53e433ba2..34a175263 100644 --- a/Manito/Manito/Data/Network/EndPoint/RoomParticipationEndPoint.swift +++ b/Manito/Manito/Data/Network/EndPoint/RoomParticipationEndPoint.swift @@ -12,7 +12,7 @@ import MTNetwork enum RoomParticipationEndPoint { case dispatchCreateRoom(roomInfo: CreateRoomDTO) case dispatchVerifyCode(code: String) - case dispatchJoinRoom(roomId: String, roomDto: MemberDTO) + case dispatchJoinRoom(roomId: String, roomDTO: MemberDTO) } extension RoomParticipationEndPoint: Requestable { diff --git a/Manito/Manito/Data/Network/Protocol/RoomProtocol.swift b/Manito/Manito/Data/Network/Protocol/RoomProtocol.swift deleted file mode 100644 index 98eff699f..000000000 --- a/Manito/Manito/Data/Network/Protocol/RoomProtocol.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// RoomProtocol.swift -// Manito -// -// Created by LeeSungHo on 2022/08/31. -// - -import Foundation - -protocol RoomProtocol { - func postCreateRoom(body: CreateRoomDTO) async throws -> Int? - func dispatchVerification(body: String) async throws -> VerificationCode? - func dispatchJoinRoom(roodId: String, dto: MemberDTO) async throws -> Int -} diff --git a/Manito/Manito/Data/Repository/RoomParticipationRepository.swift b/Manito/Manito/Data/Repository/RoomParticipationRepository.swift new file mode 100644 index 000000000..be48a8119 --- /dev/null +++ b/Manito/Manito/Data/Repository/RoomParticipationRepository.swift @@ -0,0 +1,36 @@ +// +// RoomParticipationRepository.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +import MTNetwork + +protocol RoomParticipationRepository { + func dispatchCreateRoom(roomInfo: CreateRoomDTO) async throws -> Int? + func dispatchVerifyCode(code: String) async throws -> VerificationCode? + func dispatchJoinRoom(roomId: String, roomDTO: MemberDTO) async throws -> Int +} + +final class RoomParticipationRepositoryImpl: RoomParticipationRepository { + + private var provider = Provider() + + func dispatchCreateRoom(roomInfo: CreateRoomDTO) async throws -> Int? { + let response = try await self.provider.request(.dispatchCreateRoom(roomInfo: roomInfo)) + return try response.decode() + } + + func dispatchVerifyCode(code: String) async throws -> VerificationCode? { + let response = try await self.provider.request(.dispatchVerifyCode(code: code)) + return try response.decode() + } + + func dispatchJoinRoom(roomId: String, roomDTO: MemberDTO) async throws -> Int { + let response = try await self.provider.request(.dispatchJoinRoom(roomId: roomId, roomDTO: roomDTO)) + return try response.decode() + } +} From 11693ef9fbcbf5a5f519f2c072d1a403238253b6 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 11:34:50 +0900 Subject: [PATCH 338/468] =?UTF-8?q?[ADD]=20LetterRepository=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 12 ++---- .../Manito/Data/Network/API/LetterAPI.swift | 38 ------------------- .../Network/EndPoint/LetterEndPoint.swift | 8 ---- .../Network/Protocol/LetterProtocol.swift | 14 ------- .../Data/Repository/LetterRepository.swift | 36 ++++++++++++++++++ 5 files changed, 40 insertions(+), 68 deletions(-) delete mode 100644 Manito/Manito/Data/Network/API/LetterAPI.swift delete mode 100644 Manito/Manito/Data/Network/Protocol/LetterProtocol.swift create mode 100644 Manito/Manito/Data/Repository/LetterRepository.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 958cdf0c6..3d8e07a86 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -85,6 +85,7 @@ B53A35C02A96F21A00B720BC /* MainRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35BF2A96F21A00B720BC /* MainRepository.swift */; }; B53A35C42A96F50100B720BC /* DetailRoomRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35C32A96F50100B720BC /* DetailRoomRepository.swift */; }; B53A35C62A96F6DB00B720BC /* RoomParticipationRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35C52A96F6DB00B720BC /* RoomParticipationRepository.swift */; }; + B53A35C82A96F84700B720BC /* LetterRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35C72A96F84700B720BC /* LetterRepository.swift */; }; B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */; }; B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741E929A494E200B75BA3 /* LetterImageError.swift */; }; B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55BCEB328D8449E00AF7E45 /* MemoryCollectionViewCell.swift */; }; @@ -107,8 +108,6 @@ B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */; }; B5F31BB228BE1CD700F61D0F /* UserDefaultHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BB128BE1CD700F61D0F /* UserDefaultHandler.swift */; }; B5F31C5028BF922E00F61D0F /* LetterViewController+MailCompose.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31C4F28BF922E00F61D0F /* LetterViewController+MailCompose.swift */; }; - B5F31C5228BFA64F00F61D0F /* LetterAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31C5128BFA64F00F61D0F /* LetterAPI.swift */; }; - B5F31C5428BFA70100F61D0F /* LetterProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31C5328BFA70100F61D0F /* LetterProtocol.swift */; }; B5F524CF28519AA000614FF7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F524CE28519AA000614FF7 /* AppDelegate.swift */; }; B5F524D128519AA000614FF7 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F524D028519AA000614FF7 /* SceneDelegate.swift */; }; B5F524D628519AA000614FF7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B5F524D428519AA000614FF7 /* Main.storyboard */; }; @@ -275,6 +274,7 @@ B53A35BF2A96F21A00B720BC /* MainRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainRepository.swift; sourceTree = ""; }; B53A35C32A96F50100B720BC /* DetailRoomRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailRoomRepository.swift; sourceTree = ""; }; B53A35C52A96F6DB00B720BC /* RoomParticipationRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomParticipationRepository.swift; sourceTree = ""; }; + B53A35C72A96F84700B720BC /* LetterRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterRepository.swift; sourceTree = ""; }; B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Dev.xcconfig; sourceTree = ""; }; B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Prod.xcconfig; sourceTree = ""; }; B53AD41D2A8C88E100B83B33 /* GoogleService-Info-Dev.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Dev.plist"; sourceTree = ""; }; @@ -301,8 +301,6 @@ B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultStorage.swift; sourceTree = ""; }; B5F31BB128BE1CD700F61D0F /* UserDefaultHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultHandler.swift; sourceTree = ""; }; B5F31C4F28BF922E00F61D0F /* LetterViewController+MailCompose.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LetterViewController+MailCompose.swift"; sourceTree = ""; }; - B5F31C5128BFA64F00F61D0F /* LetterAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterAPI.swift; sourceTree = ""; }; - B5F31C5328BFA70100F61D0F /* LetterProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterProtocol.swift; sourceTree = ""; }; B5F524CB28519AA000614FF7 /* Manito.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Manito.app; sourceTree = BUILT_PRODUCTS_DIR; }; B5F524CE28519AA000614FF7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; B5F524D028519AA000614FF7 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -436,7 +434,6 @@ 397A241128BA513E00454E4F /* API */ = { isa = PBXGroup; children = ( - B5F31C5128BFA64F00F61D0F /* LetterAPI.swift */, 39EEF65B28CB3CD600437654 /* LoginAPI.swift */, D739C36428C7B75400161117 /* SettingAPI.swift */, B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */, @@ -447,7 +444,6 @@ 397A241528BA519200454E4F /* Protocol */ = { isa = PBXGroup; children = ( - B5F31C5328BFA70100F61D0F /* LetterProtocol.swift */, 39EEF65528CB3BB200437654 /* LoginProtocol.swift */, D739C36228C7B69D00161117 /* SettingProtocol.swift */, B517C04D28D1FE660008BED0 /* TokenProtocol.swift */, @@ -622,6 +618,7 @@ B53A35BF2A96F21A00B720BC /* MainRepository.swift */, B53A35C32A96F50100B720BC /* DetailRoomRepository.swift */, B53A35C52A96F6DB00B720BC /* RoomParticipationRepository.swift */, + B53A35C72A96F84700B720BC /* LetterRepository.swift */, ); path = Repository; sourceTree = ""; @@ -1398,6 +1395,7 @@ 39F1C12E28D756E600585B83 /* LetterImageViewController.swift in Sources */, 7E7542B32923744300D725CB /* ToastPopupView.swift in Sources */, 39C957D22879523200A04A2B /* Date+Extension.swift in Sources */, + B53A35C82A96F84700B720BC /* LetterRepository.swift in Sources */, 39EE956F2A404A3800AF6857 /* MissionEditViewController.swift in Sources */, B5F5250A2851A06700614FF7 /* DetailWaitViewController.swift in Sources */, D7C4A1AB2A0D1AA400C3AE4C /* ParticipateRoomView.swift in Sources */, @@ -1447,7 +1445,6 @@ B5F524D128519AA000614FF7 /* SceneDelegate.swift in Sources */, CB637A3B28595C1200FF1240 /* ParticipateRoomViewController.swift in Sources */, B5F524FF28519EF300614FF7 /* UIFont+Extension.swift in Sources */, - B5F31C5228BFA64F00F61D0F /* LetterAPI.swift in Sources */, D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */, 391B3003286198C200421F1D /* Size.swift in Sources */, B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */, @@ -1462,7 +1459,6 @@ B50B1AF92856B2C60080992C /* CreateLetterViewController.swift in Sources */, B5F31C5028BF922E00F61D0F /* LetterViewController+MailCompose.swift in Sources */, 7E3058CA2854B7A900489E6A /* InputDateView.swift in Sources */, - B5F31C5428BFA70100F61D0F /* LetterProtocol.swift in Sources */, D7B6C97C2858B2D40024F326 /* CheckRoomInfoView.swift in Sources */, B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */, B5F31BB228BE1CD700F61D0F /* UserDefaultHandler.swift in Sources */, diff --git a/Manito/Manito/Data/Network/API/LetterAPI.swift b/Manito/Manito/Data/Network/API/LetterAPI.swift deleted file mode 100644 index 280b23140..000000000 --- a/Manito/Manito/Data/Network/API/LetterAPI.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// LetterAPI.swift -// Manito -// -// Created by SHIN YOON AH on 2022/08/31. -// - -import Foundation - -struct LetterAPI: LetterProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func fetchSendLetter(roomId: String) async throws -> Letter? { - let request = LetterEndPoint - .fetchSendLetter(roomId: roomId) - .createRequest() - return try await self.apiService.request(request) - } - - func fetchReceiveLetter(roomId: String) async throws -> Letter? { - let request = LetterEndPoint - .fetchReceiveLetter(roomId: roomId) - .createRequest() - return try await self.apiService.request(request) - } - - @discardableResult - func dispatchLetter(roomId: String, image: Data? = nil, letter: LetterDTO, missionId: String) async throws -> Int { - let request = LetterEndPoint - .dispatchLetter(roomId: roomId, image: image, letter: letter, missionId: missionId) - .createRequest() - return try await self.apiService.request(request) - } -} diff --git a/Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift index 9e67859f9..5476d2b22 100644 --- a/Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift +++ b/Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift @@ -13,7 +13,6 @@ enum LetterEndPoint { case dispatchLetter(roomId: String, image: Data?, letter: LetterDTO, missionId: String) case fetchSendLetter(roomId: String) case fetchReceiveLetter(roomId: String) - case patchReadMessage(roomId: String, status: String) } extension LetterEndPoint: Requestable { @@ -29,8 +28,6 @@ extension LetterEndPoint: Requestable { return "/v2/rooms/\(roomId)/messages-sent" case .fetchReceiveLetter(let roomId): return "/v2/rooms/\(roomId)/messages-received" - case .patchReadMessage(let roomId, _): - return "/v1/rooms/\(roomId)/messages/status" } } @@ -42,8 +39,6 @@ extension LetterEndPoint: Requestable { return .get case .fetchReceiveLetter: return .get - case .patchReadMessage: - return .patch } } @@ -68,9 +63,6 @@ extension LetterEndPoint: Requestable { return .requestPlain case .fetchReceiveLetter: return .requestPlain - case .patchReadMessage(_, let status): - let body = ["status": status] - return .requestJSONEncodable(body) } } diff --git a/Manito/Manito/Data/Network/Protocol/LetterProtocol.swift b/Manito/Manito/Data/Network/Protocol/LetterProtocol.swift deleted file mode 100644 index 6bf6cc223..000000000 --- a/Manito/Manito/Data/Network/Protocol/LetterProtocol.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// LetterProtocol.swift -// Manito -// -// Created by SHIN YOON AH on 2022/08/31. -// - -import Foundation - -protocol LetterProtocol { - func fetchSendLetter(roomId: String) async throws -> Letter? - func fetchReceiveLetter(roomId: String) async throws -> Letter? - func dispatchLetter(roomId: String, image: Data?, letter: LetterDTO, missionId: String) async throws -> Int -} diff --git a/Manito/Manito/Data/Repository/LetterRepository.swift b/Manito/Manito/Data/Repository/LetterRepository.swift new file mode 100644 index 000000000..f1a7d104c --- /dev/null +++ b/Manito/Manito/Data/Repository/LetterRepository.swift @@ -0,0 +1,36 @@ +// +// LetterRepository.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +import MTNetwork + +protocol LetterRepository { + func dispatchLetter(roomId: String, image: Data?, letter: LetterDTO, missionId: String) async throws -> Int + func fetchSendLetter(roomId: String) async throws -> Letter? + func fetchReceiveLetter(roomId: String) async throws -> Letter? +} + +final class LetterRepositoryImpl: LetterRepository { + + private var provider = Provider() + + func dispatchLetter(roomId: String, image: Data?, letter: LetterDTO, missionId: String) async throws -> Int { + let response = try await self.provider.request(.dispatchLetter(roomId: roomId, image: image, letter: letter, missionId: missionId)) + return try response.decode() + } + + func fetchSendLetter(roomId: String) async throws -> Letter? { + let response = try await self.provider.request(.fetchSendLetter(roomId: roomId)) + return try response.decode() + } + + func fetchReceiveLetter(roomId: String) async throws -> Letter? { + let response = try await self.provider.request(.fetchReceiveLetter(roomId: roomId)) + return try response.decode() + } +} From 12b96311f018ee47ae50898b27563ddfb86ebace Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 11:39:36 +0900 Subject: [PATCH 339/468] =?UTF-8?q?[ADD]=20SettingRepository=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 12 ++++------ .../Manito/Data/Network/API/SettingAPI.swift | 23 ------------------ .../Network/EndPoint/SettingEndPoint.swift | 6 ++--- .../Network/Protocol/SettingProtocol.swift | 12 ---------- .../Data/Repository/SettingRepository.swift | 24 +++++++++++++++++++ 5 files changed, 31 insertions(+), 46 deletions(-) delete mode 100644 Manito/Manito/Data/Network/API/SettingAPI.swift delete mode 100644 Manito/Manito/Data/Network/Protocol/SettingProtocol.swift create mode 100644 Manito/Manito/Data/Repository/SettingRepository.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 3d8e07a86..fc2fec49c 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -86,6 +86,7 @@ B53A35C42A96F50100B720BC /* DetailRoomRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35C32A96F50100B720BC /* DetailRoomRepository.swift */; }; B53A35C62A96F6DB00B720BC /* RoomParticipationRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35C52A96F6DB00B720BC /* RoomParticipationRepository.swift */; }; B53A35C82A96F84700B720BC /* LetterRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35C72A96F84700B720BC /* LetterRepository.swift */; }; + B53A35CC2A96F99D00B720BC /* SettingRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35CB2A96F99D00B720BC /* SettingRepository.swift */; }; B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */; }; B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741E929A494E200B75BA3 /* LetterImageError.swift */; }; B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55BCEB328D8449E00AF7E45 /* MemoryCollectionViewCell.swift */; }; @@ -162,8 +163,6 @@ D70220232A7A22EC0024BACD /* CreateRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D70220222A7A22EC0024BACD /* CreateRoomView.swift */; }; D724AF5D287088310003F280 /* SettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5C287088310003F280 /* SettingViewController.swift */; }; D724AF5F28708D830003F280 /* ImageRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5E28708D830003F280 /* ImageRowView.swift */; }; - D739C36328C7B69D00161117 /* SettingProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D739C36228C7B69D00161117 /* SettingProtocol.swift */; }; - D739C36528C7B75400161117 /* SettingAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = D739C36428C7B75400161117 /* SettingAPI.swift */; }; D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = D739C36628C7B82500161117 /* NicknameDTO.swift */; }; D75E8C7F28D76FFB004A6C41 /* LetterCountBadgeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D75E8C7E28D76FFB004A6C41 /* LetterCountBadgeView.swift */; }; D77224DF285DDAB7008B760B /* Notification+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D77224DE285DDAB7008B760B /* Notification+Extension.swift */; }; @@ -275,6 +274,7 @@ B53A35C32A96F50100B720BC /* DetailRoomRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailRoomRepository.swift; sourceTree = ""; }; B53A35C52A96F6DB00B720BC /* RoomParticipationRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomParticipationRepository.swift; sourceTree = ""; }; B53A35C72A96F84700B720BC /* LetterRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterRepository.swift; sourceTree = ""; }; + B53A35CB2A96F99D00B720BC /* SettingRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingRepository.swift; sourceTree = ""; }; B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Dev.xcconfig; sourceTree = ""; }; B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Prod.xcconfig; sourceTree = ""; }; B53AD41D2A8C88E100B83B33 /* GoogleService-Info-Dev.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Dev.plist"; sourceTree = ""; }; @@ -356,8 +356,6 @@ D70220222A7A22EC0024BACD /* CreateRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomView.swift; sourceTree = ""; }; D724AF5C287088310003F280 /* SettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewController.swift; sourceTree = ""; }; D724AF5E28708D830003F280 /* ImageRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageRowView.swift; sourceTree = ""; }; - D739C36228C7B69D00161117 /* SettingProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingProtocol.swift; sourceTree = ""; }; - D739C36428C7B75400161117 /* SettingAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingAPI.swift; sourceTree = ""; }; D739C36628C7B82500161117 /* NicknameDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameDTO.swift; sourceTree = ""; }; D75E8C7E28D76FFB004A6C41 /* LetterCountBadgeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterCountBadgeView.swift; sourceTree = ""; }; D77224DE285DDAB7008B760B /* Notification+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Notification+Extension.swift"; sourceTree = ""; }; @@ -435,7 +433,6 @@ isa = PBXGroup; children = ( 39EEF65B28CB3CD600437654 /* LoginAPI.swift */, - D739C36428C7B75400161117 /* SettingAPI.swift */, B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */, ); path = API; @@ -445,7 +442,6 @@ isa = PBXGroup; children = ( 39EEF65528CB3BB200437654 /* LoginProtocol.swift */, - D739C36228C7B69D00161117 /* SettingProtocol.swift */, B517C04D28D1FE660008BED0 /* TokenProtocol.swift */, ); path = Protocol; @@ -619,6 +615,7 @@ B53A35C32A96F50100B720BC /* DetailRoomRepository.swift */, B53A35C52A96F6DB00B720BC /* RoomParticipationRepository.swift */, B53A35C72A96F84700B720BC /* LetterRepository.swift */, + B53A35CB2A96F99D00B720BC /* SettingRepository.swift */, ); path = Repository; sourceTree = ""; @@ -1430,6 +1427,7 @@ 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */, B5F5251E2851A1C700614FF7 /* BaseTableViewCell.swift in Sources */, 39BDDCC42A52BB4A005E0A71 /* DetailWaitService.swift in Sources */, + B53A35CC2A96F99D00B720BC /* SettingRepository.swift in Sources */, B50CEEC02A6FF82600CF1C76 /* Publisher+Extension.swift in Sources */, 39EEF65C28CB3CD600437654 /* LoginAPI.swift in Sources */, B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */, @@ -1439,7 +1437,6 @@ B5AE11F029D1E43B00F86FF8 /* OpenManittoView.swift in Sources */, CB85DE1F28A76F3400399109 /* SettingDeveloperInfoHeaderView.swift in Sources */, B5706BF429B710FC0093D198 /* LetterView.swift in Sources */, - D739C36528C7B75400161117 /* SettingAPI.swift in Sources */, B5F525062851A05500614FF7 /* CreateRoomViewController.swift in Sources */, B517C04C28D1FE5F0008BED0 /* TokenAPI.swift in Sources */, B5F524D128519AA000614FF7 /* SceneDelegate.swift in Sources */, @@ -1448,7 +1445,6 @@ D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */, 391B3003286198C200421F1D /* Size.swift in Sources */, B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */, - D739C36328C7B69D00161117 /* SettingProtocol.swift in Sources */, B5F525262851A26D00614FF7 /* NSObject+Extension.swift in Sources */, 39FFE32828EEFFFE008442EE /* MoreButton.swift in Sources */, B5706BE129ADC20A0093D198 /* CreateLetterView.swift in Sources */, diff --git a/Manito/Manito/Data/Network/API/SettingAPI.swift b/Manito/Manito/Data/Network/API/SettingAPI.swift deleted file mode 100644 index 5ca294455..000000000 --- a/Manito/Manito/Data/Network/API/SettingAPI.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// SettingAPI.swift -// Manito -// -// Created by 이성호 on 2022/09/07. -// - -import Foundation - -struct SettingAPI: SettingProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func putChangeNickname(body: NicknameDTO) async throws -> String? { - let request = SettingEndPoint - .editUserInfo(nickNameDto: body) - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Data/Network/EndPoint/SettingEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/SettingEndPoint.swift index 00526b658..369958fa7 100644 --- a/Manito/Manito/Data/Network/EndPoint/SettingEndPoint.swift +++ b/Manito/Manito/Data/Network/EndPoint/SettingEndPoint.swift @@ -10,7 +10,7 @@ import Foundation import MTNetwork enum SettingEndPoint { - case putUserInfo(nicknameDTO: NicknameDTO) + case putUserInfo(nickname: NicknameDTO) } extension SettingEndPoint: Requestable { @@ -34,8 +34,8 @@ extension SettingEndPoint: Requestable { var task: HTTPTask { switch self { - case .putUserInfo(let nicknameDTO): - return .requestJSONEncodable(nicknameDTO) + case .putUserInfo(let nickname): + return .requestJSONEncodable(nickname) } } diff --git a/Manito/Manito/Data/Network/Protocol/SettingProtocol.swift b/Manito/Manito/Data/Network/Protocol/SettingProtocol.swift deleted file mode 100644 index 0270e5b7d..000000000 --- a/Manito/Manito/Data/Network/Protocol/SettingProtocol.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// SettingProtocol.swift -// Manito -// -// Created by 이성호 on 2022/09/07. -// - -import Foundation - -protocol SettingProtocol { - func putChangeNickname(body: NicknameDTO) async throws -> String? -} diff --git a/Manito/Manito/Data/Repository/SettingRepository.swift b/Manito/Manito/Data/Repository/SettingRepository.swift new file mode 100644 index 000000000..60da78cab --- /dev/null +++ b/Manito/Manito/Data/Repository/SettingRepository.swift @@ -0,0 +1,24 @@ +// +// SettingRepository.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +import MTNetwork + +protocol SettingRepository { + func putUserInfo(nickname: NicknameDTO) async throws -> String? +} + +final class SettingRepositoryImpl: SettingRepository { + + private var provider = Provider() + + func putUserInfo(nickname: NicknameDTO) async throws -> String? { + let response = try await self.provider.request(.putUserInfo(nickname: nickname)) + return try response.decode() + } +} From 60b40a1ff6453cda5540b6b64b83a081e734f56e Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 11:42:33 +0900 Subject: [PATCH 340/468] =?UTF-8?q?[ADD]=20LoginRepository=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 12 ++++------ Manito/Manito/Data/Network/API/LoginAPI.swift | 23 ------------------ .../Data/Network/Protocol/LoginProtocol.swift | 12 ---------- .../Data/Repository/LoginRepository.swift | 24 +++++++++++++++++++ 4 files changed, 28 insertions(+), 43 deletions(-) delete mode 100644 Manito/Manito/Data/Network/API/LoginAPI.swift delete mode 100644 Manito/Manito/Data/Network/Protocol/LoginProtocol.swift create mode 100644 Manito/Manito/Data/Repository/LoginRepository.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index fc2fec49c..fc93f2721 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -44,10 +44,8 @@ 39E099AD287FC020004F464E /* LetterDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39E099AC287FC020004F464E /* LetterDTO.swift */; }; 39EE956D2A401ED400AF6857 /* DetailingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EE956C2A401ED400AF6857 /* DetailingView.swift */; }; 39EE956F2A404A3800AF6857 /* MissionEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EE956E2A404A3800AF6857 /* MissionEditViewController.swift */; }; - 39EEF65628CB3BB200437654 /* LoginProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65528CB3BB200437654 /* LoginProtocol.swift */; }; 39EEF65828CB3C1100437654 /* Login.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65728CB3C1100437654 /* Login.swift */; }; 39EEF65A28CB3C7B00437654 /* Token.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65928CB3C7B00437654 /* Token.swift */; }; - 39EEF65C28CB3CD600437654 /* LoginAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65B28CB3CD600437654 /* LoginAPI.swift */; }; 39EEF65E28CB3CFE00437654 /* LoginEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65D28CB3CFE00437654 /* LoginEndPoint.swift */; }; 39EEF66028CB3D6200437654 /* LoginDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65F28CB3D6200437654 /* LoginDTO.swift */; }; 39F1C12E28D756E600585B83 /* LetterImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39F1C12D28D756E600585B83 /* LetterImageViewController.swift */; }; @@ -87,6 +85,7 @@ B53A35C62A96F6DB00B720BC /* RoomParticipationRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35C52A96F6DB00B720BC /* RoomParticipationRepository.swift */; }; B53A35C82A96F84700B720BC /* LetterRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35C72A96F84700B720BC /* LetterRepository.swift */; }; B53A35CC2A96F99D00B720BC /* SettingRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35CB2A96F99D00B720BC /* SettingRepository.swift */; }; + B53A35CE2A96FA7A00B720BC /* LoginRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35CD2A96FA7A00B720BC /* LoginRepository.swift */; }; B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */; }; B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741E929A494E200B75BA3 /* LetterImageError.swift */; }; B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55BCEB328D8449E00AF7E45 /* MemoryCollectionViewCell.swift */; }; @@ -236,10 +235,8 @@ 39E6321328BDE59C00CFC6C4 /* Manito.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Manito.entitlements; sourceTree = ""; }; 39EE956C2A401ED400AF6857 /* DetailingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailingView.swift; sourceTree = ""; }; 39EE956E2A404A3800AF6857 /* MissionEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionEditViewController.swift; sourceTree = ""; }; - 39EEF65528CB3BB200437654 /* LoginProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginProtocol.swift; sourceTree = ""; }; 39EEF65728CB3C1100437654 /* Login.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Login.swift; sourceTree = ""; }; 39EEF65928CB3C7B00437654 /* Token.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Token.swift; sourceTree = ""; }; - 39EEF65B28CB3CD600437654 /* LoginAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginAPI.swift; sourceTree = ""; }; 39EEF65D28CB3CFE00437654 /* LoginEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginEndPoint.swift; sourceTree = ""; }; 39EEF65F28CB3D6200437654 /* LoginDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginDTO.swift; sourceTree = ""; }; 39F1C12D28D756E600585B83 /* LetterImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterImageViewController.swift; sourceTree = ""; }; @@ -275,6 +272,7 @@ B53A35C52A96F6DB00B720BC /* RoomParticipationRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomParticipationRepository.swift; sourceTree = ""; }; B53A35C72A96F84700B720BC /* LetterRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterRepository.swift; sourceTree = ""; }; B53A35CB2A96F99D00B720BC /* SettingRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingRepository.swift; sourceTree = ""; }; + B53A35CD2A96FA7A00B720BC /* LoginRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginRepository.swift; sourceTree = ""; }; B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Dev.xcconfig; sourceTree = ""; }; B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Prod.xcconfig; sourceTree = ""; }; B53AD41D2A8C88E100B83B33 /* GoogleService-Info-Dev.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Dev.plist"; sourceTree = ""; }; @@ -432,7 +430,6 @@ 397A241128BA513E00454E4F /* API */ = { isa = PBXGroup; children = ( - 39EEF65B28CB3CD600437654 /* LoginAPI.swift */, B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */, ); path = API; @@ -441,7 +438,6 @@ 397A241528BA519200454E4F /* Protocol */ = { isa = PBXGroup; children = ( - 39EEF65528CB3BB200437654 /* LoginProtocol.swift */, B517C04D28D1FE660008BED0 /* TokenProtocol.swift */, ); path = Protocol; @@ -616,6 +612,7 @@ B53A35C52A96F6DB00B720BC /* RoomParticipationRepository.swift */, B53A35C72A96F84700B720BC /* LetterRepository.swift */, B53A35CB2A96F99D00B720BC /* SettingRepository.swift */, + B53A35CD2A96FA7A00B720BC /* LoginRepository.swift */, ); path = Repository; sourceTree = ""; @@ -1382,7 +1379,6 @@ 39EEF65E28CB3CFE00437654 /* LoginEndPoint.swift in Sources */, 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */, CB674C2128596A310063A6B7 /* CheckRoomViewController.swift in Sources */, - 39EEF65628CB3BB200437654 /* LoginProtocol.swift in Sources */, 39C9580A287DC03500A04A2B /* Encodable+Extension.swift in Sources */, B50B1AFB2856B5180080992C /* IndividualMissionView.swift in Sources */, B5F525492855D01D00614FF7 /* Letter.swift in Sources */, @@ -1403,6 +1399,7 @@ B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */, B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */, B5F525422855C97900614FF7 /* UILabel+Extension.swift in Sources */, + B53A35CE2A96FA7A00B720BC /* LoginRepository.swift in Sources */, CB21C33928C4C10200128D25 /* CharacterCollectionViewCell.swift in Sources */, 39EEF65A28CB3C7B00437654 /* Token.swift in Sources */, 39C95804287DAD3000A04A2B /* LetterEndPoint.swift in Sources */, @@ -1429,7 +1426,6 @@ 39BDDCC42A52BB4A005E0A71 /* DetailWaitService.swift in Sources */, B53A35CC2A96F99D00B720BC /* SettingRepository.swift in Sources */, B50CEEC02A6FF82600CF1C76 /* Publisher+Extension.swift in Sources */, - 39EEF65C28CB3CD600437654 /* LoginAPI.swift in Sources */, B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */, B53A35C02A96F21A00B720BC /* MainRepository.swift in Sources */, D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */, diff --git a/Manito/Manito/Data/Network/API/LoginAPI.swift b/Manito/Manito/Data/Network/API/LoginAPI.swift deleted file mode 100644 index b323e9c25..000000000 --- a/Manito/Manito/Data/Network/API/LoginAPI.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// LoginAPI.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/09. -// - -import Foundation - -struct LoginAPI: LoginProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func dispatchAppleLogin(dto: LoginDTO) async throws -> Login? { - let request = LoginEndPoint - .dispatchAppleLogin(body: dto) - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Data/Network/Protocol/LoginProtocol.swift b/Manito/Manito/Data/Network/Protocol/LoginProtocol.swift deleted file mode 100644 index 6f4e4b048..000000000 --- a/Manito/Manito/Data/Network/Protocol/LoginProtocol.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// LoginProtocol.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/09. -// - -import Foundation - -protocol LoginProtocol { - func dispatchAppleLogin(dto: LoginDTO) async throws -> Login? -} diff --git a/Manito/Manito/Data/Repository/LoginRepository.swift b/Manito/Manito/Data/Repository/LoginRepository.swift new file mode 100644 index 000000000..ac659b15e --- /dev/null +++ b/Manito/Manito/Data/Repository/LoginRepository.swift @@ -0,0 +1,24 @@ +// +// LoginRepository.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +import MTNetwork + +protocol LoginRepository { + func dispatchAppleLogin(loginDTO: LoginDTO) async throws -> Login? +} + +final class LoginRepositoryImpl: LoginRepository { + + private var provider = Provider() + + func dispatchAppleLogin(loginDTO: LoginDTO) async throws -> Login? { + let response = try await self.provider.request(.dispatchAppleLogin(loginDTO: loginDTO)) + return try response.decode() + } +} From 2a674cf40575d0f9649deb548fd38879f6903f36 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 13:57:29 +0900 Subject: [PATCH 341/468] =?UTF-8?q?[ADD]=20TokenRepository=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 28 +++---------------- Manito/Manito/Data/Network/API/TokenAPI.swift | 23 --------------- .../Data/Network/EndPoint/TokenEndPoint.swift | 10 +++---- .../Data/Network/Protocol/TokenProtocol.swift | 12 -------- .../Data/Repository/TokenRepository.swift | 24 ++++++++++++++++ 5 files changed, 33 insertions(+), 64 deletions(-) delete mode 100644 Manito/Manito/Data/Network/API/TokenAPI.swift delete mode 100644 Manito/Manito/Data/Network/Protocol/TokenProtocol.swift create mode 100644 Manito/Manito/Data/Repository/TokenRepository.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index fc93f2721..ba5c5bbbe 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -76,8 +76,6 @@ B50CEE912A445EB700CF1C76 /* UIScrollView+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */; }; B50CEEC02A6FF82600CF1C76 /* Publisher+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50CEEBF2A6FF82600CF1C76 /* Publisher+Extension.swift */; }; B517C04A28D1F7EC0008BED0 /* TokenEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */; }; - B517C04C28D1FE5F0008BED0 /* TokenAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */; }; - B517C04E28D1FE660008BED0 /* TokenProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04D28D1FE660008BED0 /* TokenProtocol.swift */; }; B53A35AD2A962E9C00B720BC /* MTNetwork in Frameworks */ = {isa = PBXBuildFile; productRef = B53A35AC2A962E9C00B720BC /* MTNetwork */; }; B53A35B72A963F2100B720BC /* DetailRoomEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35B62A963F2100B720BC /* DetailRoomEndPoint.swift */; }; B53A35C02A96F21A00B720BC /* MainRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35BF2A96F21A00B720BC /* MainRepository.swift */; }; @@ -86,6 +84,7 @@ B53A35C82A96F84700B720BC /* LetterRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35C72A96F84700B720BC /* LetterRepository.swift */; }; B53A35CC2A96F99D00B720BC /* SettingRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35CB2A96F99D00B720BC /* SettingRepository.swift */; }; B53A35CE2A96FA7A00B720BC /* LoginRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35CD2A96FA7A00B720BC /* LoginRepository.swift */; }; + B53A35D02A97194D00B720BC /* TokenRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35CF2A97194D00B720BC /* TokenRepository.swift */; }; B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */; }; B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741E929A494E200B75BA3 /* LetterImageError.swift */; }; B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55BCEB328D8449E00AF7E45 /* MemoryCollectionViewCell.swift */; }; @@ -264,8 +263,6 @@ B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIScrollView+Combine.swift"; sourceTree = ""; }; B50CEEBF2A6FF82600CF1C76 /* Publisher+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Publisher+Extension.swift"; sourceTree = ""; }; B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenEndPoint.swift; sourceTree = ""; }; - B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenAPI.swift; sourceTree = ""; }; - B517C04D28D1FE660008BED0 /* TokenProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenProtocol.swift; sourceTree = ""; }; B53A35B62A963F2100B720BC /* DetailRoomEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailRoomEndPoint.swift; sourceTree = ""; }; B53A35BF2A96F21A00B720BC /* MainRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainRepository.swift; sourceTree = ""; }; B53A35C32A96F50100B720BC /* DetailRoomRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailRoomRepository.swift; sourceTree = ""; }; @@ -273,6 +270,7 @@ B53A35C72A96F84700B720BC /* LetterRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterRepository.swift; sourceTree = ""; }; B53A35CB2A96F99D00B720BC /* SettingRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingRepository.swift; sourceTree = ""; }; B53A35CD2A96FA7A00B720BC /* LoginRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginRepository.swift; sourceTree = ""; }; + B53A35CF2A97194D00B720BC /* TokenRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenRepository.swift; sourceTree = ""; }; B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Dev.xcconfig; sourceTree = ""; }; B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Prod.xcconfig; sourceTree = ""; }; B53AD41D2A8C88E100B83B33 /* GoogleService-Info-Dev.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Dev.plist"; sourceTree = ""; }; @@ -427,22 +425,6 @@ path = ViewModel; sourceTree = ""; }; - 397A241128BA513E00454E4F /* API */ = { - isa = PBXGroup; - children = ( - B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */, - ); - path = API; - sourceTree = ""; - }; - 397A241528BA519200454E4F /* Protocol */ = { - isa = PBXGroup; - children = ( - B517C04D28D1FE660008BED0 /* TokenProtocol.swift */, - ); - path = Protocol; - sourceTree = ""; - }; 398B1CBA2A12415C00DEFCEC /* ManitoTests */ = { isa = PBXGroup; children = ( @@ -613,6 +595,7 @@ B53A35C72A96F84700B720BC /* LetterRepository.swift */, B53A35CB2A96F99D00B720BC /* SettingRepository.swift */, B53A35CD2A96FA7A00B720BC /* LoginRepository.swift */, + B53A35CF2A97194D00B720BC /* TokenRepository.swift */, ); path = Repository; sourceTree = ""; @@ -1013,8 +996,6 @@ children = ( 39C957D328799A8200A04A2B /* Foundation */, 39C957EA287AE45900A04A2B /* EndPoint */, - 397A241528BA519200454E4F /* Protocol */, - 397A241128BA513E00454E4F /* API */, B5F525472855D01200614FF7 /* Models */, ); path = Network; @@ -1371,7 +1352,6 @@ 397A241A28BA532A00454E4F /* FriendList.swift in Sources */, 397A241028BA494100454E4F /* APIEnvironment.swift in Sources */, CBBFF77C287AE491006A5964 /* DeveloperInfoViewCell.swift in Sources */, - B517C04E28D1FE660008BED0 /* TokenProtocol.swift in Sources */, 392EC7812855D17D006918A9 /* DetailWaitTitleView.swift in Sources */, 7E3058C82854B64D00489E6A /* InputCapacityView.swift in Sources */, B53A35C62A96F6DB00B720BC /* RoomParticipationRepository.swift in Sources */, @@ -1434,7 +1414,6 @@ CB85DE1F28A76F3400399109 /* SettingDeveloperInfoHeaderView.swift in Sources */, B5706BF429B710FC0093D198 /* LetterView.swift in Sources */, B5F525062851A05500614FF7 /* CreateRoomViewController.swift in Sources */, - B517C04C28D1FE5F0008BED0 /* TokenAPI.swift in Sources */, B5F524D128519AA000614FF7 /* SceneDelegate.swift in Sources */, CB637A3B28595C1200FF1240 /* ParticipateRoomViewController.swift in Sources */, B5F524FF28519EF300614FF7 /* UIFont+Extension.swift in Sources */, @@ -1473,6 +1452,7 @@ 398B1C9B29F10B0300DEFCEC /* DetailEditView.swift in Sources */, B50B1AFD2856C3500080992C /* CreateLetterTextView.swift in Sources */, D77224DF285DDAB7008B760B /* Notification+Extension.swift in Sources */, + B53A35D02A97194D00B720BC /* TokenRepository.swift in Sources */, B5706BF629B9D4650093D198 /* GuideView.swift in Sources */, B50B1B41285B048A0080992C /* OpenManittoViewController.swift in Sources */, CB5AE3E6285AB76800382EA3 /* PeopleInfoView.swift in Sources */, diff --git a/Manito/Manito/Data/Network/API/TokenAPI.swift b/Manito/Manito/Data/Network/API/TokenAPI.swift deleted file mode 100644 index 60a8b6df1..000000000 --- a/Manito/Manito/Data/Network/API/TokenAPI.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// TokenAPI.swift -// Manito -// -// Created by SHIN YOON AH on 2022/09/14. -// - -import Foundation - -struct TokenAPI: TokenProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func patchRefreshToken(dto: Token) async throws -> Token? { - let request = TokenEndPoint - .patchRefreshToken(body: dto) - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift index ed5fbccbc..b54868227 100644 --- a/Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift +++ b/Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift @@ -10,7 +10,7 @@ import Foundation import MTNetwork enum TokenEndPoint { - case patchRefreshToken(body: Token) + case patchRefreshToken(token: Token) } extension TokenEndPoint: Requestable { @@ -34,10 +34,10 @@ extension TokenEndPoint: Requestable { var task: HTTPTask { switch self { - case .patchRefreshToken(let body): - let body = ["accessToken": body.accessToken, - "refreshToken": body.refreshToken] - return .requestJSONEncodable(body) + case .patchRefreshToken(let token): + let token = ["accessToken": token.accessToken, + "refreshToken": token.refreshToken] + return .requestJSONEncodable(token) } } diff --git a/Manito/Manito/Data/Network/Protocol/TokenProtocol.swift b/Manito/Manito/Data/Network/Protocol/TokenProtocol.swift deleted file mode 100644 index 87066106c..000000000 --- a/Manito/Manito/Data/Network/Protocol/TokenProtocol.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// TokenProtocol.swift -// Manito -// -// Created by SHIN YOON AH on 2022/09/14. -// - -import Foundation - -protocol TokenProtocol { - func patchRefreshToken(dto: Token) async throws -> Token? -} diff --git a/Manito/Manito/Data/Repository/TokenRepository.swift b/Manito/Manito/Data/Repository/TokenRepository.swift new file mode 100644 index 000000000..7b50c001b --- /dev/null +++ b/Manito/Manito/Data/Repository/TokenRepository.swift @@ -0,0 +1,24 @@ +// +// TokenRepository.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +import MTNetwork + +protocol TokenRepository { + func patchRefreshToken(token: Token) async throws -> Token? +} + +final class TokenRepositoryImpl: TokenRepository { + + private var provider = Provider() + + func patchRefreshToken(token: Token) async throws -> Token? { + let response = try await self.provider.request(.patchRefreshToken(token: token)) + return try response.decode() + } +} From 2a2562aa62eda44c3ae5bb0990cee031cfe5afa8 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 13:59:46 +0900 Subject: [PATCH 342/468] =?UTF-8?q?[CHORE]=20Repository=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EB=B0=B0=EC=97=B4=20=EC=88=98=EC=A0=95(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repository/DetailRoomRepository.swift | 29 +++++++++++++------ .../Data/Repository/LetterRepository.swift | 12 ++++++-- .../Data/Repository/LoginRepository.swift | 3 +- .../Data/Repository/MainRepository.swift | 6 ++-- .../RoomParticipationRepository.swift | 10 +++++-- .../Data/Repository/SettingRepository.swift | 3 +- .../Data/Repository/TokenRepository.swift | 3 +- 7 files changed, 46 insertions(+), 20 deletions(-) diff --git a/Manito/Manito/Data/Repository/DetailRoomRepository.swift b/Manito/Manito/Data/Repository/DetailRoomRepository.swift index 9f7533eb1..53dd7f3a0 100644 --- a/Manito/Manito/Data/Repository/DetailRoomRepository.swift +++ b/Manito/Manito/Data/Repository/DetailRoomRepository.swift @@ -26,47 +26,58 @@ final class DetailRoomRepositoryImpl: DetailRoomRepository { private var provider = Provider() func fetchWithFriend(roomId: String) async throws -> FriendList? { - let response = try await self.provider.request(.fetchWithFriend(roomId: roomId)) + let response = try await self.provider + .request(.fetchWithFriend(roomId: roomId)) return try response.decode() } func fetchRoomInfo(roomId: String) async throws -> Room? { - let response = try await self.provider.request(.fetchRoomInfo(roomId: roomId)) + let response = try await self.provider + .request(.fetchRoomInfo(roomId: roomId)) return try response.decode() } func fetchResetMission(roomId: String) async throws -> MissionDTO? { - let response = try await self.provider.request(.fetchResetMission(roomId: roomId)) + let response = try await self.provider + .request(.fetchResetMission(roomId: roomId)) return try response.decode() } func fetchMemory(roomId: String) async throws -> Memory? { - let response = try await self.provider.request(.fetchMemory(roomId: roomId)) + let response = try await self.provider + .request(.fetchMemory(roomId: roomId)) return try response.decode() } func patchStartManitto(roomId: String) async throws -> Manittee? { - let response = try await self.provider.request(.patchStartManitto(roomId: roomId)) + let response = try await self.provider + .request(.patchStartManitto(roomId: roomId)) return try response.decode() } func patchEditMission(roomId: String, body: MissionDTO) async throws -> MissionDTO? { - let response = try await self.provider.request(.patchEditMission(roomId: roomId, body: body)) + let response = try await self.provider + .request(.patchEditMission(roomId: roomId, + body: body)) return try response.decode() } func putRoomInfo(roomId: String, roomInfo: RoomDTO) async throws -> Int { - let response = try await self.provider.request(.putRoomInfo(roomId: roomId, roomInfo: roomInfo)) + let response = try await self.provider + .request(.putRoomInfo(roomId: roomId, + roomInfo: roomInfo)) return try response.decode() } func deleteRoom(roomId: String) async throws -> Int { - let response = try await self.provider.request(.deleteRoom(roomId: roomId)) + let response = try await self.provider + .request(.deleteRoom(roomId: roomId)) return try response.decode() } func deleteLeaveRoom(roomId: String) async throws -> Int { - let response = try await self.provider.request(.deleteLeaveRoom(roomId: roomId)) + let response = try await self.provider + .request(.deleteLeaveRoom(roomId: roomId)) return try response.decode() } } diff --git a/Manito/Manito/Data/Repository/LetterRepository.swift b/Manito/Manito/Data/Repository/LetterRepository.swift index f1a7d104c..14a9fd0a7 100644 --- a/Manito/Manito/Data/Repository/LetterRepository.swift +++ b/Manito/Manito/Data/Repository/LetterRepository.swift @@ -20,17 +20,23 @@ final class LetterRepositoryImpl: LetterRepository { private var provider = Provider() func dispatchLetter(roomId: String, image: Data?, letter: LetterDTO, missionId: String) async throws -> Int { - let response = try await self.provider.request(.dispatchLetter(roomId: roomId, image: image, letter: letter, missionId: missionId)) + let response = try await self.provider + .request(.dispatchLetter(roomId: roomId, + image: image, + letter: letter, + missionId: missionId)) return try response.decode() } func fetchSendLetter(roomId: String) async throws -> Letter? { - let response = try await self.provider.request(.fetchSendLetter(roomId: roomId)) + let response = try await self.provider + .request(.fetchSendLetter(roomId: roomId)) return try response.decode() } func fetchReceiveLetter(roomId: String) async throws -> Letter? { - let response = try await self.provider.request(.fetchReceiveLetter(roomId: roomId)) + let response = try await self.provider + .request(.fetchReceiveLetter(roomId: roomId)) return try response.decode() } } diff --git a/Manito/Manito/Data/Repository/LoginRepository.swift b/Manito/Manito/Data/Repository/LoginRepository.swift index ac659b15e..901bd7a0c 100644 --- a/Manito/Manito/Data/Repository/LoginRepository.swift +++ b/Manito/Manito/Data/Repository/LoginRepository.swift @@ -18,7 +18,8 @@ final class LoginRepositoryImpl: LoginRepository { private var provider = Provider() func dispatchAppleLogin(loginDTO: LoginDTO) async throws -> Login? { - let response = try await self.provider.request(.dispatchAppleLogin(loginDTO: loginDTO)) + let response = try await self.provider + .request(.dispatchAppleLogin(loginDTO: loginDTO)) return try response.decode() } } diff --git a/Manito/Manito/Data/Repository/MainRepository.swift b/Manito/Manito/Data/Repository/MainRepository.swift index a10c5b0be..275e7edb8 100644 --- a/Manito/Manito/Data/Repository/MainRepository.swift +++ b/Manito/Manito/Data/Repository/MainRepository.swift @@ -19,12 +19,14 @@ final class MainRepositoryImpl: MainRepository { private var provider = Provider() func fetchCommonMission() async throws -> DailyMission? { - let response = try await self.provider.request(.fetchCommonMission) + let response = try await self.provider + .request(.fetchCommonMission) return try response.decode() } func fetchManittoList() async throws -> ParticipatingRooms? { - let response = try await self.provider.request(.fetchManittoList) + let response = try await self.provider + .request(.fetchManittoList) return try response.decode() } } diff --git a/Manito/Manito/Data/Repository/RoomParticipationRepository.swift b/Manito/Manito/Data/Repository/RoomParticipationRepository.swift index be48a8119..a2a6ca9a8 100644 --- a/Manito/Manito/Data/Repository/RoomParticipationRepository.swift +++ b/Manito/Manito/Data/Repository/RoomParticipationRepository.swift @@ -20,17 +20,21 @@ final class RoomParticipationRepositoryImpl: RoomParticipationRepository { private var provider = Provider() func dispatchCreateRoom(roomInfo: CreateRoomDTO) async throws -> Int? { - let response = try await self.provider.request(.dispatchCreateRoom(roomInfo: roomInfo)) + let response = try await self.provider + .request(.dispatchCreateRoom(roomInfo: roomInfo)) return try response.decode() } func dispatchVerifyCode(code: String) async throws -> VerificationCode? { - let response = try await self.provider.request(.dispatchVerifyCode(code: code)) + let response = try await self.provider + .request(.dispatchVerifyCode(code: code)) return try response.decode() } func dispatchJoinRoom(roomId: String, roomDTO: MemberDTO) async throws -> Int { - let response = try await self.provider.request(.dispatchJoinRoom(roomId: roomId, roomDTO: roomDTO)) + let response = try await self.provider + .request(.dispatchJoinRoom(roomId: roomId, + roomDTO: roomDTO)) return try response.decode() } } diff --git a/Manito/Manito/Data/Repository/SettingRepository.swift b/Manito/Manito/Data/Repository/SettingRepository.swift index 60da78cab..9a7424e19 100644 --- a/Manito/Manito/Data/Repository/SettingRepository.swift +++ b/Manito/Manito/Data/Repository/SettingRepository.swift @@ -18,7 +18,8 @@ final class SettingRepositoryImpl: SettingRepository { private var provider = Provider() func putUserInfo(nickname: NicknameDTO) async throws -> String? { - let response = try await self.provider.request(.putUserInfo(nickname: nickname)) + let response = try await self.provider + .request(.putUserInfo(nickname: nickname)) return try response.decode() } } diff --git a/Manito/Manito/Data/Repository/TokenRepository.swift b/Manito/Manito/Data/Repository/TokenRepository.swift index 7b50c001b..2c68035b1 100644 --- a/Manito/Manito/Data/Repository/TokenRepository.swift +++ b/Manito/Manito/Data/Repository/TokenRepository.swift @@ -18,7 +18,8 @@ final class TokenRepositoryImpl: TokenRepository { private var provider = Provider() func patchRefreshToken(token: Token) async throws -> Token? { - let response = try await self.provider.request(.patchRefreshToken(token: token)) + let response = try await self.provider + .request(.patchRefreshToken(token: token)) return try response.decode() } } From aee9e575ea24c270dd534f4570fcfec5e933c26d Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 14:57:49 +0900 Subject: [PATCH 343/468] =?UTF-8?q?[ADD]=20DTO=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 20 ++++++++++++++++++++ Manito/Manito/Data/DTO/Request/RoomDTO.swift | 8 ++++++++ 2 files changed, 28 insertions(+) create mode 100644 Manito/Manito/Data/DTO/Request/RoomDTO.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index ba5c5bbbe..fefbdd2bd 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -85,6 +85,7 @@ B53A35CC2A96F99D00B720BC /* SettingRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35CB2A96F99D00B720BC /* SettingRepository.swift */; }; B53A35CE2A96FA7A00B720BC /* LoginRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35CD2A96FA7A00B720BC /* LoginRepository.swift */; }; B53A35D02A97194D00B720BC /* TokenRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35CF2A97194D00B720BC /* TokenRepository.swift */; }; + B53A35D42A97266D00B720BC /* RoomDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35D32A97266D00B720BC /* RoomDTO.swift */; }; B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */; }; B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741E929A494E200B75BA3 /* LetterImageError.swift */; }; B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55BCEB328D8449E00AF7E45 /* MemoryCollectionViewCell.swift */; }; @@ -271,6 +272,7 @@ B53A35CB2A96F99D00B720BC /* SettingRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingRepository.swift; sourceTree = ""; }; B53A35CD2A96FA7A00B720BC /* LoginRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginRepository.swift; sourceTree = ""; }; B53A35CF2A97194D00B720BC /* TokenRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenRepository.swift; sourceTree = ""; }; + B53A35D32A97266D00B720BC /* RoomDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDTO.swift; sourceTree = ""; }; B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Dev.xcconfig; sourceTree = ""; }; B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Prod.xcconfig; sourceTree = ""; }; B53AD41D2A8C88E100B83B33 /* GoogleService-Info-Dev.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Dev.plist"; sourceTree = ""; }; @@ -580,6 +582,7 @@ B53A35B82A9640EB00B720BC /* Data */ = { isa = PBXGroup; children = ( + B53A35D12A971E4200B720BC /* DTO */, B53A35BE2A96F1F900B720BC /* Repository */, B5F525462855D00B00614FF7 /* Network */, ); @@ -600,6 +603,22 @@ path = Repository; sourceTree = ""; }; + B53A35D12A971E4200B720BC /* DTO */ = { + isa = PBXGroup; + children = ( + B53A35D22A97265F00B720BC /* Request */, + ); + path = DTO; + sourceTree = ""; + }; + B53A35D22A97265F00B720BC /* Request */ = { + isa = PBXGroup; + children = ( + B53A35D32A97266D00B720BC /* RoomDTO.swift */, + ); + path = Request; + sourceTree = ""; + }; B53AD40F2A8BC69700B83B33 /* Configuration */ = { isa = PBXGroup; children = ( @@ -1442,6 +1461,7 @@ B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */, D7C4A1AD2A0DD8FA00C3AE4C /* SettingView.swift in Sources */, 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */, + B53A35D42A97266D00B720BC /* RoomDTO.swift in Sources */, B53A35B72A963F2100B720BC /* DetailRoomEndPoint.swift in Sources */, D7C4A1B02A0E522800C3AE4C /* SettingViewController+MailComposeViewControllerDelegate.swift in Sources */, 3915D54D2A7516E9002D6C25 /* Key+Extension.swift in Sources */, diff --git a/Manito/Manito/Data/DTO/Request/RoomDTO.swift b/Manito/Manito/Data/DTO/Request/RoomDTO.swift new file mode 100644 index 000000000..a515eceec --- /dev/null +++ b/Manito/Manito/Data/DTO/Request/RoomDTO.swift @@ -0,0 +1,8 @@ +// +// RoomDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation From 8f30ee86f9ec7d71e50bb025a1bf892568bda0f0 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 15:02:27 +0900 Subject: [PATCH 344/468] =?UTF-8?q?[CHORE]=20Test=20Scheme=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/XCTestBuild.yml | 2 +- .../xcshareddata/swiftpm/Package.resolved | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/XCTestBuild.yml b/.github/workflows/XCTestBuild.yml index 68947039b..fd8244b9c 100644 --- a/.github/workflows/XCTestBuild.yml +++ b/.github/workflows/XCTestBuild.yml @@ -15,5 +15,5 @@ jobs: - name: Firefighter Build Tests run: | - xcodebuild clean test -project ./Manito/Manito.xcodeproj -scheme Manito-Prod -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" + xcodebuild clean test -project ./Manito/Manito.xcodeproj -scheme Manito-Dev -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" xcpretty --color --simple diff --git a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a3ff76c5d..f825ebc64 100644 --- a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleDataTransport.git", "state" : { - "revision" : "f6b558e3f801f2cac336b04f615ce111fa9ddaa0", - "version" : "9.2.1" + "revision" : "aae45a320fd0d11811820335b1eabc8753902a40", + "version" : "9.2.5" } }, { @@ -68,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleUtilities.git", "state" : { - "revision" : "0543562f85620b5b7c510c6bcbef75b562a5127b", - "version" : "7.11.0" + "revision" : "c38ce365d77b04a9a300c31061c5227589e5597b", + "version" : "7.11.5" } }, { @@ -113,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/promises.git", "state" : { - "revision" : "ec957ccddbcc710ccc64c9dcbd4c7006fcf8b73a", - "version" : "2.2.0" + "revision" : "e70e889c0196c76d22759eb50d6a0270ca9f1d9e", + "version" : "2.3.1" } }, { @@ -140,8 +140,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "0af9125c4eae12a4973fb66574c53a54962a9e1e", - "version" : "1.21.0" + "revision" : "ce20dc083ee485524b802669890291c0d8090170", + "version" : "1.22.1" } } ], From 80d04e0277ea73810a1817ce8631b765faa75930 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 17:44:10 +0900 Subject: [PATCH 345/468] =?UTF-8?q?[CHORE]=20=EC=A0=84=EC=B2=B4=EC=A0=81?= =?UTF-8?q?=EC=9D=B8=20Model=20=EA=B5=AC=EC=A1=B0=EC=B2=B4=EB=A5=BC=20DTO?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95=ED=95=98=EA=B3=A0=20Entity=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 176 +++++++----- .../DTO/Request/CreatedRoomRequestDTO.swift | 28 ++ .../DTO/Request/EditedMissionRequestDTO.swift | 12 + .../Data/DTO/Request/LetterRequestDTO.swift | 18 ++ .../Data/DTO/Request/LoginRequestDTO.swift | 13 + .../Data/DTO/Request/NicknameRequestDTO.swift | 12 + Manito/Manito/Data/DTO/Request/RoomDTO.swift | 8 - .../Data/DTO/Response/DailyMissionDTO.swift | 12 + .../Response/FriendListDTO.swift} | 10 +- .../Manito/Data/DTO/Response/LetterDTO.swift | 14 + .../Response/LoginDTO.swift} | 6 +- .../Manito/Data/DTO/Response/MemoryDTO.swift | 18 ++ .../DTO/Response/MessageListItemDTO.swift | 16 ++ .../Response/ParticipatedRoomInfoDTO.swift} | 6 +- .../Data/DTO/Response/RoomInfoDTO.swift | 50 ++++ .../Data/DTO/Response/RoomListDTO.swift | 22 ++ .../Data/DTO/Response/UserInfoDTO.swift | 13 + .../Models/Token.swift => DTO/TokenDTO.swift} | 6 +- .../Data/Network/EndPoint/TokenEndPoint.swift | 2 - .../Data/Network/Models/DailyMission.swift | 12 - .../Manito/Data/Network/Models/Letter.swift | 43 --- .../Manito/Data/Network/Models/Memory.swift | 17 -- .../Data/Network/Models/NicknameDTO.swift | 12 - .../Network/Models/Request/LetterDTO.swift | 18 -- .../Network/Models/Request/LoginDTO.swift | 13 - .../Network/Models/Request/MissionDTO.swift | 12 - .../Data/Network/Models/Request/RoomDTO.swift | 28 -- Manito/Manito/Data/Network/Models/Room.swift | 255 ------------------ .../Domain/Entity/MessageListItem.swift | 31 +++ .../Domain/Entity/ParticipantList.swift | 19 ++ Manito/Manito/Domain/Entity/RoomInfo.swift | 45 ++++ .../Manito/Domain/Entity/RoomListItem.swift | 55 ++++ 32 files changed, 496 insertions(+), 506 deletions(-) create mode 100644 Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift create mode 100644 Manito/Manito/Data/DTO/Request/EditedMissionRequestDTO.swift create mode 100644 Manito/Manito/Data/DTO/Request/LetterRequestDTO.swift create mode 100644 Manito/Manito/Data/DTO/Request/LoginRequestDTO.swift create mode 100644 Manito/Manito/Data/DTO/Request/NicknameRequestDTO.swift delete mode 100644 Manito/Manito/Data/DTO/Request/RoomDTO.swift create mode 100644 Manito/Manito/Data/DTO/Response/DailyMissionDTO.swift rename Manito/Manito/Data/{Network/Models/FriendList.swift => DTO/Response/FriendListDTO.swift} (56%) create mode 100644 Manito/Manito/Data/DTO/Response/LetterDTO.swift rename Manito/Manito/Data/{Network/Models/Login.swift => DTO/Response/LoginDTO.swift} (67%) create mode 100644 Manito/Manito/Data/DTO/Response/MemoryDTO.swift create mode 100644 Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift rename Manito/Manito/Data/{Network/Models/VerificationCode.swift => DTO/Response/ParticipatedRoomInfoDTO.swift} (61%) create mode 100644 Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift create mode 100644 Manito/Manito/Data/DTO/Response/RoomListDTO.swift create mode 100644 Manito/Manito/Data/DTO/Response/UserInfoDTO.swift rename Manito/Manito/Data/{Network/Models/Token.swift => DTO/TokenDTO.swift} (53%) delete mode 100644 Manito/Manito/Data/Network/Models/DailyMission.swift delete mode 100644 Manito/Manito/Data/Network/Models/Letter.swift delete mode 100644 Manito/Manito/Data/Network/Models/Memory.swift delete mode 100644 Manito/Manito/Data/Network/Models/NicknameDTO.swift delete mode 100644 Manito/Manito/Data/Network/Models/Request/LetterDTO.swift delete mode 100644 Manito/Manito/Data/Network/Models/Request/LoginDTO.swift delete mode 100644 Manito/Manito/Data/Network/Models/Request/MissionDTO.swift delete mode 100644 Manito/Manito/Data/Network/Models/Request/RoomDTO.swift delete mode 100644 Manito/Manito/Data/Network/Models/Room.swift create mode 100644 Manito/Manito/Domain/Entity/MessageListItem.swift create mode 100644 Manito/Manito/Domain/Entity/ParticipantList.swift create mode 100644 Manito/Manito/Domain/Entity/RoomInfo.swift create mode 100644 Manito/Manito/Domain/Entity/RoomListItem.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index fefbdd2bd..9b0d5da56 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -20,34 +20,24 @@ 395B5BC22A25E20000CE1420 /* DetailWaitViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */; }; 395B5BCC2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */; }; 397A241028BA494100454E4F /* APIEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957F0287D984900A04A2B /* APIEnvironment.swift */; }; - 397A241A28BA532A00454E4F /* FriendList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241928BA532A00454E4F /* FriendList.swift */; }; 398B1C9B29F10B0300DEFCEC /* DetailEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 398B1C9A29F10B0300DEFCEC /* DetailEditView.swift */; }; 398B1CBC2A12415C00DEFCEC /* ManitoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */; }; 398B1CCA2A13597600DEFCEC /* FSCalendar in Frameworks */ = {isa = PBXBuildFile; productRef = 398B1CC92A13597600DEFCEC /* FSCalendar */; }; 398B1CCC2A13599D00DEFCEC /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = 398B1CCB2A13599D00DEFCEC /* FirebaseAuth */; }; 399D17AB2856C83B00F50D9D /* DetailEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */; }; - 39A938932A4852CA00EC2CF2 /* MissionDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938922A4852CA00EC2CF2 /* MissionDTO.swift */; }; 39BDDCC42A52BB4A005E0A71 /* DetailWaitService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39BDDCC32A52BB4A005E0A71 /* DetailWaitService.swift */; }; 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */; }; 39C957D02879521400A04A2B /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CF2879521400A04A2B /* String+Extension.swift */; }; 39C957D22879523200A04A2B /* Date+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957D12879523200A04A2B /* Date+Extension.swift */; }; - 39C957DD2879A2B600A04A2B /* Room.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957DC2879A2B600A04A2B /* Room.swift */; }; - 39C957DF2879A35300A04A2B /* RoomDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957DE2879A35300A04A2B /* RoomDTO.swift */; }; - 39C957E12879A3CF00A04A2B /* DailyMission.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957E02879A3CF00A04A2B /* DailyMission.swift */; }; 39C957ED287AE4D100A04A2B /* MainEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957EC287AE4D100A04A2B /* MainEndPoint.swift */; }; 39C95802287DACC300A04A2B /* RoomParticipationEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95801287DACC300A04A2B /* RoomParticipationEndPoint.swift */; }; 39C95804287DAD3000A04A2B /* LetterEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95803287DAD3000A04A2B /* LetterEndPoint.swift */; }; 39C95808287DB05C00A04A2B /* SettingEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95807287DB05C00A04A2B /* SettingEndPoint.swift */; }; 39C9580A287DC03500A04A2B /* Encodable+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95809287DC03500A04A2B /* Encodable+Extension.swift */; }; - 39CD581F28C4C19100496E91 /* Memory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CD581E28C4C19100496E91 /* Memory.swift */; }; 39D95265285B097800183B09 /* CalendarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39D95264285B097800183B09 /* CalendarView.swift */; }; - 39E099AD287FC020004F464E /* LetterDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39E099AC287FC020004F464E /* LetterDTO.swift */; }; 39EE956D2A401ED400AF6857 /* DetailingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EE956C2A401ED400AF6857 /* DetailingView.swift */; }; 39EE956F2A404A3800AF6857 /* MissionEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EE956E2A404A3800AF6857 /* MissionEditViewController.swift */; }; - 39EEF65828CB3C1100437654 /* Login.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65728CB3C1100437654 /* Login.swift */; }; - 39EEF65A28CB3C7B00437654 /* Token.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65928CB3C7B00437654 /* Token.swift */; }; 39EEF65E28CB3CFE00437654 /* LoginEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65D28CB3CFE00437654 /* LoginEndPoint.swift */; }; - 39EEF66028CB3D6200437654 /* LoginDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65F28CB3D6200437654 /* LoginDTO.swift */; }; 39F1C12E28D756E600585B83 /* LetterImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39F1C12D28D756E600585B83 /* LetterImageViewController.swift */; }; 39FFE32828EEFFFE008442EE /* MoreButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39FFE32728EEFFFE008442EE /* MoreButton.swift */; }; 39FFE33428F457AF008442EE /* FirebaseMessaging in Frameworks */ = {isa = PBXBuildFile; productRef = 39FFE33328F457AF008442EE /* FirebaseMessaging */; }; @@ -59,7 +49,6 @@ 7E3058C82854B64D00489E6A /* InputCapacityView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C72854B64D00489E6A /* InputCapacityView.swift */; }; 7E3058CA2854B7A900489E6A /* InputDateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C92854B7A900489E6A /* InputDateView.swift */; }; 7E7542B32923744300D725CB /* ToastPopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E7542B22923744300D725CB /* ToastPopupView.swift */; }; - 7E77DB0628BF9C0600E95D4B /* VerificationCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E77DB0528BF9C0600E95D4B /* VerificationCode.swift */; }; 7EA25C2728C4FEA800746AEA /* ChangeNickNameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */; }; 7ED845BA2876BE530075AC61 /* SettingViewTableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ED845B92876BE530075AC61 /* SettingViewTableCell.swift */; }; B50B1AF92856B2C60080992C /* CreateLetterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50B1AF82856B2C60080992C /* CreateLetterViewController.swift */; }; @@ -85,7 +74,7 @@ B53A35CC2A96F99D00B720BC /* SettingRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35CB2A96F99D00B720BC /* SettingRepository.swift */; }; B53A35CE2A96FA7A00B720BC /* LoginRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35CD2A96FA7A00B720BC /* LoginRepository.swift */; }; B53A35D02A97194D00B720BC /* TokenRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35CF2A97194D00B720BC /* TokenRepository.swift */; }; - B53A35D42A97266D00B720BC /* RoomDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35D32A97266D00B720BC /* RoomDTO.swift */; }; + B53A35D42A97266D00B720BC /* CreatedRoomRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35D32A97266D00B720BC /* CreatedRoomRequestDTO.swift */; }; B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */; }; B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741E929A494E200B75BA3 /* LetterImageError.swift */; }; B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55BCEB328D8449E00AF7E45 /* MemoryCollectionViewCell.swift */; }; @@ -95,6 +84,24 @@ B5706BE129ADC20A0093D198 /* CreateLetterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5706BE029ADC20A0093D198 /* CreateLetterView.swift */; }; B5706BF429B710FC0093D198 /* LetterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5706BF329B710FC0093D198 /* LetterView.swift */; }; B5706BF629B9D4650093D198 /* GuideView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5706BF529B9D4650093D198 /* GuideView.swift */; }; + B5A085DF2A972D2A00C8A98D /* LetterRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085DE2A972D2A00C8A98D /* LetterRequestDTO.swift */; }; + B5A085E12A972D7900C8A98D /* LoginRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085E02A972D7900C8A98D /* LoginRequestDTO.swift */; }; + B5A085E32A972DDC00C8A98D /* EditedMissionRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085E22A972DDC00C8A98D /* EditedMissionRequestDTO.swift */; }; + B5A085E62A972EB700C8A98D /* LetterDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085E52A972EB700C8A98D /* LetterDTO.swift */; }; + B5A085EA2A97309900C8A98D /* MessageListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085E92A97309900C8A98D /* MessageListItem.swift */; }; + B5A085EC2A97314800C8A98D /* ParticipatedRoomInfoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085EB2A97314800C8A98D /* ParticipatedRoomInfoDTO.swift */; }; + B5A085EE2A9731F000C8A98D /* DailyMissionDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085ED2A9731F000C8A98D /* DailyMissionDTO.swift */; }; + B5A085F02A97326B00C8A98D /* FriendListDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085EF2A97326B00C8A98D /* FriendListDTO.swift */; }; + B5A085F22A9732E800C8A98D /* MemoryDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085F12A9732E800C8A98D /* MemoryDTO.swift */; }; + B5A085F42A9733A700C8A98D /* LoginDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085F32A9733A700C8A98D /* LoginDTO.swift */; }; + B5A085F62A9733F900C8A98D /* TokenDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085F52A9733F900C8A98D /* TokenDTO.swift */; }; + B5A085F82A9744CC00C8A98D /* RoomListDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085F72A9744CC00C8A98D /* RoomListDTO.swift */; }; + B5A085FA2A9745DA00C8A98D /* RoomInfoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085F92A9745DA00C8A98D /* RoomInfoDTO.swift */; }; + B5A085FC2A97470400C8A98D /* RoomInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085FB2A97470400C8A98D /* RoomInfo.swift */; }; + B5A085FE2A97493900C8A98D /* UserInfoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085FD2A97493900C8A98D /* UserInfoDTO.swift */; }; + B5A086002A97496900C8A98D /* MessageListItemDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085FF2A97496900C8A98D /* MessageListItemDTO.swift */; }; + B5A086022A974B8100C8A98D /* RoomListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A086012A974B8100C8A98D /* RoomListItem.swift */; }; + B5A086042A974D2000C8A98D /* ParticipantList.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A086032A974D2000C8A98D /* ParticipantList.swift */; }; B5AE11F029D1E43B00F86FF8 /* OpenManittoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11EF29D1E43B00F86FF8 /* OpenManittoView.swift */; }; B5AE11F229D28CB500F86FF8 /* OpenManittoPopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11F129D28CB500F86FF8 /* OpenManittoPopupView.swift */; }; B5AE11F429D32EE700F86FF8 /* SelectManitteeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */; }; @@ -137,7 +144,6 @@ B5F5253B2854ABF200614FF7 /* MainButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5253A2854ABF200614FF7 /* MainButton.swift */; }; B5F5253D2854B8CB00614FF7 /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5253C2854B8CB00614FF7 /* UIView+Extension.swift */; }; B5F525422855C97900614FF7 /* UILabel+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F525412855C97900614FF7 /* UILabel+Extension.swift */; }; - B5F525492855D01D00614FF7 /* Letter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F525482855D01D00614FF7 /* Letter.swift */; }; B5FEE9DB28C8498A00DEA07E /* ImageCacheManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FEE9DA28C8498A00DEA07E /* ImageCacheManager.swift */; }; B5FEE9DD28C849B400DEA07E /* UIImageView+Cache.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FEE9DC28C849B400DEA07E /* UIImageView+Cache.swift */; }; CB21C33928C4C10200128D25 /* CharacterCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB21C33828C4C10200128D25 /* CharacterCollectionViewCell.swift */; }; @@ -162,7 +168,7 @@ D70220232A7A22EC0024BACD /* CreateRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D70220222A7A22EC0024BACD /* CreateRoomView.swift */; }; D724AF5D287088310003F280 /* SettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5C287088310003F280 /* SettingViewController.swift */; }; D724AF5F28708D830003F280 /* ImageRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5E28708D830003F280 /* ImageRowView.swift */; }; - D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = D739C36628C7B82500161117 /* NicknameDTO.swift */; }; + D739C36728C7B82500161117 /* NicknameRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = D739C36628C7B82500161117 /* NicknameRequestDTO.swift */; }; D75E8C7F28D76FFB004A6C41 /* LetterCountBadgeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D75E8C7E28D76FFB004A6C41 /* LetterCountBadgeView.swift */; }; D77224DF285DDAB7008B760B /* Notification+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D77224DE285DDAB7008B760B /* Notification+Extension.swift */; }; D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = D777D2C828C7780E008655BD /* URLLiteral.swift */; }; @@ -210,35 +216,25 @@ 392EC7802855D17D006918A9 /* DetailWaitTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitTitleView.swift; sourceTree = ""; }; 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitViewModel.swift; sourceTree = ""; }; 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitViewModelTest.swift; sourceTree = ""; }; - 397A241928BA532A00454E4F /* FriendList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendList.swift; sourceTree = ""; }; 398B1C9A29F10B0300DEFCEC /* DetailEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailEditView.swift; sourceTree = ""; }; 398B1CB92A12415B00DEFCEC /* ManitoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ManitoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManitoTests.swift; sourceTree = ""; }; 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailEditViewController.swift; sourceTree = ""; }; - 39A938922A4852CA00EC2CF2 /* MissionDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionDTO.swift; sourceTree = ""; }; 39BDDCC32A52BB4A005E0A71 /* DetailWaitService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitService.swift; sourceTree = ""; }; 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; 39C957CF2879521400A04A2B /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = ""; }; 39C957D12879523200A04A2B /* Date+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Extension.swift"; sourceTree = ""; }; - 39C957DC2879A2B600A04A2B /* Room.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Room.swift; sourceTree = ""; }; - 39C957DE2879A35300A04A2B /* RoomDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDTO.swift; sourceTree = ""; }; - 39C957E02879A3CF00A04A2B /* DailyMission.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyMission.swift; sourceTree = ""; }; 39C957EC287AE4D100A04A2B /* MainEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainEndPoint.swift; sourceTree = ""; }; 39C957F0287D984900A04A2B /* APIEnvironment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIEnvironment.swift; sourceTree = ""; }; 39C95801287DACC300A04A2B /* RoomParticipationEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomParticipationEndPoint.swift; sourceTree = ""; }; 39C95803287DAD3000A04A2B /* LetterEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterEndPoint.swift; sourceTree = ""; }; 39C95807287DB05C00A04A2B /* SettingEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingEndPoint.swift; sourceTree = ""; }; 39C95809287DC03500A04A2B /* Encodable+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Encodable+Extension.swift"; sourceTree = ""; }; - 39CD581E28C4C19100496E91 /* Memory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Memory.swift; sourceTree = ""; }; 39D95264285B097800183B09 /* CalendarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarView.swift; sourceTree = ""; }; - 39E099AC287FC020004F464E /* LetterDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterDTO.swift; sourceTree = ""; }; 39E6321328BDE59C00CFC6C4 /* Manito.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Manito.entitlements; sourceTree = ""; }; 39EE956C2A401ED400AF6857 /* DetailingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailingView.swift; sourceTree = ""; }; 39EE956E2A404A3800AF6857 /* MissionEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionEditViewController.swift; sourceTree = ""; }; - 39EEF65728CB3C1100437654 /* Login.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Login.swift; sourceTree = ""; }; - 39EEF65928CB3C7B00437654 /* Token.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Token.swift; sourceTree = ""; }; 39EEF65D28CB3CFE00437654 /* LoginEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginEndPoint.swift; sourceTree = ""; }; - 39EEF65F28CB3D6200437654 /* LoginDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginDTO.swift; sourceTree = ""; }; 39F1C12D28D756E600585B83 /* LetterImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterImageViewController.swift; sourceTree = ""; }; 39FFE32728EEFFFE008442EE /* MoreButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreButton.swift; sourceTree = ""; }; 39FFE33528F45E44008442EE /* GoogleService-Info-Prod.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Prod.plist"; sourceTree = ""; }; @@ -250,7 +246,6 @@ 7E3058C72854B64D00489E6A /* InputCapacityView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputCapacityView.swift; sourceTree = ""; }; 7E3058C92854B7A900489E6A /* InputDateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputDateView.swift; sourceTree = ""; }; 7E7542B22923744300D725CB /* ToastPopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToastPopupView.swift; sourceTree = ""; }; - 7E77DB0528BF9C0600E95D4B /* VerificationCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerificationCode.swift; sourceTree = ""; }; 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangeNickNameViewController.swift; sourceTree = ""; }; 7ED845B92876BE530075AC61 /* SettingViewTableCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewTableCell.swift; sourceTree = ""; }; B50B1AF82856B2C60080992C /* CreateLetterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateLetterViewController.swift; sourceTree = ""; }; @@ -272,7 +267,7 @@ B53A35CB2A96F99D00B720BC /* SettingRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingRepository.swift; sourceTree = ""; }; B53A35CD2A96FA7A00B720BC /* LoginRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginRepository.swift; sourceTree = ""; }; B53A35CF2A97194D00B720BC /* TokenRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenRepository.swift; sourceTree = ""; }; - B53A35D32A97266D00B720BC /* RoomDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDTO.swift; sourceTree = ""; }; + B53A35D32A97266D00B720BC /* CreatedRoomRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreatedRoomRequestDTO.swift; sourceTree = ""; }; B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Dev.xcconfig; sourceTree = ""; }; B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Prod.xcconfig; sourceTree = ""; }; B53AD41D2A8C88E100B83B33 /* GoogleService-Info-Dev.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Dev.plist"; sourceTree = ""; }; @@ -286,6 +281,24 @@ B5706BF329B710FC0093D198 /* LetterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterView.swift; sourceTree = ""; }; B5706BF529B9D4650093D198 /* GuideView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuideView.swift; sourceTree = ""; }; B57CB3032A763C1600474042 /* MTNetwork */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = MTNetwork; sourceTree = ""; }; + B5A085DE2A972D2A00C8A98D /* LetterRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterRequestDTO.swift; sourceTree = ""; }; + B5A085E02A972D7900C8A98D /* LoginRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginRequestDTO.swift; sourceTree = ""; }; + B5A085E22A972DDC00C8A98D /* EditedMissionRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditedMissionRequestDTO.swift; sourceTree = ""; }; + B5A085E52A972EB700C8A98D /* LetterDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterDTO.swift; sourceTree = ""; }; + B5A085E92A97309900C8A98D /* MessageListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageListItem.swift; sourceTree = ""; }; + B5A085EB2A97314800C8A98D /* ParticipatedRoomInfoDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipatedRoomInfoDTO.swift; sourceTree = ""; }; + B5A085ED2A9731F000C8A98D /* DailyMissionDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyMissionDTO.swift; sourceTree = ""; }; + B5A085EF2A97326B00C8A98D /* FriendListDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendListDTO.swift; sourceTree = ""; }; + B5A085F12A9732E800C8A98D /* MemoryDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryDTO.swift; sourceTree = ""; }; + B5A085F32A9733A700C8A98D /* LoginDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginDTO.swift; sourceTree = ""; }; + B5A085F52A9733F900C8A98D /* TokenDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenDTO.swift; sourceTree = ""; }; + B5A085F72A9744CC00C8A98D /* RoomListDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomListDTO.swift; sourceTree = ""; }; + B5A085F92A9745DA00C8A98D /* RoomInfoDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomInfoDTO.swift; sourceTree = ""; }; + B5A085FB2A97470400C8A98D /* RoomInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomInfo.swift; sourceTree = ""; }; + B5A085FD2A97493900C8A98D /* UserInfoDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInfoDTO.swift; sourceTree = ""; }; + B5A085FF2A97496900C8A98D /* MessageListItemDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageListItemDTO.swift; sourceTree = ""; }; + B5A086012A974B8100C8A98D /* RoomListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomListItem.swift; sourceTree = ""; }; + B5A086032A974D2000C8A98D /* ParticipantList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipantList.swift; sourceTree = ""; }; B5AE11EF29D1E43B00F86FF8 /* OpenManittoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoView.swift; sourceTree = ""; }; B5AE11F129D28CB500F86FF8 /* OpenManittoPopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoPopupView.swift; sourceTree = ""; }; B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeView.swift; sourceTree = ""; }; @@ -330,7 +343,6 @@ B5F5253A2854ABF200614FF7 /* MainButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainButton.swift; sourceTree = ""; }; B5F5253C2854B8CB00614FF7 /* UIView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Extension.swift"; sourceTree = ""; }; B5F525412855C97900614FF7 /* UILabel+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UILabel+Extension.swift"; sourceTree = ""; }; - B5F525482855D01D00614FF7 /* Letter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Letter.swift; sourceTree = ""; }; B5FEE9DA28C8498A00DEA07E /* ImageCacheManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCacheManager.swift; sourceTree = ""; }; B5FEE9DC28C849B400DEA07E /* UIImageView+Cache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImageView+Cache.swift"; sourceTree = ""; }; CB21C33828C4C10200128D25 /* CharacterCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterCollectionViewCell.swift; sourceTree = ""; }; @@ -354,7 +366,7 @@ D70220222A7A22EC0024BACD /* CreateRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomView.swift; sourceTree = ""; }; D724AF5C287088310003F280 /* SettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewController.swift; sourceTree = ""; }; D724AF5E28708D830003F280 /* ImageRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageRowView.swift; sourceTree = ""; }; - D739C36628C7B82500161117 /* NicknameDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameDTO.swift; sourceTree = ""; }; + D739C36628C7B82500161117 /* NicknameRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameRequestDTO.swift; sourceTree = ""; }; D75E8C7E28D76FFB004A6C41 /* LetterCountBadgeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterCountBadgeView.swift; sourceTree = ""; }; D77224DE285DDAB7008B760B /* Notification+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Notification+Extension.swift"; sourceTree = ""; }; D777D2C828C7780E008655BD /* URLLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLLiteral.swift; sourceTree = ""; }; @@ -483,17 +495,6 @@ path = EndPoint; sourceTree = ""; }; - 39E099AB287FBFD2004F464E /* Request */ = { - isa = PBXGroup; - children = ( - 39C957DE2879A35300A04A2B /* RoomDTO.swift */, - 39E099AC287FC020004F464E /* LetterDTO.swift */, - 39EEF65F28CB3D6200437654 /* LoginDTO.swift */, - 39A938922A4852CA00EC2CF2 /* MissionDTO.swift */, - ); - path = Request; - sourceTree = ""; - }; 39EE956B2A401E9600AF6857 /* View */ = { isa = PBXGroup; children = ( @@ -606,7 +607,9 @@ B53A35D12A971E4200B720BC /* DTO */ = { isa = PBXGroup; children = ( + B5A085F52A9733F900C8A98D /* TokenDTO.swift */, B53A35D22A97265F00B720BC /* Request */, + B5A085E42A972E5F00C8A98D /* Response */, ); path = DTO; sourceTree = ""; @@ -614,7 +617,11 @@ B53A35D22A97265F00B720BC /* Request */ = { isa = PBXGroup; children = ( - B53A35D32A97266D00B720BC /* RoomDTO.swift */, + B53A35D32A97266D00B720BC /* CreatedRoomRequestDTO.swift */, + B5A085DE2A972D2A00C8A98D /* LetterRequestDTO.swift */, + B5A085E02A972D7900C8A98D /* LoginRequestDTO.swift */, + B5A085E22A972DDC00C8A98D /* EditedMissionRequestDTO.swift */, + D739C36628C7B82500161117 /* NicknameRequestDTO.swift */, ); path = Request; sourceTree = ""; @@ -689,6 +696,42 @@ path = Packages; sourceTree = ""; }; + B5A085E42A972E5F00C8A98D /* Response */ = { + isa = PBXGroup; + children = ( + B5A085FD2A97493900C8A98D /* UserInfoDTO.swift */, + B5A085EB2A97314800C8A98D /* ParticipatedRoomInfoDTO.swift */, + B5A085F92A9745DA00C8A98D /* RoomInfoDTO.swift */, + B5A085EF2A97326B00C8A98D /* FriendListDTO.swift */, + B5A085F72A9744CC00C8A98D /* RoomListDTO.swift */, + B5A085FF2A97496900C8A98D /* MessageListItemDTO.swift */, + B5A085F32A9733A700C8A98D /* LoginDTO.swift */, + B5A085E52A972EB700C8A98D /* LetterDTO.swift */, + B5A085ED2A9731F000C8A98D /* DailyMissionDTO.swift */, + B5A085F12A9732E800C8A98D /* MemoryDTO.swift */, + ); + path = Response; + sourceTree = ""; + }; + B5A085E72A97302900C8A98D /* Domain */ = { + isa = PBXGroup; + children = ( + B5A085E82A97303900C8A98D /* Entity */, + ); + path = Domain; + sourceTree = ""; + }; + B5A085E82A97303900C8A98D /* Entity */ = { + isa = PBXGroup; + children = ( + B5A085E92A97309900C8A98D /* MessageListItem.swift */, + B5A086012A974B8100C8A98D /* RoomListItem.swift */, + B5A085FB2A97470400C8A98D /* RoomInfo.swift */, + B5A086032A974D2000C8A98D /* ParticipantList.swift */, + ); + path = Entity; + sourceTree = ""; + }; B5AE11EE29D1E38D00F86FF8 /* View */ = { isa = PBXGroup; children = ( @@ -761,6 +804,7 @@ B5F524CD28519AA000614FF7 /* Manito */ = { isa = PBXGroup; children = ( + B5A085E72A97302900C8A98D /* Domain */, B53A35B82A9640EB00B720BC /* Data */, B5F524E328519AC300614FF7 /* Screens */, B5F524E428519AC600614FF7 /* Global */, @@ -1015,28 +1059,10 @@ children = ( 39C957D328799A8200A04A2B /* Foundation */, 39C957EA287AE45900A04A2B /* EndPoint */, - B5F525472855D01200614FF7 /* Models */, ); path = Network; sourceTree = ""; }; - B5F525472855D01200614FF7 /* Models */ = { - isa = PBXGroup; - children = ( - 39E099AB287FBFD2004F464E /* Request */, - B5F525482855D01D00614FF7 /* Letter.swift */, - 39C957DC2879A2B600A04A2B /* Room.swift */, - 7E77DB0528BF9C0600E95D4B /* VerificationCode.swift */, - 39C957E02879A3CF00A04A2B /* DailyMission.swift */, - 397A241928BA532A00454E4F /* FriendList.swift */, - 39CD581E28C4C19100496E91 /* Memory.swift */, - 39EEF65728CB3C1100437654 /* Login.swift */, - 39EEF65928CB3C7B00437654 /* Token.swift */, - D739C36628C7B82500161117 /* NicknameDTO.swift */, - ); - path = Models; - sourceTree = ""; - }; CB5AE3E2285AAF2E00382EA3 /* UIComponent */ = { isa = PBXGroup; children = ( @@ -1364,43 +1390,44 @@ CBA4D7A62856D48C0018BDC2 /* RoomStateView.swift in Sources */, 333BF66628571CF00039F77F /* FriendCollectionViewCell.swift in Sources */, 39D95265285B097800183B09 /* CalendarView.swift in Sources */, - 39EEF65828CB3C1100437654 /* Login.swift in Sources */, 39C957ED287AE4D100A04A2B /* MainEndPoint.swift in Sources */, B5F525292851A2A400614FF7 /* Logger.swift in Sources */, B50B1AFF2856D3820080992C /* CreateLetterPhotoView.swift in Sources */, - 397A241A28BA532A00454E4F /* FriendList.swift in Sources */, + B5A086042A974D2000C8A98D /* ParticipantList.swift in Sources */, 397A241028BA494100454E4F /* APIEnvironment.swift in Sources */, CBBFF77C287AE491006A5964 /* DeveloperInfoViewCell.swift in Sources */, 392EC7812855D17D006918A9 /* DetailWaitTitleView.swift in Sources */, + B5A085E62A972EB700C8A98D /* LetterDTO.swift in Sources */, 7E3058C82854B64D00489E6A /* InputCapacityView.swift in Sources */, B53A35C62A96F6DB00B720BC /* RoomParticipationRepository.swift in Sources */, CBA15C94285CE1A80051EDE2 /* ChooseCharacterViewController.swift in Sources */, 39EEF65E28CB3CFE00437654 /* LoginEndPoint.swift in Sources */, 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */, CB674C2128596A310063A6B7 /* CheckRoomViewController.swift in Sources */, + B5A085DF2A972D2A00C8A98D /* LetterRequestDTO.swift in Sources */, 39C9580A287DC03500A04A2B /* Encodable+Extension.swift in Sources */, B50B1AFB2856B5180080992C /* IndividualMissionView.swift in Sources */, - B5F525492855D01D00614FF7 /* Letter.swift in Sources */, B5F524FB28519C2A00614FF7 /* MainViewController.swift in Sources */, 7E3058C62854B47F00489E6A /* InputTitleView.swift in Sources */, B5F5250128519EFB00614FF7 /* ImageLiteral.swift in Sources */, 39F1C12E28D756E600585B83 /* LetterImageViewController.swift in Sources */, 7E7542B32923744300D725CB /* ToastPopupView.swift in Sources */, + B5A085FE2A97493900C8A98D /* UserInfoDTO.swift in Sources */, 39C957D22879523200A04A2B /* Date+Extension.swift in Sources */, B53A35C82A96F84700B720BC /* LetterRepository.swift in Sources */, 39EE956F2A404A3800AF6857 /* MissionEditViewController.swift in Sources */, B5F5250A2851A06700614FF7 /* DetailWaitViewController.swift in Sources */, + B5A085F02A97326B00C8A98D /* FriendListDTO.swift in Sources */, D7C4A1AB2A0D1AA400C3AE4C /* ParticipateRoomView.swift in Sources */, 39C957D02879521400A04A2B /* String+Extension.swift in Sources */, 399D17AB2856C83B00F50D9D /* DetailEditViewController.swift in Sources */, + B5A086002A97496900C8A98D /* MessageListItemDTO.swift in Sources */, 7E15F67E28B35B3D00441305 /* TextLiteral.swift in Sources */, - 39C957DD2879A2B600A04A2B /* Room.swift in Sources */, B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */, B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */, B5F525422855C97900614FF7 /* UILabel+Extension.swift in Sources */, B53A35CE2A96FA7A00B720BC /* LoginRepository.swift in Sources */, CB21C33928C4C10200128D25 /* CharacterCollectionViewCell.swift in Sources */, - 39EEF65A28CB3C7B00437654 /* Token.swift in Sources */, 39C95804287DAD3000A04A2B /* LetterEndPoint.swift in Sources */, B50B1B44285B146A0080992C /* OpenManittoCollectionViewCell.swift in Sources */, B5F5253128545E4C00614FF7 /* BackButton.swift in Sources */, @@ -1410,12 +1437,12 @@ B5B3C15F2A41D6F400AABD6F /* LetterService.swift in Sources */, B5AE11F229D28CB500F86FF8 /* OpenManittoPopupView.swift in Sources */, B517C04A28D1F7EC0008BED0 /* TokenEndPoint.swift in Sources */, - 39C957DF2879A35300A04A2B /* RoomDTO.swift in Sources */, 39EE956D2A401ED400AF6857 /* DetailingView.swift in Sources */, 39C95808287DB05C00A04A2B /* SettingEndPoint.swift in Sources */, B5F524CF28519AA000614FF7 /* AppDelegate.swift in Sources */, 435B17682913E71400212663 /* DetailingViewController.swift in Sources */, B50CEE912A445EB700CF1C76 /* UIScrollView+Combine.swift in Sources */, + B5A085F22A9732E800C8A98D /* MemoryDTO.swift in Sources */, B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */, D7C4A1A92A0B895300C3AE4C /* ChooseCharacterView.swift in Sources */, 7EA25C2728C4FEA800746AEA /* ChangeNickNameViewController.swift in Sources */, @@ -1423,17 +1450,20 @@ 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */, B5F5251E2851A1C700614FF7 /* BaseTableViewCell.swift in Sources */, 39BDDCC42A52BB4A005E0A71 /* DetailWaitService.swift in Sources */, + B5A086022A974B8100C8A98D /* RoomListItem.swift in Sources */, B53A35CC2A96F99D00B720BC /* SettingRepository.swift in Sources */, B50CEEC02A6FF82600CF1C76 /* Publisher+Extension.swift in Sources */, B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */, B53A35C02A96F21A00B720BC /* MainRepository.swift in Sources */, - D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */, + D739C36728C7B82500161117 /* NicknameRequestDTO.swift in Sources */, + B5A085EA2A97309900C8A98D /* MessageListItem.swift in Sources */, B5F5251A2851A12600614FF7 /* BaseViewController.swift in Sources */, B5AE11F029D1E43B00F86FF8 /* OpenManittoView.swift in Sources */, CB85DE1F28A76F3400399109 /* SettingDeveloperInfoHeaderView.swift in Sources */, B5706BF429B710FC0093D198 /* LetterView.swift in Sources */, B5F525062851A05500614FF7 /* CreateRoomViewController.swift in Sources */, B5F524D128519AA000614FF7 /* SceneDelegate.swift in Sources */, + B5A085E32A972DDC00C8A98D /* EditedMissionRequestDTO.swift in Sources */, CB637A3B28595C1200FF1240 /* ParticipateRoomViewController.swift in Sources */, B5F524FF28519EF300614FF7 /* UIFont+Extension.swift in Sources */, D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */, @@ -1442,9 +1472,9 @@ B5F525262851A26D00614FF7 /* NSObject+Extension.swift in Sources */, 39FFE32828EEFFFE008442EE /* MoreButton.swift in Sources */, B5706BE129ADC20A0093D198 /* CreateLetterView.swift in Sources */, - 39EEF66028CB3D6200437654 /* LoginDTO.swift in Sources */, 7E0C5C362855B22700F698D1 /* CreateNickNameViewController.swift in Sources */, B5B3C15D2A41D6EB00AABD6F /* LetterViewModel.swift in Sources */, + B5A085FC2A97470400C8A98D /* RoomInfo.swift in Sources */, CB674C1C285966020063A6B7 /* InputInvitedCodeView.swift in Sources */, B50B1AF92856B2C60080992C /* CreateLetterViewController.swift in Sources */, B5F31C5028BF922E00F61D0F /* LetterViewController+MailCompose.swift in Sources */, @@ -1461,10 +1491,11 @@ B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */, D7C4A1AD2A0DD8FA00C3AE4C /* SettingView.swift in Sources */, 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */, - B53A35D42A97266D00B720BC /* RoomDTO.swift in Sources */, + B53A35D42A97266D00B720BC /* CreatedRoomRequestDTO.swift in Sources */, B53A35B72A963F2100B720BC /* DetailRoomEndPoint.swift in Sources */, D7C4A1B02A0E522800C3AE4C /* SettingViewController+MailComposeViewControllerDelegate.swift in Sources */, 3915D54D2A7516E9002D6C25 /* Key+Extension.swift in Sources */, + B5A085EE2A9731F000C8A98D /* DailyMissionDTO.swift in Sources */, 33BDF5622856E03800564211 /* FriendListViewController.swift in Sources */, B5F5250E2851A07700614FF7 /* LetterViewController.swift in Sources */, B5F5251C2851A19A00614FF7 /* BaseCollectionViewCell.swift in Sources */, @@ -1472,25 +1503,26 @@ 398B1C9B29F10B0300DEFCEC /* DetailEditView.swift in Sources */, B50B1AFD2856C3500080992C /* CreateLetterTextView.swift in Sources */, D77224DF285DDAB7008B760B /* Notification+Extension.swift in Sources */, + B5A085F42A9733A700C8A98D /* LoginDTO.swift in Sources */, B53A35D02A97194D00B720BC /* TokenRepository.swift in Sources */, B5706BF629B9D4650093D198 /* GuideView.swift in Sources */, B50B1B41285B048A0080992C /* OpenManittoViewController.swift in Sources */, CB5AE3E6285AB76800382EA3 /* PeopleInfoView.swift in Sources */, B5B3C1652A427B5800AABD6F /* UIControl+Combine.swift in Sources */, - 39CD581F28C4C19100496E91 /* Memory.swift in Sources */, - 39E099AD287FC020004F464E /* LetterDTO.swift in Sources */, B5F525222851A24100614FF7 /* UITableView+Extension.swift in Sources */, + B5A085F82A9744CC00C8A98D /* RoomListDTO.swift in Sources */, + B5A085F62A9733F900C8A98D /* TokenDTO.swift in Sources */, B5F5253B2854ABF200614FF7 /* MainButton.swift in Sources */, B50B1B2A285AB7650080992C /* SplashViewController.swift in Sources */, B5FEE9DB28C8498A00DEA07E /* ImageCacheManager.swift in Sources */, B5F5253528547F1900614FF7 /* LetterHeaderView.swift in Sources */, + B5A085FA2A9745DA00C8A98D /* RoomInfoDTO.swift in Sources */, B5F52537285481C800614FF7 /* LetterCollectionViewCell.swift in Sources */, - 7E77DB0628BF9C0600E95D4B /* VerificationCode.swift in Sources */, B53A35C42A96F50100B720BC /* DetailRoomRepository.swift in Sources */, CB358C0228A564080084D001 /* SettingDeveloperInfoViewController.swift in Sources */, CB7B23A828C4ECA8004A4CF3 /* Character.swift in Sources */, - 39C957E12879A3CF00A04A2B /* DailyMission.swift in Sources */, B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */, + B5A085EC2A97314800C8A98D /* ParticipatedRoomInfoDTO.swift in Sources */, D724AF5D287088310003F280 /* SettingViewController.swift in Sources */, B5F5253D2854B8CB00614FF7 /* UIView+Extension.swift in Sources */, 39018F4228C4708A00C78DBA /* UIButton+Extension.swift in Sources */, @@ -1499,7 +1531,7 @@ CB9592B22855C09A00847751 /* ManitoRoomCollectionCell.swift in Sources */, D70220232A7A22EC0024BACD /* CreateRoomView.swift in Sources */, B5AE11F429D32EE700F86FF8 /* SelectManitteeView.swift in Sources */, - 39A938932A4852CA00EC2CF2 /* MissionDTO.swift in Sources */, + B5A085E12A972D7900C8A98D /* LoginRequestDTO.swift in Sources */, B5F525242851A25400614FF7 /* UICollectionView+Extension.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift b/Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift new file mode 100644 index 000000000..12e7bad2f --- /dev/null +++ b/Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift @@ -0,0 +1,28 @@ +// +// CreatedRoomRequestDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct CreatedRoomRequestDTO: Encodable { + let room: CreatedRoomInfoRequestDTO + let member: MemberInfoRequestDTO +} + +struct CreatedRoomInfoRequestDTO: Encodable { + let title: String + let capacity: Int + let startDate: String + let endDate: String +} + +struct MemberInfoRequestDTO: Encodable { + let colorIndex: Int + + enum CodingKeys: String, CodingKey { + case colorIndex = "colorIdx" + } +} diff --git a/Manito/Manito/Data/DTO/Request/EditedMissionRequestDTO.swift b/Manito/Manito/Data/DTO/Request/EditedMissionRequestDTO.swift new file mode 100644 index 000000000..f91e99f21 --- /dev/null +++ b/Manito/Manito/Data/DTO/Request/EditedMissionRequestDTO.swift @@ -0,0 +1,12 @@ +// +// EditedMissionRequestDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct EditedMissionRequestDTO: Codable { + let mission: String +} diff --git a/Manito/Manito/Data/DTO/Request/LetterRequestDTO.swift b/Manito/Manito/Data/DTO/Request/LetterRequestDTO.swift new file mode 100644 index 000000000..dca2a74c3 --- /dev/null +++ b/Manito/Manito/Data/DTO/Request/LetterRequestDTO.swift @@ -0,0 +1,18 @@ +// +// LetterRequestDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct LetterRequestDTO: Encodable { + let manitteeId: String + let messageContent: String? + + init(manitteeId: String, messageContent: String? = nil) { + self.manitteeId = manitteeId + self.messageContent = messageContent + } +} diff --git a/Manito/Manito/Data/DTO/Request/LoginRequestDTO.swift b/Manito/Manito/Data/DTO/Request/LoginRequestDTO.swift new file mode 100644 index 000000000..7b1ca557b --- /dev/null +++ b/Manito/Manito/Data/DTO/Request/LoginRequestDTO.swift @@ -0,0 +1,13 @@ +// +// LoginRequestDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct LoginRequestDTO: Encodable { + let identityToken: String + let fcmToken : String +} diff --git a/Manito/Manito/Data/DTO/Request/NicknameRequestDTO.swift b/Manito/Manito/Data/DTO/Request/NicknameRequestDTO.swift new file mode 100644 index 000000000..6fd886cc5 --- /dev/null +++ b/Manito/Manito/Data/DTO/Request/NicknameRequestDTO.swift @@ -0,0 +1,12 @@ +// +// NicknameRequestDTO.swift +// Manito +// +// Created by 이성호 on 2022/09/07. +// + +import Foundation + +struct NicknameRequestDTO: Encodable { + let nickname: String +} diff --git a/Manito/Manito/Data/DTO/Request/RoomDTO.swift b/Manito/Manito/Data/DTO/Request/RoomDTO.swift deleted file mode 100644 index a515eceec..000000000 --- a/Manito/Manito/Data/DTO/Request/RoomDTO.swift +++ /dev/null @@ -1,8 +0,0 @@ -// -// RoomDTO.swift -// Manito -// -// Created by SHIN YOON AH on 2023/08/24. -// - -import Foundation diff --git a/Manito/Manito/Data/DTO/Response/DailyMissionDTO.swift b/Manito/Manito/Data/DTO/Response/DailyMissionDTO.swift new file mode 100644 index 000000000..8b965cf21 --- /dev/null +++ b/Manito/Manito/Data/DTO/Response/DailyMissionDTO.swift @@ -0,0 +1,12 @@ +// +// DailyMissionDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct DailyMissionDTO: Decodable { + let mission: String? +} diff --git a/Manito/Manito/Data/Network/Models/FriendList.swift b/Manito/Manito/Data/DTO/Response/FriendListDTO.swift similarity index 56% rename from Manito/Manito/Data/Network/Models/FriendList.swift rename to Manito/Manito/Data/DTO/Response/FriendListDTO.swift index 89f2cf1f9..98f6bef61 100644 --- a/Manito/Manito/Data/Network/Models/FriendList.swift +++ b/Manito/Manito/Data/DTO/Response/FriendListDTO.swift @@ -1,18 +1,18 @@ // -// FriendList.swift +// FriendListDTO.swift // Manito // -// Created by Mingwan Choi on 2022/08/27. +// Created by SHIN YOON AH on 2023/08/24. // import Foundation -struct FriendList: Decodable { +struct FriendListDTO: Decodable { let count: Int? - let members: [Member]? + let members: [MemberInfoDTO]? } -struct Member: Decodable { +struct MemberInfoDTO: Decodable { let nickname: String? let colorIndex: Int? diff --git a/Manito/Manito/Data/DTO/Response/LetterDTO.swift b/Manito/Manito/Data/DTO/Response/LetterDTO.swift new file mode 100644 index 000000000..2c6995167 --- /dev/null +++ b/Manito/Manito/Data/DTO/Response/LetterDTO.swift @@ -0,0 +1,14 @@ +// +// LetterDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct LetterDTO: Decodable { + let count: Int? + let manittee: UserInfoDTO? + let messages: [MessageListItemDTO] +} diff --git a/Manito/Manito/Data/Network/Models/Login.swift b/Manito/Manito/Data/DTO/Response/LoginDTO.swift similarity index 67% rename from Manito/Manito/Data/Network/Models/Login.swift rename to Manito/Manito/Data/DTO/Response/LoginDTO.swift index 18b8ec11a..dfeb6c1ab 100644 --- a/Manito/Manito/Data/Network/Models/Login.swift +++ b/Manito/Manito/Data/DTO/Response/LoginDTO.swift @@ -1,13 +1,13 @@ // -// Login.swift +// LoginDTO.swift // Manito // -// Created by Mingwan Choi on 2022/09/09. +// Created by SHIN YOON AH on 2023/08/24. // import Foundation -struct Login: Decodable { +struct LoginDTO: Decodable { let accessToken: String? let refreshToken: String? let nickname: String? diff --git a/Manito/Manito/Data/DTO/Response/MemoryDTO.swift b/Manito/Manito/Data/DTO/Response/MemoryDTO.swift new file mode 100644 index 000000000..d347824c6 --- /dev/null +++ b/Manito/Manito/Data/DTO/Response/MemoryDTO.swift @@ -0,0 +1,18 @@ +// +// MemoryDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct MemoryDTO: Decodable { + let memoriesWithManitto: MemoryItemDTO? + let memoriesWithManittee: MemoryItemDTO? +} + +struct MemoryItemDTO: Decodable { + let member: MemberInfoDTO? + let messages: [MessageListItemDTO]? +} diff --git a/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift b/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift new file mode 100644 index 000000000..42a119163 --- /dev/null +++ b/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift @@ -0,0 +1,16 @@ +// +// MessageListItemDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct MessageListItemDTO: Decodable { + let id: Int? + let content: String? + let imageUrl: String? + let createdDate: String? + let missionInfo: Mission? +} diff --git a/Manito/Manito/Data/Network/Models/VerificationCode.swift b/Manito/Manito/Data/DTO/Response/ParticipatedRoomInfoDTO.swift similarity index 61% rename from Manito/Manito/Data/Network/Models/VerificationCode.swift rename to Manito/Manito/Data/DTO/Response/ParticipatedRoomInfoDTO.swift index a80512f44..71bcc075a 100644 --- a/Manito/Manito/Data/Network/Models/VerificationCode.swift +++ b/Manito/Manito/Data/DTO/Response/ParticipatedRoomInfoDTO.swift @@ -1,13 +1,13 @@ // -// VerificationCode.swift +// ParticipatedRoomInfoDTO.swift // Manito // -// Created by LeeSungHo on 2022/08/31. +// Created by SHIN YOON AH on 2023/08/24. // import Foundation -struct VerificationCode: Decodable { +struct ParticipatedRoomInfoDTO: Decodable { let id: Int? let title: String? let capacity: Int? diff --git a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift new file mode 100644 index 000000000..2f39886d5 --- /dev/null +++ b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift @@ -0,0 +1,50 @@ +// +// RoomInfoDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct RoomInfoDTO: Decodable { + let roomInformation: RoomListItemDTO? + let participants: ParticipantListDTO? + let manittee: UserInfoDTO? + let manitto: UserInfoDTO? + let invitation: InvitationCodeDTO? + let didViewRoulette: Bool? + let mission: IndividualMissionDTO? + let admin: Bool? + let messages: MessageInfo? + + enum CodingKeys: String, CodingKey { + case roomInformation = "room" + case participants + case manittee + case manitto + case invitation + case didViewRoulette + case mission + case admin + case messages + } +} + +struct ParticipantListDTO: Decodable { + let count: Int? + let members: [UserInfoDTO]? +} + +struct InvitationCodeDTO: Decodable { + let code: String? +} + +struct IndividualMissionDTO: Decodable { + let id: Int? + let content: String? +} + +struct MessageInfo: Decodable { + let count: Int? +} diff --git a/Manito/Manito/Data/DTO/Response/RoomListDTO.swift b/Manito/Manito/Data/DTO/Response/RoomListDTO.swift new file mode 100644 index 000000000..82dc4cc87 --- /dev/null +++ b/Manito/Manito/Data/DTO/Response/RoomListDTO.swift @@ -0,0 +1,22 @@ +// +// RoomListDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct RoomListDTO: Decodable { + let participatingRooms: [RoomListItemDTO]? +} + +struct RoomListItemDTO: Decodable { + let id: Int? + let title: String? + let state: String? + let participatingCount: Int? + let capacity: Int? + let startDate: String? + let endDate: String? +} diff --git a/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift b/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift new file mode 100644 index 000000000..bc8bb6411 --- /dev/null +++ b/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift @@ -0,0 +1,13 @@ +// +// UserInfoDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct UserInfoDTO: Decodable { + let id: String? + let nickname: String? +} diff --git a/Manito/Manito/Data/Network/Models/Token.swift b/Manito/Manito/Data/DTO/TokenDTO.swift similarity index 53% rename from Manito/Manito/Data/Network/Models/Token.swift rename to Manito/Manito/Data/DTO/TokenDTO.swift index 63ffea08f..d3c3e355a 100644 --- a/Manito/Manito/Data/Network/Models/Token.swift +++ b/Manito/Manito/Data/DTO/TokenDTO.swift @@ -1,13 +1,13 @@ // -// Token.swift +// TokenDTO.swift // Manito // -// Created by Mingwan Choi on 2022/09/09. +// Created by SHIN YOON AH on 2023/08/24. // import Foundation -struct Token: Codable { +struct TokenDTO: Codable { let accessToken: String? let refreshToken: String? } diff --git a/Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift index b54868227..9430dd0e7 100644 --- a/Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift +++ b/Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift @@ -35,8 +35,6 @@ extension TokenEndPoint: Requestable { var task: HTTPTask { switch self { case .patchRefreshToken(let token): - let token = ["accessToken": token.accessToken, - "refreshToken": token.refreshToken] return .requestJSONEncodable(token) } } diff --git a/Manito/Manito/Data/Network/Models/DailyMission.swift b/Manito/Manito/Data/Network/Models/DailyMission.swift deleted file mode 100644 index f695d75d2..000000000 --- a/Manito/Manito/Data/Network/Models/DailyMission.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// DailyMission.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/09. -// - -import Foundation - -struct DailyMission: Decodable { - let mission: String? -} diff --git a/Manito/Manito/Data/Network/Models/Letter.swift b/Manito/Manito/Data/Network/Models/Letter.swift deleted file mode 100644 index efd9a5edc..000000000 --- a/Manito/Manito/Data/Network/Models/Letter.swift +++ /dev/null @@ -1,43 +0,0 @@ -// -// Letter.swift -// Manito -// -// Created by SHIN YOON AH on 2022/06/12. -// - -import Foundation - -struct Letter: Codable { - var count: Int? - var manittee: Manitte? - var messages: [Message] -} - -struct Manitte: Codable { - var id: String? - var nickname: String? -} - -struct Message: Codable, Hashable { - let id: Int? - let content: String? - let imageUrl: String? - let createdDate: String? - let missionInfo: Mission? - var canReport: Bool? - - var isToday: Bool { - return Date().letterDateToString == createdDate - } - - var date: String { - guard let createdDate = createdDate else { return "" } - return self.isToday ? "오늘" : createdDate - } - - var mission: String? { - guard let mission = missionInfo?.content else { return nil } - - return "\(date)의 개별미션\n[\(mission)]" - } -} diff --git a/Manito/Manito/Data/Network/Models/Memory.swift b/Manito/Manito/Data/Network/Models/Memory.swift deleted file mode 100644 index 3611b4416..000000000 --- a/Manito/Manito/Data/Network/Models/Memory.swift +++ /dev/null @@ -1,17 +0,0 @@ -// -// Memory.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/04. -// - -import Foundation - -struct Memory: Decodable { - let memoriesWithManitto, memoriesWithManittee: MemoriesWithManitte? -} - -struct MemoriesWithManitte: Decodable { - let member: Member? - let messages: [Message]? -} diff --git a/Manito/Manito/Data/Network/Models/NicknameDTO.swift b/Manito/Manito/Data/Network/Models/NicknameDTO.swift deleted file mode 100644 index 58cbb6033..000000000 --- a/Manito/Manito/Data/Network/Models/NicknameDTO.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// Setting.swift -// Manito -// -// Created by 이성호 on 2022/09/07. -// - -import Foundation - -struct NicknameDTO: Codable { - let nickname: String? -} diff --git a/Manito/Manito/Data/Network/Models/Request/LetterDTO.swift b/Manito/Manito/Data/Network/Models/Request/LetterDTO.swift deleted file mode 100644 index 4e5e6695e..000000000 --- a/Manito/Manito/Data/Network/Models/Request/LetterDTO.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// LetterDTO.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/14. -// - -import Foundation - -struct LetterDTO: Encodable { - var manitteeId: String? - var messageContent: String? - - init(manitteeId: String?, messageContent: String? = nil) { - self.manitteeId = manitteeId - self.messageContent = messageContent - } -} diff --git a/Manito/Manito/Data/Network/Models/Request/LoginDTO.swift b/Manito/Manito/Data/Network/Models/Request/LoginDTO.swift deleted file mode 100644 index 32c63ad72..000000000 --- a/Manito/Manito/Data/Network/Models/Request/LoginDTO.swift +++ /dev/null @@ -1,13 +0,0 @@ -// -// LoginDTO.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/09. -// - -import Foundation - -struct LoginDTO: Encodable { - let identityToken: String - let fcmToken : String -} diff --git a/Manito/Manito/Data/Network/Models/Request/MissionDTO.swift b/Manito/Manito/Data/Network/Models/Request/MissionDTO.swift deleted file mode 100644 index 175b5bde2..000000000 --- a/Manito/Manito/Data/Network/Models/Request/MissionDTO.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// MissionDTO.swift -// Manito -// -// Created by Mingwan Choi on 2023/06/25. -// - -import Foundation - -struct MissionDTO: Codable { - let mission: String -} diff --git a/Manito/Manito/Data/Network/Models/Request/RoomDTO.swift b/Manito/Manito/Data/Network/Models/Request/RoomDTO.swift deleted file mode 100644 index b4394bd43..000000000 --- a/Manito/Manito/Data/Network/Models/Request/RoomDTO.swift +++ /dev/null @@ -1,28 +0,0 @@ -// -// RoomDTO.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/09. -// - -import Foundation - -struct CreateRoomDTO: Encodable { - var room: RoomDTO - var member: MemberDTO -} - -struct RoomDTO: Encodable { - let title: String - let capacity: Int - let startDate: String - let endDate: String -} - -struct MemberDTO: Encodable { - var colorIndex: Int - - enum CodingKeys: String, CodingKey { - case colorIndex = "colorIdx" - } -} diff --git a/Manito/Manito/Data/Network/Models/Room.swift b/Manito/Manito/Data/Network/Models/Room.swift deleted file mode 100644 index 6be0dffdd..000000000 --- a/Manito/Manito/Data/Network/Models/Room.swift +++ /dev/null @@ -1,255 +0,0 @@ -// -// Room.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/09. -// - -import Foundation - -struct ParticipatingRooms: Decodable { - let participatingRooms: [ParticipatingRoom]? -} - -struct ParticipatingRoom: Decodable, Equatable { - let id: Int? - let title: String? - var state: String? - let participatingCount, capacity: Int? - let startDate, endDate: String? -} - -struct Room: Decodable, Equatable { - static func == (lhs: Room, rhs: Room) -> Bool { - return lhs.roomInformation == rhs.roomInformation && - lhs.participants == rhs.participants && - lhs.manittee == rhs.manittee && - lhs.manitto == rhs.manitto && - lhs.invitation == rhs.invitation && - lhs.didViewRoulette == rhs.didViewRoulette && - lhs.mission == rhs.mission && - lhs.admin == rhs.admin && - lhs.messages == rhs.messages - } - - let roomInformation: RoomInfo? - let participants: Participants? - let manittee: Manittee? - let manitto: Manitto? - let invitation: Invitation? - var didViewRoulette: Bool? - let mission: Mission? - let admin: Bool? - let messages: Message1? - - var userCount: String { - if let count = participants?.count, - let capacity = roomInformation?.capacity { - return "\(count)/\(capacity)" - } else { - return "" - } - } - - var canStart: Bool { - if let count = participants?.count, - let date = roomInformation?.startDate?.stringToDate, - let isAdmin = admin { - let isMinimumUserCount = count >= 4 - return isMinimumUserCount && date.isToday && isAdmin - } else { - return false - } - } - - var roomDTO: RoomDTO { - if let roomInformation { - let dto = RoomDTO(title: roomInformation.title ?? "", - capacity: roomInformation.capacity ?? 0, - startDate: roomInformation.startDate ?? "", - endDate: roomInformation.endDate ?? "") - return dto - } else { - return RoomDTO(title: "", capacity: 0, startDate: "", endDate: "") - } - } - - enum CodingKeys: String, CodingKey { - case roomInformation = "room" - case participants - case manittee - case manitto - case invitation - case didViewRoulette - case mission - case admin - case messages - } -} - -extension Room { - static let emptyRoom = Room( - roomInformation: nil, - participants: nil, - manittee: nil, - manitto: nil, - invitation: nil, - mission: nil, - admin: nil, - messages: nil) - - static let testRoom = Room( - roomInformation: RoomInfo.testRoomInfo, - participants: Participants.testParticipants, - manittee: Manittee.testManittee, - manitto: Manitto.testManitto, - invitation: Invitation.testInvitation, - didViewRoulette: false, - mission: Mission.testMission, - admin: false, - messages: Message1.testMessage) -} - -struct Friend: Decodable { - let colorIndex: Int? - let name: String? -} - -// MARK: - Participants -struct Participants: Decodable, Equatable { - let count: Int? - let members: [User]? - - var membersNickname: [String] { - if let nicknames = members { - return nicknames.map { $0.nickname ?? "" } - } else { - return [] - } - } -} - -extension Participants { - static let testParticipants = Participants( - count: 5, - members: User.testUserList) -} - -// MARK: - User -struct User: Decodable, Equatable { - let id, nickname: String? -} - -extension User { - static let testUser = User( - id: "100", nickname: "유저1") - static let testUserList = [ - User(id: "100", nickname: "유저1"), - User(id: "200", nickname: "유저2"), - User(id: "300", nickname: "유저3"), - User(id: "400", nickname: "유저4"), - User(id: "500", nickname: "유저5") - ] -} - -// MARK: - Room -struct RoomInfo: Decodable, Equatable { - let id, capacity: Int? - let title, startDate, endDate, state: String? - - var dateRangeText: String { - if let startDate, - let endDate { - return startDate + " ~ " + endDate - } else { - return "" - } - } - - var isAlreadyPastDate: Bool { - if let date = startDate?.stringToDate { - return date.distance(to: Date()) > 86400 - } else { - return false - } - } - - var isStart: Bool { - if let date = startDate?.stringToDate { - let isStartDate = date.distance(to: Date()) < 86400 - let isPast = date.distance(to: Date()) > 86400 - return !isPast && isStartDate - } else { - return false - } - } - - var isStartDatePast: Bool { - guard let startDate = self.startDate?.stringToDate else { return true } - return startDate.isPast - } - - var dateRange: (startDate: String, endDate: String) { - let fiveDaysInterval: TimeInterval = 86400 * 4 - let startDate: String = isStartDatePast ? Date().dateToString : self.startDate ?? "" - let endDate: String = isStartDatePast ? (Date() + fiveDaysInterval).dateToString : self.endDate ?? "" - - return (startDate, endDate) - } -} - -extension RoomInfo { - static let testRoomInfo = RoomInfo( - id: 1, - capacity: 5, - title: "테스트타이틀", - startDate: "2023.01.01", - endDate: "2023.01.05", - state: "PRE") -} - -// MARK: - Mission -struct Mission: Codable, Equatable, Hashable { - let id: Int? - let content: String? -} - -extension Mission { - static let testMission = Mission(id: 1, content: "테스트미션") -} - -// MARK: - Invitation -struct Invitation: Decodable, Equatable { - let code: String? -} - -extension Invitation { - static let testInvitation = Invitation(code: "ABCDEF") -} - -// MARK: - Message1 -struct Message1: Decodable, Equatable { - let count: Int? -} - -extension Message1 { - static let testMessage = Message1(count: 3) -} - -// MARK: - Manittee -struct Manittee: Decodable, Equatable { - let nickname: String? -} - -extension Manittee { - static let testManittee = Manittee(nickname: "테스트마니띠") -} - -// MARK: - Manitto -struct Manitto: Decodable, Equatable { - let nickname: String? -} - -extension Manitto { - static let testManitto = Manitto(nickname: "테스트마니또") -} diff --git a/Manito/Manito/Domain/Entity/MessageListItem.swift b/Manito/Manito/Domain/Entity/MessageListItem.swift new file mode 100644 index 000000000..6a4b7e1ce --- /dev/null +++ b/Manito/Manito/Domain/Entity/MessageListItem.swift @@ -0,0 +1,31 @@ +// +// MessageListItem.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct MessageListItem { + let id: Int + let content: String + let imageUrl: String + let createdDate: String + let missionInfo: IndividualMissionDTO + let canReport: Bool + + var isToday: Bool { + return Date().letterDateToString == createdDate + } + + var date: String { + return self.isToday ? "오늘" : createdDate + } + + var mission: String? { + guard let mission = missionInfo.content else { return nil } + + return "\(date)의 개별미션\n[\(mission)]" + } +} diff --git a/Manito/Manito/Domain/Entity/ParticipantList.swift b/Manito/Manito/Domain/Entity/ParticipantList.swift new file mode 100644 index 000000000..5e3308fb5 --- /dev/null +++ b/Manito/Manito/Domain/Entity/ParticipantList.swift @@ -0,0 +1,19 @@ +// +// ParticipantList.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct ParticipantList: Decodable { + let count: Int + let members: [UserInfoDTO] +} + +extension ParticipantList { + var membersNickname: [String] { + return members.map { $0.nickname ?? "" } + } +} diff --git a/Manito/Manito/Domain/Entity/RoomInfo.swift b/Manito/Manito/Domain/Entity/RoomInfo.swift new file mode 100644 index 000000000..81636883e --- /dev/null +++ b/Manito/Manito/Domain/Entity/RoomInfo.swift @@ -0,0 +1,45 @@ +// +// RoomInfo.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct RoomInfo { + let roomInformation: RoomListItem + let participants: ParticipantList + let manittee: UserInfoDTO + let manitto: UserInfoDTO? + let invitation: InvitationCodeDTO + let didViewRoulette: Bool? + let mission: IndividualMissionDTO? + let admin: Bool + let messages: MessageInfo? +} + +extension RoomInfo { + var userCount: String { + return "\(participants.count)/\(roomInformation.capacity)" + } + + var canStart: Bool { + if let date = roomInformation.startDate.stringToDate { + let isMinimumUserCount = participants.count >= 4 + return isMinimumUserCount && date.isToday && admin + } else { + return false + } + } + + func toRoomListItem() -> RoomListItem { + return RoomListItem(id: roomInformation.id, + title: roomInformation.title, + state: roomInformation.state, + participatingCount: participants.count, + capacity: roomInformation.capacity, + startDate: roomInformation.startDate, + endDate: roomInformation.endDate) + } +} diff --git a/Manito/Manito/Domain/Entity/RoomListItem.swift b/Manito/Manito/Domain/Entity/RoomListItem.swift new file mode 100644 index 000000000..5084cc4a7 --- /dev/null +++ b/Manito/Manito/Domain/Entity/RoomListItem.swift @@ -0,0 +1,55 @@ +// +// RoomListItem.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct RoomListItem { + let id: Int + let title: String + let state: String + let participatingCount: Int? + let capacity: Int + let startDate: String + let endDate: String +} + +extension RoomListItem { + var dateRangeText: String { + return startDate + " ~ " + endDate + } + + var isAlreadyPastDate: Bool { + if let date = startDate.stringToDate { + return date.distance(to: Date()) > 86400 + } else { + return false + } + } + + var isStart: Bool { + if let date = startDate.stringToDate { + let isStartDate = date.distance(to: Date()) < 86400 + let isPast = date.distance(to: Date()) > 86400 + return !isPast && isStartDate + } else { + return false + } + } + + var isStartDatePast: Bool { + guard let startDate = self.startDate.stringToDate else { return true } + return startDate.isPast + } + + var dateRange: (startDate: String, endDate: String) { + let fiveDaysInterval: TimeInterval = 86400 * 4 + let startDate: String = isStartDatePast ? Date().dateToString : self.startDate + let endDate: String = isStartDatePast ? (Date() + fiveDaysInterval).dateToString : self.endDate + + return (startDate, endDate) + } +} From 9d9556dc87446f7a98af7b88e2f728d1a440b331 Mon Sep 17 00:00:00 2001 From: chemi Date: Thu, 24 Aug 2023 18:05:29 +0900 Subject: [PATCH 346/468] =?UTF-8?q?[CHORE]=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=82=AD=EC=A0=9C=20(#488)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 --- Manito/ManitoTests/ManitoTests.swift | 36 ------------------------- 2 files changed, 40 deletions(-) delete mode 100644 Manito/ManitoTests/ManitoTests.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index f08785f87..b5fb6fb9f 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -24,7 +24,6 @@ 397A241828BA51B400454E4F /* DetailWaitProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */; }; 397A241A28BA532A00454E4F /* FriendList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241928BA532A00454E4F /* FriendList.swift */; }; 398B1C9B29F10B0300DEFCEC /* DetailEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 398B1C9A29F10B0300DEFCEC /* DetailEditView.swift */; }; - 398B1CBC2A12415C00DEFCEC /* ManitoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */; }; 398B1CCA2A13597600DEFCEC /* FSCalendar in Frameworks */ = {isa = PBXBuildFile; productRef = 398B1CC92A13597600DEFCEC /* FSCalendar */; }; 398B1CCC2A13599D00DEFCEC /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = 398B1CCB2A13599D00DEFCEC /* FirebaseAuth */; }; 399D17AB2856C83B00F50D9D /* DetailEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */; }; @@ -225,7 +224,6 @@ 397A241928BA532A00454E4F /* FriendList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendList.swift; sourceTree = ""; }; 398B1C9A29F10B0300DEFCEC /* DetailEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailEditView.swift; sourceTree = ""; }; 398B1CB92A12415B00DEFCEC /* ManitoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ManitoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManitoTests.swift; sourceTree = ""; }; 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailEditViewController.swift; sourceTree = ""; }; 39A938902A48504200EC2CF2 /* MissionEditEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionEditEndPoint.swift; sourceTree = ""; }; 39A938922A4852CA00EC2CF2 /* MissionDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionDTO.swift; sourceTree = ""; }; @@ -497,7 +495,6 @@ 398B1CBA2A12415C00DEFCEC /* ManitoTests */ = { isa = PBXGroup; children = ( - 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */, 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */, ); path = ManitoTests; @@ -1383,7 +1380,6 @@ buildActionMask = 2147483647; files = ( 395B5BCC2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift in Sources */, - 398B1CBC2A12415C00DEFCEC /* ManitoTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Manito/ManitoTests/ManitoTests.swift b/Manito/ManitoTests/ManitoTests.swift deleted file mode 100644 index e9d485745..000000000 --- a/Manito/ManitoTests/ManitoTests.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// ManitoTests.swift -// ManitoTests -// -// Created by Mingwan Choi on 2023/05/15. -// - -import XCTest -@testable import Manito - -final class ManitoTests: XCTestCase { - - override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - - func testExample() throws { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - // Any test you write for XCTest can be annotated as throws and async. - // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. - // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. - } - - func testPerformanceExample() throws { - // This is an example of a performance test case. - measure { - // Put the code you want to measure the time of here. - } - } - -} From 432c80b804208da1a55b16578607b9650ea5c76e Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 18:43:38 +0900 Subject: [PATCH 347/468] =?UTF-8?q?[CHORE]=20Main=20=EB=B6=80=EB=B6=84=20D?= =?UTF-8?q?TO=20=EC=88=98=EC=A0=95(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Data/Repository/MainRepository.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Data/Repository/MainRepository.swift b/Manito/Manito/Data/Repository/MainRepository.swift index 275e7edb8..e18cae6ad 100644 --- a/Manito/Manito/Data/Repository/MainRepository.swift +++ b/Manito/Manito/Data/Repository/MainRepository.swift @@ -10,21 +10,21 @@ import Foundation import MTNetwork protocol MainRepository { - func fetchCommonMission() async throws -> DailyMission? - func fetchManittoList() async throws -> ParticipatingRooms? + func fetchCommonMission() async throws -> DailyMissionDTO? + func fetchManittoList() async throws -> RoomListDTO? } final class MainRepositoryImpl: MainRepository { private var provider = Provider() - func fetchCommonMission() async throws -> DailyMission? { + func fetchCommonMission() async throws -> DailyMissionDTO? { let response = try await self.provider .request(.fetchCommonMission) return try response.decode() } - func fetchManittoList() async throws -> ParticipatingRooms? { + func fetchManittoList() async throws -> RoomListDTO? { let response = try await self.provider .request(.fetchManittoList) return try response.decode() From dd80096fcf2ad2187fdf03448bab715309b347da Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 19:01:49 +0900 Subject: [PATCH 348/468] =?UTF-8?q?[CHORE]=20DetailRoom=20DTO=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EC=A7=84=ED=96=89(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Network/EndPoint/DetailRoomEndPoint.swift | 14 +++----- .../Repository/DetailRoomRepository.swift | 36 +++++++++---------- .../Data/Repository/MainRepository.swift | 8 ++--- 3 files changed, 27 insertions(+), 31 deletions(-) diff --git a/Manito/Manito/Data/Network/EndPoint/DetailRoomEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/DetailRoomEndPoint.swift index ceedef95c..ee8e4c952 100644 --- a/Manito/Manito/Data/Network/EndPoint/DetailRoomEndPoint.swift +++ b/Manito/Manito/Data/Network/EndPoint/DetailRoomEndPoint.swift @@ -15,8 +15,8 @@ enum DetailRoomEndPoint { case fetchResetMission(roomId: String) case fetchMemory(roomId: String) case patchStartManitto(roomId: String) - case patchEditMission(roomId: String, body: MissionDTO) - case putRoomInfo(roomId: String, roomInfo: RoomDTO) + case patchEditMission(roomId: String, mission: EditedMissionRequestDTO) + case putRoomInfo(roomId: String, roomInfo: CreatedRoomInfoRequestDTO) case deleteRoom(roomId: String) case deleteLeaveRoom(roomId: String) } @@ -84,14 +84,10 @@ extension DetailRoomEndPoint: Requestable { return .requestPlain case .patchStartManitto: return .requestPlain - case .patchEditMission(_, let body): - return .requestJSONEncodable(body) + case .patchEditMission(_, let mission): + return .requestJSONEncodable(mission) case .putRoomInfo(_, let roomInfo): - let body = ["title": roomInfo.title, - "capacity": roomInfo.capacity.description, - "startDate": roomInfo.startDate, - "endDate": roomInfo.endDate] - return .requestJSONEncodable(body) + return .requestJSONEncodable(roomInfo) case .deleteRoom: return .requestPlain case .deleteLeaveRoom: diff --git a/Manito/Manito/Data/Repository/DetailRoomRepository.swift b/Manito/Manito/Data/Repository/DetailRoomRepository.swift index 53dd7f3a0..b8ecd1662 100644 --- a/Manito/Manito/Data/Repository/DetailRoomRepository.swift +++ b/Manito/Manito/Data/Repository/DetailRoomRepository.swift @@ -10,13 +10,13 @@ import Foundation import MTNetwork protocol DetailRoomRepository { - func fetchWithFriend(roomId: String) async throws -> FriendList? - func fetchRoomInfo(roomId: String) async throws -> Room? - func fetchResetMission(roomId: String) async throws -> MissionDTO? - func fetchMemory(roomId: String) async throws -> Memory? - func patchStartManitto(roomId: String) async throws -> Manittee? - func patchEditMission(roomId: String, body: MissionDTO) async throws -> MissionDTO? - func putRoomInfo(roomId: String, roomInfo: RoomDTO) async throws -> Int + func fetchWithFriend(roomId: String) async throws -> FriendListDTO + func fetchRoomInfo(roomId: String) async throws -> RoomInfoDTO + func fetchResetMission(roomId: String) async throws -> IndividualMissionDTO + func fetchMemory(roomId: String) async throws -> MemoryDTO + func patchStartManitto(roomId: String) async throws -> UserInfoDTO + func patchEditMission(roomId: String, mission: EditedMissionRequestDTO) async throws -> IndividualMissionDTO + func putRoomInfo(roomId: String, roomInfo: CreatedRoomInfoRequestDTO) async throws -> Int func deleteRoom(roomId: String) async throws -> Int func deleteLeaveRoom(roomId: String) async throws -> Int } @@ -25,59 +25,59 @@ final class DetailRoomRepositoryImpl: DetailRoomRepository { private var provider = Provider() - func fetchWithFriend(roomId: String) async throws -> FriendList? { + func fetchWithFriend(roomId: String) async throws -> FriendListDTO { let response = try await self.provider .request(.fetchWithFriend(roomId: roomId)) return try response.decode() } - func fetchRoomInfo(roomId: String) async throws -> Room? { + func fetchRoomInfo(roomId: String) async throws -> RoomInfoDTO { let response = try await self.provider .request(.fetchRoomInfo(roomId: roomId)) return try response.decode() } - func fetchResetMission(roomId: String) async throws -> MissionDTO? { + func fetchResetMission(roomId: String) async throws -> IndividualMissionDTO { let response = try await self.provider .request(.fetchResetMission(roomId: roomId)) return try response.decode() } - func fetchMemory(roomId: String) async throws -> Memory? { + func fetchMemory(roomId: String) async throws -> MemoryDTO { let response = try await self.provider .request(.fetchMemory(roomId: roomId)) return try response.decode() } - func patchStartManitto(roomId: String) async throws -> Manittee? { + func patchStartManitto(roomId: String) async throws -> UserInfoDTO { let response = try await self.provider .request(.patchStartManitto(roomId: roomId)) return try response.decode() } - func patchEditMission(roomId: String, body: MissionDTO) async throws -> MissionDTO? { + func patchEditMission(roomId: String, mission: EditedMissionRequestDTO) async throws -> IndividualMissionDTO { let response = try await self.provider .request(.patchEditMission(roomId: roomId, - body: body)) + mission: mission)) return try response.decode() } - func putRoomInfo(roomId: String, roomInfo: RoomDTO) async throws -> Int { + func putRoomInfo(roomId: String, roomInfo: CreatedRoomInfoRequestDTO) async throws -> Int { let response = try await self.provider .request(.putRoomInfo(roomId: roomId, roomInfo: roomInfo)) - return try response.decode() + return response.statusCode } func deleteRoom(roomId: String) async throws -> Int { let response = try await self.provider .request(.deleteRoom(roomId: roomId)) - return try response.decode() + return response.statusCode } func deleteLeaveRoom(roomId: String) async throws -> Int { let response = try await self.provider .request(.deleteLeaveRoom(roomId: roomId)) - return try response.decode() + return response.statusCode } } diff --git a/Manito/Manito/Data/Repository/MainRepository.swift b/Manito/Manito/Data/Repository/MainRepository.swift index e18cae6ad..3a88b918b 100644 --- a/Manito/Manito/Data/Repository/MainRepository.swift +++ b/Manito/Manito/Data/Repository/MainRepository.swift @@ -10,21 +10,21 @@ import Foundation import MTNetwork protocol MainRepository { - func fetchCommonMission() async throws -> DailyMissionDTO? - func fetchManittoList() async throws -> RoomListDTO? + func fetchCommonMission() async throws -> DailyMissionDTO + func fetchManittoList() async throws -> RoomListDTO } final class MainRepositoryImpl: MainRepository { private var provider = Provider() - func fetchCommonMission() async throws -> DailyMissionDTO? { + func fetchCommonMission() async throws -> DailyMissionDTO { let response = try await self.provider .request(.fetchCommonMission) return try response.decode() } - func fetchManittoList() async throws -> RoomListDTO? { + func fetchManittoList() async throws -> RoomListDTO { let response = try await self.provider .request(.fetchManittoList) return try response.decode() From 9814005ed2e33f5c10184c34c9efcc7233606bab Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 19:07:50 +0900 Subject: [PATCH 349/468] =?UTF-8?q?[CHORE]=20RoomParticipation=20=EB=B6=80?= =?UTF-8?q?=EB=B6=84=20DTO=20=EC=88=98=EC=A0=95(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTO/Request/CreatedRoomRequestDTO.swift | 4 ---- .../EndPoint/RoomParticipationEndPoint.swift | 12 +++++------ .../RoomParticipationRepository.swift | 20 +++++++++---------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift b/Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift index 12e7bad2f..69fb6441b 100644 --- a/Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift +++ b/Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift @@ -21,8 +21,4 @@ struct CreatedRoomInfoRequestDTO: Encodable { struct MemberInfoRequestDTO: Encodable { let colorIndex: Int - - enum CodingKeys: String, CodingKey { - case colorIndex = "colorIdx" - } } diff --git a/Manito/Manito/Data/Network/EndPoint/RoomParticipationEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/RoomParticipationEndPoint.swift index 34a175263..8ae22afd8 100644 --- a/Manito/Manito/Data/Network/EndPoint/RoomParticipationEndPoint.swift +++ b/Manito/Manito/Data/Network/EndPoint/RoomParticipationEndPoint.swift @@ -10,9 +10,9 @@ import Foundation import MTNetwork enum RoomParticipationEndPoint { - case dispatchCreateRoom(roomInfo: CreateRoomDTO) + case dispatchCreateRoom(room: CreatedRoomRequestDTO) case dispatchVerifyCode(code: String) - case dispatchJoinRoom(roomId: String, roomDTO: MemberDTO) + case dispatchJoinRoom(roomId: String, member: MemberInfoRequestDTO) } extension RoomParticipationEndPoint: Requestable { @@ -44,13 +44,13 @@ extension RoomParticipationEndPoint: Requestable { var task: HTTPTask { switch self { - case .dispatchCreateRoom(let roomInfo): - return .requestJSONEncodable(roomInfo) + case .dispatchCreateRoom(let room): + return .requestJSONEncodable(room) case .dispatchVerifyCode(let code): let body = ["invitationCode": code] return .requestJSONEncodable(body) - case .dispatchJoinRoom(_, let roomDto): - return .requestJSONEncodable(roomDto) + case .dispatchJoinRoom(_, let member): + return .requestJSONEncodable(member) } } diff --git a/Manito/Manito/Data/Repository/RoomParticipationRepository.swift b/Manito/Manito/Data/Repository/RoomParticipationRepository.swift index a2a6ca9a8..473bf9fcb 100644 --- a/Manito/Manito/Data/Repository/RoomParticipationRepository.swift +++ b/Manito/Manito/Data/Repository/RoomParticipationRepository.swift @@ -10,31 +10,31 @@ import Foundation import MTNetwork protocol RoomParticipationRepository { - func dispatchCreateRoom(roomInfo: CreateRoomDTO) async throws -> Int? - func dispatchVerifyCode(code: String) async throws -> VerificationCode? - func dispatchJoinRoom(roomId: String, roomDTO: MemberDTO) async throws -> Int + func dispatchCreateRoom(room: CreatedRoomRequestDTO) async throws -> Int + func dispatchVerifyCode(code: String) async throws -> InvitationCodeDTO + func dispatchJoinRoom(roomId: String, member: MemberInfoRequestDTO) async throws -> Int } final class RoomParticipationRepositoryImpl: RoomParticipationRepository { private var provider = Provider() - func dispatchCreateRoom(roomInfo: CreateRoomDTO) async throws -> Int? { + func dispatchCreateRoom(room: CreatedRoomRequestDTO) async throws -> Int { let response = try await self.provider - .request(.dispatchCreateRoom(roomInfo: roomInfo)) - return try response.decode() + .request(.dispatchCreateRoom(room: room)) + return response.statusCode } - func dispatchVerifyCode(code: String) async throws -> VerificationCode? { + func dispatchVerifyCode(code: String) async throws -> InvitationCodeDTO { let response = try await self.provider .request(.dispatchVerifyCode(code: code)) return try response.decode() } - func dispatchJoinRoom(roomId: String, roomDTO: MemberDTO) async throws -> Int { + func dispatchJoinRoom(roomId: String, member: MemberInfoRequestDTO) async throws -> Int { let response = try await self.provider .request(.dispatchJoinRoom(roomId: roomId, - roomDTO: roomDTO)) - return try response.decode() + member: member)) + return response.statusCode } } From 55c21aeb13c5d485a248b605826c96b4c0fa480e Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 19:13:29 +0900 Subject: [PATCH 350/468] =?UTF-8?q?[CHORE]=20Letter=20=EB=B6=80=EB=B6=84?= =?UTF-8?q?=20DTO=20=EC=88=98=EC=A0=95(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Data/Network/EndPoint/LetterEndPoint.swift | 2 +- .../Manito/Data/Repository/LetterRepository.swift | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift index 5476d2b22..db2e3ae20 100644 --- a/Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift +++ b/Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift @@ -10,7 +10,7 @@ import Foundation import MTNetwork enum LetterEndPoint { - case dispatchLetter(roomId: String, image: Data?, letter: LetterDTO, missionId: String) + case dispatchLetter(roomId: String, image: Data?, letter: LetterRequestDTO, missionId: String) case fetchSendLetter(roomId: String) case fetchReceiveLetter(roomId: String) } diff --git a/Manito/Manito/Data/Repository/LetterRepository.swift b/Manito/Manito/Data/Repository/LetterRepository.swift index 14a9fd0a7..b5c8a9f0b 100644 --- a/Manito/Manito/Data/Repository/LetterRepository.swift +++ b/Manito/Manito/Data/Repository/LetterRepository.swift @@ -10,31 +10,31 @@ import Foundation import MTNetwork protocol LetterRepository { - func dispatchLetter(roomId: String, image: Data?, letter: LetterDTO, missionId: String) async throws -> Int - func fetchSendLetter(roomId: String) async throws -> Letter? - func fetchReceiveLetter(roomId: String) async throws -> Letter? + func dispatchLetter(roomId: String, image: Data?, letter: LetterRequestDTO, missionId: String) async throws -> Int + func fetchSendLetter(roomId: String) async throws -> LetterDTO + func fetchReceiveLetter(roomId: String) async throws -> LetterDTO } final class LetterRepositoryImpl: LetterRepository { private var provider = Provider() - func dispatchLetter(roomId: String, image: Data?, letter: LetterDTO, missionId: String) async throws -> Int { + func dispatchLetter(roomId: String, image: Data?, letter: LetterRequestDTO, missionId: String) async throws -> Int { let response = try await self.provider .request(.dispatchLetter(roomId: roomId, image: image, letter: letter, missionId: missionId)) - return try response.decode() + return response.statusCode } - func fetchSendLetter(roomId: String) async throws -> Letter? { + func fetchSendLetter(roomId: String) async throws -> LetterDTO { let response = try await self.provider .request(.fetchSendLetter(roomId: roomId)) return try response.decode() } - func fetchReceiveLetter(roomId: String) async throws -> Letter? { + func fetchReceiveLetter(roomId: String) async throws -> LetterDTO { let response = try await self.provider .request(.fetchReceiveLetter(roomId: roomId)) return try response.decode() From c9bc12c7269ef31d75a7c9fd8c8852f38519f97f Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 19:17:26 +0900 Subject: [PATCH 351/468] =?UTF-8?q?[CHORE]=20Setting=20=EB=B6=80=EB=B6=84?= =?UTF-8?q?=20DTO=20=EC=88=98=EC=A0=95(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 8 ++++---- .../NicknameRequestDTO.swift => NicknameDTO.swift} | 4 ++-- Manito/Manito/Data/Repository/SettingRepository.swift | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) rename Manito/Manito/Data/DTO/{Request/NicknameRequestDTO.swift => NicknameDTO.swift} (61%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 9b0d5da56..628e62c0d 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -168,7 +168,7 @@ D70220232A7A22EC0024BACD /* CreateRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D70220222A7A22EC0024BACD /* CreateRoomView.swift */; }; D724AF5D287088310003F280 /* SettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5C287088310003F280 /* SettingViewController.swift */; }; D724AF5F28708D830003F280 /* ImageRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5E28708D830003F280 /* ImageRowView.swift */; }; - D739C36728C7B82500161117 /* NicknameRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = D739C36628C7B82500161117 /* NicknameRequestDTO.swift */; }; + D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = D739C36628C7B82500161117 /* NicknameDTO.swift */; }; D75E8C7F28D76FFB004A6C41 /* LetterCountBadgeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D75E8C7E28D76FFB004A6C41 /* LetterCountBadgeView.swift */; }; D77224DF285DDAB7008B760B /* Notification+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D77224DE285DDAB7008B760B /* Notification+Extension.swift */; }; D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = D777D2C828C7780E008655BD /* URLLiteral.swift */; }; @@ -366,7 +366,7 @@ D70220222A7A22EC0024BACD /* CreateRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomView.swift; sourceTree = ""; }; D724AF5C287088310003F280 /* SettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewController.swift; sourceTree = ""; }; D724AF5E28708D830003F280 /* ImageRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageRowView.swift; sourceTree = ""; }; - D739C36628C7B82500161117 /* NicknameRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameRequestDTO.swift; sourceTree = ""; }; + D739C36628C7B82500161117 /* NicknameDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameDTO.swift; sourceTree = ""; }; D75E8C7E28D76FFB004A6C41 /* LetterCountBadgeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterCountBadgeView.swift; sourceTree = ""; }; D77224DE285DDAB7008B760B /* Notification+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Notification+Extension.swift"; sourceTree = ""; }; D777D2C828C7780E008655BD /* URLLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLLiteral.swift; sourceTree = ""; }; @@ -608,6 +608,7 @@ isa = PBXGroup; children = ( B5A085F52A9733F900C8A98D /* TokenDTO.swift */, + D739C36628C7B82500161117 /* NicknameDTO.swift */, B53A35D22A97265F00B720BC /* Request */, B5A085E42A972E5F00C8A98D /* Response */, ); @@ -621,7 +622,6 @@ B5A085DE2A972D2A00C8A98D /* LetterRequestDTO.swift */, B5A085E02A972D7900C8A98D /* LoginRequestDTO.swift */, B5A085E22A972DDC00C8A98D /* EditedMissionRequestDTO.swift */, - D739C36628C7B82500161117 /* NicknameRequestDTO.swift */, ); path = Request; sourceTree = ""; @@ -1455,7 +1455,7 @@ B50CEEC02A6FF82600CF1C76 /* Publisher+Extension.swift in Sources */, B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */, B53A35C02A96F21A00B720BC /* MainRepository.swift in Sources */, - D739C36728C7B82500161117 /* NicknameRequestDTO.swift in Sources */, + D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */, B5A085EA2A97309900C8A98D /* MessageListItem.swift in Sources */, B5F5251A2851A12600614FF7 /* BaseViewController.swift in Sources */, B5AE11F029D1E43B00F86FF8 /* OpenManittoView.swift in Sources */, diff --git a/Manito/Manito/Data/DTO/Request/NicknameRequestDTO.swift b/Manito/Manito/Data/DTO/NicknameDTO.swift similarity index 61% rename from Manito/Manito/Data/DTO/Request/NicknameRequestDTO.swift rename to Manito/Manito/Data/DTO/NicknameDTO.swift index 6fd886cc5..e9347ad51 100644 --- a/Manito/Manito/Data/DTO/Request/NicknameRequestDTO.swift +++ b/Manito/Manito/Data/DTO/NicknameDTO.swift @@ -1,5 +1,5 @@ // -// NicknameRequestDTO.swift +// NicknameDTO.swift // Manito // // Created by 이성호 on 2022/09/07. @@ -7,6 +7,6 @@ import Foundation -struct NicknameRequestDTO: Encodable { +struct NicknameDTO: Codable { let nickname: String } diff --git a/Manito/Manito/Data/Repository/SettingRepository.swift b/Manito/Manito/Data/Repository/SettingRepository.swift index 9a7424e19..a5cbd3844 100644 --- a/Manito/Manito/Data/Repository/SettingRepository.swift +++ b/Manito/Manito/Data/Repository/SettingRepository.swift @@ -10,14 +10,14 @@ import Foundation import MTNetwork protocol SettingRepository { - func putUserInfo(nickname: NicknameDTO) async throws -> String? + func putUserInfo(nickname: NicknameDTO) async throws -> NicknameDTO } final class SettingRepositoryImpl: SettingRepository { private var provider = Provider() - func putUserInfo(nickname: NicknameDTO) async throws -> String? { + func putUserInfo(nickname: NicknameDTO) async throws -> NicknameDTO { let response = try await self.provider .request(.putUserInfo(nickname: nickname)) return try response.decode() From d20307b3586d09eaca6735259c795f3ff8287402 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 20:39:01 +0900 Subject: [PATCH 352/468] =?UTF-8?q?[CHORE]=20Login,=20Token=20DTO=20?= =?UTF-8?q?=EC=88=98=EC=A0=95(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Data/Network/EndPoint/LoginEndPoint.swift | 2 +- Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift | 2 +- Manito/Manito/Data/Repository/LoginRepository.swift | 6 +++--- Manito/Manito/Data/Repository/TokenRepository.swift | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Manito/Manito/Data/Network/EndPoint/LoginEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/LoginEndPoint.swift index 19d811159..d52c2782a 100644 --- a/Manito/Manito/Data/Network/EndPoint/LoginEndPoint.swift +++ b/Manito/Manito/Data/Network/EndPoint/LoginEndPoint.swift @@ -10,7 +10,7 @@ import Foundation import MTNetwork enum LoginEndPoint { - case dispatchAppleLogin(loginDTO: LoginDTO) + case dispatchAppleLogin(login: LoginRequestDTO) } extension LoginEndPoint: Requestable { diff --git a/Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift index 9430dd0e7..09703bf49 100644 --- a/Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift +++ b/Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift @@ -10,7 +10,7 @@ import Foundation import MTNetwork enum TokenEndPoint { - case patchRefreshToken(token: Token) + case patchRefreshToken(token: TokenDTO) } extension TokenEndPoint: Requestable { diff --git a/Manito/Manito/Data/Repository/LoginRepository.swift b/Manito/Manito/Data/Repository/LoginRepository.swift index 901bd7a0c..aa8cf0bf7 100644 --- a/Manito/Manito/Data/Repository/LoginRepository.swift +++ b/Manito/Manito/Data/Repository/LoginRepository.swift @@ -10,16 +10,16 @@ import Foundation import MTNetwork protocol LoginRepository { - func dispatchAppleLogin(loginDTO: LoginDTO) async throws -> Login? + func dispatchAppleLogin(login: LoginRequestDTO) async throws -> LoginDTO } final class LoginRepositoryImpl: LoginRepository { private var provider = Provider() - func dispatchAppleLogin(loginDTO: LoginDTO) async throws -> Login? { + func dispatchAppleLogin(login: LoginRequestDTO) async throws -> LoginDTO { let response = try await self.provider - .request(.dispatchAppleLogin(loginDTO: loginDTO)) + .request(.dispatchAppleLogin(login: login)) return try response.decode() } } diff --git a/Manito/Manito/Data/Repository/TokenRepository.swift b/Manito/Manito/Data/Repository/TokenRepository.swift index 2c68035b1..60fc9a549 100644 --- a/Manito/Manito/Data/Repository/TokenRepository.swift +++ b/Manito/Manito/Data/Repository/TokenRepository.swift @@ -10,14 +10,14 @@ import Foundation import MTNetwork protocol TokenRepository { - func patchRefreshToken(token: Token) async throws -> Token? + func patchRefreshToken(token: TokenDTO) async throws -> TokenDTO } final class TokenRepositoryImpl: TokenRepository { private var provider = Provider() - func patchRefreshToken(token: Token) async throws -> Token? { + func patchRefreshToken(token: TokenDTO) async throws -> TokenDTO { let response = try await self.provider .request(.patchRefreshToken(token: token)) return try response.decode() From e868fb954e2dcc39da409940720699eac64fd08a Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 21:13:36 +0900 Subject: [PATCH 353/468] =?UTF-8?q?[CHORE]=20Setting,=20Login,=20CreateNic?= =?UTF-8?q?kname,=20Main,=20Interaction=20=EB=B6=80=EB=B6=84=20DTO=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EB=B0=8F=20NetworkError=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++ .../Network/Foundation/NetworkError.swift | 19 ++++++++++ .../CreateNickNameViewController.swift | 12 +++--- .../OpenManittoViewController.swift | 14 +++---- .../Screens/Login/LoginViewController.swift | 37 +++++++++---------- .../Screens/Main/MainViewController.swift | 24 ++++++------ .../ChangeNickNameViewController.swift | 6 +-- 7 files changed, 66 insertions(+), 50 deletions(-) create mode 100644 Manito/Manito/Data/Network/Foundation/NetworkError.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 628e62c0d..998e23030 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -102,6 +102,7 @@ B5A086002A97496900C8A98D /* MessageListItemDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085FF2A97496900C8A98D /* MessageListItemDTO.swift */; }; B5A086022A974B8100C8A98D /* RoomListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A086012A974B8100C8A98D /* RoomListItem.swift */; }; B5A086042A974D2000C8A98D /* ParticipantList.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A086032A974D2000C8A98D /* ParticipantList.swift */; }; + B5A086062A977F1700C8A98D /* NetworkError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A086052A977F1700C8A98D /* NetworkError.swift */; }; B5AE11F029D1E43B00F86FF8 /* OpenManittoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11EF29D1E43B00F86FF8 /* OpenManittoView.swift */; }; B5AE11F229D28CB500F86FF8 /* OpenManittoPopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11F129D28CB500F86FF8 /* OpenManittoPopupView.swift */; }; B5AE11F429D32EE700F86FF8 /* SelectManitteeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */; }; @@ -299,6 +300,7 @@ B5A085FF2A97496900C8A98D /* MessageListItemDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageListItemDTO.swift; sourceTree = ""; }; B5A086012A974B8100C8A98D /* RoomListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomListItem.swift; sourceTree = ""; }; B5A086032A974D2000C8A98D /* ParticipantList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipantList.swift; sourceTree = ""; }; + B5A086052A977F1700C8A98D /* NetworkError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkError.swift; sourceTree = ""; }; B5AE11EF29D1E43B00F86FF8 /* OpenManittoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoView.swift; sourceTree = ""; }; B5AE11F129D28CB500F86FF8 /* OpenManittoPopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoPopupView.swift; sourceTree = ""; }; B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeView.swift; sourceTree = ""; }; @@ -477,6 +479,7 @@ 3915D54A2A7516A2002D6C25 /* Key.plist */, 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */, 39C957F0287D984900A04A2B /* APIEnvironment.swift */, + B5A086052A977F1700C8A98D /* NetworkError.swift */, ); path = Foundation; sourceTree = ""; @@ -1439,6 +1442,7 @@ B517C04A28D1F7EC0008BED0 /* TokenEndPoint.swift in Sources */, 39EE956D2A401ED400AF6857 /* DetailingView.swift in Sources */, 39C95808287DB05C00A04A2B /* SettingEndPoint.swift in Sources */, + B5A086062A977F1700C8A98D /* NetworkError.swift in Sources */, B5F524CF28519AA000614FF7 /* AppDelegate.swift in Sources */, 435B17682913E71400212663 /* DetailingViewController.swift in Sources */, B50CEE912A445EB700CF1C76 /* UIScrollView+Combine.swift in Sources */, diff --git a/Manito/Manito/Data/Network/Foundation/NetworkError.swift b/Manito/Manito/Data/Network/Foundation/NetworkError.swift new file mode 100644 index 000000000..278a4b6c7 --- /dev/null +++ b/Manito/Manito/Data/Network/Foundation/NetworkError.swift @@ -0,0 +1,19 @@ +// +// NetworkError.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +/// +/// 프로젝트에 존재하는 모든 NetworkError가 사라지면 삭제하겠습니다. +/// + +enum NetworkError: Error { + case encodingError + case clientError(message: String?) + case serverError + case unknownError +} diff --git a/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift b/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift index 626970359..719eb66d8 100644 --- a/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift +++ b/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift @@ -11,7 +11,7 @@ import SnapKit class CreateNickNameViewController: BaseViewController { - let settingService: SettingProtocol = SettingAPI(apiService: APIService()) + private let settingRepository: SettingRepository = SettingRepositoryImpl() private var nickname: String = "" private let maxLength = 5 @@ -73,13 +73,11 @@ class CreateNickNameViewController: BaseViewController { } // MARK: - API - func requestNickname(setting: NicknameDTO) { + func requestNickname(nickname: NicknameDTO) { Task { do { - let data = try await settingService.putChangeNickname(body: setting) - if let nickname = data { - UserDefaultHandler.setNickname(nickname: nickname) - } + let data = try await self.settingRepository.putUserInfo(nickname: nickname) + UserDefaultHandler.setNickname(nickname: data.nickname) } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { @@ -123,7 +121,7 @@ class CreateNickNameViewController: BaseViewController { if let text = roomsNameTextField.text, !text.isEmpty { nickname = text UserData.setValue(nickname, forKey: .nickname) - requestNickname(setting: NicknameDTO(nickname: nickname)) + requestNickname(nickname: NicknameDTO(nickname: nickname)) presentMainViewController() } } diff --git a/Manito/Manito/Screens/Interaction/OpenManittoViewController.swift b/Manito/Manito/Screens/Interaction/OpenManittoViewController.swift index 2ac72a58c..152048b2e 100644 --- a/Manito/Manito/Screens/Interaction/OpenManittoViewController.swift +++ b/Manito/Manito/Screens/Interaction/OpenManittoViewController.swift @@ -17,8 +17,8 @@ final class OpenManittoViewController: BaseViewController { // MARK: - property - private let openManittoService: DetailIngAPI = DetailIngAPI(apiService: APIService()) - private var friendsList: FriendList = FriendList(count: 0, members: []) + private let detailRoomRepository: DetailRoomRepository = DetailRoomRepositoryImpl() + private var friendsList: FriendListDTO = FriendListDTO(count: 0, members: []) private let roomId: String private let manittoNickname: String @@ -78,14 +78,12 @@ final class OpenManittoViewController: BaseViewController { private func fetchFriendList(roomId: String, manittoNickname: String, - completionHandler: @escaping (Result<(FriendList, Int), NetworkError>) -> Void) { + completionHandler: @escaping (Result<(FriendListDTO, Int), NetworkError>) -> Void) { Task { do { - let data = try await self.openManittoService.requestWithFriends(roomId: roomId) - if let list = data { - let manittoIndex = list.members?.firstIndex(where: { $0.nickname == manittoNickname }).map { Int($0) } ?? 0 - completionHandler(.success((list, manittoIndex))) - } + let data = try await self.detailRoomRepository.fetchWithFriend(roomId: roomId) + let manittoIndex = data.members?.firstIndex(where: { $0.nickname == manittoNickname }).map { Int($0) } ?? 0 + completionHandler(.success((data, manittoIndex))) } catch NetworkError.serverError { completionHandler(.failure(.serverError)) } catch NetworkError.encodingError { diff --git a/Manito/Manito/Screens/Login/LoginViewController.swift b/Manito/Manito/Screens/Login/LoginViewController.swift index 07aa4c7f0..47ff9a97e 100644 --- a/Manito/Manito/Screens/Login/LoginViewController.swift +++ b/Manito/Manito/Screens/Login/LoginViewController.swift @@ -24,7 +24,7 @@ final class LoginViewController: BaseViewController { // MARK: - property - private let loginService: LoginAPI = LoginAPI(apiService: APIService()) + private let loginRepository: LoginRepository = LoginRepositoryImpl() // MARK: - init @@ -99,26 +99,25 @@ extension LoginViewController: ASAuthorizationControllerDelegate { Task { do { - let response = try await self.loginService.dispatchAppleLogin(dto: LoginDTO(identityToken: tokenToString, fcmToken: UserDefaultStorage.fcmToken)) - - if let data = response { - UserDefaultHandler.setIsLogin(isLogin: true) - UserDefaultHandler.setAccessToken(accessToken: data.accessToken ?? "") - UserDefaultHandler.setRefreshToken(refreshToken: data.refreshToken ?? "") + let loginDTO = LoginRequestDTO(identityToken: tokenToString, fcmToken: UserDefaultStorage.fcmToken) + let data = try await self.loginRepository.dispatchAppleLogin(login: loginDTO) - guard data.nickname != nil else { - self.navigationController?.pushViewController(CreateNickNameViewController(), animated: true) - return - } - - UserDefaultHandler.setNickname(nickname: data.nickname ?? "") - UserDefaultHandler.setIsSetFcmToken(isSetFcmToken: true) - let storyboard = UIStoryboard(name: "Main", bundle: nil) - let viewController = storyboard.instantiateViewController(withIdentifier: "MainNavigationController") - viewController.modalPresentationStyle = .fullScreen - viewController.modalTransitionStyle = .crossDissolve - self.present(viewController, animated: true) + UserDefaultHandler.setIsLogin(isLogin: true) + UserDefaultHandler.setAccessToken(accessToken: data.accessToken ?? "") + UserDefaultHandler.setRefreshToken(refreshToken: data.refreshToken ?? "") + + guard data.nickname != nil else { + self.navigationController?.pushViewController(CreateNickNameViewController(), animated: true) + return } + + UserDefaultHandler.setNickname(nickname: data.nickname ?? "") + UserDefaultHandler.setIsSetFcmToken(isSetFcmToken: true) + let storyboard = UIStoryboard(name: "Main", bundle: nil) + let viewController = storyboard.instantiateViewController(withIdentifier: "MainNavigationController") + viewController.modalPresentationStyle = .fullScreen + viewController.modalTransitionStyle = .crossDissolve + self.present(viewController, animated: true) } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { diff --git a/Manito/Manito/Screens/Main/MainViewController.swift b/Manito/Manito/Screens/Main/MainViewController.swift index b4e260497..d98bc6242 100644 --- a/Manito/Manito/Screens/Main/MainViewController.swift +++ b/Manito/Manito/Screens/Main/MainViewController.swift @@ -98,8 +98,8 @@ final class MainViewController: BaseViewController { // MARK: - property - private let mainService: MainProtocol = MainAPI(apiService: APIService()) - private var rooms: [ParticipatingRoom]? + private let mainRepository: MainRepository = MainRepositoryImpl() + private var rooms: [RoomListItemDTO]? // MARK: - init @@ -283,8 +283,9 @@ final class MainViewController: BaseViewController { switch status { case .waiting: guard let index = index else { return } - let viewController = DetailWaitViewController(viewModel: DetailWaitViewModel(roomIndex: index, - detailWaitService: DetailWaitService(api: DetailWaitAPI(apiService: APIService())))) + let viewModel = DetailWaitViewModel(roomIndex: index, + detailWaitService: DetailWaitService(api: DetailRoomRepositoryImpl())) + let viewController = DetailWaitViewController(viewModel: viewModel) self.navigationController?.pushViewController(viewController, animated: true) default: @@ -313,8 +314,8 @@ final class MainViewController: BaseViewController { private func requestCommonMission() { Task { do { - let data = try await self.mainService.fetchCommonMission() - if let commonMission = data?.mission { + let data = try await self.mainRepository.fetchCommonMission() + if let commonMission = data.mission { self.commonMissionView.missionLabel.text = commonMission } } catch NetworkError.serverError { @@ -330,13 +331,10 @@ final class MainViewController: BaseViewController { private func requestManittoRoomList() { Task { do { - let data = try await self.mainService.fetchManittoList() - - if let manittoList = data { - self.rooms = manittoList.participatingRooms - self.listCollectionView.reloadData() - self.stopSkeletonView() - } + let data = try await self.mainRepository.fetchManittoList() + self.rooms = data.participatingRooms + self.listCollectionView.reloadData() + self.stopSkeletonView() } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { diff --git a/Manito/Manito/Screens/Setting/ChangeNickNameViewController.swift b/Manito/Manito/Screens/Setting/ChangeNickNameViewController.swift index 675bd2627..65eb0e2af 100644 --- a/Manito/Manito/Screens/Setting/ChangeNickNameViewController.swift +++ b/Manito/Manito/Screens/Setting/ChangeNickNameViewController.swift @@ -10,8 +10,8 @@ import UIKit import SnapKit class ChangeNickNameViewController: BaseViewController { - - let settingService: SettingProtocol = SettingAPI(apiService: APIService()) + + private let settingRepository: SettingRepository = SettingRepositoryImpl() private var nickname: String = UserDefaultStorage.nickname private var maxLength = 5 @@ -127,7 +127,7 @@ class ChangeNickNameViewController: BaseViewController { func requestChangeNickname(nickname: NicknameDTO) { Task { do { - let _ = try await settingService.putChangeNickname(body: nickname) + let _ = try await self.settingRepository.putUserInfo(nickname: nickname) } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { From 5e3fddd1e8af9b36d71d0ba6bf920f3b105983f3 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 21:46:24 +0900 Subject: [PATCH 354/468] =?UTF-8?q?[CHORE]=20ChooseCharacter,=20Participat?= =?UTF-8?q?eRoom,=20CheckRoom,=20Letter=20=EB=B6=80=EB=B6=84=20DTO=20?= =?UTF-8?q?=EC=88=98=EC=A0=95(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTO/Response/MessageListItemDTO.swift | 13 ++++++- .../Data/DTO/Response/RoomInfoDTO.swift | 2 +- .../RoomParticipationRepository.swift | 4 +-- .../Domain/Entity/MessageListItem.swift | 2 +- .../CheckRoom/CheckRoomViewController.swift | 10 +++--- .../ChooseCharacterViewController.swift | 11 +++--- .../Letter/Services/LetterService.swift | 36 +++++++------------ .../Letter/ViewModels/LetterViewModel.swift | 16 ++++----- .../CreateLetterViewController.swift | 11 +++--- .../LetterViewController.swift | 19 +++++----- .../Letter/Views/Views/LetterView.swift | 2 +- .../ParticipateRoomViewController.swift | 23 ++++++------ 12 files changed, 72 insertions(+), 77 deletions(-) diff --git a/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift b/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift index 42a119163..8acd3f978 100644 --- a/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift +++ b/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift @@ -12,5 +12,16 @@ struct MessageListItemDTO: Decodable { let content: String? let imageUrl: String? let createdDate: String? - let missionInfo: Mission? + let missionInfo: IndividualMissionDTO? +} + +extension MessageListItemDTO { + func toMessageListItem(canReport: Bool) -> MessageListItem { + return MessageListItem(id: self.id ?? 0, + content: self.content ?? "", + imageUrl: self.imageUrl ?? "", + createdDate: self.createdDate ?? "", + missionInfo: self.missionInfo ?? IndividualMissionDTO(id: 0, content: ""), + canReport: canReport) + } } diff --git a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift index 2f39886d5..f06b93ce1 100644 --- a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift +++ b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift @@ -40,7 +40,7 @@ struct InvitationCodeDTO: Decodable { let code: String? } -struct IndividualMissionDTO: Decodable { +struct IndividualMissionDTO: Decodable, Hashable { let id: Int? let content: String? } diff --git a/Manito/Manito/Data/Repository/RoomParticipationRepository.swift b/Manito/Manito/Data/Repository/RoomParticipationRepository.swift index 473bf9fcb..b2e8dc7e4 100644 --- a/Manito/Manito/Data/Repository/RoomParticipationRepository.swift +++ b/Manito/Manito/Data/Repository/RoomParticipationRepository.swift @@ -11,7 +11,7 @@ import MTNetwork protocol RoomParticipationRepository { func dispatchCreateRoom(room: CreatedRoomRequestDTO) async throws -> Int - func dispatchVerifyCode(code: String) async throws -> InvitationCodeDTO + func dispatchVerifyCode(code: String) async throws -> ParticipatedRoomInfoDTO func dispatchJoinRoom(roomId: String, member: MemberInfoRequestDTO) async throws -> Int } @@ -25,7 +25,7 @@ final class RoomParticipationRepositoryImpl: RoomParticipationRepository { return response.statusCode } - func dispatchVerifyCode(code: String) async throws -> InvitationCodeDTO { + func dispatchVerifyCode(code: String) async throws -> ParticipatedRoomInfoDTO { let response = try await self.provider .request(.dispatchVerifyCode(code: code)) return try response.decode() diff --git a/Manito/Manito/Domain/Entity/MessageListItem.swift b/Manito/Manito/Domain/Entity/MessageListItem.swift index 6a4b7e1ce..9a21b3984 100644 --- a/Manito/Manito/Domain/Entity/MessageListItem.swift +++ b/Manito/Manito/Domain/Entity/MessageListItem.swift @@ -7,7 +7,7 @@ import Foundation -struct MessageListItem { +struct MessageListItem: Hashable { let id: Int let content: String let imageUrl: String diff --git a/Manito/Manito/Screens/CheckRoom/CheckRoomViewController.swift b/Manito/Manito/Screens/CheckRoom/CheckRoomViewController.swift index 6844db072..6a4a3a9d6 100644 --- a/Manito/Manito/Screens/CheckRoom/CheckRoomViewController.swift +++ b/Manito/Manito/Screens/CheckRoom/CheckRoomViewController.swift @@ -11,7 +11,7 @@ import SnapKit class CheckRoomViewController: BaseViewController { var roomId: Int? - var verification: VerificationCode? + var roomInfo: ParticipatedRoomInfoDTO? // MARK: - Property @@ -117,10 +117,10 @@ class CheckRoomViewController: BaseViewController { // MARK: - func private func setupViewController() { - guard let title = verification?.title, - let startDate = verification?.startDate, - let endDate = verification?.endDate, - let capacity = verification?.capacity else { return } + guard let title = roomInfo?.title, + let startDate = roomInfo?.startDate, + let endDate = roomInfo?.endDate, + let capacity = roomInfo?.capacity else { return } roomInfoView.roomLabel.text = title roomInfoView.dateLabel.text = "\(startDate) ~ \(endDate)" roomInfoView.peopleInfoView.peopleLabel.text = "X \(capacity)인" diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index 0d66f4bba..c0ebe3eba 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -17,7 +17,7 @@ final class ChooseCharacterViewController: BaseViewController { // MARK: - property - private let roomService: RoomProtocol = RoomAPI(apiService: APIService()) + private let roomParticipationRepository: RoomParticipationRepository = RoomParticipationRepositoryImpl() private let roomId: Int? // MARK: - init @@ -69,9 +69,8 @@ final class ChooseCharacterViewController: BaseViewController { private func pushDetailWaitViewController(roomId: Int) { guard let navigationController = self.presentingViewController as? UINavigationController else { return } - - let viewController = DetailWaitViewController(viewModel: DetailWaitViewModel(roomIndex: roomId, - detailWaitService: DetailWaitService(api: DetailWaitAPI(apiService: APIService())))) + let viewModel = DetailWaitViewModel(roomIndex: roomId, detailWaitService: DetailWaitService(api: DetailRoomRepositoryImpl())) + let viewController = DetailWaitViewController(viewModel: viewModel) self.dismiss(animated: true) { navigationController.pushViewController(viewController, animated: true) } @@ -89,8 +88,8 @@ final class ChooseCharacterViewController: BaseViewController { Task { do { guard let roomId = self.roomId else { return } - let status = try await self.roomService.dispatchJoinRoom(roodId: roomId.description, - dto: MemberDTO(colorIndex: characterIndex)) + let status = try await self.roomParticipationRepository.dispatchJoinRoom(roomId: roomId.description, + member: MemberInfoRequestDTO(colorIndex: characterIndex)) if status == 201 { self.pushDetailWaitViewController(roomId: roomId) } diff --git a/Manito/Manito/Screens/Letter/Services/LetterService.swift b/Manito/Manito/Screens/Letter/Services/LetterService.swift index e954fd482..242693d32 100644 --- a/Manito/Manito/Screens/Letter/Services/LetterService.swift +++ b/Manito/Manito/Screens/Letter/Services/LetterService.swift @@ -12,8 +12,8 @@ protocol LetterServicable { var manitteeId: String? { get set } var nickname: String { get set } - func fetchSendLetter(roomId: String) async throws -> [Message] - func fetchReceiveLetter(roomId: String) async throws -> [Message] + func fetchSendLetter(roomId: String) async throws -> [MessageListItemDTO] + func fetchReceiveLetter(roomId: String) async throws -> [MessageListItemDTO] func loadNickname() } @@ -24,26 +24,21 @@ final class LetterService: LetterServicable { @Published var manitteeId: String? @Published var nickname: String = "" - private let api: LetterProtocol + private let repository: LetterRepository // MARK: - init - init(api: LetterProtocol) { - self.api = api + init(repository: LetterRepository) { + self.repository = repository } // MARK: - Public - func - func fetchSendLetter(roomId: String) async throws -> [Message] { + func fetchSendLetter(roomId: String) async throws -> [MessageListItemDTO] { do { - let letterData = try await self.api.fetchSendLetter(roomId: roomId) - if let letterData { - self.setManitteeId(letterData.manittee?.id) - - return letterData.messages - } else { - throw NetworkError.serverError - } + let letterData = try await self.repository.fetchSendLetter(roomId: roomId) + self.setManitteeId(letterData.manittee?.id) + return letterData.messages } catch NetworkError.serverError { throw NetworkError.serverError } catch NetworkError.clientError(let message) { @@ -51,16 +46,11 @@ final class LetterService: LetterServicable { } } - func fetchReceiveLetter(roomId: String) async throws -> [Message] { + func fetchReceiveLetter(roomId: String) async throws -> [MessageListItemDTO] { do { - let letterData = try await self.api.fetchReceiveLetter(roomId: roomId) - if let letterData { - self.setManitteeId(letterData.manittee?.id) - - return letterData.messages - } else { - throw NetworkError.serverError - } + let letterData = try await self.repository.fetchReceiveLetter(roomId: roomId) + self.setManitteeId(letterData.manittee?.id) + return letterData.messages } catch NetworkError.serverError { throw NetworkError.serverError } catch NetworkError.clientError(let message) { diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift index fae832bab..b96cf44e9 100644 --- a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -32,7 +32,7 @@ final class LetterViewModel: ViewModelType { } struct Output { - let messages: AnyPublisher<[Message]?, Error> + let messages: AnyPublisher<[MessageListItem]?, Error> let index: AnyPublisher let messageDetails: AnyPublisher let reportDetails: AnyPublisher @@ -122,7 +122,7 @@ final class LetterViewModel: ViewModelType { return currentIndex } - private func fetchMessages(with type: MessageType) async throws -> [Message] { + private func fetchMessages(with type: MessageType) async throws -> [MessageListItem] { let roomId = self.messageDetails.roomId switch type { @@ -140,12 +140,12 @@ extension LetterViewModel { return type.rawValue } - private func fetchSendMessages(roomId: String, type: MessageType) async throws -> [Message] { + private func fetchSendMessages(roomId: String, type: MessageType) async throws -> [MessageListItem] { let messages = try await self.service.fetchSendLetter(roomId: roomId) return self.insertReportState(type, in: messages) } - private func fetchReceivedMessages(roomId: String, type: MessageType) async throws -> [Message] { + private func fetchReceivedMessages(roomId: String, type: MessageType) async throws -> [MessageListItem] { let messages = try await self.service.fetchReceiveLetter(roomId: roomId) return self.insertReportState(type, in: messages) } @@ -155,11 +155,7 @@ extension LetterViewModel { self.messageDetails.manitteeId = manitteeId } - private func insertReportState(_ type: MessageType, in messages: [Message]) -> [Message] { - return messages.map { item in - var item = item - item.canReport = (type == .received) - return item - } + private func insertReportState(_ type: MessageType, in messages: [MessageListItemDTO]) -> [MessageListItem] { + return messages.map { $0.toMessageListItem(canReport: (type == .received)) } } } diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/CreateLetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/CreateLetterViewController.swift index f31ac5a3e..b62618a35 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/CreateLetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/CreateLetterViewController.swift @@ -21,7 +21,7 @@ final class CreateLetterViewController: BaseViewController { // MARK: - property - private let letterSevice: LetterAPI = LetterAPI(apiService: APIService()) + private let letterRepository: LetterRepository = LetterRepositoryImpl() private let mission: String private let manitteeId: String private let roomId: String @@ -83,12 +83,15 @@ final class CreateLetterViewController: BaseViewController { // MARK: - network - private func dispatchLetter(with letterDTO: LetterDTO, + private func dispatchLetter(with letterDTO: LetterRequestDTO, _ jpegData: Data? = nil, completionHandler: @escaping ((Result) -> Void)) { Task { do { - let statusCode = try await self.letterSevice.dispatchLetter(roomId: self.roomId, image: jpegData, letter: letterDTO, missionId: self.missionId) + let statusCode = try await self.letterRepository.dispatchLetter(roomId: self.roomId, + image: jpegData, + letter: letterDTO, + missionId: self.missionId) switch statusCode { case 200..<300: completionHandler(.success(())) default: completionHandler(.failure(.unknownError)) @@ -120,7 +123,7 @@ extension CreateLetterViewController: CreateLetterViewDelegate { func sendLetterToManittee(with content: String?, _ image: UIImage?) { let jpegData = image?.jpegData(compressionQuality: 0.3) - let letterDTO = LetterDTO(manitteeId: self.manitteeId, messageContent: content) + let letterDTO = LetterRequestDTO(manitteeId: self.manitteeId, messageContent: content) self.createLetterView.sending = true self.dispatchLetter(with: letterDTO, jpegData) { [weak self] response in diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index cea1ca2a4..9050691eb 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -18,8 +18,8 @@ final class LetterViewController: BaseViewController { private let letterView: LetterView = LetterView() - private var dataSource: UICollectionViewDiffableDataSource! - private var snapShot: NSDiffableDataSourceSnapshot! + private var dataSource: UICollectionViewDiffableDataSource! + private var snapShot: NSDiffableDataSourceSnapshot! // MARK: - property @@ -131,7 +131,7 @@ final class LetterViewController: BaseViewController { .store(in: &self.cancelBag) } - private func bindCell(_ cell: LetterCollectionViewCell, with item: Message) { + private func bindCell(_ cell: LetterCollectionViewCell, with item: MessageListItem) { cell.reportButtonTapPublisher .sink(receiveValue: { [weak self] content in if let content { @@ -144,8 +144,7 @@ final class LetterViewController: BaseViewController { cell.imageViewTapGesturePublisher .sink(receiveValue: { [weak self] _ in - guard let imageUrl = item.imageUrl else { return } - let viewController = LetterImageViewController(imageUrl: imageUrl) + let viewController = LetterImageViewController(imageUrl: item.imageUrl) viewController.modalPresentationStyle = .fullScreen viewController.modalTransitionStyle = .crossDissolve self?.present(viewController, animated: true) @@ -176,7 +175,7 @@ extension LetterViewController { message: TextLiteral.letterViewControllerErrorDescription) } - private func handleMessageList(_ messages: [Message]?) { + private func handleMessageList(_ messages: [MessageListItem]?) { guard let messages else { self.showErrorAlert() return @@ -218,8 +217,8 @@ extension LetterViewController { self.configureSnapshot() } - private func letterCollectionViewDataSource() -> UICollectionViewDiffableDataSource { - let letterCellRegistration = UICollectionView.CellRegistration { + private func letterCollectionViewDataSource() -> UICollectionViewDiffableDataSource { + let letterCellRegistration = UICollectionView.CellRegistration { [weak self] cell, indexPath, item in cell.configureCell((mission: item.mission, date: item.date, @@ -263,12 +262,12 @@ extension LetterViewController { // MARK: - Snapshot extension LetterViewController { private func configureSnapshot() { - self.snapShot = NSDiffableDataSourceSnapshot() + self.snapShot = NSDiffableDataSourceSnapshot() self.snapShot.appendSections([.main]) self.dataSource.apply(self.snapShot, animatingDifferences: true) } - private func reloadMessageList(_ items: [Message]) { + private func reloadMessageList(_ items: [MessageListItem]) { let previousMessageData = self.snapShot.itemIdentifiers(inSection: .main) self.snapShot.deleteItems(previousMessageData) self.snapShot.appendItems(items, toSection: .main) diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index 837c56cb6..d44a98e77 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -103,7 +103,7 @@ final class LetterView: UIView { self.setupGuideView(in: viewController) } - func updateEmptyArea(with items: [Message]) { + func updateEmptyArea(with items: [MessageListItem]) { let isEmpty = items.isEmpty self.emptyLabel.isHidden = !isEmpty } diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift index 788295efa..093d8fab4 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift @@ -17,7 +17,7 @@ final class ParticipateRoomViewController: BaseViewController { // MARK: - property - private let checkRoomInfoService: RoomProtocol = RoomAPI(apiService: APIService()) + private let roomParticipationRepository: RoomParticipationRepository = RoomParticipationRepositoryImpl() // MARK: - init @@ -59,18 +59,15 @@ final class ParticipateRoomViewController: BaseViewController { private func dispatchInviteCode(_ code : String) { Task { do { - let data = try await self.checkRoomInfoService - .dispatchVerification(body: code) - if let info = data { - guard let id = info.id else { return } - let viewController = CheckRoomViewController() - viewController.modalPresentationStyle = .overFullScreen - viewController.modalTransitionStyle = .crossDissolve - viewController.verification = info - viewController.roomId = id - - self.present(viewController, animated: true) - } + let data = try await self.roomParticipationRepository.dispatchVerifyCode(code: code) + guard let id = data.id else { return } + let viewController = CheckRoomViewController() + viewController.modalPresentationStyle = .overFullScreen + viewController.modalTransitionStyle = .crossDissolve + viewController.roomInfo = data + viewController.roomId = id + + self.present(viewController, animated: true) } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { From d66a55d5349b7c719a4be33ff0b9bc5403050c75 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 22:56:03 +0900 Subject: [PATCH 355/468] =?UTF-8?q?[CHORE]=20Detail-Ing,=20Detail-Wait=20D?= =?UTF-8?q?TO=20=EC=88=98=EC=A0=95(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Data/DTO/Response/RoomInfoDTO.swift | 23 ++++++++ .../Data/DTO/Response/RoomListDTO.swift | 13 +++++ Manito/Manito/Domain/Entity/RoomInfo.swift | 19 +++++++ .../Detail-Ing/DetailingViewController.swift | 55 ++++++++----------- .../Detail-Ing/FriendListViewController.swift | 10 ++-- .../Detail-Ing/MemoryViewController.swift | 14 ++--- .../MissionEditViewController.swift | 12 ++-- .../Detail-Ing/View/DetailingView.swift | 30 ++++------ .../DetailEditViewController.swift | 34 ++++++------ .../DetailWaitViewController.swift | 2 +- .../Services/DetailWaitService.swift | 34 +++++------- .../Detail-Wait/View/DetailWaitView.swift | 20 +++---- .../ViewModel/DetailWaitViewModel.swift | 20 +++---- 13 files changed, 151 insertions(+), 135 deletions(-) diff --git a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift index f06b93ce1..bd78bdc75 100644 --- a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift +++ b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift @@ -31,11 +31,34 @@ struct RoomInfoDTO: Decodable { } } +extension RoomInfoDTO { + func toRoomInfo() -> RoomInfo { + let roomInformation = self.roomInformation?.toRoomListItem() + let participants = self.participants?.toParticipantList() + return RoomInfo(roomInformation: roomInformation!, + participants: participants!, + manittee: self.manittee ?? UserInfoDTO(id: "", nickname: ""), + manitto: self.manitto, + invitation: self.invitation ?? InvitationCodeDTO(code: ""), + didViewRoulette: self.didViewRoulette, + mission: self.mission, + admin: self.admin ?? false, + messages: self.messages) + } +} + struct ParticipantListDTO: Decodable { let count: Int? let members: [UserInfoDTO]? } +extension ParticipantListDTO { + func toParticipantList() -> ParticipantList { + return ParticipantList(count: self.count ?? 0, + members: self.members ?? []) + } +} + struct InvitationCodeDTO: Decodable { let code: String? } diff --git a/Manito/Manito/Data/DTO/Response/RoomListDTO.swift b/Manito/Manito/Data/DTO/Response/RoomListDTO.swift index 82dc4cc87..aa15d2d00 100644 --- a/Manito/Manito/Data/DTO/Response/RoomListDTO.swift +++ b/Manito/Manito/Data/DTO/Response/RoomListDTO.swift @@ -20,3 +20,16 @@ struct RoomListItemDTO: Decodable { let startDate: String? let endDate: String? } + +extension RoomListItemDTO { + func toRoomListItem() -> RoomListItem { + return RoomListItem(id: self.id ?? 0, + title: self.title ?? "", + state: self.state ?? "", + participatingCount: self.participatingCount, + capacity: self.capacity ?? 0, + startDate: self.startDate ?? "", + endDate: self.endDate ?? "" + ) + } +} diff --git a/Manito/Manito/Domain/Entity/RoomInfo.swift b/Manito/Manito/Domain/Entity/RoomInfo.swift index 81636883e..5b15aaf1b 100644 --- a/Manito/Manito/Domain/Entity/RoomInfo.swift +++ b/Manito/Manito/Domain/Entity/RoomInfo.swift @@ -42,4 +42,23 @@ extension RoomInfo { startDate: roomInformation.startDate, endDate: roomInformation.endDate) } + + static let emptyRoom: RoomInfo = { + let roomList = RoomListItem(id: 0, + title: "", + state: "", + participatingCount: 0, + capacity: 0, + startDate: "", + endDate: "") + return RoomInfo(roomInformation: roomList, + participants: ParticipantList(count: 0, members: []), + manittee: UserInfoDTO(id: "", nickname: ""), + manitto: UserInfoDTO(id: "", nickname: ""), + invitation: InvitationCodeDTO(code: ""), + didViewRoulette: false, + mission: nil, + admin: false, + messages: nil) + }() } diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index b77901843..589c3b8c1 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -13,8 +13,7 @@ final class DetailingViewController: BaseViewController { // MARK: - property - private let detailIngService: DetailIngAPI = DetailIngAPI(apiService: APIService()) - private let detailDoneService: DetailDoneAPI = DetailDoneAPI(apiService: APIService()) + private let detailRoomRepository: DetailRoomRepository = DetailRoomRepositoryImpl() private let roomId: String private var missionId: String = "" @@ -118,7 +117,7 @@ final class DetailingViewController: BaseViewController { self.fetchRoomInformation() { [weak self] result in switch result { case .success(let roomInformation): - self?.detailingView.updateDetailingView(room: roomInformation) + self?.detailingView.updateDetailingView(room: roomInformation.toRoomInfo()) case .failure: print("error") } @@ -127,13 +126,11 @@ final class DetailingViewController: BaseViewController { // MARK: - network - private func fetchRoomInformation(completionHandler: @escaping ((Result) -> Void)) { + private func fetchRoomInformation(completionHandler: @escaping ((Result) -> Void)) { Task { do { - let data = try await detailIngService.requestStartingRoomInfo(roomId: roomId) - if let info = data { - completionHandler(.success(info)) - } + let data = try await detailRoomRepository.fetchRoomInfo(roomId: roomId) + completionHandler(.success(data)) } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { @@ -147,22 +144,20 @@ final class DetailingViewController: BaseViewController { func pushNavigationAfterRequestRoomInfo() { Task { do { - let data = try await detailIngService.requestStartingRoomInfo(roomId: self.roomId) - if let info = data { - guard let mission = info.mission?.content, - let missionId = info.mission?.id - else { return } - // FIXME: - RoomType를 View에서 바로 빼오지 않고 다른 방식으로 구현해야 합니다. - let service = LetterService(api: LetterAPI(apiService: APIService())) - let viewModel = LetterViewModel(service: service, - roomId: self.roomId, - mission: mission, - missionId: missionId.description, - roomState: self.detailingView.roomType.rawValue, - messageType: .received) - let letterViewController = LetterViewController(viewModel: viewModel) - self.navigationController?.pushViewController(letterViewController, animated: true) - } + let data = try await self.detailRoomRepository.fetchRoomInfo(roomId: self.roomId) + guard let mission = data.mission?.content, + let missionId = data.mission?.id + else { return } + // FIXME: - RoomType를 View에서 바로 빼오지 않고 다른 방식으로 구현해야 합니다. + let service = LetterService(repository: LetterRepositoryImpl()) + let viewModel = LetterViewModel(service: service, + roomId: self.roomId, + mission: mission, + missionId: missionId.description, + roomState: self.detailingView.roomType.rawValue, + messageType: .received) + let letterViewController = LetterViewController(viewModel: viewModel) + self.navigationController?.pushViewController(letterViewController, animated: true) } } } @@ -170,7 +165,7 @@ final class DetailingViewController: BaseViewController { private func requestExitRoom(completionHandler: @escaping ((Result) -> Void)) { Task { do { - let statusCode = try await detailDoneService.requestExitRoom(roomId: roomId) + let statusCode = try await self.detailRoomRepository.deleteLeaveRoom(roomId: roomId) switch statusCode { case 200..<300: completionHandler(.success(())) default: completionHandler(.failure(.unknownError)) @@ -189,7 +184,7 @@ final class DetailingViewController: BaseViewController { private func requestDeleteRoom(completionHandler: @escaping ((Result) -> Void)) { Task { do { - let statusCode = try await detailDoneService.requestDeleteRoom(roomId: roomId) + let statusCode = try await self.detailRoomRepository.deleteRoom(roomId: roomId) switch statusCode { case 200..<300: completionHandler(.success(())) default: completionHandler(.failure(.unknownError)) @@ -207,10 +202,8 @@ final class DetailingViewController: BaseViewController { private func requestResetMission(roomId: String, completionHandler: @escaping ((Result) -> Void)) { Task { do { - let data = try await self.detailIngService.fetchResetMission(roomId: roomId) - if let _ = data { - completionHandler(.success(())) - } + let data = try await self.detailRoomRepository.fetchResetMission(roomId: roomId) + completionHandler(.success(())) } catch NetworkError.serverError { completionHandler(.failure(.serverError)) } catch NetworkError.clientError(let message) { @@ -248,7 +241,7 @@ extension DetailingViewController: DetailingDelegate { mission: String, missionId: String) { // FIXME: - RoomType를 View에서 바로 빼오지 않고 다른 방식으로 구현해야 합니다. - let service = LetterService(api: LetterAPI(apiService: APIService())) + let service = LetterService(repository: LetterRepositoryImpl()) let viewModel = LetterViewModel(service: service, roomId: self.roomId, mission: mission, diff --git a/Manito/Manito/Screens/Detail-Ing/FriendListViewController.swift b/Manito/Manito/Screens/Detail-Ing/FriendListViewController.swift index 872e65fdd..15738a2e7 100644 --- a/Manito/Manito/Screens/Detail-Ing/FriendListViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/FriendListViewController.swift @@ -8,12 +8,12 @@ import UIKit final class FriendListViewController: BaseViewController { - var friendArray: [Member] = [] { + var friendArray: [MemberInfoDTO] = [] { didSet { friendListCollectionView.reloadData() } } - var detailIngService: DetailIngAPI = DetailIngAPI(apiService: APIService()) + var detailRoomRepository: DetailRoomRepository = DetailRoomRepositoryImpl() var roomIndex: Int = 0 @@ -51,10 +51,8 @@ final class FriendListViewController: BaseViewController { private func requestWithFriends() { Task { do { - let data = try await detailIngService.requestWithFriends(roomId: "\(roomIndex)") - if let list = data { - friendArray = list.members ?? [] - } + let data = try await self.detailRoomRepository.fetchWithFriend(roomId: "\(roomIndex)") + friendArray = data.members ?? [] } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { diff --git a/Manito/Manito/Screens/Detail-Ing/MemoryViewController.swift b/Manito/Manito/Screens/Detail-Ing/MemoryViewController.swift index 6692e05d8..c5d6ea7e3 100644 --- a/Manito/Manito/Screens/Detail-Ing/MemoryViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/MemoryViewController.swift @@ -88,14 +88,14 @@ final class MemoryViewController: BaseViewController { return view }() - private var detailDoneService: DetailDoneAPI = DetailDoneAPI(apiService: APIService()) + private var detailRoomRepository: DetailRoomRepository = DetailRoomRepositoryImpl() private var memoryType: MemoryType = .manittee { willSet { setupData(with: newValue) self.memoryCollectionView.reloadData() } } - private var memory: Memory? + private var memory: MemoryDTO? private var roomId: String // MARK: - init @@ -244,12 +244,10 @@ final class MemoryViewController: BaseViewController { private func requestMemory(roomId: String) { Task { do { - let data = try await detailDoneService.requestMemory(roomId: roomId) - if let memory = data { - self.memory = memory - self.setupData(with: .manittee) - self.memoryCollectionView.reloadData() - } + let data = try await self.detailRoomRepository.fetchMemory(roomId: roomId) + self.memory = data + self.setupData(with: .manittee) + self.memoryCollectionView.reloadData() } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { diff --git a/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift index 9f519ad43..d3673971a 100644 --- a/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift @@ -19,7 +19,7 @@ final class MissionEditViewController: BaseViewController { let mission: String let roomId: String - private let missionEditService: MissionEditAPI = MissionEditAPI(apiService: APIService()) + private let detailRoomRepository: DetailRoomRepository = DetailRoomRepositoryImpl() private weak var delegate: MissionEditDelegate? // MARK: - component @@ -178,13 +178,9 @@ final class MissionEditViewController: BaseViewController { private func patchEditMission(mission: String, completionHandler: @escaping ((Result) -> Void)) { Task { do { - let data = try await self.missionEditService.patchEditMission(roomId: self.roomId, - body: MissionDTO(mission: mission)) - if let _ = data { - completionHandler(.success(())) - } else { - completionHandler(.failure(.unknownError)) - } + let data = try await self.detailRoomRepository.patchEditMission(roomId: roomId, + mission: EditedMissionRequestDTO(mission: mission)) + completionHandler(.success(())) } catch NetworkError.serverError { completionHandler(.failure(.serverError)) } catch NetworkError.clientError(let message) { diff --git a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift index 743bec006..39866eae5 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift @@ -417,23 +417,15 @@ final class DetailingView: UIView { navigationItem?.rightBarButtonItem = exitButton } - func updateDetailingView(room: Room) { - guard let state = room.roomInformation?.state, - let title = room.roomInformation?.title, - let startDate = room.roomInformation?.startDate, - let endDate = room.roomInformation?.endDate, - let manittee = room.manittee?.nickname, - let admin = room.admin, - let badgeCount = room.messages?.count - else { return } - self.roomType = RoomType.init(rawValue: state) ?? .PROCESSING + func updateDetailingView(room: RoomInfo) { + self.roomType = RoomType.init(rawValue: room.roomInformation.state) ?? .PROCESSING self.missionId = room.mission?.id?.description ?? "" DispatchQueue.main.async { - self.titleLabel.text = title - self.periodLabel.text = "\(startDate.subStringToDate()) ~ \(endDate.subStringToDate())" - self.manitteeAnimationLabel.text = manittee - self.setupBadge(count: badgeCount) - self.updateMissionEditButton(admin, type: self.roomType) + self.titleLabel.text = room.roomInformation.title + self.periodLabel.text = "\(room.roomInformation.startDate.subStringToDate()) ~ \(room.roomInformation.endDate.subStringToDate())" + self.manitteeAnimationLabel.text = room.manittee.nickname + self.setupBadge(count: room.messages?.count ?? 0) + self.updateMissionEditButton(room.admin, type: self.roomType) if self.roomType == .PROCESSING { self.setupProcessingUI() guard let missionContent = room.mission?.content, @@ -442,13 +434,13 @@ final class DetailingView: UIView { else { return } self.missionContentsLabel.attributedText = NSAttributedString(string: missionContent) self.manittoNickname = manittoNickname - if !didView && !admin { - self.delegate?.didNotShowManitteeView(manitteeName: manittee) + if !didView && !room.admin { + self.delegate?.didNotShowManitteeView(manitteeName: room.manittee.nickname ?? "") } - self.setupManittoOpenButton(date: endDate) + self.setupManittoOpenButton(date: room.roomInformation.endDate) } else { self.setupPostUI() - self.setupExitButton(admin: admin) + self.setupExitButton(admin: room.admin) } } } diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index b9ed537cc..10b5755f8 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -18,13 +18,13 @@ final class DetailEditViewController: BaseViewController { // MARK: - property private let editMode: DetailEditView.EditMode - private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) - private let room: Room + private let detailRoomRepository: DetailRoomRepository = DetailRoomRepositoryImpl() + private let room: RoomInfo weak var detailWaitDelegate: DetailWaitViewControllerDelegate? // MARK: - init - init(editMode: DetailEditView.EditMode, room: Room) { + init(editMode: DetailEditView.EditMode, room: RoomInfo) { self.detailEditView = DetailEditView(editMode: editMode) self.editMode = editMode self.room = room @@ -71,13 +71,13 @@ final class DetailEditViewController: BaseViewController { } private func setupCalendarDateRange() { - guard let startDate = self.room.roomInformation?.startDate, - let endDate = self.room.roomInformation?.endDate else { return } + let startDate = self.room.roomInformation.startDate + let endDate = self.room.roomInformation.endDate self.detailEditView.setupDateRange(from: startDate, to: endDate) } private func setupMemberSliderValue() { - guard let capacity = self.room.roomInformation?.capacity else { return } + let capacity = self.room.roomInformation.capacity self.detailEditView.setupSliderValue(capacity) } @@ -102,12 +102,12 @@ final class DetailEditViewController: BaseViewController { // MARK: - network - private func putRoomInfo(roomDto: RoomDTO, completionHandler: @escaping ((Result) -> Void)) { - guard let roomIndex = self.room.roomInformation?.id else { return } + private func putRoomInfo(roomDTO: CreatedRoomInfoRequestDTO, completionHandler: @escaping ((Result) -> Void)) { + let roomIndex = self.room.roomInformation.id Task { do { - let status = try await self.detailWaitService.editRoomInfo(roomId: roomIndex.description, - roomInfo: roomDto) + let status = try await self.detailRoomRepository.putRoomInfo(roomId: roomIndex.description, + roomInfo: roomDTO) switch status { case 200..<300: completionHandler(.success(())) @@ -135,14 +135,14 @@ extension DetailEditViewController: DetailEditDelegate { } func changeButtonDidTap(capacity: Int, from startDate: String, to endDate: String) { - guard let roomTitle = self.room.roomInformation?.title, - let currentUserCount = self.room.participants?.count else { return } - let dto = RoomDTO(title: roomTitle, - capacity: capacity, - startDate: "20\(startDate)", - endDate: "20\(endDate)") + let roomTitle = self.room.roomInformation.title + let currentUserCount = self.room.participants.count + let dto = CreatedRoomInfoRequestDTO(title: roomTitle, + capacity: capacity, + startDate: "20\(startDate)", + endDate: "20\(endDate)") if currentUserCount <= capacity { - self.putRoomInfo(roomDto: dto) { [weak self] result in + self.putRoomInfo(roomDTO: dto) { [weak self] result in switch result { case .success: self?.detailWaitDelegate?.didTappedChangeButton() diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index d95b6e108..be34423dc 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -176,7 +176,7 @@ final class DetailWaitViewController: BaseViewController { .store(in: &self.cancellable) } - private func showDetailEditViewController(roomInformation: Room, mode: DetailEditView.EditMode) { + private func showDetailEditViewController(roomInformation: RoomInfo, mode: DetailEditView.EditMode) { let viewController = DetailEditViewController(editMode: mode, room: roomInformation) viewController.detailWaitDelegate = self self.present(viewController, animated: true) diff --git a/Manito/Manito/Screens/Detail-Wait/Services/DetailWaitService.swift b/Manito/Manito/Screens/Detail-Wait/Services/DetailWaitService.swift index a6e38fd2e..337c84ef7 100644 --- a/Manito/Manito/Screens/Detail-Wait/Services/DetailWaitService.swift +++ b/Manito/Manito/Screens/Detail-Wait/Services/DetailWaitService.swift @@ -8,28 +8,24 @@ import Foundation protocol DetailWaitServicable { - func fetchWaitingRoomInfo(roomId: String) async throws -> Room - func patchStartManitto(roomId: String) async throws -> Manittee + func fetchWaitingRoomInfo(roomId: String) async throws -> RoomInfoDTO + func patchStartManitto(roomId: String) async throws -> UserInfoDTO func deleteRoom(roomId: String) async throws -> Int func deleteLeaveRoom(roomId: String) async throws -> Int } final class DetailWaitService: DetailWaitServicable { - private let api: DetailWaitProtocol + private let repository: DetailRoomRepository - init(api: DetailWaitProtocol) { - self.api = api + init(repository: DetailRoomRepository) { + self.repository = repository } - func fetchWaitingRoomInfo(roomId: String) async throws -> Room { + func fetchWaitingRoomInfo(roomId: String) async throws -> RoomInfoDTO { do { - let roomData = try await self.api.getWaitingRoomInfo(roomId: roomId) - if let roomData { - return roomData - } else { - throw NetworkError.serverError - } + let roomData = try await self.repository.fetchRoomInfo(roomId: roomId) + return roomData } catch NetworkError.serverError { throw NetworkError.serverError } catch NetworkError.clientError(let message) { @@ -37,14 +33,10 @@ final class DetailWaitService: DetailWaitServicable { } } - func patchStartManitto(roomId: String) async throws -> Manittee { + func patchStartManitto(roomId: String) async throws -> UserInfoDTO { do { - let manitteeData = try await self.api.startManitto(roomId: roomId) - if let manitteeData { - return manitteeData - } else { - throw NetworkError.serverError - } + let manitteeData = try await self.repository.patchStartManitto(roomId: roomId) + return manitteeData } catch NetworkError.serverError { throw NetworkError.serverError } catch NetworkError.clientError(let message) { @@ -54,7 +46,7 @@ final class DetailWaitService: DetailWaitServicable { func deleteRoom(roomId: String) async throws -> Int { do { - let statusCode = try await self.api.deleteRoom(roomId: roomId) + let statusCode = try await self.repository.deleteRoom(roomId: roomId) return statusCode } catch NetworkError.serverError { throw NetworkError.serverError @@ -65,7 +57,7 @@ final class DetailWaitService: DetailWaitServicable { func deleteLeaveRoom(roomId: String) async throws -> Int { do { - let statusCode = try await self.api.deleteLeaveRoom(roomId: roomId) + let statusCode = try await self.repository.deleteLeaveRoom(roomId: roomId) return statusCode } catch NetworkError.serverError { throw NetworkError.serverError diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 470094c00..53a1b2f41 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -82,7 +82,7 @@ final class DetailWaitView: UIView { // MARK: - property - private var userArray: [User] = [] { + private var userArray: [UserInfoDTO] = [] { didSet { DispatchQueue.main.async { self.listTableView.reloadData() @@ -224,19 +224,13 @@ final class DetailWaitView: UIView { navigationItem?.rightBarButtonItem = moreButton } - func updateDetailWaitView(room: Room) { - guard let title = room.roomInformation?.title, - let state = room.roomInformation?.state, - let dateRange = room.roomInformation?.dateRangeText, - let users = room.participants?.members, - let isStart = room.roomInformation?.isStart, - let admin = room.admin - else { return } - - self.userArray = users + func updateDetailWaitView(room: RoomInfo) { + self.userArray = room.participants.members - self.setupTitleViewData(title: title, state: state, dateRange: dateRange) - self.setupRelatedViews(of: admin, isStart) + self.setupTitleViewData(title: room.roomInformation.title, + state: room.roomInformation.state, + dateRange: room.roomInformation.dateRangeText) + self.setupRelatedViews(of: room.admin, room.roomInformation.isStart) self.configureStartButton(room.canStart) self.configureUserCountLabel(userCount: room.userCount) diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index da8002619..7f1f7c75e 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -10,7 +10,7 @@ import Foundation final class DetailWaitViewModel { - typealias EditRoomInformation = (roomInformation: Room, mode: DetailEditView.EditMode) + typealias EditRoomInformation = (roomInformation: RoomInfo, mode: DetailEditView.EditMode) typealias PassedStartDateAndIsOwner = (passStartDate: Bool, isOwner: Bool) // MARK: - property @@ -19,7 +19,7 @@ final class DetailWaitViewModel { private let detailWaitService: DetailWaitServicable private var cancellable = Set() - private let roomInformationSubject = CurrentValueSubject(Room.emptyRoom) + private let roomInformationSubject = CurrentValueSubject(RoomInfo.emptyRoom) private let manitteeNicknameSubject = PassthroughSubject() private let deleteRoomSubject = PassthroughSubject() private let leaveRoomSubject = PassthroughSubject() @@ -36,7 +36,7 @@ final class DetailWaitViewModel { } struct Output { - let roomInformation: CurrentValueSubject + let roomInformation: CurrentValueSubject let code: AnyPublisher let manitteeNickname: PassthroughSubject let editRoomInformation: AnyPublisher @@ -69,7 +69,7 @@ final class DetailWaitViewModel { let editRoomInformationOutput = input.editMenuButtonDidTap .map { [weak self] _ -> EditRoomInformation in - guard let self else { return (Room.emptyRoom, .information) } + guard let self else { return (RoomInfo.emptyRoom, .information) } return self.makeEditRoomInformation() } .eraseToAnyPublisher() @@ -123,13 +123,13 @@ final class DetailWaitViewModel { // MARK: - func - func makeRoomInformation() -> Room { + func makeRoomInformation() -> RoomInfo { return self.roomInformationSubject.value } private func makeCode() -> String { let roomInformation = self.roomInformationSubject.value - guard let code = roomInformation.invitation?.code else { return "" } + guard let code = roomInformation.invitation.code else { return "" } return code } @@ -141,13 +141,11 @@ final class DetailWaitViewModel { private func makeIsAdmin() -> PassedStartDateAndIsOwner { let roomInformation = self.roomInformationSubject.value - guard let isAdmin = roomInformation.admin, - let isPassStartDate = roomInformation.roomInformation?.isStartDatePast else { return (false, false) } - return (isPassStartDate, isAdmin) + return (roomInformation.roomInformation.isStartDatePast, roomInformation.admin) } - func setRoomInformation(room: Room) { + func setRoomInformation(room: RoomInfo) { self.roomInformationSubject.send(room) } @@ -157,7 +155,7 @@ final class DetailWaitViewModel { Task { do { let room = try await self.detailWaitService.fetchWaitingRoomInfo(roomId: roomId) - self.roomInformationSubject.send(room) + self.roomInformationSubject.send(room.toRoomInfo()) } catch(let error) { guard let error = error as? NetworkError else { return } self.roomInformationSubject.send(completion: .failure(error)) From 81f1e1885f8e160b134e9bed6c33c55f64db2f8e Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 24 Aug 2023 23:20:03 +0900 Subject: [PATCH 356/468] =?UTF-8?q?[CHORE]=20InvitedCode,=20CreateRoom=20D?= =?UTF-8?q?TO=20=EC=88=98=EC=A0=95(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreateRoom/CreateRoomViewController.swift | 29 +++++++++---------- .../CreateRoom/View/CreateRoomView.swift | 16 +++++----- .../InvitedCodeViewController.swift | 4 +-- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index 3835125ee..deaaa71f8 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -17,7 +17,7 @@ final class CreateRoomViewController: BaseViewController { // MARK: - property - private let roomService: RoomProtocol = RoomAPI(apiService: APIService()) + private let roomParticipationRepository: RoomParticipationRepository = RoomParticipationRepositoryImpl() // MARK: - init @@ -61,9 +61,9 @@ final class CreateRoomViewController: BaseViewController { private func pushDetailWaitViewController(roomId: Int) { guard let navigationController = self.presentingViewController as? UINavigationController else { return } - - let viewController = DetailWaitViewController(viewModel: DetailWaitViewModel(roomIndex: roomId, - detailWaitService: DetailWaitService(api: DetailWaitAPI(apiService: APIService())))) + let viewModel = DetailWaitViewModel(roomIndex: roomId, + detailWaitService: DetailWaitService(repository: DetailRoomRepositoryImpl())) + let viewController = DetailWaitViewController(viewModel: viewModel) navigationController.popViewController(animated: true) navigationController.pushViewController(viewController, animated: false) @@ -75,10 +75,10 @@ final class CreateRoomViewController: BaseViewController { // MARK: - network - private func requestCreateRoom(room: CreateRoomDTO) { + private func requestCreateRoom(room: CreatedRoomRequestDTO) { Task { do { - guard let roomId = try await self.roomService.postCreateRoom(body: room) else { return } + let roomId = try await self.roomParticipationRepository.dispatchCreateRoom(room: room) self.pushDetailWaitViewController(roomId: roomId) } catch NetworkError.serverError { print("server Error") @@ -96,15 +96,12 @@ extension CreateRoomViewController: CreateRoomViewDelegate { self.dismiss(animated: true) } - func requestCreateRoom(roomInfo: RoomInfo, colorIndex: Int) { - guard let roomTitle = roomInfo.title, - let roomCapacity = roomInfo.capacity, - let roomStartDate = roomInfo.startDate, - let roomEndDate = roomInfo.endDate else { return } - self.requestCreateRoom(room: CreateRoomDTO(room: RoomDTO(title: roomTitle, - capacity: roomCapacity, - startDate: roomStartDate, - endDate: roomEndDate), - member: MemberDTO(colorIndex: colorIndex))) + func requestCreateRoom(roomInfo: RoomListItem, colorIndex: Int) { + let room = CreatedRoomInfoRequestDTO(title: roomInfo.title, + capacity: roomInfo.capacity, + startDate: roomInfo.startDate, + endDate: roomInfo.endDate) + let member = MemberInfoRequestDTO(colorIndex: colorIndex) + self.requestCreateRoom(room: CreatedRoomRequestDTO(room: room, member: member)) } } diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index 082f2bfcf..c00f0108e 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -11,7 +11,7 @@ import SnapKit protocol CreateRoomViewDelegate: AnyObject { func didTapCloseButton() - func requestCreateRoom(roomInfo: RoomInfo, colorIndex: Int) + func requestCreateRoom(roomInfo: RoomListItem, colorIndex: Int) } final class CreateRoomView: UIView { @@ -234,12 +234,14 @@ final class CreateRoomView: UIView { break case .chooseCharacter: let colorIndex = self.characterCollectionView.characterIndex - self.delegate?.requestCreateRoom(roomInfo: RoomInfo(id: nil, - capacity: self.roomInfoView.capacity, - title: self.roomInfoView.title, - startDate: "20\(self.roomDateView.calendarView.getTempStartDate())", - endDate: "20\(self.roomDateView.calendarView.getTempEndDate())", - state: nil), + let roomInfo = RoomListItem(id: 0, + title: self.roomInfoView.title, + state: "", + participatingCount: 0, + capacity: self.roomInfoView.capacity, + startDate: "20\(self.roomDateView.calendarView.getTempStartDate())", + endDate: "20\(self.roomDateView.calendarView.getTempEndDate())") + self.delegate?.requestCreateRoom(roomInfo: roomInfo, colorIndex: colorIndex) } } diff --git a/Manito/Manito/Screens/InvitedCode/InvitedCodeViewController.swift b/Manito/Manito/Screens/InvitedCode/InvitedCodeViewController.swift index 1bcc2d2ca..d0fc7f193 100644 --- a/Manito/Manito/Screens/InvitedCode/InvitedCodeViewController.swift +++ b/Manito/Manito/Screens/InvitedCode/InvitedCodeViewController.swift @@ -11,10 +11,10 @@ import SnapKit class InvitedCodeViewController: BaseViewController { - var roomInfo: RoomDTO + var roomInfo: RoomListItemDTO var code: String - init(roomInfo: RoomDTO, code: String){ + init(roomInfo: RoomListItemDTO, code: String){ self.roomInfo = roomInfo self.code = code super.init() From c6c811f151b1785a7158946baac4c5220b2852fe Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Fri, 25 Aug 2023 20:11:18 +0900 Subject: [PATCH 357/468] =?UTF-8?q?[CHORE]=20DTO,=20Repository=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9=20=EC=95=88=EB=90=9C=20=EB=B6=80=EB=B6=84=EC=97=90=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/Base/BaseViewController.swift | 2 +- .../ChooseCharacterViewController.swift | 2 +- .../DetailWaitViewController.swift | 24 ++++++++++--------- .../Interaction/View/OpenManittoView.swift | 6 ++--- .../Screens/Main/MainViewController.swift | 2 +- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Manito/Manito/Global/Base/BaseViewController.swift b/Manito/Manito/Global/Base/BaseViewController.swift index 1c87c2618..94f4faeba 100644 --- a/Manito/Manito/Global/Base/BaseViewController.swift +++ b/Manito/Manito/Global/Base/BaseViewController.swift @@ -20,7 +20,7 @@ class BaseViewController: UIViewController { return button }() - private let tokenService: TokenAPI = TokenAPI(apiService: APIService()) + private let tokenRepository: TokenRepository = TokenRepositoryImpl() // MARK: - init diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index c0ebe3eba..8a13b4566 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -69,7 +69,7 @@ final class ChooseCharacterViewController: BaseViewController { private func pushDetailWaitViewController(roomId: Int) { guard let navigationController = self.presentingViewController as? UINavigationController else { return } - let viewModel = DetailWaitViewModel(roomIndex: roomId, detailWaitService: DetailWaitService(api: DetailRoomRepositoryImpl())) + let viewModel = DetailWaitViewModel(roomIndex: roomId, detailWaitService: DetailWaitService(repository: DetailRoomRepositoryImpl())) let viewController = DetailWaitViewController(viewModel: viewModel) self.dismiss(animated: true) { navigationController.pushViewController(viewController, animated: true) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index be34423dc..5a4befcde 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -235,17 +235,19 @@ final class DetailWaitViewController: BaseViewController { @objc private func didTapEnterButton() { let roomInfo = self.detailWaitViewModel.makeRoomInformation() - guard let title = roomInfo.roomInformation?.title, - let capacity = roomInfo.roomInformation?.capacity, - let startDate = roomInfo.roomInformation?.startDate, - let endDate = roomInfo.roomInformation?.endDate, - let invitationCode = roomInfo.invitation?.code - else { return } - let roomDto = RoomDTO(title: title, - capacity: capacity, - startDate: startDate, - endDate: endDate) - let viewController = InvitedCodeViewController(roomInfo: roomDto, + let title = roomInfo.roomInformation.title + let capacity = roomInfo.roomInformation.capacity + let startDate = roomInfo.roomInformation.startDate + let endDate = roomInfo.roomInformation.endDate + guard let invitationCode = roomInfo.invitation.code else { return } + let roomDTO = RoomListItemDTO(id: nil, + title: title, + state: nil, + participatingCount: nil, + capacity: capacity, + startDate: startDate, + endDate: endDate) + let viewController = InvitedCodeViewController(roomInfo: roomDTO, code: invitationCode) viewController.modalPresentationStyle = .overCurrentContext viewController.modalTransitionStyle = .crossDissolve diff --git a/Manito/Manito/Screens/Interaction/View/OpenManittoView.swift b/Manito/Manito/Screens/Interaction/View/OpenManittoView.swift index b5190faf0..f4714eb8c 100644 --- a/Manito/Manito/Screens/Interaction/View/OpenManittoView.swift +++ b/Manito/Manito/Screens/Interaction/View/OpenManittoView.swift @@ -98,7 +98,7 @@ final class OpenManittoView: UIView { } } - private func animateManittoCollectionView(with friendList: FriendList, + private func animateManittoCollectionView(with friendList: FriendListDTO, _ manittoIndex: Int, _ manittoNickname: String) { let timeInterval: Double = 0.3 @@ -115,7 +115,7 @@ final class OpenManittoView: UIView { }) } - private func performRandomShuffleAnimation(with timeInterval: TimeInterval, _ friendList: FriendList) { + private func performRandomShuffleAnimation(with timeInterval: TimeInterval, _ friendList: FriendListDTO) { guard let count = friendList.count else { return } var countNumber: Int = 0 @@ -141,7 +141,7 @@ final class OpenManittoView: UIView { }) } - func setupManittoAnimation(friendList: FriendList, manittoIndex: Int, manittoNickname: String) { + func setupManittoAnimation(friendList: FriendListDTO, manittoIndex: Int, manittoNickname: String) { self.animateManittoCollectionView(with: friendList, manittoIndex, manittoNickname) self.manittoCollectionView.reloadData() } diff --git a/Manito/Manito/Screens/Main/MainViewController.swift b/Manito/Manito/Screens/Main/MainViewController.swift index d98bc6242..62469a2a7 100644 --- a/Manito/Manito/Screens/Main/MainViewController.swift +++ b/Manito/Manito/Screens/Main/MainViewController.swift @@ -284,7 +284,7 @@ final class MainViewController: BaseViewController { case .waiting: guard let index = index else { return } let viewModel = DetailWaitViewModel(roomIndex: index, - detailWaitService: DetailWaitService(api: DetailRoomRepositoryImpl())) + detailWaitService: DetailWaitService(repository: DetailRoomRepositoryImpl())) let viewController = DetailWaitViewController(viewModel: viewModel) self.navigationController?.pushViewController(viewController, animated: true) From 3b66f57cb9aa4cd662ab3f26950ee2e7c08b00e7 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Fri, 25 Aug 2023 20:26:54 +0900 Subject: [PATCH 358/468] =?UTF-8?q?[CHORE]=20ParticipantList=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=B0=9C=EC=83=9D=ED=95=98=EB=8A=94=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift index bd78bdc75..54362d890 100644 --- a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift +++ b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift @@ -36,7 +36,7 @@ extension RoomInfoDTO { let roomInformation = self.roomInformation?.toRoomListItem() let participants = self.participants?.toParticipantList() return RoomInfo(roomInformation: roomInformation!, - participants: participants!, + participants: participants ?? ParticipantList(count: 0, members: []), manittee: self.manittee ?? UserInfoDTO(id: "", nickname: ""), manitto: self.manitto, invitation: self.invitation ?? InvitationCodeDTO(code: ""), From a4d5f03c27c814a1b90db90680d72ee650f4a8b5 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Fri, 25 Aug 2023 20:37:32 +0900 Subject: [PATCH 359/468] =?UTF-8?q?[CHORE]=20Letter=20=EB=B6=80=EB=B6=84?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=B0=9C=EC=83=9D=ED=95=9C=20DTO=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift | 6 +++--- Manito/Manito/Domain/Entity/MessageListItem.swift | 8 ++++---- .../Views/ViewControllers/LetterViewController.swift | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift b/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift index 8acd3f978..90e6f71a6 100644 --- a/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift +++ b/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift @@ -18,10 +18,10 @@ struct MessageListItemDTO: Decodable { extension MessageListItemDTO { func toMessageListItem(canReport: Bool) -> MessageListItem { return MessageListItem(id: self.id ?? 0, - content: self.content ?? "", - imageUrl: self.imageUrl ?? "", + content: self.content, + imageUrl: self.imageUrl, createdDate: self.createdDate ?? "", - missionInfo: self.missionInfo ?? IndividualMissionDTO(id: 0, content: ""), + missionInfo: self.missionInfo, canReport: canReport) } } diff --git a/Manito/Manito/Domain/Entity/MessageListItem.swift b/Manito/Manito/Domain/Entity/MessageListItem.swift index 9a21b3984..b032a6053 100644 --- a/Manito/Manito/Domain/Entity/MessageListItem.swift +++ b/Manito/Manito/Domain/Entity/MessageListItem.swift @@ -9,10 +9,10 @@ import Foundation struct MessageListItem: Hashable { let id: Int - let content: String - let imageUrl: String + let content: String? + let imageUrl: String? let createdDate: String - let missionInfo: IndividualMissionDTO + let missionInfo: IndividualMissionDTO? let canReport: Bool var isToday: Bool { @@ -24,7 +24,7 @@ struct MessageListItem: Hashable { } var mission: String? { - guard let mission = missionInfo.content else { return nil } + guard let mission = missionInfo?.content else { return nil } return "\(date)의 개별미션\n[\(mission)]" } diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index 9050691eb..29531d611 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -144,7 +144,8 @@ final class LetterViewController: BaseViewController { cell.imageViewTapGesturePublisher .sink(receiveValue: { [weak self] _ in - let viewController = LetterImageViewController(imageUrl: item.imageUrl) + guard let imageUrl = item.imageUrl else { return } + let viewController = LetterImageViewController(imageUrl: imageUrl) viewController.modalPresentationStyle = .fullScreen viewController.modalTransitionStyle = .crossDissolve self?.present(viewController, animated: true) From 0ab3f086b023dd8abaf3660ded960f0d131bfd3f Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Fri, 25 Aug 2023 20:50:08 +0900 Subject: [PATCH 360/468] =?UTF-8?q?[CHORE]=20=EB=B0=A9=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EC=8B=9C=20=EC=83=9D=EA=B8=B0=EB=8A=94=20DTO=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Data/Repository/RoomParticipationRepository.swift | 4 +++- .../Screens/InvitedCode/InvitedCodeViewController.swift | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Data/Repository/RoomParticipationRepository.swift b/Manito/Manito/Data/Repository/RoomParticipationRepository.swift index b2e8dc7e4..4fd9e053a 100644 --- a/Manito/Manito/Data/Repository/RoomParticipationRepository.swift +++ b/Manito/Manito/Data/Repository/RoomParticipationRepository.swift @@ -22,7 +22,9 @@ final class RoomParticipationRepositoryImpl: RoomParticipationRepository { func dispatchCreateRoom(room: CreatedRoomRequestDTO) async throws -> Int { let response = try await self.provider .request(.dispatchCreateRoom(room: room)) - return response.statusCode + let location = response.response?.allHeaderFields["Location"] as? String + let roomId = Int(location?.split(separator: "/").last ?? "-1") ?? -1 + return roomId } func dispatchVerifyCode(code: String) async throws -> ParticipatedRoomInfoDTO { diff --git a/Manito/Manito/Screens/InvitedCode/InvitedCodeViewController.swift b/Manito/Manito/Screens/InvitedCode/InvitedCodeViewController.swift index d0fc7f193..256368dd7 100644 --- a/Manito/Manito/Screens/InvitedCode/InvitedCodeViewController.swift +++ b/Manito/Manito/Screens/InvitedCode/InvitedCodeViewController.swift @@ -48,14 +48,14 @@ class InvitedCodeViewController: BaseViewController { private lazy var roomDateLabel: UILabel = { let label = UILabel() label.font = .font(.regular, ofSize: 18) - label.text = "\(roomInfo.startDate) ~ \(roomInfo.endDate)" + label.text = "\(roomInfo.startDate ?? "") ~ \(roomInfo.endDate ?? "")" return label }() private let roomImage = UIImageView(image: ImageLiterals.imgCharacterBrown) private lazy var roomPersonLabel: UILabel = { let label = UILabel() label.font = .font(.regular, ofSize: 24) - label.text = "X \(roomInfo.capacity)인" + label.text = "X \(roomInfo.capacity ?? 0)인" return label }() private lazy var roomPersonView: UIView = { From 13933306adf72c617efb8b27a7866067d2e78843 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Sat, 26 Aug 2023 21:30:08 +0900 Subject: [PATCH 361/468] =?UTF-8?q?[CHORE]=20Parameter=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=EC=88=98=EC=A0=95(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift index db2e3ae20..793ac908d 100644 --- a/Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift +++ b/Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift @@ -49,13 +49,13 @@ extension LetterEndPoint: Requestable { if let image { let imageData = MultipartFormData(provider: .data(image), name: "image", - filename: "\(arc4random()).jpeg", + filename: "\(arc4random())", mimeType: "image/jpeg") multipartData.append(imageData) } - let parameters: [String: String?] = ["manitteeId": letter.manitteeId, - "messageContent": letter.messageContent, - "missionId": missionId] + let parameters: [String: Any] = ["manitteeId": letter.manitteeId, + "messageContent": letter.messageContent ?? "", + "missionId": missionId] let parametersData = MultipartFormData(provider: .parameter(parameters)) multipartData.append(parametersData) return .uploadMultipart(multipartData) From 1a1787d9ed432122a0cae3abc41775fe97ae24f4 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Sat, 26 Aug 2023 21:40:50 +0900 Subject: [PATCH 362/468] =?UTF-8?q?[DEL]=20Auto-Assign=20=EB=A9=A4?= =?UTF-8?q?=EB=B2=84=20=EC=A0=9C=EA=B1=B0(#495)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/auto_assign.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/auto_assign.yml b/.github/auto_assign.yml index b675edc2c..7b78dcbc4 100644 --- a/.github/auto_assign.yml +++ b/.github/auto_assign.yml @@ -9,8 +9,6 @@ reviewers: - YoonAh-dev - MMMIIIN - coby5502 - - CreoHwan - - sunchoi22 - dangsal # A list of keywords to be skipped the process that add reviewers if pull requests include it skipKeywords: From adc276df7401638405460eae6662b8e4d93c1c69 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Sat, 26 Aug 2023 22:08:23 +0900 Subject: [PATCH 363/468] =?UTF-8?q?[CHORE]=20CodingKey=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EB=B3=B5=EA=B5=AC(#490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift b/Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift index 69fb6441b..12e7bad2f 100644 --- a/Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift +++ b/Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift @@ -21,4 +21,8 @@ struct CreatedRoomInfoRequestDTO: Encodable { struct MemberInfoRequestDTO: Encodable { let colorIndex: Int + + enum CodingKeys: String, CodingKey { + case colorIndex = "colorIdx" + } } From 6c78100df3cff720ca9771a47a908934d3ac11b5 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 28 Aug 2023 00:39:16 +0900 Subject: [PATCH 364/468] =?UTF-8?q?[FEAT]=20MVVM=20=ED=98=95=EC=8B=9D?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreateRoom/CreateRoomViewController.swift | 102 +++++++------- .../UIComponent/CharacterCollectionView.swift | 6 +- .../UIComponent/CheckRoomInfoView.swift | 24 +--- .../UIComponent/InputCapacityView.swift | 5 - .../UIComponent/InputTitleView.swift | 42 ++---- .../CreateRoom/View/CreateRoomView.swift | 96 ++----------- .../ViewModel/CreateRoomViewModel.swift | 127 ++++++++++++++---- .../UIComponent/CalendarView.swift | 6 + 8 files changed, 184 insertions(+), 224 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index 73dc7b805..5578abd95 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -18,8 +18,6 @@ final class CreateRoomViewController: BaseViewController { // MARK: - property - private let roomService: RoomProtocol = RoomAPI(apiService: APIService()) - private var cancellable = Set() private let createRoomViewModel: CreateRoomViewModel @@ -51,12 +49,6 @@ final class CreateRoomViewController: BaseViewController { self.bindViewModel() } - // FIXME: 플로우 연결 하면서 변경 될 예정 - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - navigationController?.navigationBar.isHidden = true - } - // MARK: - override override func configureUI() { @@ -94,62 +86,74 @@ final class CreateRoomViewController: BaseViewController { } private func transformedOutput() -> CreateRoomViewModel.Output { - let input = CreateRoomViewModel.Input( - textFieldTextDidChanged: self.createRoomView.roomTitleView.textFieldPublisher.eraseToAnyPublisher(), - sliderValueDidChanged: self.createRoomView.roomCapacityView.sliderPublisher.eraseToAnyPublisher(), - calendarDateDidTap: self.createRoomView.calendarDidTapPublisher.eraseToAnyPublisher(), - nextButtonDidTap: self.createRoomView.nextButtonDidTapPublisher.eraseToAnyPublisher()) + let input = CreateRoomViewModel.Input(textFieldTextDidChanged: self.createRoomView.roomTitleView.textFieldPublisher.eraseToAnyPublisher(), + sliderValueDidChanged: self.createRoomView.roomCapacityView.sliderPublisher.eraseToAnyPublisher(), + startDateDidTap: self.createRoomView.roomDateView.calendarView.startDateTapPublisher.eraseToAnyPublisher(), + endDateDidTap: self.createRoomView.roomDateView.calendarView.endDateTapPublisher.eraseToAnyPublisher(), + characterIndexDidTap: self.createRoomView.characterCollectionView.characterIndexTapPublisher.eraseToAnyPublisher(), + nextButtonDidTap: self.createRoomView.nextButtonDidTapPublisher.eraseToAnyPublisher()) return self.createRoomViewModel.transform(from: input) } private func bindOutputToViewModel(_ output: CreateRoomViewModel.Output) { + output.title - .receive(on: DispatchQueue.main) .sink(receiveValue: { [weak self] title in - self?.createRoomView.roomTitleView.setCounter(count: title.count) self?.createRoomView.roomInfoView.updateRoomTitle(title: title) }) - .store(in: &cancellable) + .store(in: &self.cancellable) + + output.titleCount + .sink { [weak self] titleCount in + self?.createRoomView.roomTitleView.updateTitleCount(count: titleCount, maxLength: self?.createRoomViewModel.maxCount ?? 0) + } + .store(in: &self.cancellable) + + output.isOverMaxCount + .sink(receiveValue: { [weak self] isOverMaxCount in + if isOverMaxCount { + self?.createRoomView.roomTitleView.updateTextFieldText(maxLength: self?.createRoomViewModel.maxCount ?? 0) + } + }) + .store(in: &self.cancellable) + + output.isEnabled + .sink(receiveValue: { [weak self] isEnable in + self?.createRoomView.toggleNextButton(isEnable: isEnable) + }) + .store(in: &self.cancellable) output.capacity - .receive(on: DispatchQueue.main) .sink(receiveValue: { [weak self] capacity in self?.createRoomView.roomCapacityView.updateCapacity(capacity: capacity) self?.createRoomView.roomInfoView.updateRoomCapacity(capacity: capacity) - }) - .store(in: &cancellable) + .store(in: &self.cancellable) - output.date - .receive(on: DispatchQueue.main) - .sink(receiveValue: { [weak self] range in - self?.createRoomView.roomInfoView.updateRoomDateRange(range: range) + output.dateRange + .sink(receiveValue: { [weak self] dateRange in + self?.createRoomView.roomInfoView.updateRoomDateRange(range: dateRange) }) - .store(in: &cancellable) + .store(in: &self.cancellable) output.currentStep - .receive(on: DispatchQueue.main) .sink(receiveValue: { [weak self] currentStep in self?.createRoomView.nextButtonDidTap(step: currentStep) }) - .store(in: &cancellable) - } - - // MARK: - network - - private func requestCreateRoom(room: CreateRoomDTO) { - Task { - do { - guard let roomId = try await self.roomService.postCreateRoom(body: room) else { return } - self.pushDetailWaitViewController(roomId: roomId) - } catch NetworkError.serverError { - print("server Error") - } catch NetworkError.encodingError { - print("encoding Error") - } catch NetworkError.clientError(let message) { - print("client Error: \(String(describing: message))") - } - } + .store(in: &self.cancellable) + + output.roomId + .receive(on: DispatchQueue.main) + .sink(receiveCompletion: { [weak self] result in + switch result { + case .finished: return + case .failure(_): + self?.makeAlert(title: "에러발생") + } + }, receiveValue: { [weak self] roomid in + self?.pushDetailWaitViewController(roomId: roomid) + }) + .store(in: &self.cancellable) } } @@ -157,16 +161,4 @@ extension CreateRoomViewController: CreateRoomViewDelegate { func didTapCloseButton() { self.dismiss(animated: true) } - - func requestCreateRoom(roomInfo: RoomInfo, colorIndex: Int) { - guard let roomTitle = roomInfo.title, - let roomCapacity = roomInfo.capacity, - let roomStartDate = roomInfo.startDate, - let roomEndDate = roomInfo.endDate else { return } - self.requestCreateRoom(room: CreateRoomDTO(room: RoomDTO(title: roomTitle, - capacity: roomCapacity, - startDate: roomStartDate, - endDate: roomEndDate), - member: MemberDTO(colorIndex: colorIndex))) - } } diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift index b8aef22fd..685d18de0 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift @@ -5,6 +5,7 @@ // Created by 이성호 on 2023/05/10. // +import Combine import UIKit import SnapKit @@ -44,8 +45,9 @@ final class CharacterCollectionView: UIView { }() // MARK: - property - + // FIXME: characterIndex 삭제예정 private(set) var characterIndex: Int = 0 + let characterIndexTapPublisher = PassthroughSubject() // MARK: - init @@ -91,6 +93,6 @@ extension CharacterCollectionView: UICollectionViewDataSource { extension CharacterCollectionView: UICollectionViewDelegate { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - self.characterIndex = indexPath.item + self.characterIndexTapPublisher.send(indexPath.item) } } diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift index eace7ab0b..0fcb3b5ae 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift @@ -37,24 +37,6 @@ final class CheckRoomInfoView: UIView { return label }() - // MARK: - property - - private var dateRange = "" { - willSet { - self.dateLabel.text = newValue - } - } - private(set) var title: String = "" { - willSet { - self.nameLabel.text = newValue - } - } - private(set) var capacity: Int = 0 { - willSet { - self.personLabel.text = "\(newValue.description)" + TextLiteral.per - } - } - // MARK: - init override init(frame: CGRect) { @@ -97,14 +79,14 @@ final class CheckRoomInfoView: UIView { } func updateRoomTitle(title: String) { - self.title = title + self.nameLabel.text = title } func updateRoomCapacity(capacity: Int) { - self.capacity = capacity + self.personLabel.text = "\(capacity)" + TextLiteral.per } func updateRoomDateRange(range: String) { - self.dateRange = range + self.dateLabel.text = range } } diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift index dc4383b0c..e412a34ea 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift @@ -123,11 +123,6 @@ final class InputCapacityView: UIView { } } - func sliderValue() -> Int { - let value = Int(self.personSlider.value) - return value - } - func updateCapacity(capacity: Int) { self.personLabel.text = TextLiteral.x + " \(capacity)인" } diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift index c2baf980f..381114118 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift @@ -43,8 +43,7 @@ final class InputTitleView: UIView { // MARK: - property private var maxLength: Int = 8 - var changeNextButtonEnableStatus: ((Bool) -> ())? - let textFieldPublisher = PassthroughSubject() + let textFieldPublisher = CurrentValueSubject("") // MARK: - init @@ -74,31 +73,22 @@ final class InputTitleView: UIView { } } - func setCounter(count: Int) { - if count <= maxLength { - self.roomsTextLimitLabel.text = "\(count)/\(self.maxLength)" - } else { - self.roomsTextLimitLabel.text = "\(self.maxLength)/\(self.maxLength)" - } - } - - private func checkMaxLength(textField: UITextField, maxLength: Int) { - if let text = textField.text { - if text.count > maxLength { - let endIndex = text.index(text.startIndex, offsetBy: maxLength) - let fixedText = text[text.startIndex.. String { - guard let text = self.roomsNameTextField.text else { return "" } - return text + func updateTitleCount(count: Int, maxLength: Int) { + if count > maxLength { + self.roomsTextLimitLabel.text = "\(maxLength)/\(maxLength)" + } + else { + self.roomsTextLimitLabel.text = "\(count)/\(maxLength)" + } } } @@ -109,9 +99,5 @@ extension InputTitleView: UITextFieldDelegate { func textFieldDidChangeSelection(_ textField: UITextField) { self.textFieldPublisher.send(textField.text ?? "") - self.checkMaxLength(textField: self.roomsNameTextField, maxLength: self.maxLength) - - let hasText = textField.hasText - self.changeNextButtonEnableStatus?(hasText) } } diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index a873d4e03..4249bda27 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -12,15 +12,10 @@ import SnapKit protocol CreateRoomViewDelegate: AnyObject { func didTapCloseButton() - func requestCreateRoom(roomInfo: RoomInfo, colorIndex: Int) } final class CreateRoomView: UIView { -// fileprivate enum CreateRoomStep { -// case inputTitle, inputCapacity, inputDate, checkRoom, chooseCharacter -// } - // MARK: - ui component private let titleLabel: UILabel = { @@ -56,12 +51,10 @@ final class CreateRoomView: UIView { let roomInfoView: CheckRoomInfoView = CheckRoomInfoView() let characterCollectionView: CharacterCollectionView = CharacterCollectionView() - let calendarDidTapPublisher = PassthroughSubject() let nextButtonDidTapPublisher = PassthroughSubject() // MARK: - property - private var roomInfo: RoomInfo? private weak var delegate: CreateRoomViewDelegate? private var roomStep: CreateRoomStep = .inputTitle { willSet(step) { @@ -76,7 +69,6 @@ final class CreateRoomView: UIView { self.setupLayout() self.setupAction() self.setupNotificationCenter() - self.detectStartableStatus() self.configureUI() } @@ -140,10 +132,6 @@ final class CreateRoomView: UIView { let nextAction = UIAction { [weak self] _ in guard let currentStep = self?.roomStep else { return } -// guard let nextStep = self?.moveToNextStep(from: currentStep) else { return } -// -// self?.runActionAtStep(at: currentStep) -// self?.roomStep = nextStep self?.nextButtonDidTapPublisher.send(currentStep) } self.nextButton.addAction(nextAction, for: .touchUpInside) @@ -175,16 +163,6 @@ final class CreateRoomView: UIView { return step.previous() } - private func detectStartableStatus() { - self.roomTitleView.changeNextButtonEnableStatus = { [weak self] isEnabled in - self?.nextButton.isDisabled = !isEnabled - } - - self.roomDateView.calendarView.changeButtonState = { [weak self] isEnabled in - self?.nextButton.isDisabled = !isEnabled - } - } - private func updateHiddenStepView(at step: CreateRoomStep) { self.roomTitleView.isHidden = !(step == .inputTitle) self.roomCapacityView.isHidden = !(step == .inputCapacity) @@ -230,43 +208,18 @@ final class CreateRoomView: UIView { case .inputTitle: self.endEditing(true) case .inputCapacity: - self.disabledNextButton() + break case .inputDate: - self.sendDateRangeSubject() + break case .checkRoom: break case .chooseCharacter: -// let colorIndex = self.characterCollectionView.characterIndex -// self.delegate?.requestCreateRoom(roomInfo: RoomInfo(id: nil, -// capacity: self.roomInfoView.capacity, -// title: self.roomInfoView.title, -// startDate: "20\(self.roomDateView.calendarView.getTempStartDate())", -// endDate: "20\(self.roomDateView.calendarView.getTempEndDate())", -// state: nil), -// colorIndex: colorIndex) break } } - private func updateRoomTitle() { - let title = self.roomTitleView.textFieldText() - self.roomInfoView.updateRoomTitle(title: title) - } - - private func updateRoomCapacity() { - let capacity = self.roomCapacityView.sliderValue() - self.roomInfoView.updateRoomCapacity(capacity: capacity) - } - - private func disabledNextButton() { - self.nextButton.isDisabled = true - } - - private func sendDateRangeSubject() { - let startDate = self.roomDateView.calendarView.getTempStartDate() - let endDate = self.roomDateView.calendarView.getTempEndDate() - let roomDateRange = "\(startDate) ~ \(endDate)" - self.calendarDidTapPublisher.send(roomDateRange) + private func nextButton(isEnable: Bool) { + self.nextButton.isDisabled = !isEnable } private func configureUI() { @@ -284,12 +237,16 @@ final class CreateRoomView: UIView { } func nextButtonDidTap(step: CreateRoomStep) { - let nextStep = self.moveToNextStep(from: step) - self.runActionAtStep(at: step) + + let nextStep = self.moveToNextStep(from: step) self.roomStep = nextStep } + func toggleNextButton(isEnable: Bool) { + self.nextButton.isDisabled = !isEnable + } + private func manageStepView(step: CreateRoomStep) { self.updateHiddenStepView(at: step) self.updateHiddenBackButton(at: step) @@ -298,6 +255,7 @@ final class CreateRoomView: UIView { self.updateRoomTitleViewAnimation() case .inputCapacity: self.updateRoomCapacityViewAnimation() + self.nextButton(isEnable: true) case .inputDate: self.updateRoomDateViewAnimation() case .checkRoom: @@ -326,38 +284,6 @@ final class CreateRoomView: UIView { } } -//private extension CreateRoomView.CreateRoomStep { -// func next() -> Self { -// switch self { -// case .inputTitle: -// return .inputCapacity -// case .inputCapacity: -// return .inputDate -// case .inputDate: -// return .checkRoom -// case .checkRoom: -// return .chooseCharacter -// case .chooseCharacter: -// return .chooseCharacter -// } -// } -// -// func previous() -> Self { -// switch self { -// case .inputTitle: -// return .inputTitle -// case .inputCapacity: -// return .inputTitle -// case .inputDate: -// return .inputCapacity -// case .checkRoom: -// return .inputDate -// case .chooseCharacter: -// return .checkRoom -// } -// } -//} - enum CreateRoomStep { case inputTitle, inputCapacity, inputDate, checkRoom, chooseCharacter diff --git a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift index fa8d9a9a1..65ce50971 100644 --- a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift +++ b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift @@ -12,59 +12,123 @@ final class CreateRoomViewModel: ViewModelType { // MARK: - property + let maxCount: Int = 8 + private let createRoomService: CreateRoomService private var cancellable = Set() + private let titleSubject = CurrentValueSubject("") + private let capacitySubject = CurrentValueSubject(4) + private let startDateSubject = CurrentValueSubject("") + private let endDateSubject = CurrentValueSubject("") + private let dateRangeSubject = PassthroughSubject() + private let characterIndexSubject = CurrentValueSubject(0) private let roomIdSubject = PassthroughSubject() struct Input { let textFieldTextDidChanged: AnyPublisher let sliderValueDidChanged: AnyPublisher - let calendarDateDidTap: AnyPublisher + let startDateDidTap: AnyPublisher + let endDateDidTap: AnyPublisher + let characterIndexDidTap: AnyPublisher let nextButtonDidTap: AnyPublisher } struct Output { - let title: AnyPublisher - let capacity: AnyPublisher - let date: AnyPublisher + let title: CurrentValueSubject + let titleCount: AnyPublisher + let isOverMaxCount: AnyPublisher + let isEnabled: AnyPublisher + let capacity: CurrentValueSubject + let dateRange: PassthroughSubject let currentStep: AnyPublisher + let roomId: PassthroughSubject } func transform(from input: Input) -> Output { - let text = input.textFieldTextDidChanged - .map { text in - return text - } + let titleCount = input.textFieldTextDidChanged + .map { $0.count } .eraseToAnyPublisher() - let capacity = input.sliderValueDidChanged - .map { value in - return Int(value) + let isOverMaxCount = input.textFieldTextDidChanged + .map { [weak self] text -> Bool in + return self?.isOverMaxCount(titleCount: text.count, maxCount: self?.maxCount ?? 0) ?? false } .eraseToAnyPublisher() - let date = input.calendarDateDidTap - .map { date in - return date + input.textFieldTextDidChanged + .sink(receiveValue: { [weak self] title in + self?.titleSubject.send(title) + }) + .store(in: &self.cancellable) + + input.sliderValueDidChanged + .sink(receiveValue: { [weak self] capacity in + self?.capacitySubject.send(capacity) + }) + .store(in: &self.cancellable) + + input.startDateDidTap + .sink(receiveValue: { [weak self] startDate in + self?.startDateSubject.send(startDate) + }) + .store(in: &self.cancellable) + + input.endDateDidTap + .sink(receiveValue: { [weak self] endDate in + self?.endDateSubject.send(endDate) + if let startDate = self?.startDateSubject.value { + let range = "\(startDate) ~ \(endDate)" + self?.dateRangeSubject.send(range) + } + }) + .store(in: &self.cancellable) + + let isEnabledTitleType = input.textFieldTextDidChanged + .map { title -> Bool in + return !title.isEmpty } + + let isEnabledDateType = input.endDateDidTap + .map { endDate -> Bool in + return !endDate.isEmpty + } + + let isEnabled = Publishers.Merge(isEnabledTitleType, isEnabledDateType) .eraseToAnyPublisher() - let step = input.nextButtonDidTap - .map { currentStep -> CreateRoomStep in - if currentStep == .chooseCharacter { - // viewModel 에 request api 만들고 실행 여기서 - - print("네트워크 통신") + input.characterIndexDidTap + .sink(receiveValue: { [weak self] index in + self?.characterIndexSubject.send(index) + }) + .store(in: &self.cancellable) + + let currentStep = input.nextButtonDidTap + .map { [weak self] step -> CreateRoomStep in + guard let self = self else { return step } + switch step { + case .chooseCharacter: + self.requestCreateRoom(roomInfo: RoomInfo(id: nil, + capacity: self.capacitySubject.value, + title: self.titleSubject.value, + startDate: "20\(self.startDateSubject.value)", + endDate: "20\(self.endDateSubject.value)", + state: nil)) + return step + default: + return step } - return currentStep } .eraseToAnyPublisher() - return Output(title: text, - capacity: capacity, - date: date, - currentStep: step) + return Output(title: self.titleSubject, + titleCount: titleCount, + isOverMaxCount: isOverMaxCount, + isEnabled: isEnabled, + capacity: self.capacitySubject, + dateRange: self.dateRangeSubject, + currentStep: currentStep, + roomId: self.roomIdSubject) } // MARK: - init @@ -75,14 +139,21 @@ final class CreateRoomViewModel: ViewModelType { // MARK: - func - + private func isOverMaxCount(titleCount: Int, maxCount: Int) -> Bool { + if titleCount > maxCount { return true } + else { return false } + } // MARK: - network - private func requestCreateRoom(room: CreateRoomDTO) { + private func requestCreateRoom(roomInfo: RoomInfo) { Task { do { - let roomId = try await self.createRoomService.postCreateRoom(body: room) + let roomId = try await self.createRoomService.postCreateRoom(body: CreateRoomDTO(room: RoomDTO(title: roomInfo.title!, + capacity: roomInfo.capacity!, + startDate: roomInfo.startDate!, + endDate: roomInfo.endDate!), + member: MemberDTO(colorIndex: self.characterIndexSubject.value))) self.roomIdSubject.send(roomId) } catch(let error) { guard let error = error as? NetworkError else { return } diff --git a/Manito/Manito/Screens/Detail-Wait/UIComponent/CalendarView.swift b/Manito/Manito/Screens/Detail-Wait/UIComponent/CalendarView.swift index ead6c1c03..ac4ae9817 100644 --- a/Manito/Manito/Screens/Detail-Wait/UIComponent/CalendarView.swift +++ b/Manito/Manito/Screens/Detail-Wait/UIComponent/CalendarView.swift @@ -5,6 +5,7 @@ // Created by Mingwan Choi on 2022/06/16. // +import Combine import UIKit import FSCalendar @@ -74,6 +75,9 @@ final class CalendarView: UIView { private var tempEndDateText: String = "" var isFirstTap: Bool = false private weak var delegate: CalendarDelegate? + + let startDateTapPublisher = CurrentValueSubject("") + let endDateTapPublisher = CurrentValueSubject("") // MARK: - init @@ -239,6 +243,8 @@ extension CalendarView: FSCalendarDelegate { calendar.reloadData() } + self.startDateTapPublisher.send(self.getTempStartDate()) + self.endDateTapPublisher.send(self.getTempEndDate()) self.setupButtonState() } From 6d7882eda6b9c2921650c1b1268280aff27aaa01 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 28 Aug 2023 14:55:00 +0900 Subject: [PATCH 365/468] =?UTF-8?q?[CHORE]=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=20=EB=B2=84=EC=A0=84=20=EA=B4=80=EB=A0=A8=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xcshareddata/swiftpm/Package.resolved | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index f825ebc64..a3ff76c5d 100644 --- a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleDataTransport.git", "state" : { - "revision" : "aae45a320fd0d11811820335b1eabc8753902a40", - "version" : "9.2.5" + "revision" : "f6b558e3f801f2cac336b04f615ce111fa9ddaa0", + "version" : "9.2.1" } }, { @@ -68,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleUtilities.git", "state" : { - "revision" : "c38ce365d77b04a9a300c31061c5227589e5597b", - "version" : "7.11.5" + "revision" : "0543562f85620b5b7c510c6bcbef75b562a5127b", + "version" : "7.11.0" } }, { @@ -113,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/promises.git", "state" : { - "revision" : "e70e889c0196c76d22759eb50d6a0270ca9f1d9e", - "version" : "2.3.1" + "revision" : "ec957ccddbcc710ccc64c9dcbd4c7006fcf8b73a", + "version" : "2.2.0" } }, { @@ -140,8 +140,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "ce20dc083ee485524b802669890291c0d8090170", - "version" : "1.22.1" + "revision" : "0af9125c4eae12a4973fb66574c53a54962a9e1e", + "version" : "1.21.0" } } ], From 1f59b1494ed85ca21a1f57d754ad95219d35e62f Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 28 Aug 2023 15:11:43 +0900 Subject: [PATCH 366/468] =?UTF-8?q?[CHORE]=20=EA=B0=80=EB=8F=85=EC=84=B1?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20=EC=88=9C=EC=84=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#497)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index da8002619..c12f60385 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -141,8 +141,8 @@ final class DetailWaitViewModel { private func makeIsAdmin() -> PassedStartDateAndIsOwner { let roomInformation = self.roomInformationSubject.value - guard let isAdmin = roomInformation.admin, - let isPassStartDate = roomInformation.roomInformation?.isStartDatePast else { return (false, false) } + guard let isPassStartDate = roomInformation.roomInformation?.isStartDatePast, + let isAdmin = roomInformation.admin else { return (false, false) } return (isPassStartDate, isAdmin) } From 1d0b2810a637c3e33e03de6f8bab1e9a8a81516a Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 28 Aug 2023 15:12:53 +0900 Subject: [PATCH 367/468] =?UTF-8?q?[CHORE]=20=EC=8B=9C=EC=9E=91=EB=82=A0?= =?UTF-8?q?=EC=A7=9C=20=EC=A7=80=EB=82=A8=20Alert=20=ED=91=9C=EC=8B=9C=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EC=88=98=EC=A0=95=20(#497)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailWaitViewController.swift | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index d95b6e108..984567915 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -215,19 +215,26 @@ final class DetailWaitViewController: BaseViewController { } private func showStartDatePassedAlert(isPassedStartDate: Bool, isAdmin: Bool) { - if isAdmin { - if isPassedStartDate { - self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, - message: TextLiteral.detailWaitViewControllerPastAdminAlertMessage, - okAction: { [weak self] _ in - guard let roomInformation = self?.detailWaitViewModel.makeRoomInformation() else { return } - self?.showDetailEditViewController(roomInformation: roomInformation, mode: .date) - }) + guard isPassedStartDate else { return } + self.makeAlert( + title: isAdmin + ? TextLiteral.detailWaitViewControllerPastAlertTitle + : TextLiteral.detailWaitViewControllerPastAlertTitle, + message: isAdmin + ? TextLiteral.detailWaitViewControllerPastAdminAlertMessage + : TextLiteral.detailWaitViewControllerPastAlertMessage, + okAction: isAdmin + ? { [weak self] _ in + guard let roomInformaion = self?.roomInformation() else { return } + self?.showDetailEditViewController(roomInformation: roomInformaion, mode: .date) } - } else { - self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, - message: TextLiteral.detailWaitViewControllerPastAlertMessage) - } + : nil + ) + } + + private func roomInformation() -> Room { + let roomInformaion = self.detailWaitViewModel.makeRoomInformation() + return roomInformaion } // MARK: - selector From 6239e458ba6716ef32c29329a7ea56055ae5ff50 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 28 Aug 2023 15:18:05 +0900 Subject: [PATCH 368/468] =?UTF-8?q?[CHORE]=20roomInformaion=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20ViewController=EC=97=90=EC=84=9C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C(#497)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/DetailWaitViewController.swift | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 984567915..13a661839 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -225,18 +225,13 @@ final class DetailWaitViewController: BaseViewController { : TextLiteral.detailWaitViewControllerPastAlertMessage, okAction: isAdmin ? { [weak self] _ in - guard let roomInformaion = self?.roomInformation() else { return } + guard let roomInformaion = self?.detailWaitViewModel.makeRoomInformation() else { return } self?.showDetailEditViewController(roomInformation: roomInformaion, mode: .date) } : nil ) } - private func roomInformation() -> Room { - let roomInformaion = self.detailWaitViewModel.makeRoomInformation() - return roomInformaion - } - // MARK: - selector @objc From 21c86d52b2420d8769a4d6e36798d88a428ff423 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Mon, 28 Aug 2023 21:05:25 +0900 Subject: [PATCH 369/468] =?UTF-8?q?[MOVE]=20Presention=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=83=9D=EC=84=B1=20=EB=B0=8F=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=98=AE=EA=B9=80(#499)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 90 ++++++++++++++----- .../Usecase}/LetterService.swift | 0 .../Scene/LetterScene/View}/LetterView.swift | 0 .../View/UIComponent}/LetterHeaderView.swift | 0 .../LetterViewController.swift | 0 .../ViewModel}/LetterViewModel.swift | 0 6 files changed, 69 insertions(+), 21 deletions(-) rename Manito/Manito/{Screens/Letter/Services => Domain/Usecase}/LetterService.swift (100%) rename Manito/Manito/{Screens/Letter/Views/Views => Presentation/Scene/LetterScene/View}/LetterView.swift (100%) rename Manito/Manito/{Screens/Letter/Views/UIComponents => Presentation/Scene/LetterScene/View/UIComponent}/LetterHeaderView.swift (100%) rename Manito/Manito/{Screens/Letter/Views/ViewControllers => Presentation/Scene/LetterScene/ViewController}/LetterViewController.swift (100%) rename Manito/Manito/{Screens/Letter/ViewModels => Presentation/Scene/LetterScene/ViewModel}/LetterViewModel.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 1bde3cb60..ffc1aafb7 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -696,6 +696,73 @@ path = Packages; sourceTree = ""; }; + B58CA2FC2A9CC29A00977592 /* Presentation */ = { + isa = PBXGroup; + children = ( + B58CA3052A9CC37000977592 /* Scene */, + ); + path = Presentation; + sourceTree = ""; + }; + B58CA3052A9CC37000977592 /* Scene */ = { + isa = PBXGroup; + children = ( + B58CA3062A9CC37B00977592 /* LetterScene */, + ); + path = Scene; + sourceTree = ""; + }; + B58CA3062A9CC37B00977592 /* LetterScene */ = { + isa = PBXGroup; + children = ( + B58CA3082A9CC3B300977592 /* View */, + B58CA3072A9CC39700977592 /* ViewController */, + B58CA30A2A9CC41600977592 /* ViewModel */, + ); + path = LetterScene; + sourceTree = ""; + }; + B58CA3072A9CC39700977592 /* ViewController */ = { + isa = PBXGroup; + children = ( + B5F5250D2851A07700614FF7 /* LetterViewController.swift */, + ); + path = ViewController; + sourceTree = ""; + }; + B58CA3082A9CC3B300977592 /* View */ = { + isa = PBXGroup; + children = ( + B58CA3092A9CC3D700977592 /* UIComponent */, + B5706BF329B710FC0093D198 /* LetterView.swift */, + ); + path = View; + sourceTree = ""; + }; + B58CA3092A9CC3D700977592 /* UIComponent */ = { + isa = PBXGroup; + children = ( + B5F5253428547F1900614FF7 /* LetterHeaderView.swift */, + ); + path = UIComponent; + sourceTree = ""; + }; + B58CA30A2A9CC41600977592 /* ViewModel */ = { + isa = PBXGroup; + children = ( + B5B3C15C2A41D6EB00AABD6F /* LetterViewModel.swift */, + ); + path = ViewModel; + sourceTree = ""; + }; + B58CA30B2A9CC43600977592 /* Usecase */ = { + isa = PBXGroup; + children = ( + B5B3C15E2A41D6F400AABD6F /* LetterService.swift */, + ); + path = Usecase; + sourceTree = ""; + }; B5A085E42A972E5F00C8A98D /* Response */ = { isa = PBXGroup; children = ( @@ -716,6 +783,7 @@ B5A085E72A97302900C8A98D /* Domain */ = { isa = PBXGroup; children = ( + B58CA30B2A9CC43600977592 /* Usecase */, B5A085E82A97303900C8A98D /* Entity */, ); path = Domain; @@ -742,18 +810,9 @@ path = View; sourceTree = ""; }; - B5B3C1572A41D65400AABD6F /* ViewModels */ = { - isa = PBXGroup; - children = ( - B5B3C15C2A41D6EB00AABD6F /* LetterViewModel.swift */, - ); - path = ViewModels; - sourceTree = ""; - }; B5B3C1582A41D67F00AABD6F /* Views */ = { isa = PBXGroup; children = ( - B5706BF329B710FC0093D198 /* LetterView.swift */, B5706BE029ADC20A0093D198 /* CreateLetterView.swift */, B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */, ); @@ -763,7 +822,6 @@ B5B3C1592A41D69500AABD6F /* ViewControllers */ = { isa = PBXGroup; children = ( - B5F5250D2851A07700614FF7 /* LetterViewController.swift */, B5F31C4F28BF922E00F61D0F /* LetterViewController+MailCompose.swift */, B50B1AF82856B2C60080992C /* CreateLetterViewController.swift */, 39F1C12D28D756E600585B83 /* LetterImageViewController.swift */, @@ -771,14 +829,6 @@ path = ViewControllers; sourceTree = ""; }; - B5B3C15A2A41D6A600AABD6F /* Services */ = { - isa = PBXGroup; - children = ( - B5B3C15E2A41D6F400AABD6F /* LetterService.swift */, - ); - path = Services; - sourceTree = ""; - }; B5F524C228519AA000614FF7 = { isa = PBXGroup; children = ( @@ -804,6 +854,7 @@ B5F524CD28519AA000614FF7 /* Manito */ = { isa = PBXGroup; children = ( + B58CA2FC2A9CC29A00977592 /* Presentation */, B5A085E72A97302900C8A98D /* Domain */, B53A35B82A9640EB00B720BC /* Data */, B5F524E328519AC300614FF7 /* Screens */, @@ -910,8 +961,6 @@ isa = PBXGroup; children = ( B54741DE29A3A4BA00B75BA3 /* Views */, - B5B3C1572A41D65400AABD6F /* ViewModels */, - B5B3C15A2A41D6A600AABD6F /* Services */, ); path = Letter; sourceTree = ""; @@ -1046,7 +1095,6 @@ B5F5253328547EE000614FF7 /* UIComponents */ = { isa = PBXGroup; children = ( - B5F5253428547F1900614FF7 /* LetterHeaderView.swift */, B50B1AFA2856B5180080992C /* IndividualMissionView.swift */, B50B1AFC2856C3500080992C /* CreateLetterTextView.swift */, B50B1AFE2856D3820080992C /* CreateLetterPhotoView.swift */, diff --git a/Manito/Manito/Screens/Letter/Services/LetterService.swift b/Manito/Manito/Domain/Usecase/LetterService.swift similarity index 100% rename from Manito/Manito/Screens/Letter/Services/LetterService.swift rename to Manito/Manito/Domain/Usecase/LetterService.swift diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Presentation/Scene/LetterScene/View/LetterView.swift similarity index 100% rename from Manito/Manito/Screens/Letter/Views/Views/LetterView.swift rename to Manito/Manito/Presentation/Scene/LetterScene/View/LetterView.swift diff --git a/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift b/Manito/Manito/Presentation/Scene/LetterScene/View/UIComponent/LetterHeaderView.swift similarity index 100% rename from Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift rename to Manito/Manito/Presentation/Scene/LetterScene/View/UIComponent/LetterHeaderView.swift diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Presentation/Scene/LetterScene/ViewController/LetterViewController.swift similarity index 100% rename from Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift rename to Manito/Manito/Presentation/Scene/LetterScene/ViewController/LetterViewController.swift diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Presentation/Scene/LetterScene/ViewModel/LetterViewModel.swift similarity index 100% rename from Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift rename to Manito/Manito/Presentation/Scene/LetterScene/ViewModel/LetterViewModel.swift From c3c22afaa9233566e044ef7166c1c0024f3dddff Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 28 Aug 2023 21:51:20 +0900 Subject: [PATCH 370/468] =?UTF-8?q?[CHORE]=20pull=20=EC=9D=B4=ED=9B=84=20?= =?UTF-8?q?=EC=BB=A8=ED=94=8C=EB=A6=AD=ED=8A=B8=20=ED=95=B4=EA=B2=B0=20(#4?= =?UTF-8?q?83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/CreateRoomService.swift | 23 ++++++++----------- .../ViewModel/CreateRoomViewModel.swift | 22 ++++++++---------- .../Screens/Main/MainViewController.swift | 2 +- 3 files changed, 20 insertions(+), 27 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/Services/CreateRoomService.swift b/Manito/Manito/Screens/CreateRoom/Services/CreateRoomService.swift index e41705f8b..ff231823a 100644 --- a/Manito/Manito/Screens/CreateRoom/Services/CreateRoomService.swift +++ b/Manito/Manito/Screens/CreateRoom/Services/CreateRoomService.swift @@ -7,27 +7,22 @@ import Foundation -protocol CreateRoomSeviceable { - func postCreateRoom(body: CreateRoomDTO) async throws -> Int +protocol CreateRoomSevicable { + func dispatchCreateRoom(room: CreatedRoomRequestDTO) async throws -> Int } -final class CreateRoomService: CreateRoomSeviceable { +final class CreateRoomService: CreateRoomSevicable { - private let api: RoomProtocol + private let repository: RoomParticipationRepository - init(api: RoomProtocol) { - self.api = api + init(repository: RoomParticipationRepository) { + self.repository = repository } - func postCreateRoom(body: CreateRoomDTO) async throws -> Int { + func dispatchCreateRoom(room: CreatedRoomRequestDTO) async throws -> Int { do { - let roomId = try await self.api.postCreateRoom(body: body) - if let roomId { - return roomId - } - else { - throw NetworkError.serverError - } + let roomId = try await self.repository.dispatchCreateRoom(room: room) + return roomId } catch NetworkError.serverError { throw NetworkError.serverError } catch NetworkError.clientError(let message) { diff --git a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift index 65ce50971..7598117c5 100644 --- a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift +++ b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift @@ -108,12 +108,10 @@ final class CreateRoomViewModel: ViewModelType { guard let self = self else { return step } switch step { case .chooseCharacter: - self.requestCreateRoom(roomInfo: RoomInfo(id: nil, - capacity: self.capacitySubject.value, - title: self.titleSubject.value, - startDate: "20\(self.startDateSubject.value)", - endDate: "20\(self.endDateSubject.value)", - state: nil)) + self.requestCreateRoom(roomInfo: CreatedRoomInfoRequestDTO(title: self.titleSubject.value, + capacity: self.capacitySubject.value, + startDate: self.startDateSubject.value, + endDate: self.endDateSubject.value)) return step default: return step @@ -146,14 +144,14 @@ final class CreateRoomViewModel: ViewModelType { // MARK: - network - private func requestCreateRoom(roomInfo: RoomInfo) { + private func requestCreateRoom(roomInfo: CreatedRoomInfoRequestDTO) { Task { do { - let roomId = try await self.createRoomService.postCreateRoom(body: CreateRoomDTO(room: RoomDTO(title: roomInfo.title!, - capacity: roomInfo.capacity!, - startDate: roomInfo.startDate!, - endDate: roomInfo.endDate!), - member: MemberDTO(colorIndex: self.characterIndexSubject.value))) + let roomId = try await self.createRoomService.dispatchCreateRoom(room: CreatedRoomRequestDTO(room: CreatedRoomInfoRequestDTO(title: roomInfo.title, + capacity: roomInfo.capacity, + startDate: "20\(roomInfo.startDate)", + endDate: "20\(roomInfo.endDate)") + , member: MemberInfoRequestDTO(colorIndex: self.characterIndexSubject.value))) self.roomIdSubject.send(roomId) } catch(let error) { guard let error = error as? NetworkError else { return } diff --git a/Manito/Manito/Screens/Main/MainViewController.swift b/Manito/Manito/Screens/Main/MainViewController.swift index 11617ec53..7fedd8439 100644 --- a/Manito/Manito/Screens/Main/MainViewController.swift +++ b/Manito/Manito/Screens/Main/MainViewController.swift @@ -242,7 +242,7 @@ final class MainViewController: BaseViewController { let createRoom = UIAlertAction(title: TextLiteral.createRoom, style: .default, handler: { [weak self] _ in - let createVC = CreateRoomViewController(viewModel: CreateRoomViewModel(createRoomService: CreateRoomService(api: RoomAPI(apiService: APIService())))) + let createVC = CreateRoomViewController(viewModel: CreateRoomViewModel(createRoomService: CreateRoomService(repository: RoomParticipationRepositoryImpl()))) let navigationController = UINavigationController(rootViewController: createVC) navigationController.modalPresentationStyle = .overFullScreen DispatchQueue.main.async { From 0fc6fe014f4cd3f0038fe22a5f51a05ef12763c1 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 28 Aug 2023 21:59:17 +0900 Subject: [PATCH 371/468] =?UTF-8?q?[CHORE]=20testability=20YES=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 1 + 1 file changed, 1 insertion(+) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 1bde3cb60..1539ff2f7 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -1784,6 +1784,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = HF8GHZB58X; + ENABLE_TESTABILITY = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Manito/Global/Supports/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "$(BUNDLE_DISPLAY_NAME)"; From decdcddd6878e3bb951908c4e1b73517e40734ae Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 28 Aug 2023 22:19:41 +0900 Subject: [PATCH 372/468] =?UTF-8?q?[FEAT]=20Output=20=EC=A4=91=20titleCoun?= =?UTF-8?q?t=20=EC=82=AD=EC=A0=9C=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/CreateRoom/CreateRoomViewController.swift | 7 +------ .../Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift | 6 ------ 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index ada613982..359ceb34d 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -101,15 +101,10 @@ final class CreateRoomViewController: BaseViewController { output.title .sink(receiveValue: { [weak self] title in self?.createRoomView.roomInfoView.updateRoomTitle(title: title) + self?.createRoomView.roomTitleView.updateTitleCount(count: title.count, maxLength: self?.createRoomViewModel.maxCount ?? 0) }) .store(in: &self.cancellable) - output.titleCount - .sink { [weak self] titleCount in - self?.createRoomView.roomTitleView.updateTitleCount(count: titleCount, maxLength: self?.createRoomViewModel.maxCount ?? 0) - } - .store(in: &self.cancellable) - output.isOverMaxCount .sink(receiveValue: { [weak self] isOverMaxCount in if isOverMaxCount { diff --git a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift index 7598117c5..c095f37af 100644 --- a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift +++ b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift @@ -36,7 +36,6 @@ final class CreateRoomViewModel: ViewModelType { struct Output { let title: CurrentValueSubject - let titleCount: AnyPublisher let isOverMaxCount: AnyPublisher let isEnabled: AnyPublisher let capacity: CurrentValueSubject @@ -46,10 +45,6 @@ final class CreateRoomViewModel: ViewModelType { } func transform(from input: Input) -> Output { - let titleCount = input.textFieldTextDidChanged - .map { $0.count } - .eraseToAnyPublisher() - let isOverMaxCount = input.textFieldTextDidChanged .map { [weak self] text -> Bool in return self?.isOverMaxCount(titleCount: text.count, maxCount: self?.maxCount ?? 0) ?? false @@ -120,7 +115,6 @@ final class CreateRoomViewModel: ViewModelType { .eraseToAnyPublisher() return Output(title: self.titleSubject, - titleCount: titleCount, isOverMaxCount: isOverMaxCount, isEnabled: isEnabled, capacity: self.capacitySubject, From bfb6d7312f28a51cfab4aeea012643a7defddce4 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 28 Aug 2023 23:07:18 +0900 Subject: [PATCH 373/468] =?UTF-8?q?[FEAT]=20step=20=EA=B4=80=EB=A0=A8=20ne?= =?UTF-8?q?xt,=20previous=20=EA=B4=80=EB=A6=AC=20viewModel=20=EB=A1=9C=20?= =?UTF-8?q?=EC=98=AE=EA=B9=80=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreateRoom/CreateRoomViewController.swift | 25 ++++++---- .../CreateRoom/View/CreateRoomView.swift | 22 +++------ .../ViewModel/CreateRoomViewModel.swift | 49 +++++++++++++------ 3 files changed, 59 insertions(+), 37 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index 359ceb34d..da179ef73 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -92,7 +92,8 @@ final class CreateRoomViewController: BaseViewController { startDateDidTap: self.createRoomView.roomDateView.calendarView.startDateTapPublisher.eraseToAnyPublisher(), endDateDidTap: self.createRoomView.roomDateView.calendarView.endDateTapPublisher.eraseToAnyPublisher(), characterIndexDidTap: self.createRoomView.characterCollectionView.characterIndexTapPublisher.eraseToAnyPublisher(), - nextButtonDidTap: self.createRoomView.nextButtonDidTapPublisher.eraseToAnyPublisher()) + nextButtonDidTap: self.createRoomView.nextButtonDidTapPublisher.eraseToAnyPublisher(), + backButtonDidTap: self.createRoomView.backButtonDidTapPublisher.eraseToAnyPublisher()) return self.createRoomViewModel.transform(from: input) } @@ -113,12 +114,6 @@ final class CreateRoomViewController: BaseViewController { }) .store(in: &self.cancellable) - output.isEnabled - .sink(receiveValue: { [weak self] isEnable in - self?.createRoomView.toggleNextButton(isEnable: isEnable) - }) - .store(in: &self.cancellable) - output.capacity .sink(receiveValue: { [weak self] capacity in self?.createRoomView.roomCapacityView.updateCapacity(capacity: capacity) @@ -132,9 +127,21 @@ final class CreateRoomViewController: BaseViewController { }) .store(in: &self.cancellable) + output.isEnabled + .sink(receiveValue: { [weak self] isEnable in + self?.createRoomView.toggleNextButton(isEnable: isEnable) + }) + .store(in: &self.cancellable) + output.currentStep - .sink(receiveValue: { [weak self] currentStep in - self?.createRoomView.nextButtonDidTap(step: currentStep) + .sink(receiveValue: { [weak self] step in + self?.createRoomView.nextButtonDidTap(currentStep: step.0, nextStep: step.1) + }) + .store(in: &self.cancellable) + + output.previousStep + .sink(receiveValue: { [weak self] step in + self?.createRoomView.backButtonDidTap(previousStep: step) }) .store(in: &self.cancellable) diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index 4249bda27..a9d2682c3 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -52,6 +52,7 @@ final class CreateRoomView: UIView { let characterCollectionView: CharacterCollectionView = CharacterCollectionView() let nextButtonDidTapPublisher = PassthroughSubject() + let backButtonDidTapPublisher = PassthroughSubject() // MARK: - property @@ -138,8 +139,7 @@ final class CreateRoomView: UIView { let backAction = UIAction { [weak self] _ in guard let currentStep = self?.roomStep else { return } - guard let previousStep = self?.moveToPreviousStep(from: currentStep) else { return } - self?.roomStep = previousStep + self?.backButtonDidTapPublisher.send(currentStep) } self.backButton.addAction(backAction, for: .touchUpInside) } @@ -155,14 +155,6 @@ final class CreateRoomView: UIView { object: nil) } - private func moveToNextStep(from step: CreateRoomStep) -> CreateRoomStep { - return step.next() - } - - private func moveToPreviousStep(from step: CreateRoomStep) -> CreateRoomStep { - return step.previous() - } - private func updateHiddenStepView(at step: CreateRoomStep) { self.roomTitleView.isHidden = !(step == .inputTitle) self.roomCapacityView.isHidden = !(step == .inputCapacity) @@ -236,10 +228,12 @@ final class CreateRoomView: UIView { } } - func nextButtonDidTap(step: CreateRoomStep) { - self.runActionAtStep(at: step) - - let nextStep = self.moveToNextStep(from: step) + func backButtonDidTap(previousStep: CreateRoomStep) { + self.roomStep = previousStep + } + + func nextButtonDidTap(currentStep: CreateRoomStep, nextStep: CreateRoomStep) { + self.runActionAtStep(at: currentStep) self.roomStep = nextStep } diff --git a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift index c095f37af..14c8bdc42 100644 --- a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift +++ b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift @@ -10,6 +10,8 @@ import Foundation final class CreateRoomViewModel: ViewModelType { + typealias CurrentNextStep = (current: CreateRoomStep, next: CreateRoomStep) + // MARK: - property let maxCount: Int = 8 @@ -32,31 +34,33 @@ final class CreateRoomViewModel: ViewModelType { let endDateDidTap: AnyPublisher let characterIndexDidTap: AnyPublisher let nextButtonDidTap: AnyPublisher + let backButtonDidTap: AnyPublisher } struct Output { let title: CurrentValueSubject let isOverMaxCount: AnyPublisher - let isEnabled: AnyPublisher let capacity: CurrentValueSubject let dateRange: PassthroughSubject - let currentStep: AnyPublisher + let isEnabled: AnyPublisher + let currentStep: AnyPublisher + let previousStep: AnyPublisher let roomId: PassthroughSubject } func transform(from input: Input) -> Output { - let isOverMaxCount = input.textFieldTextDidChanged - .map { [weak self] text -> Bool in - return self?.isOverMaxCount(titleCount: text.count, maxCount: self?.maxCount ?? 0) ?? false - } - .eraseToAnyPublisher() - input.textFieldTextDidChanged .sink(receiveValue: { [weak self] title in self?.titleSubject.send(title) }) .store(in: &self.cancellable) + let isOverMaxCount = input.textFieldTextDidChanged + .map { [weak self] text -> Bool in + return self?.isOverMaxCount(titleCount: text.count, maxCount: self?.maxCount ?? 0) ?? false + } + .eraseToAnyPublisher() + input.sliderValueDidChanged .sink(receiveValue: { [weak self] capacity in self?.capacitySubject.send(capacity) @@ -99,27 +103,44 @@ final class CreateRoomViewModel: ViewModelType { .store(in: &self.cancellable) let currentStep = input.nextButtonDidTap - .map { [weak self] step -> CreateRoomStep in - guard let self = self else { return step } + .map { [weak self] step -> CurrentNextStep in + guard let self = self else { return (step, step.next()) } switch step { case .chooseCharacter: self.requestCreateRoom(roomInfo: CreatedRoomInfoRequestDTO(title: self.titleSubject.value, capacity: self.capacitySubject.value, startDate: self.startDateSubject.value, endDate: self.endDateSubject.value)) - return step + return (step, step.next()) default: - return step + return (step, step.next()) + } + } + .eraseToAnyPublisher() + + let previousStep = input.backButtonDidTap + .map { step -> CreateRoomStep in + switch step { + case .inputTitle: + return .inputTitle + case .inputCapacity: + return .inputTitle + case .inputDate: + return .inputCapacity + case .checkRoom: + return .inputDate + case .chooseCharacter: + return .checkRoom } } .eraseToAnyPublisher() return Output(title: self.titleSubject, isOverMaxCount: isOverMaxCount, - isEnabled: isEnabled, capacity: self.capacitySubject, dateRange: self.dateRangeSubject, - currentStep: currentStep, + isEnabled: isEnabled, + currentStep: currentStep, previousStep: previousStep, roomId: self.roomIdSubject) } From 1d1e09b16ec16295a4c60a6725541cc3233e2b4e Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 28 Aug 2023 23:16:10 +0900 Subject: [PATCH 374/468] =?UTF-8?q?[CHORE]=20case=20=EB=93=A4=20=EB=AC=B6?= =?UTF-8?q?=EC=96=B4=EC=84=9C=20default=20=EB=A7=8C=EB=93=A4=EA=B8=B0=20(#?= =?UTF-8?q?483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/CreateRoom/View/CreateRoomView.swift | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index a9d2682c3..daf21c4c3 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -199,13 +199,7 @@ final class CreateRoomView: UIView { switch step { case .inputTitle: self.endEditing(true) - case .inputCapacity: - break - case .inputDate: - break - case .checkRoom: - break - case .chooseCharacter: + default: break } } From a5eaf6f3db1b753eb7be796ded60d9b0137fb964 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 28 Aug 2023 23:26:25 +0900 Subject: [PATCH 375/468] =?UTF-8?q?[CHORE]=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=82=AD=EC=A0=9C=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index da179ef73..9935fa83a 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -20,7 +20,6 @@ final class CreateRoomViewController: BaseViewController { private var cancellable = Set() private let createRoomViewModel: CreateRoomViewModel - private let roomParticipationRepository: RoomParticipationRepository = RoomParticipationRepositoryImpl() // MARK: - init From 02f2f0263dba6fb42340ec8e74e745c9ac5b5cc6 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 28 Aug 2023 23:45:36 +0900 Subject: [PATCH 376/468] =?UTF-8?q?[CHORE]=20transform=20=EB=82=B4=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=EB=A1=9C=20=EB=B6=84=EB=A6=AC=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModel/CreateRoomViewModel.swift | 55 +++++++++++-------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift index 14c8bdc42..a62929b83 100644 --- a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift +++ b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift @@ -105,33 +105,14 @@ final class CreateRoomViewModel: ViewModelType { let currentStep = input.nextButtonDidTap .map { [weak self] step -> CurrentNextStep in guard let self = self else { return (step, step.next()) } - switch step { - case .chooseCharacter: - self.requestCreateRoom(roomInfo: CreatedRoomInfoRequestDTO(title: self.titleSubject.value, - capacity: self.capacitySubject.value, - startDate: self.startDateSubject.value, - endDate: self.endDateSubject.value)) - return (step, step.next()) - default: - return (step, step.next()) - } + return self.runActionByStep(step: step) } .eraseToAnyPublisher() let previousStep = input.backButtonDidTap - .map { step -> CreateRoomStep in - switch step { - case .inputTitle: - return .inputTitle - case .inputCapacity: - return .inputTitle - case .inputDate: - return .inputCapacity - case .checkRoom: - return .inputDate - case .chooseCharacter: - return .checkRoom - } + .map { [weak self] step -> CreateRoomStep in + guard let self = self else { return step } + return self.previous(step: step) } .eraseToAnyPublisher() @@ -157,6 +138,34 @@ final class CreateRoomViewModel: ViewModelType { else { return false } } + private func runActionByStep(step: CreateRoomStep) -> CurrentNextStep { + switch step { + case .chooseCharacter: + self.requestCreateRoom(roomInfo: CreatedRoomInfoRequestDTO(title: self.titleSubject.value, + capacity: self.capacitySubject.value, + startDate: self.startDateSubject.value, + endDate: self.endDateSubject.value)) + return (step, step.next()) + default: + return (step, step.next()) + } + } + + private func previous(step: CreateRoomStep) -> CreateRoomStep { + switch step { + case .inputTitle: + return .inputTitle + case .inputCapacity: + return .inputTitle + case .inputDate: + return .inputCapacity + case .checkRoom: + return .inputDate + case .chooseCharacter: + return .checkRoom + } + } + // MARK: - network private func requestCreateRoom(roomInfo: CreatedRoomInfoRequestDTO) { From 6cf88c06e7f0eef1b5c97c04e70e347f469b38fa Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 29 Aug 2023 00:00:43 +0900 Subject: [PATCH 377/468] =?UTF-8?q?[CHORE]=20=EB=B3=80=EC=88=98=EB=AA=85?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/CreateRoom/CreateRoomViewController.swift | 2 +- .../Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index 9935fa83a..6195428e2 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -132,7 +132,7 @@ final class CreateRoomViewController: BaseViewController { }) .store(in: &self.cancellable) - output.currentStep + output.currentNextStep .sink(receiveValue: { [weak self] step in self?.createRoomView.nextButtonDidTap(currentStep: step.0, nextStep: step.1) }) diff --git a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift index a62929b83..45b1f4ade 100644 --- a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift +++ b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift @@ -43,7 +43,7 @@ final class CreateRoomViewModel: ViewModelType { let capacity: CurrentValueSubject let dateRange: PassthroughSubject let isEnabled: AnyPublisher - let currentStep: AnyPublisher + let currentNextStep: AnyPublisher let previousStep: AnyPublisher let roomId: PassthroughSubject } @@ -121,7 +121,7 @@ final class CreateRoomViewModel: ViewModelType { capacity: self.capacitySubject, dateRange: self.dateRangeSubject, isEnabled: isEnabled, - currentStep: currentStep, previousStep: previousStep, + currentNextStep: currentStep, previousStep: previousStep, roomId: self.roomIdSubject) } From 5bcb229ff6a266fe220591029796fa4b289458c8 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 29 Aug 2023 00:16:52 +0900 Subject: [PATCH 378/468] =?UTF-8?q?[CHORE]=20=EB=B3=80=EC=88=98=EB=AA=85?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift index 45b1f4ade..135bda57e 100644 --- a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift +++ b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift @@ -102,7 +102,7 @@ final class CreateRoomViewModel: ViewModelType { }) .store(in: &self.cancellable) - let currentStep = input.nextButtonDidTap + let currentNextStep = input.nextButtonDidTap .map { [weak self] step -> CurrentNextStep in guard let self = self else { return (step, step.next()) } return self.runActionByStep(step: step) @@ -121,7 +121,7 @@ final class CreateRoomViewModel: ViewModelType { capacity: self.capacitySubject, dateRange: self.dateRangeSubject, isEnabled: isEnabled, - currentNextStep: currentStep, previousStep: previousStep, + currentNextStep: currentNextStep, previousStep: previousStep, roomId: self.roomIdSubject) } From 70c19b579f360c7be40f659ae33447a5afa4ed20 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 29 Aug 2023 00:27:24 +0900 Subject: [PATCH 379/468] =?UTF-8?q?[CHORE]=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EB=B9=84=ED=99=9C=EC=84=B1=ED=99=94=20=EB=90=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EB=B3=80=EA=B2=BD=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index daf21c4c3..695da7d34 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -199,6 +199,8 @@ final class CreateRoomView: UIView { switch step { case .inputTitle: self.endEditing(true) + case .inputCapacity: + self.nextButton(isEnable: false) default: break } From d74da66ac0480527b94c61d0bbf426dde409e543 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 29 Aug 2023 00:44:30 +0900 Subject: [PATCH 380/468] =?UTF-8?q?[CHORE]=20Current=20->=20Pass=20?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/CreateRoom/UIComponent/InputTitleView.swift | 2 +- .../Manito/Screens/Detail-Wait/UIComponent/CalendarView.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift index 381114118..88fe05acd 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift @@ -43,7 +43,7 @@ final class InputTitleView: UIView { // MARK: - property private var maxLength: Int = 8 - let textFieldPublisher = CurrentValueSubject("") + let textFieldPublisher = PassthroughSubject() // MARK: - init diff --git a/Manito/Manito/Screens/Detail-Wait/UIComponent/CalendarView.swift b/Manito/Manito/Screens/Detail-Wait/UIComponent/CalendarView.swift index ac4ae9817..872d522c2 100644 --- a/Manito/Manito/Screens/Detail-Wait/UIComponent/CalendarView.swift +++ b/Manito/Manito/Screens/Detail-Wait/UIComponent/CalendarView.swift @@ -76,8 +76,8 @@ final class CalendarView: UIView { var isFirstTap: Bool = false private weak var delegate: CalendarDelegate? - let startDateTapPublisher = CurrentValueSubject("") - let endDateTapPublisher = CurrentValueSubject("") + let startDateTapPublisher = PassthroughSubject() + let endDateTapPublisher = PassthroughSubject() // MARK: - init From ff39665b31716c001971d97054909fb0d82e6582 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 29 Aug 2023 11:24:33 +0900 Subject: [PATCH 381/468] =?UTF-8?q?[CHORE]=20Merge=20=ED=9B=84=20confilct?= =?UTF-8?q?=20=ED=95=B4=EA=B2=B0=20(#474)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/auto_assign.yml | 2 - .github/workflows/XCTestBuild.yml | 4 +- .github/workflows/build.yml | 2 +- Manito/Configuration/Dev/Dev.xcconfig | 11 + .../Dev/GoogleService-Info-Dev.plist | 34 + .../Prod/GoogleService-Info-Prod.plist} | 12 +- Manito/Configuration/Prod/Prod.xcconfig | 11 + Manito/Manito.xcodeproj/project.pbxproj | 619 ++++++++++-------- .../{Manito.xcscheme => Manito-Dev.xcscheme} | 10 +- .../xcschemes/Manito-Prod.xcscheme | 77 +++ .../Models => Data/DTO}/NicknameDTO.swift | 4 +- .../DTO/Request/CreatedRoomRequestDTO.swift | 28 + .../DTO/Request/EditedMissionRequestDTO.swift | 12 + .../Data/DTO/Request/LetterRequestDTO.swift | 18 + .../Data/DTO/Request/LoginRequestDTO.swift | 13 + .../Data/DTO/Response/DailyMissionDTO.swift | 12 + .../DTO/Response/FriendListDTO.swift} | 10 +- .../Manito/Data/DTO/Response/LetterDTO.swift | 14 + .../DTO/Response/LoginDTO.swift} | 6 +- .../Manito/Data/DTO/Response/MemoryDTO.swift | 18 + .../DTO/Response/MessageListItemDTO.swift | 27 + .../Response/ParticipatedRoomInfoDTO.swift} | 6 +- .../Data/DTO/Response/RoomInfoDTO.swift | 73 +++ .../Data/DTO/Response/RoomListDTO.swift | 35 + .../Data/DTO/Response/UserInfoDTO.swift | 13 + .../Token.swift => Data/DTO/TokenDTO.swift} | 6 +- .../Network/EndPoint/DetailRoomEndPoint.swift | 113 ++++ .../Network/EndPoint/LetterEndPoint.swift | 91 +++ .../Data/Network/EndPoint/LoginEndPoint.swift | 56 ++ .../Data/Network/EndPoint/MainEndPoint.swift | 64 ++ .../EndPoint/RoomParticipationEndPoint.swift | 72 ++ .../Network/EndPoint/SettingEndPoint.swift | 64 ++ .../Data/Network/EndPoint/TokenEndPoint.swift | 56 ++ .../Network/Foundation/APIEnvironment.swift | 16 + .../Network/Foundation/Key+Extension.swift} | 4 +- .../Network/Foundation/Key.plist} | 4 +- .../Network/Foundation/NetworkError.swift | 6 +- .../Repository/DetailRoomRepository.swift | 83 +++ .../Data/Repository/LetterRepository.swift | 42 ++ .../Data/Repository/LoginRepository.swift | 25 + .../Data/Repository/MainRepository.swift | 32 + .../RoomParticipationRepository.swift | 42 ++ .../Data/Repository/SettingRepository.swift | 32 + .../Data/Repository/TokenRepository.swift | 25 + .../Domain/Entity/MessageListItem.swift | 31 + .../Domain/Entity/ParticipantList.swift | 19 + Manito/Manito/Domain/Entity/RoomInfo.swift | 64 ++ .../Manito/Domain/Entity/RoomListItem.swift | 55 ++ .../Global/Base/BaseViewController.swift | 2 +- Manito/Manito/Global/Literal/URLLiteral.swift | 7 +- Manito/Manito/Network/API/DetailDoneAPI.swift | 51 -- .../Network/API/DetailStartingAPI.swift | 37 -- Manito/Manito/Network/API/DetailWaitAPI.swift | 58 -- Manito/Manito/Network/API/LetterAPI.swift | 38 -- Manito/Manito/Network/API/LoginAPI.swift | 23 - Manito/Manito/Network/API/MainAPI.swift | 30 - .../Manito/Network/API/MissionEditAPI.swift | 23 - Manito/Manito/Network/API/RoomAPI.swift | 37 -- Manito/Manito/Network/API/SettingAPI.swift | 30 - Manito/Manito/Network/API/TokenAPI.swift | 23 - .../Network/EndPoint/DetailDoneEndPoint.swift | 90 --- .../Network/EndPoint/DetailIngEndPoint.swift | 72 -- .../Network/EndPoint/DetailWaitEndPoint.swift | 108 --- .../EndPoint/InteractionEndPoint.swift | 55 -- .../Network/EndPoint/LetterEndPoint.swift | 135 ---- .../Network/EndPoint/LoginEndPoint.swift | 58 -- .../Network/EndPoint/MainEndPoint.swift | 68 -- .../EndPoint/MissionEditEndPoint.swift | 60 -- .../Network/EndPoint/RoomEndPoint.swift | 80 --- .../Network/EndPoint/SettingEndPoint.swift | 77 --- .../Network/EndPoint/TokenEndPoint.swift | 60 -- .../Network/Foundation/APIEnvironment.swift | 20 - .../Network/Foundation/APIService.swift | 81 --- .../Network/Foundation/Endpointable.swift | 15 - .../Network/Foundation/HTTPMethod.swift | 16 - .../Network/Foundation/NetworkRequest.swift | 38 -- .../Network/Foundation/Requestable.swift | 16 - .../Network/Foundation/URLRepresentable.swift | 18 - .../Manito/Network/Models/DailyMission.swift | 12 - Manito/Manito/Network/Models/Letter.swift | 43 -- Manito/Manito/Network/Models/Memory.swift | 17 - .../Network/Models/Request/LetterDTO.swift | 18 - .../Network/Models/Request/LoginDTO.swift | 13 - .../Network/Models/Request/MissionDTO.swift | 12 - .../Network/Models/Request/RoomDTO.swift | 28 - Manito/Manito/Network/Models/Room.swift | 255 -------- .../Network/Protocol/DetailDoneProtocol.swift | 16 - .../Protocol/DetailStartingProtocol.swift | 14 - .../Network/Protocol/DetailWaitProtocol.swift | 17 - .../Network/Protocol/LetterProtocol.swift | 14 - .../Network/Protocol/LoginProtocol.swift | 12 - .../Network/Protocol/MainProtocol.swift | 13 - .../Protocol/MisstionEditProtocol.swift | 12 - .../Network/Protocol/RoomProtocol.swift | 14 - .../Network/Protocol/SettingProtocol.swift | 13 - .../Network/Protocol/TokenProtocol.swift | 12 - .../CheckRoom/CheckRoomViewController.swift | 10 +- .../ChooseCharacterViewController.swift | 77 +-- .../ChooseCharacterView.swift | 0 .../CreateNickNameViewController.swift | 12 +- .../CreateRoom/CreateRoomViewController.swift | 326 ++------- .../UIComponent/CharacterCollectionView.swift | 2 +- ...RoomView.swift => CheckRoomInfoView.swift} | 24 +- ...rsonView.swift => InputCapacityView.swift} | 13 +- .../UIComponent/InputDateView.swift | 4 +- ...putNameView.swift => InputTitleView.swift} | 11 +- .../CreateRoom/View/CreateRoomView.swift | 350 ++++++++++ .../Detail-Ing/DetailingViewController.swift | 55 +- .../Detail-Ing/FriendListViewController.swift | 10 +- .../Detail-Ing/MemoryViewController.swift | 14 +- .../MissionEditViewController.swift | 12 +- .../Detail-Ing/View/DetailingView.swift | 30 +- .../DetailEditViewController.swift | 34 +- .../DetailWaitViewController.swift | 52 +- .../Services/DetailWaitService.swift | 34 +- .../Detail-Wait/View/DetailWaitView.swift | 20 +- .../ViewModel/DetailWaitViewModel.swift | 20 +- .../OpenManittoViewController.swift | 14 +- .../Interaction/View/OpenManittoView.swift | 6 +- .../InvitedCodeViewController.swift | 8 +- .../Letter/Services/LetterService.swift | 36 +- .../Letter/ViewModels/LetterViewModel.swift | 16 +- .../Views/UIComponents/LetterHeaderView.swift | 3 +- .../CreateLetterViewController.swift | 11 +- .../LetterViewController.swift | 16 +- .../Letter/Views/Views/LetterView.swift | 6 +- .../Screens/Login/LoginViewController.swift | 37 +- .../Screens/Main/MainViewController.swift | 24 +- .../ParticipateRoomViewController.swift | 25 +- .../ChangeNickNameViewController.swift | 6 +- .../Setting/SettingViewController.swift | 15 +- .../UserDefaultHandler.swift | 0 .../UserDefaultStorage.swift | 0 .../ManitoTests/DetailWaitViewModelTest.swift | 14 +- Manito/ManitoTests/ManitoTests.swift | 36 - .../xcschemes/MTNetworkTests.xcscheme | 53 ++ 136 files changed, 2501 insertions(+), 2969 deletions(-) create mode 100644 Manito/Configuration/Dev/Dev.xcconfig create mode 100644 Manito/Configuration/Dev/GoogleService-Info-Dev.plist rename Manito/{Manito/Global/Supports/GoogleService-Info.plist => Configuration/Prod/GoogleService-Info-Prod.plist} (92%) create mode 100644 Manito/Configuration/Prod/Prod.xcconfig rename Manito/Manito.xcodeproj/xcshareddata/xcschemes/{Manito.xcscheme => Manito-Dev.xcscheme} (94%) create mode 100644 Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito-Prod.xcscheme rename Manito/Manito/{Network/Models => Data/DTO}/NicknameDTO.swift (70%) create mode 100644 Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift create mode 100644 Manito/Manito/Data/DTO/Request/EditedMissionRequestDTO.swift create mode 100644 Manito/Manito/Data/DTO/Request/LetterRequestDTO.swift create mode 100644 Manito/Manito/Data/DTO/Request/LoginRequestDTO.swift create mode 100644 Manito/Manito/Data/DTO/Response/DailyMissionDTO.swift rename Manito/Manito/{Network/Models/FriendList.swift => Data/DTO/Response/FriendListDTO.swift} (56%) create mode 100644 Manito/Manito/Data/DTO/Response/LetterDTO.swift rename Manito/Manito/{Network/Models/Login.swift => Data/DTO/Response/LoginDTO.swift} (67%) create mode 100644 Manito/Manito/Data/DTO/Response/MemoryDTO.swift create mode 100644 Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift rename Manito/Manito/{Network/Models/VerificationCode.swift => Data/DTO/Response/ParticipatedRoomInfoDTO.swift} (61%) create mode 100644 Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift create mode 100644 Manito/Manito/Data/DTO/Response/RoomListDTO.swift create mode 100644 Manito/Manito/Data/DTO/Response/UserInfoDTO.swift rename Manito/Manito/{Network/Models/Token.swift => Data/DTO/TokenDTO.swift} (53%) create mode 100644 Manito/Manito/Data/Network/EndPoint/DetailRoomEndPoint.swift create mode 100644 Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift create mode 100644 Manito/Manito/Data/Network/EndPoint/LoginEndPoint.swift create mode 100644 Manito/Manito/Data/Network/EndPoint/MainEndPoint.swift create mode 100644 Manito/Manito/Data/Network/EndPoint/RoomParticipationEndPoint.swift create mode 100644 Manito/Manito/Data/Network/EndPoint/SettingEndPoint.swift create mode 100644 Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift create mode 100644 Manito/Manito/Data/Network/Foundation/APIEnvironment.swift rename Manito/Manito/{Global/Extension/URLInfo+Extension.swift => Data/Network/Foundation/Key+Extension.swift} (72%) rename Manito/Manito/{Global/Literal/URLInfo.plist => Data/Network/Foundation/Key.plist} (68%) rename Manito/Manito/{ => Data}/Network/Foundation/NetworkError.swift (57%) create mode 100644 Manito/Manito/Data/Repository/DetailRoomRepository.swift create mode 100644 Manito/Manito/Data/Repository/LetterRepository.swift create mode 100644 Manito/Manito/Data/Repository/LoginRepository.swift create mode 100644 Manito/Manito/Data/Repository/MainRepository.swift create mode 100644 Manito/Manito/Data/Repository/RoomParticipationRepository.swift create mode 100644 Manito/Manito/Data/Repository/SettingRepository.swift create mode 100644 Manito/Manito/Data/Repository/TokenRepository.swift create mode 100644 Manito/Manito/Domain/Entity/MessageListItem.swift create mode 100644 Manito/Manito/Domain/Entity/ParticipantList.swift create mode 100644 Manito/Manito/Domain/Entity/RoomInfo.swift create mode 100644 Manito/Manito/Domain/Entity/RoomListItem.swift delete mode 100644 Manito/Manito/Network/API/DetailDoneAPI.swift delete mode 100644 Manito/Manito/Network/API/DetailStartingAPI.swift delete mode 100644 Manito/Manito/Network/API/DetailWaitAPI.swift delete mode 100644 Manito/Manito/Network/API/LetterAPI.swift delete mode 100644 Manito/Manito/Network/API/LoginAPI.swift delete mode 100644 Manito/Manito/Network/API/MainAPI.swift delete mode 100644 Manito/Manito/Network/API/MissionEditAPI.swift delete mode 100644 Manito/Manito/Network/API/RoomAPI.swift delete mode 100644 Manito/Manito/Network/API/SettingAPI.swift delete mode 100644 Manito/Manito/Network/API/TokenAPI.swift delete mode 100644 Manito/Manito/Network/EndPoint/DetailDoneEndPoint.swift delete mode 100644 Manito/Manito/Network/EndPoint/DetailIngEndPoint.swift delete mode 100644 Manito/Manito/Network/EndPoint/DetailWaitEndPoint.swift delete mode 100644 Manito/Manito/Network/EndPoint/InteractionEndPoint.swift delete mode 100644 Manito/Manito/Network/EndPoint/LetterEndPoint.swift delete mode 100644 Manito/Manito/Network/EndPoint/LoginEndPoint.swift delete mode 100644 Manito/Manito/Network/EndPoint/MainEndPoint.swift delete mode 100644 Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift delete mode 100644 Manito/Manito/Network/EndPoint/RoomEndPoint.swift delete mode 100644 Manito/Manito/Network/EndPoint/SettingEndPoint.swift delete mode 100644 Manito/Manito/Network/EndPoint/TokenEndPoint.swift delete mode 100644 Manito/Manito/Network/Foundation/APIEnvironment.swift delete mode 100644 Manito/Manito/Network/Foundation/APIService.swift delete mode 100644 Manito/Manito/Network/Foundation/Endpointable.swift delete mode 100644 Manito/Manito/Network/Foundation/HTTPMethod.swift delete mode 100644 Manito/Manito/Network/Foundation/NetworkRequest.swift delete mode 100644 Manito/Manito/Network/Foundation/Requestable.swift delete mode 100644 Manito/Manito/Network/Foundation/URLRepresentable.swift delete mode 100644 Manito/Manito/Network/Models/DailyMission.swift delete mode 100644 Manito/Manito/Network/Models/Letter.swift delete mode 100644 Manito/Manito/Network/Models/Memory.swift delete mode 100644 Manito/Manito/Network/Models/Request/LetterDTO.swift delete mode 100644 Manito/Manito/Network/Models/Request/LoginDTO.swift delete mode 100644 Manito/Manito/Network/Models/Request/MissionDTO.swift delete mode 100644 Manito/Manito/Network/Models/Request/RoomDTO.swift delete mode 100644 Manito/Manito/Network/Models/Room.swift delete mode 100644 Manito/Manito/Network/Protocol/DetailDoneProtocol.swift delete mode 100644 Manito/Manito/Network/Protocol/DetailStartingProtocol.swift delete mode 100644 Manito/Manito/Network/Protocol/DetailWaitProtocol.swift delete mode 100644 Manito/Manito/Network/Protocol/LetterProtocol.swift delete mode 100644 Manito/Manito/Network/Protocol/LoginProtocol.swift delete mode 100644 Manito/Manito/Network/Protocol/MainProtocol.swift delete mode 100644 Manito/Manito/Network/Protocol/MisstionEditProtocol.swift delete mode 100644 Manito/Manito/Network/Protocol/RoomProtocol.swift delete mode 100644 Manito/Manito/Network/Protocol/SettingProtocol.swift delete mode 100644 Manito/Manito/Network/Protocol/TokenProtocol.swift rename Manito/Manito/Screens/ChooseCharacter/{UIComponent => View}/ChooseCharacterView.swift (100%) rename Manito/Manito/Screens/CreateRoom/UIComponent/{CheckRoomView.swift => CheckRoomInfoView.swift} (82%) rename Manito/Manito/Screens/CreateRoom/UIComponent/{InputPersonView.swift => InputCapacityView.swift} (93%) rename Manito/Manito/Screens/CreateRoom/UIComponent/{InputNameView.swift => InputTitleView.swift} (92%) create mode 100644 Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift rename Manito/Manito/{Network/Storage => Service/UserDefaultService}/UserDefaultHandler.swift (100%) rename Manito/Manito/{Network/Storage => Service/UserDefaultService}/UserDefaultStorage.swift (100%) delete mode 100644 Manito/ManitoTests/ManitoTests.swift create mode 100644 Manito/Packages/MTNetwork/.swiftpm/xcode/xcshareddata/xcschemes/MTNetworkTests.xcscheme diff --git a/.github/auto_assign.yml b/.github/auto_assign.yml index b675edc2c..7b78dcbc4 100644 --- a/.github/auto_assign.yml +++ b/.github/auto_assign.yml @@ -9,8 +9,6 @@ reviewers: - YoonAh-dev - MMMIIIN - coby5502 - - CreoHwan - - sunchoi22 - dangsal # A list of keywords to be skipped the process that add reviewers if pull requests include it skipKeywords: diff --git a/.github/workflows/XCTestBuild.yml b/.github/workflows/XCTestBuild.yml index 0ae54d5a2..fd8244b9c 100644 --- a/.github/workflows/XCTestBuild.yml +++ b/.github/workflows/XCTestBuild.yml @@ -9,11 +9,11 @@ on: branches: [ develop, release, hotfix, feature, main ] jobs: build: - runs-on: macos-latest + runs-on: self-hosted steps: - uses: actions/checkout@v2 - name: Firefighter Build Tests run: | - xcodebuild clean test -project ./Manito/Manito.xcodeproj -scheme Manito -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" + xcodebuild clean test -project ./Manito/Manito.xcodeproj -scheme Manito-Dev -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" xcpretty --color --simple diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ce3b6aa5..d31879d39 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,5 +19,5 @@ jobs: - name: Firefighter Build Tests run: | - xcodebuild build -project ./Manito/Manito.xcodeproj -scheme Manito -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" + xcodebuild build -project ./Manito/Manito.xcodeproj -scheme Manito-Prod -destination "platform=iOS Simulator,name=iPhone 13,OS=latest" xcpretty --color --simple diff --git a/Manito/Configuration/Dev/Dev.xcconfig b/Manito/Configuration/Dev/Dev.xcconfig new file mode 100644 index 000000000..21eb6793b --- /dev/null +++ b/Manito/Configuration/Dev/Dev.xcconfig @@ -0,0 +1,11 @@ +// +// Dev.xcconfig +// Manito +// +// Created by SHIN YOON AH on 2023/08/15. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +BUNDLE_DISPLAY_NAME = 애니또테스트 diff --git a/Manito/Configuration/Dev/GoogleService-Info-Dev.plist b/Manito/Configuration/Dev/GoogleService-Info-Dev.plist new file mode 100644 index 000000000..bb28de329 --- /dev/null +++ b/Manito/Configuration/Dev/GoogleService-Info-Dev.plist @@ -0,0 +1,34 @@ + + + + + CLIENT_ID + 127402077581-1vseg29m3he1bbe7a4of2o5ctmti41do.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.127402077581-1vseg29m3he1bbe7a4of2o5ctmti41do + API_KEY + AIzaSyDEDRvAR6vtuGe1PWtEexLlsUvuFUk1xRU + GCM_SENDER_ID + 127402077581 + PLIST_VERSION + 1 + BUNDLE_ID + com.TeamFirefighter.Manito + PROJECT_ID + aenitto-develop + STORAGE_BUCKET + aenitto-develop.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:127402077581:ios:38169c06a3af4fc9ace1c4 + + diff --git a/Manito/Manito/Global/Supports/GoogleService-Info.plist b/Manito/Configuration/Prod/GoogleService-Info-Prod.plist similarity index 92% rename from Manito/Manito/Global/Supports/GoogleService-Info.plist rename to Manito/Configuration/Prod/GoogleService-Info-Prod.plist index cb16b6241..5a08b5d14 100644 --- a/Manito/Manito/Global/Supports/GoogleService-Info.plist +++ b/Manito/Configuration/Prod/GoogleService-Info-Prod.plist @@ -19,16 +19,16 @@ STORAGE_BUCKET aenitto-350c7.appspot.com IS_ADS_ENABLED - + IS_ANALYTICS_ENABLED - + IS_APPINVITE_ENABLED - + IS_GCM_ENABLED - + IS_SIGNIN_ENABLED - + GOOGLE_APP_ID 1:1096284073075:ios:274e5e836bf912e806ce06 - \ No newline at end of file + diff --git a/Manito/Configuration/Prod/Prod.xcconfig b/Manito/Configuration/Prod/Prod.xcconfig new file mode 100644 index 000000000..70ecc1f91 --- /dev/null +++ b/Manito/Configuration/Prod/Prod.xcconfig @@ -0,0 +1,11 @@ +// +// Prod.xcconfig +// Manito +// +// Created by SHIN YOON AH on 2023/08/15. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +BUNDLE_DISPLAY_NAME = 애니또 diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index f0b0500ac..1bde3cb60 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -11,8 +11,8 @@ 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 333BF669285864CE0039F77F /* MemoryViewController.swift */; }; 33BDF5622856E03800564211 /* FriendListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33BDF5612856E03800564211 /* FriendListViewController.swift */; }; 39018F4228C4708A00C78DBA /* UIButton+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */; }; - 3915D54B2A7516A2002D6C25 /* URLInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3915D54A2A7516A2002D6C25 /* URLInfo.plist */; }; - 3915D54D2A7516E9002D6C25 /* URLInfo+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3915D54C2A7516E9002D6C25 /* URLInfo+Extension.swift */; }; + 3915D54B2A7516A2002D6C25 /* Key.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3915D54A2A7516A2002D6C25 /* Key.plist */; }; + 3915D54D2A7516E9002D6C25 /* Key+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */; }; 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391612D729E9231B004AE982 /* DetailWaitView.swift */; }; 391B3003286198C200421F1D /* Size.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391B3002286198C200421F1D /* Size.swift */; }; 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392EC77D2855C388006918A9 /* SettingButton.swift */; }; @@ -20,69 +20,34 @@ 395B5BC22A25E20000CE1420 /* DetailWaitViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */; }; 395B5BCC2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */; }; 397A241028BA494100454E4F /* APIEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957F0287D984900A04A2B /* APIEnvironment.swift */; }; - 397A241428BA516B00454E4F /* DetailWaitAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241328BA516B00454E4F /* DetailWaitAPI.swift */; }; - 397A241828BA51B400454E4F /* DetailWaitProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */; }; - 397A241A28BA532A00454E4F /* FriendList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 397A241928BA532A00454E4F /* FriendList.swift */; }; 398B1C9B29F10B0300DEFCEC /* DetailEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 398B1C9A29F10B0300DEFCEC /* DetailEditView.swift */; }; - 398B1CBC2A12415C00DEFCEC /* ManitoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */; }; 398B1CCA2A13597600DEFCEC /* FSCalendar in Frameworks */ = {isa = PBXBuildFile; productRef = 398B1CC92A13597600DEFCEC /* FSCalendar */; }; 398B1CCC2A13599D00DEFCEC /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = 398B1CCB2A13599D00DEFCEC /* FirebaseAuth */; }; 399D17AB2856C83B00F50D9D /* DetailEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */; }; - 39A938912A48504200EC2CF2 /* MissionEditEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938902A48504200EC2CF2 /* MissionEditEndPoint.swift */; }; - 39A938932A4852CA00EC2CF2 /* MissionDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938922A4852CA00EC2CF2 /* MissionDTO.swift */; }; - 39A938952A48562500EC2CF2 /* MisstionEditProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938942A48562500EC2CF2 /* MisstionEditProtocol.swift */; }; - 39A938972A48565500EC2CF2 /* MissionEditAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39A938962A48565500EC2CF2 /* MissionEditAPI.swift */; }; 39BDDCC42A52BB4A005E0A71 /* DetailWaitService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39BDDCC32A52BB4A005E0A71 /* DetailWaitService.swift */; }; 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */; }; 39C957D02879521400A04A2B /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CF2879521400A04A2B /* String+Extension.swift */; }; 39C957D22879523200A04A2B /* Date+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957D12879523200A04A2B /* Date+Extension.swift */; }; - 39C957D628799AB900A04A2B /* HTTPMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957D528799AB900A04A2B /* HTTPMethod.swift */; }; - 39C957D828799DB900A04A2B /* NetworkError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957D728799DB900A04A2B /* NetworkError.swift */; }; - 39C957DD2879A2B600A04A2B /* Room.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957DC2879A2B600A04A2B /* Room.swift */; }; - 39C957DF2879A35300A04A2B /* RoomDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957DE2879A35300A04A2B /* RoomDTO.swift */; }; - 39C957E12879A3CF00A04A2B /* DailyMission.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957E02879A3CF00A04A2B /* DailyMission.swift */; }; 39C957ED287AE4D100A04A2B /* MainEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957EC287AE4D100A04A2B /* MainEndPoint.swift */; }; - 39C957EF287AEBB400A04A2B /* Endpointable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957EE287AEBB400A04A2B /* Endpointable.swift */; }; - 39C957F4287D9EB400A04A2B /* APIService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957F3287D9EB400A04A2B /* APIService.swift */; }; - 39C957F6287D9ED000A04A2B /* NetworkRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957F5287D9ED000A04A2B /* NetworkRequest.swift */; }; - 39C957FC287DAAFA00A04A2B /* DetailWaitEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957FB287DAAFA00A04A2B /* DetailWaitEndPoint.swift */; }; - 39C957FE287DAB6D00A04A2B /* DetailIngEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957FD287DAB6D00A04A2B /* DetailIngEndPoint.swift */; }; - 39C95800287DAC2900A04A2B /* DetailDoneEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957FF287DAC2900A04A2B /* DetailDoneEndPoint.swift */; }; - 39C95802287DACC300A04A2B /* RoomEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95801287DACC300A04A2B /* RoomEndPoint.swift */; }; + 39C95802287DACC300A04A2B /* RoomParticipationEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95801287DACC300A04A2B /* RoomParticipationEndPoint.swift */; }; 39C95804287DAD3000A04A2B /* LetterEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95803287DAD3000A04A2B /* LetterEndPoint.swift */; }; - 39C95806287DAE5700A04A2B /* InteractionEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95805287DAE5700A04A2B /* InteractionEndPoint.swift */; }; 39C95808287DB05C00A04A2B /* SettingEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95807287DB05C00A04A2B /* SettingEndPoint.swift */; }; 39C9580A287DC03500A04A2B /* Encodable+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95809287DC03500A04A2B /* Encodable+Extension.swift */; }; - 39CD581928C4BD9D00496E91 /* DetailStartingProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CD581828C4BD9D00496E91 /* DetailStartingProtocol.swift */; }; - 39CD581B28C4BE8800496E91 /* DetailStartingAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CD581A28C4BE8800496E91 /* DetailStartingAPI.swift */; }; - 39CD581D28C4C03C00496E91 /* DetailDoneProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CD581C28C4C03B00496E91 /* DetailDoneProtocol.swift */; }; - 39CD581F28C4C19100496E91 /* Memory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CD581E28C4C19100496E91 /* Memory.swift */; }; - 39CD582128C4C3E800496E91 /* DetailDoneAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CD582028C4C3E800496E91 /* DetailDoneAPI.swift */; }; 39D95265285B097800183B09 /* CalendarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39D95264285B097800183B09 /* CalendarView.swift */; }; - 39E099AD287FC020004F464E /* LetterDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39E099AC287FC020004F464E /* LetterDTO.swift */; }; 39EE956D2A401ED400AF6857 /* DetailingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EE956C2A401ED400AF6857 /* DetailingView.swift */; }; 39EE956F2A404A3800AF6857 /* MissionEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EE956E2A404A3800AF6857 /* MissionEditViewController.swift */; }; - 39EEF65628CB3BB200437654 /* LoginProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65528CB3BB200437654 /* LoginProtocol.swift */; }; - 39EEF65828CB3C1100437654 /* Login.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65728CB3C1100437654 /* Login.swift */; }; - 39EEF65A28CB3C7B00437654 /* Token.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65928CB3C7B00437654 /* Token.swift */; }; - 39EEF65C28CB3CD600437654 /* LoginAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65B28CB3CD600437654 /* LoginAPI.swift */; }; 39EEF65E28CB3CFE00437654 /* LoginEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65D28CB3CFE00437654 /* LoginEndPoint.swift */; }; - 39EEF66028CB3D6200437654 /* LoginDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EEF65F28CB3D6200437654 /* LoginDTO.swift */; }; 39F1C12E28D756E600585B83 /* LetterImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39F1C12D28D756E600585B83 /* LetterImageViewController.swift */; }; 39FFE32828EEFFFE008442EE /* MoreButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39FFE32728EEFFFE008442EE /* MoreButton.swift */; }; 39FFE33428F457AF008442EE /* FirebaseMessaging in Frameworks */ = {isa = PBXBuildFile; productRef = 39FFE33328F457AF008442EE /* FirebaseMessaging */; }; - 39FFE33628F45E44008442EE /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 39FFE33528F45E44008442EE /* GoogleService-Info.plist */; }; 435B17682913E71400212663 /* DetailingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 435B17672913E71400212663 /* DetailingViewController.swift */; }; 7E0C5C362855B22700F698D1 /* CreateNickNameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E0C5C352855B22700F698D1 /* CreateNickNameViewController.swift */; }; 7E0C5C382855B73100F698D1 /* Splash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7E0C5C372855B73100F698D1 /* Splash.storyboard */; }; 7E15F67E28B35B3D00441305 /* TextLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E15F67D28B35B3D00441305 /* TextLiteral.swift */; }; - 7E3058C62854B47F00489E6A /* InputNameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C52854B47F00489E6A /* InputNameView.swift */; }; - 7E3058C82854B64D00489E6A /* InputPersonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C72854B64D00489E6A /* InputPersonView.swift */; }; + 7E3058C62854B47F00489E6A /* InputTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C52854B47F00489E6A /* InputTitleView.swift */; }; + 7E3058C82854B64D00489E6A /* InputCapacityView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C72854B64D00489E6A /* InputCapacityView.swift */; }; 7E3058CA2854B7A900489E6A /* InputDateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C92854B7A900489E6A /* InputDateView.swift */; }; 7E7542B32923744300D725CB /* ToastPopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E7542B22923744300D725CB /* ToastPopupView.swift */; }; - 7E77DB0428BF9A6700E95D4B /* RoomProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E77DB0328BF9A6700E95D4B /* RoomProtocol.swift */; }; - 7E77DB0628BF9C0600E95D4B /* VerificationCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E77DB0528BF9C0600E95D4B /* VerificationCode.swift */; }; - 7E77DB0828BF9D2400E95D4B /* RoomAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E77DB0728BF9D2400E95D4B /* RoomAPI.swift */; }; 7EA25C2728C4FEA800746AEA /* ChangeNickNameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */; }; 7ED845BA2876BE530075AC61 /* SettingViewTableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ED845B92876BE530075AC61 /* SettingViewTableCell.swift */; }; B50B1AF92856B2C60080992C /* CreateLetterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50B1AF82856B2C60080992C /* CreateLetterViewController.swift */; }; @@ -99,12 +64,18 @@ B50CEE912A445EB700CF1C76 /* UIScrollView+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */; }; B50CEEC02A6FF82600CF1C76 /* Publisher+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50CEEBF2A6FF82600CF1C76 /* Publisher+Extension.swift */; }; B517C04A28D1F7EC0008BED0 /* TokenEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */; }; - B517C04C28D1FE5F0008BED0 /* TokenAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */; }; - B517C04E28D1FE660008BED0 /* TokenProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04D28D1FE660008BED0 /* TokenProtocol.swift */; }; - B53AD35E2A763CC400B83B33 /* MTNetwork in Frameworks */ = {isa = PBXBuildFile; productRef = B53AD35D2A763CC400B83B33 /* MTNetwork */; }; + B53A35AD2A962E9C00B720BC /* MTNetwork in Frameworks */ = {isa = PBXBuildFile; productRef = B53A35AC2A962E9C00B720BC /* MTNetwork */; }; + B53A35B72A963F2100B720BC /* DetailRoomEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35B62A963F2100B720BC /* DetailRoomEndPoint.swift */; }; + B53A35C02A96F21A00B720BC /* MainRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35BF2A96F21A00B720BC /* MainRepository.swift */; }; + B53A35C42A96F50100B720BC /* DetailRoomRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35C32A96F50100B720BC /* DetailRoomRepository.swift */; }; + B53A35C62A96F6DB00B720BC /* RoomParticipationRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35C52A96F6DB00B720BC /* RoomParticipationRepository.swift */; }; + B53A35C82A96F84700B720BC /* LetterRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35C72A96F84700B720BC /* LetterRepository.swift */; }; + B53A35CC2A96F99D00B720BC /* SettingRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35CB2A96F99D00B720BC /* SettingRepository.swift */; }; + B53A35CE2A96FA7A00B720BC /* LoginRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35CD2A96FA7A00B720BC /* LoginRepository.swift */; }; + B53A35D02A97194D00B720BC /* TokenRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35CF2A97194D00B720BC /* TokenRepository.swift */; }; + B53A35D42A97266D00B720BC /* CreatedRoomRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35D32A97266D00B720BC /* CreatedRoomRequestDTO.swift */; }; B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */; }; B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B54741E929A494E200B75BA3 /* LetterImageError.swift */; }; - B55B482229C3723B00CFFDAD /* URLRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55B482129C3723B00CFFDAD /* URLRepresentable.swift */; }; B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B55BCEB328D8449E00AF7E45 /* MemoryCollectionViewCell.swift */; }; B55BCEB628D99F8600AF7E45 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = B55BCEB528D99F8600AF7E45 /* Settings.bundle */; }; B55BCEC628F5AFB200AF7E45 /* capsule.gif in Resources */ = {isa = PBXBuildFile; fileRef = B55BCEC528F5AFB200AF7E45 /* capsule.gif */; }; @@ -112,6 +83,25 @@ B5706BE129ADC20A0093D198 /* CreateLetterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5706BE029ADC20A0093D198 /* CreateLetterView.swift */; }; B5706BF429B710FC0093D198 /* LetterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5706BF329B710FC0093D198 /* LetterView.swift */; }; B5706BF629B9D4650093D198 /* GuideView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5706BF529B9D4650093D198 /* GuideView.swift */; }; + B5A085DF2A972D2A00C8A98D /* LetterRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085DE2A972D2A00C8A98D /* LetterRequestDTO.swift */; }; + B5A085E12A972D7900C8A98D /* LoginRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085E02A972D7900C8A98D /* LoginRequestDTO.swift */; }; + B5A085E32A972DDC00C8A98D /* EditedMissionRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085E22A972DDC00C8A98D /* EditedMissionRequestDTO.swift */; }; + B5A085E62A972EB700C8A98D /* LetterDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085E52A972EB700C8A98D /* LetterDTO.swift */; }; + B5A085EA2A97309900C8A98D /* MessageListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085E92A97309900C8A98D /* MessageListItem.swift */; }; + B5A085EC2A97314800C8A98D /* ParticipatedRoomInfoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085EB2A97314800C8A98D /* ParticipatedRoomInfoDTO.swift */; }; + B5A085EE2A9731F000C8A98D /* DailyMissionDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085ED2A9731F000C8A98D /* DailyMissionDTO.swift */; }; + B5A085F02A97326B00C8A98D /* FriendListDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085EF2A97326B00C8A98D /* FriendListDTO.swift */; }; + B5A085F22A9732E800C8A98D /* MemoryDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085F12A9732E800C8A98D /* MemoryDTO.swift */; }; + B5A085F42A9733A700C8A98D /* LoginDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085F32A9733A700C8A98D /* LoginDTO.swift */; }; + B5A085F62A9733F900C8A98D /* TokenDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085F52A9733F900C8A98D /* TokenDTO.swift */; }; + B5A085F82A9744CC00C8A98D /* RoomListDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085F72A9744CC00C8A98D /* RoomListDTO.swift */; }; + B5A085FA2A9745DA00C8A98D /* RoomInfoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085F92A9745DA00C8A98D /* RoomInfoDTO.swift */; }; + B5A085FC2A97470400C8A98D /* RoomInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085FB2A97470400C8A98D /* RoomInfo.swift */; }; + B5A085FE2A97493900C8A98D /* UserInfoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085FD2A97493900C8A98D /* UserInfoDTO.swift */; }; + B5A086002A97496900C8A98D /* MessageListItemDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A085FF2A97496900C8A98D /* MessageListItemDTO.swift */; }; + B5A086022A974B8100C8A98D /* RoomListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A086012A974B8100C8A98D /* RoomListItem.swift */; }; + B5A086042A974D2000C8A98D /* ParticipantList.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A086032A974D2000C8A98D /* ParticipantList.swift */; }; + B5A086062A977F1700C8A98D /* NetworkError.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A086052A977F1700C8A98D /* NetworkError.swift */; }; B5AE11F029D1E43B00F86FF8 /* OpenManittoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11EF29D1E43B00F86FF8 /* OpenManittoView.swift */; }; B5AE11F229D28CB500F86FF8 /* OpenManittoPopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11F129D28CB500F86FF8 /* OpenManittoPopupView.swift */; }; B5AE11F429D32EE700F86FF8 /* SelectManitteeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */; }; @@ -125,9 +115,6 @@ B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */; }; B5F31BB228BE1CD700F61D0F /* UserDefaultHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BB128BE1CD700F61D0F /* UserDefaultHandler.swift */; }; B5F31C5028BF922E00F61D0F /* LetterViewController+MailCompose.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31C4F28BF922E00F61D0F /* LetterViewController+MailCompose.swift */; }; - B5F31C5228BFA64F00F61D0F /* LetterAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31C5128BFA64F00F61D0F /* LetterAPI.swift */; }; - B5F31C5428BFA70100F61D0F /* LetterProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31C5328BFA70100F61D0F /* LetterProtocol.swift */; }; - B5F31C5628BFA87700F61D0F /* Requestable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31C5528BFA87700F61D0F /* Requestable.swift */; }; B5F524CF28519AA000614FF7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F524CE28519AA000614FF7 /* AppDelegate.swift */; }; B5F524D128519AA000614FF7 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F524D028519AA000614FF7 /* SceneDelegate.swift */; }; B5F524D628519AA000614FF7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B5F524D428519AA000614FF7 /* Main.storyboard */; }; @@ -157,7 +144,6 @@ B5F5253B2854ABF200614FF7 /* MainButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5253A2854ABF200614FF7 /* MainButton.swift */; }; B5F5253D2854B8CB00614FF7 /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5253C2854B8CB00614FF7 /* UIView+Extension.swift */; }; B5F525422855C97900614FF7 /* UILabel+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F525412855C97900614FF7 /* UILabel+Extension.swift */; }; - B5F525492855D01D00614FF7 /* Letter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F525482855D01D00614FF7 /* Letter.swift */; }; B5FEE9DB28C8498A00DEA07E /* ImageCacheManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FEE9DA28C8498A00DEA07E /* ImageCacheManager.swift */; }; B5FEE9DD28C849B400DEA07E /* UIImageView+Cache.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5FEE9DC28C849B400DEA07E /* UIImageView+Cache.swift */; }; CB21C33928C4C10200128D25 /* CharacterCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB21C33828C4C10200128D25 /* CharacterCollectionViewCell.swift */; }; @@ -165,8 +151,6 @@ CB2F0FCC28A5468C005F04C8 /* gifTto.gif in Resources */ = {isa = PBXBuildFile; fileRef = CB2F0FC928A5468C005F04C8 /* gifTto.gif */; }; CB2F0FCD28A5468C005F04C8 /* gifNi.gif in Resources */ = {isa = PBXBuildFile; fileRef = CB2F0FCA28A5468C005F04C8 /* gifNi.gif */; }; CB358C0228A564080084D001 /* SettingDeveloperInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB358C0128A564080084D001 /* SettingDeveloperInfoViewController.swift */; }; - CB4C77E428C0D4C9007A1AD2 /* MainProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB4C77E328C0D4C9007A1AD2 /* MainProtocol.swift */; }; - CB4C77E628C0D4EB007A1AD2 /* MainAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB4C77E528C0D4EB007A1AD2 /* MainAPI.swift */; }; CB5AE3E4285AAF7400382EA3 /* RoomInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB5AE3E3285AAF7400382EA3 /* RoomInfoView.swift */; }; CB5AE3E6285AB76800382EA3 /* PeopleInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB5AE3E5285AB76800382EA3 /* PeopleInfoView.swift */; }; CB637A3B28595C1200FF1240 /* ParticipateRoomViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB637A3A28595C1200FF1240 /* ParticipateRoomViewController.swift */; }; @@ -181,15 +165,14 @@ CBA4D7A42856CE9F0018BDC2 /* CreateRoomCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBA4D7A32856CE9F0018BDC2 /* CreateRoomCollectionViewCell.swift */; }; CBA4D7A62856D48C0018BDC2 /* RoomStateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBA4D7A52856D48C0018BDC2 /* RoomStateView.swift */; }; CBBFF77C287AE491006A5964 /* DeveloperInfoViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBBFF77B287AE491006A5964 /* DeveloperInfoViewCell.swift */; }; + D70220232A7A22EC0024BACD /* CreateRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D70220222A7A22EC0024BACD /* CreateRoomView.swift */; }; D724AF5D287088310003F280 /* SettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5C287088310003F280 /* SettingViewController.swift */; }; D724AF5F28708D830003F280 /* ImageRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5E28708D830003F280 /* ImageRowView.swift */; }; - D739C36328C7B69D00161117 /* SettingProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D739C36228C7B69D00161117 /* SettingProtocol.swift */; }; - D739C36528C7B75400161117 /* SettingAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = D739C36428C7B75400161117 /* SettingAPI.swift */; }; D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = D739C36628C7B82500161117 /* NicknameDTO.swift */; }; D75E8C7F28D76FFB004A6C41 /* LetterCountBadgeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D75E8C7E28D76FFB004A6C41 /* LetterCountBadgeView.swift */; }; D77224DF285DDAB7008B760B /* Notification+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D77224DE285DDAB7008B760B /* Notification+Extension.swift */; }; D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = D777D2C828C7780E008655BD /* URLLiteral.swift */; }; - D7B6C97C2858B2D40024F326 /* CheckRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */; }; + D7B6C97C2858B2D40024F326 /* CheckRoomInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B6C97B2858B2D40024F326 /* CheckRoomInfoView.swift */; }; D7C4A1A72A0B2EB000C3AE4C /* CharacterCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */; }; D7C4A1A92A0B895300C3AE4C /* ChooseCharacterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */; }; D7C4A1AB2A0D1AA400C3AE4C /* ParticipateRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7C4A1AA2A0D1AA400C3AE4C /* ParticipateRoomView.swift */; }; @@ -207,82 +190,61 @@ }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + B5B6E4C62A962B2D0082FC7B /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 333BF66528571CF00039F77F /* FriendCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendCollectionViewCell.swift; sourceTree = ""; }; 333BF669285864CE0039F77F /* MemoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryViewController.swift; sourceTree = ""; }; 33BDF5612856E03800564211 /* FriendListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendListViewController.swift; sourceTree = ""; }; 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+Extension.swift"; sourceTree = ""; }; - 3915D54A2A7516A2002D6C25 /* URLInfo.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = URLInfo.plist; sourceTree = ""; }; - 3915D54C2A7516E9002D6C25 /* URLInfo+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URLInfo+Extension.swift"; sourceTree = ""; }; + 3915D54A2A7516A2002D6C25 /* Key.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Key.plist; sourceTree = ""; }; + 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Key+Extension.swift"; sourceTree = ""; }; 391612D729E9231B004AE982 /* DetailWaitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitView.swift; sourceTree = ""; }; 391B3002286198C200421F1D /* Size.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Size.swift; sourceTree = ""; }; 392EC77D2855C388006918A9 /* SettingButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingButton.swift; sourceTree = ""; }; 392EC7802855D17D006918A9 /* DetailWaitTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitTitleView.swift; sourceTree = ""; }; 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitViewModel.swift; sourceTree = ""; }; 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitViewModelTest.swift; sourceTree = ""; }; - 397A241328BA516B00454E4F /* DetailWaitAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitAPI.swift; sourceTree = ""; }; - 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitProtocol.swift; sourceTree = ""; }; - 397A241928BA532A00454E4F /* FriendList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendList.swift; sourceTree = ""; }; 398B1C9A29F10B0300DEFCEC /* DetailEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailEditView.swift; sourceTree = ""; }; 398B1CB92A12415B00DEFCEC /* ManitoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ManitoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManitoTests.swift; sourceTree = ""; }; 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailEditViewController.swift; sourceTree = ""; }; - 39A938902A48504200EC2CF2 /* MissionEditEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionEditEndPoint.swift; sourceTree = ""; }; - 39A938922A4852CA00EC2CF2 /* MissionDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionDTO.swift; sourceTree = ""; }; - 39A938942A48562500EC2CF2 /* MisstionEditProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MisstionEditProtocol.swift; sourceTree = ""; }; - 39A938962A48565500EC2CF2 /* MissionEditAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionEditAPI.swift; sourceTree = ""; }; 39BDDCC32A52BB4A005E0A71 /* DetailWaitService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitService.swift; sourceTree = ""; }; 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; 39C957CF2879521400A04A2B /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = ""; }; 39C957D12879523200A04A2B /* Date+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Extension.swift"; sourceTree = ""; }; - 39C957D528799AB900A04A2B /* HTTPMethod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPMethod.swift; sourceTree = ""; }; - 39C957D728799DB900A04A2B /* NetworkError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkError.swift; sourceTree = ""; }; - 39C957DC2879A2B600A04A2B /* Room.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Room.swift; sourceTree = ""; }; - 39C957DE2879A35300A04A2B /* RoomDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDTO.swift; sourceTree = ""; }; - 39C957E02879A3CF00A04A2B /* DailyMission.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyMission.swift; sourceTree = ""; }; 39C957EC287AE4D100A04A2B /* MainEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainEndPoint.swift; sourceTree = ""; }; - 39C957EE287AEBB400A04A2B /* Endpointable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Endpointable.swift; sourceTree = ""; }; 39C957F0287D984900A04A2B /* APIEnvironment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIEnvironment.swift; sourceTree = ""; }; - 39C957F3287D9EB400A04A2B /* APIService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIService.swift; sourceTree = ""; }; - 39C957F5287D9ED000A04A2B /* NetworkRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkRequest.swift; sourceTree = ""; }; - 39C957FB287DAAFA00A04A2B /* DetailWaitEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitEndPoint.swift; sourceTree = ""; }; - 39C957FD287DAB6D00A04A2B /* DetailIngEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailIngEndPoint.swift; sourceTree = ""; }; - 39C957FF287DAC2900A04A2B /* DetailDoneEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailDoneEndPoint.swift; sourceTree = ""; }; - 39C95801287DACC300A04A2B /* RoomEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomEndPoint.swift; sourceTree = ""; }; + 39C95801287DACC300A04A2B /* RoomParticipationEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomParticipationEndPoint.swift; sourceTree = ""; }; 39C95803287DAD3000A04A2B /* LetterEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterEndPoint.swift; sourceTree = ""; }; - 39C95805287DAE5700A04A2B /* InteractionEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InteractionEndPoint.swift; sourceTree = ""; }; 39C95807287DB05C00A04A2B /* SettingEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingEndPoint.swift; sourceTree = ""; }; 39C95809287DC03500A04A2B /* Encodable+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Encodable+Extension.swift"; sourceTree = ""; }; - 39CD581828C4BD9D00496E91 /* DetailStartingProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailStartingProtocol.swift; sourceTree = ""; }; - 39CD581A28C4BE8800496E91 /* DetailStartingAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailStartingAPI.swift; sourceTree = ""; }; - 39CD581C28C4C03B00496E91 /* DetailDoneProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailDoneProtocol.swift; sourceTree = ""; }; - 39CD581E28C4C19100496E91 /* Memory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Memory.swift; sourceTree = ""; }; - 39CD582028C4C3E800496E91 /* DetailDoneAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailDoneAPI.swift; sourceTree = ""; }; 39D95264285B097800183B09 /* CalendarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarView.swift; sourceTree = ""; }; - 39E099AC287FC020004F464E /* LetterDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterDTO.swift; sourceTree = ""; }; 39E6321328BDE59C00CFC6C4 /* Manito.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Manito.entitlements; sourceTree = ""; }; 39EE956C2A401ED400AF6857 /* DetailingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailingView.swift; sourceTree = ""; }; 39EE956E2A404A3800AF6857 /* MissionEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MissionEditViewController.swift; sourceTree = ""; }; - 39EEF65528CB3BB200437654 /* LoginProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginProtocol.swift; sourceTree = ""; }; - 39EEF65728CB3C1100437654 /* Login.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Login.swift; sourceTree = ""; }; - 39EEF65928CB3C7B00437654 /* Token.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Token.swift; sourceTree = ""; }; - 39EEF65B28CB3CD600437654 /* LoginAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginAPI.swift; sourceTree = ""; }; 39EEF65D28CB3CFE00437654 /* LoginEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginEndPoint.swift; sourceTree = ""; }; - 39EEF65F28CB3D6200437654 /* LoginDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginDTO.swift; sourceTree = ""; }; 39F1C12D28D756E600585B83 /* LetterImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterImageViewController.swift; sourceTree = ""; }; 39FFE32728EEFFFE008442EE /* MoreButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreButton.swift; sourceTree = ""; }; - 39FFE33528F45E44008442EE /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; + 39FFE33528F45E44008442EE /* GoogleService-Info-Prod.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Prod.plist"; sourceTree = ""; }; 435B17672913E71400212663 /* DetailingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailingViewController.swift; sourceTree = ""; }; 7E0C5C352855B22700F698D1 /* CreateNickNameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateNickNameViewController.swift; sourceTree = ""; }; 7E0C5C372855B73100F698D1 /* Splash.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Splash.storyboard; sourceTree = ""; }; 7E15F67D28B35B3D00441305 /* TextLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextLiteral.swift; sourceTree = ""; }; - 7E3058C52854B47F00489E6A /* InputNameView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputNameView.swift; sourceTree = ""; }; - 7E3058C72854B64D00489E6A /* InputPersonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputPersonView.swift; sourceTree = ""; }; + 7E3058C52854B47F00489E6A /* InputTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputTitleView.swift; sourceTree = ""; }; + 7E3058C72854B64D00489E6A /* InputCapacityView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputCapacityView.swift; sourceTree = ""; }; 7E3058C92854B7A900489E6A /* InputDateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputDateView.swift; sourceTree = ""; }; 7E7542B22923744300D725CB /* ToastPopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToastPopupView.swift; sourceTree = ""; }; - 7E77DB0328BF9A6700E95D4B /* RoomProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomProtocol.swift; sourceTree = ""; }; - 7E77DB0528BF9C0600E95D4B /* VerificationCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerificationCode.swift; sourceTree = ""; }; - 7E77DB0728BF9D2400E95D4B /* RoomAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomAPI.swift; sourceTree = ""; }; 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangeNickNameViewController.swift; sourceTree = ""; }; 7ED845B92876BE530075AC61 /* SettingViewTableCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewTableCell.swift; sourceTree = ""; }; B50B1AF82856B2C60080992C /* CreateLetterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateLetterViewController.swift; sourceTree = ""; }; @@ -296,11 +258,20 @@ B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIScrollView+Combine.swift"; sourceTree = ""; }; B50CEEBF2A6FF82600CF1C76 /* Publisher+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Publisher+Extension.swift"; sourceTree = ""; }; B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenEndPoint.swift; sourceTree = ""; }; - B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenAPI.swift; sourceTree = ""; }; - B517C04D28D1FE660008BED0 /* TokenProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenProtocol.swift; sourceTree = ""; }; + B53A35B62A963F2100B720BC /* DetailRoomEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailRoomEndPoint.swift; sourceTree = ""; }; + B53A35BF2A96F21A00B720BC /* MainRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainRepository.swift; sourceTree = ""; }; + B53A35C32A96F50100B720BC /* DetailRoomRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailRoomRepository.swift; sourceTree = ""; }; + B53A35C52A96F6DB00B720BC /* RoomParticipationRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomParticipationRepository.swift; sourceTree = ""; }; + B53A35C72A96F84700B720BC /* LetterRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterRepository.swift; sourceTree = ""; }; + B53A35CB2A96F99D00B720BC /* SettingRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingRepository.swift; sourceTree = ""; }; + B53A35CD2A96FA7A00B720BC /* LoginRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginRepository.swift; sourceTree = ""; }; + B53A35CF2A97194D00B720BC /* TokenRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenRepository.swift; sourceTree = ""; }; + B53A35D32A97266D00B720BC /* CreatedRoomRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreatedRoomRequestDTO.swift; sourceTree = ""; }; + B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Dev.xcconfig; sourceTree = ""; }; + B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Prod.xcconfig; sourceTree = ""; }; + B53AD41D2A8C88E100B83B33 /* GoogleService-Info-Dev.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Dev.plist"; sourceTree = ""; }; B54741DF29A3A4DB00B75BA3 /* LetterImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterImageView.swift; sourceTree = ""; }; B54741E929A494E200B75BA3 /* LetterImageError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterImageError.swift; sourceTree = ""; }; - B55B482129C3723B00CFFDAD /* URLRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLRepresentable.swift; sourceTree = ""; }; B55BCEB328D8449E00AF7E45 /* MemoryCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryCollectionViewCell.swift; sourceTree = ""; }; B55BCEB528D99F8600AF7E45 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = ""; }; B55BCEC528F5AFB200AF7E45 /* capsule.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = capsule.gif; sourceTree = ""; }; @@ -309,6 +280,25 @@ B5706BF329B710FC0093D198 /* LetterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterView.swift; sourceTree = ""; }; B5706BF529B9D4650093D198 /* GuideView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GuideView.swift; sourceTree = ""; }; B57CB3032A763C1600474042 /* MTNetwork */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = MTNetwork; sourceTree = ""; }; + B5A085DE2A972D2A00C8A98D /* LetterRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterRequestDTO.swift; sourceTree = ""; }; + B5A085E02A972D7900C8A98D /* LoginRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginRequestDTO.swift; sourceTree = ""; }; + B5A085E22A972DDC00C8A98D /* EditedMissionRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditedMissionRequestDTO.swift; sourceTree = ""; }; + B5A085E52A972EB700C8A98D /* LetterDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterDTO.swift; sourceTree = ""; }; + B5A085E92A97309900C8A98D /* MessageListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageListItem.swift; sourceTree = ""; }; + B5A085EB2A97314800C8A98D /* ParticipatedRoomInfoDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipatedRoomInfoDTO.swift; sourceTree = ""; }; + B5A085ED2A9731F000C8A98D /* DailyMissionDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyMissionDTO.swift; sourceTree = ""; }; + B5A085EF2A97326B00C8A98D /* FriendListDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendListDTO.swift; sourceTree = ""; }; + B5A085F12A9732E800C8A98D /* MemoryDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryDTO.swift; sourceTree = ""; }; + B5A085F32A9733A700C8A98D /* LoginDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginDTO.swift; sourceTree = ""; }; + B5A085F52A9733F900C8A98D /* TokenDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenDTO.swift; sourceTree = ""; }; + B5A085F72A9744CC00C8A98D /* RoomListDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomListDTO.swift; sourceTree = ""; }; + B5A085F92A9745DA00C8A98D /* RoomInfoDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomInfoDTO.swift; sourceTree = ""; }; + B5A085FB2A97470400C8A98D /* RoomInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomInfo.swift; sourceTree = ""; }; + B5A085FD2A97493900C8A98D /* UserInfoDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInfoDTO.swift; sourceTree = ""; }; + B5A085FF2A97496900C8A98D /* MessageListItemDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageListItemDTO.swift; sourceTree = ""; }; + B5A086012A974B8100C8A98D /* RoomListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomListItem.swift; sourceTree = ""; }; + B5A086032A974D2000C8A98D /* ParticipantList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipantList.swift; sourceTree = ""; }; + B5A086052A977F1700C8A98D /* NetworkError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkError.swift; sourceTree = ""; }; B5AE11EF29D1E43B00F86FF8 /* OpenManittoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoView.swift; sourceTree = ""; }; B5AE11F129D28CB500F86FF8 /* OpenManittoPopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoPopupView.swift; sourceTree = ""; }; B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeView.swift; sourceTree = ""; }; @@ -322,9 +312,6 @@ B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultStorage.swift; sourceTree = ""; }; B5F31BB128BE1CD700F61D0F /* UserDefaultHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultHandler.swift; sourceTree = ""; }; B5F31C4F28BF922E00F61D0F /* LetterViewController+MailCompose.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LetterViewController+MailCompose.swift"; sourceTree = ""; }; - B5F31C5128BFA64F00F61D0F /* LetterAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterAPI.swift; sourceTree = ""; }; - B5F31C5328BFA70100F61D0F /* LetterProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterProtocol.swift; sourceTree = ""; }; - B5F31C5528BFA87700F61D0F /* Requestable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Requestable.swift; sourceTree = ""; }; B5F524CB28519AA000614FF7 /* Manito.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Manito.app; sourceTree = BUILT_PRODUCTS_DIR; }; B5F524CE28519AA000614FF7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; B5F524D028519AA000614FF7 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -356,7 +343,6 @@ B5F5253A2854ABF200614FF7 /* MainButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainButton.swift; sourceTree = ""; }; B5F5253C2854B8CB00614FF7 /* UIView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Extension.swift"; sourceTree = ""; }; B5F525412855C97900614FF7 /* UILabel+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UILabel+Extension.swift"; sourceTree = ""; }; - B5F525482855D01D00614FF7 /* Letter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Letter.swift; sourceTree = ""; }; B5FEE9DA28C8498A00DEA07E /* ImageCacheManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCacheManager.swift; sourceTree = ""; }; B5FEE9DC28C849B400DEA07E /* UIImageView+Cache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImageView+Cache.swift"; sourceTree = ""; }; CB21C33828C4C10200128D25 /* CharacterCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterCollectionViewCell.swift; sourceTree = ""; }; @@ -364,8 +350,6 @@ CB2F0FC928A5468C005F04C8 /* gifTto.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = gifTto.gif; sourceTree = ""; }; CB2F0FCA28A5468C005F04C8 /* gifNi.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = gifNi.gif; sourceTree = ""; }; CB358C0128A564080084D001 /* SettingDeveloperInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingDeveloperInfoViewController.swift; sourceTree = ""; }; - CB4C77E328C0D4C9007A1AD2 /* MainProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainProtocol.swift; sourceTree = ""; }; - CB4C77E528C0D4EB007A1AD2 /* MainAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainAPI.swift; sourceTree = ""; }; CB5AE3E3285AAF7400382EA3 /* RoomInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomInfoView.swift; sourceTree = ""; }; CB5AE3E5285AB76800382EA3 /* PeopleInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PeopleInfoView.swift; sourceTree = ""; }; CB637A3A28595C1200FF1240 /* ParticipateRoomViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipateRoomViewController.swift; sourceTree = ""; }; @@ -379,15 +363,14 @@ CBA4D7A32856CE9F0018BDC2 /* CreateRoomCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomCollectionViewCell.swift; sourceTree = ""; }; CBA4D7A52856D48C0018BDC2 /* RoomStateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomStateView.swift; sourceTree = ""; }; CBBFF77B287AE491006A5964 /* DeveloperInfoViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeveloperInfoViewCell.swift; sourceTree = ""; }; + D70220222A7A22EC0024BACD /* CreateRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomView.swift; sourceTree = ""; }; D724AF5C287088310003F280 /* SettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewController.swift; sourceTree = ""; }; D724AF5E28708D830003F280 /* ImageRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageRowView.swift; sourceTree = ""; }; - D739C36228C7B69D00161117 /* SettingProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingProtocol.swift; sourceTree = ""; }; - D739C36428C7B75400161117 /* SettingAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingAPI.swift; sourceTree = ""; }; D739C36628C7B82500161117 /* NicknameDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameDTO.swift; sourceTree = ""; }; D75E8C7E28D76FFB004A6C41 /* LetterCountBadgeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterCountBadgeView.swift; sourceTree = ""; }; D77224DE285DDAB7008B760B /* Notification+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Notification+Extension.swift"; sourceTree = ""; }; D777D2C828C7780E008655BD /* URLLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLLiteral.swift; sourceTree = ""; }; - D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckRoomView.swift; sourceTree = ""; }; + D7B6C97B2858B2D40024F326 /* CheckRoomInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckRoomInfoView.swift; sourceTree = ""; }; D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CharacterCollectionView.swift; sourceTree = ""; }; D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChooseCharacterView.swift; sourceTree = ""; }; D7C4A1AA2A0D1AA400C3AE4C /* ParticipateRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipateRoomView.swift; sourceTree = ""; }; @@ -413,7 +396,7 @@ 39FFE33428F457AF008442EE /* FirebaseMessaging in Frameworks */, B50B1B0428596C900080992C /* SnapKit in Frameworks */, B50B1B0728596CB10080992C /* FSCalendar in Frameworks */, - B53AD35E2A763CC400B83B33 /* MTNetwork in Frameworks */, + B53A35AD2A962E9C00B720BC /* MTNetwork in Frameworks */, B50B1B33285AC0970080992C /* Gifu in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -456,44 +439,9 @@ path = ViewModel; sourceTree = ""; }; - 397A241128BA513E00454E4F /* API */ = { - isa = PBXGroup; - children = ( - 397A241328BA516B00454E4F /* DetailWaitAPI.swift */, - 7E77DB0728BF9D2400E95D4B /* RoomAPI.swift */, - 39CD581A28C4BE8800496E91 /* DetailStartingAPI.swift */, - 39CD582028C4C3E800496E91 /* DetailDoneAPI.swift */, - CB4C77E528C0D4EB007A1AD2 /* MainAPI.swift */, - B5F31C5128BFA64F00F61D0F /* LetterAPI.swift */, - 39EEF65B28CB3CD600437654 /* LoginAPI.swift */, - D739C36428C7B75400161117 /* SettingAPI.swift */, - B517C04B28D1FE5F0008BED0 /* TokenAPI.swift */, - 39A938962A48565500EC2CF2 /* MissionEditAPI.swift */, - ); - path = API; - sourceTree = ""; - }; - 397A241528BA519200454E4F /* Protocol */ = { - isa = PBXGroup; - children = ( - 397A241728BA51B400454E4F /* DetailWaitProtocol.swift */, - 7E77DB0328BF9A6700E95D4B /* RoomProtocol.swift */, - 39CD581828C4BD9D00496E91 /* DetailStartingProtocol.swift */, - 39CD581C28C4C03B00496E91 /* DetailDoneProtocol.swift */, - CB4C77E328C0D4C9007A1AD2 /* MainProtocol.swift */, - B5F31C5328BFA70100F61D0F /* LetterProtocol.swift */, - 39EEF65528CB3BB200437654 /* LoginProtocol.swift */, - D739C36228C7B69D00161117 /* SettingProtocol.swift */, - B517C04D28D1FE660008BED0 /* TokenProtocol.swift */, - 39A938942A48562500EC2CF2 /* MisstionEditProtocol.swift */, - ); - path = Protocol; - sourceTree = ""; - }; 398B1CBA2A12415C00DEFCEC /* ManitoTests */ = { isa = PBXGroup; children = ( - 398B1CBB2A12415C00DEFCEC /* ManitoTests.swift */, 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */, ); path = ManitoTests; @@ -525,14 +473,10 @@ 39C957D328799A8200A04A2B /* Foundation */ = { isa = PBXGroup; children = ( - 39C957D528799AB900A04A2B /* HTTPMethod.swift */, - 39C957D728799DB900A04A2B /* NetworkError.swift */, - 39C957EE287AEBB400A04A2B /* Endpointable.swift */, + 3915D54A2A7516A2002D6C25 /* Key.plist */, + 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */, 39C957F0287D984900A04A2B /* APIEnvironment.swift */, - 39C957F3287D9EB400A04A2B /* APIService.swift */, - 39C957F5287D9ED000A04A2B /* NetworkRequest.swift */, - B5F31C5528BFA87700F61D0F /* Requestable.swift */, - B55B482129C3723B00CFFDAD /* URLRepresentable.swift */, + B5A086052A977F1700C8A98D /* NetworkError.swift */, ); path = Foundation; sourceTree = ""; @@ -541,31 +485,16 @@ isa = PBXGroup; children = ( 39C957EC287AE4D100A04A2B /* MainEndPoint.swift */, - 39C957FB287DAAFA00A04A2B /* DetailWaitEndPoint.swift */, - 39C957FD287DAB6D00A04A2B /* DetailIngEndPoint.swift */, - 39C957FF287DAC2900A04A2B /* DetailDoneEndPoint.swift */, - 39C95801287DACC300A04A2B /* RoomEndPoint.swift */, + B53A35B62A963F2100B720BC /* DetailRoomEndPoint.swift */, + 39C95801287DACC300A04A2B /* RoomParticipationEndPoint.swift */, 39C95803287DAD3000A04A2B /* LetterEndPoint.swift */, - 39C95805287DAE5700A04A2B /* InteractionEndPoint.swift */, 39C95807287DB05C00A04A2B /* SettingEndPoint.swift */, 39EEF65D28CB3CFE00437654 /* LoginEndPoint.swift */, B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */, - 39A938902A48504200EC2CF2 /* MissionEditEndPoint.swift */, ); path = EndPoint; sourceTree = ""; }; - 39E099AB287FBFD2004F464E /* Request */ = { - isa = PBXGroup; - children = ( - 39C957DE2879A35300A04A2B /* RoomDTO.swift */, - 39E099AC287FC020004F464E /* LetterDTO.swift */, - 39EEF65F28CB3D6200437654 /* LoginDTO.swift */, - 39A938922A4852CA00EC2CF2 /* MissionDTO.swift */, - ); - path = Request; - sourceTree = ""; - }; 39EE956B2A401E9600AF6857 /* View */ = { isa = PBXGroup; children = ( @@ -585,10 +514,10 @@ 7E3058C42854B45300489E6A /* UIComponent */ = { isa = PBXGroup; children = ( - 7E3058C52854B47F00489E6A /* InputNameView.swift */, - 7E3058C72854B64D00489E6A /* InputPersonView.swift */, + 7E3058C52854B47F00489E6A /* InputTitleView.swift */, + 7E3058C72854B64D00489E6A /* InputCapacityView.swift */, 7E3058C92854B7A900489E6A /* InputDateView.swift */, - D7B6C97B2858B2D40024F326 /* CheckRoomView.swift */, + D7B6C97B2858B2D40024F326 /* CheckRoomInfoView.swift */, D7C4A1A62A0B2EB000C3AE4C /* CharacterCollectionView.swift */, ); path = UIComponent; @@ -634,6 +563,96 @@ path = Cell; sourceTree = ""; }; + B53A35B22A9630FE00B720BC /* Service */ = { + isa = PBXGroup; + children = ( + B53A35B32A96310700B720BC /* UserDefaultService */, + ); + path = Service; + sourceTree = ""; + }; + B53A35B32A96310700B720BC /* UserDefaultService */ = { + isa = PBXGroup; + children = ( + B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */, + B5F31BB128BE1CD700F61D0F /* UserDefaultHandler.swift */, + ); + path = UserDefaultService; + sourceTree = ""; + }; + B53A35B82A9640EB00B720BC /* Data */ = { + isa = PBXGroup; + children = ( + B53A35D12A971E4200B720BC /* DTO */, + B53A35BE2A96F1F900B720BC /* Repository */, + B5F525462855D00B00614FF7 /* Network */, + ); + path = Data; + sourceTree = ""; + }; + B53A35BE2A96F1F900B720BC /* Repository */ = { + isa = PBXGroup; + children = ( + B53A35BF2A96F21A00B720BC /* MainRepository.swift */, + B53A35C32A96F50100B720BC /* DetailRoomRepository.swift */, + B53A35C52A96F6DB00B720BC /* RoomParticipationRepository.swift */, + B53A35C72A96F84700B720BC /* LetterRepository.swift */, + B53A35CB2A96F99D00B720BC /* SettingRepository.swift */, + B53A35CD2A96FA7A00B720BC /* LoginRepository.swift */, + B53A35CF2A97194D00B720BC /* TokenRepository.swift */, + ); + path = Repository; + sourceTree = ""; + }; + B53A35D12A971E4200B720BC /* DTO */ = { + isa = PBXGroup; + children = ( + B5A085F52A9733F900C8A98D /* TokenDTO.swift */, + D739C36628C7B82500161117 /* NicknameDTO.swift */, + B53A35D22A97265F00B720BC /* Request */, + B5A085E42A972E5F00C8A98D /* Response */, + ); + path = DTO; + sourceTree = ""; + }; + B53A35D22A97265F00B720BC /* Request */ = { + isa = PBXGroup; + children = ( + B53A35D32A97266D00B720BC /* CreatedRoomRequestDTO.swift */, + B5A085DE2A972D2A00C8A98D /* LetterRequestDTO.swift */, + B5A085E02A972D7900C8A98D /* LoginRequestDTO.swift */, + B5A085E22A972DDC00C8A98D /* EditedMissionRequestDTO.swift */, + ); + path = Request; + sourceTree = ""; + }; + B53AD40F2A8BC69700B83B33 /* Configuration */ = { + isa = PBXGroup; + children = ( + B53AD4112A8BC6A400B83B33 /* Dev */, + B53AD4102A8BC69E00B83B33 /* Prod */, + ); + path = Configuration; + sourceTree = ""; + }; + B53AD4102A8BC69E00B83B33 /* Prod */ = { + isa = PBXGroup; + children = ( + B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */, + 39FFE33528F45E44008442EE /* GoogleService-Info-Prod.plist */, + ); + path = Prod; + sourceTree = ""; + }; + B53AD4112A8BC6A400B83B33 /* Dev */ = { + isa = PBXGroup; + children = ( + B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */, + B53AD41D2A8C88E100B83B33 /* GoogleService-Info-Dev.plist */, + ); + path = Dev; + sourceTree = ""; + }; B54741DE29A3A4BA00B75BA3 /* Views */ = { isa = PBXGroup; children = ( @@ -677,6 +696,42 @@ path = Packages; sourceTree = ""; }; + B5A085E42A972E5F00C8A98D /* Response */ = { + isa = PBXGroup; + children = ( + B5A085FD2A97493900C8A98D /* UserInfoDTO.swift */, + B5A085EB2A97314800C8A98D /* ParticipatedRoomInfoDTO.swift */, + B5A085F92A9745DA00C8A98D /* RoomInfoDTO.swift */, + B5A085EF2A97326B00C8A98D /* FriendListDTO.swift */, + B5A085F72A9744CC00C8A98D /* RoomListDTO.swift */, + B5A085FF2A97496900C8A98D /* MessageListItemDTO.swift */, + B5A085F32A9733A700C8A98D /* LoginDTO.swift */, + B5A085E52A972EB700C8A98D /* LetterDTO.swift */, + B5A085ED2A9731F000C8A98D /* DailyMissionDTO.swift */, + B5A085F12A9732E800C8A98D /* MemoryDTO.swift */, + ); + path = Response; + sourceTree = ""; + }; + B5A085E72A97302900C8A98D /* Domain */ = { + isa = PBXGroup; + children = ( + B5A085E82A97303900C8A98D /* Entity */, + ); + path = Domain; + sourceTree = ""; + }; + B5A085E82A97303900C8A98D /* Entity */ = { + isa = PBXGroup; + children = ( + B5A085E92A97309900C8A98D /* MessageListItem.swift */, + B5A086012A974B8100C8A98D /* RoomListItem.swift */, + B5A085FB2A97470400C8A98D /* RoomInfo.swift */, + B5A086032A974D2000C8A98D /* ParticipantList.swift */, + ); + path = Entity; + sourceTree = ""; + }; B5AE11EE29D1E38D00F86FF8 /* View */ = { isa = PBXGroup; children = ( @@ -724,19 +779,11 @@ path = Services; sourceTree = ""; }; - B5F31BAE28BE1C7900F61D0F /* Storage */ = { - isa = PBXGroup; - children = ( - B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */, - B5F31BB128BE1CD700F61D0F /* UserDefaultHandler.swift */, - ); - path = Storage; - sourceTree = ""; - }; B5F524C228519AA000614FF7 = { isa = PBXGroup; children = ( B55BCEB528D99F8600AF7E45 /* Settings.bundle */, + B53AD40F2A8BC69700B83B33 /* Configuration */, B5F524CD28519AA000614FF7 /* Manito */, 398B1CBA2A12415C00DEFCEC /* ManitoTests */, B57CB3022A763BB200474042 /* Packages */, @@ -757,9 +804,11 @@ B5F524CD28519AA000614FF7 /* Manito */ = { isa = PBXGroup; children = ( - B5F525462855D00B00614FF7 /* Network */, + B5A085E72A97302900C8A98D /* Domain */, + B53A35B82A9640EB00B720BC /* Data */, B5F524E328519AC300614FF7 /* Screens */, B5F524E428519AC600614FF7 /* Global */, + B53A35B22A9630FE00B720BC /* Service */, ); path = Manito; sourceTree = ""; @@ -805,6 +854,7 @@ B5F524E528519ACA00614FF7 /* CreateRoom */ = { isa = PBXGroup; children = ( + D70220212A7A22DC0024BACD /* View */, 7E3058C42854B45300489E6A /* UIComponent */, B5F525052851A05500614FF7 /* CreateRoomViewController.swift */, ); @@ -910,7 +960,6 @@ B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */, B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */, B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */, - 3915D54C2A7516E9002D6C25 /* URLInfo+Extension.swift */, B50CEEBF2A6FF82600CF1C76 /* Publisher+Extension.swift */, ); path = Extension; @@ -921,7 +970,6 @@ children = ( 39E6321328BDE59C00CFC6C4 /* Manito.entitlements */, B5F524DC28519AA100614FF7 /* Info.plist */, - 39FFE33528F45E44008442EE /* GoogleService-Info.plist */, B5F524CE28519AA000614FF7 /* AppDelegate.swift */, B5F524D028519AA000614FF7 /* SceneDelegate.swift */, ); @@ -954,7 +1002,6 @@ CB7B23A728C4ECA8004A4CF3 /* Character.swift */, 7E15F67D28B35B3D00441305 /* TextLiteral.swift */, D777D2C828C7780E008655BD /* URLLiteral.swift */, - 3915D54A2A7516A2002D6C25 /* URLInfo.plist */, ); path = Literal; sourceTree = ""; @@ -1010,33 +1057,12 @@ B5F525462855D00B00614FF7 /* Network */ = { isa = PBXGroup; children = ( - B5F31BAE28BE1C7900F61D0F /* Storage */, - 397A241528BA519200454E4F /* Protocol */, - 397A241128BA513E00454E4F /* API */, - 39C957EA287AE45900A04A2B /* EndPoint */, 39C957D328799A8200A04A2B /* Foundation */, - B5F525472855D01200614FF7 /* Models */, + 39C957EA287AE45900A04A2B /* EndPoint */, ); path = Network; sourceTree = ""; }; - B5F525472855D01200614FF7 /* Models */ = { - isa = PBXGroup; - children = ( - 39E099AB287FBFD2004F464E /* Request */, - B5F525482855D01D00614FF7 /* Letter.swift */, - 39C957DC2879A2B600A04A2B /* Room.swift */, - 7E77DB0528BF9C0600E95D4B /* VerificationCode.swift */, - 39C957E02879A3CF00A04A2B /* DailyMission.swift */, - 397A241928BA532A00454E4F /* FriendList.swift */, - 39CD581E28C4C19100496E91 /* Memory.swift */, - 39EEF65728CB3C1100437654 /* Login.swift */, - 39EEF65928CB3C7B00437654 /* Token.swift */, - D739C36628C7B82500161117 /* NicknameDTO.swift */, - ); - path = Models; - sourceTree = ""; - }; CB5AE3E2285AAF2E00382EA3 /* UIComponent */ = { isa = PBXGroup; children = ( @@ -1102,6 +1128,7 @@ CBA15C91285CE1880051EDE2 /* ChooseCharacter */ = { isa = PBXGroup; children = ( + D7B83FD32A92F55200BFD8FF /* View */, CBA15C92285CE18F0051EDE2 /* UIComponent */, CBA15C93285CE1A80051EDE2 /* ChooseCharacterViewController.swift */, ); @@ -1112,7 +1139,6 @@ isa = PBXGroup; children = ( CB21C33828C4C10200128D25 /* CharacterCollectionViewCell.swift */, - D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */, ); path = UIComponent; sourceTree = ""; @@ -1135,6 +1161,14 @@ path = Cell; sourceTree = ""; }; + D70220212A7A22DC0024BACD /* View */ = { + isa = PBXGroup; + children = ( + D70220222A7A22EC0024BACD /* CreateRoomView.swift */, + ); + path = View; + sourceTree = ""; + }; D724AF5B287088110003F280 /* Setting */ = { isa = PBXGroup; children = ( @@ -1172,6 +1206,14 @@ path = Component; sourceTree = ""; }; + D7B83FD32A92F55200BFD8FF /* View */ = { + isa = PBXGroup; + children = ( + D7C4A1A82A0B895300C3AE4C /* ChooseCharacterView.swift */, + ); + path = View; + sourceTree = ""; + }; D7C4A1AE2A0E51F500C3AE4C /* View */ = { isa = PBXGroup; children = ( @@ -1212,6 +1254,8 @@ B5F524C728519AA000614FF7 /* Sources */, B5F524C828519AA000614FF7 /* Frameworks */, B5F524C928519AA000614FF7 /* Resources */, + B53AD41E2A8C892800B83B33 /* GoogleService-Info.plist */, + B5B6E4C62A962B2D0082FC7B /* Embed Frameworks */, ); buildRules = ( ); @@ -1224,7 +1268,7 @@ B50B1B32285AC0970080992C /* Gifu */, CB6637E72959CBC60050BD04 /* SkeletonView */, 39FFE33328F457AF008442EE /* FirebaseMessaging */, - B53AD35D2A763CC400B83B33 /* MTNetwork */, + B53A35AC2A962E9C00B720BC /* MTNetwork */, ); productName = Manito; productReference = B5F524CB28519AA000614FF7 /* Manito.app */; @@ -1289,10 +1333,9 @@ files = ( CB2F0FCB28A5468C005F04C8 /* gifMa.gif in Resources */, CB2F0FCD28A5468C005F04C8 /* gifNi.gif in Resources */, - 39FFE33628F45E44008442EE /* GoogleService-Info.plist in Resources */, B50B1B3C285AD2B20080992C /* logo.gif in Resources */, 7E0C5C382855B73100F698D1 /* Splash.storyboard in Resources */, - 3915D54B2A7516A2002D6C25 /* URLInfo.plist in Resources */, + 3915D54B2A7516A2002D6C25 /* Key.plist in Resources */, B5F524DB28519AA100614FF7 /* LaunchScreen.storyboard in Resources */, B5F524D828519AA100614FF7 /* Assets.xcassets in Resources */, B55BCEB628D99F8600AF7E45 /* Settings.bundle in Resources */, @@ -1307,13 +1350,34 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + B53AD41E2A8C892800B83B33 /* GoogleService-Info.plist */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "GoogleService-Info.plist"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/${PRODUCT_NAME}.app/GoogleService-Info.plist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\ncase \"${CONFIGURATION}\" in\n \"Dev\" )\ncp -r \"$SRCROOT/Configuration/Dev/GoogleService-Info-Dev.plist\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist\" ;;\n \"Prod\" )\ncp -r \"$SRCROOT/Configuration/Prod/GoogleService-Info-Prod.plist\" \"${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist\" ;;\n*)\n;;\nesac\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 398B1CB52A12415B00DEFCEC /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 395B5BCC2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift in Sources */, - 398B1CBC2A12415C00DEFCEC /* ManitoTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1322,130 +1386,116 @@ buildActionMask = 2147483647; files = ( D75E8C7F28D76FFB004A6C41 /* LetterCountBadgeView.swift in Sources */, - 39A938912A48504200EC2CF2 /* MissionEditEndPoint.swift in Sources */, CBA4D7A62856D48C0018BDC2 /* RoomStateView.swift in Sources */, 333BF66628571CF00039F77F /* FriendCollectionViewCell.swift in Sources */, 39D95265285B097800183B09 /* CalendarView.swift in Sources */, - 39EEF65828CB3C1100437654 /* Login.swift in Sources */, 39C957ED287AE4D100A04A2B /* MainEndPoint.swift in Sources */, - 39C957EF287AEBB400A04A2B /* Endpointable.swift in Sources */, B5F525292851A2A400614FF7 /* Logger.swift in Sources */, B50B1AFF2856D3820080992C /* CreateLetterPhotoView.swift in Sources */, - 397A241A28BA532A00454E4F /* FriendList.swift in Sources */, - B5F31C5628BFA87700F61D0F /* Requestable.swift in Sources */, + B5A086042A974D2000C8A98D /* ParticipantList.swift in Sources */, 397A241028BA494100454E4F /* APIEnvironment.swift in Sources */, CBBFF77C287AE491006A5964 /* DeveloperInfoViewCell.swift in Sources */, - B517C04E28D1FE660008BED0 /* TokenProtocol.swift in Sources */, 392EC7812855D17D006918A9 /* DetailWaitTitleView.swift in Sources */, - 7E3058C82854B64D00489E6A /* InputPersonView.swift in Sources */, + B5A085E62A972EB700C8A98D /* LetterDTO.swift in Sources */, + 7E3058C82854B64D00489E6A /* InputCapacityView.swift in Sources */, + B53A35C62A96F6DB00B720BC /* RoomParticipationRepository.swift in Sources */, CBA15C94285CE1A80051EDE2 /* ChooseCharacterViewController.swift in Sources */, 39EEF65E28CB3CFE00437654 /* LoginEndPoint.swift in Sources */, 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */, - 39C957FC287DAAFA00A04A2B /* DetailWaitEndPoint.swift in Sources */, CB674C2128596A310063A6B7 /* CheckRoomViewController.swift in Sources */, - 39EEF65628CB3BB200437654 /* LoginProtocol.swift in Sources */, + B5A085DF2A972D2A00C8A98D /* LetterRequestDTO.swift in Sources */, 39C9580A287DC03500A04A2B /* Encodable+Extension.swift in Sources */, B50B1AFB2856B5180080992C /* IndividualMissionView.swift in Sources */, - B5F525492855D01D00614FF7 /* Letter.swift in Sources */, B5F524FB28519C2A00614FF7 /* MainViewController.swift in Sources */, - 7E3058C62854B47F00489E6A /* InputNameView.swift in Sources */, + 7E3058C62854B47F00489E6A /* InputTitleView.swift in Sources */, B5F5250128519EFB00614FF7 /* ImageLiteral.swift in Sources */, - 39C957D828799DB900A04A2B /* NetworkError.swift in Sources */, 39F1C12E28D756E600585B83 /* LetterImageViewController.swift in Sources */, 7E7542B32923744300D725CB /* ToastPopupView.swift in Sources */, - 39CD581B28C4BE8800496E91 /* DetailStartingAPI.swift in Sources */, + B5A085FE2A97493900C8A98D /* UserInfoDTO.swift in Sources */, 39C957D22879523200A04A2B /* Date+Extension.swift in Sources */, + B53A35C82A96F84700B720BC /* LetterRepository.swift in Sources */, 39EE956F2A404A3800AF6857 /* MissionEditViewController.swift in Sources */, B5F5250A2851A06700614FF7 /* DetailWaitViewController.swift in Sources */, + B5A085F02A97326B00C8A98D /* FriendListDTO.swift in Sources */, D7C4A1AB2A0D1AA400C3AE4C /* ParticipateRoomView.swift in Sources */, 39C957D02879521400A04A2B /* String+Extension.swift in Sources */, 399D17AB2856C83B00F50D9D /* DetailEditViewController.swift in Sources */, + B5A086002A97496900C8A98D /* MessageListItemDTO.swift in Sources */, 7E15F67E28B35B3D00441305 /* TextLiteral.swift in Sources */, - 39C957DD2879A2B600A04A2B /* Room.swift in Sources */, B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */, B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */, B5F525422855C97900614FF7 /* UILabel+Extension.swift in Sources */, + B53A35CE2A96FA7A00B720BC /* LoginRepository.swift in Sources */, CB21C33928C4C10200128D25 /* CharacterCollectionViewCell.swift in Sources */, - 39A938952A48562500EC2CF2 /* MisstionEditProtocol.swift in Sources */, - 39EEF65A28CB3C7B00437654 /* Token.swift in Sources */, 39C95804287DAD3000A04A2B /* LetterEndPoint.swift in Sources */, - 7E77DB0828BF9D2400E95D4B /* RoomAPI.swift in Sources */, B50B1B44285B146A0080992C /* OpenManittoCollectionViewCell.swift in Sources */, B5F5253128545E4C00614FF7 /* BackButton.swift in Sources */, - 39C957D628799AB900A04A2B /* HTTPMethod.swift in Sources */, 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */, B5F525202851A21D00614FF7 /* UIViewController+Extension.swift in Sources */, 7ED845BA2876BE530075AC61 /* SettingViewTableCell.swift in Sources */, B5B3C15F2A41D6F400AABD6F /* LetterService.swift in Sources */, B5AE11F229D28CB500F86FF8 /* OpenManittoPopupView.swift in Sources */, B517C04A28D1F7EC0008BED0 /* TokenEndPoint.swift in Sources */, - 39C957DF2879A35300A04A2B /* RoomDTO.swift in Sources */, 39EE956D2A401ED400AF6857 /* DetailingView.swift in Sources */, 39C95808287DB05C00A04A2B /* SettingEndPoint.swift in Sources */, - 39C957F4287D9EB400A04A2B /* APIService.swift in Sources */, + B5A086062A977F1700C8A98D /* NetworkError.swift in Sources */, B5F524CF28519AA000614FF7 /* AppDelegate.swift in Sources */, - 39A938972A48565500EC2CF2 /* MissionEditAPI.swift in Sources */, 435B17682913E71400212663 /* DetailingViewController.swift in Sources */, B50CEE912A445EB700CF1C76 /* UIScrollView+Combine.swift in Sources */, + B5A085F22A9732E800C8A98D /* MemoryDTO.swift in Sources */, B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */, D7C4A1A92A0B895300C3AE4C /* ChooseCharacterView.swift in Sources */, - 397A241828BA51B400454E4F /* DetailWaitProtocol.swift in Sources */, 7EA25C2728C4FEA800746AEA /* ChangeNickNameViewController.swift in Sources */, D724AF5F28708D830003F280 /* ImageRowView.swift in Sources */, 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */, B5F5251E2851A1C700614FF7 /* BaseTableViewCell.swift in Sources */, 39BDDCC42A52BB4A005E0A71 /* DetailWaitService.swift in Sources */, - 39C957F6287D9ED000A04A2B /* NetworkRequest.swift in Sources */, + B5A086022A974B8100C8A98D /* RoomListItem.swift in Sources */, + B53A35CC2A96F99D00B720BC /* SettingRepository.swift in Sources */, B50CEEC02A6FF82600CF1C76 /* Publisher+Extension.swift in Sources */, - 39EEF65C28CB3CD600437654 /* LoginAPI.swift in Sources */, B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */, + B53A35C02A96F21A00B720BC /* MainRepository.swift in Sources */, D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */, - 39C957FE287DAB6D00A04A2B /* DetailIngEndPoint.swift in Sources */, + B5A085EA2A97309900C8A98D /* MessageListItem.swift in Sources */, B5F5251A2851A12600614FF7 /* BaseViewController.swift in Sources */, B5AE11F029D1E43B00F86FF8 /* OpenManittoView.swift in Sources */, - CB4C77E428C0D4C9007A1AD2 /* MainProtocol.swift in Sources */, CB85DE1F28A76F3400399109 /* SettingDeveloperInfoHeaderView.swift in Sources */, B5706BF429B710FC0093D198 /* LetterView.swift in Sources */, - D739C36528C7B75400161117 /* SettingAPI.swift in Sources */, B5F525062851A05500614FF7 /* CreateRoomViewController.swift in Sources */, - B517C04C28D1FE5F0008BED0 /* TokenAPI.swift in Sources */, B5F524D128519AA000614FF7 /* SceneDelegate.swift in Sources */, + B5A085E32A972DDC00C8A98D /* EditedMissionRequestDTO.swift in Sources */, CB637A3B28595C1200FF1240 /* ParticipateRoomViewController.swift in Sources */, B5F524FF28519EF300614FF7 /* UIFont+Extension.swift in Sources */, - B5F31C5228BFA64F00F61D0F /* LetterAPI.swift in Sources */, D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */, 391B3003286198C200421F1D /* Size.swift in Sources */, - 39C95800287DAC2900A04A2B /* DetailDoneEndPoint.swift in Sources */, B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */, - 7E77DB0428BF9A6700E95D4B /* RoomProtocol.swift in Sources */, - D739C36328C7B69D00161117 /* SettingProtocol.swift in Sources */, B5F525262851A26D00614FF7 /* NSObject+Extension.swift in Sources */, 39FFE32828EEFFFE008442EE /* MoreButton.swift in Sources */, B5706BE129ADC20A0093D198 /* CreateLetterView.swift in Sources */, - 39EEF66028CB3D6200437654 /* LoginDTO.swift in Sources */, 7E0C5C362855B22700F698D1 /* CreateNickNameViewController.swift in Sources */, B5B3C15D2A41D6EB00AABD6F /* LetterViewModel.swift in Sources */, + B5A085FC2A97470400C8A98D /* RoomInfo.swift in Sources */, CB674C1C285966020063A6B7 /* InputInvitedCodeView.swift in Sources */, B50B1AF92856B2C60080992C /* CreateLetterViewController.swift in Sources */, B5F31C5028BF922E00F61D0F /* LetterViewController+MailCompose.swift in Sources */, 7E3058CA2854B7A900489E6A /* InputDateView.swift in Sources */, - B5F31C5428BFA70100F61D0F /* LetterProtocol.swift in Sources */, - D7B6C97C2858B2D40024F326 /* CheckRoomView.swift in Sources */, + D7B6C97C2858B2D40024F326 /* CheckRoomInfoView.swift in Sources */, B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */, B5F31BB228BE1CD700F61D0F /* UserDefaultHandler.swift in Sources */, - 39CD581D28C4C03C00496E91 /* DetailDoneProtocol.swift in Sources */, CB9592B52855D52700847751 /* CommonMissionView.swift in Sources */, CBA4D7A42856CE9F0018BDC2 /* CreateRoomCollectionViewCell.swift in Sources */, D7C4A1A72A0B2EB000C3AE4C /* CharacterCollectionView.swift in Sources */, - 39C95802287DACC300A04A2B /* RoomEndPoint.swift in Sources */, + 39C95802287DACC300A04A2B /* RoomParticipationEndPoint.swift in Sources */, 395B5BC22A25E20000CE1420 /* DetailWaitViewModel.swift in Sources */, - CB4C77E628C0D4EB007A1AD2 /* MainAPI.swift in Sources */, B5F524FD28519EEC00614FF7 /* UIColor+Extension.swift in Sources */, B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */, D7C4A1AD2A0DD8FA00C3AE4C /* SettingView.swift in Sources */, 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */, + B53A35D42A97266D00B720BC /* CreatedRoomRequestDTO.swift in Sources */, + B53A35B72A963F2100B720BC /* DetailRoomEndPoint.swift in Sources */, D7C4A1B02A0E522800C3AE4C /* SettingViewController+MailComposeViewControllerDelegate.swift in Sources */, - 3915D54D2A7516E9002D6C25 /* URLInfo+Extension.swift in Sources */, + 3915D54D2A7516E9002D6C25 /* Key+Extension.swift in Sources */, + B5A085EE2A9731F000C8A98D /* DailyMissionDTO.swift in Sources */, 33BDF5622856E03800564211 /* FriendListViewController.swift in Sources */, B5F5250E2851A07700614FF7 /* LetterViewController.swift in Sources */, B5F5251C2851A19A00614FF7 /* BaseCollectionViewCell.swift in Sources */, @@ -1453,36 +1503,35 @@ 398B1C9B29F10B0300DEFCEC /* DetailEditView.swift in Sources */, B50B1AFD2856C3500080992C /* CreateLetterTextView.swift in Sources */, D77224DF285DDAB7008B760B /* Notification+Extension.swift in Sources */, + B5A085F42A9733A700C8A98D /* LoginDTO.swift in Sources */, + B53A35D02A97194D00B720BC /* TokenRepository.swift in Sources */, B5706BF629B9D4650093D198 /* GuideView.swift in Sources */, B50B1B41285B048A0080992C /* OpenManittoViewController.swift in Sources */, CB5AE3E6285AB76800382EA3 /* PeopleInfoView.swift in Sources */, B5B3C1652A427B5800AABD6F /* UIControl+Combine.swift in Sources */, - 39CD581F28C4C19100496E91 /* Memory.swift in Sources */, - 39E099AD287FC020004F464E /* LetterDTO.swift in Sources */, B5F525222851A24100614FF7 /* UITableView+Extension.swift in Sources */, + B5A085F82A9744CC00C8A98D /* RoomListDTO.swift in Sources */, + B5A085F62A9733F900C8A98D /* TokenDTO.swift in Sources */, B5F5253B2854ABF200614FF7 /* MainButton.swift in Sources */, B50B1B2A285AB7650080992C /* SplashViewController.swift in Sources */, B5FEE9DB28C8498A00DEA07E /* ImageCacheManager.swift in Sources */, - 39CD581928C4BD9D00496E91 /* DetailStartingProtocol.swift in Sources */, B5F5253528547F1900614FF7 /* LetterHeaderView.swift in Sources */, - 39C95806287DAE5700A04A2B /* InteractionEndPoint.swift in Sources */, + B5A085FA2A9745DA00C8A98D /* RoomInfoDTO.swift in Sources */, B5F52537285481C800614FF7 /* LetterCollectionViewCell.swift in Sources */, - 7E77DB0628BF9C0600E95D4B /* VerificationCode.swift in Sources */, + B53A35C42A96F50100B720BC /* DetailRoomRepository.swift in Sources */, CB358C0228A564080084D001 /* SettingDeveloperInfoViewController.swift in Sources */, CB7B23A828C4ECA8004A4CF3 /* Character.swift in Sources */, - 39C957E12879A3CF00A04A2B /* DailyMission.swift in Sources */, - B55B482229C3723B00CFFDAD /* URLRepresentable.swift in Sources */, B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */, - 39CD582128C4C3E800496E91 /* DetailDoneAPI.swift in Sources */, + B5A085EC2A97314800C8A98D /* ParticipatedRoomInfoDTO.swift in Sources */, D724AF5D287088310003F280 /* SettingViewController.swift in Sources */, B5F5253D2854B8CB00614FF7 /* UIView+Extension.swift in Sources */, 39018F4228C4708A00C78DBA /* UIButton+Extension.swift in Sources */, CB5AE3E4285AAF7400382EA3 /* RoomInfoView.swift in Sources */, B5FEE9DD28C849B400DEA07E /* UIImageView+Cache.swift in Sources */, CB9592B22855C09A00847751 /* ManitoRoomCollectionCell.swift in Sources */, + D70220232A7A22EC0024BACD /* CreateRoomView.swift in Sources */, B5AE11F429D32EE700F86FF8 /* SelectManitteeView.swift in Sources */, - 397A241428BA516B00454E4F /* DetailWaitAPI.swift in Sources */, - 39A938932A4852CA00EC2CF2 /* MissionDTO.swift in Sources */, + B5A085E12A972D7900C8A98D /* LoginRequestDTO.swift in Sources */, B5F525242851A25400614FF7 /* UICollectionView+Extension.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1517,8 +1566,9 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - 398B1CBF2A12415C00DEFCEC /* Debug */ = { + 398B1CBF2A12415C00DEFCEC /* Dev */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; @@ -1538,10 +1588,11 @@ TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Manito.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Manito"; }; - name = Debug; + name = Dev; }; - 398B1CC02A12415C00DEFCEC /* Release */ = { + 398B1CC02A12415C00DEFCEC /* Prod */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; @@ -1561,10 +1612,11 @@ TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Manito.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Manito"; }; - name = Release; + name = Prod; }; - B5F524DD28519AA100614FF7 /* Debug */ = { + B5F524DD28519AA100614FF7 /* Dev */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -1622,10 +1674,11 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; - name = Debug; + name = Dev; }; - B5F524DE28519AA100614FF7 /* Release */ = { + B5F524DE28519AA100614FF7 /* Prod */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -1677,10 +1730,11 @@ SWIFT_OPTIMIZATION_LEVEL = "-O"; VALIDATE_PRODUCT = YES; }; - name = Release; + name = Prod; }; - B5F524E028519AA100614FF7 /* Debug */ = { + B5F524E028519AA100614FF7 /* Dev */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B53AD4122A8BC6B300B83B33 /* Dev.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -1692,7 +1746,7 @@ DEVELOPMENT_TEAM = HF8GHZB58X; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Manito/Global/Supports/Info.plist; - INFOPLIST_KEY_CFBundleDisplayName = "애니또"; + INFOPLIST_KEY_CFBundleDisplayName = "$(BUNDLE_DISPLAY_NAME)"; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.lifestyle"; INFOPLIST_KEY_NSCameraUsageDescription = "'마니또'가 마니띠에게 전송할 사진을 위해 사용자의 카메라에 접근하려고 합니다."; INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "'애니또'가 사용자의 앨범에 접근하려고 합니다. 쪽지에 있는 사진을 앨범에 저장하세요."; @@ -1708,6 +1762,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.5.0; + OTHER_SWIFT_FLAGS = "-DDEV"; PRODUCT_BUNDLE_IDENTIFIER = com.TeamFirefighter.Manito; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1715,10 +1770,11 @@ SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; - name = Debug; + name = Dev; }; - B5F524E128519AA100614FF7 /* Release */ = { + B5F524E128519AA100614FF7 /* Prod */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B53AD4132A8BC6BE00B83B33 /* Prod.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; @@ -1730,7 +1786,7 @@ DEVELOPMENT_TEAM = HF8GHZB58X; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Manito/Global/Supports/Info.plist; - INFOPLIST_KEY_CFBundleDisplayName = "애니또"; + INFOPLIST_KEY_CFBundleDisplayName = "$(BUNDLE_DISPLAY_NAME)"; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.lifestyle"; INFOPLIST_KEY_NSCameraUsageDescription = "'마니또'가 마니띠에게 전송할 사진을 위해 사용자의 카메라에 접근하려고 합니다."; INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "'애니또'가 사용자의 앨범에 접근하려고 합니다. 쪽지에 있는 사진을 앨범에 저장하세요."; @@ -1746,6 +1802,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.5.0; + OTHER_SWIFT_FLAGS = "-DPROD"; PRODUCT_BUNDLE_IDENTIFIER = com.TeamFirefighter.Manito; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1753,7 +1810,7 @@ SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 1; }; - name = Release; + name = Prod; }; /* End XCBuildConfiguration section */ @@ -1761,29 +1818,29 @@ 398B1CC12A12415C00DEFCEC /* Build configuration list for PBXNativeTarget "ManitoTests" */ = { isa = XCConfigurationList; buildConfigurations = ( - 398B1CBF2A12415C00DEFCEC /* Debug */, - 398B1CC02A12415C00DEFCEC /* Release */, + 398B1CBF2A12415C00DEFCEC /* Dev */, + 398B1CC02A12415C00DEFCEC /* Prod */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; + defaultConfigurationName = Prod; }; B5F524C628519AA000614FF7 /* Build configuration list for PBXProject "Manito" */ = { isa = XCConfigurationList; buildConfigurations = ( - B5F524DD28519AA100614FF7 /* Debug */, - B5F524DE28519AA100614FF7 /* Release */, + B5F524DD28519AA100614FF7 /* Dev */, + B5F524DE28519AA100614FF7 /* Prod */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; + defaultConfigurationName = Prod; }; B5F524DF28519AA100614FF7 /* Build configuration list for PBXNativeTarget "Manito" */ = { isa = XCConfigurationList; buildConfigurations = ( - B5F524E028519AA100614FF7 /* Debug */, - B5F524E128519AA100614FF7 /* Release */, + B5F524E028519AA100614FF7 /* Dev */, + B5F524E128519AA100614FF7 /* Prod */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; + defaultConfigurationName = Prod; }; /* End XCConfigurationList section */ @@ -1861,7 +1918,7 @@ package = B50B1B31285AC0970080992C /* XCRemoteSwiftPackageReference "Gifu" */; productName = Gifu; }; - B53AD35D2A763CC400B83B33 /* MTNetwork */ = { + B53A35AC2A962E9C00B720BC /* MTNetwork */ = { isa = XCSwiftPackageProductDependency; productName = MTNetwork; }; diff --git a/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito.xcscheme b/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito-Dev.xcscheme similarity index 94% rename from Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito.xcscheme rename to Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito-Dev.xcscheme index 0e99ce95e..7719f96ec 100644 --- a/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito.xcscheme +++ b/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito-Dev.xcscheme @@ -23,7 +23,7 @@ @@ -42,7 +42,7 @@ + buildConfiguration = "Dev"> diff --git a/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito-Prod.xcscheme b/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito-Prod.xcscheme new file mode 100644 index 000000000..5dc19be77 --- /dev/null +++ b/Manito/Manito.xcodeproj/xcshareddata/xcschemes/Manito-Prod.xcscheme @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Manito/Manito/Network/Models/NicknameDTO.swift b/Manito/Manito/Data/DTO/NicknameDTO.swift similarity index 70% rename from Manito/Manito/Network/Models/NicknameDTO.swift rename to Manito/Manito/Data/DTO/NicknameDTO.swift index 58cbb6033..e9347ad51 100644 --- a/Manito/Manito/Network/Models/NicknameDTO.swift +++ b/Manito/Manito/Data/DTO/NicknameDTO.swift @@ -1,5 +1,5 @@ // -// Setting.swift +// NicknameDTO.swift // Manito // // Created by 이성호 on 2022/09/07. @@ -8,5 +8,5 @@ import Foundation struct NicknameDTO: Codable { - let nickname: String? + let nickname: String } diff --git a/Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift b/Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift new file mode 100644 index 000000000..12e7bad2f --- /dev/null +++ b/Manito/Manito/Data/DTO/Request/CreatedRoomRequestDTO.swift @@ -0,0 +1,28 @@ +// +// CreatedRoomRequestDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct CreatedRoomRequestDTO: Encodable { + let room: CreatedRoomInfoRequestDTO + let member: MemberInfoRequestDTO +} + +struct CreatedRoomInfoRequestDTO: Encodable { + let title: String + let capacity: Int + let startDate: String + let endDate: String +} + +struct MemberInfoRequestDTO: Encodable { + let colorIndex: Int + + enum CodingKeys: String, CodingKey { + case colorIndex = "colorIdx" + } +} diff --git a/Manito/Manito/Data/DTO/Request/EditedMissionRequestDTO.swift b/Manito/Manito/Data/DTO/Request/EditedMissionRequestDTO.swift new file mode 100644 index 000000000..f91e99f21 --- /dev/null +++ b/Manito/Manito/Data/DTO/Request/EditedMissionRequestDTO.swift @@ -0,0 +1,12 @@ +// +// EditedMissionRequestDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct EditedMissionRequestDTO: Codable { + let mission: String +} diff --git a/Manito/Manito/Data/DTO/Request/LetterRequestDTO.swift b/Manito/Manito/Data/DTO/Request/LetterRequestDTO.swift new file mode 100644 index 000000000..dca2a74c3 --- /dev/null +++ b/Manito/Manito/Data/DTO/Request/LetterRequestDTO.swift @@ -0,0 +1,18 @@ +// +// LetterRequestDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct LetterRequestDTO: Encodable { + let manitteeId: String + let messageContent: String? + + init(manitteeId: String, messageContent: String? = nil) { + self.manitteeId = manitteeId + self.messageContent = messageContent + } +} diff --git a/Manito/Manito/Data/DTO/Request/LoginRequestDTO.swift b/Manito/Manito/Data/DTO/Request/LoginRequestDTO.swift new file mode 100644 index 000000000..7b1ca557b --- /dev/null +++ b/Manito/Manito/Data/DTO/Request/LoginRequestDTO.swift @@ -0,0 +1,13 @@ +// +// LoginRequestDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct LoginRequestDTO: Encodable { + let identityToken: String + let fcmToken : String +} diff --git a/Manito/Manito/Data/DTO/Response/DailyMissionDTO.swift b/Manito/Manito/Data/DTO/Response/DailyMissionDTO.swift new file mode 100644 index 000000000..8b965cf21 --- /dev/null +++ b/Manito/Manito/Data/DTO/Response/DailyMissionDTO.swift @@ -0,0 +1,12 @@ +// +// DailyMissionDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct DailyMissionDTO: Decodable { + let mission: String? +} diff --git a/Manito/Manito/Network/Models/FriendList.swift b/Manito/Manito/Data/DTO/Response/FriendListDTO.swift similarity index 56% rename from Manito/Manito/Network/Models/FriendList.swift rename to Manito/Manito/Data/DTO/Response/FriendListDTO.swift index 89f2cf1f9..98f6bef61 100644 --- a/Manito/Manito/Network/Models/FriendList.swift +++ b/Manito/Manito/Data/DTO/Response/FriendListDTO.swift @@ -1,18 +1,18 @@ // -// FriendList.swift +// FriendListDTO.swift // Manito // -// Created by Mingwan Choi on 2022/08/27. +// Created by SHIN YOON AH on 2023/08/24. // import Foundation -struct FriendList: Decodable { +struct FriendListDTO: Decodable { let count: Int? - let members: [Member]? + let members: [MemberInfoDTO]? } -struct Member: Decodable { +struct MemberInfoDTO: Decodable { let nickname: String? let colorIndex: Int? diff --git a/Manito/Manito/Data/DTO/Response/LetterDTO.swift b/Manito/Manito/Data/DTO/Response/LetterDTO.swift new file mode 100644 index 000000000..2c6995167 --- /dev/null +++ b/Manito/Manito/Data/DTO/Response/LetterDTO.swift @@ -0,0 +1,14 @@ +// +// LetterDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct LetterDTO: Decodable { + let count: Int? + let manittee: UserInfoDTO? + let messages: [MessageListItemDTO] +} diff --git a/Manito/Manito/Network/Models/Login.swift b/Manito/Manito/Data/DTO/Response/LoginDTO.swift similarity index 67% rename from Manito/Manito/Network/Models/Login.swift rename to Manito/Manito/Data/DTO/Response/LoginDTO.swift index 18b8ec11a..dfeb6c1ab 100644 --- a/Manito/Manito/Network/Models/Login.swift +++ b/Manito/Manito/Data/DTO/Response/LoginDTO.swift @@ -1,13 +1,13 @@ // -// Login.swift +// LoginDTO.swift // Manito // -// Created by Mingwan Choi on 2022/09/09. +// Created by SHIN YOON AH on 2023/08/24. // import Foundation -struct Login: Decodable { +struct LoginDTO: Decodable { let accessToken: String? let refreshToken: String? let nickname: String? diff --git a/Manito/Manito/Data/DTO/Response/MemoryDTO.swift b/Manito/Manito/Data/DTO/Response/MemoryDTO.swift new file mode 100644 index 000000000..d347824c6 --- /dev/null +++ b/Manito/Manito/Data/DTO/Response/MemoryDTO.swift @@ -0,0 +1,18 @@ +// +// MemoryDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct MemoryDTO: Decodable { + let memoriesWithManitto: MemoryItemDTO? + let memoriesWithManittee: MemoryItemDTO? +} + +struct MemoryItemDTO: Decodable { + let member: MemberInfoDTO? + let messages: [MessageListItemDTO]? +} diff --git a/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift b/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift new file mode 100644 index 000000000..90e6f71a6 --- /dev/null +++ b/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift @@ -0,0 +1,27 @@ +// +// MessageListItemDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct MessageListItemDTO: Decodable { + let id: Int? + let content: String? + let imageUrl: String? + let createdDate: String? + let missionInfo: IndividualMissionDTO? +} + +extension MessageListItemDTO { + func toMessageListItem(canReport: Bool) -> MessageListItem { + return MessageListItem(id: self.id ?? 0, + content: self.content, + imageUrl: self.imageUrl, + createdDate: self.createdDate ?? "", + missionInfo: self.missionInfo, + canReport: canReport) + } +} diff --git a/Manito/Manito/Network/Models/VerificationCode.swift b/Manito/Manito/Data/DTO/Response/ParticipatedRoomInfoDTO.swift similarity index 61% rename from Manito/Manito/Network/Models/VerificationCode.swift rename to Manito/Manito/Data/DTO/Response/ParticipatedRoomInfoDTO.swift index a80512f44..71bcc075a 100644 --- a/Manito/Manito/Network/Models/VerificationCode.swift +++ b/Manito/Manito/Data/DTO/Response/ParticipatedRoomInfoDTO.swift @@ -1,13 +1,13 @@ // -// VerificationCode.swift +// ParticipatedRoomInfoDTO.swift // Manito // -// Created by LeeSungHo on 2022/08/31. +// Created by SHIN YOON AH on 2023/08/24. // import Foundation -struct VerificationCode: Decodable { +struct ParticipatedRoomInfoDTO: Decodable { let id: Int? let title: String? let capacity: Int? diff --git a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift new file mode 100644 index 000000000..54362d890 --- /dev/null +++ b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift @@ -0,0 +1,73 @@ +// +// RoomInfoDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct RoomInfoDTO: Decodable { + let roomInformation: RoomListItemDTO? + let participants: ParticipantListDTO? + let manittee: UserInfoDTO? + let manitto: UserInfoDTO? + let invitation: InvitationCodeDTO? + let didViewRoulette: Bool? + let mission: IndividualMissionDTO? + let admin: Bool? + let messages: MessageInfo? + + enum CodingKeys: String, CodingKey { + case roomInformation = "room" + case participants + case manittee + case manitto + case invitation + case didViewRoulette + case mission + case admin + case messages + } +} + +extension RoomInfoDTO { + func toRoomInfo() -> RoomInfo { + let roomInformation = self.roomInformation?.toRoomListItem() + let participants = self.participants?.toParticipantList() + return RoomInfo(roomInformation: roomInformation!, + participants: participants ?? ParticipantList(count: 0, members: []), + manittee: self.manittee ?? UserInfoDTO(id: "", nickname: ""), + manitto: self.manitto, + invitation: self.invitation ?? InvitationCodeDTO(code: ""), + didViewRoulette: self.didViewRoulette, + mission: self.mission, + admin: self.admin ?? false, + messages: self.messages) + } +} + +struct ParticipantListDTO: Decodable { + let count: Int? + let members: [UserInfoDTO]? +} + +extension ParticipantListDTO { + func toParticipantList() -> ParticipantList { + return ParticipantList(count: self.count ?? 0, + members: self.members ?? []) + } +} + +struct InvitationCodeDTO: Decodable { + let code: String? +} + +struct IndividualMissionDTO: Decodable, Hashable { + let id: Int? + let content: String? +} + +struct MessageInfo: Decodable { + let count: Int? +} diff --git a/Manito/Manito/Data/DTO/Response/RoomListDTO.swift b/Manito/Manito/Data/DTO/Response/RoomListDTO.swift new file mode 100644 index 000000000..aa15d2d00 --- /dev/null +++ b/Manito/Manito/Data/DTO/Response/RoomListDTO.swift @@ -0,0 +1,35 @@ +// +// RoomListDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct RoomListDTO: Decodable { + let participatingRooms: [RoomListItemDTO]? +} + +struct RoomListItemDTO: Decodable { + let id: Int? + let title: String? + let state: String? + let participatingCount: Int? + let capacity: Int? + let startDate: String? + let endDate: String? +} + +extension RoomListItemDTO { + func toRoomListItem() -> RoomListItem { + return RoomListItem(id: self.id ?? 0, + title: self.title ?? "", + state: self.state ?? "", + participatingCount: self.participatingCount, + capacity: self.capacity ?? 0, + startDate: self.startDate ?? "", + endDate: self.endDate ?? "" + ) + } +} diff --git a/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift b/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift new file mode 100644 index 000000000..bc8bb6411 --- /dev/null +++ b/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift @@ -0,0 +1,13 @@ +// +// UserInfoDTO.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct UserInfoDTO: Decodable { + let id: String? + let nickname: String? +} diff --git a/Manito/Manito/Network/Models/Token.swift b/Manito/Manito/Data/DTO/TokenDTO.swift similarity index 53% rename from Manito/Manito/Network/Models/Token.swift rename to Manito/Manito/Data/DTO/TokenDTO.swift index 63ffea08f..d3c3e355a 100644 --- a/Manito/Manito/Network/Models/Token.swift +++ b/Manito/Manito/Data/DTO/TokenDTO.swift @@ -1,13 +1,13 @@ // -// Token.swift +// TokenDTO.swift // Manito // -// Created by Mingwan Choi on 2022/09/09. +// Created by SHIN YOON AH on 2023/08/24. // import Foundation -struct Token: Codable { +struct TokenDTO: Codable { let accessToken: String? let refreshToken: String? } diff --git a/Manito/Manito/Data/Network/EndPoint/DetailRoomEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/DetailRoomEndPoint.swift new file mode 100644 index 000000000..ee8e4c952 --- /dev/null +++ b/Manito/Manito/Data/Network/EndPoint/DetailRoomEndPoint.swift @@ -0,0 +1,113 @@ +// +// DetailRoomEndPoint.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/23. +// + +import Foundation + +import MTNetwork + +enum DetailRoomEndPoint { + case fetchWithFriend(roomId: String) + case fetchRoomInfo(roomId: String) + case fetchResetMission(roomId: String) + case fetchMemory(roomId: String) + case patchStartManitto(roomId: String) + case patchEditMission(roomId: String, mission: EditedMissionRequestDTO) + case putRoomInfo(roomId: String, roomInfo: CreatedRoomInfoRequestDTO) + case deleteRoom(roomId: String) + case deleteLeaveRoom(roomId: String) +} + +extension DetailRoomEndPoint: Requestable { + var baseURL: URL { + return APIEnvironment.baseURL + } + + var path: String { + switch self { + case .fetchWithFriend(let roomId): + return "/v1/rooms/\(roomId)/participants" + case .fetchRoomInfo(let roomId): + return "/v1/rooms/\(roomId)" + case .fetchResetMission(let roomId): + return "/v1/\(roomId)/individual-mission/restore" + case .fetchMemory(let roomId): + return "/v1/rooms/\(roomId)/memories" + case .patchStartManitto(let roomId): + return "/v1/rooms/\(roomId)/state" + case .patchEditMission(let roomId, _): + return "/v1/\(roomId)/individual-mission" + case .putRoomInfo(let roomId, _): + return "/v1/rooms/\(roomId)" + case .deleteRoom(let roomId): + return "/v1/rooms/\(roomId)" + case .deleteLeaveRoom(let roomId): + return "/v1/rooms/\(roomId)/participants" + } + } + + var method: HTTPMethod { + switch self { + case .fetchWithFriend: + return .get + case .fetchRoomInfo: + return .get + case .fetchResetMission: + return .get + case .fetchMemory: + return .get + case .patchStartManitto: + return .patch + case .patchEditMission: + return .patch + case .putRoomInfo: + return .put + case .deleteRoom: + return .delete + case .deleteLeaveRoom: + return .delete + } + } + + var task: HTTPTask { + switch self { + case .fetchWithFriend: + return .requestPlain + case .fetchRoomInfo: + return .requestPlain + case .fetchResetMission: + return .requestPlain + case .fetchMemory: + return .requestPlain + case .patchStartManitto: + return .requestPlain + case .patchEditMission(_, let mission): + return .requestJSONEncodable(mission) + case .putRoomInfo(_, let roomInfo): + return .requestJSONEncodable(roomInfo) + case .deleteRoom: + return .requestPlain + case .deleteLeaveRoom: + return .requestPlain + } + } + + var headers: HTTPHeaders { + let headers: [HTTPHeader] = [ + HTTPHeader.contentType("application/json"), + HTTPHeader.authorization(bearerToken: UserDefaultStorage.accessToken) + ] + return HTTPHeaders(headers) + } + + var requestTimeout: Float { + return 10 + } + + var sampleData: Data? { + return nil + } +} diff --git a/Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift new file mode 100644 index 000000000..793ac908d --- /dev/null +++ b/Manito/Manito/Data/Network/EndPoint/LetterEndPoint.swift @@ -0,0 +1,91 @@ +// +// LetterEndPoint.swift +// Manito +// +// Created by Mingwan Choi on 2022/07/12. +// + +import Foundation + +import MTNetwork + +enum LetterEndPoint { + case dispatchLetter(roomId: String, image: Data?, letter: LetterRequestDTO, missionId: String) + case fetchSendLetter(roomId: String) + case fetchReceiveLetter(roomId: String) +} + +extension LetterEndPoint: Requestable { + var baseURL: URL { + return APIEnvironment.baseURL + } + + var path: String { + switch self { + case .dispatchLetter(let roomId, _, _, _): + return "/v1/rooms/\(roomId)/messages-separate" + case .fetchSendLetter(let roomId): + return "/v2/rooms/\(roomId)/messages-sent" + case .fetchReceiveLetter(let roomId): + return "/v2/rooms/\(roomId)/messages-received" + } + } + + var method: HTTPMethod { + switch self { + case .dispatchLetter: + return .post + case .fetchSendLetter: + return .get + case .fetchReceiveLetter: + return .get + } + } + + var task: HTTPTask { + switch self { + case .dispatchLetter(_, let image, let letter, let missionId): + var multipartData: [MultipartFormData] = [] + if let image { + let imageData = MultipartFormData(provider: .data(image), + name: "image", + filename: "\(arc4random())", + mimeType: "image/jpeg") + multipartData.append(imageData) + } + let parameters: [String: Any] = ["manitteeId": letter.manitteeId, + "messageContent": letter.messageContent ?? "", + "missionId": missionId] + let parametersData = MultipartFormData(provider: .parameter(parameters)) + multipartData.append(parametersData) + return .uploadMultipart(multipartData) + case .fetchSendLetter: + return .requestPlain + case .fetchReceiveLetter: + return .requestPlain + } + } + + var headers: HTTPHeaders { + var headers: [HTTPHeader] = [ + HTTPHeader.authorization(bearerToken: UserDefaultStorage.accessToken) + ] + switch self { + case .dispatchLetter: + let contentType = HTTPHeader.contentType("multipart/form-data") + headers.append(contentType) + default: + let contentType = HTTPHeader.contentType("application/json") + headers.append(contentType) + } + return HTTPHeaders(headers) + } + + var requestTimeout: Float { + return 10 + } + + var sampleData: Data? { + return nil + } +} diff --git a/Manito/Manito/Data/Network/EndPoint/LoginEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/LoginEndPoint.swift new file mode 100644 index 000000000..d52c2782a --- /dev/null +++ b/Manito/Manito/Data/Network/EndPoint/LoginEndPoint.swift @@ -0,0 +1,56 @@ +// +// LoginEndPoint.swift +// Manito +// +// Created by Mingwan Choi on 2022/09/09. +// + +import Foundation + +import MTNetwork + +enum LoginEndPoint { + case dispatchAppleLogin(login: LoginRequestDTO) +} + +extension LoginEndPoint: Requestable { + var baseURL: URL { + return APIEnvironment.baseURL + } + + var path: String { + switch self { + case .dispatchAppleLogin: + return "/v2/login" + } + } + + var method: HTTPMethod { + switch self { + case .dispatchAppleLogin: + return .post + } + } + + var task: HTTPTask { + switch self { + case .dispatchAppleLogin(let body): + return .requestJSONEncodable(body) + } + } + + var headers: HTTPHeaders { + let headers: [HTTPHeader] = [ + HTTPHeader.contentType("application/json"), + ] + return HTTPHeaders(headers) + } + + var requestTimeout: Float { + return 10 + } + + var sampleData: Data? { + return nil + } +} diff --git a/Manito/Manito/Data/Network/EndPoint/MainEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/MainEndPoint.swift new file mode 100644 index 000000000..a1345d264 --- /dev/null +++ b/Manito/Manito/Data/Network/EndPoint/MainEndPoint.swift @@ -0,0 +1,64 @@ +// +// MainEndPoint.swift +// Manito +// +// Created by Mingwan Choi on 2022/07/10. +// + +import Foundation + +import MTNetwork + +enum MainEndPoint { + case fetchCommonMission + case fetchManittoList +} + +extension MainEndPoint: Requestable { + var baseURL: URL { + return APIEnvironment.baseURL + } + + var path: String { + switch self { + case .fetchCommonMission: + return "/v1/missions/common" + case .fetchManittoList: + return "/v1/rooms" + } + } + + var method: HTTPMethod { + switch self { + case .fetchCommonMission: + return .get + case .fetchManittoList: + return .get + } + } + + var task: HTTPTask { + switch self { + case .fetchCommonMission: + return .requestPlain + case .fetchManittoList: + return .requestPlain + } + } + + var headers: HTTPHeaders { + let headers: [HTTPHeader] = [ + HTTPHeader.contentType("application/json"), + HTTPHeader.authorization(bearerToken: UserDefaultStorage.accessToken) + ] + return HTTPHeaders(headers) + } + + var requestTimeout: Float { + return 10 + } + + var sampleData: Data? { + return nil + } +} diff --git a/Manito/Manito/Data/Network/EndPoint/RoomParticipationEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/RoomParticipationEndPoint.swift new file mode 100644 index 000000000..8ae22afd8 --- /dev/null +++ b/Manito/Manito/Data/Network/EndPoint/RoomParticipationEndPoint.swift @@ -0,0 +1,72 @@ +// +// RoomEndPoint.swift +// Manito +// +// Created by Mingwan Choi on 2022/07/12. +// + +import Foundation + +import MTNetwork + +enum RoomParticipationEndPoint { + case dispatchCreateRoom(room: CreatedRoomRequestDTO) + case dispatchVerifyCode(code: String) + case dispatchJoinRoom(roomId: String, member: MemberInfoRequestDTO) +} + +extension RoomParticipationEndPoint: Requestable { + var baseURL: URL { + return APIEnvironment.baseURL + } + + var path: String { + switch self { + case .dispatchCreateRoom: + return "/v1/rooms" + case .dispatchVerifyCode: + return "/v1/invitations/verification" + case .dispatchJoinRoom(let roomId, _): + return "/v1/rooms/\(roomId)/participants" + } + } + + var method: HTTPMethod { + switch self { + case .dispatchCreateRoom: + return .post + case .dispatchVerifyCode: + return .post + case .dispatchJoinRoom: + return .post + } + } + + var task: HTTPTask { + switch self { + case .dispatchCreateRoom(let room): + return .requestJSONEncodable(room) + case .dispatchVerifyCode(let code): + let body = ["invitationCode": code] + return .requestJSONEncodable(body) + case .dispatchJoinRoom(_, let member): + return .requestJSONEncodable(member) + } + } + + var headers: HTTPHeaders { + let headers: [HTTPHeader] = [ + HTTPHeader.contentType("application/json"), + HTTPHeader.authorization(bearerToken: UserDefaultStorage.accessToken) + ] + return HTTPHeaders(headers) + } + + var requestTimeout: Float { + return 10 + } + + var sampleData: Data? { + return nil + } +} diff --git a/Manito/Manito/Data/Network/EndPoint/SettingEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/SettingEndPoint.swift new file mode 100644 index 000000000..581d9611e --- /dev/null +++ b/Manito/Manito/Data/Network/EndPoint/SettingEndPoint.swift @@ -0,0 +1,64 @@ +// +// SettingEndPoint.swift +// Manito +// +// Created by Mingwan Choi on 2022/07/12. +// + +import Foundation + +import MTNetwork + +enum SettingEndPoint { + case putUserInfo(nickname: NicknameDTO) + case deleteMember +} + +extension SettingEndPoint: Requestable { + var baseURL: URL { + return APIEnvironment.baseURL + } + + var path: String { + switch self { + case .putUserInfo: + return "/v1/members/nickname" + case .deleteMember: + return "/v1/members" + } + } + + var method: HTTPMethod { + switch self { + case .putUserInfo: + return .put + case .deleteMember: + return .delete + } + } + + var task: HTTPTask { + switch self { + case .putUserInfo(let nickname): + return .requestJSONEncodable(nickname) + case .deleteMember: + return .requestPlain + } + } + + var headers: HTTPHeaders { + let headers: [HTTPHeader] = [ + HTTPHeader.contentType("application/json"), + HTTPHeader.authorization(bearerToken: UserDefaultStorage.accessToken) + ] + return HTTPHeaders(headers) + } + + var requestTimeout: Float { + return 10 + } + + var sampleData: Data? { + return nil + } +} diff --git a/Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift new file mode 100644 index 000000000..09703bf49 --- /dev/null +++ b/Manito/Manito/Data/Network/EndPoint/TokenEndPoint.swift @@ -0,0 +1,56 @@ +// +// TokenEndPoint.swift +// Manito +// +// Created by SHIN YOON AH on 2022/09/14. +// + +import Foundation + +import MTNetwork + +enum TokenEndPoint { + case patchRefreshToken(token: TokenDTO) +} + +extension TokenEndPoint: Requestable { + var baseURL: URL { + return APIEnvironment.baseURL + } + + var path: String { + switch self { + case .patchRefreshToken: + return "/v1/auth/reissue" + } + } + + var method: HTTPMethod { + switch self { + case .patchRefreshToken: + return .patch + } + } + + var task: HTTPTask { + switch self { + case .patchRefreshToken(let token): + return .requestJSONEncodable(token) + } + } + + var headers: HTTPHeaders { + let headers: [HTTPHeader] = [ + HTTPHeader.contentType("application/json"), + ] + return HTTPHeaders(headers) + } + + var requestTimeout: Float { + return 10 + } + + var sampleData: Data? { + return nil + } +} diff --git a/Manito/Manito/Data/Network/Foundation/APIEnvironment.swift b/Manito/Manito/Data/Network/Foundation/APIEnvironment.swift new file mode 100644 index 000000000..06fa9e7c6 --- /dev/null +++ b/Manito/Manito/Data/Network/Foundation/APIEnvironment.swift @@ -0,0 +1,16 @@ +// +// APIEnvironment.swift +// Manito +// +// Created by Mingwan Choi on 2022/07/12. +// + +import Foundation + +enum APIEnvironment { + #if DEV + static let baseURL: URL = URL(string: Bundle.main.developmentURL)! + #elseif PROD + static let baseURL: URL = URL(string: Bundle.main.productionURL)! + #endif +} diff --git a/Manito/Manito/Global/Extension/URLInfo+Extension.swift b/Manito/Manito/Data/Network/Foundation/Key+Extension.swift similarity index 72% rename from Manito/Manito/Global/Extension/URLInfo+Extension.swift rename to Manito/Manito/Data/Network/Foundation/Key+Extension.swift index ddd6221c7..2377d8796 100644 --- a/Manito/Manito/Global/Extension/URLInfo+Extension.swift +++ b/Manito/Manito/Data/Network/Foundation/Key+Extension.swift @@ -9,14 +9,14 @@ import Foundation extension Bundle { var productionURL: String { - guard let file = self.path(forResource: "URLInfo", ofType: "plist") else { return "URLInfo 파일이 없습니다." } + guard let file = self.path(forResource: "Key", ofType: "plist") else { return "Key 파일이 없습니다." } guard let resource = NSDictionary(contentsOfFile: file) else { return "" } guard let key = resource["Production URL"] as? String else { fatalError("Production URL을 입력해 주세요") } return key } var developmentURL: String { - guard let file = self.path(forResource: "URLInfo", ofType: "plist") else { return "URLInfo 파일이 없습니다." } + guard let file = self.path(forResource: "Key", ofType: "plist") else { return "Key 파일이 없습니다." } guard let resource = NSDictionary(contentsOfFile: file) else { return "" } guard let key = resource["Development URL"] as? String else { fatalError("Development URL을 입력해 주세요") } return key diff --git a/Manito/Manito/Global/Literal/URLInfo.plist b/Manito/Manito/Data/Network/Foundation/Key.plist similarity index 68% rename from Manito/Manito/Global/Literal/URLInfo.plist rename to Manito/Manito/Data/Network/Foundation/Key.plist index 050a08730..6dd25488a 100644 --- a/Manito/Manito/Global/Literal/URLInfo.plist +++ b/Manito/Manito/Data/Network/Foundation/Key.plist @@ -3,8 +3,8 @@ Development URL - Development URL을 입력해주세요. + https://ckyeon.store/api Production URL - Production URL을 입력해주세요. + https://dev.aenitto.shop/api diff --git a/Manito/Manito/Network/Foundation/NetworkError.swift b/Manito/Manito/Data/Network/Foundation/NetworkError.swift similarity index 57% rename from Manito/Manito/Network/Foundation/NetworkError.swift rename to Manito/Manito/Data/Network/Foundation/NetworkError.swift index 090a138cc..278a4b6c7 100644 --- a/Manito/Manito/Network/Foundation/NetworkError.swift +++ b/Manito/Manito/Data/Network/Foundation/NetworkError.swift @@ -2,11 +2,15 @@ // NetworkError.swift // Manito // -// Created by Mingwan Choi on 2022/07/09. +// Created by SHIN YOON AH on 2023/08/24. // import Foundation +/// +/// 프로젝트에 존재하는 모든 NetworkError가 사라지면 삭제하겠습니다. +/// + enum NetworkError: Error { case encodingError case clientError(message: String?) diff --git a/Manito/Manito/Data/Repository/DetailRoomRepository.swift b/Manito/Manito/Data/Repository/DetailRoomRepository.swift new file mode 100644 index 000000000..b8ecd1662 --- /dev/null +++ b/Manito/Manito/Data/Repository/DetailRoomRepository.swift @@ -0,0 +1,83 @@ +// +// DetailRoomRepository.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +import MTNetwork + +protocol DetailRoomRepository { + func fetchWithFriend(roomId: String) async throws -> FriendListDTO + func fetchRoomInfo(roomId: String) async throws -> RoomInfoDTO + func fetchResetMission(roomId: String) async throws -> IndividualMissionDTO + func fetchMemory(roomId: String) async throws -> MemoryDTO + func patchStartManitto(roomId: String) async throws -> UserInfoDTO + func patchEditMission(roomId: String, mission: EditedMissionRequestDTO) async throws -> IndividualMissionDTO + func putRoomInfo(roomId: String, roomInfo: CreatedRoomInfoRequestDTO) async throws -> Int + func deleteRoom(roomId: String) async throws -> Int + func deleteLeaveRoom(roomId: String) async throws -> Int +} + +final class DetailRoomRepositoryImpl: DetailRoomRepository { + + private var provider = Provider() + + func fetchWithFriend(roomId: String) async throws -> FriendListDTO { + let response = try await self.provider + .request(.fetchWithFriend(roomId: roomId)) + return try response.decode() + } + + func fetchRoomInfo(roomId: String) async throws -> RoomInfoDTO { + let response = try await self.provider + .request(.fetchRoomInfo(roomId: roomId)) + return try response.decode() + } + + func fetchResetMission(roomId: String) async throws -> IndividualMissionDTO { + let response = try await self.provider + .request(.fetchResetMission(roomId: roomId)) + return try response.decode() + } + + func fetchMemory(roomId: String) async throws -> MemoryDTO { + let response = try await self.provider + .request(.fetchMemory(roomId: roomId)) + return try response.decode() + } + + func patchStartManitto(roomId: String) async throws -> UserInfoDTO { + let response = try await self.provider + .request(.patchStartManitto(roomId: roomId)) + return try response.decode() + } + + func patchEditMission(roomId: String, mission: EditedMissionRequestDTO) async throws -> IndividualMissionDTO { + let response = try await self.provider + .request(.patchEditMission(roomId: roomId, + mission: mission)) + return try response.decode() + } + + func putRoomInfo(roomId: String, roomInfo: CreatedRoomInfoRequestDTO) async throws -> Int { + let response = try await self.provider + .request(.putRoomInfo(roomId: roomId, + roomInfo: roomInfo)) + return response.statusCode + } + + func deleteRoom(roomId: String) async throws -> Int { + let response = try await self.provider + .request(.deleteRoom(roomId: roomId)) + return response.statusCode + } + + func deleteLeaveRoom(roomId: String) async throws -> Int { + let response = try await self.provider + .request(.deleteLeaveRoom(roomId: roomId)) + return response.statusCode + } +} diff --git a/Manito/Manito/Data/Repository/LetterRepository.swift b/Manito/Manito/Data/Repository/LetterRepository.swift new file mode 100644 index 000000000..b5c8a9f0b --- /dev/null +++ b/Manito/Manito/Data/Repository/LetterRepository.swift @@ -0,0 +1,42 @@ +// +// LetterRepository.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +import MTNetwork + +protocol LetterRepository { + func dispatchLetter(roomId: String, image: Data?, letter: LetterRequestDTO, missionId: String) async throws -> Int + func fetchSendLetter(roomId: String) async throws -> LetterDTO + func fetchReceiveLetter(roomId: String) async throws -> LetterDTO +} + +final class LetterRepositoryImpl: LetterRepository { + + private var provider = Provider() + + func dispatchLetter(roomId: String, image: Data?, letter: LetterRequestDTO, missionId: String) async throws -> Int { + let response = try await self.provider + .request(.dispatchLetter(roomId: roomId, + image: image, + letter: letter, + missionId: missionId)) + return response.statusCode + } + + func fetchSendLetter(roomId: String) async throws -> LetterDTO { + let response = try await self.provider + .request(.fetchSendLetter(roomId: roomId)) + return try response.decode() + } + + func fetchReceiveLetter(roomId: String) async throws -> LetterDTO { + let response = try await self.provider + .request(.fetchReceiveLetter(roomId: roomId)) + return try response.decode() + } +} diff --git a/Manito/Manito/Data/Repository/LoginRepository.swift b/Manito/Manito/Data/Repository/LoginRepository.swift new file mode 100644 index 000000000..aa8cf0bf7 --- /dev/null +++ b/Manito/Manito/Data/Repository/LoginRepository.swift @@ -0,0 +1,25 @@ +// +// LoginRepository.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +import MTNetwork + +protocol LoginRepository { + func dispatchAppleLogin(login: LoginRequestDTO) async throws -> LoginDTO +} + +final class LoginRepositoryImpl: LoginRepository { + + private var provider = Provider() + + func dispatchAppleLogin(login: LoginRequestDTO) async throws -> LoginDTO { + let response = try await self.provider + .request(.dispatchAppleLogin(login: login)) + return try response.decode() + } +} diff --git a/Manito/Manito/Data/Repository/MainRepository.swift b/Manito/Manito/Data/Repository/MainRepository.swift new file mode 100644 index 000000000..3a88b918b --- /dev/null +++ b/Manito/Manito/Data/Repository/MainRepository.swift @@ -0,0 +1,32 @@ +// +// MainRepository.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +import MTNetwork + +protocol MainRepository { + func fetchCommonMission() async throws -> DailyMissionDTO + func fetchManittoList() async throws -> RoomListDTO +} + +final class MainRepositoryImpl: MainRepository { + + private var provider = Provider() + + func fetchCommonMission() async throws -> DailyMissionDTO { + let response = try await self.provider + .request(.fetchCommonMission) + return try response.decode() + } + + func fetchManittoList() async throws -> RoomListDTO { + let response = try await self.provider + .request(.fetchManittoList) + return try response.decode() + } +} diff --git a/Manito/Manito/Data/Repository/RoomParticipationRepository.swift b/Manito/Manito/Data/Repository/RoomParticipationRepository.swift new file mode 100644 index 000000000..4fd9e053a --- /dev/null +++ b/Manito/Manito/Data/Repository/RoomParticipationRepository.swift @@ -0,0 +1,42 @@ +// +// RoomParticipationRepository.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +import MTNetwork + +protocol RoomParticipationRepository { + func dispatchCreateRoom(room: CreatedRoomRequestDTO) async throws -> Int + func dispatchVerifyCode(code: String) async throws -> ParticipatedRoomInfoDTO + func dispatchJoinRoom(roomId: String, member: MemberInfoRequestDTO) async throws -> Int +} + +final class RoomParticipationRepositoryImpl: RoomParticipationRepository { + + private var provider = Provider() + + func dispatchCreateRoom(room: CreatedRoomRequestDTO) async throws -> Int { + let response = try await self.provider + .request(.dispatchCreateRoom(room: room)) + let location = response.response?.allHeaderFields["Location"] as? String + let roomId = Int(location?.split(separator: "/").last ?? "-1") ?? -1 + return roomId + } + + func dispatchVerifyCode(code: String) async throws -> ParticipatedRoomInfoDTO { + let response = try await self.provider + .request(.dispatchVerifyCode(code: code)) + return try response.decode() + } + + func dispatchJoinRoom(roomId: String, member: MemberInfoRequestDTO) async throws -> Int { + let response = try await self.provider + .request(.dispatchJoinRoom(roomId: roomId, + member: member)) + return response.statusCode + } +} diff --git a/Manito/Manito/Data/Repository/SettingRepository.swift b/Manito/Manito/Data/Repository/SettingRepository.swift new file mode 100644 index 000000000..deb78e500 --- /dev/null +++ b/Manito/Manito/Data/Repository/SettingRepository.swift @@ -0,0 +1,32 @@ +// +// SettingRepository.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +import MTNetwork + +protocol SettingRepository { + func putUserInfo(nickname: NicknameDTO) async throws -> NicknameDTO + func deleteMember() async throws -> Int +} + +final class SettingRepositoryImpl: SettingRepository { + + private var provider = Provider() + + func putUserInfo(nickname: NicknameDTO) async throws -> NicknameDTO { + let response = try await self.provider + .request(.putUserInfo(nickname: nickname)) + return try response.decode() + } + + func deleteMember() async throws -> Int { + let response = try await self.provider + .request(.deleteMember) + return response.statusCode + } +} diff --git a/Manito/Manito/Data/Repository/TokenRepository.swift b/Manito/Manito/Data/Repository/TokenRepository.swift new file mode 100644 index 000000000..60fc9a549 --- /dev/null +++ b/Manito/Manito/Data/Repository/TokenRepository.swift @@ -0,0 +1,25 @@ +// +// TokenRepository.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +import MTNetwork + +protocol TokenRepository { + func patchRefreshToken(token: TokenDTO) async throws -> TokenDTO +} + +final class TokenRepositoryImpl: TokenRepository { + + private var provider = Provider() + + func patchRefreshToken(token: TokenDTO) async throws -> TokenDTO { + let response = try await self.provider + .request(.patchRefreshToken(token: token)) + return try response.decode() + } +} diff --git a/Manito/Manito/Domain/Entity/MessageListItem.swift b/Manito/Manito/Domain/Entity/MessageListItem.swift new file mode 100644 index 000000000..b032a6053 --- /dev/null +++ b/Manito/Manito/Domain/Entity/MessageListItem.swift @@ -0,0 +1,31 @@ +// +// MessageListItem.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct MessageListItem: Hashable { + let id: Int + let content: String? + let imageUrl: String? + let createdDate: String + let missionInfo: IndividualMissionDTO? + let canReport: Bool + + var isToday: Bool { + return Date().letterDateToString == createdDate + } + + var date: String { + return self.isToday ? "오늘" : createdDate + } + + var mission: String? { + guard let mission = missionInfo?.content else { return nil } + + return "\(date)의 개별미션\n[\(mission)]" + } +} diff --git a/Manito/Manito/Domain/Entity/ParticipantList.swift b/Manito/Manito/Domain/Entity/ParticipantList.swift new file mode 100644 index 000000000..5e3308fb5 --- /dev/null +++ b/Manito/Manito/Domain/Entity/ParticipantList.swift @@ -0,0 +1,19 @@ +// +// ParticipantList.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct ParticipantList: Decodable { + let count: Int + let members: [UserInfoDTO] +} + +extension ParticipantList { + var membersNickname: [String] { + return members.map { $0.nickname ?? "" } + } +} diff --git a/Manito/Manito/Domain/Entity/RoomInfo.swift b/Manito/Manito/Domain/Entity/RoomInfo.swift new file mode 100644 index 000000000..5b15aaf1b --- /dev/null +++ b/Manito/Manito/Domain/Entity/RoomInfo.swift @@ -0,0 +1,64 @@ +// +// RoomInfo.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct RoomInfo { + let roomInformation: RoomListItem + let participants: ParticipantList + let manittee: UserInfoDTO + let manitto: UserInfoDTO? + let invitation: InvitationCodeDTO + let didViewRoulette: Bool? + let mission: IndividualMissionDTO? + let admin: Bool + let messages: MessageInfo? +} + +extension RoomInfo { + var userCount: String { + return "\(participants.count)/\(roomInformation.capacity)" + } + + var canStart: Bool { + if let date = roomInformation.startDate.stringToDate { + let isMinimumUserCount = participants.count >= 4 + return isMinimumUserCount && date.isToday && admin + } else { + return false + } + } + + func toRoomListItem() -> RoomListItem { + return RoomListItem(id: roomInformation.id, + title: roomInformation.title, + state: roomInformation.state, + participatingCount: participants.count, + capacity: roomInformation.capacity, + startDate: roomInformation.startDate, + endDate: roomInformation.endDate) + } + + static let emptyRoom: RoomInfo = { + let roomList = RoomListItem(id: 0, + title: "", + state: "", + participatingCount: 0, + capacity: 0, + startDate: "", + endDate: "") + return RoomInfo(roomInformation: roomList, + participants: ParticipantList(count: 0, members: []), + manittee: UserInfoDTO(id: "", nickname: ""), + manitto: UserInfoDTO(id: "", nickname: ""), + invitation: InvitationCodeDTO(code: ""), + didViewRoulette: false, + mission: nil, + admin: false, + messages: nil) + }() +} diff --git a/Manito/Manito/Domain/Entity/RoomListItem.swift b/Manito/Manito/Domain/Entity/RoomListItem.swift new file mode 100644 index 000000000..5084cc4a7 --- /dev/null +++ b/Manito/Manito/Domain/Entity/RoomListItem.swift @@ -0,0 +1,55 @@ +// +// RoomListItem.swift +// Manito +// +// Created by SHIN YOON AH on 2023/08/24. +// + +import Foundation + +struct RoomListItem { + let id: Int + let title: String + let state: String + let participatingCount: Int? + let capacity: Int + let startDate: String + let endDate: String +} + +extension RoomListItem { + var dateRangeText: String { + return startDate + " ~ " + endDate + } + + var isAlreadyPastDate: Bool { + if let date = startDate.stringToDate { + return date.distance(to: Date()) > 86400 + } else { + return false + } + } + + var isStart: Bool { + if let date = startDate.stringToDate { + let isStartDate = date.distance(to: Date()) < 86400 + let isPast = date.distance(to: Date()) > 86400 + return !isPast && isStartDate + } else { + return false + } + } + + var isStartDatePast: Bool { + guard let startDate = self.startDate.stringToDate else { return true } + return startDate.isPast + } + + var dateRange: (startDate: String, endDate: String) { + let fiveDaysInterval: TimeInterval = 86400 * 4 + let startDate: String = isStartDatePast ? Date().dateToString : self.startDate + let endDate: String = isStartDatePast ? (Date() + fiveDaysInterval).dateToString : self.endDate + + return (startDate, endDate) + } +} diff --git a/Manito/Manito/Global/Base/BaseViewController.swift b/Manito/Manito/Global/Base/BaseViewController.swift index 1c87c2618..94f4faeba 100644 --- a/Manito/Manito/Global/Base/BaseViewController.swift +++ b/Manito/Manito/Global/Base/BaseViewController.swift @@ -20,7 +20,7 @@ class BaseViewController: UIViewController { return button }() - private let tokenService: TokenAPI = TokenAPI(apiService: APIService()) + private let tokenRepository: TokenRepository = TokenRepositoryImpl() // MARK: - init diff --git a/Manito/Manito/Global/Literal/URLLiteral.swift b/Manito/Manito/Global/Literal/URLLiteral.swift index 82b34b3e7..9fdcae7a6 100644 --- a/Manito/Manito/Global/Literal/URLLiteral.swift +++ b/Manito/Manito/Global/Literal/URLLiteral.swift @@ -8,12 +8,7 @@ import Foundation enum URLLiteral { - - // MARK: - server url - - static let developmentUrl: String = Bundle.main.developmentURL - static let productionUrl: String = Bundle.main.productionURL - + // MARK: - notion url static let personalInfomationUrl: String = "https://torpid-spy-8e4.notion.site/767e80eea1734539aead3b814016b361" diff --git a/Manito/Manito/Network/API/DetailDoneAPI.swift b/Manito/Manito/Network/API/DetailDoneAPI.swift deleted file mode 100644 index 7a924b644..000000000 --- a/Manito/Manito/Network/API/DetailDoneAPI.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// DetailEndAPI.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/04. -// - -import Foundation - -struct DetailDoneAPI: DetailDoneProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func requestMemory(roomId: String) async throws -> Memory? { - let request = DetailDoneEndPoint - .requestMemory(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func requestDoneRoomInfo(roomId: String) async throws -> Room? { - let request = DetailDoneEndPoint - .requestDoneRoomInfo(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func requestWithFriends(roomId: String) async throws -> FriendList? { - let request = DetailDoneEndPoint - .requestWithFriend(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func requestExitRoom(roomId: String) async throws -> Int { - let request = DetailDoneEndPoint - .requestExitRoom(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func requestDeleteRoom(roomId: String) async throws -> Int { - let request = DetailDoneEndPoint - .requestDeleteRoom(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Network/API/DetailStartingAPI.swift b/Manito/Manito/Network/API/DetailStartingAPI.swift deleted file mode 100644 index 723c3bba7..000000000 --- a/Manito/Manito/Network/API/DetailStartingAPI.swift +++ /dev/null @@ -1,37 +0,0 @@ -// -// DetailIngAPI.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/04. -// - -import Foundation - -struct DetailIngAPI: DetailStartingProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func requestStartingRoomInfo(roomId: String) async throws -> Room? { - let request = DetailIngEndPoint - .requestStartingRoomInfo(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func requestWithFriends(roomId: String) async throws -> FriendList? { - let request = DetailIngEndPoint - .requestWithFriend(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func fetchResetMission(roomId: String) async throws -> MissionDTO? { - let request = DetailIngEndPoint - .getResetMission(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Network/API/DetailWaitAPI.swift b/Manito/Manito/Network/API/DetailWaitAPI.swift deleted file mode 100644 index c9443ddf0..000000000 --- a/Manito/Manito/Network/API/DetailWaitAPI.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// DetailWaitAPI.swift -// Manito -// -// Created by Mingwan Choi on 2022/08/27. -// - -import Foundation - -struct DetailWaitAPI: DetailWaitProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func getWithFriend(roomId: String) async throws -> FriendList? { - let request = DetailWaitEndPoint - .fetchWithFriend(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func getWaitingRoomInfo(roomId: String) async throws -> Room? { - let request = DetailWaitEndPoint - .fetchWaitingRoomInfo(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func startManitto(roomId: String) async throws -> Manittee? { - let request = DetailWaitEndPoint - .patchStartManitto(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func editRoomInfo(roomId: String, roomInfo: RoomDTO) async throws -> Int { - let request = DetailWaitEndPoint - .putRoomInfo(roomId: roomId, roomInfo: roomInfo) - .createRequest() - return try await apiService.request(request) - } - - func deleteRoom(roomId: String) async throws -> Int { - let request = DetailWaitEndPoint - .deleteRoom(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } - - func deleteLeaveRoom(roomId: String) async throws -> Int { - let request = DetailWaitEndPoint - .deleteLeaveRoom(roomId: roomId) - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Network/API/LetterAPI.swift b/Manito/Manito/Network/API/LetterAPI.swift deleted file mode 100644 index 280b23140..000000000 --- a/Manito/Manito/Network/API/LetterAPI.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// LetterAPI.swift -// Manito -// -// Created by SHIN YOON AH on 2022/08/31. -// - -import Foundation - -struct LetterAPI: LetterProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func fetchSendLetter(roomId: String) async throws -> Letter? { - let request = LetterEndPoint - .fetchSendLetter(roomId: roomId) - .createRequest() - return try await self.apiService.request(request) - } - - func fetchReceiveLetter(roomId: String) async throws -> Letter? { - let request = LetterEndPoint - .fetchReceiveLetter(roomId: roomId) - .createRequest() - return try await self.apiService.request(request) - } - - @discardableResult - func dispatchLetter(roomId: String, image: Data? = nil, letter: LetterDTO, missionId: String) async throws -> Int { - let request = LetterEndPoint - .dispatchLetter(roomId: roomId, image: image, letter: letter, missionId: missionId) - .createRequest() - return try await self.apiService.request(request) - } -} diff --git a/Manito/Manito/Network/API/LoginAPI.swift b/Manito/Manito/Network/API/LoginAPI.swift deleted file mode 100644 index b323e9c25..000000000 --- a/Manito/Manito/Network/API/LoginAPI.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// LoginAPI.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/09. -// - -import Foundation - -struct LoginAPI: LoginProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func dispatchAppleLogin(dto: LoginDTO) async throws -> Login? { - let request = LoginEndPoint - .dispatchAppleLogin(body: dto) - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Network/API/MainAPI.swift b/Manito/Manito/Network/API/MainAPI.swift deleted file mode 100644 index 17ad2c003..000000000 --- a/Manito/Manito/Network/API/MainAPI.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// MainAPI.swift -// Manito -// -// Created by COBY_PRO on 2022/09/01. -// - -import Foundation - -struct MainAPI: MainProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func fetchCommonMission() async throws -> DailyMission? { - let request = MainEndPoint - .fetchCommonMission - .createRequest() - return try await apiService.request(request) - } - - func fetchManittoList() async throws -> ParticipatingRooms? { - let request = MainEndPoint - .fetchManittoList - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Network/API/MissionEditAPI.swift b/Manito/Manito/Network/API/MissionEditAPI.swift deleted file mode 100644 index 9eb2a5dbd..000000000 --- a/Manito/Manito/Network/API/MissionEditAPI.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// MissionEditAPI.swift -// Manito -// -// Created by Mingwan Choi on 2023/06/25. -// - -import Foundation - -struct MissionEditAPI: MissionEditProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func patchEditMission(roomId: String, body: MissionDTO) async throws -> MissionDTO? { - let request = MissionEditEndPoint - .patchEditMission(roomId: roomId, body: body) - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Network/API/RoomAPI.swift b/Manito/Manito/Network/API/RoomAPI.swift deleted file mode 100644 index dd0a86ffb..000000000 --- a/Manito/Manito/Network/API/RoomAPI.swift +++ /dev/null @@ -1,37 +0,0 @@ -// -// RoomAPI.swift -// Manito -// -// Created by LeeSungHo on 2022/08/31. -// - -import Foundation - -struct RoomAPI: RoomProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func postCreateRoom(body: CreateRoomDTO) async throws -> Int? { - let request = RoomEndPoint - .dispatchCreateRoom(roomInfo: body) - .createRequest() - return try await apiService.requestCreateRoom(request) - } - - func dispatchVerification(body: String) async throws -> VerificationCode? { - let request = RoomEndPoint - .fetchVerifyCode(code: body) - .createRequest() - return try await apiService.request(request) - } - - func dispatchJoinRoom(roodId: String, dto: MemberDTO) async throws -> Int { - let request = RoomEndPoint - .dispatchJoinRoom(roomId: roodId, roomDto: dto) - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Network/API/SettingAPI.swift b/Manito/Manito/Network/API/SettingAPI.swift deleted file mode 100644 index d12b7506e..000000000 --- a/Manito/Manito/Network/API/SettingAPI.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// SettingAPI.swift -// Manito -// -// Created by 이성호 on 2022/09/07. -// - -import Foundation - -struct SettingAPI: SettingProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func putChangeNickname(body: NicknameDTO) async throws -> String? { - let request = SettingEndPoint - .editUserInfo(nickNameDto: body) - .createRequest() - return try await apiService.request(request) - } - - func deleteMember() async throws -> Int { - let request = SettingEndPoint - .deleteMember - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Network/API/TokenAPI.swift b/Manito/Manito/Network/API/TokenAPI.swift deleted file mode 100644 index 60a8b6df1..000000000 --- a/Manito/Manito/Network/API/TokenAPI.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// TokenAPI.swift -// Manito -// -// Created by SHIN YOON AH on 2022/09/14. -// - -import Foundation - -struct TokenAPI: TokenProtocol { - private let apiService: Requestable - - init(apiService: Requestable) { - self.apiService = apiService - } - - func patchRefreshToken(dto: Token) async throws -> Token? { - let request = TokenEndPoint - .patchRefreshToken(body: dto) - .createRequest() - return try await apiService.request(request) - } -} diff --git a/Manito/Manito/Network/EndPoint/DetailDoneEndPoint.swift b/Manito/Manito/Network/EndPoint/DetailDoneEndPoint.swift deleted file mode 100644 index b69d166fa..000000000 --- a/Manito/Manito/Network/EndPoint/DetailDoneEndPoint.swift +++ /dev/null @@ -1,90 +0,0 @@ -// -// DetailDoneEndPoint.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -enum DetailDoneEndPoint: URLRepresentable { - case requestWithFriend(roomId: String) - case requestMemory(roomId: String) - case requestDoneRoomInfo(roomId: String) - case requestExitRoom(roomId: String) - case requestDeleteRoom(roomId: String) - - var path: String { - switch self { - case .requestWithFriend(let roomId): - return "/rooms/\(roomId)/participants" - case .requestMemory(let roomId): - return "/rooms/\(roomId)/memories" - case .requestDoneRoomInfo(let roomId): - return "/rooms/\(roomId)" - case .requestExitRoom(let roomId): - return "/rooms/\(roomId)/participants" - case .requestDeleteRoom(let roomId): - return "/rooms/\(roomId)" - } - } -} - -extension DetailDoneEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .requestWithFriend: - return .get - case .requestMemory: - return .get - case .requestDoneRoomInfo: - return .get - case .requestExitRoom: - return .delete - case .requestDeleteRoom: - return .delete - } - } - - var requestBody: Data? { - switch self { - case .requestWithFriend: - return nil - case .requestMemory: - return nil - case .requestDoneRoomInfo: - return nil - case .requestExitRoom: - return nil - case .requestDeleteRoom: - return nil - } - } - - var url: String { - switch self { - case .requestWithFriend(let roomId): - return self[.requestWithFriend(roomId: roomId)] - case .requestMemory(let roomId): - return self[.requestMemory(roomId: roomId)] - case .requestDoneRoomInfo(let roomId): - return self[.requestDoneRoomInfo(roomId: roomId)] - case .requestExitRoom(let roomId): - return self[.requestExitRoom(roomId: roomId)] - case .requestDeleteRoom(let roomId): - return self[.requestDeleteRoom(roomId: roomId)] - } - } - - func createRequest() -> NetworkRequest { - return NetworkRequest(url: self.url, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) - } -} diff --git a/Manito/Manito/Network/EndPoint/DetailIngEndPoint.swift b/Manito/Manito/Network/EndPoint/DetailIngEndPoint.swift deleted file mode 100644 index 70ff7acc5..000000000 --- a/Manito/Manito/Network/EndPoint/DetailIngEndPoint.swift +++ /dev/null @@ -1,72 +0,0 @@ -// -// DetailIngEndPoint.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -enum DetailIngEndPoint: URLRepresentable { - case requestWithFriend(roomId: String) - case requestStartingRoomInfo(roomId: String) - case getResetMission(roomId: String) - - var path: String { - switch self { - case .requestWithFriend(let roomId): - return "/rooms/\(roomId)/participants" - case .requestStartingRoomInfo(let roomId): - return "/rooms/\(roomId)" - case .getResetMission(let roomId): - return "/\(roomId)/individual-mission/restore" - } - } -} - -extension DetailIngEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .requestWithFriend: - return .get - case .requestStartingRoomInfo: - return .get - case .getResetMission: - return .get - } - } - - var requestBody: Data? { - switch self { - case .requestWithFriend: - return nil - case .requestStartingRoomInfo: - return nil - case .getResetMission: - return nil - } - } - - var url: String { - switch self { - case .requestWithFriend(let roomId): - return self[.requestWithFriend(roomId: roomId)] - case .requestStartingRoomInfo(let roomId): - return self[.requestStartingRoomInfo(roomId: roomId)] - case .getResetMission(let roomId): - return self[.getResetMission(roomId: roomId)] - } - } - - func createRequest() -> NetworkRequest { - return NetworkRequest(url: self.url, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) - } -} diff --git a/Manito/Manito/Network/EndPoint/DetailWaitEndPoint.swift b/Manito/Manito/Network/EndPoint/DetailWaitEndPoint.swift deleted file mode 100644 index aec356b48..000000000 --- a/Manito/Manito/Network/EndPoint/DetailWaitEndPoint.swift +++ /dev/null @@ -1,108 +0,0 @@ -// -// DetailWaitEndPoint.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -enum DetailWaitEndPoint: URLRepresentable { - case fetchWithFriend(roomId: String) - case fetchWaitingRoomInfo(roomId: String) - case patchStartManitto(roomId: String) - case putRoomInfo(roomId: String, roomInfo: RoomDTO) - case deleteRoom(roomId: String) - case deleteLeaveRoom(roomId: String) - - var path: String { - switch self { - case .fetchWithFriend(let roomId): - return "/rooms/\(roomId)/participants" - case .fetchWaitingRoomInfo(let roomId): - return "/rooms/\(roomId)" - case .patchStartManitto(let roomId): - return "/rooms/\(roomId)/state" - case .putRoomInfo(let roomId, _): - return "/rooms/\(roomId)" - case .deleteRoom(let roomId): - return "/rooms/\(roomId)" - case .deleteLeaveRoom(let roomId): - return "/rooms/\(roomId)/participants" - } - } -} - -extension DetailWaitEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .fetchWithFriend: - return .get - case .fetchWaitingRoomInfo: - return .get - case .patchStartManitto: - return .patch - case .putRoomInfo: - return .put - case .deleteRoom: - return .delete - case .deleteLeaveRoom: - return .delete - } - } - - var requestBody: Data? { - switch self { - case .fetchWithFriend: - return nil - case .fetchWaitingRoomInfo: - return nil - case .patchStartManitto: - return nil - case .putRoomInfo(_, let roomInfo): - let body = ["title": roomInfo.title, - "capacity": roomInfo.capacity.description, - "startDate": roomInfo.startDate, - "endDate": roomInfo.endDate] - return body.encode() - case .deleteRoom: - return nil - case .deleteLeaveRoom: - return nil - } - } - - var url: String { - switch self { - case .fetchWithFriend(let roomId): - return self[.fetchWithFriend(roomId: roomId)] - case .fetchWaitingRoomInfo(let roomId): - return self[.fetchWaitingRoomInfo(roomId: roomId)] - case .patchStartManitto(let roomId): - return self[.patchStartManitto(roomId: roomId)] - case .putRoomInfo(let roomId, let roomInfo): - return self[.putRoomInfo(roomId: roomId, roomInfo: roomInfo)] - case .deleteRoom(let roomId): - return self[.deleteRoom(roomId: roomId)] - case .deleteLeaveRoom(let roomId): - return self[.deleteLeaveRoom(roomId: roomId)] - } - } - - func createRequest() -> NetworkRequest { - var headers: [String: String] = [:] - headers["Content-Type"] = "application/json" - headers["authorization"] = "Bearer \(UserDefaultStorage.accessToken)" - - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) - } -} diff --git a/Manito/Manito/Network/EndPoint/InteractionEndPoint.swift b/Manito/Manito/Network/EndPoint/InteractionEndPoint.swift deleted file mode 100644 index 865be28ce..000000000 --- a/Manito/Manito/Network/EndPoint/InteractionEndPoint.swift +++ /dev/null @@ -1,55 +0,0 @@ -// -// InteractionEndPoint.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -enum InteractionEndPoint: URLRepresentable { - case mixRandomManitto(roomId: String) - case openManitto - - var path: String { - switch self { - case .mixRandomManitto(let roomId): - return "/rooms/\(roomId)/relations" - case .openManitto: - return "/relations/my-manitto" - } - } -} - -extension InteractionEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .mixRandomManitto: - return .post - case .openManitto: - return .get - } - } - - var requestBody: Data? { - switch self { - case .mixRandomManitto: - return nil - case .openManitto: - return nil - } - } - - var url: String { - switch self { - case .mixRandomManitto(let roomId): - return self[.mixRandomManitto(roomId: roomId), .none] - case .openManitto: - return self[.openManitto, .none] - } - } -} diff --git a/Manito/Manito/Network/EndPoint/LetterEndPoint.swift b/Manito/Manito/Network/EndPoint/LetterEndPoint.swift deleted file mode 100644 index 33f733ba1..000000000 --- a/Manito/Manito/Network/EndPoint/LetterEndPoint.swift +++ /dev/null @@ -1,135 +0,0 @@ -// -// LetterEndPoint.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -enum LetterEndPoint: URLRepresentable { - case dispatchLetter(roomId: String, image: Data?, letter: LetterDTO, missionId: String) - case fetchSendLetter(roomId: String) - case fetchReceiveLetter(roomId: String) - case patchReadMessage(roomId: String, status: String) - - var path: String { - switch self { - case .dispatchLetter(let roomId, _, _, _): - return "/rooms/\(roomId)/messages-separate" - case .fetchSendLetter(let roomId): - return "/rooms/\(roomId)/messages-sent" - case .fetchReceiveLetter(let roomId): - return "/rooms/\(roomId)/messages-received" - case .patchReadMessage(let roomId, _): - return "/rooms/\(roomId)/messages/status" - } - } -} - -extension LetterEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .dispatchLetter: - return .post - case .fetchSendLetter: - return .get - case .fetchReceiveLetter: - return .get - case .patchReadMessage: - return .patch - } - } - - var requestBody: Data? { - switch self { - case .dispatchLetter(_, let image, let letter, let missionId): - let parameters: [String: String?] = ["manitteeId": letter.manitteeId, - "messageContent": letter.messageContent, - "missionId": missionId] - let dataBody = createDataBody(withParameters: parameters, - media: image ?? nil, - boundary: APIEnvironment.boundary) - return dataBody - case .fetchSendLetter: - return nil - case .fetchReceiveLetter: - return nil - case .patchReadMessage(_, let status): - let body = ["status": status] - return body.encode() - } - } - - var url: String { - switch self { - case .dispatchLetter(let roomId, let image, let letterDTO, let missionId): - return self[.dispatchLetter(roomId: roomId, image: image, letter: letterDTO, missionId: missionId)] - case .fetchSendLetter(let roomId): - return self[.fetchSendLetter(roomId: roomId), .v2] - case .fetchReceiveLetter(let roomId): - return self[.fetchReceiveLetter(roomId: roomId), .v2] - case .patchReadMessage(let roomId, let status): - return self[.patchReadMessage(roomId: roomId, status: status)] - } - } - - func createRequest() -> NetworkRequest { - var headers: [String: String] = [:] - switch self { - case .dispatchLetter: - headers["Content-Type"] = "multipart/form-data; boundary=\(APIEnvironment.boundary)" - default: - headers["Content-Type"] = "application/json" - } - headers["Authorization"] = "Bearer \(UserDefaultStorage.accessToken)" - - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod) - } -} - -// MARK: - Multipart Form Data Helper Method -extension LetterEndPoint { - func createDataBody(withParameters params: [String: String?], - media: Data?, - boundary: String) -> Data { - let lineBreak = "\r\n" - var body = Data() - - for (key, value) in params { - guard let value = value else { continue } - body.append("--\(boundary + lineBreak)") - body.append("Content-Disposition: form-data; name=\"\(key)\"\(lineBreak + lineBreak)") - body.append("\(value + lineBreak)") - } - - if let media = media { - let mediaKey = "image" - body.append("--\(boundary + lineBreak)") - body.append("Content-Disposition: form-data; name=\"\(mediaKey)\"; filename=\"\(arc4random()).jpeg\"\(lineBreak)") - body.append("Content-Type: image/jpeg\(lineBreak + lineBreak)") - body.append(media) - body.append(lineBreak) - } - - body.append("--\(boundary)--\(lineBreak)") - - return body - } -} - -extension Data { - mutating func append(_ string: String) { - if let data = string.data(using: .utf8) { - append(data) - } - } -} diff --git a/Manito/Manito/Network/EndPoint/LoginEndPoint.swift b/Manito/Manito/Network/EndPoint/LoginEndPoint.swift deleted file mode 100644 index 7a0735c92..000000000 --- a/Manito/Manito/Network/EndPoint/LoginEndPoint.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// LoginEndPoint.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/09. -// - -import Foundation - -enum LoginEndPoint: URLRepresentable { - case dispatchAppleLogin(body: LoginDTO) - - var path: String { - switch self { - case .dispatchAppleLogin: - return "/login" - } - } -} - -extension LoginEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .dispatchAppleLogin: - return .post - } - } - - var requestBody: Data? { - switch self { - case .dispatchAppleLogin(let body): - return body.encode() - } - } - - var url: String { - switch self { - case .dispatchAppleLogin(let loginDTO): - return self[.dispatchAppleLogin(body: loginDTO), .v2] - } - } - - func createRequest() -> NetworkRequest { - var headers: [String: String] = [:] - headers["Content-Type"] = "application/json" - - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) - } -} diff --git a/Manito/Manito/Network/EndPoint/MainEndPoint.swift b/Manito/Manito/Network/EndPoint/MainEndPoint.swift deleted file mode 100644 index e39747c79..000000000 --- a/Manito/Manito/Network/EndPoint/MainEndPoint.swift +++ /dev/null @@ -1,68 +0,0 @@ -// -// MainEndPoint.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/10. -// - -import Foundation - -enum MainEndPoint: URLRepresentable { - case fetchCommonMission - case fetchManittoList - - var path: String { - switch self { - case .fetchCommonMission: - return "/missions/common" - case .fetchManittoList: - return "/rooms" - } - } -} - -extension MainEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .fetchCommonMission: - return .get - case .fetchManittoList: - return .get - } - } - - var requestBody: Data? { - switch self { - case .fetchCommonMission: - return nil - case .fetchManittoList: - return nil - } - } - - var url: String { - switch self { - case .fetchCommonMission: - return self[.fetchCommonMission] - case .fetchManittoList: - return self[.fetchManittoList] - } - } - - func createRequest() -> NetworkRequest { - var headers: [String: String] = [:] - headers["Content-Type"] = "application/json" - headers["authorization"] = "Bearer \(UserDefaultStorage.accessToken)" - - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) - } -} diff --git a/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift b/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift deleted file mode 100644 index 143d5fbd6..000000000 --- a/Manito/Manito/Network/EndPoint/MissionEditEndPoint.swift +++ /dev/null @@ -1,60 +0,0 @@ -// -// MissionEditEndPoint.swift -// Manito -// -// Created by Mingwan Choi on 2023/06/25. -// - -import Foundation - -enum MissionEditEndPoint: URLRepresentable { - case patchEditMission(roomId: String, body: MissionDTO) - - - var path: String { - switch self { - case .patchEditMission(let roomId, _): - return "/\(roomId)/individual-mission" - } - } -} - -extension MissionEditEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .patchEditMission: - return .patch - } - } - - var requestBody: Data? { - switch self { - case .patchEditMission(_, let body): - return body.encode() - } - } - - var url: String { - switch self { - case .patchEditMission(let roomId, let body): - return self[.patchEditMission(roomId: roomId, body: body)] - } - } - - func createRequest() -> NetworkRequest { - var headers: [String: String] = [:] - headers["Content-Type"] = "application/json" - headers["authorization"] = "Bearer \(UserDefaultStorage.accessToken)" - - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) - } -} diff --git a/Manito/Manito/Network/EndPoint/RoomEndPoint.swift b/Manito/Manito/Network/EndPoint/RoomEndPoint.swift deleted file mode 100644 index 99336e9b4..000000000 --- a/Manito/Manito/Network/EndPoint/RoomEndPoint.swift +++ /dev/null @@ -1,80 +0,0 @@ -// -// RoomEndPoint.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -enum RoomEndPoint: URLRepresentable { - case dispatchCreateRoom(roomInfo: CreateRoomDTO) - case fetchVerifyCode(code: String) - case dispatchJoinRoom(roomId: String, roomDto: MemberDTO) - - var path: String { - switch self { - case .dispatchCreateRoom: - return "/rooms" - case .fetchVerifyCode: - return "/invitations/verification" - case .dispatchJoinRoom(let roomId, _): - return "/rooms/\(roomId)/participants" - } - } -} - -extension RoomEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .dispatchCreateRoom: - return .post - case .fetchVerifyCode: - return .post - case .dispatchJoinRoom: - return .post - } - } - - var requestBody: Data? { - switch self { - case .dispatchCreateRoom(let roomInfo): - let body = roomInfo - return body.encode() - case .fetchVerifyCode(let code): - let body = ["invitationCode": code] - return body.encode() - case .dispatchJoinRoom(_, let roomDto): - let body = roomDto - return body.encode() - } - } - - var url: String { - switch self { - case .dispatchCreateRoom(let roomInfo): - return self[.dispatchCreateRoom(roomInfo: roomInfo)] - case .fetchVerifyCode(let code): - return self[.fetchVerifyCode(code: code)] - case .dispatchJoinRoom(let roomId, let roomDTO): - return self[.dispatchJoinRoom(roomId: roomId, roomDto: roomDTO)] - } - } - - func createRequest() -> NetworkRequest { - var headers: [String: String] = [:] - headers["Content-Type"] = "application/json" - headers["authorization"] = "Bearer \(UserDefaultStorage.accessToken)" - - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) - } -} diff --git a/Manito/Manito/Network/EndPoint/SettingEndPoint.swift b/Manito/Manito/Network/EndPoint/SettingEndPoint.swift deleted file mode 100644 index ed903d05e..000000000 --- a/Manito/Manito/Network/EndPoint/SettingEndPoint.swift +++ /dev/null @@ -1,77 +0,0 @@ -// -// SettingEndPoint.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -enum SettingEndPoint: URLRepresentable { - case editUserInfo(nickNameDto: NicknameDTO) - case deleteMember - - var path: String { - switch self { - case .editUserInfo: - return "/members/nickname" - case .deleteMember: - return "/members" - } - } -} - -extension SettingEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .editUserInfo: - return .put - case .deleteMember: - return .delete - } - } - - var requestBody: Data? { - switch self { - case .editUserInfo(let setting): - let body = setting - return body.encode() - case .deleteMember: - return nil - } - } - - var url: String { - switch self { - case .editUserInfo(let nicknameDTO): - return self[.editUserInfo(nickNameDto: nicknameDTO)] - case .deleteMember: - return self[.deleteMember] - } - } - - func createRequest() -> NetworkRequest { - switch self { - case .editUserInfo(_): - var headers: [String: String] = [:] - headers["Content-Type"] = "application/json" - headers["authorization"] = "Bearer \(UserDefaultStorage.accessToken)" - - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) - case .deleteMember: - return NetworkRequest(url: self.url, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod) - } - } -} diff --git a/Manito/Manito/Network/EndPoint/TokenEndPoint.swift b/Manito/Manito/Network/EndPoint/TokenEndPoint.swift deleted file mode 100644 index 7bec96344..000000000 --- a/Manito/Manito/Network/EndPoint/TokenEndPoint.swift +++ /dev/null @@ -1,60 +0,0 @@ -// -// TokenEndPoint.swift -// Manito -// -// Created by SHIN YOON AH on 2022/09/14. -// - -import Foundation - -enum TokenEndPoint: URLRepresentable { - case patchRefreshToken(body: Token) - - var path: String { - switch self { - case .patchRefreshToken: - return "/auth/reissue" - } - } -} - -extension TokenEndPoint: EndPointable { - var requestTimeOut: Float { - return 20 - } - - var httpMethod: HTTPMethod { - switch self { - case .patchRefreshToken: - return .patch - } - } - - var requestBody: Data? { - switch self { - case .patchRefreshToken(let body): - let body = ["accessToken": body.accessToken, - "refreshToken": body.refreshToken] - return body.encode() - } - } - - var url: String { - switch self { - case .patchRefreshToken(let body): - return self[.patchRefreshToken(body: body)] - } - } - - func createRequest() -> NetworkRequest { - var headers: [String: String] = [:] - headers["Content-Type"] = "application/json" - - return NetworkRequest(url: self.url, - headers: headers, - reqBody: self.requestBody, - reqTimeout: self.requestTimeOut, - httpMethod: self.httpMethod - ) - } -} diff --git a/Manito/Manito/Network/Foundation/APIEnvironment.swift b/Manito/Manito/Network/Foundation/APIEnvironment.swift deleted file mode 100644 index 39e646c9a..000000000 --- a/Manito/Manito/Network/Foundation/APIEnvironment.swift +++ /dev/null @@ -1,20 +0,0 @@ -// -// APIEnvironment.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -enum APIEnvironment: String { - case v1 = "/v1" - case v2 = "/v2" - case none = "" - - static func baseURL(_ version: Self = v1) -> String { - return URLLiteral.developmentUrl + "/api\(version.rawValue)" - } - - static let boundary: String = "com.TeamFirefighter.Manito" -} diff --git a/Manito/Manito/Network/Foundation/APIService.swift b/Manito/Manito/Network/Foundation/APIService.swift deleted file mode 100644 index 7bc2f6460..000000000 --- a/Manito/Manito/Network/Foundation/APIService.swift +++ /dev/null @@ -1,81 +0,0 @@ -// -// APIService.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -final class APIService: Requestable { - - var requestTimeOut: Float = 30 - - func request(_ request: NetworkRequest) async throws -> T? { - let (data, httpResponse) = try await requestDataToUrl(request) - - switch httpResponse.statusCode { - case (200..<300): - let decoder = JSONDecoder() - let baseModelData: T? = try decoder.decode(T.self, from: data) - return baseModelData - case (300..<500): - throw NetworkError.clientError(message: httpResponse.statusCode.description) - default: - throw NetworkError.serverError - } - } - - func request(_ request: NetworkRequest) async throws -> Int { - let (_, httpResponse) = try await requestDataToUrl(request) - - switch httpResponse.statusCode { - case (200..<300): - return httpResponse.statusCode - case (300..<500): - throw NetworkError.clientError(message: httpResponse.statusCode.description) - default: - throw NetworkError.serverError - } - } - - func requestCreateRoom(_ request: NetworkRequest) async throws -> Int? { - let (_, httpResponse) = try await requestDataToUrl(request) - - switch httpResponse.statusCode { - case (200..<300): - let responseUrl = httpResponse.value(forHTTPHeaderField: "Location") - return responseUrl?.roomId - case (300..<500): - throw NetworkError.clientError(message: httpResponse.statusCode.description) - default: - throw NetworkError.serverError - } - } -} - -extension APIService { - typealias URLResponse = (Data, HTTPURLResponse) - - private func requestDataToUrl(_ request: NetworkRequest) async throws -> URLResponse { - let sessionConfig = URLSessionConfiguration.default - sessionConfig.timeoutIntervalForRequest = TimeInterval(request.requestTimeOut ?? requestTimeOut) - guard let encodedUrl = request.url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed), - let url = URL(string: encodedUrl) else { - throw NetworkError.encodingError - } - print("encodedUrl = \(encodedUrl)") - - let (data, response) = try await URLSession.shared.data(for: request.buildURLRequest(with: url)) - guard let httpResponse = response as? HTTPURLResponse else { throw NetworkError.serverError } - - return (data, httpResponse) - } -} - -private extension String { - var roomId: Int? { - guard let id = self.split(separator: "/").last.map({ Int($0) }) else { return nil } - return id - } -} diff --git a/Manito/Manito/Network/Foundation/Endpointable.swift b/Manito/Manito/Network/Foundation/Endpointable.swift deleted file mode 100644 index 65b655ae2..000000000 --- a/Manito/Manito/Network/Foundation/Endpointable.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// Endpointable.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/10. -// - -import Foundation - -protocol EndPointable { - var requestTimeOut: Float { get } - var httpMethod: HTTPMethod { get } - var requestBody: Data? { get } - var url: String { get } -} diff --git a/Manito/Manito/Network/Foundation/HTTPMethod.swift b/Manito/Manito/Network/Foundation/HTTPMethod.swift deleted file mode 100644 index dad051491..000000000 --- a/Manito/Manito/Network/Foundation/HTTPMethod.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// HTTPMethod.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/09. -// - -import Foundation - -enum HTTPMethod: String { - case get = "GET" - case post = "POST" - case put = "PUT" - case patch = "PATCH" - case delete = "DELETE" -} diff --git a/Manito/Manito/Network/Foundation/NetworkRequest.swift b/Manito/Manito/Network/Foundation/NetworkRequest.swift deleted file mode 100644 index b02d247be..000000000 --- a/Manito/Manito/Network/Foundation/NetworkRequest.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// NetworkRequest.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -struct NetworkRequest { - let url: String - let headers: [String: String]? - let body: Data? - let requestTimeOut: Float? - let httpMethod: HTTPMethod - - init(url: String, - headers: [String: String]? = nil, - reqBody: Data? = nil, - reqTimeout: Float? = nil, - httpMethod: HTTPMethod - ) { - self.url = url - self.headers = headers - self.body = reqBody - self.requestTimeOut = reqTimeout - self.httpMethod = httpMethod - } - - func buildURLRequest(with url: URL) -> URLRequest { - var urlRequest = URLRequest(url: url) - urlRequest.setValue("Bearer " + UserDefaultStorage.accessToken, forHTTPHeaderField: "Authorization") - urlRequest.httpMethod = httpMethod.rawValue - urlRequest.allHTTPHeaderFields = headers ?? [:] - urlRequest.httpBody = body - return urlRequest - } -} diff --git a/Manito/Manito/Network/Foundation/Requestable.swift b/Manito/Manito/Network/Foundation/Requestable.swift deleted file mode 100644 index 060a824f5..000000000 --- a/Manito/Manito/Network/Foundation/Requestable.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// Requestable.swift -// Manito -// -// Created by SHIN YOON AH on 2022/08/31. -// - -import Foundation - -protocol Requestable { - var requestTimeOut: Float { get } - - func request(_ request: NetworkRequest) async throws -> T? - func request(_ request: NetworkRequest) async throws -> Int - func requestCreateRoom(_ request: NetworkRequest) async throws -> Int? -} diff --git a/Manito/Manito/Network/Foundation/URLRepresentable.swift b/Manito/Manito/Network/Foundation/URLRepresentable.swift deleted file mode 100644 index bd82f5793..000000000 --- a/Manito/Manito/Network/Foundation/URLRepresentable.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// URLRepresentable.swift -// Manito -// -// Created by SHIN YOON AH on 2023/03/17. -// - -import Foundation - -protocol URLRepresentable { - var path: String { get } -} - -extension URLRepresentable { - subscript(_ `case`: Self, version: APIEnvironment = .v1) -> String { - return APIEnvironment.baseURL(version) + "\(`case`.path)" - } -} diff --git a/Manito/Manito/Network/Models/DailyMission.swift b/Manito/Manito/Network/Models/DailyMission.swift deleted file mode 100644 index f695d75d2..000000000 --- a/Manito/Manito/Network/Models/DailyMission.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// DailyMission.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/09. -// - -import Foundation - -struct DailyMission: Decodable { - let mission: String? -} diff --git a/Manito/Manito/Network/Models/Letter.swift b/Manito/Manito/Network/Models/Letter.swift deleted file mode 100644 index efd9a5edc..000000000 --- a/Manito/Manito/Network/Models/Letter.swift +++ /dev/null @@ -1,43 +0,0 @@ -// -// Letter.swift -// Manito -// -// Created by SHIN YOON AH on 2022/06/12. -// - -import Foundation - -struct Letter: Codable { - var count: Int? - var manittee: Manitte? - var messages: [Message] -} - -struct Manitte: Codable { - var id: String? - var nickname: String? -} - -struct Message: Codable, Hashable { - let id: Int? - let content: String? - let imageUrl: String? - let createdDate: String? - let missionInfo: Mission? - var canReport: Bool? - - var isToday: Bool { - return Date().letterDateToString == createdDate - } - - var date: String { - guard let createdDate = createdDate else { return "" } - return self.isToday ? "오늘" : createdDate - } - - var mission: String? { - guard let mission = missionInfo?.content else { return nil } - - return "\(date)의 개별미션\n[\(mission)]" - } -} diff --git a/Manito/Manito/Network/Models/Memory.swift b/Manito/Manito/Network/Models/Memory.swift deleted file mode 100644 index 3611b4416..000000000 --- a/Manito/Manito/Network/Models/Memory.swift +++ /dev/null @@ -1,17 +0,0 @@ -// -// Memory.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/04. -// - -import Foundation - -struct Memory: Decodable { - let memoriesWithManitto, memoriesWithManittee: MemoriesWithManitte? -} - -struct MemoriesWithManitte: Decodable { - let member: Member? - let messages: [Message]? -} diff --git a/Manito/Manito/Network/Models/Request/LetterDTO.swift b/Manito/Manito/Network/Models/Request/LetterDTO.swift deleted file mode 100644 index 4e5e6695e..000000000 --- a/Manito/Manito/Network/Models/Request/LetterDTO.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// LetterDTO.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/14. -// - -import Foundation - -struct LetterDTO: Encodable { - var manitteeId: String? - var messageContent: String? - - init(manitteeId: String?, messageContent: String? = nil) { - self.manitteeId = manitteeId - self.messageContent = messageContent - } -} diff --git a/Manito/Manito/Network/Models/Request/LoginDTO.swift b/Manito/Manito/Network/Models/Request/LoginDTO.swift deleted file mode 100644 index 32c63ad72..000000000 --- a/Manito/Manito/Network/Models/Request/LoginDTO.swift +++ /dev/null @@ -1,13 +0,0 @@ -// -// LoginDTO.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/09. -// - -import Foundation - -struct LoginDTO: Encodable { - let identityToken: String - let fcmToken : String -} diff --git a/Manito/Manito/Network/Models/Request/MissionDTO.swift b/Manito/Manito/Network/Models/Request/MissionDTO.swift deleted file mode 100644 index 175b5bde2..000000000 --- a/Manito/Manito/Network/Models/Request/MissionDTO.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// MissionDTO.swift -// Manito -// -// Created by Mingwan Choi on 2023/06/25. -// - -import Foundation - -struct MissionDTO: Codable { - let mission: String -} diff --git a/Manito/Manito/Network/Models/Request/RoomDTO.swift b/Manito/Manito/Network/Models/Request/RoomDTO.swift deleted file mode 100644 index b4394bd43..000000000 --- a/Manito/Manito/Network/Models/Request/RoomDTO.swift +++ /dev/null @@ -1,28 +0,0 @@ -// -// RoomDTO.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/09. -// - -import Foundation - -struct CreateRoomDTO: Encodable { - var room: RoomDTO - var member: MemberDTO -} - -struct RoomDTO: Encodable { - let title: String - let capacity: Int - let startDate: String - let endDate: String -} - -struct MemberDTO: Encodable { - var colorIndex: Int - - enum CodingKeys: String, CodingKey { - case colorIndex = "colorIdx" - } -} diff --git a/Manito/Manito/Network/Models/Room.swift b/Manito/Manito/Network/Models/Room.swift deleted file mode 100644 index 6be0dffdd..000000000 --- a/Manito/Manito/Network/Models/Room.swift +++ /dev/null @@ -1,255 +0,0 @@ -// -// Room.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/09. -// - -import Foundation - -struct ParticipatingRooms: Decodable { - let participatingRooms: [ParticipatingRoom]? -} - -struct ParticipatingRoom: Decodable, Equatable { - let id: Int? - let title: String? - var state: String? - let participatingCount, capacity: Int? - let startDate, endDate: String? -} - -struct Room: Decodable, Equatable { - static func == (lhs: Room, rhs: Room) -> Bool { - return lhs.roomInformation == rhs.roomInformation && - lhs.participants == rhs.participants && - lhs.manittee == rhs.manittee && - lhs.manitto == rhs.manitto && - lhs.invitation == rhs.invitation && - lhs.didViewRoulette == rhs.didViewRoulette && - lhs.mission == rhs.mission && - lhs.admin == rhs.admin && - lhs.messages == rhs.messages - } - - let roomInformation: RoomInfo? - let participants: Participants? - let manittee: Manittee? - let manitto: Manitto? - let invitation: Invitation? - var didViewRoulette: Bool? - let mission: Mission? - let admin: Bool? - let messages: Message1? - - var userCount: String { - if let count = participants?.count, - let capacity = roomInformation?.capacity { - return "\(count)/\(capacity)" - } else { - return "" - } - } - - var canStart: Bool { - if let count = participants?.count, - let date = roomInformation?.startDate?.stringToDate, - let isAdmin = admin { - let isMinimumUserCount = count >= 4 - return isMinimumUserCount && date.isToday && isAdmin - } else { - return false - } - } - - var roomDTO: RoomDTO { - if let roomInformation { - let dto = RoomDTO(title: roomInformation.title ?? "", - capacity: roomInformation.capacity ?? 0, - startDate: roomInformation.startDate ?? "", - endDate: roomInformation.endDate ?? "") - return dto - } else { - return RoomDTO(title: "", capacity: 0, startDate: "", endDate: "") - } - } - - enum CodingKeys: String, CodingKey { - case roomInformation = "room" - case participants - case manittee - case manitto - case invitation - case didViewRoulette - case mission - case admin - case messages - } -} - -extension Room { - static let emptyRoom = Room( - roomInformation: nil, - participants: nil, - manittee: nil, - manitto: nil, - invitation: nil, - mission: nil, - admin: nil, - messages: nil) - - static let testRoom = Room( - roomInformation: RoomInfo.testRoomInfo, - participants: Participants.testParticipants, - manittee: Manittee.testManittee, - manitto: Manitto.testManitto, - invitation: Invitation.testInvitation, - didViewRoulette: false, - mission: Mission.testMission, - admin: false, - messages: Message1.testMessage) -} - -struct Friend: Decodable { - let colorIndex: Int? - let name: String? -} - -// MARK: - Participants -struct Participants: Decodable, Equatable { - let count: Int? - let members: [User]? - - var membersNickname: [String] { - if let nicknames = members { - return nicknames.map { $0.nickname ?? "" } - } else { - return [] - } - } -} - -extension Participants { - static let testParticipants = Participants( - count: 5, - members: User.testUserList) -} - -// MARK: - User -struct User: Decodable, Equatable { - let id, nickname: String? -} - -extension User { - static let testUser = User( - id: "100", nickname: "유저1") - static let testUserList = [ - User(id: "100", nickname: "유저1"), - User(id: "200", nickname: "유저2"), - User(id: "300", nickname: "유저3"), - User(id: "400", nickname: "유저4"), - User(id: "500", nickname: "유저5") - ] -} - -// MARK: - Room -struct RoomInfo: Decodable, Equatable { - let id, capacity: Int? - let title, startDate, endDate, state: String? - - var dateRangeText: String { - if let startDate, - let endDate { - return startDate + " ~ " + endDate - } else { - return "" - } - } - - var isAlreadyPastDate: Bool { - if let date = startDate?.stringToDate { - return date.distance(to: Date()) > 86400 - } else { - return false - } - } - - var isStart: Bool { - if let date = startDate?.stringToDate { - let isStartDate = date.distance(to: Date()) < 86400 - let isPast = date.distance(to: Date()) > 86400 - return !isPast && isStartDate - } else { - return false - } - } - - var isStartDatePast: Bool { - guard let startDate = self.startDate?.stringToDate else { return true } - return startDate.isPast - } - - var dateRange: (startDate: String, endDate: String) { - let fiveDaysInterval: TimeInterval = 86400 * 4 - let startDate: String = isStartDatePast ? Date().dateToString : self.startDate ?? "" - let endDate: String = isStartDatePast ? (Date() + fiveDaysInterval).dateToString : self.endDate ?? "" - - return (startDate, endDate) - } -} - -extension RoomInfo { - static let testRoomInfo = RoomInfo( - id: 1, - capacity: 5, - title: "테스트타이틀", - startDate: "2023.01.01", - endDate: "2023.01.05", - state: "PRE") -} - -// MARK: - Mission -struct Mission: Codable, Equatable, Hashable { - let id: Int? - let content: String? -} - -extension Mission { - static let testMission = Mission(id: 1, content: "테스트미션") -} - -// MARK: - Invitation -struct Invitation: Decodable, Equatable { - let code: String? -} - -extension Invitation { - static let testInvitation = Invitation(code: "ABCDEF") -} - -// MARK: - Message1 -struct Message1: Decodable, Equatable { - let count: Int? -} - -extension Message1 { - static let testMessage = Message1(count: 3) -} - -// MARK: - Manittee -struct Manittee: Decodable, Equatable { - let nickname: String? -} - -extension Manittee { - static let testManittee = Manittee(nickname: "테스트마니띠") -} - -// MARK: - Manitto -struct Manitto: Decodable, Equatable { - let nickname: String? -} - -extension Manitto { - static let testManitto = Manitto(nickname: "테스트마니또") -} diff --git a/Manito/Manito/Network/Protocol/DetailDoneProtocol.swift b/Manito/Manito/Network/Protocol/DetailDoneProtocol.swift deleted file mode 100644 index 0f071e014..000000000 --- a/Manito/Manito/Network/Protocol/DetailDoneProtocol.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// DetailEndProtocol.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/04. -// - -import Foundation - -protocol DetailDoneProtocol { - func requestMemory(roomId: String) async throws -> Memory? - func requestDoneRoomInfo(roomId: String) async throws -> Room? - func requestWithFriends(roomId: String) async throws -> FriendList? - func requestExitRoom(roomId: String) async throws -> Int - func requestDeleteRoom(roomId: String) async throws -> Int -} diff --git a/Manito/Manito/Network/Protocol/DetailStartingProtocol.swift b/Manito/Manito/Network/Protocol/DetailStartingProtocol.swift deleted file mode 100644 index 0123cc5d4..000000000 --- a/Manito/Manito/Network/Protocol/DetailStartingProtocol.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// DetailIngProtocol.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/04. -// - -import Foundation - -protocol DetailStartingProtocol { - func requestStartingRoomInfo(roomId: String) async throws -> Room? - func requestWithFriends(roomId: String) async throws -> FriendList? - func fetchResetMission(roomId: String) async throws -> MissionDTO? -} diff --git a/Manito/Manito/Network/Protocol/DetailWaitProtocol.swift b/Manito/Manito/Network/Protocol/DetailWaitProtocol.swift deleted file mode 100644 index 7b1a74165..000000000 --- a/Manito/Manito/Network/Protocol/DetailWaitProtocol.swift +++ /dev/null @@ -1,17 +0,0 @@ -// -// DetailWaitProtocol.swift -// Manito -// -// Created by Mingwan Choi on 2022/08/27. -// - -import Foundation - -protocol DetailWaitProtocol { - func getWithFriend(roomId: String) async throws -> FriendList? - func getWaitingRoomInfo(roomId: String) async throws -> Room? - func startManitto(roomId: String) async throws -> Manittee? - func editRoomInfo(roomId: String, roomInfo: RoomDTO) async throws -> Int - func deleteRoom(roomId: String) async throws -> Int - func deleteLeaveRoom(roomId: String) async throws -> Int -} diff --git a/Manito/Manito/Network/Protocol/LetterProtocol.swift b/Manito/Manito/Network/Protocol/LetterProtocol.swift deleted file mode 100644 index 6bf6cc223..000000000 --- a/Manito/Manito/Network/Protocol/LetterProtocol.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// LetterProtocol.swift -// Manito -// -// Created by SHIN YOON AH on 2022/08/31. -// - -import Foundation - -protocol LetterProtocol { - func fetchSendLetter(roomId: String) async throws -> Letter? - func fetchReceiveLetter(roomId: String) async throws -> Letter? - func dispatchLetter(roomId: String, image: Data?, letter: LetterDTO, missionId: String) async throws -> Int -} diff --git a/Manito/Manito/Network/Protocol/LoginProtocol.swift b/Manito/Manito/Network/Protocol/LoginProtocol.swift deleted file mode 100644 index 6f4e4b048..000000000 --- a/Manito/Manito/Network/Protocol/LoginProtocol.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// LoginProtocol.swift -// Manito -// -// Created by Mingwan Choi on 2022/09/09. -// - -import Foundation - -protocol LoginProtocol { - func dispatchAppleLogin(dto: LoginDTO) async throws -> Login? -} diff --git a/Manito/Manito/Network/Protocol/MainProtocol.swift b/Manito/Manito/Network/Protocol/MainProtocol.swift deleted file mode 100644 index 205482da0..000000000 --- a/Manito/Manito/Network/Protocol/MainProtocol.swift +++ /dev/null @@ -1,13 +0,0 @@ -// -// MainProtocal.swift -// Manito -// -// Created by COBY_PRO on 2022/09/01. -// - -import Foundation - -protocol MainProtocol { - func fetchCommonMission() async throws -> DailyMission? - func fetchManittoList() async throws -> ParticipatingRooms? -} diff --git a/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift b/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift deleted file mode 100644 index ef27e4421..000000000 --- a/Manito/Manito/Network/Protocol/MisstionEditProtocol.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// MisstionEditProtocol.swift -// Manito -// -// Created by Mingwan Choi on 2023/06/25. -// - -import Foundation - -protocol MissionEditProtocol { - func patchEditMission(roomId: String, body: MissionDTO) async throws -> MissionDTO? -} diff --git a/Manito/Manito/Network/Protocol/RoomProtocol.swift b/Manito/Manito/Network/Protocol/RoomProtocol.swift deleted file mode 100644 index 98eff699f..000000000 --- a/Manito/Manito/Network/Protocol/RoomProtocol.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// RoomProtocol.swift -// Manito -// -// Created by LeeSungHo on 2022/08/31. -// - -import Foundation - -protocol RoomProtocol { - func postCreateRoom(body: CreateRoomDTO) async throws -> Int? - func dispatchVerification(body: String) async throws -> VerificationCode? - func dispatchJoinRoom(roodId: String, dto: MemberDTO) async throws -> Int -} diff --git a/Manito/Manito/Network/Protocol/SettingProtocol.swift b/Manito/Manito/Network/Protocol/SettingProtocol.swift deleted file mode 100644 index ef8a309de..000000000 --- a/Manito/Manito/Network/Protocol/SettingProtocol.swift +++ /dev/null @@ -1,13 +0,0 @@ -// -// SettingProtocol.swift -// Manito -// -// Created by 이성호 on 2022/09/07. -// - -import Foundation - -protocol SettingProtocol { - func putChangeNickname(body: NicknameDTO) async throws -> String? - func deleteMember() async throws -> Int -} diff --git a/Manito/Manito/Network/Protocol/TokenProtocol.swift b/Manito/Manito/Network/Protocol/TokenProtocol.swift deleted file mode 100644 index 87066106c..000000000 --- a/Manito/Manito/Network/Protocol/TokenProtocol.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// TokenProtocol.swift -// Manito -// -// Created by SHIN YOON AH on 2022/09/14. -// - -import Foundation - -protocol TokenProtocol { - func patchRefreshToken(dto: Token) async throws -> Token? -} diff --git a/Manito/Manito/Screens/CheckRoom/CheckRoomViewController.swift b/Manito/Manito/Screens/CheckRoom/CheckRoomViewController.swift index 6844db072..6a4a3a9d6 100644 --- a/Manito/Manito/Screens/CheckRoom/CheckRoomViewController.swift +++ b/Manito/Manito/Screens/CheckRoom/CheckRoomViewController.swift @@ -11,7 +11,7 @@ import SnapKit class CheckRoomViewController: BaseViewController { var roomId: Int? - var verification: VerificationCode? + var roomInfo: ParticipatedRoomInfoDTO? // MARK: - Property @@ -117,10 +117,10 @@ class CheckRoomViewController: BaseViewController { // MARK: - func private func setupViewController() { - guard let title = verification?.title, - let startDate = verification?.startDate, - let endDate = verification?.endDate, - let capacity = verification?.capacity else { return } + guard let title = roomInfo?.title, + let startDate = roomInfo?.startDate, + let endDate = roomInfo?.endDate, + let capacity = roomInfo?.capacity else { return } roomInfoView.roomLabel.text = title roomInfoView.dateLabel.text = "\(startDate) ~ \(endDate)" roomInfoView.peopleInfoView.peopleLabel.text = "X \(capacity)인" diff --git a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift index 668f72d75..8a13b4566 100644 --- a/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift +++ b/Manito/Manito/Screens/ChooseCharacter/ChooseCharacterViewController.swift @@ -10,11 +10,6 @@ import UIKit import SnapKit final class ChooseCharacterViewController: BaseViewController { - // FIXME: Status 삭제예정 - enum Status { - case createRoom - case enterRoom - } // MARK: - ui component @@ -22,17 +17,12 @@ final class ChooseCharacterViewController: BaseViewController { // MARK: - property - private let roomService: RoomProtocol = RoomAPI(apiService: APIService()) - // FIXME: 삭제예정 - private var statusMode: Status - private var roomId: Int? - // FIXME: private 변경 예정 - var roomInfo: RoomDTO? + private let roomParticipationRepository: RoomParticipationRepository = RoomParticipationRepositoryImpl() + private let roomId: Int? // MARK: - init - init(statusMode: Status, roomId: Int?) { - self.statusMode = statusMode + init(roomId: Int?) { self.roomId = roomId super.init() } @@ -77,41 +67,13 @@ final class ChooseCharacterViewController: BaseViewController { self.chooseCharacterView.configureNavigationItem(navigationController) } - private func didTapEnterButton(characterIndex: Int) { - // FIXME: statusMode 삭제 이후 enterRoom 변경 예정 - switch self.statusMode { - case .createRoom: - guard let roomInfo = self.roomInfo else { return } - self.requestCreateRoom(room: CreateRoomDTO(room: RoomDTO(title: roomInfo.title, - capacity: roomInfo.capacity, - startDate: roomInfo.startDate, - endDate: roomInfo.endDate) , - member: MemberDTO(colorIndex: characterIndex))) - case .enterRoom: - self.requestJoinRoom(characterIndex: characterIndex) - } - } - - private func pushDetailWaitViewController(status: Status, roomId: Int) { + private func pushDetailWaitViewController(roomId: Int) { guard let navigationController = self.presentingViewController as? UINavigationController else { return } - - let viewController = DetailWaitViewController(viewModel: DetailWaitViewModel(roomIndex: roomId, - detailWaitService: DetailWaitService(api: DetailWaitAPI(apiService: APIService())))) - - switch status { - case .createRoom: - navigationController.popViewController(animated: true) - navigationController.pushViewController(viewController, animated: false) - - self.dismiss(animated: true) { - NotificationCenter.default.post(name: .createRoomInvitedCode, object: nil) - } - case .enterRoom: - self.dismiss(animated: true) { - navigationController.pushViewController(viewController, animated: true) - } + let viewModel = DetailWaitViewModel(roomIndex: roomId, detailWaitService: DetailWaitService(repository: DetailRoomRepositoryImpl())) + let viewController = DetailWaitViewController(viewModel: viewModel) + self.dismiss(animated: true) { + navigationController.pushViewController(viewController, animated: true) } - } private func makeAlertWhenAlreadyJoin() { @@ -126,10 +88,10 @@ final class ChooseCharacterViewController: BaseViewController { Task { do { guard let roomId = self.roomId else { return } - let status = try await self.roomService.dispatchJoinRoom(roodId: roomId.description, - dto: MemberDTO(colorIndex: characterIndex)) + let status = try await self.roomParticipationRepository.dispatchJoinRoom(roomId: roomId.description, + member: MemberInfoRequestDTO(colorIndex: characterIndex)) if status == 201 { - self.pushDetailWaitViewController(status: .enterRoom, roomId: roomId) + self.pushDetailWaitViewController(roomId: roomId) } } catch NetworkError.serverError { print("server Error") @@ -141,21 +103,6 @@ final class ChooseCharacterViewController: BaseViewController { } } } - - private func requestCreateRoom(room: CreateRoomDTO) { - Task { - do { - guard let roomId = try await self.roomService.postCreateRoom(body: room) else { return } - self.pushDetailWaitViewController(status: .createRoom, roomId: roomId) - } catch NetworkError.serverError { - print("server Error") - } catch NetworkError.encodingError { - print("encoding Error") - } catch NetworkError.clientError(let message) { - print("client Error: \(String(describing: message))") - } - } - } } extension ChooseCharacterViewController: ChooseCharacterViewDelegate { @@ -168,6 +115,6 @@ extension ChooseCharacterViewController: ChooseCharacterViewDelegate { } func joinButtonDidTap(characterIndex: Int) { - self.didTapEnterButton(characterIndex: characterIndex) + self.requestJoinRoom(characterIndex: characterIndex) } } diff --git a/Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift b/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift similarity index 100% rename from Manito/Manito/Screens/ChooseCharacter/UIComponent/ChooseCharacterView.swift rename to Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift diff --git a/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift b/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift index 626970359..719eb66d8 100644 --- a/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift +++ b/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift @@ -11,7 +11,7 @@ import SnapKit class CreateNickNameViewController: BaseViewController { - let settingService: SettingProtocol = SettingAPI(apiService: APIService()) + private let settingRepository: SettingRepository = SettingRepositoryImpl() private var nickname: String = "" private let maxLength = 5 @@ -73,13 +73,11 @@ class CreateNickNameViewController: BaseViewController { } // MARK: - API - func requestNickname(setting: NicknameDTO) { + func requestNickname(nickname: NicknameDTO) { Task { do { - let data = try await settingService.putChangeNickname(body: setting) - if let nickname = data { - UserDefaultHandler.setNickname(nickname: nickname) - } + let data = try await self.settingRepository.putUserInfo(nickname: nickname) + UserDefaultHandler.setNickname(nickname: data.nickname) } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { @@ -123,7 +121,7 @@ class CreateNickNameViewController: BaseViewController { if let text = roomsNameTextField.text, !text.isEmpty { nickname = text UserData.setValue(nickname, forKey: .nickname) - requestNickname(setting: NicknameDTO(nickname: nickname)) + requestNickname(nickname: NicknameDTO(nickname: nickname)) presentMainViewController() } } diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index a2287a21f..deaaa71f8 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -11,54 +11,13 @@ import SnapKit final class CreateRoomViewController: BaseViewController { - private enum RoomState: Int { - case inputName = 0 - case inputPerson = 1 - case inputDate = 2 - case checkRoom = 3 - } - // MARK: - ui component - private let titleLabel: UILabel = { - let label = UILabel() - label.text = TextLiteral.createRoom - label.font = .font(.regular, ofSize: 34) - return label - }() - private let closeButton: UIButton = { - let button = UIButton(type: .system) - button.setImage(ImageLiterals.btnXmark, for: .normal) - button.tintColor = .grey001 - return button - }() - private let nextButton: MainButton = { - let button = MainButton() - button.title = TextLiteral.next - button.isDisabled = true - return button - }() - private let backButton: UIButton = { - let button = UIButton() - button.setImage(ImageLiterals.icBack, for: .normal) - button.setTitle(" " + TextLiteral.previous, for: .normal) - button.titleLabel?.font = .font(.regular, ofSize: 14) - button.tintColor = .white - button.isHidden = true - return button - }() - private let nameView: InputNameView = InputNameView() - private let personView: InputPersonView = InputPersonView() - private let dateView: InputDateView = InputDateView() - private let checkView: CheckRoomView = CheckRoomView() - + private let createRoomView: CreateRoomView = CreateRoomView() + // MARK: - property - private let roomService: RoomProtocol = RoomAPI(apiService: APIService()) - private var name: String = "" - private var person: Int = 0 - private var notiIndex: RoomState = .inputName - private var roomInfo: RoomDTO? + private let roomParticipationRepository: RoomParticipationRepository = RoomParticipationRepositoryImpl() // MARK: - init @@ -68,13 +27,15 @@ final class CreateRoomViewController: BaseViewController { // MARK: - life cycle + override func loadView() { + self.view = self.createRoomView + } + override func viewDidLoad() { super.viewDidLoad() - self.detectStartableStatus() - self.setupNotificationCenter() - self.setInputViewIsHidden() - self.setupAction() + self.configureDelegation() } + // FIXME: 플로우 연결 하면서 변경 될 예정 override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) @@ -83,253 +44,64 @@ final class CreateRoomViewController: BaseViewController { // MARK: - override - override func setupLayout() { - self.view.addSubview(self.titleLabel) - self.titleLabel.snp.makeConstraints { - $0.top.equalTo(self.view.safeAreaLayoutGuide).inset(66) - $0.leading.equalTo(self.view.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) - } - - self.view.addSubview(self.closeButton) - self.closeButton.snp.makeConstraints { - $0.top.equalTo(self.view.safeAreaLayoutGuide).inset(9) - $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - } - - self.view.addSubview(self.backButton) - self.backButton.snp.makeConstraints { - $0.top.equalTo(self.closeButton) - $0.leading.equalTo(self.view.safeAreaLayoutGuide) - $0.height.equalTo(44) - } - - self.view.addSubview(self.nextButton) - self.nextButton.snp.makeConstraints { - $0.leading.trailing.equalTo(self.view.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) - $0.bottom.equalTo(self.view.safeAreaLayoutGuide).inset(23) - $0.height.equalTo(60) - } - - self.view.addSubview(self.nameView) - self.nameView.snp.makeConstraints { - $0.top.equalTo(self.titleLabel.snp.bottom).offset(66) - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalTo(self.nextButton.snp.top) - } - - self.view.addSubview(self.personView) - self.personView.snp.makeConstraints { - $0.top.equalTo(self.titleLabel.snp.bottom).offset(66) - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalTo(self.nextButton.snp.top) - } - - self.view.addSubview(self.dateView) - self.dateView.snp.makeConstraints { - $0.top.equalTo(self.titleLabel.snp.bottom).offset(66) - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalTo(self.nextButton.snp.top) - } - - self.view.addSubview(self.checkView) - self.checkView.snp.makeConstraints { - $0.top.equalTo(self.titleLabel.snp.bottom).offset(66) - $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - $0.bottom.equalTo(self.nextButton.snp.top) - } - - self.view.bringSubviewToFront(self.nextButton) - } - override func configureUI() { super.configureUI() self.navigationController?.navigationBar.isHidden = true } override func endEditingView() { - if !self.nextButton.isTouchInside { - self.view.endEditing(true) - } + self.createRoomView.endEditingView() } // MARK: - func - private func setupAction() { - let closeAction = UIAction { [weak self] _ in - self?.didTapCloseButton() - } - self.closeButton.addAction(closeAction, for: .touchUpInside) - - let nextAction = UIAction { [weak self] _ in - self?.didTapNextButton() - } - self.nextButton.addAction(nextAction, for: .touchUpInside) - - let backAction = UIAction { [weak self] _ in - self?.didTapBackButton() - } - self.backButton.addAction(backAction, for: .touchUpInside) - } - - private func didTapBackButton() { - self.notiIndex = RoomState.init(rawValue: self.notiIndex.rawValue - 1) ?? RoomState.inputName - self.changedInputView() + private func configureDelegation() { + self.createRoomView.configureDelegate(self) } - private func didTapCloseButton() { - DispatchQueue.main.async { - self.dismiss(animated: true) - } - } - - private func didTapNextButton() { - switch self.notiIndex { - case .inputName: - guard let text = self.nameView.roomsNameTextField.text else { return } - self.name = text - self.setDataInCheckView(name: self.name) - self.changeNotiIndex() - self.changedInputView() - self.nameView.roomsNameTextField.resignFirstResponder() - case .inputPerson: - self.person = Int(self.personView.personSlider.value) - self.setDataInCheckView(person: self.person) - self.changeNotiIndex() - self.changedInputView() - case .inputDate: - self.setDataInCheckView(date: "\(dateView.calendarView.getTempStartDate()) ~ \(dateView.calendarView.getTempEndDate())") - self.changeNotiIndex() - self.changedInputView() - case .checkRoom: - self.roomInfo = RoomDTO(title: self.name, - capacity: self.person, - startDate: "20\(self.dateView.calendarView.getTempStartDate())", - endDate: "20\(self.dateView.calendarView.getTempEndDate())") - let viewController = ChooseCharacterViewController(statusMode: .createRoom, roomId: nil) - viewController.roomInfo = self.roomInfo - self.navigationController?.pushViewController(viewController, animated: true) - } - } - - private func detectStartableStatus() { - self.nameView.changeNextButtonEnableStatus = { [weak self] isEnabled in - self?.nextButton.isDisabled = !isEnabled - } + private func pushDetailWaitViewController(roomId: Int) { + guard let navigationController = self.presentingViewController as? UINavigationController else { return } + let viewModel = DetailWaitViewModel(roomIndex: roomId, + detailWaitService: DetailWaitService(repository: DetailRoomRepositoryImpl())) + let viewController = DetailWaitViewController(viewModel: viewModel) - self.dateView.calendarView.changeButtonState = { [weak self] isEnabled in - self?.nextButton.isDisabled = !isEnabled - } - } - - private func changedInputView() { - switch self.notiIndex { - case .inputName: - self.setInputNameView() - case .inputPerson: - self.setInputPersonView() - case .inputDate: - self.setInputDateView() - case .checkRoom: - self.setCheckRoomView() - } - } - - private func setInputNameView() { - self.backButton.isHidden = true - self.nameView.fadeIn(duration: 0.3) - self.nameView.isHidden = false - self.personView.fadeOut() - self.personView.isHidden = true - } - - private func setInputPersonView() { - self.nextButton.isDisabled = false - self.backButton.isHidden = false - self.nameView.fadeOut() - self.nameView.isHidden = true - self.personView.fadeIn(duration: 0.3) - self.personView.isHidden = false - self.dateView.fadeOut() - self.dateView.isHidden = true - } - - private func setInputDateView() { - self.dateView.calendarView.setupButtonState() - self.personView.fadeOut() - self.personView.isHidden = true - self.dateView.fadeIn(duration: 0.3) - self.dateView.isHidden = false - self.checkView.fadeOut() - self.checkView.isHidden = true - } - - private func setCheckRoomView() { - self.dateView.fadeOut() - self.dateView.isHidden = true - self.checkView.fadeIn(duration: 0.3) - self.checkView.isHidden = false - } - - private func setDataInCheckView(name: String = "", person: Int = 0, date: String = "" ) { - switch self.notiIndex { - case .inputName: - self.checkView.name = name - case .inputPerson: - self.checkView.participants = person - case .inputDate: - self.checkView.dateRange = date - default: - return - } - } - private func changeNotiIndex() { - switch self.notiIndex { - case .inputName: - self.notiIndex = .inputPerson - case .inputPerson: - self.notiIndex = .inputDate - case .inputDate: - self.notiIndex = .checkRoom - default: - return + navigationController.popViewController(animated: true) + navigationController.pushViewController(viewController, animated: false) + + self.dismiss(animated: true) { + NotificationCenter.default.post(name: .createRoomInvitedCode, object: nil) } } - private func setInputViewIsHidden() { - self.personView.alpha = 0.0 - self.personView.isHidden = true - self.dateView.alpha = 0.0 - self.dateView.isHidden = true - self.checkView.alpha = 0.0 - self.checkView.isHidden = true - } - - private func setupNotificationCenter() { - NotificationCenter.default.addObserver(self, - selector: #selector(keyboardWillShow), - name: UIResponder.keyboardWillShowNotification, - object: nil) - NotificationCenter.default.addObserver(self, - selector: #selector(keyboardWillHide), - name: UIResponder.keyboardWillHideNotification, - object: nil) - } + // MARK: - network - // MARK: - selector - - @objc - private func keyboardWillShow(notification: NSNotification) { - if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { - UIView.animate(withDuration: 0.2, animations: { - self.nextButton.transform = CGAffineTransform(translationX: 0, y: -keyboardSize.height + 30) - }) + private func requestCreateRoom(room: CreatedRoomRequestDTO) { + Task { + do { + let roomId = try await self.roomParticipationRepository.dispatchCreateRoom(room: room) + self.pushDetailWaitViewController(roomId: roomId) + } catch NetworkError.serverError { + print("server Error") + } catch NetworkError.encodingError { + print("encoding Error") + } catch NetworkError.clientError(let message) { + print("client Error: \(String(describing: message))") + } } } - - @objc - private func keyboardWillHide(notification: NSNotification) { - UIView.animate(withDuration: 0.2, animations: { - self.nextButton.transform = .identity - }) +} + +extension CreateRoomViewController: CreateRoomViewDelegate { + func didTapCloseButton() { + self.dismiss(animated: true) + } + + func requestCreateRoom(roomInfo: RoomListItem, colorIndex: Int) { + let room = CreatedRoomInfoRequestDTO(title: roomInfo.title, + capacity: roomInfo.capacity, + startDate: roomInfo.startDate, + endDate: roomInfo.endDate) + let member = MemberInfoRequestDTO(colorIndex: colorIndex) + self.requestCreateRoom(room: CreatedRoomRequestDTO(room: room, member: member)) } } diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift index eafd46644..b8aef22fd 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift @@ -45,7 +45,7 @@ final class CharacterCollectionView: UIView { // MARK: - property - var characterIndex: Int = 0 + private(set) var characterIndex: Int = 0 // MARK: - init diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift similarity index 82% rename from Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomView.swift rename to Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift index 4302f4ec4..eace7ab0b 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CheckRoomInfoView.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -final class CheckRoomView: UIView { +final class CheckRoomInfoView: UIView { // MARK: - ui component @@ -39,17 +39,17 @@ final class CheckRoomView: UIView { // MARK: - property - var dateRange = "" { + private var dateRange = "" { willSet { self.dateLabel.text = newValue } } - var name: String = "" { + private(set) var title: String = "" { willSet { self.nameLabel.text = newValue } } - var participants: Int = 0 { + private(set) var capacity: Int = 0 { willSet { self.personLabel.text = "\(newValue.description)" + TextLiteral.per } @@ -59,7 +59,7 @@ final class CheckRoomView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setLayout() + self.setupLayout() } @available(*, unavailable) @@ -69,7 +69,7 @@ final class CheckRoomView: UIView { // MARK: - func - private func setLayout() { + private func setupLayout() { self.addSubview(self.nameLabel) self.nameLabel.snp.makeConstraints { $0.top.equalToSuperview().inset(40) @@ -95,4 +95,16 @@ final class CheckRoomView: UIView { $0.width.height.equalTo(60) } } + + func updateRoomTitle(title: String) { + self.title = title + } + + func updateRoomCapacity(capacity: Int) { + self.capacity = capacity + } + + func updateRoomDateRange(range: String) { + self.dateRange = range + } } diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputPersonView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift similarity index 93% rename from Manito/Manito/Screens/CreateRoom/UIComponent/InputPersonView.swift rename to Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift index 9a36f5eec..ec134122f 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputPersonView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputCapacityView.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -final class InputPersonView: UIView { +final class InputCapacityView: UIView { // MARK: - ui component @@ -37,7 +37,7 @@ final class InputPersonView: UIView { label.font = .font(.regular, ofSize: 24) return label }() - lazy var personSlider: UISlider = { + private lazy var personSlider: UISlider = { let slider = UISlider() slider.value = 1 slider.minimumValue = 4 @@ -64,7 +64,7 @@ final class InputPersonView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setLayout() + self.setupLayout() } @available(*, unavailable) @@ -74,7 +74,7 @@ final class InputPersonView: UIView { // MARK: - func - private func setLayout() { + private func setupLayout() { self.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { $0.top.leading.trailing.equalToSuperview() @@ -120,6 +120,11 @@ final class InputPersonView: UIView { } } + func sliderValue() -> Int { + let value = Int(self.personSlider.value) + return value + } + // MARK: - selector @objc diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputDateView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputDateView.swift index 86abde8ec..35073c558 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputDateView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputDateView.swift @@ -32,7 +32,7 @@ final class InputDateView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setLayout() + self.setupLayout() } @available(*, unavailable) @@ -42,7 +42,7 @@ final class InputDateView: UIView { // MARK: - func - private func setLayout() { + private func setupLayout() { self.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { $0.top.leading.trailing.equalToSuperview() diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputNameView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift similarity index 92% rename from Manito/Manito/Screens/CreateRoom/UIComponent/InputNameView.swift rename to Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift index d3a998d70..35cef99d3 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputNameView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift @@ -9,11 +9,11 @@ import UIKit import SnapKit -final class InputNameView: UIView { +final class InputTitleView: UIView { // MARK: - ui component - lazy var roomsNameTextField: UITextField = { + private lazy var roomsNameTextField: UITextField = { let textField = UITextField() let attributes = [ NSAttributedString.Key.font : UIFont.font(.regular, ofSize: 18) @@ -93,9 +93,14 @@ final class InputNameView: UIView { } } } + + func textFieldText() -> String { + guard let text = self.roomsNameTextField.text else { return "" } + return text + } } -extension InputNameView: UITextFieldDelegate { +extension InputTitleView: UITextFieldDelegate { func textFieldShouldReturn(_ textField: UITextField) -> Bool { textField.resignFirstResponder() } diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift new file mode 100644 index 000000000..c00f0108e --- /dev/null +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -0,0 +1,350 @@ +// +// CreateRoomView.swift +// Manito +// +// Created by 이성호 on 2023/08/02. +// + +import UIKit + +import SnapKit + +protocol CreateRoomViewDelegate: AnyObject { + func didTapCloseButton() + func requestCreateRoom(roomInfo: RoomListItem, colorIndex: Int) +} + +final class CreateRoomView: UIView { + + fileprivate enum CreateRoomStep { + case inputTitle, inputCapacity, inputDate, checkRoom, chooseCharacter + } + + // MARK: - ui component + + private let titleLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.createRoom + label.font = .font(.regular, ofSize: 34) + return label + }() + private let closeButton: UIButton = { + let button = UIButton(type: .system) + button.setImage(ImageLiterals.btnXmark, for: .normal) + button.tintColor = .grey001 + return button + }() + private let nextButton: MainButton = { + let button = MainButton() + button.title = TextLiteral.next + button.isDisabled = true + return button + }() + private let backButton: UIButton = { + let button = UIButton() + button.setImage(ImageLiterals.icBack, for: .normal) + button.setTitle(" " + TextLiteral.previous, for: .normal) + button.titleLabel?.font = .font(.regular, ofSize: 14) + button.tintColor = .white + button.isHidden = true + return button + }() + private let roomTitleView: InputTitleView = InputTitleView() + private let roomCapacityView: InputCapacityView = InputCapacityView() + private let roomDateView: InputDateView = InputDateView() + private let roomInfoView: CheckRoomInfoView = CheckRoomInfoView() + private let characterCollectionView: CharacterCollectionView = CharacterCollectionView() + + // MARK: - property + + private var roomInfo: RoomInfo? + private weak var delegate: CreateRoomViewDelegate? + private var roomStep: CreateRoomStep = .inputTitle { + willSet(step) { + self.manageStepView(step: step) + } + } + + // MARK: - init + + override init(frame: CGRect) { + super.init(frame: frame) + self.setupLayout() + self.setupAction() + self.setupNotificationCenter() + self.detectStartableStatus() + self.configureUI() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - func + + private func setupLayout() { + self.addSubview(self.titleLabel) + self.titleLabel.snp.makeConstraints { + $0.top.equalTo(self.safeAreaLayoutGuide).inset(66) + $0.leading.equalTo(self.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) + } + + self.addSubview(self.closeButton) + self.closeButton.snp.makeConstraints { + $0.top.equalTo(self.safeAreaLayoutGuide).inset(9) + $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + } + + self.addSubview(self.backButton) + self.backButton.snp.makeConstraints { + $0.top.equalTo(self.closeButton) + $0.leading.equalTo(self.safeAreaLayoutGuide) + $0.height.equalTo(44) + } + + self.addSubview(self.nextButton) + self.nextButton.snp.makeConstraints { + $0.leading.trailing.equalTo(self.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) + $0.bottom.equalTo(self.safeAreaLayoutGuide).inset(23) + $0.height.equalTo(60) + } + + self.addSubview(self.roomTitleView) + self.addSubview(self.roomCapacityView) + self.addSubview(self.roomDateView) + self.addSubview(self.roomInfoView) + self.addSubview(self.characterCollectionView) + + [self.roomTitleView, self.roomCapacityView, self.roomDateView, self.roomInfoView, self.characterCollectionView] + .forEach { + $0.snp.makeConstraints { + $0.top.equalTo(self.titleLabel.snp.bottom).offset(66) + $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.bottom.equalTo(self.nextButton.snp.top) + } + } + + self.bringSubviewToFront(self.nextButton) + } + + private func setupAction() { + let closeAction = UIAction { [weak self] _ in + self?.delegate?.didTapCloseButton() + } + self.closeButton.addAction(closeAction, for: .touchUpInside) + + let nextAction = UIAction { [weak self] _ in + guard let currentStep = self?.roomStep else { return } + guard let nextStep = self?.moveToNextStep(from: currentStep) else { return } + + self?.runActionAtStep(at: currentStep) + self?.roomStep = nextStep + } + self.nextButton.addAction(nextAction, for: .touchUpInside) + + let backAction = UIAction { [weak self] _ in + guard let currentStep = self?.roomStep else { return } + guard let previousStep = self?.moveToPreviousStep(from: currentStep) else { return } + self?.roomStep = previousStep + } + self.backButton.addAction(backAction, for: .touchUpInside) + } + + private func setupNotificationCenter() { + NotificationCenter.default.addObserver(self, + selector: #selector(keyboardWillShow), + name: UIResponder.keyboardWillShowNotification, + object: nil) + NotificationCenter.default.addObserver(self, + selector: #selector(keyboardWillHide), + name: UIResponder.keyboardWillHideNotification, + object: nil) + } + + private func moveToNextStep(from step: CreateRoomStep) -> CreateRoomStep { + return step.next() + } + + private func moveToPreviousStep(from step: CreateRoomStep) -> CreateRoomStep { + return step.previous() + } + + private func detectStartableStatus() { + self.roomTitleView.changeNextButtonEnableStatus = { [weak self] isEnabled in + self?.nextButton.isDisabled = !isEnabled + } + + self.roomDateView.calendarView.changeButtonState = { [weak self] isEnabled in + self?.nextButton.isDisabled = !isEnabled + } + } + + private func updateHiddenStepView(at step: CreateRoomStep) { + self.roomTitleView.isHidden = !(step == .inputTitle) + self.roomCapacityView.isHidden = !(step == .inputCapacity) + self.roomDateView.isHidden = !(step == .inputDate) + self.roomInfoView.isHidden = !(step == .checkRoom) + self.characterCollectionView.isHidden = !(step == .chooseCharacter) + } + + private func updateHiddenBackButton(at step: CreateRoomStep) { + self.backButton.isHidden = !(step == .inputCapacity || step == .inputDate || step == .checkRoom || step == .chooseCharacter) + } + + private func updateRoomTitleViewAnimation() { + self.roomCapacityView.fadeOut() + self.roomTitleView.fadeIn() + } + + private func updateRoomCapacityViewAnimation() { + self.roomTitleView.fadeOut() + self.roomCapacityView.fadeIn() + self.roomDateView.fadeOut() + } + + private func updateRoomDateViewAnimation() { + self.roomCapacityView.fadeOut() + self.roomDateView.fadeIn() + self.roomInfoView.fadeOut() + } + + private func updateRoomDataCheckViewAnimation() { + self.roomDateView.fadeOut() + self.roomInfoView.fadeIn() + self.characterCollectionView.fadeOut() + } + + private func updateChooseCharacterViewAnimation() { + self.roomInfoView.fadeOut() + self.characterCollectionView.fadeIn() + } + + private func runActionAtStep(at step: CreateRoomStep) { + switch step { + case .inputTitle: + self.updateRoomTitle() + self.endEditing(true) + case .inputCapacity: + self.updateRoomCapacity() + self.disabledNextButton() + case .inputDate: + self.updateRoomDate() + case .checkRoom: + break + case .chooseCharacter: + let colorIndex = self.characterCollectionView.characterIndex + let roomInfo = RoomListItem(id: 0, + title: self.roomInfoView.title, + state: "", + participatingCount: 0, + capacity: self.roomInfoView.capacity, + startDate: "20\(self.roomDateView.calendarView.getTempStartDate())", + endDate: "20\(self.roomDateView.calendarView.getTempEndDate())") + self.delegate?.requestCreateRoom(roomInfo: roomInfo, + colorIndex: colorIndex) + } + } + + private func updateRoomTitle() { + let title = self.roomTitleView.textFieldText() + self.roomInfoView.updateRoomTitle(title: title) + } + + private func updateRoomCapacity() { + let capacity = self.roomCapacityView.sliderValue() + self.roomInfoView.updateRoomCapacity(capacity: capacity) + } + + private func disabledNextButton() { + self.nextButton.isDisabled = true + } + + private func updateRoomDate() { + let startDate = self.roomDateView.calendarView.getTempStartDate() + let endDate = self.roomDateView.calendarView.getTempEndDate() + let roomDateRange = "\(startDate) ~ \(endDate)" + self.roomInfoView.updateRoomDateRange(range: roomDateRange) + } + + private func configureUI() { + self.roomStep = .inputTitle + } + + func configureDelegate(_ delegate: CreateRoomViewDelegate) { + self.delegate = delegate + } + + func endEditingView() { + if !self.nextButton.isTouchInside { + self.endEditing(true) + } + } + + private func manageStepView(step: CreateRoomStep) { + self.updateHiddenStepView(at: step) + self.updateHiddenBackButton(at: step) + switch step { + case .inputTitle: + self.updateRoomTitleViewAnimation() + case .inputCapacity: + self.updateRoomCapacityViewAnimation() + case .inputDate: + self.updateRoomDateViewAnimation() + case .checkRoom: + self.updateRoomDataCheckViewAnimation() + case .chooseCharacter: + self.updateChooseCharacterViewAnimation() + } + } + + // MARK: - selector + + @objc + private func keyboardWillShow(notification: NSNotification) { + if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { + UIView.animate(withDuration: 0.2, animations: { + self.nextButton.transform = CGAffineTransform(translationX: 0, y: -keyboardSize.height + 30) + }) + } + } + + @objc + private func keyboardWillHide(notification: NSNotification) { + UIView.animate(withDuration: 0.2, animations: { + self.nextButton.transform = .identity + }) + } +} + +private extension CreateRoomView.CreateRoomStep { + func next() -> Self { + switch self { + case .inputTitle: + return .inputCapacity + case .inputCapacity: + return .inputDate + case .inputDate: + return .checkRoom + case .checkRoom: + return .chooseCharacter + case .chooseCharacter: + return .chooseCharacter + } + } + + func previous() -> Self { + switch self { + case .inputTitle: + return .inputTitle + case .inputCapacity: + return .inputTitle + case .inputDate: + return .inputCapacity + case .checkRoom: + return .inputDate + case .chooseCharacter: + return .checkRoom + } + } +} diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index b77901843..589c3b8c1 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -13,8 +13,7 @@ final class DetailingViewController: BaseViewController { // MARK: - property - private let detailIngService: DetailIngAPI = DetailIngAPI(apiService: APIService()) - private let detailDoneService: DetailDoneAPI = DetailDoneAPI(apiService: APIService()) + private let detailRoomRepository: DetailRoomRepository = DetailRoomRepositoryImpl() private let roomId: String private var missionId: String = "" @@ -118,7 +117,7 @@ final class DetailingViewController: BaseViewController { self.fetchRoomInformation() { [weak self] result in switch result { case .success(let roomInformation): - self?.detailingView.updateDetailingView(room: roomInformation) + self?.detailingView.updateDetailingView(room: roomInformation.toRoomInfo()) case .failure: print("error") } @@ -127,13 +126,11 @@ final class DetailingViewController: BaseViewController { // MARK: - network - private func fetchRoomInformation(completionHandler: @escaping ((Result) -> Void)) { + private func fetchRoomInformation(completionHandler: @escaping ((Result) -> Void)) { Task { do { - let data = try await detailIngService.requestStartingRoomInfo(roomId: roomId) - if let info = data { - completionHandler(.success(info)) - } + let data = try await detailRoomRepository.fetchRoomInfo(roomId: roomId) + completionHandler(.success(data)) } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { @@ -147,22 +144,20 @@ final class DetailingViewController: BaseViewController { func pushNavigationAfterRequestRoomInfo() { Task { do { - let data = try await detailIngService.requestStartingRoomInfo(roomId: self.roomId) - if let info = data { - guard let mission = info.mission?.content, - let missionId = info.mission?.id - else { return } - // FIXME: - RoomType를 View에서 바로 빼오지 않고 다른 방식으로 구현해야 합니다. - let service = LetterService(api: LetterAPI(apiService: APIService())) - let viewModel = LetterViewModel(service: service, - roomId: self.roomId, - mission: mission, - missionId: missionId.description, - roomState: self.detailingView.roomType.rawValue, - messageType: .received) - let letterViewController = LetterViewController(viewModel: viewModel) - self.navigationController?.pushViewController(letterViewController, animated: true) - } + let data = try await self.detailRoomRepository.fetchRoomInfo(roomId: self.roomId) + guard let mission = data.mission?.content, + let missionId = data.mission?.id + else { return } + // FIXME: - RoomType를 View에서 바로 빼오지 않고 다른 방식으로 구현해야 합니다. + let service = LetterService(repository: LetterRepositoryImpl()) + let viewModel = LetterViewModel(service: service, + roomId: self.roomId, + mission: mission, + missionId: missionId.description, + roomState: self.detailingView.roomType.rawValue, + messageType: .received) + let letterViewController = LetterViewController(viewModel: viewModel) + self.navigationController?.pushViewController(letterViewController, animated: true) } } } @@ -170,7 +165,7 @@ final class DetailingViewController: BaseViewController { private func requestExitRoom(completionHandler: @escaping ((Result) -> Void)) { Task { do { - let statusCode = try await detailDoneService.requestExitRoom(roomId: roomId) + let statusCode = try await self.detailRoomRepository.deleteLeaveRoom(roomId: roomId) switch statusCode { case 200..<300: completionHandler(.success(())) default: completionHandler(.failure(.unknownError)) @@ -189,7 +184,7 @@ final class DetailingViewController: BaseViewController { private func requestDeleteRoom(completionHandler: @escaping ((Result) -> Void)) { Task { do { - let statusCode = try await detailDoneService.requestDeleteRoom(roomId: roomId) + let statusCode = try await self.detailRoomRepository.deleteRoom(roomId: roomId) switch statusCode { case 200..<300: completionHandler(.success(())) default: completionHandler(.failure(.unknownError)) @@ -207,10 +202,8 @@ final class DetailingViewController: BaseViewController { private func requestResetMission(roomId: String, completionHandler: @escaping ((Result) -> Void)) { Task { do { - let data = try await self.detailIngService.fetchResetMission(roomId: roomId) - if let _ = data { - completionHandler(.success(())) - } + let data = try await self.detailRoomRepository.fetchResetMission(roomId: roomId) + completionHandler(.success(())) } catch NetworkError.serverError { completionHandler(.failure(.serverError)) } catch NetworkError.clientError(let message) { @@ -248,7 +241,7 @@ extension DetailingViewController: DetailingDelegate { mission: String, missionId: String) { // FIXME: - RoomType를 View에서 바로 빼오지 않고 다른 방식으로 구현해야 합니다. - let service = LetterService(api: LetterAPI(apiService: APIService())) + let service = LetterService(repository: LetterRepositoryImpl()) let viewModel = LetterViewModel(service: service, roomId: self.roomId, mission: mission, diff --git a/Manito/Manito/Screens/Detail-Ing/FriendListViewController.swift b/Manito/Manito/Screens/Detail-Ing/FriendListViewController.swift index 872e65fdd..15738a2e7 100644 --- a/Manito/Manito/Screens/Detail-Ing/FriendListViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/FriendListViewController.swift @@ -8,12 +8,12 @@ import UIKit final class FriendListViewController: BaseViewController { - var friendArray: [Member] = [] { + var friendArray: [MemberInfoDTO] = [] { didSet { friendListCollectionView.reloadData() } } - var detailIngService: DetailIngAPI = DetailIngAPI(apiService: APIService()) + var detailRoomRepository: DetailRoomRepository = DetailRoomRepositoryImpl() var roomIndex: Int = 0 @@ -51,10 +51,8 @@ final class FriendListViewController: BaseViewController { private func requestWithFriends() { Task { do { - let data = try await detailIngService.requestWithFriends(roomId: "\(roomIndex)") - if let list = data { - friendArray = list.members ?? [] - } + let data = try await self.detailRoomRepository.fetchWithFriend(roomId: "\(roomIndex)") + friendArray = data.members ?? [] } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { diff --git a/Manito/Manito/Screens/Detail-Ing/MemoryViewController.swift b/Manito/Manito/Screens/Detail-Ing/MemoryViewController.swift index 6692e05d8..c5d6ea7e3 100644 --- a/Manito/Manito/Screens/Detail-Ing/MemoryViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/MemoryViewController.swift @@ -88,14 +88,14 @@ final class MemoryViewController: BaseViewController { return view }() - private var detailDoneService: DetailDoneAPI = DetailDoneAPI(apiService: APIService()) + private var detailRoomRepository: DetailRoomRepository = DetailRoomRepositoryImpl() private var memoryType: MemoryType = .manittee { willSet { setupData(with: newValue) self.memoryCollectionView.reloadData() } } - private var memory: Memory? + private var memory: MemoryDTO? private var roomId: String // MARK: - init @@ -244,12 +244,10 @@ final class MemoryViewController: BaseViewController { private func requestMemory(roomId: String) { Task { do { - let data = try await detailDoneService.requestMemory(roomId: roomId) - if let memory = data { - self.memory = memory - self.setupData(with: .manittee) - self.memoryCollectionView.reloadData() - } + let data = try await self.detailRoomRepository.fetchMemory(roomId: roomId) + self.memory = data + self.setupData(with: .manittee) + self.memoryCollectionView.reloadData() } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { diff --git a/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift index 9f519ad43..d3673971a 100644 --- a/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift @@ -19,7 +19,7 @@ final class MissionEditViewController: BaseViewController { let mission: String let roomId: String - private let missionEditService: MissionEditAPI = MissionEditAPI(apiService: APIService()) + private let detailRoomRepository: DetailRoomRepository = DetailRoomRepositoryImpl() private weak var delegate: MissionEditDelegate? // MARK: - component @@ -178,13 +178,9 @@ final class MissionEditViewController: BaseViewController { private func patchEditMission(mission: String, completionHandler: @escaping ((Result) -> Void)) { Task { do { - let data = try await self.missionEditService.patchEditMission(roomId: self.roomId, - body: MissionDTO(mission: mission)) - if let _ = data { - completionHandler(.success(())) - } else { - completionHandler(.failure(.unknownError)) - } + let data = try await self.detailRoomRepository.patchEditMission(roomId: roomId, + mission: EditedMissionRequestDTO(mission: mission)) + completionHandler(.success(())) } catch NetworkError.serverError { completionHandler(.failure(.serverError)) } catch NetworkError.clientError(let message) { diff --git a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift index 743bec006..39866eae5 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift @@ -417,23 +417,15 @@ final class DetailingView: UIView { navigationItem?.rightBarButtonItem = exitButton } - func updateDetailingView(room: Room) { - guard let state = room.roomInformation?.state, - let title = room.roomInformation?.title, - let startDate = room.roomInformation?.startDate, - let endDate = room.roomInformation?.endDate, - let manittee = room.manittee?.nickname, - let admin = room.admin, - let badgeCount = room.messages?.count - else { return } - self.roomType = RoomType.init(rawValue: state) ?? .PROCESSING + func updateDetailingView(room: RoomInfo) { + self.roomType = RoomType.init(rawValue: room.roomInformation.state) ?? .PROCESSING self.missionId = room.mission?.id?.description ?? "" DispatchQueue.main.async { - self.titleLabel.text = title - self.periodLabel.text = "\(startDate.subStringToDate()) ~ \(endDate.subStringToDate())" - self.manitteeAnimationLabel.text = manittee - self.setupBadge(count: badgeCount) - self.updateMissionEditButton(admin, type: self.roomType) + self.titleLabel.text = room.roomInformation.title + self.periodLabel.text = "\(room.roomInformation.startDate.subStringToDate()) ~ \(room.roomInformation.endDate.subStringToDate())" + self.manitteeAnimationLabel.text = room.manittee.nickname + self.setupBadge(count: room.messages?.count ?? 0) + self.updateMissionEditButton(room.admin, type: self.roomType) if self.roomType == .PROCESSING { self.setupProcessingUI() guard let missionContent = room.mission?.content, @@ -442,13 +434,13 @@ final class DetailingView: UIView { else { return } self.missionContentsLabel.attributedText = NSAttributedString(string: missionContent) self.manittoNickname = manittoNickname - if !didView && !admin { - self.delegate?.didNotShowManitteeView(manitteeName: manittee) + if !didView && !room.admin { + self.delegate?.didNotShowManitteeView(manitteeName: room.manittee.nickname ?? "") } - self.setupManittoOpenButton(date: endDate) + self.setupManittoOpenButton(date: room.roomInformation.endDate) } else { self.setupPostUI() - self.setupExitButton(admin: admin) + self.setupExitButton(admin: room.admin) } } } diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index b9ed537cc..10b5755f8 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -18,13 +18,13 @@ final class DetailEditViewController: BaseViewController { // MARK: - property private let editMode: DetailEditView.EditMode - private let detailWaitService: DetailWaitAPI = DetailWaitAPI(apiService: APIService()) - private let room: Room + private let detailRoomRepository: DetailRoomRepository = DetailRoomRepositoryImpl() + private let room: RoomInfo weak var detailWaitDelegate: DetailWaitViewControllerDelegate? // MARK: - init - init(editMode: DetailEditView.EditMode, room: Room) { + init(editMode: DetailEditView.EditMode, room: RoomInfo) { self.detailEditView = DetailEditView(editMode: editMode) self.editMode = editMode self.room = room @@ -71,13 +71,13 @@ final class DetailEditViewController: BaseViewController { } private func setupCalendarDateRange() { - guard let startDate = self.room.roomInformation?.startDate, - let endDate = self.room.roomInformation?.endDate else { return } + let startDate = self.room.roomInformation.startDate + let endDate = self.room.roomInformation.endDate self.detailEditView.setupDateRange(from: startDate, to: endDate) } private func setupMemberSliderValue() { - guard let capacity = self.room.roomInformation?.capacity else { return } + let capacity = self.room.roomInformation.capacity self.detailEditView.setupSliderValue(capacity) } @@ -102,12 +102,12 @@ final class DetailEditViewController: BaseViewController { // MARK: - network - private func putRoomInfo(roomDto: RoomDTO, completionHandler: @escaping ((Result) -> Void)) { - guard let roomIndex = self.room.roomInformation?.id else { return } + private func putRoomInfo(roomDTO: CreatedRoomInfoRequestDTO, completionHandler: @escaping ((Result) -> Void)) { + let roomIndex = self.room.roomInformation.id Task { do { - let status = try await self.detailWaitService.editRoomInfo(roomId: roomIndex.description, - roomInfo: roomDto) + let status = try await self.detailRoomRepository.putRoomInfo(roomId: roomIndex.description, + roomInfo: roomDTO) switch status { case 200..<300: completionHandler(.success(())) @@ -135,14 +135,14 @@ extension DetailEditViewController: DetailEditDelegate { } func changeButtonDidTap(capacity: Int, from startDate: String, to endDate: String) { - guard let roomTitle = self.room.roomInformation?.title, - let currentUserCount = self.room.participants?.count else { return } - let dto = RoomDTO(title: roomTitle, - capacity: capacity, - startDate: "20\(startDate)", - endDate: "20\(endDate)") + let roomTitle = self.room.roomInformation.title + let currentUserCount = self.room.participants.count + let dto = CreatedRoomInfoRequestDTO(title: roomTitle, + capacity: capacity, + startDate: "20\(startDate)", + endDate: "20\(endDate)") if currentUserCount <= capacity { - self.putRoomInfo(roomDto: dto) { [weak self] result in + self.putRoomInfo(roomDTO: dto) { [weak self] result in switch result { case .success: self?.detailWaitDelegate?.didTappedChangeButton() diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index d95b6e108..588a1c4ba 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -176,7 +176,7 @@ final class DetailWaitViewController: BaseViewController { .store(in: &self.cancellable) } - private func showDetailEditViewController(roomInformation: Room, mode: DetailEditView.EditMode) { + private func showDetailEditViewController(roomInformation: RoomInfo, mode: DetailEditView.EditMode) { let viewController = DetailEditViewController(editMode: mode, room: roomInformation) viewController.detailWaitDelegate = self self.present(viewController, animated: true) @@ -215,19 +215,21 @@ final class DetailWaitViewController: BaseViewController { } private func showStartDatePassedAlert(isPassedStartDate: Bool, isAdmin: Bool) { - if isAdmin { - if isPassedStartDate { - self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, - message: TextLiteral.detailWaitViewControllerPastAdminAlertMessage, - okAction: { [weak self] _ in - guard let roomInformation = self?.detailWaitViewModel.makeRoomInformation() else { return } - self?.showDetailEditViewController(roomInformation: roomInformation, mode: .date) - }) + guard isPassedStartDate else { return } + self.makeAlert( + title: isAdmin + ? TextLiteral.detailWaitViewControllerPastAlertTitle + : TextLiteral.detailWaitViewControllerPastAlertTitle, + message: isAdmin + ? TextLiteral.detailWaitViewControllerPastAdminAlertMessage + : TextLiteral.detailWaitViewControllerPastAlertMessage, + okAction: isAdmin + ? { [weak self] _ in + guard let roomInformaion = self?.detailWaitViewModel.makeRoomInformation() else { return } + self?.showDetailEditViewController(roomInformation: roomInformaion, mode: .date) } - } else { - self.makeAlert(title: TextLiteral.detailWaitViewControllerPastAlertTitle, - message: TextLiteral.detailWaitViewControllerPastAlertMessage) - } + : nil + ) } // MARK: - selector @@ -235,17 +237,19 @@ final class DetailWaitViewController: BaseViewController { @objc private func didTapEnterButton() { let roomInfo = self.detailWaitViewModel.makeRoomInformation() - guard let title = roomInfo.roomInformation?.title, - let capacity = roomInfo.roomInformation?.capacity, - let startDate = roomInfo.roomInformation?.startDate, - let endDate = roomInfo.roomInformation?.endDate, - let invitationCode = roomInfo.invitation?.code - else { return } - let roomDto = RoomDTO(title: title, - capacity: capacity, - startDate: startDate, - endDate: endDate) - let viewController = InvitedCodeViewController(roomInfo: roomDto, + let title = roomInfo.roomInformation.title + let capacity = roomInfo.roomInformation.capacity + let startDate = roomInfo.roomInformation.startDate + let endDate = roomInfo.roomInformation.endDate + guard let invitationCode = roomInfo.invitation.code else { return } + let roomDTO = RoomListItemDTO(id: nil, + title: title, + state: nil, + participatingCount: nil, + capacity: capacity, + startDate: startDate, + endDate: endDate) + let viewController = InvitedCodeViewController(roomInfo: roomDTO, code: invitationCode) viewController.modalPresentationStyle = .overCurrentContext viewController.modalTransitionStyle = .crossDissolve diff --git a/Manito/Manito/Screens/Detail-Wait/Services/DetailWaitService.swift b/Manito/Manito/Screens/Detail-Wait/Services/DetailWaitService.swift index a6e38fd2e..337c84ef7 100644 --- a/Manito/Manito/Screens/Detail-Wait/Services/DetailWaitService.swift +++ b/Manito/Manito/Screens/Detail-Wait/Services/DetailWaitService.swift @@ -8,28 +8,24 @@ import Foundation protocol DetailWaitServicable { - func fetchWaitingRoomInfo(roomId: String) async throws -> Room - func patchStartManitto(roomId: String) async throws -> Manittee + func fetchWaitingRoomInfo(roomId: String) async throws -> RoomInfoDTO + func patchStartManitto(roomId: String) async throws -> UserInfoDTO func deleteRoom(roomId: String) async throws -> Int func deleteLeaveRoom(roomId: String) async throws -> Int } final class DetailWaitService: DetailWaitServicable { - private let api: DetailWaitProtocol + private let repository: DetailRoomRepository - init(api: DetailWaitProtocol) { - self.api = api + init(repository: DetailRoomRepository) { + self.repository = repository } - func fetchWaitingRoomInfo(roomId: String) async throws -> Room { + func fetchWaitingRoomInfo(roomId: String) async throws -> RoomInfoDTO { do { - let roomData = try await self.api.getWaitingRoomInfo(roomId: roomId) - if let roomData { - return roomData - } else { - throw NetworkError.serverError - } + let roomData = try await self.repository.fetchRoomInfo(roomId: roomId) + return roomData } catch NetworkError.serverError { throw NetworkError.serverError } catch NetworkError.clientError(let message) { @@ -37,14 +33,10 @@ final class DetailWaitService: DetailWaitServicable { } } - func patchStartManitto(roomId: String) async throws -> Manittee { + func patchStartManitto(roomId: String) async throws -> UserInfoDTO { do { - let manitteeData = try await self.api.startManitto(roomId: roomId) - if let manitteeData { - return manitteeData - } else { - throw NetworkError.serverError - } + let manitteeData = try await self.repository.patchStartManitto(roomId: roomId) + return manitteeData } catch NetworkError.serverError { throw NetworkError.serverError } catch NetworkError.clientError(let message) { @@ -54,7 +46,7 @@ final class DetailWaitService: DetailWaitServicable { func deleteRoom(roomId: String) async throws -> Int { do { - let statusCode = try await self.api.deleteRoom(roomId: roomId) + let statusCode = try await self.repository.deleteRoom(roomId: roomId) return statusCode } catch NetworkError.serverError { throw NetworkError.serverError @@ -65,7 +57,7 @@ final class DetailWaitService: DetailWaitServicable { func deleteLeaveRoom(roomId: String) async throws -> Int { do { - let statusCode = try await self.api.deleteLeaveRoom(roomId: roomId) + let statusCode = try await self.repository.deleteLeaveRoom(roomId: roomId) return statusCode } catch NetworkError.serverError { throw NetworkError.serverError diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 470094c00..53a1b2f41 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -82,7 +82,7 @@ final class DetailWaitView: UIView { // MARK: - property - private var userArray: [User] = [] { + private var userArray: [UserInfoDTO] = [] { didSet { DispatchQueue.main.async { self.listTableView.reloadData() @@ -224,19 +224,13 @@ final class DetailWaitView: UIView { navigationItem?.rightBarButtonItem = moreButton } - func updateDetailWaitView(room: Room) { - guard let title = room.roomInformation?.title, - let state = room.roomInformation?.state, - let dateRange = room.roomInformation?.dateRangeText, - let users = room.participants?.members, - let isStart = room.roomInformation?.isStart, - let admin = room.admin - else { return } - - self.userArray = users + func updateDetailWaitView(room: RoomInfo) { + self.userArray = room.participants.members - self.setupTitleViewData(title: title, state: state, dateRange: dateRange) - self.setupRelatedViews(of: admin, isStart) + self.setupTitleViewData(title: room.roomInformation.title, + state: room.roomInformation.state, + dateRange: room.roomInformation.dateRangeText) + self.setupRelatedViews(of: room.admin, room.roomInformation.isStart) self.configureStartButton(room.canStart) self.configureUserCountLabel(userCount: room.userCount) diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index da8002619..7f1f7c75e 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -10,7 +10,7 @@ import Foundation final class DetailWaitViewModel { - typealias EditRoomInformation = (roomInformation: Room, mode: DetailEditView.EditMode) + typealias EditRoomInformation = (roomInformation: RoomInfo, mode: DetailEditView.EditMode) typealias PassedStartDateAndIsOwner = (passStartDate: Bool, isOwner: Bool) // MARK: - property @@ -19,7 +19,7 @@ final class DetailWaitViewModel { private let detailWaitService: DetailWaitServicable private var cancellable = Set() - private let roomInformationSubject = CurrentValueSubject(Room.emptyRoom) + private let roomInformationSubject = CurrentValueSubject(RoomInfo.emptyRoom) private let manitteeNicknameSubject = PassthroughSubject() private let deleteRoomSubject = PassthroughSubject() private let leaveRoomSubject = PassthroughSubject() @@ -36,7 +36,7 @@ final class DetailWaitViewModel { } struct Output { - let roomInformation: CurrentValueSubject + let roomInformation: CurrentValueSubject let code: AnyPublisher let manitteeNickname: PassthroughSubject let editRoomInformation: AnyPublisher @@ -69,7 +69,7 @@ final class DetailWaitViewModel { let editRoomInformationOutput = input.editMenuButtonDidTap .map { [weak self] _ -> EditRoomInformation in - guard let self else { return (Room.emptyRoom, .information) } + guard let self else { return (RoomInfo.emptyRoom, .information) } return self.makeEditRoomInformation() } .eraseToAnyPublisher() @@ -123,13 +123,13 @@ final class DetailWaitViewModel { // MARK: - func - func makeRoomInformation() -> Room { + func makeRoomInformation() -> RoomInfo { return self.roomInformationSubject.value } private func makeCode() -> String { let roomInformation = self.roomInformationSubject.value - guard let code = roomInformation.invitation?.code else { return "" } + guard let code = roomInformation.invitation.code else { return "" } return code } @@ -141,13 +141,11 @@ final class DetailWaitViewModel { private func makeIsAdmin() -> PassedStartDateAndIsOwner { let roomInformation = self.roomInformationSubject.value - guard let isAdmin = roomInformation.admin, - let isPassStartDate = roomInformation.roomInformation?.isStartDatePast else { return (false, false) } - return (isPassStartDate, isAdmin) + return (roomInformation.roomInformation.isStartDatePast, roomInformation.admin) } - func setRoomInformation(room: Room) { + func setRoomInformation(room: RoomInfo) { self.roomInformationSubject.send(room) } @@ -157,7 +155,7 @@ final class DetailWaitViewModel { Task { do { let room = try await self.detailWaitService.fetchWaitingRoomInfo(roomId: roomId) - self.roomInformationSubject.send(room) + self.roomInformationSubject.send(room.toRoomInfo()) } catch(let error) { guard let error = error as? NetworkError else { return } self.roomInformationSubject.send(completion: .failure(error)) diff --git a/Manito/Manito/Screens/Interaction/OpenManittoViewController.swift b/Manito/Manito/Screens/Interaction/OpenManittoViewController.swift index 2ac72a58c..152048b2e 100644 --- a/Manito/Manito/Screens/Interaction/OpenManittoViewController.swift +++ b/Manito/Manito/Screens/Interaction/OpenManittoViewController.swift @@ -17,8 +17,8 @@ final class OpenManittoViewController: BaseViewController { // MARK: - property - private let openManittoService: DetailIngAPI = DetailIngAPI(apiService: APIService()) - private var friendsList: FriendList = FriendList(count: 0, members: []) + private let detailRoomRepository: DetailRoomRepository = DetailRoomRepositoryImpl() + private var friendsList: FriendListDTO = FriendListDTO(count: 0, members: []) private let roomId: String private let manittoNickname: String @@ -78,14 +78,12 @@ final class OpenManittoViewController: BaseViewController { private func fetchFriendList(roomId: String, manittoNickname: String, - completionHandler: @escaping (Result<(FriendList, Int), NetworkError>) -> Void) { + completionHandler: @escaping (Result<(FriendListDTO, Int), NetworkError>) -> Void) { Task { do { - let data = try await self.openManittoService.requestWithFriends(roomId: roomId) - if let list = data { - let manittoIndex = list.members?.firstIndex(where: { $0.nickname == manittoNickname }).map { Int($0) } ?? 0 - completionHandler(.success((list, manittoIndex))) - } + let data = try await self.detailRoomRepository.fetchWithFriend(roomId: roomId) + let manittoIndex = data.members?.firstIndex(where: { $0.nickname == manittoNickname }).map { Int($0) } ?? 0 + completionHandler(.success((data, manittoIndex))) } catch NetworkError.serverError { completionHandler(.failure(.serverError)) } catch NetworkError.encodingError { diff --git a/Manito/Manito/Screens/Interaction/View/OpenManittoView.swift b/Manito/Manito/Screens/Interaction/View/OpenManittoView.swift index b5190faf0..f4714eb8c 100644 --- a/Manito/Manito/Screens/Interaction/View/OpenManittoView.swift +++ b/Manito/Manito/Screens/Interaction/View/OpenManittoView.swift @@ -98,7 +98,7 @@ final class OpenManittoView: UIView { } } - private func animateManittoCollectionView(with friendList: FriendList, + private func animateManittoCollectionView(with friendList: FriendListDTO, _ manittoIndex: Int, _ manittoNickname: String) { let timeInterval: Double = 0.3 @@ -115,7 +115,7 @@ final class OpenManittoView: UIView { }) } - private func performRandomShuffleAnimation(with timeInterval: TimeInterval, _ friendList: FriendList) { + private func performRandomShuffleAnimation(with timeInterval: TimeInterval, _ friendList: FriendListDTO) { guard let count = friendList.count else { return } var countNumber: Int = 0 @@ -141,7 +141,7 @@ final class OpenManittoView: UIView { }) } - func setupManittoAnimation(friendList: FriendList, manittoIndex: Int, manittoNickname: String) { + func setupManittoAnimation(friendList: FriendListDTO, manittoIndex: Int, manittoNickname: String) { self.animateManittoCollectionView(with: friendList, manittoIndex, manittoNickname) self.manittoCollectionView.reloadData() } diff --git a/Manito/Manito/Screens/InvitedCode/InvitedCodeViewController.swift b/Manito/Manito/Screens/InvitedCode/InvitedCodeViewController.swift index 1bcc2d2ca..256368dd7 100644 --- a/Manito/Manito/Screens/InvitedCode/InvitedCodeViewController.swift +++ b/Manito/Manito/Screens/InvitedCode/InvitedCodeViewController.swift @@ -11,10 +11,10 @@ import SnapKit class InvitedCodeViewController: BaseViewController { - var roomInfo: RoomDTO + var roomInfo: RoomListItemDTO var code: String - init(roomInfo: RoomDTO, code: String){ + init(roomInfo: RoomListItemDTO, code: String){ self.roomInfo = roomInfo self.code = code super.init() @@ -48,14 +48,14 @@ class InvitedCodeViewController: BaseViewController { private lazy var roomDateLabel: UILabel = { let label = UILabel() label.font = .font(.regular, ofSize: 18) - label.text = "\(roomInfo.startDate) ~ \(roomInfo.endDate)" + label.text = "\(roomInfo.startDate ?? "") ~ \(roomInfo.endDate ?? "")" return label }() private let roomImage = UIImageView(image: ImageLiterals.imgCharacterBrown) private lazy var roomPersonLabel: UILabel = { let label = UILabel() label.font = .font(.regular, ofSize: 24) - label.text = "X \(roomInfo.capacity)인" + label.text = "X \(roomInfo.capacity ?? 0)인" return label }() private lazy var roomPersonView: UIView = { diff --git a/Manito/Manito/Screens/Letter/Services/LetterService.swift b/Manito/Manito/Screens/Letter/Services/LetterService.swift index e954fd482..242693d32 100644 --- a/Manito/Manito/Screens/Letter/Services/LetterService.swift +++ b/Manito/Manito/Screens/Letter/Services/LetterService.swift @@ -12,8 +12,8 @@ protocol LetterServicable { var manitteeId: String? { get set } var nickname: String { get set } - func fetchSendLetter(roomId: String) async throws -> [Message] - func fetchReceiveLetter(roomId: String) async throws -> [Message] + func fetchSendLetter(roomId: String) async throws -> [MessageListItemDTO] + func fetchReceiveLetter(roomId: String) async throws -> [MessageListItemDTO] func loadNickname() } @@ -24,26 +24,21 @@ final class LetterService: LetterServicable { @Published var manitteeId: String? @Published var nickname: String = "" - private let api: LetterProtocol + private let repository: LetterRepository // MARK: - init - init(api: LetterProtocol) { - self.api = api + init(repository: LetterRepository) { + self.repository = repository } // MARK: - Public - func - func fetchSendLetter(roomId: String) async throws -> [Message] { + func fetchSendLetter(roomId: String) async throws -> [MessageListItemDTO] { do { - let letterData = try await self.api.fetchSendLetter(roomId: roomId) - if let letterData { - self.setManitteeId(letterData.manittee?.id) - - return letterData.messages - } else { - throw NetworkError.serverError - } + let letterData = try await self.repository.fetchSendLetter(roomId: roomId) + self.setManitteeId(letterData.manittee?.id) + return letterData.messages } catch NetworkError.serverError { throw NetworkError.serverError } catch NetworkError.clientError(let message) { @@ -51,16 +46,11 @@ final class LetterService: LetterServicable { } } - func fetchReceiveLetter(roomId: String) async throws -> [Message] { + func fetchReceiveLetter(roomId: String) async throws -> [MessageListItemDTO] { do { - let letterData = try await self.api.fetchReceiveLetter(roomId: roomId) - if let letterData { - self.setManitteeId(letterData.manittee?.id) - - return letterData.messages - } else { - throw NetworkError.serverError - } + let letterData = try await self.repository.fetchReceiveLetter(roomId: roomId) + self.setManitteeId(letterData.manittee?.id) + return letterData.messages } catch NetworkError.serverError { throw NetworkError.serverError } catch NetworkError.clientError(let message) { diff --git a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift index fae832bab..b96cf44e9 100644 --- a/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift +++ b/Manito/Manito/Screens/Letter/ViewModels/LetterViewModel.swift @@ -32,7 +32,7 @@ final class LetterViewModel: ViewModelType { } struct Output { - let messages: AnyPublisher<[Message]?, Error> + let messages: AnyPublisher<[MessageListItem]?, Error> let index: AnyPublisher let messageDetails: AnyPublisher let reportDetails: AnyPublisher @@ -122,7 +122,7 @@ final class LetterViewModel: ViewModelType { return currentIndex } - private func fetchMessages(with type: MessageType) async throws -> [Message] { + private func fetchMessages(with type: MessageType) async throws -> [MessageListItem] { let roomId = self.messageDetails.roomId switch type { @@ -140,12 +140,12 @@ extension LetterViewModel { return type.rawValue } - private func fetchSendMessages(roomId: String, type: MessageType) async throws -> [Message] { + private func fetchSendMessages(roomId: String, type: MessageType) async throws -> [MessageListItem] { let messages = try await self.service.fetchSendLetter(roomId: roomId) return self.insertReportState(type, in: messages) } - private func fetchReceivedMessages(roomId: String, type: MessageType) async throws -> [Message] { + private func fetchReceivedMessages(roomId: String, type: MessageType) async throws -> [MessageListItem] { let messages = try await self.service.fetchReceiveLetter(roomId: roomId) return self.insertReportState(type, in: messages) } @@ -155,11 +155,7 @@ extension LetterViewModel { self.messageDetails.manitteeId = manitteeId } - private func insertReportState(_ type: MessageType, in messages: [Message]) -> [Message] { - return messages.map { item in - var item = item - item.canReport = (type == .received) - return item - } + private func insertReportState(_ type: MessageType, in messages: [MessageListItemDTO]) -> [MessageListItem] { + return messages.map { $0.toMessageListItem(canReport: (type == .received)) } } } diff --git a/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift b/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift index 24b6785b3..ddc993a37 100644 --- a/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift +++ b/Manito/Manito/Screens/Letter/Views/UIComponents/LetterHeaderView.swift @@ -33,8 +33,7 @@ final class LetterHeaderView: UICollectionReusableView { var segmentedControlTapPublisher: AnyPublisher { return self.segmentedControl.tapPublisher - .map { [weak self] in self?.segmentedControl.selectedSegmentIndex } - .map { $0! } + .compactMap { [weak self] in self?.segmentedControl.selectedSegmentIndex } .eraseToAnyPublisher() } diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/CreateLetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/CreateLetterViewController.swift index f31ac5a3e..b62618a35 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/CreateLetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/CreateLetterViewController.swift @@ -21,7 +21,7 @@ final class CreateLetterViewController: BaseViewController { // MARK: - property - private let letterSevice: LetterAPI = LetterAPI(apiService: APIService()) + private let letterRepository: LetterRepository = LetterRepositoryImpl() private let mission: String private let manitteeId: String private let roomId: String @@ -83,12 +83,15 @@ final class CreateLetterViewController: BaseViewController { // MARK: - network - private func dispatchLetter(with letterDTO: LetterDTO, + private func dispatchLetter(with letterDTO: LetterRequestDTO, _ jpegData: Data? = nil, completionHandler: @escaping ((Result) -> Void)) { Task { do { - let statusCode = try await self.letterSevice.dispatchLetter(roomId: self.roomId, image: jpegData, letter: letterDTO, missionId: self.missionId) + let statusCode = try await self.letterRepository.dispatchLetter(roomId: self.roomId, + image: jpegData, + letter: letterDTO, + missionId: self.missionId) switch statusCode { case 200..<300: completionHandler(.success(())) default: completionHandler(.failure(.unknownError)) @@ -120,7 +123,7 @@ extension CreateLetterViewController: CreateLetterViewDelegate { func sendLetterToManittee(with content: String?, _ image: UIImage?) { let jpegData = image?.jpegData(compressionQuality: 0.3) - let letterDTO = LetterDTO(manitteeId: self.manitteeId, messageContent: content) + let letterDTO = LetterRequestDTO(manitteeId: self.manitteeId, messageContent: content) self.createLetterView.sending = true self.dispatchLetter(with: letterDTO, jpegData) { [weak self] response in diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift index cea1ca2a4..29531d611 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/LetterViewController.swift @@ -18,8 +18,8 @@ final class LetterViewController: BaseViewController { private let letterView: LetterView = LetterView() - private var dataSource: UICollectionViewDiffableDataSource! - private var snapShot: NSDiffableDataSourceSnapshot! + private var dataSource: UICollectionViewDiffableDataSource! + private var snapShot: NSDiffableDataSourceSnapshot! // MARK: - property @@ -131,7 +131,7 @@ final class LetterViewController: BaseViewController { .store(in: &self.cancelBag) } - private func bindCell(_ cell: LetterCollectionViewCell, with item: Message) { + private func bindCell(_ cell: LetterCollectionViewCell, with item: MessageListItem) { cell.reportButtonTapPublisher .sink(receiveValue: { [weak self] content in if let content { @@ -176,7 +176,7 @@ extension LetterViewController { message: TextLiteral.letterViewControllerErrorDescription) } - private func handleMessageList(_ messages: [Message]?) { + private func handleMessageList(_ messages: [MessageListItem]?) { guard let messages else { self.showErrorAlert() return @@ -218,8 +218,8 @@ extension LetterViewController { self.configureSnapshot() } - private func letterCollectionViewDataSource() -> UICollectionViewDiffableDataSource { - let letterCellRegistration = UICollectionView.CellRegistration { + private func letterCollectionViewDataSource() -> UICollectionViewDiffableDataSource { + let letterCellRegistration = UICollectionView.CellRegistration { [weak self] cell, indexPath, item in cell.configureCell((mission: item.mission, date: item.date, @@ -263,12 +263,12 @@ extension LetterViewController { // MARK: - Snapshot extension LetterViewController { private func configureSnapshot() { - self.snapShot = NSDiffableDataSourceSnapshot() + self.snapShot = NSDiffableDataSourceSnapshot() self.snapShot.appendSections([.main]) self.dataSource.apply(self.snapShot, animatingDifferences: true) } - private func reloadMessageList(_ items: [Message]) { + private func reloadMessageList(_ items: [MessageListItem]) { let previousMessageData = self.snapShot.itemIdentifiers(inSection: .main) self.snapShot.deleteItems(previousMessageData) self.snapShot.appendItems(items, toSection: .main) diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift index 3cdf30407..d44a98e77 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterView.swift @@ -103,7 +103,7 @@ final class LetterView: UIView { self.setupGuideView(in: viewController) } - func updateEmptyArea(with items: [Message]) { + func updateEmptyArea(with items: [MessageListItem]) { let isEmpty = items.isEmpty self.emptyLabel.isHidden = !isEmpty } @@ -182,7 +182,7 @@ extension LetterView { // MARK: - UICollectionViewLayout extension LetterView { private func createLayout() -> UICollectionViewLayout { - let layout = UICollectionViewCompositionalLayout { index, environment -> NSCollectionLayoutSection? in + let layout = UICollectionViewCompositionalLayout { [weak self] index, environment -> NSCollectionLayoutSection? in let itemSize = NSCollectionLayoutSize( widthDimension: .fractionalWidth(1.0), heightDimension: .estimated(500) @@ -197,7 +197,7 @@ extension LetterView { let section = NSCollectionLayoutSection(group: group) section.contentInsets = ConstantSize.sectionContentInset - section.boundarySupplementaryItems = self.sectionHeader() + section.boundarySupplementaryItems = self?.sectionHeader() ?? [] section.interGroupSpacing = ConstantSize.groupInterItemSpacing return section diff --git a/Manito/Manito/Screens/Login/LoginViewController.swift b/Manito/Manito/Screens/Login/LoginViewController.swift index 07aa4c7f0..47ff9a97e 100644 --- a/Manito/Manito/Screens/Login/LoginViewController.swift +++ b/Manito/Manito/Screens/Login/LoginViewController.swift @@ -24,7 +24,7 @@ final class LoginViewController: BaseViewController { // MARK: - property - private let loginService: LoginAPI = LoginAPI(apiService: APIService()) + private let loginRepository: LoginRepository = LoginRepositoryImpl() // MARK: - init @@ -99,26 +99,25 @@ extension LoginViewController: ASAuthorizationControllerDelegate { Task { do { - let response = try await self.loginService.dispatchAppleLogin(dto: LoginDTO(identityToken: tokenToString, fcmToken: UserDefaultStorage.fcmToken)) - - if let data = response { - UserDefaultHandler.setIsLogin(isLogin: true) - UserDefaultHandler.setAccessToken(accessToken: data.accessToken ?? "") - UserDefaultHandler.setRefreshToken(refreshToken: data.refreshToken ?? "") + let loginDTO = LoginRequestDTO(identityToken: tokenToString, fcmToken: UserDefaultStorage.fcmToken) + let data = try await self.loginRepository.dispatchAppleLogin(login: loginDTO) - guard data.nickname != nil else { - self.navigationController?.pushViewController(CreateNickNameViewController(), animated: true) - return - } - - UserDefaultHandler.setNickname(nickname: data.nickname ?? "") - UserDefaultHandler.setIsSetFcmToken(isSetFcmToken: true) - let storyboard = UIStoryboard(name: "Main", bundle: nil) - let viewController = storyboard.instantiateViewController(withIdentifier: "MainNavigationController") - viewController.modalPresentationStyle = .fullScreen - viewController.modalTransitionStyle = .crossDissolve - self.present(viewController, animated: true) + UserDefaultHandler.setIsLogin(isLogin: true) + UserDefaultHandler.setAccessToken(accessToken: data.accessToken ?? "") + UserDefaultHandler.setRefreshToken(refreshToken: data.refreshToken ?? "") + + guard data.nickname != nil else { + self.navigationController?.pushViewController(CreateNickNameViewController(), animated: true) + return } + + UserDefaultHandler.setNickname(nickname: data.nickname ?? "") + UserDefaultHandler.setIsSetFcmToken(isSetFcmToken: true) + let storyboard = UIStoryboard(name: "Main", bundle: nil) + let viewController = storyboard.instantiateViewController(withIdentifier: "MainNavigationController") + viewController.modalPresentationStyle = .fullScreen + viewController.modalTransitionStyle = .crossDissolve + self.present(viewController, animated: true) } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { diff --git a/Manito/Manito/Screens/Main/MainViewController.swift b/Manito/Manito/Screens/Main/MainViewController.swift index b4e260497..62469a2a7 100644 --- a/Manito/Manito/Screens/Main/MainViewController.swift +++ b/Manito/Manito/Screens/Main/MainViewController.swift @@ -98,8 +98,8 @@ final class MainViewController: BaseViewController { // MARK: - property - private let mainService: MainProtocol = MainAPI(apiService: APIService()) - private var rooms: [ParticipatingRoom]? + private let mainRepository: MainRepository = MainRepositoryImpl() + private var rooms: [RoomListItemDTO]? // MARK: - init @@ -283,8 +283,9 @@ final class MainViewController: BaseViewController { switch status { case .waiting: guard let index = index else { return } - let viewController = DetailWaitViewController(viewModel: DetailWaitViewModel(roomIndex: index, - detailWaitService: DetailWaitService(api: DetailWaitAPI(apiService: APIService())))) + let viewModel = DetailWaitViewModel(roomIndex: index, + detailWaitService: DetailWaitService(repository: DetailRoomRepositoryImpl())) + let viewController = DetailWaitViewController(viewModel: viewModel) self.navigationController?.pushViewController(viewController, animated: true) default: @@ -313,8 +314,8 @@ final class MainViewController: BaseViewController { private func requestCommonMission() { Task { do { - let data = try await self.mainService.fetchCommonMission() - if let commonMission = data?.mission { + let data = try await self.mainRepository.fetchCommonMission() + if let commonMission = data.mission { self.commonMissionView.missionLabel.text = commonMission } } catch NetworkError.serverError { @@ -330,13 +331,10 @@ final class MainViewController: BaseViewController { private func requestManittoRoomList() { Task { do { - let data = try await self.mainService.fetchManittoList() - - if let manittoList = data { - self.rooms = manittoList.participatingRooms - self.listCollectionView.reloadData() - self.stopSkeletonView() - } + let data = try await self.mainRepository.fetchManittoList() + self.rooms = data.participatingRooms + self.listCollectionView.reloadData() + self.stopSkeletonView() } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift index ec026c061..093d8fab4 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomViewController.swift @@ -17,7 +17,7 @@ final class ParticipateRoomViewController: BaseViewController { // MARK: - property - private let checkRoomInfoService: RoomProtocol = RoomAPI(apiService: APIService()) + private let roomParticipationRepository: RoomParticipationRepository = RoomParticipationRepositoryImpl() // MARK: - init @@ -59,18 +59,15 @@ final class ParticipateRoomViewController: BaseViewController { private func dispatchInviteCode(_ code : String) { Task { do { - let data = try await self.checkRoomInfoService - .dispatchVerification(body: code) - if let info = data { - guard let id = info.id else { return } - let viewController = CheckRoomViewController() - viewController.modalPresentationStyle = .overFullScreen - viewController.modalTransitionStyle = .crossDissolve - viewController.verification = info - viewController.roomId = id - - self.present(viewController, animated: true) - } + let data = try await self.roomParticipationRepository.dispatchVerifyCode(code: code) + guard let id = data.id else { return } + let viewController = CheckRoomViewController() + viewController.modalPresentationStyle = .overFullScreen + viewController.modalTransitionStyle = .crossDissolve + viewController.roomInfo = data + viewController.roomId = id + + self.present(viewController, animated: true) } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { @@ -93,6 +90,6 @@ extension ParticipateRoomViewController: ParticipateRoomViewDelegate { } func observeNextNotification(roomId: Int) { - self.navigationController?.pushViewController(ChooseCharacterViewController(statusMode: .enterRoom, roomId: roomId), animated: true) + self.navigationController?.pushViewController(ChooseCharacterViewController(roomId: roomId), animated: true) } } diff --git a/Manito/Manito/Screens/Setting/ChangeNickNameViewController.swift b/Manito/Manito/Screens/Setting/ChangeNickNameViewController.swift index 675bd2627..65eb0e2af 100644 --- a/Manito/Manito/Screens/Setting/ChangeNickNameViewController.swift +++ b/Manito/Manito/Screens/Setting/ChangeNickNameViewController.swift @@ -10,8 +10,8 @@ import UIKit import SnapKit class ChangeNickNameViewController: BaseViewController { - - let settingService: SettingProtocol = SettingAPI(apiService: APIService()) + + private let settingRepository: SettingRepository = SettingRepositoryImpl() private var nickname: String = UserDefaultStorage.nickname private var maxLength = 5 @@ -127,7 +127,7 @@ class ChangeNickNameViewController: BaseViewController { func requestChangeNickname(nickname: NicknameDTO) { Task { do { - let _ = try await settingService.putChangeNickname(body: nickname) + let _ = try await self.settingRepository.putUserInfo(nickname: nickname) } catch NetworkError.serverError { print("server Error") } catch NetworkError.encodingError { diff --git a/Manito/Manito/Screens/Setting/SettingViewController.swift b/Manito/Manito/Screens/Setting/SettingViewController.swift index 388469af4..7686e9f74 100644 --- a/Manito/Manito/Screens/Setting/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/SettingViewController.swift @@ -15,7 +15,7 @@ final class SettingViewController: BaseViewController { private let settingView: SettingView = SettingView() - private let settingService: SettingAPI = SettingAPI(apiService: APIService()) + private let settingRepository: SettingRepository = SettingRepositoryImpl() // MARK: - init @@ -52,12 +52,10 @@ final class SettingViewController: BaseViewController { private func requestDeleteMember(completionHandler: @escaping ((Result) -> Void)) { Task { do { - let statusCode = try await settingService.deleteMember() + let statusCode = try await self.settingRepository.deleteMember() switch statusCode { case 200..<300: completionHandler(.success(())) - default: - print(statusCode) - completionHandler(.failure(.unknownError)) + default: completionHandler(.failure(.unknownError)) } } catch NetworkError.serverError { print("server Error") @@ -108,10 +106,13 @@ extension SettingViewController: SettingViewDelegate { func withdrawalButtonDidTap() { self.makeRequestAlert(title: "경고", message: "회원탈퇴 시 지금까지 내용이 전부 삭제됩니다. \n 탈퇴 하시겠습니까?", okTitle: "탈퇴") { [weak self] _ in - self?.requestDeleteMember() { [weak self] result in + self?.requestDeleteMember() { result in switch result { case .success: - self?.navigationController?.popViewController(animated: true) + UserDefaultHandler.clearAllDataExcludingFcmToken() + guard let sceneDelgate = UIApplication.shared.connectedScenes.first?.delegate + as? SceneDelegate else { return } + sceneDelgate.logout() case .failure: print("error") } diff --git a/Manito/Manito/Network/Storage/UserDefaultHandler.swift b/Manito/Manito/Service/UserDefaultService/UserDefaultHandler.swift similarity index 100% rename from Manito/Manito/Network/Storage/UserDefaultHandler.swift rename to Manito/Manito/Service/UserDefaultService/UserDefaultHandler.swift diff --git a/Manito/Manito/Network/Storage/UserDefaultStorage.swift b/Manito/Manito/Service/UserDefaultService/UserDefaultStorage.swift similarity index 100% rename from Manito/Manito/Network/Storage/UserDefaultStorage.swift rename to Manito/Manito/Service/UserDefaultService/UserDefaultStorage.swift diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index a6e6bd783..641a2275e 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -112,7 +112,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testViewDidLoadSubject.send(()) // then - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertEqual(checkRoom, testRoom) } @@ -139,7 +139,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testStartButtonDidTapSubject.send(()) // then - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertEqual(checkNickname, testNickname) } @@ -169,7 +169,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testEditMenuButtonDidTapSubject.send(()) // then - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertEqual(checkRoom, testRoom) XCTAssertEqual(checkMode, testMode) } @@ -196,7 +196,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testDeleteMenuButtonDidTapSubject.send(()) // then - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertTrue(testBool) } @@ -222,7 +222,7 @@ final class DetailWaitViewModelTest: XCTestCase { self.testLeaveMenuButtonDidTapSubject.send(()) // then - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertTrue(testBool) } @@ -240,7 +240,7 @@ final class DetailWaitViewModelTest: XCTestCase { testRoom = self.viewModel.makeRoomInformation() expectation.fulfill() } - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertEqual(checkRoom, testRoom) } @@ -258,7 +258,7 @@ final class DetailWaitViewModelTest: XCTestCase { testRoom = self.viewModel.makeRoomInformation() expectation.fulfill() } - wait(for: [expectation], timeout: 2) + wait(for: [expectation], timeout: 5) XCTAssertEqual(checkRoom, testRoom) } } diff --git a/Manito/ManitoTests/ManitoTests.swift b/Manito/ManitoTests/ManitoTests.swift deleted file mode 100644 index e9d485745..000000000 --- a/Manito/ManitoTests/ManitoTests.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// ManitoTests.swift -// ManitoTests -// -// Created by Mingwan Choi on 2023/05/15. -// - -import XCTest -@testable import Manito - -final class ManitoTests: XCTestCase { - - override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - - func testExample() throws { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - // Any test you write for XCTest can be annotated as throws and async. - // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. - // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. - } - - func testPerformanceExample() throws { - // This is an example of a performance test case. - measure { - // Put the code you want to measure the time of here. - } - } - -} diff --git a/Manito/Packages/MTNetwork/.swiftpm/xcode/xcshareddata/xcschemes/MTNetworkTests.xcscheme b/Manito/Packages/MTNetwork/.swiftpm/xcode/xcshareddata/xcschemes/MTNetworkTests.xcscheme new file mode 100644 index 000000000..f00dcdb6c --- /dev/null +++ b/Manito/Packages/MTNetwork/.swiftpm/xcode/xcshareddata/xcschemes/MTNetworkTests.xcscheme @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + From b143b3f7bab24600ca086660cedf25ca808110e1 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 29 Aug 2023 11:41:31 +0900 Subject: [PATCH 382/468] =?UTF-8?q?[CHORE]=20Service=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EB=B0=8D=EC=9D=84=20Usecase=EB=A1=9C=20=EB=B3=80=EA=B2=BD(#499?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 16 ++++++++++++---- .../LetterUsecase.swift} | 6 +++--- .../LetterScene/ViewModel/LetterViewModel.swift | 16 ++++++++-------- .../Detail-Ing/DetailingViewController.swift | 8 ++++---- 4 files changed, 27 insertions(+), 19 deletions(-) rename Manito/Manito/Domain/Usecase/{LetterService.swift => LetterScene/LetterUsecase.swift} (94%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index ffc1aafb7..9f20d50fe 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -106,7 +106,7 @@ B5AE11F229D28CB500F86FF8 /* OpenManittoPopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11F129D28CB500F86FF8 /* OpenManittoPopupView.swift */; }; B5AE11F429D32EE700F86FF8 /* SelectManitteeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */; }; B5B3C15D2A41D6EB00AABD6F /* LetterViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C15C2A41D6EB00AABD6F /* LetterViewModel.swift */; }; - B5B3C15F2A41D6F400AABD6F /* LetterService.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C15E2A41D6F400AABD6F /* LetterService.swift */; }; + B5B3C15F2A41D6F400AABD6F /* LetterUsecase.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C15E2A41D6F400AABD6F /* LetterUsecase.swift */; }; B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */; }; B5B3C1652A427B5800AABD6F /* UIControl+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */; }; B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */; }; @@ -303,7 +303,7 @@ B5AE11F129D28CB500F86FF8 /* OpenManittoPopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoPopupView.swift; sourceTree = ""; }; B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeView.swift; sourceTree = ""; }; B5B3C15C2A41D6EB00AABD6F /* LetterViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterViewModel.swift; sourceTree = ""; }; - B5B3C15E2A41D6F400AABD6F /* LetterService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterService.swift; sourceTree = ""; }; + B5B3C15E2A41D6F400AABD6F /* LetterUsecase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterUsecase.swift; sourceTree = ""; }; B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModelType.swift; sourceTree = ""; }; B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Combine.swift"; sourceTree = ""; }; B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Combine.swift"; sourceTree = ""; }; @@ -758,11 +758,19 @@ B58CA30B2A9CC43600977592 /* Usecase */ = { isa = PBXGroup; children = ( - B5B3C15E2A41D6F400AABD6F /* LetterService.swift */, + B58CA3142A9D913600977592 /* LetterScene */, ); path = Usecase; sourceTree = ""; }; + B58CA3142A9D913600977592 /* LetterScene */ = { + isa = PBXGroup; + children = ( + B5B3C15E2A41D6F400AABD6F /* LetterUsecase.swift */, + ); + path = LetterScene; + sourceTree = ""; + }; B5A085E42A972E5F00C8A98D /* Response */ = { isa = PBXGroup; children = ( @@ -1481,7 +1489,7 @@ 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */, B5F525202851A21D00614FF7 /* UIViewController+Extension.swift in Sources */, 7ED845BA2876BE530075AC61 /* SettingViewTableCell.swift in Sources */, - B5B3C15F2A41D6F400AABD6F /* LetterService.swift in Sources */, + B5B3C15F2A41D6F400AABD6F /* LetterUsecase.swift in Sources */, B5AE11F229D28CB500F86FF8 /* OpenManittoPopupView.swift in Sources */, B517C04A28D1F7EC0008BED0 /* TokenEndPoint.swift in Sources */, 39EE956D2A401ED400AF6857 /* DetailingView.swift in Sources */, diff --git a/Manito/Manito/Domain/Usecase/LetterService.swift b/Manito/Manito/Domain/Usecase/LetterScene/LetterUsecase.swift similarity index 94% rename from Manito/Manito/Domain/Usecase/LetterService.swift rename to Manito/Manito/Domain/Usecase/LetterScene/LetterUsecase.swift index 242693d32..fa80db544 100644 --- a/Manito/Manito/Domain/Usecase/LetterService.swift +++ b/Manito/Manito/Domain/Usecase/LetterScene/LetterUsecase.swift @@ -1,5 +1,5 @@ // -// LetterService.swift +// LetterUsecase.swift // Manito // // Created by SHIN YOON AH on 2023/06/20. @@ -8,7 +8,7 @@ import Combine import Foundation -protocol LetterServicable { +protocol LetterUsecase { var manitteeId: String? { get set } var nickname: String { get set } @@ -17,7 +17,7 @@ protocol LetterServicable { func loadNickname() } -final class LetterService: LetterServicable { +final class LetterUsecaseImpl: LetterUsecase { // MARK: - property diff --git a/Manito/Manito/Presentation/Scene/LetterScene/ViewModel/LetterViewModel.swift b/Manito/Manito/Presentation/Scene/LetterScene/ViewModel/LetterViewModel.swift index b96cf44e9..f1d5f103d 100644 --- a/Manito/Manito/Presentation/Scene/LetterScene/ViewModel/LetterViewModel.swift +++ b/Manito/Manito/Presentation/Scene/LetterScene/ViewModel/LetterViewModel.swift @@ -43,20 +43,20 @@ final class LetterViewModel: ViewModelType { private var cancelBag: Set = Set() - private let service: LetterServicable + private let usecase: LetterUsecase private var messageDetails: MessageDetails private let roomState: RoomState private let messageType: MessageType // MARK: - init - init(service: LetterServicable, + init(usecase: LetterUsecase, roomId: String, mission: String, missionId: String, roomState: String, messageType: MessageType) { - self.service = service + self.usecase = usecase self.messageDetails = MessageDetails(roomId, mission, missionId, "") self.roomState = RoomState(rawValue: roomState)! self.messageType = messageType @@ -97,8 +97,8 @@ final class LetterViewModel: ViewModelType { let reportPublisher = input.reportButtonDidTap .map { [weak self] content -> ReportDetails in - self?.service.loadNickname() - return ((self?.service.nickname)!, content) + self?.usecase.loadNickname() + return ((self?.usecase.nickname)!, content) } .eraseToAnyPublisher() @@ -141,17 +141,17 @@ extension LetterViewModel { } private func fetchSendMessages(roomId: String, type: MessageType) async throws -> [MessageListItem] { - let messages = try await self.service.fetchSendLetter(roomId: roomId) + let messages = try await self.usecase.fetchSendLetter(roomId: roomId) return self.insertReportState(type, in: messages) } private func fetchReceivedMessages(roomId: String, type: MessageType) async throws -> [MessageListItem] { - let messages = try await self.service.fetchReceiveLetter(roomId: roomId) + let messages = try await self.usecase.fetchReceiveLetter(roomId: roomId) return self.insertReportState(type, in: messages) } private func loadMessageDetails() { - guard let manitteeId = self.service.manitteeId else { return } + guard let manitteeId = self.usecase.manitteeId else { return } self.messageDetails.manitteeId = manitteeId } diff --git a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift index 589c3b8c1..b2f344b88 100644 --- a/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/DetailingViewController.swift @@ -149,8 +149,8 @@ final class DetailingViewController: BaseViewController { let missionId = data.mission?.id else { return } // FIXME: - RoomType를 View에서 바로 빼오지 않고 다른 방식으로 구현해야 합니다. - let service = LetterService(repository: LetterRepositoryImpl()) - let viewModel = LetterViewModel(service: service, + let usecase = LetterUsecaseImpl(repository: LetterRepositoryImpl()) + let viewModel = LetterViewModel(usecase: usecase, roomId: self.roomId, mission: mission, missionId: missionId.description, @@ -241,8 +241,8 @@ extension DetailingViewController: DetailingDelegate { mission: String, missionId: String) { // FIXME: - RoomType를 View에서 바로 빼오지 않고 다른 방식으로 구현해야 합니다. - let service = LetterService(repository: LetterRepositoryImpl()) - let viewModel = LetterViewModel(service: service, + let usecase = LetterUsecaseImpl(repository: LetterRepositoryImpl()) + let viewModel = LetterViewModel(usecase: usecase, roomId: self.roomId, mission: mission, missionId: missionId.description, From bca2f22e109f829002a75e9ff29fedc548017a95 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 29 Aug 2023 11:49:32 +0900 Subject: [PATCH 383/468] =?UTF-8?q?[CHORE]=20Error=20=ED=8F=B4=EB=8D=94=20?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EC=88=98=EC=A0=95(#499)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 12 ++++++------ .../LetterScene}/LetterImageError.swift | 0 2 files changed, 6 insertions(+), 6 deletions(-) rename Manito/Manito/Global/Error/{Screens/Letter => Presentation/LetterScene}/LetterImageError.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 9f20d50fe..fe45041ab 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -667,25 +667,25 @@ B54741E529A4945100B75BA3 /* Error */ = { isa = PBXGroup; children = ( - B54741E629A4945A00B75BA3 /* Screens */, + B54741E629A4945A00B75BA3 /* Presentation */, ); path = Error; sourceTree = ""; }; - B54741E629A4945A00B75BA3 /* Screens */ = { + B54741E629A4945A00B75BA3 /* Presentation */ = { isa = PBXGroup; children = ( - B54741E729A4947C00B75BA3 /* Letter */, + B54741E729A4947C00B75BA3 /* LetterScene */, ); - path = Screens; + path = Presentation; sourceTree = ""; }; - B54741E729A4947C00B75BA3 /* Letter */ = { + B54741E729A4947C00B75BA3 /* LetterScene */ = { isa = PBXGroup; children = ( B54741E929A494E200B75BA3 /* LetterImageError.swift */, ); - path = Letter; + path = LetterScene; sourceTree = ""; }; B57CB3022A763BB200474042 /* Packages */ = { diff --git a/Manito/Manito/Global/Error/Screens/Letter/LetterImageError.swift b/Manito/Manito/Global/Error/Presentation/LetterScene/LetterImageError.swift similarity index 100% rename from Manito/Manito/Global/Error/Screens/Letter/LetterImageError.swift rename to Manito/Manito/Global/Error/Presentation/LetterScene/LetterImageError.swift From a37ecbeaa5078f1009cfe59f01e83cfe6e6ca230 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 29 Aug 2023 12:12:15 +0900 Subject: [PATCH 384/468] =?UTF-8?q?[CHORE]=20View=EC=97=90=EC=84=9C=20Enti?= =?UTF-8?q?ty=EB=A5=BC=20=EC=82=AC=EC=9A=A9=ED=95=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95(#499)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 18 +++++++++--------- .../View/Cell}/LetterCollectionViewCell.swift | 0 .../Scene/LetterScene/View/LetterView.swift | 5 ++--- .../ViewController/LetterViewController.swift | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) rename Manito/Manito/{Screens/Letter/Views/Cells => Presentation/Scene/LetterScene/View/Cell}/LetterCollectionViewCell.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index fe45041ab..dbf93e7b2 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -658,7 +658,6 @@ children = ( B5B3C1592A41D69500AABD6F /* ViewControllers */, B5B3C1582A41D67F00AABD6F /* Views */, - B5F5253228547CAF00614FF7 /* Cells */, B5F5253328547EE000614FF7 /* UIComponents */, ); path = Views; @@ -733,6 +732,7 @@ B58CA3082A9CC3B300977592 /* View */ = { isa = PBXGroup; children = ( + B58CA3192A9D992F00977592 /* Cell */, B58CA3092A9CC3D700977592 /* UIComponent */, B5706BF329B710FC0093D198 /* LetterView.swift */, ); @@ -771,6 +771,14 @@ path = LetterScene; sourceTree = ""; }; + B58CA3192A9D992F00977592 /* Cell */ = { + isa = PBXGroup; + children = ( + B5F52536285481C800614FF7 /* LetterCollectionViewCell.swift */, + ); + path = Cell; + sourceTree = ""; + }; B5A085E42A972E5F00C8A98D /* Response */ = { isa = PBXGroup; children = ( @@ -1092,14 +1100,6 @@ path = Utils; sourceTree = ""; }; - B5F5253228547CAF00614FF7 /* Cells */ = { - isa = PBXGroup; - children = ( - B5F52536285481C800614FF7 /* LetterCollectionViewCell.swift */, - ); - path = Cells; - sourceTree = ""; - }; B5F5253328547EE000614FF7 /* UIComponents */ = { isa = PBXGroup; children = ( diff --git a/Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift b/Manito/Manito/Presentation/Scene/LetterScene/View/Cell/LetterCollectionViewCell.swift similarity index 100% rename from Manito/Manito/Screens/Letter/Views/Cells/LetterCollectionViewCell.swift rename to Manito/Manito/Presentation/Scene/LetterScene/View/Cell/LetterCollectionViewCell.swift diff --git a/Manito/Manito/Presentation/Scene/LetterScene/View/LetterView.swift b/Manito/Manito/Presentation/Scene/LetterScene/View/LetterView.swift index d44a98e77..f46de09b2 100644 --- a/Manito/Manito/Presentation/Scene/LetterScene/View/LetterView.swift +++ b/Manito/Manito/Presentation/Scene/LetterScene/View/LetterView.swift @@ -103,9 +103,8 @@ final class LetterView: UIView { self.setupGuideView(in: viewController) } - func updateEmptyArea(with items: [MessageListItem]) { - let isEmpty = items.isEmpty - self.emptyLabel.isHidden = !isEmpty + func updateEmptyAreaStatus(to isHidden: Bool) { + self.emptyLabel.isHidden = isHidden } func updateEmptyArea(with text: String) { diff --git a/Manito/Manito/Presentation/Scene/LetterScene/ViewController/LetterViewController.swift b/Manito/Manito/Presentation/Scene/LetterScene/ViewController/LetterViewController.swift index 29531d611..8d4a71b51 100644 --- a/Manito/Manito/Presentation/Scene/LetterScene/ViewController/LetterViewController.swift +++ b/Manito/Manito/Presentation/Scene/LetterScene/ViewController/LetterViewController.swift @@ -183,7 +183,7 @@ extension LetterViewController { } self.reloadMessageList(messages) - self.letterView.updateEmptyArea(with: messages) + self.letterView.updateEmptyAreaStatus(to: !messages.isEmpty) } private func updateLetterViewEmptyArea(with index: Int) { From eb14976f7894cb8936013e9d3901bcd5a31d9cc2 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 29 Aug 2023 12:43:10 +0900 Subject: [PATCH 385/468] =?UTF-8?q?[ADD]=20DTO,=20Entity=EC=97=90=20?= =?UTF-8?q?=EB=8C=80=ED=95=9C=20=EC=A0=95=EB=B3=B4=20=EC=B6=94=EA=B0=80(#4?= =?UTF-8?q?99)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Data/DTO/Response/MessageListItemDTO.swift | 11 +++++++++++ .../Manito/Domain/Entity/MessageListItem.swift | 18 ++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift b/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift index 90e6f71a6..fadd48933 100644 --- a/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift +++ b/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift @@ -7,6 +7,17 @@ import Foundation +/// +/// 쪽지, 함께 했던 기억 화면에서 쪽지 내용에 대한 정보들을 반환하는 +/// 데이터 모델 DTO입니다. +/// +/// - id: 쪽지의 id 정보 +/// - content: 쪽지의 내용(옵션) +/// - imageUrl: 쪽지에 포함된 사진(옵션) +/// - createdDate: 쪽지를 보낸 날짜 +/// - missionInfo: 쪽지에 해당하는 미션(옵션 - 미션을 추가하지 않았던 v1 API) +/// + struct MessageListItemDTO: Decodable { let id: Int? let content: String? diff --git a/Manito/Manito/Domain/Entity/MessageListItem.swift b/Manito/Manito/Domain/Entity/MessageListItem.swift index b032a6053..4a12d77e9 100644 --- a/Manito/Manito/Domain/Entity/MessageListItem.swift +++ b/Manito/Manito/Domain/Entity/MessageListItem.swift @@ -7,22 +7,36 @@ import Foundation +/// +/// 쪽지, 함께 했던 기억 화면에서 쪽지 내용에 대한 정보들을 반환하는 +/// 데이터 모델 Entity 입니다. +/// + struct MessageListItem: Hashable { + /// 쪽지의 id 정보 let id: Int + /// 쪽지의 내용(옵션) let content: String? + /// 쪽지에 포함된 사진(옵션) let imageUrl: String? + /// 쪽지를 보낸 날짜 let createdDate: String + /// 쪽지에 해당하는 미션(옵션 - 미션을 추가하지 않았던 v1 API) let missionInfo: IndividualMissionDTO? + /// 쪽지 신고 가능 정보(받은 쪽지만 신고 가능) let canReport: Bool + // MARK: - Custom property + + /// 쪽지 생성 날짜와 오늘 날짜가 동일한지 var isToday: Bool { return Date().letterDateToString == createdDate } - + /// 쪽지의 날짜를 반환(당일이라면 "오늘" 반환) var date: String { return self.isToday ? "오늘" : createdDate } - + /// 쪽지에 해당하는 개별 미션 반환(없으면 nil 반환) var mission: String? { guard let mission = missionInfo?.content else { return nil } From be9af5b8741cc7a2acf303ffcab883eb7960d488 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 29 Aug 2023 12:49:05 +0900 Subject: [PATCH 386/468] =?UTF-8?q?[CHORE]=20=EB=AF=B8=EC=85=98=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=ED=95=98=EB=82=98=EB=A1=9C=20?= =?UTF-8?q?=ED=95=A9=EC=B9=98=EA=B8=B0=20=EC=A7=84=ED=96=89(#499)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Domain/Entity/MessageListItem.swift | 12 ++++-------- .../View/Cell/LetterCollectionViewCell.swift | 9 ++------- .../ViewController/LetterViewController.swift | 1 - 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/Manito/Manito/Domain/Entity/MessageListItem.swift b/Manito/Manito/Domain/Entity/MessageListItem.swift index 4a12d77e9..e19ff168f 100644 --- a/Manito/Manito/Domain/Entity/MessageListItem.swift +++ b/Manito/Manito/Domain/Entity/MessageListItem.swift @@ -32,14 +32,10 @@ struct MessageListItem: Hashable { var isToday: Bool { return Date().letterDateToString == createdDate } - /// 쪽지의 날짜를 반환(당일이라면 "오늘" 반환) - var date: String { - return self.isToday ? "오늘" : createdDate - } - /// 쪽지에 해당하는 개별 미션 반환(없으면 nil 반환) - var mission: String? { - guard let mission = missionInfo?.content else { return nil } - + /// 쪽지에 해당하는 개별 미션 반환(없으면 날짜 반환) + var mission: String { + let date = self.isToday ? "오늘" : createdDate + guard let mission = missionInfo?.content else { return date } return "\(date)의 개별미션\n[\(mission)]" } } diff --git a/Manito/Manito/Presentation/Scene/LetterScene/View/Cell/LetterCollectionViewCell.swift b/Manito/Manito/Presentation/Scene/LetterScene/View/Cell/LetterCollectionViewCell.swift index 8a3e6e52a..0c467b4e4 100644 --- a/Manito/Manito/Presentation/Scene/LetterScene/View/Cell/LetterCollectionViewCell.swift +++ b/Manito/Manito/Presentation/Scene/LetterScene/View/Cell/LetterCollectionViewCell.swift @@ -12,7 +12,7 @@ import SnapKit final class LetterCollectionViewCell: BaseCollectionViewCell { - typealias ConfigurationData = (mission: String?, date: String, content: String?, imageURL: String?, isTodayLetter: Bool, canReport: Bool?) + typealias ConfigurationData = (mission: String, content: String?, imageURL: String?, isTodayLetter: Bool, canReport: Bool?) private enum ConstantSize { static let contentSpacing: CGFloat = 10 @@ -141,12 +141,6 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { // MARK: - Public - func extension LetterCollectionViewCell { func configureCell(_ data: ConfigurationData) { - if let mission = data.mission { - self.missionLabel.text = mission - } else { - self.missionLabel.text = data.date - } - if let content = data.content { self.contentLabel.text = content self.contentLabel.addLabelSpacing() @@ -162,6 +156,7 @@ extension LetterCollectionViewCell { self.photoImageView.isHidden = true } + self.missionLabel.text = data.mission self.missionLabel.textColor = data.isTodayLetter ? .subOrange : .grey003 self.reportButton.isHidden = !(data.canReport ?? false) } diff --git a/Manito/Manito/Presentation/Scene/LetterScene/ViewController/LetterViewController.swift b/Manito/Manito/Presentation/Scene/LetterScene/ViewController/LetterViewController.swift index 8d4a71b51..411c8a0dd 100644 --- a/Manito/Manito/Presentation/Scene/LetterScene/ViewController/LetterViewController.swift +++ b/Manito/Manito/Presentation/Scene/LetterScene/ViewController/LetterViewController.swift @@ -222,7 +222,6 @@ extension LetterViewController { let letterCellRegistration = UICollectionView.CellRegistration { [weak self] cell, indexPath, item in cell.configureCell((mission: item.mission, - date: item.date, content: item.content, imageURL: item.imageUrl, isTodayLetter: item.isToday, From 70462620b7f6d7bcb513980c443751ba56c315dc Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 29 Aug 2023 13:33:40 +0900 Subject: [PATCH 387/468] =?UTF-8?q?[ADD]=20DTO=20=EC=83=81=EC=84=B8=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=20=EC=B6=94=EA=B0=80(#499)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Data/DTO/Response/LetterDTO.swift | 8 ++++++++ .../Manito/Data/DTO/Response/MessageListItemDTO.swift | 11 +++++------ Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift | 3 +++ Manito/Manito/Data/DTO/Response/UserInfoDTO.swift | 6 ++++++ 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Manito/Manito/Data/DTO/Response/LetterDTO.swift b/Manito/Manito/Data/DTO/Response/LetterDTO.swift index 2c6995167..4ccb968a5 100644 --- a/Manito/Manito/Data/DTO/Response/LetterDTO.swift +++ b/Manito/Manito/Data/DTO/Response/LetterDTO.swift @@ -7,8 +7,16 @@ import Foundation +/// +/// 쪽지 화면에서 받은 쪽지, 보낸 쪽지 정보들을 반환하는 +/// 데이터 모델 DTO입니다. +/// + struct LetterDTO: Decodable { + /// 총 쪽지 개수 let count: Int? + /// 마니띠 정보 let manittee: UserInfoDTO? + /// 쪽지 내용에 대한 자세한 정보 let messages: [MessageListItemDTO] } diff --git a/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift b/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift index fadd48933..560cfdced 100644 --- a/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift +++ b/Manito/Manito/Data/DTO/Response/MessageListItemDTO.swift @@ -11,18 +11,17 @@ import Foundation /// 쪽지, 함께 했던 기억 화면에서 쪽지 내용에 대한 정보들을 반환하는 /// 데이터 모델 DTO입니다. /// -/// - id: 쪽지의 id 정보 -/// - content: 쪽지의 내용(옵션) -/// - imageUrl: 쪽지에 포함된 사진(옵션) -/// - createdDate: 쪽지를 보낸 날짜 -/// - missionInfo: 쪽지에 해당하는 미션(옵션 - 미션을 추가하지 않았던 v1 API) -/// struct MessageListItemDTO: Decodable { + /// 쪽지의 id 정보 let id: Int? + /// 쪽지의 내용(옵션) let content: String? + /// 쪽지에 포함된 사진(옵션) let imageUrl: String? + /// 쪽지를 보낸 날짜 let createdDate: String? + /// 쪽지에 해당하는 미션(옵션 - 미션을 추가하지 않았던 v1 API) let missionInfo: IndividualMissionDTO? } diff --git a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift index 54362d890..17c507c4a 100644 --- a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift +++ b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift @@ -63,8 +63,11 @@ struct InvitationCodeDTO: Decodable { let code: String? } +/// 개별 미션에 대한 정보들을 반환하는 데이터 모델 DTO입니다. struct IndividualMissionDTO: Decodable, Hashable { + /// 개별 미션 identifier let id: Int? + /// 개별 미션 내용 let content: String? } diff --git a/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift b/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift index bc8bb6411..da19de773 100644 --- a/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift +++ b/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift @@ -7,7 +7,13 @@ import Foundation +/// +/// User 정보들을 반환하는 데이터 모델 DTO입니다. +/// + struct UserInfoDTO: Decodable { + /// User Identifier let id: String? + /// User 닉네임 let nickname: String? } From 4edec24ab51ecfb82dacfe46b5ba41fa8716c61b Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 29 Aug 2023 15:19:05 +0900 Subject: [PATCH 388/468] =?UTF-8?q?[CHORE]=20Entity=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20test=20=EA=B0=92=EB=93=A4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Data/DTO/Response/RoomInfoDTO.swift | 18 ++++++++++++++++++ .../Manito/Data/DTO/Response/UserInfoDTO.swift | 15 +++++++++++++++ .../Manito/Domain/Entity/ParticipantList.swift | 9 +++++++++ Manito/Manito/Domain/Entity/RoomInfo.swift | 16 ++++++++++++++++ Manito/Manito/Domain/Entity/RoomListItem.swift | 14 ++++++++++++++ 5 files changed, 72 insertions(+) diff --git a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift index 54362d890..b21a1a5e8 100644 --- a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift +++ b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift @@ -63,11 +63,29 @@ struct InvitationCodeDTO: Decodable { let code: String? } +#if DEBUG +extension InvitationCodeDTO { + static let testInvitationCodeDTO = InvitationCodeDTO(code: "ABCDEF") +} +#endif + struct IndividualMissionDTO: Decodable, Hashable { let id: Int? let content: String? } +#if DEBUG +extension IndividualMissionDTO { + static let testIndividualMissionDTO = IndividualMissionDTO(id: 1, content: "테스트미션") +} +#endif + struct MessageInfo: Decodable { let count: Int? } + +#if DEBUG +extension MessageInfo { + static let testMessageInfo = MessageInfo(count: 3) +} +#endif diff --git a/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift b/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift index bc8bb6411..3438c80b5 100644 --- a/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift +++ b/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift @@ -11,3 +11,18 @@ struct UserInfoDTO: Decodable { let id: String? let nickname: String? } + +#if DEBUG +extension UserInfoDTO { + static let testUserManittee = UserInfoDTO(id: "1", nickname: "테스트마니띠") + static let testUserManitto = UserInfoDTO(id: "2", nickname: "테스트마니또") + + static let testUserList = [ + UserInfoDTO(id: "100", nickname: "유저1"), + UserInfoDTO(id: "200", nickname: "유저2"), + UserInfoDTO(id: "300", nickname: "유저3"), + UserInfoDTO(id: "400", nickname: "유저4"), + UserInfoDTO(id: "500", nickname: "유저5") + ] +} +#endif diff --git a/Manito/Manito/Domain/Entity/ParticipantList.swift b/Manito/Manito/Domain/Entity/ParticipantList.swift index 5e3308fb5..41a9cac22 100644 --- a/Manito/Manito/Domain/Entity/ParticipantList.swift +++ b/Manito/Manito/Domain/Entity/ParticipantList.swift @@ -17,3 +17,12 @@ extension ParticipantList { return members.map { $0.nickname ?? "" } } } + +#if DEBUG +extension ParticipantList { + static let testParticipantList = ParticipantList( + count: 5, + members: UserInfoDTO.testUserList + ) +} +#endif diff --git a/Manito/Manito/Domain/Entity/RoomInfo.swift b/Manito/Manito/Domain/Entity/RoomInfo.swift index 5b15aaf1b..d0739e380 100644 --- a/Manito/Manito/Domain/Entity/RoomInfo.swift +++ b/Manito/Manito/Domain/Entity/RoomInfo.swift @@ -62,3 +62,19 @@ extension RoomInfo { messages: nil) }() } + +#if DEBUG +extension RoomInfo { + static let testRoom = RoomInfo( + roomInformation: RoomListItem.testRoomListItem, + participants: ParticipantList.testParticipantList, + manittee: UserInfoDTO.testUserManitto, + manitto: UserInfoDTO.testUserManitto, + invitation: InvitationCodeDTO.testInvitationCodeDTO, + didViewRoulette: false, + mission: IndividualMissionDTO.testIndividualMissionDTO, + admin: false, + messages: MessageInfo.testMessageInfo + ) +} +#endif diff --git a/Manito/Manito/Domain/Entity/RoomListItem.swift b/Manito/Manito/Domain/Entity/RoomListItem.swift index 5084cc4a7..dd8a35a3e 100644 --- a/Manito/Manito/Domain/Entity/RoomListItem.swift +++ b/Manito/Manito/Domain/Entity/RoomListItem.swift @@ -53,3 +53,17 @@ extension RoomListItem { return (startDate, endDate) } } + +#if DEBUG +extension RoomListItem { + static let testRoomListItem = RoomListItem( + id: 1, + title: "테스트타이틀", + state: "PRE", + participatingCount: 10, + capacity: 5, + startDate: "2023.01.01", + endDate: "2023.01.05" + ) +} +#endif From 8ee2407e74fb96c89cf78efc0200a654ee9b8b2a Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 29 Aug 2023 15:33:17 +0900 Subject: [PATCH 389/468] =?UTF-8?q?[CHORE]=20RoomInfo=20=EA=B5=AC=EC=A1=B0?= =?UTF-8?q?=EC=B2=B4=20Equtable=20=ED=94=84=EB=A1=9C=ED=86=A0=EC=BD=9C=20?= =?UTF-8?q?=EC=B1=84=ED=83=9D(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift | 12 +++--------- Manito/Manito/Data/DTO/Response/UserInfoDTO.swift | 4 +--- Manito/Manito/Domain/Entity/ParticipantList.swift | 4 +--- Manito/Manito/Domain/Entity/RoomInfo.swift | 4 +--- Manito/Manito/Domain/Entity/RoomListItem.swift | 6 ++---- 5 files changed, 8 insertions(+), 22 deletions(-) diff --git a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift index b21a1a5e8..3caee5d32 100644 --- a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift +++ b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift @@ -63,29 +63,23 @@ struct InvitationCodeDTO: Decodable { let code: String? } -#if DEBUG -extension InvitationCodeDTO { +extension InvitationCodeDTO: Equatable { static let testInvitationCodeDTO = InvitationCodeDTO(code: "ABCDEF") } -#endif struct IndividualMissionDTO: Decodable, Hashable { let id: Int? let content: String? } -#if DEBUG -extension IndividualMissionDTO { +extension IndividualMissionDTO: Equatable { static let testIndividualMissionDTO = IndividualMissionDTO(id: 1, content: "테스트미션") } -#endif struct MessageInfo: Decodable { let count: Int? } -#if DEBUG -extension MessageInfo { +extension MessageInfo: Equatable { static let testMessageInfo = MessageInfo(count: 3) } -#endif diff --git a/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift b/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift index 3438c80b5..e8f2aefd2 100644 --- a/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift +++ b/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift @@ -12,8 +12,7 @@ struct UserInfoDTO: Decodable { let nickname: String? } -#if DEBUG -extension UserInfoDTO { +extension UserInfoDTO: Equatable { static let testUserManittee = UserInfoDTO(id: "1", nickname: "테스트마니띠") static let testUserManitto = UserInfoDTO(id: "2", nickname: "테스트마니또") @@ -25,4 +24,3 @@ extension UserInfoDTO { UserInfoDTO(id: "500", nickname: "유저5") ] } -#endif diff --git a/Manito/Manito/Domain/Entity/ParticipantList.swift b/Manito/Manito/Domain/Entity/ParticipantList.swift index 41a9cac22..9c08f6e33 100644 --- a/Manito/Manito/Domain/Entity/ParticipantList.swift +++ b/Manito/Manito/Domain/Entity/ParticipantList.swift @@ -18,11 +18,9 @@ extension ParticipantList { } } -#if DEBUG -extension ParticipantList { +extension ParticipantList: Equatable { static let testParticipantList = ParticipantList( count: 5, members: UserInfoDTO.testUserList ) } -#endif diff --git a/Manito/Manito/Domain/Entity/RoomInfo.swift b/Manito/Manito/Domain/Entity/RoomInfo.swift index d0739e380..3f08f10fc 100644 --- a/Manito/Manito/Domain/Entity/RoomInfo.swift +++ b/Manito/Manito/Domain/Entity/RoomInfo.swift @@ -63,8 +63,7 @@ extension RoomInfo { }() } -#if DEBUG -extension RoomInfo { +extension RoomInfo: Equatable { static let testRoom = RoomInfo( roomInformation: RoomListItem.testRoomListItem, participants: ParticipantList.testParticipantList, @@ -77,4 +76,3 @@ extension RoomInfo { messages: MessageInfo.testMessageInfo ) } -#endif diff --git a/Manito/Manito/Domain/Entity/RoomListItem.swift b/Manito/Manito/Domain/Entity/RoomListItem.swift index dd8a35a3e..7543a0d16 100644 --- a/Manito/Manito/Domain/Entity/RoomListItem.swift +++ b/Manito/Manito/Domain/Entity/RoomListItem.swift @@ -54,16 +54,14 @@ extension RoomListItem { } } -#if DEBUG -extension RoomListItem { +extension RoomListItem: Equatable { static let testRoomListItem = RoomListItem( id: 1, title: "테스트타이틀", state: "PRE", - participatingCount: 10, + participatingCount: 5, capacity: 5, startDate: "2023.01.01", endDate: "2023.01.05" ) } -#endif From 46e5114d9aff36fd8767efaae8c0a174430e6813 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 29 Aug 2023 15:45:57 +0900 Subject: [PATCH 390/468] =?UTF-8?q?[CHORE]=20=EB=84=A4=EC=9D=B4=EB=B0=8D?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=EB=B0=98=EC=98=81=20(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManitoTests/DetailWaitViewModelTest.swift | 58 ++++++++++--------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index 641a2275e..d57969dc6 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -44,7 +44,7 @@ final class DetailWaitViewModelTest: XCTestCase { leaveMenuButtonDidTap: testLeaveMenuButtonDidTapSubject.eraseToAnyPublisher(), changeButtonDidTap: testChangeButtonDidTapSubject.eraseToAnyPublisher()) self.output = self.viewModel.transform(input) - self.viewModel.setRoomInformation(room: Room.testRoom) + self.viewModel.setRoomInformation(room: RoomInfo.testRoom) } override func tearDown() { @@ -62,7 +62,7 @@ final class DetailWaitViewModelTest: XCTestCase { func testMakeRoomInformation() { // given - let checkRoom = Room.testRoom + let checkRoom = RoomInfo.testRoom self.viewModel.setRoomInformation(room: checkRoom) // then @@ -93,7 +93,7 @@ final class DetailWaitViewModelTest: XCTestCase { // given let checkRoom = mockRoom let expectation = XCTestExpectation(description: "roomInformation test") - var testRoom = Room.emptyRoom + var testRoom = RoomInfo.emptyRoom // when self.output.roomInformation @@ -145,10 +145,10 @@ final class DetailWaitViewModelTest: XCTestCase { func testTransferEditRoom() { // given - let checkRoom = Room.testRoom + let checkRoom = RoomInfo.testRoom let checkMode: DetailEditView.EditMode = .information let expectation = XCTestExpectation(description: "editButton test") - var testRoom = Room.emptyRoom + var testRoom = RoomInfo.emptyRoom var testMode: DetailEditView.EditMode = .date // when @@ -230,7 +230,7 @@ final class DetailWaitViewModelTest: XCTestCase { // given let checkRoom = mockRoom let expectation = XCTestExpectation(description: "changeButton test") - var testRoom = Room.emptyRoom + var testRoom = RoomInfo.emptyRoom // when self.testChangeButtonDidTapSubject.send(()) @@ -248,7 +248,7 @@ final class DetailWaitViewModelTest: XCTestCase { // given let checkRoom = mockRoom let expectation = XCTestExpectation(description: "viewDidLoad test") - var testRoom = Room.emptyRoom + var testRoom = RoomInfo.emptyRoom // when self.testViewDidLoadSubject.send() @@ -264,34 +264,38 @@ final class DetailWaitViewModelTest: XCTestCase { } extension DetailWaitViewModelTest { - var mockRoom: Room { - return Room(roomInformation: RoomInfo(id: 10, capacity: 10, title: "목타이틀", startDate: "", endDate: "", state: ""), - participants: Participants.testParticipants, - manittee: Manittee.testManittee, - manitto: Manitto.testManitto, - invitation: Invitation.testInvitation, - mission: Mission.testMission, - admin: true, - messages: Message1.testMessage) + var mockRoom: RoomInfo { + return RoomInfo( + roomInformation: RoomListItem(id: 10, title: "목타이틀", state: "", participatingCount: 10, capacity: 10, startDate: "", endDate: ""), + participants: ParticipantList.testParticipantList, + manittee: UserInfoDTO.testUserManitto, + manitto: UserInfoDTO.testUserManitto, + invitation: InvitationCodeDTO.testInvitationCodeDTO, + didViewRoulette: false, + mission: IndividualMissionDTO.testIndividualMissionDTO, + admin: false, + messages: MessageInfo.testMessageInfo) } } final class MockDetailWaitService: DetailWaitServicable { // FIXME: - network mocking 만들어야함. - func fetchWaitingRoomInfo(roomId: String) async throws -> Manito.Room { - let room = Room(roomInformation: RoomInfo(id: 10, capacity: 10, title: "목타이틀", startDate: "", endDate: "", state: ""), - participants: Participants.testParticipants, - manittee: Manittee.testManittee, - manitto: Manitto.testManitto, - invitation: Invitation.testInvitation, - mission: Mission.testMission, - admin: true, - messages: Message1.testMessage) + func fetchWaitingRoomInfo(roomId: String) async throws -> Manito.RoomInfoDTO { + let room = RoomInfoDTO( + roomInformation: RoomListItemDTO(id: 10, title: "목타이틀", state: "", participatingCount: 5, capacity: 10, startDate: "", endDate: ""), + participants: ParticipantListDTO(count: 5, members: UserInfoDTO.testUserList), + manittee: UserInfoDTO.testUserManitto, + manitto: UserInfoDTO.testUserManitto, + invitation: InvitationCodeDTO.testInvitationCodeDTO, + didViewRoulette: false, + mission: IndividualMissionDTO.testIndividualMissionDTO, + admin: false, + messages: MessageInfo.testMessageInfo) return room } - func patchStartManitto(roomId: String) async throws -> Manito.Manittee { - return Manittee.testManittee + func patchStartManitto(roomId: String) async throws -> Manito.UserInfoDTO { + return UserInfoDTO.testUserManitto } func deleteRoom(roomId: String) async throws -> Int { From 1383c213da6ce4d3742379161784743ed8d56b92 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 29 Aug 2023 16:43:30 +0900 Subject: [PATCH 391/468] =?UTF-8?q?[FEAT]=20=ED=9A=8C=EC=9B=90=ED=83=88?= =?UTF-8?q?=ED=87=B4=20=EC=9D=B4=ED=9B=84=20=ED=94=8C=EB=A1=9C=EC=9A=B0=20?= =?UTF-8?q?=EC=97=B0=EA=B2=B0=20(#474)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Supports/SceneDelegate.swift | 4 +++- .../CreateNickName/CreateNickNameViewController.swift | 10 ++++++++-- Manito/Manito/Screens/Login/LoginViewController.swift | 8 +++++--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Manito/Manito/Global/Supports/SceneDelegate.swift b/Manito/Manito/Global/Supports/SceneDelegate.swift index 3c84a2d22..5780fecd9 100644 --- a/Manito/Manito/Global/Supports/SceneDelegate.swift +++ b/Manito/Manito/Global/Supports/SceneDelegate.swift @@ -35,7 +35,9 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { extension SceneDelegate { func logout() { - window?.rootViewController = LoginViewController() + let viewController = UINavigationController(rootViewController: LoginViewController()) + viewController.navigationController?.navigationBar.isHidden = true + window?.rootViewController = viewController } func changeRootViewWithLetterView(roomId: Int) { diff --git a/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift b/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift index 719eb66d8..6b9a87c8c 100644 --- a/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift +++ b/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift @@ -68,8 +68,9 @@ class CreateNickNameViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() - setupDelegation() - setupNotificationCenter() + self.setupDelegation() + self.setupNotificationCenter() + self.configureNavigationBar() } // MARK: - API @@ -115,12 +116,17 @@ class CreateNickNameViewController: BaseViewController { } } + private func configureNavigationBar() { + self.navigationController?.navigationBar.isHidden = true + } + // MARK: - Seletors @objc private func didTapDoneButton() { if let text = roomsNameTextField.text, !text.isEmpty { nickname = text UserData.setValue(nickname, forKey: .nickname) + UserDefaultHandler.setIsSetFcmToken(isSetFcmToken: true) requestNickname(nickname: NicknameDTO(nickname: nickname)) presentMainViewController() } diff --git a/Manito/Manito/Screens/Login/LoginViewController.swift b/Manito/Manito/Screens/Login/LoginViewController.swift index 47ff9a97e..7b0f58eeb 100644 --- a/Manito/Manito/Screens/Login/LoginViewController.swift +++ b/Manito/Manito/Screens/Login/LoginViewController.swift @@ -106,9 +106,11 @@ extension LoginViewController: ASAuthorizationControllerDelegate { UserDefaultHandler.setAccessToken(accessToken: data.accessToken ?? "") UserDefaultHandler.setRefreshToken(refreshToken: data.refreshToken ?? "") - guard data.nickname != nil else { - self.navigationController?.pushViewController(CreateNickNameViewController(), animated: true) - return + if let isNewMember = data.isNewMember { + if isNewMember { + self.navigationController?.pushViewController(CreateNickNameViewController(), animated: true) + return + } } UserDefaultHandler.setNickname(nickname: data.nickname ?? "") From 0844d13d231e70711aa3ce465c7a77185f206ed2 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:06:21 +0900 Subject: [PATCH 392/468] =?UTF-8?q?[CHORE]=20=EB=B3=80=EC=88=98=EB=AA=85?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Data/Network/Foundation/Key.plist | 4 ++-- Manito/Manito/Global/Supports/SceneDelegate.swift | 2 +- Manito/Manito/Screens/Setting/SettingViewController.swift | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Manito/Manito/Data/Network/Foundation/Key.plist b/Manito/Manito/Data/Network/Foundation/Key.plist index 6dd25488a..050a08730 100644 --- a/Manito/Manito/Data/Network/Foundation/Key.plist +++ b/Manito/Manito/Data/Network/Foundation/Key.plist @@ -3,8 +3,8 @@ Development URL - https://ckyeon.store/api + Development URL을 입력해주세요. Production URL - https://dev.aenitto.shop/api + Production URL을 입력해주세요. diff --git a/Manito/Manito/Global/Supports/SceneDelegate.swift b/Manito/Manito/Global/Supports/SceneDelegate.swift index 5780fecd9..d9258637f 100644 --- a/Manito/Manito/Global/Supports/SceneDelegate.swift +++ b/Manito/Manito/Global/Supports/SceneDelegate.swift @@ -34,7 +34,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { } extension SceneDelegate { - func logout() { + func moveToLoginViewController() { let viewController = UINavigationController(rootViewController: LoginViewController()) viewController.navigationController?.navigationBar.isHidden = true window?.rootViewController = viewController diff --git a/Manito/Manito/Screens/Setting/SettingViewController.swift b/Manito/Manito/Screens/Setting/SettingViewController.swift index 7686e9f74..10494dc59 100644 --- a/Manito/Manito/Screens/Setting/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/SettingViewController.swift @@ -100,7 +100,7 @@ extension SettingViewController: SettingViewDelegate { UserDefaultHandler.clearAllDataExcludingFcmToken() guard let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate else { return } - sceneDelegate.logout() + sceneDelegate.moveToLoginViewController() }) } @@ -112,7 +112,7 @@ extension SettingViewController: SettingViewDelegate { UserDefaultHandler.clearAllDataExcludingFcmToken() guard let sceneDelgate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate else { return } - sceneDelgate.logout() + sceneDelgate.moveToLoginViewController() case .failure: print("error") } From b752c5b5555e985fe8bb107780c232a57192e5cf Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 29 Aug 2023 18:05:11 +0900 Subject: [PATCH 393/468] =?UTF-8?q?[CHORE]=20Input=20initialize=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModel/DetailWaitViewModel.swift | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 7f1f7c75e..22d880a3a 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -33,6 +33,22 @@ final class DetailWaitViewModel { let deleteMenuButtonDidTap: AnyPublisher let leaveMenuButtonDidTap: AnyPublisher let changeButtonDidTap: AnyPublisher + + init(viewDidLoad: AnyPublisher = Empty().eraseToAnyPublisher(), + codeCopyButtonDidTap: AnyPublisher = Empty().eraseToAnyPublisher(), + startButtonDidTap: AnyPublisher = Empty().eraseToAnyPublisher(), + editMenuButtonDidTap: AnyPublisher = Empty().eraseToAnyPublisher(), + deleteMenuButtonDidTap: AnyPublisher = Empty().eraseToAnyPublisher(), + leaveMenuButtonDidTap: AnyPublisher = Empty().eraseToAnyPublisher(), + changeButtonDidTap: AnyPublisher = Empty().eraseToAnyPublisher()) { + self.viewDidLoad = viewDidLoad + self.codeCopyButtonDidTap = codeCopyButtonDidTap + self.startButtonDidTap = startButtonDidTap + self.editMenuButtonDidTap = editMenuButtonDidTap + self.deleteMenuButtonDidTap = deleteMenuButtonDidTap + self.leaveMenuButtonDidTap = leaveMenuButtonDidTap + self.changeButtonDidTap = changeButtonDidTap + } } struct Output { @@ -56,7 +72,7 @@ final class DetailWaitViewModel { let codeOutput = input.codeCopyButtonDidTap .map { [weak self] _ -> String in guard let self else { return "" } - return self.makeCode() + return self.makeCode(roomInformation: self.roomInformationSubject.value) } .eraseToAnyPublisher() @@ -70,7 +86,7 @@ final class DetailWaitViewModel { let editRoomInformationOutput = input.editMenuButtonDidTap .map { [weak self] _ -> EditRoomInformation in guard let self else { return (RoomInfo.emptyRoom, .information) } - return self.makeEditRoomInformation() + return self.makeEditRoomInformation(roomInformation: self.roomInformationSubject.value) } .eraseToAnyPublisher() @@ -92,7 +108,7 @@ final class DetailWaitViewModel { .delay(for: 0.5, scheduler: DispatchQueue.main) .map { [weak self] _ -> PassedStartDateAndIsOwner in guard let self else { return (false, false) } - return self.makeIsAdmin() + return self.makeIsAdmin(roomInformation: self.roomInformationSubject.value) } .eraseToAnyPublisher() @@ -127,20 +143,17 @@ final class DetailWaitViewModel { return self.roomInformationSubject.value } - private func makeCode() -> String { - let roomInformation = self.roomInformationSubject.value + private func makeCode(roomInformation: RoomInfo) -> String { guard let code = roomInformation.invitation.code else { return "" } return code } - private func makeEditRoomInformation() -> EditRoomInformation { - let roomInformation = self.roomInformationSubject.value + private func makeEditRoomInformation(roomInformation: RoomInfo) -> EditRoomInformation { let editMode: DetailEditView.EditMode = .information return (roomInformation, editMode) } - private func makeIsAdmin() -> PassedStartDateAndIsOwner { - let roomInformation = self.roomInformationSubject.value + private func makeIsAdmin(roomInformation: RoomInfo) -> PassedStartDateAndIsOwner { return (roomInformation.roomInformation.isStartDatePast, roomInformation.admin) } From faf7942de1ad78a0ddf1045949a828630171564b Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 29 Aug 2023 18:05:38 +0900 Subject: [PATCH 394/468] =?UTF-8?q?[CHORE]=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=20=EC=8B=A4=ED=8C=A8=20=EC=88=98=EC=A0=95=20(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManitoTests/DetailWaitViewModelTest.swift | 112 +++++++++--------- 1 file changed, 53 insertions(+), 59 deletions(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index d57969dc6..9a7cdf18a 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -14,13 +14,6 @@ final class DetailWaitViewModelTest: XCTestCase { private var viewModel: DetailWaitViewModel! private var service: MockDetailWaitService! private var cancellable: Set! - private var testViewDidLoadSubject: PassthroughSubject! - private var testCodeCopyButtonDidTapSubject: PassthroughSubject! - private var testStartButtonDidTapSubject: PassthroughSubject! - private var testEditMenuButtonDidTapSubject: PassthroughSubject! - private var testDeleteMenuButtonDidTapSubject: PassthroughSubject! - private var testLeaveMenuButtonDidTapSubject: PassthroughSubject! - private var testChangeButtonDidTapSubject: PassthroughSubject! private var output: DetailWaitViewModel.Output! override func setUp() { @@ -28,22 +21,6 @@ final class DetailWaitViewModelTest: XCTestCase { self.service = MockDetailWaitService() self.viewModel = DetailWaitViewModel(roomIndex: 0, detailWaitService: self.service) self.cancellable = Set() - self.testViewDidLoadSubject = PassthroughSubject() - self.testCodeCopyButtonDidTapSubject = PassthroughSubject() - self.testStartButtonDidTapSubject = PassthroughSubject() - self.testEditMenuButtonDidTapSubject = PassthroughSubject() - self.testDeleteMenuButtonDidTapSubject = PassthroughSubject() - self.testLeaveMenuButtonDidTapSubject = PassthroughSubject() - self.testChangeButtonDidTapSubject = PassthroughSubject() - let input = DetailWaitViewModel.Input( - viewDidLoad: testViewDidLoadSubject.eraseToAnyPublisher(), - codeCopyButtonDidTap: testCodeCopyButtonDidTapSubject.eraseToAnyPublisher(), - startButtonDidTap: testStartButtonDidTapSubject.eraseToAnyPublisher(), - editMenuButtonDidTap: testEditMenuButtonDidTapSubject.eraseToAnyPublisher(), - deleteMenuButtonDidTap: testDeleteMenuButtonDidTapSubject.eraseToAnyPublisher(), - leaveMenuButtonDidTap: testLeaveMenuButtonDidTapSubject.eraseToAnyPublisher(), - changeButtonDidTap: testChangeButtonDidTapSubject.eraseToAnyPublisher()) - self.output = self.viewModel.transform(input) self.viewModel.setRoomInformation(room: RoomInfo.testRoom) } @@ -51,13 +28,6 @@ final class DetailWaitViewModelTest: XCTestCase { super.tearDown() self.viewModel = nil self.cancellable = nil - self.testViewDidLoadSubject = nil - self.testCodeCopyButtonDidTapSubject = nil - self.testStartButtonDidTapSubject = nil - self.testEditMenuButtonDidTapSubject = nil - self.testDeleteMenuButtonDidTapSubject = nil - self.testLeaveMenuButtonDidTapSubject = nil - self.testChangeButtonDidTapSubject = nil } func testMakeRoomInformation() { @@ -76,14 +46,17 @@ final class DetailWaitViewModelTest: XCTestCase { // given let checkCode = "ABCDEF" var testCode = "" + let testCodeCopyButtonDidTapSubject = PassthroughSubject() + let input = DetailWaitViewModel.Input(codeCopyButtonDidTap: testCodeCopyButtonDidTapSubject.eraseToAnyPublisher()) + let output = self.viewModel.transform(input) // when - self.output.code + output.code .sink { code in testCode = code } .store(in: &self.cancellable) - self.testCodeCopyButtonDidTapSubject.send(()) + testCodeCopyButtonDidTapSubject.send(()) // then XCTAssertEqual(checkCode, testCode) @@ -94,9 +67,12 @@ final class DetailWaitViewModelTest: XCTestCase { let checkRoom = mockRoom let expectation = XCTestExpectation(description: "roomInformation test") var testRoom = RoomInfo.emptyRoom - + let testViewDidLoadSubject = PassthroughSubject() + let input = DetailWaitViewModel.Input(viewDidLoad: testViewDidLoadSubject.eraseToAnyPublisher()) + let output = self.viewModel.transform(input) + // when - self.output.roomInformation + output.roomInformation .sink(receiveCompletion: { result in switch result { case .failure: @@ -109,8 +85,8 @@ final class DetailWaitViewModelTest: XCTestCase { expectation.fulfill() }) .store(in: &self.cancellable) - self.testViewDidLoadSubject.send(()) - + testViewDidLoadSubject.send(()) + // then wait(for: [expectation], timeout: 5) XCTAssertEqual(checkRoom, testRoom) @@ -121,9 +97,12 @@ final class DetailWaitViewModelTest: XCTestCase { let checkNickname = "테스트마니띠" let expectation = XCTestExpectation(description: "startButton test") var testNickname = "" - + let testStartButtonDidTapSubject = PassthroughSubject() + let input = DetailWaitViewModel.Input(startButtonDidTap: testStartButtonDidTapSubject.eraseToAnyPublisher()) + let output = self.viewModel.transform(input) + // when - self.output.manitteeNickname + output.manitteeNickname .sink(receiveCompletion: { result in switch result { case .finished: @@ -136,8 +115,8 @@ final class DetailWaitViewModelTest: XCTestCase { expectation.fulfill() }) .store(in: &self.cancellable) - self.testStartButtonDidTapSubject.send(()) - + testStartButtonDidTapSubject.send(()) + // then wait(for: [expectation], timeout: 5) XCTAssertEqual(checkNickname, testNickname) @@ -150,9 +129,12 @@ final class DetailWaitViewModelTest: XCTestCase { let expectation = XCTestExpectation(description: "editButton test") var testRoom = RoomInfo.emptyRoom var testMode: DetailEditView.EditMode = .date - + let testEditMenuButtonDidTapSubject = PassthroughSubject() + let input = DetailWaitViewModel.Input(editMenuButtonDidTap: testEditMenuButtonDidTapSubject.eraseToAnyPublisher()) + let output = self.viewModel.transform(input) + // when - self.output.editRoomInformation + output.editRoomInformation .sink(receiveCompletion: { result in switch result { case .finished: @@ -166,8 +148,8 @@ final class DetailWaitViewModelTest: XCTestCase { expectation.fulfill() }) .store(in: &self.cancellable) - self.testEditMenuButtonDidTapSubject.send(()) - + testEditMenuButtonDidTapSubject.send(()) + // then wait(for: [expectation], timeout: 5) XCTAssertEqual(checkRoom, testRoom) @@ -178,9 +160,12 @@ final class DetailWaitViewModelTest: XCTestCase { // given let expectation = XCTestExpectation(description: "deleteButton test") var testBool = false - + let testDeleteMenuButtonDidTapSubject = PassthroughSubject() + let input = DetailWaitViewModel.Input(deleteMenuButtonDidTap: testDeleteMenuButtonDidTapSubject.eraseToAnyPublisher()) + let output = self.viewModel.transform(input) + // when - self.output.deleteRoom + output.deleteRoom .sink(receiveCompletion: { result in switch result { case .finished: @@ -193,8 +178,8 @@ final class DetailWaitViewModelTest: XCTestCase { expectation.fulfill() }) .store(in: &self.cancellable) - self.testDeleteMenuButtonDidTapSubject.send(()) - + testDeleteMenuButtonDidTapSubject.send(()) + // then wait(for: [expectation], timeout: 5) XCTAssertTrue(testBool) @@ -204,9 +189,12 @@ final class DetailWaitViewModelTest: XCTestCase { // given let expectation = XCTestExpectation(description: "leaveButton test") var testBool = false + let testLeaveMenuButtonDidTapSubject = PassthroughSubject() + let input = DetailWaitViewModel.Input(leaveMenuButtonDidTap: testLeaveMenuButtonDidTapSubject.eraseToAnyPublisher()) + let output = self.viewModel.transform(input) // when - self.output.leaveRoom + output.leaveRoom .sink(receiveCompletion: { result in switch result { case .finished: @@ -219,8 +207,8 @@ final class DetailWaitViewModelTest: XCTestCase { expectation.fulfill() }) .store(in: &self.cancellable) - self.testLeaveMenuButtonDidTapSubject.send(()) - + testLeaveMenuButtonDidTapSubject.send(()) + // then wait(for: [expectation], timeout: 5) XCTAssertTrue(testBool) @@ -231,10 +219,13 @@ final class DetailWaitViewModelTest: XCTestCase { let checkRoom = mockRoom let expectation = XCTestExpectation(description: "changeButton test") var testRoom = RoomInfo.emptyRoom - + let testChangeButtonDidTapSubject = PassthroughSubject() + let input = DetailWaitViewModel.Input(changeButtonDidTap: testChangeButtonDidTapSubject.eraseToAnyPublisher()) + let _ = self.viewModel.transform(input) + // when - self.testChangeButtonDidTapSubject.send(()) - + testChangeButtonDidTapSubject.send(()) + // then DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { testRoom = self.viewModel.makeRoomInformation() @@ -249,10 +240,13 @@ final class DetailWaitViewModelTest: XCTestCase { let checkRoom = mockRoom let expectation = XCTestExpectation(description: "viewDidLoad test") var testRoom = RoomInfo.emptyRoom - + let testViewDidLoadSubject = PassthroughSubject() + let input = DetailWaitViewModel.Input(viewDidLoad: testViewDidLoadSubject.eraseToAnyPublisher()) + let _ = self.viewModel.transform(input) + // when - self.testViewDidLoadSubject.send() - + testViewDidLoadSubject.send() + // then DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { testRoom = self.viewModel.makeRoomInformation() @@ -282,7 +276,7 @@ final class MockDetailWaitService: DetailWaitServicable { // FIXME: - network mocking 만들어야함. func fetchWaitingRoomInfo(roomId: String) async throws -> Manito.RoomInfoDTO { let room = RoomInfoDTO( - roomInformation: RoomListItemDTO(id: 10, title: "목타이틀", state: "", participatingCount: 5, capacity: 10, startDate: "", endDate: ""), + roomInformation: RoomListItemDTO(id: 10, title: "목타이틀", state: "", participatingCount: 10, capacity: 10, startDate: "", endDate: ""), participants: ParticipantListDTO(count: 5, members: UserInfoDTO.testUserList), manittee: UserInfoDTO.testUserManitto, manitto: UserInfoDTO.testUserManitto, @@ -295,7 +289,7 @@ final class MockDetailWaitService: DetailWaitServicable { } func patchStartManitto(roomId: String) async throws -> Manito.UserInfoDTO { - return UserInfoDTO.testUserManitto + return UserInfoDTO.testUserManittee } func deleteRoom(roomId: String) async throws -> Int { From da5b0b16b26bc86f8621bfdf4cf63b6a3a9d0734 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 29 Aug 2023 18:29:06 +0900 Subject: [PATCH 395/468] =?UTF-8?q?[CHORE]=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EB=A5=BC=20=EC=9C=84=ED=95=9C=20private=20=EC=A0=9C=EA=B1=B0?= =?UTF-8?q?=20(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index 22d880a3a..f44978029 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -143,17 +143,17 @@ final class DetailWaitViewModel { return self.roomInformationSubject.value } - private func makeCode(roomInformation: RoomInfo) -> String { + func makeCode(roomInformation: RoomInfo) -> String { guard let code = roomInformation.invitation.code else { return "" } return code } - private func makeEditRoomInformation(roomInformation: RoomInfo) -> EditRoomInformation { + func makeEditRoomInformation(roomInformation: RoomInfo) -> EditRoomInformation { let editMode: DetailEditView.EditMode = .information return (roomInformation, editMode) } - private func makeIsAdmin(roomInformation: RoomInfo) -> PassedStartDateAndIsOwner { + func makeIsAdmin(roomInformation: RoomInfo) -> PassedStartDateAndIsOwner { return (roomInformation.roomInformation.isStartDatePast, roomInformation.admin) } From 303e58332cd4daf6d0a78d22d905a92a8a573d6d Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 29 Aug 2023 18:29:24 +0900 Subject: [PATCH 396/468] =?UTF-8?q?[ADD]=20make=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=EC=BD=94=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManitoTests/DetailWaitViewModelTest.swift | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index 9a7cdf18a..fbbfff92e 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -30,6 +30,43 @@ final class DetailWaitViewModelTest: XCTestCase { self.cancellable = nil } + func testMakeCode() { + // given + let checkCode = "ABCDEF" + + // when + let code = self.viewModel.makeCode(roomInformation: RoomInfo.testRoom) + + // then + XCTAssertEqual(checkCode, code) + } + + func testMakeEditRoomInformation() { + // given + let checkRoom = RoomInfo.testRoom + let checkEditMode: DetailEditView.EditMode = .information + + // when + let editRoomInformation = self.viewModel.makeEditRoomInformation(roomInformation: checkRoom) + + // then + XCTAssertEqual(checkRoom, editRoomInformation.roomInformation) + XCTAssertEqual(checkEditMode, editRoomInformation.mode) + } + + func testMakeIsAdmin() { + // given + let checkIsStartDatePast = true + let checkIsAdmin = false + + // when + let passedStartDateAndIsOwner = self.viewModel.makeIsAdmin(roomInformation: RoomInfo.testRoom) + + // then + XCTAssertEqual(checkIsStartDatePast, passedStartDateAndIsOwner.passStartDate) + XCTAssertEqual(checkIsAdmin, passedStartDateAndIsOwner.isOwner) + } + func testMakeRoomInformation() { // given let checkRoom = RoomInfo.testRoom From 072b7f591cd58132c43f0303cef59b2d24595f4e Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 29 Aug 2023 20:47:05 +0900 Subject: [PATCH 397/468] [CHORE] deleteMember -> deleteUser (#474) --- Manito/Manito/Data/Network/EndPoint/SettingEndPoint.swift | 8 ++++---- Manito/Manito/Data/Repository/SettingRepository.swift | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Manito/Manito/Data/Network/EndPoint/SettingEndPoint.swift b/Manito/Manito/Data/Network/EndPoint/SettingEndPoint.swift index 581d9611e..3cf9dd216 100644 --- a/Manito/Manito/Data/Network/EndPoint/SettingEndPoint.swift +++ b/Manito/Manito/Data/Network/EndPoint/SettingEndPoint.swift @@ -11,7 +11,7 @@ import MTNetwork enum SettingEndPoint { case putUserInfo(nickname: NicknameDTO) - case deleteMember + case deleteUser } extension SettingEndPoint: Requestable { @@ -23,7 +23,7 @@ extension SettingEndPoint: Requestable { switch self { case .putUserInfo: return "/v1/members/nickname" - case .deleteMember: + case .deleteUser: return "/v1/members" } } @@ -32,7 +32,7 @@ extension SettingEndPoint: Requestable { switch self { case .putUserInfo: return .put - case .deleteMember: + case .deleteUser: return .delete } } @@ -41,7 +41,7 @@ extension SettingEndPoint: Requestable { switch self { case .putUserInfo(let nickname): return .requestJSONEncodable(nickname) - case .deleteMember: + case .deleteUser: return .requestPlain } } diff --git a/Manito/Manito/Data/Repository/SettingRepository.swift b/Manito/Manito/Data/Repository/SettingRepository.swift index deb78e500..fd4502f9b 100644 --- a/Manito/Manito/Data/Repository/SettingRepository.swift +++ b/Manito/Manito/Data/Repository/SettingRepository.swift @@ -26,7 +26,7 @@ final class SettingRepositoryImpl: SettingRepository { func deleteMember() async throws -> Int { let response = try await self.provider - .request(.deleteMember) + .request(.deleteUser) return response.statusCode } } From f98be906abf1af139a9fb8aa2c6d3a8a96915578 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 29 Aug 2023 20:50:20 +0900 Subject: [PATCH 398/468] =?UTF-8?q?[CHORE]=20=ED=9A=8C=EC=9B=90=ED=83=88?= =?UTF-8?q?=ED=87=B4=20=EC=8B=A4=ED=8C=A8=EC=8B=9C=20=EC=95=8C=EB=9F=BF?= =?UTF-8?q?=EC=B0=BD=20=EB=9D=84=EC=9A=B0=EA=B8=B0=20(#474)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Setting/SettingViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Setting/SettingViewController.swift b/Manito/Manito/Screens/Setting/SettingViewController.swift index 10494dc59..469436557 100644 --- a/Manito/Manito/Screens/Setting/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/SettingViewController.swift @@ -114,7 +114,7 @@ extension SettingViewController: SettingViewDelegate { as? SceneDelegate else { return } sceneDelgate.moveToLoginViewController() case .failure: - print("error") + self?.makeAlert(title: "실패", message: "회원탈퇴에 실패했습니다. 다시 시도하여주십시오.") } } } From b767baa9e79b0c40c7ba9e78e5fb49304c472204 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 29 Aug 2023 21:01:05 +0900 Subject: [PATCH 399/468] =?UTF-8?q?[CHORE]=20=EB=A1=9C=EA=B7=B8=EC=9D=B8?= =?UTF-8?q?=20=EB=B7=B0=EC=BB=A8=EC=97=90=20naviBar=20=ED=9E=88=EB=93=A0?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20(#474)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Supports/SceneDelegate.swift | 1 - .../CreateNickName/CreateNickNameViewController.swift | 5 ----- Manito/Manito/Screens/Login/LoginViewController.swift | 5 +++++ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Manito/Manito/Global/Supports/SceneDelegate.swift b/Manito/Manito/Global/Supports/SceneDelegate.swift index d9258637f..200ccf860 100644 --- a/Manito/Manito/Global/Supports/SceneDelegate.swift +++ b/Manito/Manito/Global/Supports/SceneDelegate.swift @@ -36,7 +36,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { extension SceneDelegate { func moveToLoginViewController() { let viewController = UINavigationController(rootViewController: LoginViewController()) - viewController.navigationController?.navigationBar.isHidden = true window?.rootViewController = viewController } diff --git a/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift b/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift index 6b9a87c8c..c8d1c5d1b 100644 --- a/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift +++ b/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift @@ -70,7 +70,6 @@ class CreateNickNameViewController: BaseViewController { super.viewDidLoad() self.setupDelegation() self.setupNotificationCenter() - self.configureNavigationBar() } // MARK: - API @@ -116,10 +115,6 @@ class CreateNickNameViewController: BaseViewController { } } - private func configureNavigationBar() { - self.navigationController?.navigationBar.isHidden = true - } - // MARK: - Seletors @objc private func didTapDoneButton() { diff --git a/Manito/Manito/Screens/Login/LoginViewController.swift b/Manito/Manito/Screens/Login/LoginViewController.swift index 7b0f58eeb..b0098ca05 100644 --- a/Manito/Manito/Screens/Login/LoginViewController.swift +++ b/Manito/Manito/Screens/Login/LoginViewController.swift @@ -37,6 +37,7 @@ final class LoginViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() self.setupLoginButton() + self.configureNavigationBar() } // MARK: - override @@ -66,6 +67,10 @@ final class LoginViewController: BaseViewController { // MARK: - func + private func configureNavigationBar() { + self.navigationController?.navigationBar.isHidden = true + } + private func setupLoginButton() { let action = UIAction { [weak self] _ in self?.appleSignIn() From fb85cc5621766a61f71e6d9ae291b024e6aac0d3 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 29 Aug 2023 21:45:35 +0900 Subject: [PATCH 400/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20-=20=EC=BD=A4=EB=A7=88?= =?UTF-8?q?=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift index 135bda57e..905a4c16c 100644 --- a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift +++ b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift @@ -174,8 +174,8 @@ final class CreateRoomViewModel: ViewModelType { let roomId = try await self.createRoomService.dispatchCreateRoom(room: CreatedRoomRequestDTO(room: CreatedRoomInfoRequestDTO(title: roomInfo.title, capacity: roomInfo.capacity, startDate: "20\(roomInfo.startDate)", - endDate: "20\(roomInfo.endDate)") - , member: MemberInfoRequestDTO(colorIndex: self.characterIndexSubject.value))) + endDate: "20\(roomInfo.endDate)"), + member: MemberInfoRequestDTO(colorIndex: self.characterIndexSubject.value))) self.roomIdSubject.send(roomId) } catch(let error) { guard let error = error as? NetworkError else { return } From ed2afb91c89697a8253e1864a2bb7c20014cc284 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 29 Aug 2023 21:56:34 +0900 Subject: [PATCH 401/468] =?UTF-8?q?[CHORE]=20TextLiteral=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20(#474)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Literal/TextLiteral.swift | 6 ++++++ Manito/Manito/Screens/Setting/SettingViewController.swift | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Global/Literal/TextLiteral.swift b/Manito/Manito/Global/Literal/TextLiteral.swift index 71450fd09..6908a861f 100644 --- a/Manito/Manito/Global/Literal/TextLiteral.swift +++ b/Manito/Manito/Global/Literal/TextLiteral.swift @@ -36,6 +36,8 @@ enum TextLiteral { static let next: String = "다음" static let previous: String = "이전" static let errorAlertTitle: String = "오류 발생" + static let alert: String = "경고" + static let fail: String = "실패" // MARK: - SettingDeveloperInfo static let settingDeveloperInfoTitle: String = "개발자 정보" @@ -48,6 +50,10 @@ enum TextLiteral { static let settingViewControllerHelpTitle: String = "문의하기" static let settingViewControllerLogoutTitle: String = "로그아웃" static let settingViewControllerWithdrawalTitle: String = "서비스 탈퇴" + static let settingViewControllerLogoutAlertTitle: String = "로그아웃 하시겠습니까?" + static let settingViewControllerWithdrawalMessage: String = "회원탈퇴 시 지금까지 내용이 전부 삭제됩니다. \n 탈퇴 하시겠습니까?" + static let settingViewControllerWithdrawal: String = "탈퇴" + static let settingViewControllerFailMessage: String = "회원탈퇴에 실패했습니다. 다시 시도해주세요." // MARK: - CreateNickNameViewController static let createNickNameViewControllerTitle: String = "닉네임 설정" diff --git a/Manito/Manito/Screens/Setting/SettingViewController.swift b/Manito/Manito/Screens/Setting/SettingViewController.swift index 469436557..7be9fd85e 100644 --- a/Manito/Manito/Screens/Setting/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/SettingViewController.swift @@ -96,7 +96,7 @@ extension SettingViewController: SettingViewDelegate { } func logoutButtonDidTap() { - self.makeRequestAlert(title: "로그아웃 하시겠습니까?", message: "", okTitle: "확인", cancelTitle: "취소", okAction: { _ in + self.makeRequestAlert(title: TextLiteral.settingViewControllerLogoutAlertTitle, message: "", okTitle: TextLiteral.confirm, cancelTitle: TextLiteral.cancel, okAction: { _ in UserDefaultHandler.clearAllDataExcludingFcmToken() guard let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate else { return } @@ -105,7 +105,7 @@ extension SettingViewController: SettingViewDelegate { } func withdrawalButtonDidTap() { - self.makeRequestAlert(title: "경고", message: "회원탈퇴 시 지금까지 내용이 전부 삭제됩니다. \n 탈퇴 하시겠습니까?", okTitle: "탈퇴") { [weak self] _ in + self.makeRequestAlert(title: TextLiteral.alert, message: TextLiteral.settingViewControllerWithdrawalMessage, okTitle: TextLiteral.settingViewControllerWithdrawal) { [weak self] _ in self?.requestDeleteMember() { result in switch result { case .success: @@ -114,7 +114,7 @@ extension SettingViewController: SettingViewDelegate { as? SceneDelegate else { return } sceneDelgate.moveToLoginViewController() case .failure: - self?.makeAlert(title: "실패", message: "회원탈퇴에 실패했습니다. 다시 시도하여주십시오.") + self?.makeAlert(title: TextLiteral.fail, message: TextLiteral.settingViewControllerFailMessage) } } } From 46de88e547e79940e2690c24fca54796499fccf7 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 29 Aug 2023 22:07:17 +0900 Subject: [PATCH 402/468] =?UTF-8?q?[CHORE]=20UX=20=ED=86=B5=EC=9D=BC=20(?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20->=20=EC=84=9C=EB=B9=84=EC=8A=A4)=20(#474)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Global/Literal/TextLiteral.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Global/Literal/TextLiteral.swift b/Manito/Manito/Global/Literal/TextLiteral.swift index 6908a861f..9ef2500bc 100644 --- a/Manito/Manito/Global/Literal/TextLiteral.swift +++ b/Manito/Manito/Global/Literal/TextLiteral.swift @@ -51,9 +51,9 @@ enum TextLiteral { static let settingViewControllerLogoutTitle: String = "로그아웃" static let settingViewControllerWithdrawalTitle: String = "서비스 탈퇴" static let settingViewControllerLogoutAlertTitle: String = "로그아웃 하시겠습니까?" - static let settingViewControllerWithdrawalMessage: String = "회원탈퇴 시 지금까지 내용이 전부 삭제됩니다. \n 탈퇴 하시겠습니까?" + static let settingViewControllerWithdrawalMessage: String = "서비스 탈퇴 시 지금까지 내용이 전부 삭제됩니다. \n 탈퇴 하시겠습니까?" static let settingViewControllerWithdrawal: String = "탈퇴" - static let settingViewControllerFailMessage: String = "회원탈퇴에 실패했습니다. 다시 시도해주세요." + static let settingViewControllerFailMessage: String = "서비스 탈퇴에 실패했습니다. 다시 시도해주세요." // MARK: - CreateNickNameViewController static let createNickNameViewControllerTitle: String = "닉네임 설정" From 9f6cd476bcd367709c06e8e76c8de847a1a5a2fd Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Tue, 29 Aug 2023 23:35:25 +0900 Subject: [PATCH 403/468] =?UTF-8?q?[FEAT]=20View=20=EC=97=90=EC=84=9C=20Vi?= =?UTF-8?q?ewModel=EB=A1=9C=20fixedtitle=20=EB=84=98=EA=B8=B0=EA=B8=B0=20+?= =?UTF-8?q?=20=ED=8D=BC=EB=B8=94=EB=A6=AC=EC=85=94=20share=20=ED=95=98?= =?UTF-8?q?=EA=B8=B0=20(#483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreateRoom/CreateRoomViewController.swift | 8 ++---- .../UIComponent/InputTitleView.swift | 11 +++----- .../ViewModel/CreateRoomViewModel.swift | 28 +++++++++++-------- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index 6195428e2..4de73fb15 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -105,11 +105,9 @@ final class CreateRoomViewController: BaseViewController { }) .store(in: &self.cancellable) - output.isOverMaxCount - .sink(receiveValue: { [weak self] isOverMaxCount in - if isOverMaxCount { - self?.createRoomView.roomTitleView.updateTextFieldText(maxLength: self?.createRoomViewModel.maxCount ?? 0) - } + output.fixedTitleByMaxCount + .sink(receiveValue: { [weak self] fixedTitle in + self?.createRoomView.roomTitleView.updateTextFieldText(fixedTitle: fixedTitle) }) .store(in: &self.cancellable) diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift index 88fe05acd..56dd562c9 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift @@ -73,13 +73,10 @@ final class InputTitleView: UIView { } } - func updateTextFieldText(maxLength: Int) { - guard let text = self.roomsNameTextField.text else { return } - let endIndex = text.index(text.startIndex, offsetBy: maxLength) - let fixedText = text[text.startIndex.. - let isOverMaxCount: AnyPublisher + let fixedTitleByMaxCount: AnyPublisher let capacity: CurrentValueSubject let dateRange: PassthroughSubject let isEnabled: AnyPublisher @@ -49,18 +49,22 @@ final class CreateRoomViewModel: ViewModelType { } func transform(from input: Input) -> Output { - input.textFieldTextDidChanged - .sink(receiveValue: { [weak self] title in - self?.titleSubject.send(title) - }) - .store(in: &self.cancellable) - - let isOverMaxCount = input.textFieldTextDidChanged - .map { [weak self] text -> Bool in - return self?.isOverMaxCount(titleCount: text.count, maxCount: self?.maxCount ?? 0) ?? false + let fixedTitle = input.textFieldTextDidChanged + .map { [weak self] text -> String in + let isOverMaxCount = self?.isOverMaxCount(titleCount: text.count, maxCount: self?.maxCount ?? 0) ?? false + + if isOverMaxCount { + let endIndex = text.index(text.startIndex, offsetBy: self?.maxCount ?? 0) + let fixedText = text[text.startIndex.. Date: Fri, 1 Sep 2023 16:26:08 +0900 Subject: [PATCH 404/468] =?UTF-8?q?[CHORE]=20=ED=8F=B4=EB=8D=94=EA=B5=AC?= =?UTF-8?q?=EC=A1=B0=20=EC=A0=95=EB=A6=AC=20(#505)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 44 ++++++++++++++++--- .../Setting/Service/SettingService.swift | 8 ++++ .../ImageRowView.swift | 0 .../ChangeNickNameViewController.swift | 0 ...er+MailComposeViewControllerDelegate.swift | 0 .../SettingViewController.swift | 0 .../Setting/ViewModel/SettingViewModel.swift | 8 ++++ 7 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 Manito/Manito/Screens/Setting/Service/SettingService.swift rename Manito/Manito/Screens/Setting/{Component => UIComponent}/ImageRowView.swift (100%) rename Manito/Manito/Screens/Setting/{ => ViewControllers}/ChangeNickNameViewController.swift (100%) rename Manito/Manito/Screens/Setting/{ => ViewControllers}/SettingViewController+MailComposeViewControllerDelegate.swift (100%) rename Manito/Manito/Screens/Setting/{ => ViewControllers}/SettingViewController.swift (100%) create mode 100644 Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 049926950..98460b176 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -166,6 +166,8 @@ CBA4D7A62856D48C0018BDC2 /* RoomStateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBA4D7A52856D48C0018BDC2 /* RoomStateView.swift */; }; CBBFF77C287AE491006A5964 /* DeveloperInfoViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBBFF77B287AE491006A5964 /* DeveloperInfoViewCell.swift */; }; D70220232A7A22EC0024BACD /* CreateRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D70220222A7A22EC0024BACD /* CreateRoomView.swift */; }; + D71939532AA1C84900A73D6C /* SettingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D71939522AA1C84900A73D6C /* SettingService.swift */; }; + D71939552AA1C85300A73D6C /* SettingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D71939542AA1C85300A73D6C /* SettingViewModel.swift */; }; D724AF5D287088310003F280 /* SettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5C287088310003F280 /* SettingViewController.swift */; }; D724AF5F28708D830003F280 /* ImageRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5E28708D830003F280 /* ImageRowView.swift */; }; D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = D739C36628C7B82500161117 /* NicknameDTO.swift */; }; @@ -366,6 +368,8 @@ CBA4D7A52856D48C0018BDC2 /* RoomStateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomStateView.swift; sourceTree = ""; }; CBBFF77B287AE491006A5964 /* DeveloperInfoViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeveloperInfoViewCell.swift; sourceTree = ""; }; D70220222A7A22EC0024BACD /* CreateRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomView.swift; sourceTree = ""; }; + D71939522AA1C84900A73D6C /* SettingService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingService.swift; sourceTree = ""; }; + D71939542AA1C85300A73D6C /* SettingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewModel.swift; sourceTree = ""; }; D724AF5C287088310003F280 /* SettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewController.swift; sourceTree = ""; }; D724AF5E28708D830003F280 /* ImageRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageRowView.swift; sourceTree = ""; }; D739C36628C7B82500161117 /* NicknameDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameDTO.swift; sourceTree = ""; }; @@ -1175,16 +1179,42 @@ path = View; sourceTree = ""; }; - D724AF5B287088110003F280 /* Setting */ = { + D71939502AA1C82100A73D6C /* Service */ = { + isa = PBXGroup; + children = ( + D71939522AA1C84900A73D6C /* SettingService.swift */, + ); + path = Service; + sourceTree = ""; + }; + D71939512AA1C82F00A73D6C /* ViewModel */ = { + isa = PBXGroup; + children = ( + D71939542AA1C85300A73D6C /* SettingViewModel.swift */, + ); + path = ViewModel; + sourceTree = ""; + }; + D71939562AA1C86600A73D6C /* ViewControllers */ = { isa = PBXGroup; children = ( - D7C4A1AE2A0E51F500C3AE4C /* View */, - D75ECB6E28A5EDC400A5B271 /* Component */, - D75ECB6D28A5EDBC00A5B271 /* Cell */, D724AF5C287088310003F280 /* SettingViewController.swift */, D7C4A1AF2A0E522800C3AE4C /* SettingViewController+MailComposeViewControllerDelegate.swift */, 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */, ); + path = ViewControllers; + sourceTree = ""; + }; + D724AF5B287088110003F280 /* Setting */ = { + isa = PBXGroup; + children = ( + D71939502AA1C82100A73D6C /* Service */, + D71939512AA1C82F00A73D6C /* ViewModel */, + D7C4A1AE2A0E51F500C3AE4C /* View */, + D75ECB6E28A5EDC400A5B271 /* UIComponent */, + D75ECB6D28A5EDBC00A5B271 /* Cell */, + D71939562AA1C86600A73D6C /* ViewControllers */, + ); path = Setting; sourceTree = ""; }; @@ -1204,12 +1234,12 @@ path = Cell; sourceTree = ""; }; - D75ECB6E28A5EDC400A5B271 /* Component */ = { + D75ECB6E28A5EDC400A5B271 /* UIComponent */ = { isa = PBXGroup; children = ( D724AF5E28708D830003F280 /* ImageRowView.swift */, ); - path = Component; + path = UIComponent; sourceTree = ""; }; D79E9D882A826D7900C031F0 /* ViewModel */ = { @@ -1504,6 +1534,7 @@ B5F31C5028BF922E00F61D0F /* LetterViewController+MailCompose.swift in Sources */, 7E3058CA2854B7A900489E6A /* InputDateView.swift in Sources */, D7B6C97C2858B2D40024F326 /* CheckRoomInfoView.swift in Sources */, + D71939532AA1C84900A73D6C /* SettingService.swift in Sources */, B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */, B5F31BB228BE1CD700F61D0F /* UserDefaultHandler.swift in Sources */, CB9592B52855D52700847751 /* CommonMissionView.swift in Sources */, @@ -1521,6 +1552,7 @@ 3915D54D2A7516E9002D6C25 /* Key+Extension.swift in Sources */, B5A085EE2A9731F000C8A98D /* DailyMissionDTO.swift in Sources */, 33BDF5622856E03800564211 /* FriendListViewController.swift in Sources */, + D71939552AA1C85300A73D6C /* SettingViewModel.swift in Sources */, B5F5250E2851A07700614FF7 /* LetterViewController.swift in Sources */, B5F5251C2851A19A00614FF7 /* BaseCollectionViewCell.swift in Sources */, B5F525082851A05E00614FF7 /* InvitedCodeViewController.swift in Sources */, diff --git a/Manito/Manito/Screens/Setting/Service/SettingService.swift b/Manito/Manito/Screens/Setting/Service/SettingService.swift new file mode 100644 index 000000000..ee653f97e --- /dev/null +++ b/Manito/Manito/Screens/Setting/Service/SettingService.swift @@ -0,0 +1,8 @@ +// +// SettingService.swift +// Manito +// +// Created by 이성호 on 2023/09/01. +// + +import Foundation diff --git a/Manito/Manito/Screens/Setting/Component/ImageRowView.swift b/Manito/Manito/Screens/Setting/UIComponent/ImageRowView.swift similarity index 100% rename from Manito/Manito/Screens/Setting/Component/ImageRowView.swift rename to Manito/Manito/Screens/Setting/UIComponent/ImageRowView.swift diff --git a/Manito/Manito/Screens/Setting/ChangeNickNameViewController.swift b/Manito/Manito/Screens/Setting/ViewControllers/ChangeNickNameViewController.swift similarity index 100% rename from Manito/Manito/Screens/Setting/ChangeNickNameViewController.swift rename to Manito/Manito/Screens/Setting/ViewControllers/ChangeNickNameViewController.swift diff --git a/Manito/Manito/Screens/Setting/SettingViewController+MailComposeViewControllerDelegate.swift b/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController+MailComposeViewControllerDelegate.swift similarity index 100% rename from Manito/Manito/Screens/Setting/SettingViewController+MailComposeViewControllerDelegate.swift rename to Manito/Manito/Screens/Setting/ViewControllers/SettingViewController+MailComposeViewControllerDelegate.swift diff --git a/Manito/Manito/Screens/Setting/SettingViewController.swift b/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift similarity index 100% rename from Manito/Manito/Screens/Setting/SettingViewController.swift rename to Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift diff --git a/Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift b/Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift new file mode 100644 index 000000000..7768360dd --- /dev/null +++ b/Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift @@ -0,0 +1,8 @@ +// +// SettingViewModel.swift +// Manito +// +// Created by 이성호 on 2023/09/01. +// + +import Foundation From 42487be98771e902e272566e5e5667833a9502eb Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Fri, 1 Sep 2023 16:27:25 +0900 Subject: [PATCH 405/468] =?UTF-8?q?[CHORE]=20ChangeNickname=20VC=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC=20(#505)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 10 +++++++++- .../ChangeNickNameViewController.swift | 0 2 files changed, 9 insertions(+), 1 deletion(-) rename Manito/Manito/Screens/{Setting/ViewControllers => ChangeNickname}/ChangeNickNameViewController.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 98460b176..d9afd097a 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -828,6 +828,7 @@ D724AF5B287088110003F280 /* Setting */, B50B1B28285AB7550080992C /* Splash */, 39C957CC2876E2BE00A04A2B /* Login */, + D71939572AA1C9A000A73D6C /* ChangeNickname */, 7E0C5C342855B1EF00F698D1 /* CreateNickName */, B5F524E628519B0A00614FF7 /* Main */, B50B1B3F285B047C0080992C /* Interaction */, @@ -1200,11 +1201,18 @@ children = ( D724AF5C287088310003F280 /* SettingViewController.swift */, D7C4A1AF2A0E522800C3AE4C /* SettingViewController+MailComposeViewControllerDelegate.swift */, - 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */, ); path = ViewControllers; sourceTree = ""; }; + D71939572AA1C9A000A73D6C /* ChangeNickname */ = { + isa = PBXGroup; + children = ( + 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */, + ); + path = ChangeNickname; + sourceTree = ""; + }; D724AF5B287088110003F280 /* Setting */ = { isa = PBXGroup; children = ( diff --git a/Manito/Manito/Screens/Setting/ViewControllers/ChangeNickNameViewController.swift b/Manito/Manito/Screens/ChangeNickname/ChangeNickNameViewController.swift similarity index 100% rename from Manito/Manito/Screens/Setting/ViewControllers/ChangeNickNameViewController.swift rename to Manito/Manito/Screens/ChangeNickname/ChangeNickNameViewController.swift From 200406e31a75efc95a8afef57c89b49f7306bdf3 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Fri, 1 Sep 2023 17:12:06 +0900 Subject: [PATCH 406/468] =?UTF-8?q?[REFACTOR]=20MVVM=20+=20Combine=20?= =?UTF-8?q?=ED=98=95=ED=83=9C=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#505)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Main/MainViewController.swift | 2 +- .../Setting/Service/SettingService.swift | 24 +++++++ .../Screens/Setting/View/SettingView.swift | 3 + .../SettingViewController.swift | 68 ++++++++++++------- .../Setting/ViewModel/SettingViewModel.swift | 54 +++++++++++++++ 5 files changed, 124 insertions(+), 27 deletions(-) diff --git a/Manito/Manito/Screens/Main/MainViewController.swift b/Manito/Manito/Screens/Main/MainViewController.swift index 7fedd8439..b87e0a578 100644 --- a/Manito/Manito/Screens/Main/MainViewController.swift +++ b/Manito/Manito/Screens/Main/MainViewController.swift @@ -55,7 +55,7 @@ final class MainViewController: BaseViewController { private lazy var settingButton: SettingButton = { let button = SettingButton() let action = UIAction { [weak self] _ in - self?.navigationController?.pushViewController(SettingViewController(), animated: true) + self?.navigationController?.pushViewController(SettingViewController(viewModel: SettingViewModel(settingService: SettingService(repository: SettingRepositoryImpl()))), animated: true) } button.addAction(action, for: .touchUpInside) return button diff --git a/Manito/Manito/Screens/Setting/Service/SettingService.swift b/Manito/Manito/Screens/Setting/Service/SettingService.swift index ee653f97e..d0075c814 100644 --- a/Manito/Manito/Screens/Setting/Service/SettingService.swift +++ b/Manito/Manito/Screens/Setting/Service/SettingService.swift @@ -6,3 +6,27 @@ // import Foundation + +protocol SettingServicable { + func deleteUser() async throws -> Int +} + +final class SettingService: SettingServicable { + + private let repository: SettingRepository + + init(repository: SettingRepository) { + self.repository = repository + } + + func deleteUser() async throws -> Int { + do { + let statusCode = try await self.repository.deleteMember() + return statusCode + } catch NetworkError.serverError { + throw NetworkError.serverError + } catch NetworkError.clientError(let message) { + throw NetworkError.clientError(message: message) + } + } +} diff --git a/Manito/Manito/Screens/Setting/View/SettingView.swift b/Manito/Manito/Screens/Setting/View/SettingView.swift index e0a0f0480..5d0b6a8a7 100644 --- a/Manito/Manito/Screens/Setting/View/SettingView.swift +++ b/Manito/Manito/Screens/Setting/View/SettingView.swift @@ -5,6 +5,7 @@ // Created by 이성호 on 2023/05/12. // +import Combine import UIKit import SnapKit @@ -53,6 +54,8 @@ final class SettingView: UIView { private var options: [Option] = [] private weak var delegate: SettingViewDelegate? + let withdrawalButtonPublisher = PassthroughSubject() + // MARK: - init override init(frame: CGRect) { diff --git a/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift b/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift index 7be9fd85e..c248ba466 100644 --- a/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift @@ -5,6 +5,7 @@ // Created by 이성호 on 2022/07/02. // +import Combine import UIKit import SnapKit @@ -15,10 +16,23 @@ final class SettingViewController: BaseViewController { private let settingView: SettingView = SettingView() - private let settingRepository: SettingRepository = SettingRepositoryImpl() + // MARK: - property + + private var cancellable = Set() + private let viewModel: SettingViewModel // MARK: - init + init(viewModel: SettingViewModel) { + self.viewModel = viewModel + super.init() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + deinit { print("\(#file) is dead") } @@ -32,6 +46,7 @@ final class SettingViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() self.configureDelegation() + self.bindViewModel() } override func viewWillAppear(_ animated: Bool) { @@ -49,22 +64,33 @@ final class SettingViewController: BaseViewController { self.navigationController?.navigationBar.prefersLargeTitles = false } - private func requestDeleteMember(completionHandler: @escaping ((Result) -> Void)) { - Task { - do { - let statusCode = try await self.settingRepository.deleteMember() - switch statusCode { - case 200..<300: completionHandler(.success(())) - default: completionHandler(.failure(.unknownError)) + private func bindViewModel() { + let output = self.transformedOutput() + self.bindOutputToViewModel(output) + } + + private func transformedOutput() -> SettingViewModel.Output { + let input = SettingViewModel.Input(withdrawalButtonDidTap: self.settingView.withdrawalButtonPublisher.eraseToAnyPublisher()) + + return viewModel.transform(from: input) + } + + private func bindOutputToViewModel(_ output: SettingViewModel.Output) { + output.deleteUser + .receive(on: DispatchQueue.main) + .sink { [weak self] result in + switch result { + case .finished: return + case .failure(_): + self?.makeAlert(title: TextLiteral.fail, message: TextLiteral.settingViewControllerFailMessage) } - } catch NetworkError.serverError { - print("server Error") - } catch NetworkError.encodingError { - print("encoding Error") - } catch NetworkError.clientError(let message) { - print("client Error: \(String(describing: message))") + } receiveValue: { _ in + UserDefaultHandler.clearAllDataExcludingFcmToken() + guard let sceneDelgate = UIApplication.shared.connectedScenes.first?.delegate + as? SceneDelegate else { return } + sceneDelgate.moveToLoginViewController() } - } + .store(in: &self.cancellable) } } @@ -106,17 +132,7 @@ extension SettingViewController: SettingViewDelegate { func withdrawalButtonDidTap() { self.makeRequestAlert(title: TextLiteral.alert, message: TextLiteral.settingViewControllerWithdrawalMessage, okTitle: TextLiteral.settingViewControllerWithdrawal) { [weak self] _ in - self?.requestDeleteMember() { result in - switch result { - case .success: - UserDefaultHandler.clearAllDataExcludingFcmToken() - guard let sceneDelgate = UIApplication.shared.connectedScenes.first?.delegate - as? SceneDelegate else { return } - sceneDelgate.moveToLoginViewController() - case .failure: - self?.makeAlert(title: TextLiteral.fail, message: TextLiteral.settingViewControllerFailMessage) - } - } + self?.settingView.withdrawalButtonPublisher.send() } } } diff --git a/Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift b/Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift index 7768360dd..2dfffc6b0 100644 --- a/Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift +++ b/Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift @@ -5,4 +5,58 @@ // Created by 이성호 on 2023/09/01. // +import Combine import Foundation + +final class SettingViewModel { + + // MARK: - property + + private let settingService: SettingService + private var cancellable = Set() + + private let deleteUserSubject = PassthroughSubject() + + struct Input { + let withdrawalButtonDidTap: AnyPublisher + } + + struct Output { + let deleteUser: PassthroughSubject + } + + func transform(from input: Input) -> Output { + input.withdrawalButtonDidTap + .sink(receiveValue: { [weak self] _ in + self?.requestDeleteUser() + }) + .store(in: &self.cancellable) + + return Output(deleteUser: self.deleteUserSubject) + } + + // MARK: - init + + init(settingService: SettingService) { + self.settingService = settingService + } + + // MARK: - func + + private func requestDeleteUser() { + Task { + do { + let statusCode = try await self.settingService.deleteUser() + switch statusCode { + case 200..<300: + self.deleteUserSubject.send() + default: + self.deleteUserSubject.send(completion: .failure(.unknownError)) + } + } catch(let error) { + guard let error = error as? NetworkError else { return } + self.deleteUserSubject.send(completion: .failure(error)) + } + } + } +} From 192b025239471f836a613e0b8b1deeba8c0a4974 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Fri, 1 Sep 2023 19:46:46 +0900 Subject: [PATCH 407/468] =?UTF-8?q?[CHORE]=20=ED=95=A8=EC=88=98=EB=A1=9C?= =?UTF-8?q?=20=EB=B9=BC=EA=B8=B0=20(#505)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewControllers/SettingViewController.swift | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift b/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift index c248ba466..7d0a0920b 100644 --- a/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift @@ -71,7 +71,6 @@ final class SettingViewController: BaseViewController { private func transformedOutput() -> SettingViewModel.Output { let input = SettingViewModel.Input(withdrawalButtonDidTap: self.settingView.withdrawalButtonPublisher.eraseToAnyPublisher()) - return viewModel.transform(from: input) } @@ -84,14 +83,18 @@ final class SettingViewController: BaseViewController { case .failure(_): self?.makeAlert(title: TextLiteral.fail, message: TextLiteral.settingViewControllerFailMessage) } - } receiveValue: { _ in - UserDefaultHandler.clearAllDataExcludingFcmToken() - guard let sceneDelgate = UIApplication.shared.connectedScenes.first?.delegate - as? SceneDelegate else { return } - sceneDelgate.moveToLoginViewController() + } receiveValue: { [weak self] _ in + self?.deleteUser() } .store(in: &self.cancellable) } + + private func deleteUser() { + UserDefaultHandler.clearAllDataExcludingFcmToken() + guard let sceneDelgate = UIApplication.shared.connectedScenes.first?.delegate + as? SceneDelegate else { return } + sceneDelgate.moveToLoginViewController() + } } // MARK: - Extensions From 6a433af0e4ca8cf68e000543dda04cef51bbdc46 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 00:06:44 +0900 Subject: [PATCH 408/468] =?UTF-8?q?[FEAT]=20NicknameView=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20(#507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++++ .../Screens/CreateNickName/NicknameView.swift | 23 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 Manito/Manito/Screens/CreateNickName/NicknameView.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index d9afd097a..0d1caff03 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -168,6 +168,7 @@ D70220232A7A22EC0024BACD /* CreateRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D70220222A7A22EC0024BACD /* CreateRoomView.swift */; }; D71939532AA1C84900A73D6C /* SettingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D71939522AA1C84900A73D6C /* SettingService.swift */; }; D71939552AA1C85300A73D6C /* SettingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D71939542AA1C85300A73D6C /* SettingViewModel.swift */; }; + D71939592AA2343E00A73D6C /* NicknameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D71939582AA2343E00A73D6C /* NicknameView.swift */; }; D724AF5D287088310003F280 /* SettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5C287088310003F280 /* SettingViewController.swift */; }; D724AF5F28708D830003F280 /* ImageRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5E28708D830003F280 /* ImageRowView.swift */; }; D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = D739C36628C7B82500161117 /* NicknameDTO.swift */; }; @@ -370,6 +371,7 @@ D70220222A7A22EC0024BACD /* CreateRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomView.swift; sourceTree = ""; }; D71939522AA1C84900A73D6C /* SettingService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingService.swift; sourceTree = ""; }; D71939542AA1C85300A73D6C /* SettingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewModel.swift; sourceTree = ""; }; + D71939582AA2343E00A73D6C /* NicknameView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameView.swift; sourceTree = ""; }; D724AF5C287088310003F280 /* SettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewController.swift; sourceTree = ""; }; D724AF5E28708D830003F280 /* ImageRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageRowView.swift; sourceTree = ""; }; D739C36628C7B82500161117 /* NicknameDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameDTO.swift; sourceTree = ""; }; @@ -515,6 +517,7 @@ isa = PBXGroup; children = ( 7E0C5C352855B22700F698D1 /* CreateNickNameViewController.swift */, + D71939582AA2343E00A73D6C /* NicknameView.swift */, ); path = CreateNickName; sourceTree = ""; @@ -1472,6 +1475,7 @@ B5F5250128519EFB00614FF7 /* ImageLiteral.swift in Sources */, 39F1C12E28D756E600585B83 /* LetterImageViewController.swift in Sources */, 7E7542B32923744300D725CB /* ToastPopupView.swift in Sources */, + D71939592AA2343E00A73D6C /* NicknameView.swift in Sources */, B5A085FE2A97493900C8A98D /* UserInfoDTO.swift in Sources */, 39C957D22879523200A04A2B /* Date+Extension.swift in Sources */, B53A35C82A96F84700B720BC /* LetterRepository.swift in Sources */, diff --git a/Manito/Manito/Screens/CreateNickName/NicknameView.swift b/Manito/Manito/Screens/CreateNickName/NicknameView.swift new file mode 100644 index 000000000..3df0e00cd --- /dev/null +++ b/Manito/Manito/Screens/CreateNickName/NicknameView.swift @@ -0,0 +1,23 @@ +// +// NicknameView.swift +// Manito +// +// Created by 이성호 on 2023/09/02. +// + +import UIKit + +import SnapKit + +final class NicknameView: UIView { + + // MARK: - ui components + + // MARK: - property + + // MARK: - init + + // MARK: - func + + // MARK: - selector +} From 0f3f908ccc59e212561aa7f87dd932e065f12192 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 00:46:13 +0900 Subject: [PATCH 409/468] =?UTF-8?q?[FEAT]=20NicknameViewController=20View?= =?UTF-8?q?=20=EB=B6=84=EB=A6=AC=20(#507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreateNickNameViewController.swift | 176 +++--------------- .../Screens/CreateNickName/NicknameView.swift | 121 ++++++++++++ 2 files changed, 144 insertions(+), 153 deletions(-) diff --git a/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift b/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift index c8d1c5d1b..3de98de9d 100644 --- a/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift +++ b/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift @@ -12,51 +12,10 @@ import SnapKit class CreateNickNameViewController: BaseViewController { private let settingRepository: SettingRepository = SettingRepositoryImpl() + private lazy var nicknameView: NicknameView = NicknameView(title: TextLiteral.createNickNameViewControllerTitle) + + // MARK: - property - private var nickname: String = "" - private let maxLength = 5 - - // MARK: - Property - - private let titleLabel: UILabel = { - let label = UILabel() - label.text = TextLiteral.createNickNameViewControllerTitle - label.font = .font(.regular, ofSize: 34) - return label - }() - private let roomsNameTextField: UITextField = { - let textField = UITextField() - let attributes = [ - NSAttributedString.Key.font : UIFont.font(.regular, ofSize: 18) - ] - textField.backgroundColor = .darkGrey002 - textField.attributedPlaceholder = NSAttributedString(string: TextLiteral.createNickNameViewControllerAskNickName, attributes:attributes) - textField.font = .font(.regular, ofSize: 18) - textField.layer.cornerRadius = 10 - textField.layer.masksToBounds = true - textField.layer.borderWidth = 1 - textField.layer.borderColor = UIColor.white.cgColor - textField.textAlignment = .center - textField.returnKeyType = .done - textField.autocorrectionType = .no - textField.autocapitalizationType = .none - textField.becomeFirstResponder() - return textField - }() - private lazy var roomsTextLimit : UILabel = { - let label = UILabel() - label.text = "0/\(maxLength)" - label.font = .font(.regular, ofSize: 20) - label.textColor = .grey002 - return label - }() - private lazy var doneButton: MainButton = { - let button = MainButton() - button.title = TextLiteral.done - button.addTarget(self, action: #selector(didTapDoneButton), for: .touchUpInside) - button.isDisabled = true - return button - }() // MARK: - init @@ -66,13 +25,15 @@ class CreateNickNameViewController: BaseViewController { // MARK: - life Cycle + override func loadView() { + self.view = self.nicknameView + } + override func viewDidLoad() { super.viewDidLoad() - self.setupDelegation() - self.setupNotificationCenter() } - // MARK: - API + // MARK: - API - 옮길예정 func requestNickname(nickname: NicknameDTO) { Task { do { @@ -88,45 +49,22 @@ class CreateNickNameViewController: BaseViewController { } } - override func setupLayout() { - view.addSubview(titleLabel) - titleLabel.snp.makeConstraints { - $0.top.equalTo(view.safeAreaLayoutGuide).inset(66) - $0.leading.equalTo(view.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) - } - - view.addSubview(roomsNameTextField) - roomsNameTextField.snp.makeConstraints { - $0.top.equalTo(titleLabel.snp.bottom).offset(66) - $0.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) - $0.height.equalTo(60) - } - - view.addSubview(roomsTextLimit) - roomsTextLimit.snp.makeConstraints { - $0.top.equalTo(roomsNameTextField.snp.bottom).offset(10) - $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - } - - view.addSubview(doneButton) - doneButton.snp.makeConstraints { - $0.bottom.equalTo(view.safeAreaLayoutGuide).inset(23) - $0.centerX.equalToSuperview() - } - } - - // MARK: - Seletors + // MARK: - override - @objc private func didTapDoneButton() { - if let text = roomsNameTextField.text, !text.isEmpty { - nickname = text - UserData.setValue(nickname, forKey: .nickname) - UserDefaultHandler.setIsSetFcmToken(isSetFcmToken: true) - requestNickname(nickname: NicknameDTO(nickname: nickname)) - presentMainViewController() - } + override func configureUI() { + super.configureUI() } +// @objc private func didTapDoneButton() { +// if let text = roomsNameTextField.text, !text.isEmpty { +// nickname = text +// UserData.setValue(nickname, forKey: .nickname) +// UserDefaultHandler.setIsSetFcmToken(isSetFcmToken: true) +// requestNickname(nickname: NicknameDTO(nickname: nickname)) +// presentMainViewController() +// } +// } + private func presentMainViewController() { let storyboard = UIStoryboard(name: "Main", bundle: nil) let viewController = storyboard.instantiateViewController(withIdentifier: "MainNavigationController") @@ -135,78 +73,10 @@ class CreateNickNameViewController: BaseViewController { present(viewController, animated: true) } - @objc private func keyboardWillShow(notification:NSNotification) { - if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { - UIView.animate(withDuration: 0.2, animations: { - self.doneButton.transform = CGAffineTransform(translationX: 0, y: -keyboardSize.height + 30) - }) - } - } - - @objc private func keyboardWillHide(notification:NSNotification) { - UIView.animate(withDuration: 0.2, animations: { - self.doneButton.transform = .identity - }) - } - override func endEditingView() { - if !doneButton.isTouchInside { - view.endEditing(true) - } + self.nicknameView.endEditingView() } - // MARK: - Funtions + // MARK: - func - private func setupDelegation() { - roomsNameTextField.delegate = self - } - - private func setupNotificationCenter() { - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) - } - - private func setCounter(count: Int) { - if count <= maxLength { - roomsTextLimit.text = "\(count)/\(maxLength)" - } else { - roomsTextLimit.text = "\(maxLength)/\(maxLength)" - } - } - - private func checkMaxLength(textField: UITextField, maxLength: Int) { - if let text = textField.text { - if text.count > maxLength { - let endIndex = text.index(text.startIndex, offsetBy: maxLength) - let fixedText = text[text.startIndex.. Bool { - roomsNameTextField.resignFirstResponder() - return true - } - - func textFieldDidChangeSelection(_ textField: UITextField) { - setCounter(count: textField.text?.count ?? 0) - checkMaxLength(textField: roomsNameTextField, maxLength: maxLength) - - let hasText = roomsNameTextField.hasText - doneButton.isDisabled = !hasText - } } diff --git a/Manito/Manito/Screens/CreateNickName/NicknameView.swift b/Manito/Manito/Screens/CreateNickName/NicknameView.swift index 3df0e00cd..9b9811896 100644 --- a/Manito/Manito/Screens/CreateNickName/NicknameView.swift +++ b/Manito/Manito/Screens/CreateNickName/NicknameView.swift @@ -13,11 +13,132 @@ final class NicknameView: UIView { // MARK: - ui components + private lazy var titleLabel: UILabel = { + let label = UILabel() + label.font = .font(.regular, ofSize: 34) + label.text = self.title + return label + }() + private lazy var nicknameTextField: UITextField = { + let textField = UITextField() + let attributes = [ + NSAttributedString.Key.font : UIFont.font(.regular, ofSize: 18) + ] + textField.backgroundColor = .darkGrey002 + textField.attributedPlaceholder = NSAttributedString(string: TextLiteral.createNickNameViewControllerAskNickName, attributes:attributes) + textField.font = .font(.regular, ofSize: 18) + textField.layer.cornerRadius = 10 + textField.layer.masksToBounds = true + textField.layer.borderWidth = 1 + textField.layer.borderColor = UIColor.white.cgColor + textField.textAlignment = .center + textField.returnKeyType = .done + textField.autocorrectionType = .no + textField.autocapitalizationType = .none + textField.becomeFirstResponder() + textField.delegate = self + return textField + }() + private lazy var textLimitLabel: UILabel = { + let label = UILabel() + label.text = "0/\(maxLength)" + label.font = .font(.regular, ofSize: 20) + label.textColor = .grey002 + return label + }() + private let doneButton: MainButton = { + let button = MainButton() + button.title = TextLiteral.done + button.isDisabled = true + return button + }() + // MARK: - property + private let title: String + private let maxLength = 5 + // MARK: - init + init(title: String) { + self.title = title + super.init(frame: .zero) + self.setupLayout() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + // MARK: - func + private func setupLayout() { + self.addSubview(self.titleLabel) + self.titleLabel.snp.makeConstraints { + $0.top.equalTo(self.safeAreaLayoutGuide).inset(66) + $0.leading.equalTo(self.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) + } + + self.addSubview(self.nicknameTextField) + self.nicknameTextField.snp.makeConstraints { + $0.top.equalTo(self.titleLabel.snp.bottom).offset(66) + $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + $0.height.equalTo(60) + } + + self.addSubview(self.textLimitLabel) + self.textLimitLabel.snp.makeConstraints { + $0.top.equalTo(self.nicknameTextField.snp.bottom).offset(10) + $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) + } + + self.addSubview(self.doneButton) + self.doneButton.snp.makeConstraints { + $0.bottom.equalTo(self.safeAreaLayoutGuide).inset(23) + $0.centerX.equalToSuperview() + } + } + + private func setupNotificationCenter() { + NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) + } + + func endEditingView() { + if !self.doneButton.isTouchInside { + self.endEditing(true) + } + } + // MARK: - selector + + @objc private func keyboardWillShow(notification:NSNotification) { + if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { + UIView.animate(withDuration: 0.2, animations: { + self.doneButton.transform = CGAffineTransform(translationX: 0, y: -keyboardSize.height + 30) + }) + } + } + + @objc private func keyboardWillHide(notification:NSNotification) { + UIView.animate(withDuration: 0.2, animations: { + self.doneButton.transform = .identity + }) + } +} + +extension NicknameView: UITextFieldDelegate { + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + self.nicknameTextField.resignFirstResponder() + return true + } + + func textFieldDidChangeSelection(_ textField: UITextField) { + // setCounter(count: textField.text?.count ?? 0) + // checkMaxLength(textField: roomsNameTextField, maxLength: maxLength) + // + // let hasText = roomsNameTextField.hasText + // doneButton.isDisabled = !hasText + } } From c3d4aba159c0221920718f02e02be7cac5248049 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 00:48:51 +0900 Subject: [PATCH 410/468] =?UTF-8?q?[CHORE]=20=ED=8F=B4=EB=8D=94=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=EB=B3=80=EA=B2=BD=20(#507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 44 ++++++++++++++++++- .../Service/NicknameService.swift | 8 ++++ .../{ => View}/NicknameView.swift | 0 .../CreateNickNameViewController.swift | 0 .../ViewModel/NicknameViewModel.swift | 8 ++++ 5 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 Manito/Manito/Screens/CreateNickName/Service/NicknameService.swift rename Manito/Manito/Screens/CreateNickName/{ => View}/NicknameView.swift (100%) rename Manito/Manito/Screens/CreateNickName/{ => ViewControllers}/CreateNickNameViewController.swift (100%) create mode 100644 Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 0d1caff03..b1c68bc44 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -169,6 +169,8 @@ D71939532AA1C84900A73D6C /* SettingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D71939522AA1C84900A73D6C /* SettingService.swift */; }; D71939552AA1C85300A73D6C /* SettingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D71939542AA1C85300A73D6C /* SettingViewModel.swift */; }; D71939592AA2343E00A73D6C /* NicknameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D71939582AA2343E00A73D6C /* NicknameView.swift */; }; + D719395F2AA23F2300A73D6C /* NicknameViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D719395E2AA23F2300A73D6C /* NicknameViewModel.swift */; }; + D71939612AA23F3B00A73D6C /* NicknameService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D71939602AA23F3B00A73D6C /* NicknameService.swift */; }; D724AF5D287088310003F280 /* SettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5C287088310003F280 /* SettingViewController.swift */; }; D724AF5F28708D830003F280 /* ImageRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5E28708D830003F280 /* ImageRowView.swift */; }; D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = D739C36628C7B82500161117 /* NicknameDTO.swift */; }; @@ -372,6 +374,8 @@ D71939522AA1C84900A73D6C /* SettingService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingService.swift; sourceTree = ""; }; D71939542AA1C85300A73D6C /* SettingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewModel.swift; sourceTree = ""; }; D71939582AA2343E00A73D6C /* NicknameView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameView.swift; sourceTree = ""; }; + D719395E2AA23F2300A73D6C /* NicknameViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameViewModel.swift; sourceTree = ""; }; + D71939602AA23F3B00A73D6C /* NicknameService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameService.swift; sourceTree = ""; }; D724AF5C287088310003F280 /* SettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewController.swift; sourceTree = ""; }; D724AF5E28708D830003F280 /* ImageRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageRowView.swift; sourceTree = ""; }; D739C36628C7B82500161117 /* NicknameDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameDTO.swift; sourceTree = ""; }; @@ -516,8 +520,10 @@ 7E0C5C342855B1EF00F698D1 /* CreateNickName */ = { isa = PBXGroup; children = ( - 7E0C5C352855B22700F698D1 /* CreateNickNameViewController.swift */, - D71939582AA2343E00A73D6C /* NicknameView.swift */, + D719395A2AA23EF200A73D6C /* Service */, + D719395B2AA23EFC00A73D6C /* ViewModel */, + D719395C2AA23F0400A73D6C /* View */, + D719395D2AA23F0900A73D6C /* ViewControllers */, ); path = CreateNickName; sourceTree = ""; @@ -1216,6 +1222,38 @@ path = ChangeNickname; sourceTree = ""; }; + D719395A2AA23EF200A73D6C /* Service */ = { + isa = PBXGroup; + children = ( + D71939602AA23F3B00A73D6C /* NicknameService.swift */, + ); + path = Service; + sourceTree = ""; + }; + D719395B2AA23EFC00A73D6C /* ViewModel */ = { + isa = PBXGroup; + children = ( + D719395E2AA23F2300A73D6C /* NicknameViewModel.swift */, + ); + path = ViewModel; + sourceTree = ""; + }; + D719395C2AA23F0400A73D6C /* View */ = { + isa = PBXGroup; + children = ( + D71939582AA2343E00A73D6C /* NicknameView.swift */, + ); + path = View; + sourceTree = ""; + }; + D719395D2AA23F0900A73D6C /* ViewControllers */ = { + isa = PBXGroup; + children = ( + 7E0C5C352855B22700F698D1 /* CreateNickNameViewController.swift */, + ); + path = ViewControllers; + sourceTree = ""; + }; D724AF5B287088110003F280 /* Setting */ = { isa = PBXGroup; children = ( @@ -1514,6 +1552,7 @@ D724AF5F28708D830003F280 /* ImageRowView.swift in Sources */, 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */, B5F5251E2851A1C700614FF7 /* BaseTableViewCell.swift in Sources */, + D719395F2AA23F2300A73D6C /* NicknameViewModel.swift in Sources */, 39BDDCC42A52BB4A005E0A71 /* DetailWaitService.swift in Sources */, B5A086022A974B8100C8A98D /* RoomListItem.swift in Sources */, B53A35CC2A96F99D00B720BC /* SettingRepository.swift in Sources */, @@ -1588,6 +1627,7 @@ B5F52537285481C800614FF7 /* LetterCollectionViewCell.swift in Sources */, B53A35C42A96F50100B720BC /* DetailRoomRepository.swift in Sources */, CB358C0228A564080084D001 /* SettingDeveloperInfoViewController.swift in Sources */, + D71939612AA23F3B00A73D6C /* NicknameService.swift in Sources */, CB7B23A828C4ECA8004A4CF3 /* Character.swift in Sources */, B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */, B5A085EC2A97314800C8A98D /* ParticipatedRoomInfoDTO.swift in Sources */, diff --git a/Manito/Manito/Screens/CreateNickName/Service/NicknameService.swift b/Manito/Manito/Screens/CreateNickName/Service/NicknameService.swift new file mode 100644 index 000000000..9e6fac8f5 --- /dev/null +++ b/Manito/Manito/Screens/CreateNickName/Service/NicknameService.swift @@ -0,0 +1,8 @@ +// +// NicknameService.swift +// Manito +// +// Created by 이성호 on 2023/09/02. +// + +import Foundation diff --git a/Manito/Manito/Screens/CreateNickName/NicknameView.swift b/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift similarity index 100% rename from Manito/Manito/Screens/CreateNickName/NicknameView.swift rename to Manito/Manito/Screens/CreateNickName/View/NicknameView.swift diff --git a/Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift b/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift similarity index 100% rename from Manito/Manito/Screens/CreateNickName/CreateNickNameViewController.swift rename to Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift diff --git a/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift b/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift new file mode 100644 index 000000000..2c64b2cad --- /dev/null +++ b/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift @@ -0,0 +1,8 @@ +// +// NicknameViewModel.swift +// Manito +// +// Created by 이성호 on 2023/09/02. +// + +import Foundation From 14ee23012933e3d30b30634e184050556820aa18 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 00:54:17 +0900 Subject: [PATCH 411/468] =?UTF-8?q?[FEAT]=20NicknameService=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20(#507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/NicknameService.swift | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Manito/Manito/Screens/CreateNickName/Service/NicknameService.swift b/Manito/Manito/Screens/CreateNickName/Service/NicknameService.swift index 9e6fac8f5..d63d9302b 100644 --- a/Manito/Manito/Screens/CreateNickName/Service/NicknameService.swift +++ b/Manito/Manito/Screens/CreateNickName/Service/NicknameService.swift @@ -6,3 +6,27 @@ // import Foundation + +protocol NicknameServicable { + func putUserInfo(nickname: NicknameDTO) async throws -> NicknameDTO +} + +final class NicknameService: NicknameServicable { + + private let repository: SettingRepository + + init(repository: SettingRepository) { + self.repository = repository + } + + func putUserInfo(nickname: NicknameDTO) async throws -> NicknameDTO { + do { + let data = try await self.repository.putUserInfo(nickname: nickname) + return data + } catch NetworkError.serverError { + throw NetworkError.serverError + } catch NetworkError.clientError(let message) { + throw NetworkError.clientError(message: message) + } + } +} From 50a6592e6a9f53e0b6588fe0c7d676808a8a663d Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 02:10:47 +0900 Subject: [PATCH 412/468] =?UTF-8?q?[FEAT]=20viewModel=20=EB=A1=9C=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20(#507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreateNickName/View/NicknameView.swift | 28 ++++- .../CreateNickNameViewController.swift | 88 ++++++++++----- .../ViewModel/NicknameViewModel.swift | 102 ++++++++++++++++++ .../Screens/Login/LoginViewController.swift | 2 +- .../Screens/Splash/SplashViewController.swift | 2 +- 5 files changed, 186 insertions(+), 36 deletions(-) diff --git a/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift b/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift index 9b9811896..d844590d3 100644 --- a/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift +++ b/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift @@ -5,6 +5,7 @@ // Created by 이성호 on 2023/09/02. // +import Combine import UIKit import SnapKit @@ -57,6 +58,8 @@ final class NicknameView: UIView { private let title: String private let maxLength = 5 + lazy var doneButtonTapPublisher = self.doneButton.tapPublisher + let textFieldPublisher = PassthroughSubject() // MARK: - init @@ -111,6 +114,25 @@ final class NicknameView: UIView { } } + func updateTextFieldText(fixedText: String) { + DispatchQueue.main.async { + self.nicknameTextField.text = String(fixedText) + } + } + + func updateTextCount(count: Int, maxLength: Int) { + if count > maxLength { + self.textLimitLabel.text = "\(maxLength)/\(maxLength)" + } + else { + self.textLimitLabel.text = "\(count)/\(maxLength)" + } + } + + func toggleDoneButton(isEnabled: Bool) { + self.doneButton.isDisabled = !isEnabled + } + // MARK: - selector @objc private func keyboardWillShow(notification:NSNotification) { @@ -135,10 +157,6 @@ extension NicknameView: UITextFieldDelegate { } func textFieldDidChangeSelection(_ textField: UITextField) { - // setCounter(count: textField.text?.count ?? 0) - // checkMaxLength(textField: roomsNameTextField, maxLength: maxLength) - // - // let hasText = roomsNameTextField.hasText - // doneButton.isDisabled = !hasText + self.textFieldPublisher.send(textField.text ?? "") } } diff --git a/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift b/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift index 3de98de9d..eef8c2b0c 100644 --- a/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift +++ b/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift @@ -5,20 +5,32 @@ // Created by LeeSungHo on 2022/06/12. // +import Combine import UIKit import SnapKit class CreateNickNameViewController: BaseViewController { - private let settingRepository: SettingRepository = SettingRepositoryImpl() - private lazy var nicknameView: NicknameView = NicknameView(title: TextLiteral.createNickNameViewControllerTitle) - // MARK: - property + private let viewModel: NicknameViewModel + private lazy var nicknameView: NicknameView = NicknameView(title: TextLiteral.createNickNameViewControllerTitle) + + private var cancellable = Set() // MARK: - init + init(viewModel: NicknameViewModel) { + self.viewModel = viewModel + super.init() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + deinit { print("\(#file) is dead") } @@ -31,22 +43,7 @@ class CreateNickNameViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() - } - - // MARK: - API - 옮길예정 - func requestNickname(nickname: NicknameDTO) { - Task { - do { - let data = try await self.settingRepository.putUserInfo(nickname: nickname) - UserDefaultHandler.setNickname(nickname: data.nickname) - } catch NetworkError.serverError { - print("server Error") - } catch NetworkError.encodingError { - print("encoding Error") - } catch NetworkError.clientError(let message) { - print("client Error: \(message)") - } - } + self.bindViewModel() } // MARK: - override @@ -55,16 +52,6 @@ class CreateNickNameViewController: BaseViewController { super.configureUI() } -// @objc private func didTapDoneButton() { -// if let text = roomsNameTextField.text, !text.isEmpty { -// nickname = text -// UserData.setValue(nickname, forKey: .nickname) -// UserDefaultHandler.setIsSetFcmToken(isSetFcmToken: true) -// requestNickname(nickname: NicknameDTO(nickname: nickname)) -// presentMainViewController() -// } -// } - private func presentMainViewController() { let storyboard = UIStoryboard(name: "Main", bundle: nil) let viewController = storyboard.instantiateViewController(withIdentifier: "MainNavigationController") @@ -79,4 +66,47 @@ class CreateNickNameViewController: BaseViewController { // MARK: - func + private func bindViewModel() { + let output = self.transformedOutput() + self.bindOutputToViewModel(output) + } + + private func transformedOutput() -> NicknameViewModel.Output { + let input = NicknameViewModel.Input(textFieldDidChanged: self.nicknameView.textFieldPublisher.eraseToAnyPublisher(), + doneButtonDidTap: self.nicknameView.doneButtonTapPublisher.eraseToAnyPublisher()) + return viewModel.transform(from: input) + } + + private func bindOutputToViewModel(_ output: NicknameViewModel.Output) { + output.title + .sink { [weak self] text in + self?.nicknameView.updateTextCount(count: text.count, maxLength: self?.viewModel.maxCount ?? 0) + } + .store(in: &self.cancellable) + + output.fixedTitleByMaxCount + .sink { [weak self] fixedTitle in + self?.nicknameView.updateTextFieldText(fixedText: fixedTitle) + } + .store(in: &self.cancellable) + + output.isEnabled + .sink { [weak self] isEnabled in + self?.nicknameView.toggleDoneButton(isEnabled: isEnabled) + } + .store(in: &self.cancellable) + + output.doneButton + .receive(on: DispatchQueue.main) + .sink { [weak self] result in + switch result { + case .finished: return + case .failure(_): + self?.makeAlert(title: TextLiteral.fail, message: "실패") + } + } receiveValue: { [weak self] _ in + self?.presentMainViewController() + } + .store(in: &self.cancellable) + } } diff --git a/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift b/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift index 2c64b2cad..ebc3b74e5 100644 --- a/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift +++ b/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift @@ -5,4 +5,106 @@ // Created by 이성호 on 2023/09/02. // +import Combine import Foundation + +final class NicknameViewModel { + + // MARK: - property + + let maxCount: Int = 5 + + private let nicknameService: NicknameService + private var cancellable = Set() + + private let nicknameSubject = CurrentValueSubject("") + private let doneButtonSubject = PassthroughSubject() + + struct Input { + let textFieldDidChanged: AnyPublisher + let doneButtonDidTap: AnyPublisher + } + + struct Output { + let title: AnyPublisher + let fixedTitleByMaxCount: AnyPublisher + let isEnabled: AnyPublisher + let doneButton: PassthroughSubject + } + + func transform(from input: Input) -> Output { + let title = input.textFieldDidChanged + .map { [weak self] text -> String in + self?.nicknameSubject.send(text) + return text + } + .eraseToAnyPublisher() + + let fixedTitle = input.textFieldDidChanged + .map { [weak self] text -> String in + let isOverMaxCount = self?.isOverMaxCount(titleCount: text.count, maxCount: self?.maxCount ?? 0) ?? false + + if isOverMaxCount { + let endIndex = text.index(text.startIndex, offsetBy: self?.maxCount ?? 0) + let fixedText = text[text.startIndex.. Bool in + return !text.isEmpty + } + .eraseToAnyPublisher() + + input.doneButtonDidTap + .sink(receiveValue: { [weak self] _ in + self?.didTapDoneButton() + }) + .store(in: &self.cancellable) + + return Output(title: title, + fixedTitleByMaxCount: fixedTitle, + isEnabled: isEnabled, + doneButton: self.doneButtonSubject) + } + + // MARK: - init + + init(nicknameService: NicknameService) { + self.nicknameService = nicknameService + } + + // MARK: - func + + private func isOverMaxCount(titleCount: Int, maxCount: Int) -> Bool { + if titleCount > maxCount { return true } + else { return false } + } + + private func didTapDoneButton() { + let nickname = self.nicknameSubject.value + UserData.setValue(nickname, forKey: .nickname) + UserDefaultHandler.setIsSetFcmToken(isSetFcmToken: true) + self.requestCreateNickname(nickname: NicknameDTO(nickname: nickname)) + } + + // MARK: - network + + private func requestCreateNickname(nickname: NicknameDTO) { + Task { + do { + let data = try await self.nicknameService.putUserInfo(nickname: nickname) + print(data) + UserDefaultHandler.setNickname(nickname: data.nickname) + self.doneButtonSubject.send() + } catch(let error) { + guard let error = error as? NetworkError else { return } + self.doneButtonSubject.send(completion: .failure(error)) + } + } + } +} diff --git a/Manito/Manito/Screens/Login/LoginViewController.swift b/Manito/Manito/Screens/Login/LoginViewController.swift index b0098ca05..f95b065f4 100644 --- a/Manito/Manito/Screens/Login/LoginViewController.swift +++ b/Manito/Manito/Screens/Login/LoginViewController.swift @@ -113,7 +113,7 @@ extension LoginViewController: ASAuthorizationControllerDelegate { if let isNewMember = data.isNewMember { if isNewMember { - self.navigationController?.pushViewController(CreateNickNameViewController(), animated: true) + self.navigationController?.pushViewController(CreateNickNameViewController(viewModel: NicknameViewModel(nicknameService: NicknameService(repository: SettingRepositoryImpl()))), animated: true) return } } diff --git a/Manito/Manito/Screens/Splash/SplashViewController.swift b/Manito/Manito/Screens/Splash/SplashViewController.swift index 7d49d7091..061fb3e91 100644 --- a/Manito/Manito/Screens/Splash/SplashViewController.swift +++ b/Manito/Manito/Screens/Splash/SplashViewController.swift @@ -52,7 +52,7 @@ final class SplashViewController: UIViewController { } private func presentNicknameSettingViewController() { - let viewController = CreateNickNameViewController() + let viewController = CreateNickNameViewController(viewModel: NicknameViewModel(nicknameService: NicknameService(repository: SettingRepositoryImpl()))) viewController.modalPresentationStyle = .fullScreen viewController.modalTransitionStyle = .crossDissolve self.present(viewController, animated: true) From d0aaf74dec25a25878a1d62b5d7c4da3bf8faa44 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 02:30:18 +0900 Subject: [PATCH 413/468] =?UTF-8?q?[FEAT]=20SettingRepository=20=EC=9E=98?= =?UTF-8?q?=EB=AA=BB=EB=90=9C=EA=B0=92=20=EB=B3=80=EA=B2=BD=20(#507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Data/Repository/SettingRepository.swift | 6 +++--- .../CreateNickName/Service/NicknameService.swift | 8 ++++---- .../CreateNickName/ViewModel/NicknameViewModel.swift | 12 ++++++++---- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Manito/Manito/Data/Repository/SettingRepository.swift b/Manito/Manito/Data/Repository/SettingRepository.swift index fd4502f9b..7ddc9761f 100644 --- a/Manito/Manito/Data/Repository/SettingRepository.swift +++ b/Manito/Manito/Data/Repository/SettingRepository.swift @@ -10,7 +10,7 @@ import Foundation import MTNetwork protocol SettingRepository { - func putUserInfo(nickname: NicknameDTO) async throws -> NicknameDTO + func putUserInfo(nickname: NicknameDTO) async throws -> Int func deleteMember() async throws -> Int } @@ -18,10 +18,10 @@ final class SettingRepositoryImpl: SettingRepository { private var provider = Provider() - func putUserInfo(nickname: NicknameDTO) async throws -> NicknameDTO { + func putUserInfo(nickname: NicknameDTO) async throws -> Int { let response = try await self.provider .request(.putUserInfo(nickname: nickname)) - return try response.decode() + return response.statusCode } func deleteMember() async throws -> Int { diff --git a/Manito/Manito/Screens/CreateNickName/Service/NicknameService.swift b/Manito/Manito/Screens/CreateNickName/Service/NicknameService.swift index d63d9302b..c43274dde 100644 --- a/Manito/Manito/Screens/CreateNickName/Service/NicknameService.swift +++ b/Manito/Manito/Screens/CreateNickName/Service/NicknameService.swift @@ -8,7 +8,7 @@ import Foundation protocol NicknameServicable { - func putUserInfo(nickname: NicknameDTO) async throws -> NicknameDTO + func putUserInfo(nickname: NicknameDTO) async throws -> Int } final class NicknameService: NicknameServicable { @@ -19,10 +19,10 @@ final class NicknameService: NicknameServicable { self.repository = repository } - func putUserInfo(nickname: NicknameDTO) async throws -> NicknameDTO { + func putUserInfo(nickname: NicknameDTO) async throws -> Int { do { - let data = try await self.repository.putUserInfo(nickname: nickname) - return data + let statusCode = try await self.repository.putUserInfo(nickname: nickname) + return statusCode } catch NetworkError.serverError { throw NetworkError.serverError } catch NetworkError.clientError(let message) { diff --git a/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift b/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift index ebc3b74e5..f62becd31 100644 --- a/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift +++ b/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift @@ -97,10 +97,14 @@ final class NicknameViewModel { private func requestCreateNickname(nickname: NicknameDTO) { Task { do { - let data = try await self.nicknameService.putUserInfo(nickname: nickname) - print(data) - UserDefaultHandler.setNickname(nickname: data.nickname) - self.doneButtonSubject.send() + let statusCode = try await self.nicknameService.putUserInfo(nickname: nickname) + switch statusCode { + case 200..<300: + UserDefaultHandler.setNickname(nickname: nickname.nickname) + self.doneButtonSubject.send() + default: + self.doneButtonSubject.send(completion: .failure(.unknownError)) + } } catch(let error) { guard let error = error as? NetworkError else { return } self.doneButtonSubject.send(completion: .failure(error)) From fa360df4149433bda3445313c467acc31def100c Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 13:39:25 +0900 Subject: [PATCH 414/468] =?UTF-8?q?[FEAT]=20ChangeNickname=20=EB=B7=B0=20?= =?UTF-8?q?=EC=97=B0=EA=B2=B0=20(#507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 10 +- .../ChangeNickNameViewController.swift | 205 ------------------ .../ChangeNickNameViewController.swift | 107 +++++++++ .../CreateNickName/View/NicknameView.swift | 4 + .../CreateNickNameViewController.swift | 11 +- .../ViewModel/NicknameViewModel.swift | 12 +- .../SettingViewController.swift | 2 +- 7 files changed, 135 insertions(+), 216 deletions(-) delete mode 100644 Manito/Manito/Screens/ChangeNickname/ChangeNickNameViewController.swift create mode 100644 Manito/Manito/Screens/ChangeNickname/ViewControllers/ChangeNickNameViewController.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index b1c68bc44..89a49d9fc 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -1217,7 +1217,7 @@ D71939572AA1C9A000A73D6C /* ChangeNickname */ = { isa = PBXGroup; children = ( - 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */, + D71939632AA2E47100A73D6C /* ViewControllers */, ); path = ChangeNickname; sourceTree = ""; @@ -1254,6 +1254,14 @@ path = ViewControllers; sourceTree = ""; }; + D71939632AA2E47100A73D6C /* ViewControllers */ = { + isa = PBXGroup; + children = ( + 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */, + ); + path = ViewControllers; + sourceTree = ""; + }; D724AF5B287088110003F280 /* Setting */ = { isa = PBXGroup; children = ( diff --git a/Manito/Manito/Screens/ChangeNickname/ChangeNickNameViewController.swift b/Manito/Manito/Screens/ChangeNickname/ChangeNickNameViewController.swift deleted file mode 100644 index 65eb0e2af..000000000 --- a/Manito/Manito/Screens/ChangeNickname/ChangeNickNameViewController.swift +++ /dev/null @@ -1,205 +0,0 @@ -// -// ChangeNickNameViewController.swift -// Manito -// -// Created by LeeSungHo on 2022/09/05. -// - -import UIKit - -import SnapKit - -class ChangeNickNameViewController: BaseViewController { - - private let settingRepository: SettingRepository = SettingRepositoryImpl() - - private var nickname: String = UserDefaultStorage.nickname - private var maxLength = 5 - - // MARK: - Property - private lazy var nameTextField: UITextField = { - let textField = UITextField() - let attributes = [ - NSAttributedString.Key.font : UIFont.font(.regular, ofSize: 18) - ] - textField.backgroundColor = .darkGrey002 - textField.attributedPlaceholder = NSAttributedString(string: TextLiteral.createNickNameViewControllerAskNickName, attributes:attributes) - textField.font = .font(.regular, ofSize: 18) - textField.text = nickname - textField.layer.cornerRadius = 10 - textField.layer.masksToBounds = true - textField.layer.borderWidth = 1 - textField.layer.borderColor = UIColor.white.cgColor - textField.textAlignment = .center - textField.returnKeyType = .done - textField.autocorrectionType = .no - textField.autocapitalizationType = .none - textField.becomeFirstResponder() - return textField - }() - private lazy var roomsTextLimit : UILabel = { - let label = UILabel() - label.text = "\(String(describing: nameTextField.text?.count ?? 0))/\(maxLength)" - label.font = .font(.regular, ofSize: 20) - label.textColor = .grey002 - return label - }() - private lazy var doneButton: MainButton = { - let button = MainButton() - button.title = TextLiteral.done - button.addTarget(self, action: #selector(didTapDoneButton), for: .touchUpInside) - button.isDisabled = true - return button - }() - - // MARK: - init - - deinit { - print("\(#file) is dead") - } - - // MARK: - life Cycle - - override func viewDidLoad() { - super.viewDidLoad() - setupDelegation() - setupNotificationCenter() - } - - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - setupLargeTitle() - } - - override func setupLayout() { - view.addSubview(nameTextField) - nameTextField.snp.makeConstraints { - $0.top.equalTo(view.safeAreaLayoutGuide).inset(66) - $0.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) - $0.height.equalTo(60) - } - - view.addSubview(roomsTextLimit) - roomsTextLimit.snp.makeConstraints { - $0.top.equalTo(nameTextField.snp.bottom).offset(10) - $0.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) - } - - view.addSubview(doneButton) - doneButton.snp.makeConstraints { - $0.bottom.equalTo(view.safeAreaLayoutGuide).inset(23) - $0.centerX.equalToSuperview() - } - } - - // MARK: - Seletors - - @objc private func didTapDoneButton() { - if let text = nameTextField.text, !text.isEmpty { - nickname = text - UserDefaultHandler.setNickname(nickname: nickname) - requestChangeNickname(nickname: NicknameDTO(nickname: nickname)) - navigationController?.popViewController(animated: true) - } - } - - @objc private func keyboardWillShow(notification:NSNotification) { - if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { - UIView.animate(withDuration: 0.2, animations: { - self.doneButton.transform = CGAffineTransform(translationX: 0, y: -keyboardSize.height + 30) - }) - } - } - - @objc private func keyboardWillHide(notification:NSNotification) { - UIView.animate(withDuration: 0.2, animations: { - self.doneButton.transform = .identity - }) - } - - override func endEditingView() { - if !doneButton.isTouchInside { - view.endEditing(true) - } - } - - // MARK: - API - func requestChangeNickname(nickname: NicknameDTO) { - Task { - do { - let _ = try await self.settingRepository.putUserInfo(nickname: nickname) - } catch NetworkError.serverError { - print("server Error") - } catch NetworkError.encodingError { - print("encoding Error") - } catch NetworkError.clientError(let message) { - print("client Error: \(message)") - } - } - } - - // MARK: - Funtions - - private func setupLargeTitle() { - navigationController?.navigationBar.prefersLargeTitles = true - navigationItem.largeTitleDisplayMode = .automatic - } - - private func setupDelegation() { - nameTextField.delegate = self - } - - private func setupNotificationCenter() { - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil) - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) - } - - private func setCounter(count: Int) { - if count <= maxLength { - roomsTextLimit.text = "\(count)/\(maxLength)" - } else { - roomsTextLimit.text = "\(maxLength)/\(maxLength)" - } - } - - private func checkMaxLength(textField: UITextField, maxLength: Int) { - if let text = textField.text { - if text.count > maxLength { - let endIndex = text.index(text.startIndex, offsetBy: maxLength) - let fixedText = text[text.startIndex.. Bool { - nameTextField.resignFirstResponder() - return true - } - - func textFieldDidChangeSelection(_ textField: UITextField) { - setCounter(count: textField.text?.count ?? 0) - checkMaxLength(textField: nameTextField, maxLength: maxLength) - - let hasText = nameTextField.hasText - doneButton.isDisabled = !hasText - } -} diff --git a/Manito/Manito/Screens/ChangeNickname/ViewControllers/ChangeNickNameViewController.swift b/Manito/Manito/Screens/ChangeNickname/ViewControllers/ChangeNickNameViewController.swift new file mode 100644 index 000000000..703c7c5d5 --- /dev/null +++ b/Manito/Manito/Screens/ChangeNickname/ViewControllers/ChangeNickNameViewController.swift @@ -0,0 +1,107 @@ +// +// ChangeNickNameViewController.swift +// Manito +// +// Created by LeeSungHo on 2022/09/05. +// + +import Combine +import UIKit + +import SnapKit + +class ChangeNickNameViewController: BaseViewController { + + // MARK: - property + + private let viewModel: NicknameViewModel + private lazy var nicknameView: NicknameView = NicknameView(title: TextLiteral.changeNickNameViewControllerTitle) + + private var cancellable = Set() + + // MARK: - init + + init(viewModel: NicknameViewModel) { + self.viewModel = viewModel + super.init() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + deinit { + print("\(#file) is dead") + } + + // MARK: - life cycle + + override func loadView() { + self.view = self.nicknameView + } + + override func viewDidLoad() { + super.viewDidLoad() + self.bindViewModel() + } + + // MARK: - override + + override func endEditingView() { + self.nicknameView.endEditingView() + } + + // MARK: - func + + private func bindViewModel() { + let output = self.transformedOutput() + self.bindOutputToViewModel(output) + } + + private func transformedOutput() -> NicknameViewModel.Output { + let input = NicknameViewModel.Input(viewDidLoad: self.viewDidLoadPublisher, + textFieldDidChanged: self.nicknameView.textFieldPublisher.eraseToAnyPublisher(), + doneButtonDidTap: self.nicknameView.doneButtonTapPublisher.eraseToAnyPublisher()) + return viewModel.transform(from: input) + } + + private func bindOutputToViewModel(_ output: NicknameViewModel.Output) { + output.nickname + .sink { [weak self] nickname in + self?.nicknameView.setupNickname(nickname: nickname) + } + .store(in: &self.cancellable) + + output.title + .sink { [weak self] text in + self?.nicknameView.updateTextCount(count: text.count, maxLength: self?.viewModel.maxCount ?? 0) + } + .store(in: &self.cancellable) + + output.fixedTitleByMaxCount + .sink { [weak self] fixedTitle in + self?.nicknameView.updateTextFieldText(fixedText: fixedTitle) + } + .store(in: &self.cancellable) + + output.isEnabled + .sink { [weak self] isEnabled in + self?.nicknameView.toggleDoneButton(isEnabled: isEnabled) + } + .store(in: &self.cancellable) + + output.doneButton + .receive(on: DispatchQueue.main) + .sink { [weak self] result in + switch result { + case .finished: return + case .failure(_): + self?.makeAlert(title: TextLiteral.fail, message: "실패") + } + } receiveValue: { [weak self] _ in + self?.navigationController?.popViewController(animated: true) + } + .store(in: &self.cancellable) + } +} diff --git a/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift b/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift index d844590d3..f41d424cd 100644 --- a/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift +++ b/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift @@ -133,6 +133,10 @@ final class NicknameView: UIView { self.doneButton.isDisabled = !isEnabled } + func setupNickname(nickname: String) { + self.nicknameTextField.text = nickname + } + // MARK: - selector @objc private func keyboardWillShow(notification:NSNotification) { diff --git a/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift b/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift index eef8c2b0c..45ae7a9b4 100644 --- a/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift +++ b/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift @@ -35,7 +35,7 @@ class CreateNickNameViewController: BaseViewController { print("\(#file) is dead") } - // MARK: - life Cycle + // MARK: - life cycle override func loadView() { self.view = self.nicknameView @@ -46,12 +46,6 @@ class CreateNickNameViewController: BaseViewController { self.bindViewModel() } - // MARK: - override - - override func configureUI() { - super.configureUI() - } - private func presentMainViewController() { let storyboard = UIStoryboard(name: "Main", bundle: nil) let viewController = storyboard.instantiateViewController(withIdentifier: "MainNavigationController") @@ -72,7 +66,8 @@ class CreateNickNameViewController: BaseViewController { } private func transformedOutput() -> NicknameViewModel.Output { - let input = NicknameViewModel.Input(textFieldDidChanged: self.nicknameView.textFieldPublisher.eraseToAnyPublisher(), + let input = NicknameViewModel.Input(viewDidLoad: self.viewDidLoadPublisher, + textFieldDidChanged: self.nicknameView.textFieldPublisher.eraseToAnyPublisher(), doneButtonDidTap: self.nicknameView.doneButtonTapPublisher.eraseToAnyPublisher()) return viewModel.transform(from: input) } diff --git a/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift b/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift index f62becd31..b2bcfdde9 100644 --- a/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift +++ b/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift @@ -21,11 +21,13 @@ final class NicknameViewModel { private let doneButtonSubject = PassthroughSubject() struct Input { + let viewDidLoad: AnyPublisher let textFieldDidChanged: AnyPublisher let doneButtonDidTap: AnyPublisher } struct Output { + let nickname: AnyPublisher let title: AnyPublisher let fixedTitleByMaxCount: AnyPublisher let isEnabled: AnyPublisher @@ -33,6 +35,13 @@ final class NicknameViewModel { } func transform(from input: Input) -> Output { + let nickname = input.viewDidLoad + .map { _ -> String in + let nickname = UserDefaultStorage.nickname + return nickname + } + .eraseToAnyPublisher() + let title = input.textFieldDidChanged .map { [weak self] text -> String in self?.nicknameSubject.send(text) @@ -66,7 +75,8 @@ final class NicknameViewModel { }) .store(in: &self.cancellable) - return Output(title: title, + return Output(nickname: nickname, + title: title, fixedTitleByMaxCount: fixedTitle, isEnabled: isEnabled, doneButton: self.doneButtonSubject) diff --git a/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift b/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift index 7d0a0920b..83bdb9d30 100644 --- a/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift @@ -101,7 +101,7 @@ final class SettingViewController: BaseViewController { extension SettingViewController: SettingViewDelegate { func changNicknameButtonDidTap() { - self.navigationController?.pushViewController(ChangeNickNameViewController(), animated: true) + self.navigationController?.pushViewController(ChangeNickNameViewController(viewModel: NicknameViewModel(nicknameService: NicknameService(repository: SettingRepositoryImpl()))), animated: true) } func personalInfomationButtonDidTap() { From f2dbbaa0b196583a97662a388125a62757297f2f Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 16:38:10 +0900 Subject: [PATCH 415/468] =?UTF-8?q?[CHORE]=20=EB=84=A4=EB=B9=84=EA=B2=8C?= =?UTF-8?q?=EC=9D=B4=EC=85=98=EB=B0=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0=20(#507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Global/Literal/TextLiteral.swift | 2 +- .../CreateNickName/View/NicknameView.swift | 8 ++++++- .../CreateNickNameViewController.swift | 21 +++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Global/Literal/TextLiteral.swift b/Manito/Manito/Global/Literal/TextLiteral.swift index 9ef2500bc..9558054a2 100644 --- a/Manito/Manito/Global/Literal/TextLiteral.swift +++ b/Manito/Manito/Global/Literal/TextLiteral.swift @@ -228,7 +228,7 @@ enum TextLiteral { static let inputDateViewTitle: String = "진행 기간을 설정해 주세요" // MARK: - ChangeNickNameViewController - static let changeNickNameViewControllerTitle: String = "닉네임 변경하기" + static let changeNickNameViewControllerTitle: String = "닉네임 변경" // MARK: - InvitedCodeViewController static let invitedCodeViewCOntroller: String = "글자를 탭하여 코드를 복사하세요" diff --git a/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift b/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift index f41d424cd..e5fb76f1e 100644 --- a/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift +++ b/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift @@ -67,6 +67,7 @@ final class NicknameView: UIView { self.title = title super.init(frame: .zero) self.setupLayout() + self.setupNotificationCenter() } @available(*, unavailable) @@ -79,7 +80,7 @@ final class NicknameView: UIView { private func setupLayout() { self.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { - $0.top.equalTo(self.safeAreaLayoutGuide).inset(66) + $0.top.equalTo(self.safeAreaLayoutGuide).inset(20) $0.leading.equalTo(self.safeAreaLayoutGuide).inset(Size.leadingTrailingPadding) } @@ -108,6 +109,11 @@ final class NicknameView: UIView { NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) } + func configureNavigationItem(_ navigationController: UINavigationController) { + navigationController.isNavigationBarHidden = false + navigationController.navigationBar.isHidden = false + } + func endEditingView() { if !self.doneButton.isTouchInside { self.endEditing(true) diff --git a/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift b/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift index 45ae7a9b4..9a12095ac 100644 --- a/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift +++ b/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift @@ -43,6 +43,8 @@ class CreateNickNameViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() + self.configureNavigationController() + self.setupBackButton() self.bindViewModel() } @@ -58,8 +60,27 @@ class CreateNickNameViewController: BaseViewController { self.nicknameView.endEditingView() } + override func removeBarButtonItemOffset(with view: UIView, offsetX: CGFloat = 0, offsetY: CGFloat = 0) -> UIView { + let offsetView = UIView(frame: CGRect(x: 0, y: 0, width: 45, height: 45)) + offsetView.bounds = offsetView.bounds.offsetBy(dx: offsetX, dy: offsetY) + offsetView.addSubview(view) + return offsetView + } + // MARK: - func + private func configureNavigationController() { + guard let navigationController = self.navigationController else { return } + self.nicknameView.configureNavigationItem(navigationController) + } + + private func setupBackButton() { + let leftOffsetBackButton = removeBarButtonItemOffset(with: UIView(), offsetX: 10) + let emptyView = makeBarButtonItem(with: leftOffsetBackButton) + + navigationItem.leftBarButtonItem = emptyView + } + private func bindViewModel() { let output = self.transformedOutput() self.bindOutputToViewModel(output) From 7b3d04089f6c55b2f02cb5dc8d35457b0bcbcb1c Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 16:43:27 +0900 Subject: [PATCH 416/468] =?UTF-8?q?[CHORE]=20view=EC=9D=98=20=EC=9E=88?= =?UTF-8?q?=EB=8A=94=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20viewModel=EB=A1=9C=20?= =?UTF-8?q?=EC=98=AE=EA=B8=B0=EA=B8=B0=20(#507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewControllers/ChangeNickNameViewController.swift | 1 + .../Manito/Screens/CreateNickName/View/NicknameView.swift | 4 +--- .../ViewControllers/CreateNickNameViewController.swift | 6 ++++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/ChangeNickname/ViewControllers/ChangeNickNameViewController.swift b/Manito/Manito/Screens/ChangeNickname/ViewControllers/ChangeNickNameViewController.swift index 703c7c5d5..719651e36 100644 --- a/Manito/Manito/Screens/ChangeNickname/ViewControllers/ChangeNickNameViewController.swift +++ b/Manito/Manito/Screens/ChangeNickname/ViewControllers/ChangeNickNameViewController.swift @@ -69,6 +69,7 @@ class ChangeNickNameViewController: BaseViewController { private func bindOutputToViewModel(_ output: NicknameViewModel.Output) { output.nickname .sink { [weak self] nickname in + self?.nicknameView.updateTextCount(count: nickname.count, maxLength: self?.viewModel.maxCount ?? 0) self?.nicknameView.setupNickname(nickname: nickname) } .store(in: &self.cancellable) diff --git a/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift b/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift index e5fb76f1e..ff054d3b4 100644 --- a/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift +++ b/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift @@ -40,9 +40,8 @@ final class NicknameView: UIView { textField.delegate = self return textField }() - private lazy var textLimitLabel: UILabel = { + private let textLimitLabel: UILabel = { let label = UILabel() - label.text = "0/\(maxLength)" label.font = .font(.regular, ofSize: 20) label.textColor = .grey002 return label @@ -57,7 +56,6 @@ final class NicknameView: UIView { // MARK: - property private let title: String - private let maxLength = 5 lazy var doneButtonTapPublisher = self.doneButton.tapPublisher let textFieldPublisher = PassthroughSubject() diff --git a/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift b/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift index 9a12095ac..6335ba002 100644 --- a/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift +++ b/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift @@ -94,6 +94,12 @@ class CreateNickNameViewController: BaseViewController { } private func bindOutputToViewModel(_ output: NicknameViewModel.Output) { + output.nickname + .sink { [weak self] _ in + self?.nicknameView.updateTextCount(count: 0, maxLength: self?.viewModel.maxCount ?? 0) + } + .store(in: &self.cancellable) + output.title .sink { [weak self] text in self?.nicknameView.updateTextCount(count: text.count, maxLength: self?.viewModel.maxCount ?? 0) From a237254ee61aec683d9d6665a938c543b3719232 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 17:31:23 +0900 Subject: [PATCH 417/468] =?UTF-8?q?[CHORE]=20=EB=B3=80=EC=88=98=EB=AA=85?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20(#507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChangeNickNameViewController.swift | 10 +++++----- .../CreateNickNameViewController.swift | 8 ++++---- .../CreateNickName/ViewModel/NicknameViewModel.swift | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Manito/Manito/Screens/ChangeNickname/ViewControllers/ChangeNickNameViewController.swift b/Manito/Manito/Screens/ChangeNickname/ViewControllers/ChangeNickNameViewController.swift index 719651e36..b4ce117fc 100644 --- a/Manito/Manito/Screens/ChangeNickname/ViewControllers/ChangeNickNameViewController.swift +++ b/Manito/Manito/Screens/ChangeNickname/ViewControllers/ChangeNickNameViewController.swift @@ -67,14 +67,14 @@ class ChangeNickNameViewController: BaseViewController { } private func bindOutputToViewModel(_ output: NicknameViewModel.Output) { - output.nickname - .sink { [weak self] nickname in - self?.nicknameView.updateTextCount(count: nickname.count, maxLength: self?.viewModel.maxCount ?? 0) - self?.nicknameView.setupNickname(nickname: nickname) + output.isSetNickname + .sink { [weak self] isSetNickname in + self?.nicknameView.updateTextCount(count: isSetNickname.count, maxLength: self?.viewModel.maxCount ?? 0) + self?.nicknameView.setupNickname(nickname: isSetNickname) } .store(in: &self.cancellable) - output.title + output.isNewNickname .sink { [weak self] text in self?.nicknameView.updateTextCount(count: text.count, maxLength: self?.viewModel.maxCount ?? 0) } diff --git a/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift b/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift index 6335ba002..4cb27d58f 100644 --- a/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift +++ b/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift @@ -94,15 +94,15 @@ class CreateNickNameViewController: BaseViewController { } private func bindOutputToViewModel(_ output: NicknameViewModel.Output) { - output.nickname + output.isSetNickname .sink { [weak self] _ in self?.nicknameView.updateTextCount(count: 0, maxLength: self?.viewModel.maxCount ?? 0) } .store(in: &self.cancellable) - output.title - .sink { [weak self] text in - self?.nicknameView.updateTextCount(count: text.count, maxLength: self?.viewModel.maxCount ?? 0) + output.isNewNickname + .sink { [weak self] newNickname in + self?.nicknameView.updateTextCount(count: newNickname.count, maxLength: self?.viewModel.maxCount ?? 0) } .store(in: &self.cancellable) diff --git a/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift b/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift index b2bcfdde9..dd8e71256 100644 --- a/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift +++ b/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift @@ -27,22 +27,22 @@ final class NicknameViewModel { } struct Output { - let nickname: AnyPublisher - let title: AnyPublisher + let isSetNickname: AnyPublisher + let isNewNickname: AnyPublisher let fixedTitleByMaxCount: AnyPublisher let isEnabled: AnyPublisher let doneButton: PassthroughSubject } func transform(from input: Input) -> Output { - let nickname = input.viewDidLoad + let isSetNickname = input.viewDidLoad .map { _ -> String in let nickname = UserDefaultStorage.nickname return nickname } .eraseToAnyPublisher() - let title = input.textFieldDidChanged + let isNewNickname = input.textFieldDidChanged .map { [weak self] text -> String in self?.nicknameSubject.send(text) return text @@ -75,8 +75,8 @@ final class NicknameViewModel { }) .store(in: &self.cancellable) - return Output(nickname: nickname, - title: title, + return Output(isSetNickname: isSetNickname, + isNewNickname: isNewNickname, fixedTitleByMaxCount: fixedTitle, isEnabled: isEnabled, doneButton: self.doneButtonSubject) From 27e7c0f178bbdb3f33fd9901b24b1e7d47ac95d9 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 17:32:33 +0900 Subject: [PATCH 418/468] =?UTF-8?q?[CHORE]=20=ED=8F=B4=EB=8D=94=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=ED=95=A9=EC=B9=A8=20CreateNickname=20+=20?= =?UTF-8?q?ChangeNickname=20(#507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 22 +++---------------- .../Service/NicknameService.swift | 0 .../View/NicknameView.swift | 0 .../ChangeNickNameViewController.swift | 0 .../CreateNickNameViewController.swift | 0 .../ViewModel/NicknameViewModel.swift | 0 6 files changed, 3 insertions(+), 19 deletions(-) rename Manito/Manito/Screens/{CreateNickName => NickName}/Service/NicknameService.swift (100%) rename Manito/Manito/Screens/{CreateNickName => NickName}/View/NicknameView.swift (100%) rename Manito/Manito/Screens/{ChangeNickname => NickName}/ViewControllers/ChangeNickNameViewController.swift (100%) rename Manito/Manito/Screens/{CreateNickName => NickName}/ViewControllers/CreateNickNameViewController.swift (100%) rename Manito/Manito/Screens/{CreateNickName => NickName}/ViewModel/NicknameViewModel.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 89a49d9fc..cc835a9b7 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -517,7 +517,7 @@ path = View; sourceTree = ""; }; - 7E0C5C342855B1EF00F698D1 /* CreateNickName */ = { + 7E0C5C342855B1EF00F698D1 /* NickName */ = { isa = PBXGroup; children = ( D719395A2AA23EF200A73D6C /* Service */, @@ -525,7 +525,7 @@ D719395C2AA23F0400A73D6C /* View */, D719395D2AA23F0900A73D6C /* ViewControllers */, ); - path = CreateNickName; + path = NickName; sourceTree = ""; }; 7E3058C42854B45300489E6A /* UIComponent */ = { @@ -837,8 +837,7 @@ D724AF5B287088110003F280 /* Setting */, B50B1B28285AB7550080992C /* Splash */, 39C957CC2876E2BE00A04A2B /* Login */, - D71939572AA1C9A000A73D6C /* ChangeNickname */, - 7E0C5C342855B1EF00F698D1 /* CreateNickName */, + 7E0C5C342855B1EF00F698D1 /* NickName */, B5F524E628519B0A00614FF7 /* Main */, B50B1B3F285B047C0080992C /* Interaction */, CBA15C91285CE1880051EDE2 /* ChooseCharacter */, @@ -1214,14 +1213,6 @@ path = ViewControllers; sourceTree = ""; }; - D71939572AA1C9A000A73D6C /* ChangeNickname */ = { - isa = PBXGroup; - children = ( - D71939632AA2E47100A73D6C /* ViewControllers */, - ); - path = ChangeNickname; - sourceTree = ""; - }; D719395A2AA23EF200A73D6C /* Service */ = { isa = PBXGroup; children = ( @@ -1250,13 +1241,6 @@ isa = PBXGroup; children = ( 7E0C5C352855B22700F698D1 /* CreateNickNameViewController.swift */, - ); - path = ViewControllers; - sourceTree = ""; - }; - D71939632AA2E47100A73D6C /* ViewControllers */ = { - isa = PBXGroup; - children = ( 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */, ); path = ViewControllers; diff --git a/Manito/Manito/Screens/CreateNickName/Service/NicknameService.swift b/Manito/Manito/Screens/NickName/Service/NicknameService.swift similarity index 100% rename from Manito/Manito/Screens/CreateNickName/Service/NicknameService.swift rename to Manito/Manito/Screens/NickName/Service/NicknameService.swift diff --git a/Manito/Manito/Screens/CreateNickName/View/NicknameView.swift b/Manito/Manito/Screens/NickName/View/NicknameView.swift similarity index 100% rename from Manito/Manito/Screens/CreateNickName/View/NicknameView.swift rename to Manito/Manito/Screens/NickName/View/NicknameView.swift diff --git a/Manito/Manito/Screens/ChangeNickname/ViewControllers/ChangeNickNameViewController.swift b/Manito/Manito/Screens/NickName/ViewControllers/ChangeNickNameViewController.swift similarity index 100% rename from Manito/Manito/Screens/ChangeNickname/ViewControllers/ChangeNickNameViewController.swift rename to Manito/Manito/Screens/NickName/ViewControllers/ChangeNickNameViewController.swift diff --git a/Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift b/Manito/Manito/Screens/NickName/ViewControllers/CreateNickNameViewController.swift similarity index 100% rename from Manito/Manito/Screens/CreateNickName/ViewControllers/CreateNickNameViewController.swift rename to Manito/Manito/Screens/NickName/ViewControllers/CreateNickNameViewController.swift diff --git a/Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift b/Manito/Manito/Screens/NickName/ViewModel/NicknameViewModel.swift similarity index 100% rename from Manito/Manito/Screens/CreateNickName/ViewModel/NicknameViewModel.swift rename to Manito/Manito/Screens/NickName/ViewModel/NicknameViewModel.swift From 18ac6d7d6be354509e1a429f5196da2f5b701534 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 19:21:41 +0900 Subject: [PATCH 419/468] =?UTF-8?q?[CHORE]=20NickName=20->=20Nickname=20?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 16 ++++++++-------- .../Screens/Login/LoginViewController.swift | 2 +- ....swift => ChangeNicknameViewController.swift} | 2 +- ....swift => CreateNicknameViewController.swift} | 2 +- .../ViewControllers/SettingViewController.swift | 2 +- .../Screens/Splash/SplashViewController.swift | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) rename Manito/Manito/Screens/NickName/ViewControllers/{ChangeNickNameViewController.swift => ChangeNicknameViewController.swift} (98%) rename Manito/Manito/Screens/NickName/ViewControllers/{CreateNickNameViewController.swift => CreateNicknameViewController.swift} (98%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index cc835a9b7..45bed6c8c 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -41,14 +41,14 @@ 39FFE32828EEFFFE008442EE /* MoreButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39FFE32728EEFFFE008442EE /* MoreButton.swift */; }; 39FFE33428F457AF008442EE /* FirebaseMessaging in Frameworks */ = {isa = PBXBuildFile; productRef = 39FFE33328F457AF008442EE /* FirebaseMessaging */; }; 435B17682913E71400212663 /* DetailingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 435B17672913E71400212663 /* DetailingViewController.swift */; }; - 7E0C5C362855B22700F698D1 /* CreateNickNameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E0C5C352855B22700F698D1 /* CreateNickNameViewController.swift */; }; + 7E0C5C362855B22700F698D1 /* CreateNicknameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E0C5C352855B22700F698D1 /* CreateNicknameViewController.swift */; }; 7E0C5C382855B73100F698D1 /* Splash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7E0C5C372855B73100F698D1 /* Splash.storyboard */; }; 7E15F67E28B35B3D00441305 /* TextLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E15F67D28B35B3D00441305 /* TextLiteral.swift */; }; 7E3058C62854B47F00489E6A /* InputTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C52854B47F00489E6A /* InputTitleView.swift */; }; 7E3058C82854B64D00489E6A /* InputCapacityView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C72854B64D00489E6A /* InputCapacityView.swift */; }; 7E3058CA2854B7A900489E6A /* InputDateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E3058C92854B7A900489E6A /* InputDateView.swift */; }; 7E7542B32923744300D725CB /* ToastPopupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E7542B22923744300D725CB /* ToastPopupView.swift */; }; - 7EA25C2728C4FEA800746AEA /* ChangeNickNameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */; }; + 7EA25C2728C4FEA800746AEA /* ChangeNicknameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EA25C2628C4FEA800746AEA /* ChangeNicknameViewController.swift */; }; 7ED845BA2876BE530075AC61 /* SettingViewTableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ED845B92876BE530075AC61 /* SettingViewTableCell.swift */; }; B50B1AF92856B2C60080992C /* CreateLetterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50B1AF82856B2C60080992C /* CreateLetterViewController.swift */; }; B50B1AFB2856B5180080992C /* IndividualMissionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50B1AFA2856B5180080992C /* IndividualMissionView.swift */; }; @@ -245,14 +245,14 @@ 39FFE32728EEFFFE008442EE /* MoreButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreButton.swift; sourceTree = ""; }; 39FFE33528F45E44008442EE /* GoogleService-Info-Prod.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info-Prod.plist"; sourceTree = ""; }; 435B17672913E71400212663 /* DetailingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailingViewController.swift; sourceTree = ""; }; - 7E0C5C352855B22700F698D1 /* CreateNickNameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateNickNameViewController.swift; sourceTree = ""; }; + 7E0C5C352855B22700F698D1 /* CreateNicknameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateNicknameViewController.swift; sourceTree = ""; }; 7E0C5C372855B73100F698D1 /* Splash.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Splash.storyboard; sourceTree = ""; }; 7E15F67D28B35B3D00441305 /* TextLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextLiteral.swift; sourceTree = ""; }; 7E3058C52854B47F00489E6A /* InputTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputTitleView.swift; sourceTree = ""; }; 7E3058C72854B64D00489E6A /* InputCapacityView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputCapacityView.swift; sourceTree = ""; }; 7E3058C92854B7A900489E6A /* InputDateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputDateView.swift; sourceTree = ""; }; 7E7542B22923744300D725CB /* ToastPopupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToastPopupView.swift; sourceTree = ""; }; - 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangeNickNameViewController.swift; sourceTree = ""; }; + 7EA25C2628C4FEA800746AEA /* ChangeNicknameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangeNicknameViewController.swift; sourceTree = ""; }; 7ED845B92876BE530075AC61 /* SettingViewTableCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewTableCell.swift; sourceTree = ""; }; B50B1AF82856B2C60080992C /* CreateLetterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateLetterViewController.swift; sourceTree = ""; }; B50B1AFA2856B5180080992C /* IndividualMissionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IndividualMissionView.swift; sourceTree = ""; }; @@ -1240,8 +1240,8 @@ D719395D2AA23F0900A73D6C /* ViewControllers */ = { isa = PBXGroup; children = ( - 7E0C5C352855B22700F698D1 /* CreateNickNameViewController.swift */, - 7EA25C2628C4FEA800746AEA /* ChangeNickNameViewController.swift */, + 7E0C5C352855B22700F698D1 /* CreateNicknameViewController.swift */, + 7EA25C2628C4FEA800746AEA /* ChangeNicknameViewController.swift */, ); path = ViewControllers; sourceTree = ""; @@ -1540,7 +1540,7 @@ B5A085F22A9732E800C8A98D /* MemoryDTO.swift in Sources */, B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */, D7C4A1A92A0B895300C3AE4C /* ChooseCharacterView.swift in Sources */, - 7EA25C2728C4FEA800746AEA /* ChangeNickNameViewController.swift in Sources */, + 7EA25C2728C4FEA800746AEA /* ChangeNicknameViewController.swift in Sources */, D724AF5F28708D830003F280 /* ImageRowView.swift in Sources */, 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */, B5F5251E2851A1C700614FF7 /* BaseTableViewCell.swift in Sources */, @@ -1569,7 +1569,7 @@ B5F525262851A26D00614FF7 /* NSObject+Extension.swift in Sources */, 39FFE32828EEFFFE008442EE /* MoreButton.swift in Sources */, B5706BE129ADC20A0093D198 /* CreateLetterView.swift in Sources */, - 7E0C5C362855B22700F698D1 /* CreateNickNameViewController.swift in Sources */, + 7E0C5C362855B22700F698D1 /* CreateNicknameViewController.swift in Sources */, B5B3C15D2A41D6EB00AABD6F /* LetterViewModel.swift in Sources */, B5A085FC2A97470400C8A98D /* RoomInfo.swift in Sources */, CB674C1C285966020063A6B7 /* InputInvitedCodeView.swift in Sources */, diff --git a/Manito/Manito/Screens/Login/LoginViewController.swift b/Manito/Manito/Screens/Login/LoginViewController.swift index f95b065f4..b9a2a68b5 100644 --- a/Manito/Manito/Screens/Login/LoginViewController.swift +++ b/Manito/Manito/Screens/Login/LoginViewController.swift @@ -113,7 +113,7 @@ extension LoginViewController: ASAuthorizationControllerDelegate { if let isNewMember = data.isNewMember { if isNewMember { - self.navigationController?.pushViewController(CreateNickNameViewController(viewModel: NicknameViewModel(nicknameService: NicknameService(repository: SettingRepositoryImpl()))), animated: true) + self.navigationController?.pushViewController(CreateNicknameViewController(viewModel: NicknameViewModel(nicknameService: NicknameService(repository: SettingRepositoryImpl()))), animated: true) return } } diff --git a/Manito/Manito/Screens/NickName/ViewControllers/ChangeNickNameViewController.swift b/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift similarity index 98% rename from Manito/Manito/Screens/NickName/ViewControllers/ChangeNickNameViewController.swift rename to Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift index b4ce117fc..d8b9ae35f 100644 --- a/Manito/Manito/Screens/NickName/ViewControllers/ChangeNickNameViewController.swift +++ b/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift @@ -10,7 +10,7 @@ import UIKit import SnapKit -class ChangeNickNameViewController: BaseViewController { +class ChangeNicknameViewController: BaseViewController { // MARK: - property diff --git a/Manito/Manito/Screens/NickName/ViewControllers/CreateNickNameViewController.swift b/Manito/Manito/Screens/NickName/ViewControllers/CreateNicknameViewController.swift similarity index 98% rename from Manito/Manito/Screens/NickName/ViewControllers/CreateNickNameViewController.swift rename to Manito/Manito/Screens/NickName/ViewControllers/CreateNicknameViewController.swift index 4cb27d58f..e74f790e8 100644 --- a/Manito/Manito/Screens/NickName/ViewControllers/CreateNickNameViewController.swift +++ b/Manito/Manito/Screens/NickName/ViewControllers/CreateNicknameViewController.swift @@ -10,7 +10,7 @@ import UIKit import SnapKit -class CreateNickNameViewController: BaseViewController { +class CreateNicknameViewController: BaseViewController { // MARK: - property diff --git a/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift b/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift index 83bdb9d30..314344585 100644 --- a/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift @@ -101,7 +101,7 @@ final class SettingViewController: BaseViewController { extension SettingViewController: SettingViewDelegate { func changNicknameButtonDidTap() { - self.navigationController?.pushViewController(ChangeNickNameViewController(viewModel: NicknameViewModel(nicknameService: NicknameService(repository: SettingRepositoryImpl()))), animated: true) + self.navigationController?.pushViewController(ChangeNicknameViewController(viewModel: NicknameViewModel(nicknameService: NicknameService(repository: SettingRepositoryImpl()))), animated: true) } func personalInfomationButtonDidTap() { diff --git a/Manito/Manito/Screens/Splash/SplashViewController.swift b/Manito/Manito/Screens/Splash/SplashViewController.swift index 061fb3e91..9a7c18aa3 100644 --- a/Manito/Manito/Screens/Splash/SplashViewController.swift +++ b/Manito/Manito/Screens/Splash/SplashViewController.swift @@ -52,7 +52,7 @@ final class SplashViewController: UIViewController { } private func presentNicknameSettingViewController() { - let viewController = CreateNickNameViewController(viewModel: NicknameViewModel(nicknameService: NicknameService(repository: SettingRepositoryImpl()))) + let viewController = CreateNicknameViewController(viewModel: NicknameViewModel(nicknameService: NicknameService(repository: SettingRepositoryImpl()))) viewController.modalPresentationStyle = .fullScreen viewController.modalTransitionStyle = .crossDissolve self.present(viewController, animated: true) From b104819b2c79c9960fff5541c1593e801f80d9f3 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Sat, 2 Sep 2023 20:26:04 +0900 Subject: [PATCH 420/468] =?UTF-8?q?[ADD]=20RoomState=20Enum=20Type=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80(#509)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++++ .../xcshareddata/swiftpm/Package.resolved | 16 +++++++-------- .../Data/DTO/Response/RoomListDTO.swift | 2 +- Manito/Manito/Domain/Entity/RoomInfo.swift | 2 +- .../Manito/Domain/Entity/RoomListItem.swift | 20 ++++++++++++++++++- Manito/Manito/Domain/Entity/RoomState.swift | 14 +++++++++++++ 6 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 Manito/Manito/Domain/Entity/RoomState.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 049926950..89af594f8 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -115,6 +115,7 @@ B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */; }; B5F31BB228BE1CD700F61D0F /* UserDefaultHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BB128BE1CD700F61D0F /* UserDefaultHandler.swift */; }; B5F31C5028BF922E00F61D0F /* LetterViewController+MailCompose.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31C4F28BF922E00F61D0F /* LetterViewController+MailCompose.swift */; }; + B5F3F1062AA3516200FA1A32 /* RoomState.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F3F1052AA3516200FA1A32 /* RoomState.swift */; }; B5F524CF28519AA000614FF7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F524CE28519AA000614FF7 /* AppDelegate.swift */; }; B5F524D128519AA000614FF7 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F524D028519AA000614FF7 /* SceneDelegate.swift */; }; B5F524D628519AA000614FF7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B5F524D428519AA000614FF7 /* Main.storyboard */; }; @@ -314,6 +315,7 @@ B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultStorage.swift; sourceTree = ""; }; B5F31BB128BE1CD700F61D0F /* UserDefaultHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultHandler.swift; sourceTree = ""; }; B5F31C4F28BF922E00F61D0F /* LetterViewController+MailCompose.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LetterViewController+MailCompose.swift"; sourceTree = ""; }; + B5F3F1052AA3516200FA1A32 /* RoomState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomState.swift; sourceTree = ""; }; B5F524CB28519AA000614FF7 /* Manito.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Manito.app; sourceTree = BUILT_PRODUCTS_DIR; }; B5F524CE28519AA000614FF7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; B5F524D028519AA000614FF7 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -732,6 +734,7 @@ B5A086012A974B8100C8A98D /* RoomListItem.swift */, B5A085FB2A97470400C8A98D /* RoomInfo.swift */, B5A086032A974D2000C8A98D /* ParticipantList.swift */, + B5F3F1052AA3516200FA1A32 /* RoomState.swift */, ); path = Entity; sourceTree = ""; @@ -1548,6 +1551,7 @@ B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */, B5A085EC2A97314800C8A98D /* ParticipatedRoomInfoDTO.swift in Sources */, D724AF5D287088310003F280 /* SettingViewController.swift in Sources */, + B5F3F1062AA3516200FA1A32 /* RoomState.swift in Sources */, B5F5253D2854B8CB00614FF7 /* UIView+Extension.swift in Sources */, 39018F4228C4708A00C78DBA /* UIButton+Extension.swift in Sources */, CB5AE3E4285AAF7400382EA3 /* RoomInfoView.swift in Sources */, diff --git a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a3ff76c5d..f825ebc64 100644 --- a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleDataTransport.git", "state" : { - "revision" : "f6b558e3f801f2cac336b04f615ce111fa9ddaa0", - "version" : "9.2.1" + "revision" : "aae45a320fd0d11811820335b1eabc8753902a40", + "version" : "9.2.5" } }, { @@ -68,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleUtilities.git", "state" : { - "revision" : "0543562f85620b5b7c510c6bcbef75b562a5127b", - "version" : "7.11.0" + "revision" : "c38ce365d77b04a9a300c31061c5227589e5597b", + "version" : "7.11.5" } }, { @@ -113,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/promises.git", "state" : { - "revision" : "ec957ccddbcc710ccc64c9dcbd4c7006fcf8b73a", - "version" : "2.2.0" + "revision" : "e70e889c0196c76d22759eb50d6a0270ca9f1d9e", + "version" : "2.3.1" } }, { @@ -140,8 +140,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "0af9125c4eae12a4973fb66574c53a54962a9e1e", - "version" : "1.21.0" + "revision" : "ce20dc083ee485524b802669890291c0d8090170", + "version" : "1.22.1" } } ], diff --git a/Manito/Manito/Data/DTO/Response/RoomListDTO.swift b/Manito/Manito/Data/DTO/Response/RoomListDTO.swift index aa15d2d00..6dca36d12 100644 --- a/Manito/Manito/Data/DTO/Response/RoomListDTO.swift +++ b/Manito/Manito/Data/DTO/Response/RoomListDTO.swift @@ -25,7 +25,7 @@ extension RoomListItemDTO { func toRoomListItem() -> RoomListItem { return RoomListItem(id: self.id ?? 0, title: self.title ?? "", - state: self.state ?? "", + state: self.state ?? "PRE", participatingCount: self.participatingCount, capacity: self.capacity ?? 0, startDate: self.startDate ?? "", diff --git a/Manito/Manito/Domain/Entity/RoomInfo.swift b/Manito/Manito/Domain/Entity/RoomInfo.swift index 5b15aaf1b..02b5adb40 100644 --- a/Manito/Manito/Domain/Entity/RoomInfo.swift +++ b/Manito/Manito/Domain/Entity/RoomInfo.swift @@ -36,7 +36,7 @@ extension RoomInfo { func toRoomListItem() -> RoomListItem { return RoomListItem(id: roomInformation.id, title: roomInformation.title, - state: roomInformation.state, + state: roomInformation.state.rawValue, participatingCount: participants.count, capacity: roomInformation.capacity, startDate: roomInformation.startDate, diff --git a/Manito/Manito/Domain/Entity/RoomListItem.swift b/Manito/Manito/Domain/Entity/RoomListItem.swift index 5084cc4a7..e16f824ec 100644 --- a/Manito/Manito/Domain/Entity/RoomListItem.swift +++ b/Manito/Manito/Domain/Entity/RoomListItem.swift @@ -10,11 +10,29 @@ import Foundation struct RoomListItem { let id: Int let title: String - let state: String + let state: RoomState let participatingCount: Int? let capacity: Int let startDate: String let endDate: String + + init( + id: Int, + title: String, + state: String, + participatingCount: Int? = nil, + capacity: Int, + startDate: String, + endDate: String + ) { + self.id = id + self.title = title + self.participatingCount = participatingCount + self.capacity = capacity + self.startDate = startDate + self.endDate = endDate + self.state = RoomState(rawValue: state) ?? .PRE + } } extension RoomListItem { diff --git a/Manito/Manito/Domain/Entity/RoomState.swift b/Manito/Manito/Domain/Entity/RoomState.swift new file mode 100644 index 000000000..335468e29 --- /dev/null +++ b/Manito/Manito/Domain/Entity/RoomState.swift @@ -0,0 +1,14 @@ +// +// RoomState.swift +// Manito +// +// Created by SHIN YOON AH on 2023/09/02. +// + +import Foundation + +enum RoomState: String { + case PRE + case PROCESSING + case POST +} From b85d7d300a1143127876bfe170d06a19919fd684 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Sat, 2 Sep 2023 20:28:43 +0900 Subject: [PATCH 421/468] =?UTF-8?q?[FEAT]=20DetailWaitTitleView=EC=97=90?= =?UTF-8?q?=20State=20=EC=84=A4=EC=A0=95(#509)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail-Wait/UIComponent/DetailWaitTitleView.swift | 10 ++++------ .../Screens/Detail-Wait/View/DetailWaitView.swift | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Wait/UIComponent/DetailWaitTitleView.swift b/Manito/Manito/Screens/Detail-Wait/UIComponent/DetailWaitTitleView.swift index e686a7df4..86a0cdd14 100644 --- a/Manito/Manito/Screens/Detail-Wait/UIComponent/DetailWaitTitleView.swift +++ b/Manito/Manito/Screens/Detail-Wait/UIComponent/DetailWaitTitleView.swift @@ -118,16 +118,14 @@ final class DetailWaitTitleView: UIView { } } - func setStartState(state: String) { + func setStartState(state: RoomState) { switch state { - case "PRE": + case .PRE: self.startStautsLabel.text = StartStatus.waiting.status - case "PROCESSING": + case .PROCESSING: self.startStautsLabel.text = StartStatus.starting.status - case "POST": + case .POST: self.startStautsLabel.text = StartStatus.complete.status - default: - self.startStautsLabel.text = StartStatus.waiting.status } } diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 53a1b2f41..2e1bda50c 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -154,7 +154,7 @@ final class DetailWaitView: UIView { } } - private func setupTitleViewData(title: String, state: String, dateRange: String) { + private func setupTitleViewData(title: String, state: RoomState, dateRange: String) { self.titleView.setStartState(state: state) self.titleView.setupLabelData(title: title, dateRange: dateRange) } From 3f4dede2edcbda81f090cf4ab18d5abff95d5cdb Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Sat, 2 Sep 2023 20:31:36 +0900 Subject: [PATCH 422/468] =?UTF-8?q?[CHORE]=20Status=EB=A1=9C=20=EC=98=81?= =?UTF-8?q?=EB=8B=A8=EC=96=B4=20=EC=88=98=EC=A0=95(#509)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 8 ++++---- Manito/Manito/Domain/Entity/RoomListItem.swift | 4 ++-- .../Domain/Entity/{RoomState.swift => RoomStatus.swift} | 4 ++-- .../Detail-Wait/UIComponent/DetailWaitTitleView.swift | 4 ++-- .../Manito/Screens/Detail-Wait/View/DetailWaitView.swift | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) rename Manito/Manito/Domain/Entity/{RoomState.swift => RoomStatus.swift} (73%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 89af594f8..da583b9e1 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -115,7 +115,7 @@ B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */; }; B5F31BB228BE1CD700F61D0F /* UserDefaultHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BB128BE1CD700F61D0F /* UserDefaultHandler.swift */; }; B5F31C5028BF922E00F61D0F /* LetterViewController+MailCompose.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31C4F28BF922E00F61D0F /* LetterViewController+MailCompose.swift */; }; - B5F3F1062AA3516200FA1A32 /* RoomState.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F3F1052AA3516200FA1A32 /* RoomState.swift */; }; + B5F3F1062AA3516200FA1A32 /* RoomStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F3F1052AA3516200FA1A32 /* RoomStatus.swift */; }; B5F524CF28519AA000614FF7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F524CE28519AA000614FF7 /* AppDelegate.swift */; }; B5F524D128519AA000614FF7 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F524D028519AA000614FF7 /* SceneDelegate.swift */; }; B5F524D628519AA000614FF7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B5F524D428519AA000614FF7 /* Main.storyboard */; }; @@ -315,7 +315,7 @@ B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultStorage.swift; sourceTree = ""; }; B5F31BB128BE1CD700F61D0F /* UserDefaultHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultHandler.swift; sourceTree = ""; }; B5F31C4F28BF922E00F61D0F /* LetterViewController+MailCompose.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LetterViewController+MailCompose.swift"; sourceTree = ""; }; - B5F3F1052AA3516200FA1A32 /* RoomState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomState.swift; sourceTree = ""; }; + B5F3F1052AA3516200FA1A32 /* RoomStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomStatus.swift; sourceTree = ""; }; B5F524CB28519AA000614FF7 /* Manito.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Manito.app; sourceTree = BUILT_PRODUCTS_DIR; }; B5F524CE28519AA000614FF7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; B5F524D028519AA000614FF7 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -734,7 +734,7 @@ B5A086012A974B8100C8A98D /* RoomListItem.swift */, B5A085FB2A97470400C8A98D /* RoomInfo.swift */, B5A086032A974D2000C8A98D /* ParticipantList.swift */, - B5F3F1052AA3516200FA1A32 /* RoomState.swift */, + B5F3F1052AA3516200FA1A32 /* RoomStatus.swift */, ); path = Entity; sourceTree = ""; @@ -1551,7 +1551,7 @@ B54741E029A3A4DB00B75BA3 /* LetterImageView.swift in Sources */, B5A085EC2A97314800C8A98D /* ParticipatedRoomInfoDTO.swift in Sources */, D724AF5D287088310003F280 /* SettingViewController.swift in Sources */, - B5F3F1062AA3516200FA1A32 /* RoomState.swift in Sources */, + B5F3F1062AA3516200FA1A32 /* RoomStatus.swift in Sources */, B5F5253D2854B8CB00614FF7 /* UIView+Extension.swift in Sources */, 39018F4228C4708A00C78DBA /* UIButton+Extension.swift in Sources */, CB5AE3E4285AAF7400382EA3 /* RoomInfoView.swift in Sources */, diff --git a/Manito/Manito/Domain/Entity/RoomListItem.swift b/Manito/Manito/Domain/Entity/RoomListItem.swift index e16f824ec..228f341f9 100644 --- a/Manito/Manito/Domain/Entity/RoomListItem.swift +++ b/Manito/Manito/Domain/Entity/RoomListItem.swift @@ -10,7 +10,7 @@ import Foundation struct RoomListItem { let id: Int let title: String - let state: RoomState + let state: RoomStatus let participatingCount: Int? let capacity: Int let startDate: String @@ -31,7 +31,7 @@ struct RoomListItem { self.capacity = capacity self.startDate = startDate self.endDate = endDate - self.state = RoomState(rawValue: state) ?? .PRE + self.state = RoomStatus(rawValue: state) ?? .PRE } } diff --git a/Manito/Manito/Domain/Entity/RoomState.swift b/Manito/Manito/Domain/Entity/RoomStatus.swift similarity index 73% rename from Manito/Manito/Domain/Entity/RoomState.swift rename to Manito/Manito/Domain/Entity/RoomStatus.swift index 335468e29..55065c696 100644 --- a/Manito/Manito/Domain/Entity/RoomState.swift +++ b/Manito/Manito/Domain/Entity/RoomStatus.swift @@ -1,5 +1,5 @@ // -// RoomState.swift +// RoomStatus.swift // Manito // // Created by SHIN YOON AH on 2023/09/02. @@ -7,7 +7,7 @@ import Foundation -enum RoomState: String { +enum RoomStatus: String { case PRE case PROCESSING case POST diff --git a/Manito/Manito/Screens/Detail-Wait/UIComponent/DetailWaitTitleView.swift b/Manito/Manito/Screens/Detail-Wait/UIComponent/DetailWaitTitleView.swift index 86a0cdd14..d5f3d4708 100644 --- a/Manito/Manito/Screens/Detail-Wait/UIComponent/DetailWaitTitleView.swift +++ b/Manito/Manito/Screens/Detail-Wait/UIComponent/DetailWaitTitleView.swift @@ -118,8 +118,8 @@ final class DetailWaitTitleView: UIView { } } - func setStartState(state: RoomState) { - switch state { + func setStartStatus(status: RoomStatus) { + switch status { case .PRE: self.startStautsLabel.text = StartStatus.waiting.status case .PROCESSING: diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 2e1bda50c..d81f7b1fa 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -154,8 +154,8 @@ final class DetailWaitView: UIView { } } - private func setupTitleViewData(title: String, state: RoomState, dateRange: String) { - self.titleView.setStartState(state: state) + private func setupTitleViewData(title: String, status: RoomStatus, dateRange: String) { + self.titleView.setStartStatus(status: status) self.titleView.setupLabelData(title: title, dateRange: dateRange) } @@ -228,7 +228,7 @@ final class DetailWaitView: UIView { self.userArray = room.participants.members self.setupTitleViewData(title: room.roomInformation.title, - state: room.roomInformation.state, + status: room.roomInformation.state, dateRange: room.roomInformation.dateRangeText) self.setupRelatedViews(of: room.admin, room.roomInformation.isStart) From 2bb4bd71ac7a22730727e66f462627195e4ca790 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Sat, 2 Sep 2023 20:33:47 +0900 Subject: [PATCH 423/468] =?UTF-8?q?[CHORE]=20DetailingView=EC=97=90?= =?UTF-8?q?=EC=84=9C=20RoomStatus=20=EC=88=98=EC=A0=95(#509)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Detail-Ing/View/DetailingView.swift | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift index 39866eae5..37ebebba4 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift @@ -24,18 +24,13 @@ protocol DetailingDelegate: AnyObject { final class DetailingView: UIView { - enum RoomType: String { - case PROCESSING - case POST - } - // MARK: - property private var isTappedManittee: Bool = false private var missionId: String = "" private var manittoNickname: String = "" - // FIXME: - roomType 상태를 View에서 가지고 있으면 안될 거 같습니다. 나중에 리팩토링하실 때 이 부분 신경써주세요! - var roomType: RoomType = .PROCESSING + // FIXME: - RoomStatus 상태를 View에서 가지고 있으면 안될 거 같습니다. 나중에 리팩토링하실 때 이 부분 신경써주세요! + var roomType: RoomStatus = .PROCESSING private weak var delegate: DetailingDelegate? // MARK: - component @@ -418,14 +413,14 @@ final class DetailingView: UIView { } func updateDetailingView(room: RoomInfo) { - self.roomType = RoomType.init(rawValue: room.roomInformation.state) ?? .PROCESSING + self.roomType = room.roomInformation.state self.missionId = room.mission?.id?.description ?? "" DispatchQueue.main.async { self.titleLabel.text = room.roomInformation.title self.periodLabel.text = "\(room.roomInformation.startDate.subStringToDate()) ~ \(room.roomInformation.endDate.subStringToDate())" self.manitteeAnimationLabel.text = room.manittee.nickname self.setupBadge(count: room.messages?.count ?? 0) - self.updateMissionEditButton(room.admin, type: self.roomType) + self.updateMissionEditButton(room.admin, status: self.roomType) if self.roomType == .PROCESSING { self.setupProcessingUI() guard let missionContent = room.mission?.content, @@ -505,8 +500,8 @@ final class DetailingView: UIView { self.manitteeAnimationLabel.alpha = value ? 1 : 0 } - private func updateMissionEditButton(_ isAdmin: Bool, type: RoomType) { - if type == .POST { + private func updateMissionEditButton(_ isAdmin: Bool, status: RoomStatus) { + if status == .POST { self.pencilButton.isHidden = true } if !isAdmin { From 16da3616a3df2f4147c08e523bda17ca3760d127 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Sat, 2 Sep 2023 20:36:06 +0900 Subject: [PATCH 424/468] =?UTF-8?q?[CHORE]=20Main=20=ED=99=94=EB=A9=B4?= =?UTF-8?q?=EC=97=90=20=EC=9E=88=EB=8A=94=20RoomStatus=20=EC=88=98?= =?UTF-8?q?=EC=A0=95(#509)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Domain/Entity/RoomStatus.swift | 13 +++++++++ .../Screens/Main/MainViewController.swift | 27 ++++--------------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/Manito/Manito/Domain/Entity/RoomStatus.swift b/Manito/Manito/Domain/Entity/RoomStatus.swift index 55065c696..63a9d2c41 100644 --- a/Manito/Manito/Domain/Entity/RoomStatus.swift +++ b/Manito/Manito/Domain/Entity/RoomStatus.swift @@ -12,3 +12,16 @@ enum RoomStatus: String { case PROCESSING case POST } + +extension RoomStatus { + var badgeTitle: String { + switch self { + case .PRE: + return TextLiteral.waiting + case .PROCESSING: + return TextLiteral.doing + case .POST: + return TextLiteral.done + } + } +} diff --git a/Manito/Manito/Screens/Main/MainViewController.swift b/Manito/Manito/Screens/Main/MainViewController.swift index 7fedd8439..d7662b53c 100644 --- a/Manito/Manito/Screens/Main/MainViewController.swift +++ b/Manito/Manito/Screens/Main/MainViewController.swift @@ -25,23 +25,6 @@ final class MainViewController: BaseViewController { static let commonMissionViewHeight: CGFloat = commonMissionViewWidth * 0.6 } - private enum RoomStatus: String { - case waiting = "PRE" - case starting = "PROCESSING" - case end = "POST" - - var roomStatus: String { - switch self { - case .waiting: - return TextLiteral.waiting - case .starting: - return TextLiteral.doing - case .end: - return TextLiteral.done - } - } - } - // MARK: - ui component private let backgroundImageView: UIImageView = { @@ -281,7 +264,7 @@ final class MainViewController: BaseViewController { // FIXME: - roomIndex가 현재 item으로 설정되어 있고, index가 roomIndex로 설정되어있음. KTBQ2B private func pushDetailView(status: RoomStatus, roomIndex: Int, index: Int? = nil) { switch status { - case .waiting: + case .PRE: guard let index = index else { return } let viewModel = DetailWaitViewModel(roomIndex: index, detailWaitService: DetailWaitService(repository: DetailRoomRepositoryImpl())) @@ -395,15 +378,15 @@ extension MainViewController: UICollectionViewDataSource { cell.dateLabel.text = "\(startDate) ~ \(endDate)" switch roomStatus { - case .waiting: + case .PRE: cell.roomStateView.stateLabel.text = "대기중" cell.roomStateView.stateLabel.textColor = .darkGrey001 cell.roomStateView.backgroundColor = .badgeBeige - case .starting: + case .PROCESSING: cell.roomStateView.stateLabel.text = "진행중" cell.roomStateView.stateLabel.textColor = .white cell.roomStateView.backgroundColor = .mainRed - case .end: + case .POST: cell.roomStateView.stateLabel.text = "완료" cell.roomStateView.stateLabel.textColor = .white cell.roomStateView.backgroundColor = .grey002 @@ -424,7 +407,7 @@ extension MainViewController: UICollectionViewDelegateFlowLayout { let roomStatus = RoomStatus.init(rawValue: state), let id = self.rooms?[indexPath.item - 1].id else { return } - if roomStatus == .waiting { + if roomStatus == .PRE { self.pushDetailView(status: roomStatus, roomIndex: indexPath.item - 1, index: id) } else { self.pushDetailView(status: roomStatus, roomIndex: indexPath.item - 1) From b0e21613f73a84facf78d9236b5d5df625ecd3f4 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 20:36:58 +0900 Subject: [PATCH 425/468] =?UTF-8?q?[CHORE]=20final=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=20=EB=B6=99=EC=9D=B4=EA=B8=B0,=20TopCharacterImageVie?= =?UTF-8?q?w=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#505)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 8 ++++---- .../{ImageRowView.swift => TopCharacterImageView.swift} | 2 +- Manito/Manito/Screens/Setting/View/SettingView.swift | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) rename Manito/Manito/Screens/Setting/UIComponent/{ImageRowView.swift => TopCharacterImageView.swift} (98%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index d9afd097a..9018a9474 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -169,7 +169,7 @@ D71939532AA1C84900A73D6C /* SettingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D71939522AA1C84900A73D6C /* SettingService.swift */; }; D71939552AA1C85300A73D6C /* SettingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D71939542AA1C85300A73D6C /* SettingViewModel.swift */; }; D724AF5D287088310003F280 /* SettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5C287088310003F280 /* SettingViewController.swift */; }; - D724AF5F28708D830003F280 /* ImageRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5E28708D830003F280 /* ImageRowView.swift */; }; + D724AF5F28708D830003F280 /* TopCharacterImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D724AF5E28708D830003F280 /* TopCharacterImageView.swift */; }; D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = D739C36628C7B82500161117 /* NicknameDTO.swift */; }; D75E8C7F28D76FFB004A6C41 /* LetterCountBadgeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D75E8C7E28D76FFB004A6C41 /* LetterCountBadgeView.swift */; }; D77224DF285DDAB7008B760B /* Notification+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D77224DE285DDAB7008B760B /* Notification+Extension.swift */; }; @@ -371,7 +371,7 @@ D71939522AA1C84900A73D6C /* SettingService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingService.swift; sourceTree = ""; }; D71939542AA1C85300A73D6C /* SettingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewModel.swift; sourceTree = ""; }; D724AF5C287088310003F280 /* SettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewController.swift; sourceTree = ""; }; - D724AF5E28708D830003F280 /* ImageRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageRowView.swift; sourceTree = ""; }; + D724AF5E28708D830003F280 /* TopCharacterImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopCharacterImageView.swift; sourceTree = ""; }; D739C36628C7B82500161117 /* NicknameDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameDTO.swift; sourceTree = ""; }; D75E8C7E28D76FFB004A6C41 /* LetterCountBadgeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterCountBadgeView.swift; sourceTree = ""; }; D77224DE285DDAB7008B760B /* Notification+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Notification+Extension.swift"; sourceTree = ""; }; @@ -1245,7 +1245,7 @@ D75ECB6E28A5EDC400A5B271 /* UIComponent */ = { isa = PBXGroup; children = ( - D724AF5E28708D830003F280 /* ImageRowView.swift */, + D724AF5E28708D830003F280 /* TopCharacterImageView.swift */, ); path = UIComponent; sourceTree = ""; @@ -1507,7 +1507,7 @@ B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */, D7C4A1A92A0B895300C3AE4C /* ChooseCharacterView.swift in Sources */, 7EA25C2728C4FEA800746AEA /* ChangeNickNameViewController.swift in Sources */, - D724AF5F28708D830003F280 /* ImageRowView.swift in Sources */, + D724AF5F28708D830003F280 /* TopCharacterImageView.swift in Sources */, 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */, B5F5251E2851A1C700614FF7 /* BaseTableViewCell.swift in Sources */, 39BDDCC42A52BB4A005E0A71 /* DetailWaitService.swift in Sources */, diff --git a/Manito/Manito/Screens/Setting/UIComponent/ImageRowView.swift b/Manito/Manito/Screens/Setting/UIComponent/TopCharacterImageView.swift similarity index 98% rename from Manito/Manito/Screens/Setting/UIComponent/ImageRowView.swift rename to Manito/Manito/Screens/Setting/UIComponent/TopCharacterImageView.swift index 7577c1e6a..95de43240 100644 --- a/Manito/Manito/Screens/Setting/UIComponent/ImageRowView.swift +++ b/Manito/Manito/Screens/Setting/UIComponent/TopCharacterImageView.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -class ImageRowView: UIView { +final class TopCharacterImageView: UIView { // MARK: - Property diff --git a/Manito/Manito/Screens/Setting/View/SettingView.swift b/Manito/Manito/Screens/Setting/View/SettingView.swift index 5d0b6a8a7..85d34ee86 100644 --- a/Manito/Manito/Screens/Setting/View/SettingView.swift +++ b/Manito/Manito/Screens/Setting/View/SettingView.swift @@ -47,7 +47,7 @@ final class SettingView: UIView { return button }() - private let imageRow: ImageRowView = ImageRowView() + private let imageRow: TopCharacterImageView = TopCharacterImageView() // MARK: - property From c5e21e6b501e80397df640d74e09abd6ccb7a7dd Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 20:54:12 +0900 Subject: [PATCH 426/468] =?UTF-8?q?[CHORE]=20logout=20=EB=98=90=ED=95=9C?= =?UTF-8?q?=20ViewModel=20=EA=B1=B0=EC=B9=98=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20(#505)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Setting/View/SettingView.swift | 1 + .../SettingViewController.swift | 24 +++++++++++++------ .../Setting/ViewModel/SettingViewModel.swift | 14 ++++++++++- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/Manito/Manito/Screens/Setting/View/SettingView.swift b/Manito/Manito/Screens/Setting/View/SettingView.swift index 85d34ee86..b94d105d2 100644 --- a/Manito/Manito/Screens/Setting/View/SettingView.swift +++ b/Manito/Manito/Screens/Setting/View/SettingView.swift @@ -55,6 +55,7 @@ final class SettingView: UIView { private weak var delegate: SettingViewDelegate? let withdrawalButtonPublisher = PassthroughSubject() + let logoutButtonPublisher = PassthroughSubject() // MARK: - init diff --git a/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift b/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift index 7d0a0920b..c8144bff3 100644 --- a/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift @@ -70,7 +70,8 @@ final class SettingViewController: BaseViewController { } private func transformedOutput() -> SettingViewModel.Output { - let input = SettingViewModel.Input(withdrawalButtonDidTap: self.settingView.withdrawalButtonPublisher.eraseToAnyPublisher()) + let input = SettingViewModel.Input(withdrawalButtonDidTap: self.settingView.withdrawalButtonPublisher.eraseToAnyPublisher(), + logoutButtonDidTap: self.settingView.logoutButtonPublisher.eraseToAnyPublisher()) return viewModel.transform(from: input) } @@ -87,14 +88,26 @@ final class SettingViewController: BaseViewController { self?.deleteUser() } .store(in: &self.cancellable) + + output.logout + .receive(on: DispatchQueue.main) + .sink { [weak self] _ in + self?.logout() + } + .store(in: &self.cancellable) } private func deleteUser() { - UserDefaultHandler.clearAllDataExcludingFcmToken() guard let sceneDelgate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate else { return } sceneDelgate.moveToLoginViewController() } + + private func logout() { + guard let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate + as? SceneDelegate else { return } + sceneDelegate.moveToLoginViewController() + } } // MARK: - Extensions @@ -125,11 +138,8 @@ extension SettingViewController: SettingViewDelegate { } func logoutButtonDidTap() { - self.makeRequestAlert(title: TextLiteral.settingViewControllerLogoutAlertTitle, message: "", okTitle: TextLiteral.confirm, cancelTitle: TextLiteral.cancel, okAction: { _ in - UserDefaultHandler.clearAllDataExcludingFcmToken() - guard let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate - as? SceneDelegate else { return } - sceneDelegate.moveToLoginViewController() + self.makeRequestAlert(title: TextLiteral.settingViewControllerLogoutAlertTitle, message: "", okTitle: TextLiteral.confirm, cancelTitle: TextLiteral.cancel, okAction: { [weak self] _ in + self?.settingView.logoutButtonPublisher.send() }) } diff --git a/Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift b/Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift index 2dfffc6b0..126e542cf 100644 --- a/Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift +++ b/Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift @@ -16,23 +16,35 @@ final class SettingViewModel { private var cancellable = Set() private let deleteUserSubject = PassthroughSubject() + private let logoutSubject = PassthroughSubject() struct Input { let withdrawalButtonDidTap: AnyPublisher + let logoutButtonDidTap: AnyPublisher } struct Output { let deleteUser: PassthroughSubject + let logout: PassthroughSubject } func transform(from input: Input) -> Output { input.withdrawalButtonDidTap .sink(receiveValue: { [weak self] _ in self?.requestDeleteUser() + UserDefaultHandler.clearAllDataExcludingFcmToken() }) .store(in: &self.cancellable) - return Output(deleteUser: self.deleteUserSubject) + input.logoutButtonDidTap + .sink { [weak self] _ in + UserDefaultHandler.clearAllDataExcludingFcmToken() + self?.logoutSubject.send() + } + .store(in: &self.cancellable) + + return Output(deleteUser: self.deleteUserSubject, + logout: self.logoutSubject) } // MARK: - init From e4a56b2179ba0fb5357c135e0a95b5a327ba9d42 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Sat, 2 Sep 2023 20:55:57 +0900 Subject: [PATCH 427/468] =?UTF-8?q?[CHORE]=20=EA=B3=B5=ED=86=B5=20UI=20?= =?UTF-8?q?=EB=B6=80=EB=B6=84=20=EC=88=98=EC=A0=95(#509)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Domain/Entity/RoomStatus.swift | 26 +++++++++++---- .../UIComponent/DetailWaitTitleView.swift | 32 +++---------------- .../Screens/Main/MainViewController.swift | 17 ++-------- 3 files changed, 26 insertions(+), 49 deletions(-) diff --git a/Manito/Manito/Domain/Entity/RoomStatus.swift b/Manito/Manito/Domain/Entity/RoomStatus.swift index 63a9d2c41..6a9cfe5e2 100644 --- a/Manito/Manito/Domain/Entity/RoomStatus.swift +++ b/Manito/Manito/Domain/Entity/RoomStatus.swift @@ -5,7 +5,7 @@ // Created by SHIN YOON AH on 2023/09/02. // -import Foundation +import UIKit enum RoomStatus: String { case PRE @@ -16,12 +16,24 @@ enum RoomStatus: String { extension RoomStatus { var badgeTitle: String { switch self { - case .PRE: - return TextLiteral.waiting - case .PROCESSING: - return TextLiteral.doing - case .POST: - return TextLiteral.done + case .PRE: return TextLiteral.waiting + case .PROCESSING: return TextLiteral.doing + case .POST: return TextLiteral.done + } + } + + var badgeColor: UIColor { + switch self { + case .PRE: return .badgeBeige + case .PROCESSING: return .mainRed + case .POST: return .grey002 + } + } + + var titleColor: UIColor { + switch self { + case .PRE: return .darkGrey001 + default: return .white } } } diff --git a/Manito/Manito/Screens/Detail-Wait/UIComponent/DetailWaitTitleView.swift b/Manito/Manito/Screens/Detail-Wait/UIComponent/DetailWaitTitleView.swift index d5f3d4708..8e774b79d 100644 --- a/Manito/Manito/Screens/Detail-Wait/UIComponent/DetailWaitTitleView.swift +++ b/Manito/Manito/Screens/Detail-Wait/UIComponent/DetailWaitTitleView.swift @@ -10,23 +10,6 @@ import UIKit import SnapKit final class DetailWaitTitleView: UIView { - - private enum StartStatus: String { - case waiting - case starting - case complete - - var status: String{ - switch self { - case .waiting: - return TextLiteral.waiting - case .starting: - return TextLiteral.doing - case .complete: - return TextLiteral.cancel - } - } - } // MARK: - ui component @@ -39,11 +22,11 @@ final class DetailWaitTitleView: UIView { private let startStautsLabel: UILabel = { let label = UILabel() - label.text = StartStatus.waiting.status - label.backgroundColor = .badgeBeige + label.text = RoomStatus.PRE.badgeTitle + label.backgroundColor = RoomStatus.PRE.badgeColor label.layer.masksToBounds = true label.layer.cornerRadius = 11 - label.textColor = .darkGrey001 + label.textColor = RoomStatus.PRE.titleColor label.font = .font(.regular, ofSize: 13) label.textAlignment = .center return label @@ -119,14 +102,7 @@ final class DetailWaitTitleView: UIView { } func setStartStatus(status: RoomStatus) { - switch status { - case .PRE: - self.startStautsLabel.text = StartStatus.waiting.status - case .PROCESSING: - self.startStautsLabel.text = StartStatus.starting.status - case .POST: - self.startStautsLabel.text = StartStatus.complete.status - } + self.startStautsLabel.text = status.badgeTitle } func setupLabelData(title: String, dateRange: String) { diff --git a/Manito/Manito/Screens/Main/MainViewController.swift b/Manito/Manito/Screens/Main/MainViewController.swift index d7662b53c..fa9a706d2 100644 --- a/Manito/Manito/Screens/Main/MainViewController.swift +++ b/Manito/Manito/Screens/Main/MainViewController.swift @@ -377,20 +377,9 @@ extension MainViewController: UICollectionViewDataSource { cell.roomLabel.text = "\(title)" cell.dateLabel.text = "\(startDate) ~ \(endDate)" - switch roomStatus { - case .PRE: - cell.roomStateView.stateLabel.text = "대기중" - cell.roomStateView.stateLabel.textColor = .darkGrey001 - cell.roomStateView.backgroundColor = .badgeBeige - case .PROCESSING: - cell.roomStateView.stateLabel.text = "진행중" - cell.roomStateView.stateLabel.textColor = .white - cell.roomStateView.backgroundColor = .mainRed - case .POST: - cell.roomStateView.stateLabel.text = "완료" - cell.roomStateView.stateLabel.textColor = .white - cell.roomStateView.backgroundColor = .grey002 - } + cell.roomStateView.stateLabel.text = roomStatus.badgeTitle + cell.roomStateView.stateLabel.textColor = roomStatus.titleColor + cell.roomStateView.backgroundColor = roomStatus.badgeColor return cell } From 9a8222e83487045d9a38a404e4fb423939033008 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Sat, 2 Sep 2023 21:02:18 +0900 Subject: [PATCH 428/468] =?UTF-8?q?[FEAT]=20=EC=A3=BC=EC=84=9D=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80(#509)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Domain/Entity/RoomStatus.swift | 12 ++++++++++-- .../Screens/Detail-Ing/View/DetailingView.swift | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Domain/Entity/RoomStatus.swift b/Manito/Manito/Domain/Entity/RoomStatus.swift index 6a9cfe5e2..c6be909fd 100644 --- a/Manito/Manito/Domain/Entity/RoomStatus.swift +++ b/Manito/Manito/Domain/Entity/RoomStatus.swift @@ -7,13 +7,21 @@ import UIKit +/// +/// 방 상태에 대한 정보들을 반환하는 Enum 데이터 입니다. +/// + enum RoomStatus: String { + /// 대기 중 case PRE + /// 진행 중 case PROCESSING + /// 진행 완료 case POST } extension RoomStatus { + /// 방 상태 뱃지에 들어가는 텍스트 var badgeTitle: String { switch self { case .PRE: return TextLiteral.waiting @@ -21,7 +29,7 @@ extension RoomStatus { case .POST: return TextLiteral.done } } - + /// 방 상태 뱃지에 들어가는 배경 색상 var badgeColor: UIColor { switch self { case .PRE: return .badgeBeige @@ -29,7 +37,7 @@ extension RoomStatus { case .POST: return .grey002 } } - + /// 방 상태 뱃지에 들어가는 텍스트 색상 var titleColor: UIColor { switch self { case .PRE: return .darkGrey001 diff --git a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift index 37ebebba4..47b113817 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift @@ -421,6 +421,7 @@ final class DetailingView: UIView { self.manitteeAnimationLabel.text = room.manittee.nickname self.setupBadge(count: room.messages?.count ?? 0) self.updateMissionEditButton(room.admin, status: self.roomType) + // FIXME: - RoomStatus 내부에 Badge 설정하는 코드가 추가되어 있습니다. 해당 코드를 사용해서 뱃지 UI를 수정해주세요. if self.roomType == .PROCESSING { self.setupProcessingUI() guard let missionContent = room.mission?.content, From 83cef30c6fa98d45fb61b3c377fffbd019635d55 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 21:04:36 +0900 Subject: [PATCH 429/468] =?UTF-8?q?[CHORE]=20final=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=20=EB=B6=99=EC=9D=B4=EA=B8=B0=20(#507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NickName/ViewControllers/ChangeNicknameViewController.swift | 2 +- .../NickName/ViewControllers/CreateNicknameViewController.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift b/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift index d8b9ae35f..71c1654fd 100644 --- a/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift +++ b/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift @@ -10,7 +10,7 @@ import UIKit import SnapKit -class ChangeNicknameViewController: BaseViewController { +final class ChangeNicknameViewController: BaseViewController { // MARK: - property diff --git a/Manito/Manito/Screens/NickName/ViewControllers/CreateNicknameViewController.swift b/Manito/Manito/Screens/NickName/ViewControllers/CreateNicknameViewController.swift index e74f790e8..e7cf54e6b 100644 --- a/Manito/Manito/Screens/NickName/ViewControllers/CreateNicknameViewController.swift +++ b/Manito/Manito/Screens/NickName/ViewControllers/CreateNicknameViewController.swift @@ -10,7 +10,7 @@ import UIKit import SnapKit -class CreateNicknameViewController: BaseViewController { +final class CreateNicknameViewController: BaseViewController { // MARK: - property From 0f70e630b997d1fb48bd8cff0045292ea362c805 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 21:12:29 +0900 Subject: [PATCH 430/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20-=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=EB=AC=B8=20=EC=97=86=EC=95=A0=EA=B8=B0=20(#507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/CreateRoom/UIComponent/InputTitleView.swift | 7 +------ Manito/Manito/Screens/NickName/View/NicknameView.swift | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift index 56dd562c9..11c8fd461 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/InputTitleView.swift @@ -80,12 +80,7 @@ final class InputTitleView: UIView { } func updateTitleCount(count: Int, maxLength: Int) { - if count > maxLength { - self.roomsTextLimitLabel.text = "\(maxLength)/\(maxLength)" - } - else { - self.roomsTextLimitLabel.text = "\(count)/\(maxLength)" - } + self.roomsTextLimitLabel.text = "\(count)/\(maxLength)" } } diff --git a/Manito/Manito/Screens/NickName/View/NicknameView.swift b/Manito/Manito/Screens/NickName/View/NicknameView.swift index ff054d3b4..bac716e29 100644 --- a/Manito/Manito/Screens/NickName/View/NicknameView.swift +++ b/Manito/Manito/Screens/NickName/View/NicknameView.swift @@ -125,12 +125,7 @@ final class NicknameView: UIView { } func updateTextCount(count: Int, maxLength: Int) { - if count > maxLength { - self.textLimitLabel.text = "\(maxLength)/\(maxLength)" - } - else { - self.textLimitLabel.text = "\(count)/\(maxLength)" - } + self.textLimitLabel.text = "\(count)/\(maxLength)" } func toggleDoneButton(isEnabled: Bool) { From e6774d1f480f8f972f2cd8fb6486b15d96ffc7cd Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Sat, 2 Sep 2023 21:30:33 +0900 Subject: [PATCH 431/468] =?UTF-8?q?[MOVE]=20App=20=ED=8F=B4=EB=8D=94?= =?UTF-8?q?=EB=A1=9C=20Supports=20=ED=8C=8C=EC=9D=BC=20=EC=98=AE=EA=B9=80(?= =?UTF-8?q?#511)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 32 +++++++++---------- .../Supports => App}/AppDelegate.swift | 0 .../{Global/Supports => App}/Info.plist | 0 .../Supports => App}/Manito.entitlements | 0 .../Supports => App}/SceneDelegate.swift | 0 5 files changed, 16 insertions(+), 16 deletions(-) rename Manito/Manito/{Global/Supports => App}/AppDelegate.swift (100%) rename Manito/Manito/{Global/Supports => App}/Info.plist (100%) rename Manito/Manito/{Global/Supports => App}/Manito.entitlements (100%) rename Manito/Manito/{Global/Supports => App}/SceneDelegate.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 049926950..f78864fa7 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -692,6 +692,17 @@ path = Letter; sourceTree = ""; }; + B54B72A12AA3616600D60E4B /* App */ = { + isa = PBXGroup; + children = ( + 39E6321328BDE59C00CFC6C4 /* Manito.entitlements */, + B5F524DC28519AA100614FF7 /* Info.plist */, + B5F524CE28519AA000614FF7 /* AppDelegate.swift */, + B5F524D028519AA000614FF7 /* SceneDelegate.swift */, + ); + path = App; + sourceTree = ""; + }; B57CB3022A763BB200474042 /* Packages */ = { isa = PBXGroup; children = ( @@ -808,6 +819,7 @@ B5F524CD28519AA000614FF7 /* Manito */ = { isa = PBXGroup; children = ( + B54B72A12AA3616600D60E4B /* App */, B5A085E72A97302900C8A98D /* Domain */, B53A35B82A9640EB00B720BC /* Data */, B5F524E328519AC300614FF7 /* Screens */, @@ -847,7 +859,6 @@ B5F524F828519BC700614FF7 /* Literal */, B5F524F728519BC400614FF7 /* Base */, B5F524F628519BC000614FF7 /* Protocol */, - B5F524F528519BB700614FF7 /* Supports */, B5F524F428519BB500614FF7 /* Extension */, B5F524F328519BB100614FF7 /* UIComponent */, B5F524F228519BA700614FF7 /* Resource */, @@ -971,17 +982,6 @@ path = Extension; sourceTree = ""; }; - B5F524F528519BB700614FF7 /* Supports */ = { - isa = PBXGroup; - children = ( - 39E6321328BDE59C00CFC6C4 /* Manito.entitlements */, - B5F524DC28519AA100614FF7 /* Info.plist */, - B5F524CE28519AA000614FF7 /* AppDelegate.swift */, - B5F524D028519AA000614FF7 /* SceneDelegate.swift */, - ); - path = Supports; - sourceTree = ""; - }; B5F524F628519BC000614FF7 /* Protocol */ = { isa = PBXGroup; children = ( @@ -1763,13 +1763,13 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; - CODE_SIGN_ENTITLEMENTS = Manito/Global/Supports/Manito.entitlements; + CODE_SIGN_ENTITLEMENTS = Manito/App/Manito.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = HF8GHZB58X; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = Manito/Global/Supports/Info.plist; + INFOPLIST_FILE = Manito/App/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "$(BUNDLE_DISPLAY_NAME)"; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.lifestyle"; INFOPLIST_KEY_NSCameraUsageDescription = "'마니또'가 마니띠에게 전송할 사진을 위해 사용자의 카메라에 접근하려고 합니다."; @@ -1803,13 +1803,13 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; - CODE_SIGN_ENTITLEMENTS = Manito/Global/Supports/Manito.entitlements; + CODE_SIGN_ENTITLEMENTS = Manito/App/Manito.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = HF8GHZB58X; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = Manito/Global/Supports/Info.plist; + INFOPLIST_FILE = Manito/App/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = "$(BUNDLE_DISPLAY_NAME)"; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.lifestyle"; INFOPLIST_KEY_NSCameraUsageDescription = "'마니또'가 마니띠에게 전송할 사진을 위해 사용자의 카메라에 접근하려고 합니다."; diff --git a/Manito/Manito/Global/Supports/AppDelegate.swift b/Manito/Manito/App/AppDelegate.swift similarity index 100% rename from Manito/Manito/Global/Supports/AppDelegate.swift rename to Manito/Manito/App/AppDelegate.swift diff --git a/Manito/Manito/Global/Supports/Info.plist b/Manito/Manito/App/Info.plist similarity index 100% rename from Manito/Manito/Global/Supports/Info.plist rename to Manito/Manito/App/Info.plist diff --git a/Manito/Manito/Global/Supports/Manito.entitlements b/Manito/Manito/App/Manito.entitlements similarity index 100% rename from Manito/Manito/Global/Supports/Manito.entitlements rename to Manito/Manito/App/Manito.entitlements diff --git a/Manito/Manito/Global/Supports/SceneDelegate.swift b/Manito/Manito/App/SceneDelegate.swift similarity index 100% rename from Manito/Manito/Global/Supports/SceneDelegate.swift rename to Manito/Manito/App/SceneDelegate.swift From 028d6a045a06799b228f4ad7b1cc3177f11bdc5c Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Sat, 2 Sep 2023 21:56:28 +0900 Subject: [PATCH 432/468] =?UTF-8?q?[CHORE]=20maxCount=20=EB=A5=BC=20?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=EB=A6=BC=EC=9C=BC=EB=A1=9C=20=EC=A0=9C?= =?UTF-8?q?=EA=B3=B5=20(#507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChangeNicknameViewController.swift | 14 +++++------ .../CreateNicknameViewController.swift | 12 +++++----- .../ViewModel/NicknameViewModel.swift | 24 +++++++++++-------- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift b/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift index 71c1654fd..fc9dd41e6 100644 --- a/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift +++ b/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift @@ -67,16 +67,16 @@ final class ChangeNicknameViewController: BaseViewController { } private func bindOutputToViewModel(_ output: NicknameViewModel.Output) { - output.isSetNickname - .sink { [weak self] isSetNickname in - self?.nicknameView.updateTextCount(count: isSetNickname.count, maxLength: self?.viewModel.maxCount ?? 0) - self?.nicknameView.setupNickname(nickname: isSetNickname) + output.nicknameMaxCount + .sink { [weak self] nicknameMaxCount in + self?.nicknameView.updateTextCount(count: nicknameMaxCount.nickname.count, maxLength: nicknameMaxCount.maxCount) + self?.nicknameView.setupNickname(nickname: nicknameMaxCount.nickname) } .store(in: &self.cancellable) - output.isNewNickname - .sink { [weak self] text in - self?.nicknameView.updateTextCount(count: text.count, maxLength: self?.viewModel.maxCount ?? 0) + output.counts + .sink { [weak self] counts in + self?.nicknameView.updateTextCount(count: counts.textCount, maxLength: counts.maxCount) } .store(in: &self.cancellable) diff --git a/Manito/Manito/Screens/NickName/ViewControllers/CreateNicknameViewController.swift b/Manito/Manito/Screens/NickName/ViewControllers/CreateNicknameViewController.swift index e7cf54e6b..62f018d99 100644 --- a/Manito/Manito/Screens/NickName/ViewControllers/CreateNicknameViewController.swift +++ b/Manito/Manito/Screens/NickName/ViewControllers/CreateNicknameViewController.swift @@ -94,15 +94,15 @@ final class CreateNicknameViewController: BaseViewController { } private func bindOutputToViewModel(_ output: NicknameViewModel.Output) { - output.isSetNickname - .sink { [weak self] _ in - self?.nicknameView.updateTextCount(count: 0, maxLength: self?.viewModel.maxCount ?? 0) + output.nicknameMaxCount + .sink { [weak self] nicknameMaxCount in + self?.nicknameView.updateTextCount(count: 0, maxLength: nicknameMaxCount.maxCount) } .store(in: &self.cancellable) - output.isNewNickname - .sink { [weak self] newNickname in - self?.nicknameView.updateTextCount(count: newNickname.count, maxLength: self?.viewModel.maxCount ?? 0) + output.counts + .sink { [weak self] counts in + self?.nicknameView.updateTextCount(count: counts.textCount, maxLength: counts.maxCount) } .store(in: &self.cancellable) diff --git a/Manito/Manito/Screens/NickName/ViewModel/NicknameViewModel.swift b/Manito/Manito/Screens/NickName/ViewModel/NicknameViewModel.swift index dd8e71256..fd4e81e8b 100644 --- a/Manito/Manito/Screens/NickName/ViewModel/NicknameViewModel.swift +++ b/Manito/Manito/Screens/NickName/ViewModel/NicknameViewModel.swift @@ -10,6 +10,9 @@ import Foundation final class NicknameViewModel { + typealias Counts = (textCount: Int, maxCount: Int) + typealias NicknameMaxCount = (nickname: String, maxCount: Int) + // MARK: - property let maxCount: Int = 5 @@ -27,25 +30,26 @@ final class NicknameViewModel { } struct Output { - let isSetNickname: AnyPublisher - let isNewNickname: AnyPublisher + let nicknameMaxCount: AnyPublisher + let counts: AnyPublisher let fixedTitleByMaxCount: AnyPublisher let isEnabled: AnyPublisher let doneButton: PassthroughSubject } func transform(from input: Input) -> Output { - let isSetNickname = input.viewDidLoad - .map { _ -> String in + let nicknameMaxCount = input.viewDidLoad + .map { [weak self] _ -> NicknameMaxCount in let nickname = UserDefaultStorage.nickname - return nickname + return NicknameMaxCount(nickname, self!.maxCount) } .eraseToAnyPublisher() - let isNewNickname = input.textFieldDidChanged - .map { [weak self] text -> String in + let counts = input.textFieldDidChanged + .map { [weak self] text -> Counts in self?.nicknameSubject.send(text) - return text + + return Counts(text.count, self!.maxCount) } .eraseToAnyPublisher() @@ -75,8 +79,8 @@ final class NicknameViewModel { }) .store(in: &self.cancellable) - return Output(isSetNickname: isSetNickname, - isNewNickname: isNewNickname, + return Output(nicknameMaxCount: nicknameMaxCount, + counts: counts, fixedTitleByMaxCount: fixedTitle, isEnabled: isEnabled, doneButton: self.doneButtonSubject) From 6991c1f74a5abdcb5e7e96b1827e3519f51eb814 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 2 Sep 2023 22:24:54 +0900 Subject: [PATCH 433/468] =?UTF-8?q?[CHORE]=20MessageInfo=20=EB=84=A4?= =?UTF-8?q?=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD=20(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift | 8 ++++---- Manito/Manito/Domain/Entity/RoomInfo.swift | 4 ++-- Manito/ManitoTests/DetailWaitViewModelTest.swift | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift index 3caee5d32..52a4bc4a5 100644 --- a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift +++ b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift @@ -16,7 +16,7 @@ struct RoomInfoDTO: Decodable { let didViewRoulette: Bool? let mission: IndividualMissionDTO? let admin: Bool? - let messages: MessageInfo? + let messages: MessageCountInfoDTO? enum CodingKeys: String, CodingKey { case roomInformation = "room" @@ -76,10 +76,10 @@ extension IndividualMissionDTO: Equatable { static let testIndividualMissionDTO = IndividualMissionDTO(id: 1, content: "테스트미션") } -struct MessageInfo: Decodable { +struct MessageCountInfoDTO: Decodable { let count: Int? } -extension MessageInfo: Equatable { - static let testMessageInfo = MessageInfo(count: 3) +extension MessageCountInfoDTO: Equatable { + static let testMessageInfo = MessageCountInfoDTO(count: 3) } diff --git a/Manito/Manito/Domain/Entity/RoomInfo.swift b/Manito/Manito/Domain/Entity/RoomInfo.swift index 3f08f10fc..21ed51d4c 100644 --- a/Manito/Manito/Domain/Entity/RoomInfo.swift +++ b/Manito/Manito/Domain/Entity/RoomInfo.swift @@ -16,7 +16,7 @@ struct RoomInfo { let didViewRoulette: Bool? let mission: IndividualMissionDTO? let admin: Bool - let messages: MessageInfo? + let messages: MessageCountInfoDTO? } extension RoomInfo { @@ -73,6 +73,6 @@ extension RoomInfo: Equatable { didViewRoulette: false, mission: IndividualMissionDTO.testIndividualMissionDTO, admin: false, - messages: MessageInfo.testMessageInfo + messages: MessageCountInfoDTO.testMessageInfo ) } diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index fbbfff92e..4963058da 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -305,7 +305,7 @@ extension DetailWaitViewModelTest { didViewRoulette: false, mission: IndividualMissionDTO.testIndividualMissionDTO, admin: false, - messages: MessageInfo.testMessageInfo) + messages: MessageCountInfoDTO.testMessageInfo) } } @@ -321,7 +321,7 @@ final class MockDetailWaitService: DetailWaitServicable { didViewRoulette: false, mission: IndividualMissionDTO.testIndividualMissionDTO, admin: false, - messages: MessageInfo.testMessageInfo) + messages: MessageCountInfoDTO.testMessageInfo) return room } From 4aa51bc9f2224c1eb11a629c1ad141cbb491178d Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 2 Sep 2023 22:38:20 +0900 Subject: [PATCH 434/468] =?UTF-8?q?[ADD]=20UserInfo=20Entity=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 +++ .../Data/DTO/Response/RoomInfoDTO.swift | 6 ++--- .../Data/DTO/Response/UserInfoDTO.swift | 15 +++-------- .../Domain/Entity/ParticipantList.swift | 4 +-- Manito/Manito/Domain/Entity/RoomInfo.swift | 12 ++++----- Manito/Manito/Domain/Entity/UserInfo.swift | 26 +++++++++++++++++++ .../Detail-Wait/View/DetailWaitView.swift | 2 +- 7 files changed, 46 insertions(+), 23 deletions(-) create mode 100644 Manito/Manito/Domain/Entity/UserInfo.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 1539ff2f7..bfb310666 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 333BF669285864CE0039F77F /* MemoryViewController.swift */; }; 33BDF5622856E03800564211 /* FriendListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33BDF5612856E03800564211 /* FriendListViewController.swift */; }; 39018F4228C4708A00C78DBA /* UIButton+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */; }; + 3904F4FA2AA36F4F00B6264F /* UserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3904F4F92AA36F4F00B6264F /* UserInfo.swift */; }; 3915D54B2A7516A2002D6C25 /* Key.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3915D54A2A7516A2002D6C25 /* Key.plist */; }; 3915D54D2A7516E9002D6C25 /* Key+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */; }; 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391612D729E9231B004AE982 /* DetailWaitView.swift */; }; @@ -208,6 +209,7 @@ 333BF669285864CE0039F77F /* MemoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoryViewController.swift; sourceTree = ""; }; 33BDF5612856E03800564211 /* FriendListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendListViewController.swift; sourceTree = ""; }; 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+Extension.swift"; sourceTree = ""; }; + 3904F4F92AA36F4F00B6264F /* UserInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInfo.swift; sourceTree = ""; }; 3915D54A2A7516A2002D6C25 /* Key.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Key.plist; sourceTree = ""; }; 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Key+Extension.swift"; sourceTree = ""; }; 391612D729E9231B004AE982 /* DetailWaitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitView.swift; sourceTree = ""; }; @@ -728,6 +730,7 @@ B5A086012A974B8100C8A98D /* RoomListItem.swift */, B5A085FB2A97470400C8A98D /* RoomInfo.swift */, B5A086032A974D2000C8A98D /* ParticipantList.swift */, + 3904F4F92AA36F4F00B6264F /* UserInfo.swift */, ); path = Entity; sourceTree = ""; @@ -1470,6 +1473,7 @@ 391B3003286198C200421F1D /* Size.swift in Sources */, B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */, B5F525262851A26D00614FF7 /* NSObject+Extension.swift in Sources */, + 3904F4FA2AA36F4F00B6264F /* UserInfo.swift in Sources */, 39FFE32828EEFFFE008442EE /* MoreButton.swift in Sources */, B5706BE129ADC20A0093D198 /* CreateLetterView.swift in Sources */, 7E0C5C362855B22700F698D1 /* CreateNickNameViewController.swift in Sources */, diff --git a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift index 52a4bc4a5..2d2f80220 100644 --- a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift +++ b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift @@ -37,8 +37,8 @@ extension RoomInfoDTO { let participants = self.participants?.toParticipantList() return RoomInfo(roomInformation: roomInformation!, participants: participants ?? ParticipantList(count: 0, members: []), - manittee: self.manittee ?? UserInfoDTO(id: "", nickname: ""), - manitto: self.manitto, + manittee: self.manittee?.toUserInfo() ?? UserInfo(id: "", nickname: ""), + manitto: self.manitto?.toUserInfo(), invitation: self.invitation ?? InvitationCodeDTO(code: ""), didViewRoulette: self.didViewRoulette, mission: self.mission, @@ -55,7 +55,7 @@ struct ParticipantListDTO: Decodable { extension ParticipantListDTO { func toParticipantList() -> ParticipantList { return ParticipantList(count: self.count ?? 0, - members: self.members ?? []) + members: self.members?.compactMap { $0.toUserInfo() } ?? []) } } diff --git a/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift b/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift index e8f2aefd2..148bf264e 100644 --- a/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift +++ b/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift @@ -12,15 +12,8 @@ struct UserInfoDTO: Decodable { let nickname: String? } -extension UserInfoDTO: Equatable { - static let testUserManittee = UserInfoDTO(id: "1", nickname: "테스트마니띠") - static let testUserManitto = UserInfoDTO(id: "2", nickname: "테스트마니또") - - static let testUserList = [ - UserInfoDTO(id: "100", nickname: "유저1"), - UserInfoDTO(id: "200", nickname: "유저2"), - UserInfoDTO(id: "300", nickname: "유저3"), - UserInfoDTO(id: "400", nickname: "유저4"), - UserInfoDTO(id: "500", nickname: "유저5") - ] +extension UserInfoDTO { + func toUserInfo() -> UserInfo { + return UserInfo(id: self.id, nickname: self.nickname) + } } diff --git a/Manito/Manito/Domain/Entity/ParticipantList.swift b/Manito/Manito/Domain/Entity/ParticipantList.swift index 9c08f6e33..87446c134 100644 --- a/Manito/Manito/Domain/Entity/ParticipantList.swift +++ b/Manito/Manito/Domain/Entity/ParticipantList.swift @@ -9,7 +9,7 @@ import Foundation struct ParticipantList: Decodable { let count: Int - let members: [UserInfoDTO] + let members: [UserInfo] } extension ParticipantList { @@ -21,6 +21,6 @@ extension ParticipantList { extension ParticipantList: Equatable { static let testParticipantList = ParticipantList( count: 5, - members: UserInfoDTO.testUserList + members: UserInfo.testUserList ) } diff --git a/Manito/Manito/Domain/Entity/RoomInfo.swift b/Manito/Manito/Domain/Entity/RoomInfo.swift index 21ed51d4c..2b289cae7 100644 --- a/Manito/Manito/Domain/Entity/RoomInfo.swift +++ b/Manito/Manito/Domain/Entity/RoomInfo.swift @@ -10,8 +10,8 @@ import Foundation struct RoomInfo { let roomInformation: RoomListItem let participants: ParticipantList - let manittee: UserInfoDTO - let manitto: UserInfoDTO? + let manittee: UserInfo + let manitto: UserInfo? let invitation: InvitationCodeDTO let didViewRoulette: Bool? let mission: IndividualMissionDTO? @@ -53,8 +53,8 @@ extension RoomInfo { endDate: "") return RoomInfo(roomInformation: roomList, participants: ParticipantList(count: 0, members: []), - manittee: UserInfoDTO(id: "", nickname: ""), - manitto: UserInfoDTO(id: "", nickname: ""), + manittee: UserInfo(id: "", nickname: ""), + manitto: UserInfo(id: "", nickname: ""), invitation: InvitationCodeDTO(code: ""), didViewRoulette: false, mission: nil, @@ -67,8 +67,8 @@ extension RoomInfo: Equatable { static let testRoom = RoomInfo( roomInformation: RoomListItem.testRoomListItem, participants: ParticipantList.testParticipantList, - manittee: UserInfoDTO.testUserManitto, - manitto: UserInfoDTO.testUserManitto, + manittee: UserInfo.testUserManitto, + manitto: UserInfo.testUserManitto, invitation: InvitationCodeDTO.testInvitationCodeDTO, didViewRoulette: false, mission: IndividualMissionDTO.testIndividualMissionDTO, diff --git a/Manito/Manito/Domain/Entity/UserInfo.swift b/Manito/Manito/Domain/Entity/UserInfo.swift new file mode 100644 index 000000000..f39538885 --- /dev/null +++ b/Manito/Manito/Domain/Entity/UserInfo.swift @@ -0,0 +1,26 @@ +// +// UserInfo.swift +// Manito +// +// Created by Mingwan Choi on 2023/09/02. +// + +import Foundation + +struct UserInfo: Decodable { + let id: String? + let nickname: String? +} + +extension UserInfo: Equatable { + static let testUserManittee = UserInfo(id: "1", nickname: "테스트마니띠") + static let testUserManitto = UserInfo(id: "2", nickname: "테스트마니또") + + static let testUserList = [ + UserInfo(id: "100", nickname: "유저1"), + UserInfo(id: "200", nickname: "유저2"), + UserInfo(id: "300", nickname: "유저3"), + UserInfo(id: "400", nickname: "유저4"), + UserInfo(id: "500", nickname: "유저5") + ] +} diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 53a1b2f41..29755b35d 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -82,7 +82,7 @@ final class DetailWaitView: UIView { // MARK: - property - private var userArray: [UserInfoDTO] = [] { + private var userArray: [UserInfo] = [] { didSet { DispatchQueue.main.async { self.listTableView.reloadData() From ebfa4e073e5d65d98f94fe3cd8800163da600888 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 2 Sep 2023 22:45:45 +0900 Subject: [PATCH 435/468] =?UTF-8?q?[ADD]=20Invitation=20Entity=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++++ .../Manito/Data/DTO/Response/RoomInfoDTO.swift | 15 ++++++++++----- .../Manito/Data/DTO/Response/UserInfoDTO.swift | 2 +- Manito/Manito/Domain/Entity/InvitationCode.swift | 16 ++++++++++++++++ Manito/Manito/Domain/Entity/RoomInfo.swift | 6 +++--- Manito/Manito/Domain/Entity/UserInfo.swift | 4 ++-- .../Detail-Wait/DetailWaitViewController.swift | 2 +- .../ViewModel/DetailWaitViewModel.swift | 3 +-- 8 files changed, 38 insertions(+), 14 deletions(-) create mode 100644 Manito/Manito/Domain/Entity/InvitationCode.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index bfb310666..996793c66 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -12,6 +12,7 @@ 33BDF5622856E03800564211 /* FriendListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33BDF5612856E03800564211 /* FriendListViewController.swift */; }; 39018F4228C4708A00C78DBA /* UIButton+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */; }; 3904F4FA2AA36F4F00B6264F /* UserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3904F4F92AA36F4F00B6264F /* UserInfo.swift */; }; + 3904F4FC2AA3729300B6264F /* InvitationCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3904F4FB2AA3729300B6264F /* InvitationCode.swift */; }; 3915D54B2A7516A2002D6C25 /* Key.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3915D54A2A7516A2002D6C25 /* Key.plist */; }; 3915D54D2A7516E9002D6C25 /* Key+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */; }; 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391612D729E9231B004AE982 /* DetailWaitView.swift */; }; @@ -210,6 +211,7 @@ 33BDF5612856E03800564211 /* FriendListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendListViewController.swift; sourceTree = ""; }; 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+Extension.swift"; sourceTree = ""; }; 3904F4F92AA36F4F00B6264F /* UserInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInfo.swift; sourceTree = ""; }; + 3904F4FB2AA3729300B6264F /* InvitationCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InvitationCode.swift; sourceTree = ""; }; 3915D54A2A7516A2002D6C25 /* Key.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Key.plist; sourceTree = ""; }; 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Key+Extension.swift"; sourceTree = ""; }; 391612D729E9231B004AE982 /* DetailWaitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitView.swift; sourceTree = ""; }; @@ -731,6 +733,7 @@ B5A085FB2A97470400C8A98D /* RoomInfo.swift */, B5A086032A974D2000C8A98D /* ParticipantList.swift */, 3904F4F92AA36F4F00B6264F /* UserInfo.swift */, + 3904F4FB2AA3729300B6264F /* InvitationCode.swift */, ); path = Entity; sourceTree = ""; @@ -1517,6 +1520,7 @@ B5A085F82A9744CC00C8A98D /* RoomListDTO.swift in Sources */, B5A085F62A9733F900C8A98D /* TokenDTO.swift in Sources */, B5F5253B2854ABF200614FF7 /* MainButton.swift in Sources */, + 3904F4FC2AA3729300B6264F /* InvitationCode.swift in Sources */, B50B1B2A285AB7650080992C /* SplashViewController.swift in Sources */, B5FEE9DB28C8498A00DEA07E /* ImageCacheManager.swift in Sources */, B5F5253528547F1900614FF7 /* LetterHeaderView.swift in Sources */, diff --git a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift index 2d2f80220..342bad8d8 100644 --- a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift +++ b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift @@ -35,11 +35,14 @@ extension RoomInfoDTO { func toRoomInfo() -> RoomInfo { let roomInformation = self.roomInformation?.toRoomListItem() let participants = self.participants?.toParticipantList() + let manitteeUserInfo = self.manittee?.toUserInfo() + let manittoUserInfo = self.manitto?.toUserInfo() + let invitation = self.invitation?.toInvitationCode() return RoomInfo(roomInformation: roomInformation!, participants: participants ?? ParticipantList(count: 0, members: []), - manittee: self.manittee?.toUserInfo() ?? UserInfo(id: "", nickname: ""), - manitto: self.manitto?.toUserInfo(), - invitation: self.invitation ?? InvitationCodeDTO(code: ""), + manittee: manitteeUserInfo ?? UserInfo(id: "", nickname: ""), + manitto: manittoUserInfo, + invitation: invitation ?? InvitationCode(code: ""), didViewRoulette: self.didViewRoulette, mission: self.mission, admin: self.admin ?? false, @@ -63,8 +66,10 @@ struct InvitationCodeDTO: Decodable { let code: String? } -extension InvitationCodeDTO: Equatable { - static let testInvitationCodeDTO = InvitationCodeDTO(code: "ABCDEF") +extension InvitationCodeDTO { + func toInvitationCode() -> InvitationCode { + return InvitationCode(code: self.code ?? "") + } } struct IndividualMissionDTO: Decodable, Hashable { diff --git a/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift b/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift index 148bf264e..6c04e92a3 100644 --- a/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift +++ b/Manito/Manito/Data/DTO/Response/UserInfoDTO.swift @@ -14,6 +14,6 @@ struct UserInfoDTO: Decodable { extension UserInfoDTO { func toUserInfo() -> UserInfo { - return UserInfo(id: self.id, nickname: self.nickname) + return UserInfo(id: self.id ?? "" , nickname: self.nickname ?? "") } } diff --git a/Manito/Manito/Domain/Entity/InvitationCode.swift b/Manito/Manito/Domain/Entity/InvitationCode.swift new file mode 100644 index 000000000..80ca7218e --- /dev/null +++ b/Manito/Manito/Domain/Entity/InvitationCode.swift @@ -0,0 +1,16 @@ +// +// InvitationCode.swift +// Manito +// +// Created by Mingwan Choi on 2023/09/02. +// + +import Foundation + +struct InvitationCode: Decodable { + let code: String +} + +extension InvitationCode: Equatable { + static let testInvitationCode = InvitationCode(code: "ABCDEF") +} diff --git a/Manito/Manito/Domain/Entity/RoomInfo.swift b/Manito/Manito/Domain/Entity/RoomInfo.swift index 2b289cae7..57a8e9cc8 100644 --- a/Manito/Manito/Domain/Entity/RoomInfo.swift +++ b/Manito/Manito/Domain/Entity/RoomInfo.swift @@ -12,7 +12,7 @@ struct RoomInfo { let participants: ParticipantList let manittee: UserInfo let manitto: UserInfo? - let invitation: InvitationCodeDTO + let invitation: InvitationCode let didViewRoulette: Bool? let mission: IndividualMissionDTO? let admin: Bool @@ -55,7 +55,7 @@ extension RoomInfo { participants: ParticipantList(count: 0, members: []), manittee: UserInfo(id: "", nickname: ""), manitto: UserInfo(id: "", nickname: ""), - invitation: InvitationCodeDTO(code: ""), + invitation: InvitationCode(code: ""), didViewRoulette: false, mission: nil, admin: false, @@ -69,7 +69,7 @@ extension RoomInfo: Equatable { participants: ParticipantList.testParticipantList, manittee: UserInfo.testUserManitto, manitto: UserInfo.testUserManitto, - invitation: InvitationCodeDTO.testInvitationCodeDTO, + invitation: InvitationCode.testInvitationCode, didViewRoulette: false, mission: IndividualMissionDTO.testIndividualMissionDTO, admin: false, diff --git a/Manito/Manito/Domain/Entity/UserInfo.swift b/Manito/Manito/Domain/Entity/UserInfo.swift index f39538885..20c9ebfa1 100644 --- a/Manito/Manito/Domain/Entity/UserInfo.swift +++ b/Manito/Manito/Domain/Entity/UserInfo.swift @@ -8,8 +8,8 @@ import Foundation struct UserInfo: Decodable { - let id: String? - let nickname: String? + let id: String + let nickname: String } extension UserInfo: Equatable { diff --git a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift index 588a1c4ba..bfcda3317 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailWaitViewController.swift @@ -241,7 +241,7 @@ final class DetailWaitViewController: BaseViewController { let capacity = roomInfo.roomInformation.capacity let startDate = roomInfo.roomInformation.startDate let endDate = roomInfo.roomInformation.endDate - guard let invitationCode = roomInfo.invitation.code else { return } + let invitationCode = roomInfo.invitation.code let roomDTO = RoomListItemDTO(id: nil, title: title, state: nil, diff --git a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift index f44978029..5b1ffcb97 100644 --- a/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift +++ b/Manito/Manito/Screens/Detail-Wait/ViewModel/DetailWaitViewModel.swift @@ -144,8 +144,7 @@ final class DetailWaitViewModel { } func makeCode(roomInformation: RoomInfo) -> String { - guard let code = roomInformation.invitation.code else { return "" } - return code + return roomInformation.invitation.code } func makeEditRoomInformation(roomInformation: RoomInfo) -> EditRoomInformation { From b5d175d136f1e6c87b1db937b8778c601d52ea7e Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 2 Sep 2023 22:50:36 +0900 Subject: [PATCH 436/468] =?UTF-8?q?[CHORE]=20IndivisualMission=20Entity=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++++ .../Manito/Data/DTO/Response/RoomInfoDTO.swift | 9 ++++++--- .../Domain/Entity/IndividualMission.swift | 17 +++++++++++++++++ Manito/Manito/Domain/Entity/RoomInfo.swift | 4 ++-- .../Screens/Detail-Ing/View/DetailingView.swift | 2 +- 5 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 Manito/Manito/Domain/Entity/IndividualMission.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 996793c66..b21b3f05c 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 39018F4228C4708A00C78DBA /* UIButton+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */; }; 3904F4FA2AA36F4F00B6264F /* UserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3904F4F92AA36F4F00B6264F /* UserInfo.swift */; }; 3904F4FC2AA3729300B6264F /* InvitationCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3904F4FB2AA3729300B6264F /* InvitationCode.swift */; }; + 3904F4FE2AA3743C00B6264F /* IndividualMission.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3904F4FD2AA3743C00B6264F /* IndividualMission.swift */; }; 3915D54B2A7516A2002D6C25 /* Key.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3915D54A2A7516A2002D6C25 /* Key.plist */; }; 3915D54D2A7516E9002D6C25 /* Key+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */; }; 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391612D729E9231B004AE982 /* DetailWaitView.swift */; }; @@ -212,6 +213,7 @@ 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+Extension.swift"; sourceTree = ""; }; 3904F4F92AA36F4F00B6264F /* UserInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInfo.swift; sourceTree = ""; }; 3904F4FB2AA3729300B6264F /* InvitationCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InvitationCode.swift; sourceTree = ""; }; + 3904F4FD2AA3743C00B6264F /* IndividualMission.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IndividualMission.swift; sourceTree = ""; }; 3915D54A2A7516A2002D6C25 /* Key.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Key.plist; sourceTree = ""; }; 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Key+Extension.swift"; sourceTree = ""; }; 391612D729E9231B004AE982 /* DetailWaitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitView.swift; sourceTree = ""; }; @@ -734,6 +736,7 @@ B5A086032A974D2000C8A98D /* ParticipantList.swift */, 3904F4F92AA36F4F00B6264F /* UserInfo.swift */, 3904F4FB2AA3729300B6264F /* InvitationCode.swift */, + 3904F4FD2AA3743C00B6264F /* IndividualMission.swift */, ); path = Entity; sourceTree = ""; @@ -1429,6 +1432,7 @@ B5A086002A97496900C8A98D /* MessageListItemDTO.swift in Sources */, 7E15F67E28B35B3D00441305 /* TextLiteral.swift in Sources */, B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */, + 3904F4FE2AA3743C00B6264F /* IndividualMission.swift in Sources */, B54741EA29A494E200B75BA3 /* LetterImageError.swift in Sources */, B5F525422855C97900614FF7 /* UILabel+Extension.swift in Sources */, B53A35CE2A96FA7A00B720BC /* LoginRepository.swift in Sources */, diff --git a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift index 342bad8d8..1bcf9d66f 100644 --- a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift +++ b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift @@ -38,13 +38,14 @@ extension RoomInfoDTO { let manitteeUserInfo = self.manittee?.toUserInfo() let manittoUserInfo = self.manitto?.toUserInfo() let invitation = self.invitation?.toInvitationCode() + let mission = self.mission?.toIndividualMission() return RoomInfo(roomInformation: roomInformation!, participants: participants ?? ParticipantList(count: 0, members: []), manittee: manitteeUserInfo ?? UserInfo(id: "", nickname: ""), manitto: manittoUserInfo, invitation: invitation ?? InvitationCode(code: ""), didViewRoulette: self.didViewRoulette, - mission: self.mission, + mission: mission ?? IndividualMission(id: 0, content: ""), admin: self.admin ?? false, messages: self.messages) } @@ -77,8 +78,10 @@ struct IndividualMissionDTO: Decodable, Hashable { let content: String? } -extension IndividualMissionDTO: Equatable { - static let testIndividualMissionDTO = IndividualMissionDTO(id: 1, content: "테스트미션") +extension IndividualMissionDTO { + func toIndividualMission() -> IndividualMission { + return IndividualMission(id: self.id ?? 0, content: self.content ?? "") + } } struct MessageCountInfoDTO: Decodable { diff --git a/Manito/Manito/Domain/Entity/IndividualMission.swift b/Manito/Manito/Domain/Entity/IndividualMission.swift new file mode 100644 index 000000000..2c2666088 --- /dev/null +++ b/Manito/Manito/Domain/Entity/IndividualMission.swift @@ -0,0 +1,17 @@ +// +// IndividualMission.swift +// Manito +// +// Created by Mingwan Choi on 2023/09/02. +// + +import Foundation + +struct IndividualMission: Decodable, Hashable { + let id: Int + let content: String +} + +extension IndividualMission: Equatable { + static let testIndividualMission = IndividualMission(id: 1, content: "테스트미션") +} diff --git a/Manito/Manito/Domain/Entity/RoomInfo.swift b/Manito/Manito/Domain/Entity/RoomInfo.swift index 57a8e9cc8..a0e85d72f 100644 --- a/Manito/Manito/Domain/Entity/RoomInfo.swift +++ b/Manito/Manito/Domain/Entity/RoomInfo.swift @@ -14,7 +14,7 @@ struct RoomInfo { let manitto: UserInfo? let invitation: InvitationCode let didViewRoulette: Bool? - let mission: IndividualMissionDTO? + let mission: IndividualMission? let admin: Bool let messages: MessageCountInfoDTO? } @@ -71,7 +71,7 @@ extension RoomInfo: Equatable { manitto: UserInfo.testUserManitto, invitation: InvitationCode.testInvitationCode, didViewRoulette: false, - mission: IndividualMissionDTO.testIndividualMissionDTO, + mission: IndividualMission.testIndividualMission, admin: false, messages: MessageCountInfoDTO.testMessageInfo ) diff --git a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift index 39866eae5..e4cb129cf 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift @@ -419,7 +419,7 @@ final class DetailingView: UIView { func updateDetailingView(room: RoomInfo) { self.roomType = RoomType.init(rawValue: room.roomInformation.state) ?? .PROCESSING - self.missionId = room.mission?.id?.description ?? "" + self.missionId = room.mission?.id.description ?? "" DispatchQueue.main.async { self.titleLabel.text = room.roomInformation.title self.periodLabel.text = "\(room.roomInformation.startDate.subStringToDate()) ~ \(room.roomInformation.endDate.subStringToDate())" From e2705903d7d068d863368894f2edf298cd0f9682 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 2 Sep 2023 22:54:52 +0900 Subject: [PATCH 437/468] =?UTF-8?q?[CHORE]=20MessageInfo=20Entity=20?= =?UTF-8?q?=EC=B6=94=20(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++++ .../Manito/Data/DTO/Response/RoomInfoDTO.swift | 7 +++++-- Manito/Manito/Domain/Entity/InvitationCode.swift | 2 +- .../Manito/Domain/Entity/MessageCountInfo.swift | 16 ++++++++++++++++ .../Manito/Domain/Entity/ParticipantList.swift | 4 ++-- Manito/Manito/Domain/Entity/RoomInfo.swift | 4 ++-- Manito/Manito/Domain/Entity/UserInfo.swift | 2 +- 7 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 Manito/Manito/Domain/Entity/MessageCountInfo.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index b21b3f05c..5d9432933 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ 3904F4FA2AA36F4F00B6264F /* UserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3904F4F92AA36F4F00B6264F /* UserInfo.swift */; }; 3904F4FC2AA3729300B6264F /* InvitationCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3904F4FB2AA3729300B6264F /* InvitationCode.swift */; }; 3904F4FE2AA3743C00B6264F /* IndividualMission.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3904F4FD2AA3743C00B6264F /* IndividualMission.swift */; }; + 3904F5002AA3754400B6264F /* MessageCountInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3904F4FF2AA3754400B6264F /* MessageCountInfo.swift */; }; 3915D54B2A7516A2002D6C25 /* Key.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3915D54A2A7516A2002D6C25 /* Key.plist */; }; 3915D54D2A7516E9002D6C25 /* Key+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */; }; 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391612D729E9231B004AE982 /* DetailWaitView.swift */; }; @@ -214,6 +215,7 @@ 3904F4F92AA36F4F00B6264F /* UserInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInfo.swift; sourceTree = ""; }; 3904F4FB2AA3729300B6264F /* InvitationCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InvitationCode.swift; sourceTree = ""; }; 3904F4FD2AA3743C00B6264F /* IndividualMission.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IndividualMission.swift; sourceTree = ""; }; + 3904F4FF2AA3754400B6264F /* MessageCountInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageCountInfo.swift; sourceTree = ""; }; 3915D54A2A7516A2002D6C25 /* Key.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Key.plist; sourceTree = ""; }; 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Key+Extension.swift"; sourceTree = ""; }; 391612D729E9231B004AE982 /* DetailWaitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitView.swift; sourceTree = ""; }; @@ -737,6 +739,7 @@ 3904F4F92AA36F4F00B6264F /* UserInfo.swift */, 3904F4FB2AA3729300B6264F /* InvitationCode.swift */, 3904F4FD2AA3743C00B6264F /* IndividualMission.swift */, + 3904F4FF2AA3754400B6264F /* MessageCountInfo.swift */, ); path = Entity; sourceTree = ""; @@ -1413,6 +1416,7 @@ 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */, CB674C2128596A310063A6B7 /* CheckRoomViewController.swift in Sources */, B5A085DF2A972D2A00C8A98D /* LetterRequestDTO.swift in Sources */, + 3904F5002AA3754400B6264F /* MessageCountInfo.swift in Sources */, 39C9580A287DC03500A04A2B /* Encodable+Extension.swift in Sources */, B50B1AFB2856B5180080992C /* IndividualMissionView.swift in Sources */, B5F524FB28519C2A00614FF7 /* MainViewController.swift in Sources */, diff --git a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift index 1bcf9d66f..82e718eba 100644 --- a/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift +++ b/Manito/Manito/Data/DTO/Response/RoomInfoDTO.swift @@ -39,6 +39,7 @@ extension RoomInfoDTO { let manittoUserInfo = self.manitto?.toUserInfo() let invitation = self.invitation?.toInvitationCode() let mission = self.mission?.toIndividualMission() + let messages = self.messages?.toMessageCountInfo() return RoomInfo(roomInformation: roomInformation!, participants: participants ?? ParticipantList(count: 0, members: []), manittee: manitteeUserInfo ?? UserInfo(id: "", nickname: ""), @@ -47,7 +48,7 @@ extension RoomInfoDTO { didViewRoulette: self.didViewRoulette, mission: mission ?? IndividualMission(id: 0, content: ""), admin: self.admin ?? false, - messages: self.messages) + messages: messages ?? MessageCountInfo(count: 0)) } } @@ -89,5 +90,7 @@ struct MessageCountInfoDTO: Decodable { } extension MessageCountInfoDTO: Equatable { - static let testMessageInfo = MessageCountInfoDTO(count: 3) + func toMessageCountInfo() -> MessageCountInfo { + return MessageCountInfo(count: self.count ?? 0) + } } diff --git a/Manito/Manito/Domain/Entity/InvitationCode.swift b/Manito/Manito/Domain/Entity/InvitationCode.swift index 80ca7218e..dae45b194 100644 --- a/Manito/Manito/Domain/Entity/InvitationCode.swift +++ b/Manito/Manito/Domain/Entity/InvitationCode.swift @@ -7,7 +7,7 @@ import Foundation -struct InvitationCode: Decodable { +struct InvitationCode { let code: String } diff --git a/Manito/Manito/Domain/Entity/MessageCountInfo.swift b/Manito/Manito/Domain/Entity/MessageCountInfo.swift new file mode 100644 index 000000000..c28d55b58 --- /dev/null +++ b/Manito/Manito/Domain/Entity/MessageCountInfo.swift @@ -0,0 +1,16 @@ +// +// MessageCountInfo.swift +// Manito +// +// Created by Mingwan Choi on 2023/09/02. +// + +import Foundation + +struct MessageCountInfo { + let count: Int? +} + +extension MessageCountInfo: Equatable { + static let testMessageInfo = MessageCountInfo(count: 3) +} diff --git a/Manito/Manito/Domain/Entity/ParticipantList.swift b/Manito/Manito/Domain/Entity/ParticipantList.swift index 87446c134..ec0cbea70 100644 --- a/Manito/Manito/Domain/Entity/ParticipantList.swift +++ b/Manito/Manito/Domain/Entity/ParticipantList.swift @@ -7,14 +7,14 @@ import Foundation -struct ParticipantList: Decodable { +struct ParticipantList { let count: Int let members: [UserInfo] } extension ParticipantList { var membersNickname: [String] { - return members.map { $0.nickname ?? "" } + return members.map { $0.nickname } } } diff --git a/Manito/Manito/Domain/Entity/RoomInfo.swift b/Manito/Manito/Domain/Entity/RoomInfo.swift index a0e85d72f..9ed5f6f0f 100644 --- a/Manito/Manito/Domain/Entity/RoomInfo.swift +++ b/Manito/Manito/Domain/Entity/RoomInfo.swift @@ -16,7 +16,7 @@ struct RoomInfo { let didViewRoulette: Bool? let mission: IndividualMission? let admin: Bool - let messages: MessageCountInfoDTO? + let messages: MessageCountInfo? } extension RoomInfo { @@ -73,6 +73,6 @@ extension RoomInfo: Equatable { didViewRoulette: false, mission: IndividualMission.testIndividualMission, admin: false, - messages: MessageCountInfoDTO.testMessageInfo + messages: MessageCountInfo.testMessageInfo ) } diff --git a/Manito/Manito/Domain/Entity/UserInfo.swift b/Manito/Manito/Domain/Entity/UserInfo.swift index 20c9ebfa1..7ce7f3e4f 100644 --- a/Manito/Manito/Domain/Entity/UserInfo.swift +++ b/Manito/Manito/Domain/Entity/UserInfo.swift @@ -7,7 +7,7 @@ import Foundation -struct UserInfo: Decodable { +struct UserInfo { let id: String let nickname: String } From dd042e404c7ad0f2531470910331036100e83705 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 2 Sep 2023 22:57:43 +0900 Subject: [PATCH 438/468] =?UTF-8?q?[CHORE]=20Equatable=20=EC=B1=84?= =?UTF-8?q?=ED=83=9D=20=EA=B5=AC=EC=A1=B0=EC=B2=B4=20Hashable=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Domain/Entity/ParticipantList.swift | 2 +- Manito/Manito/Domain/Entity/UserInfo.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Domain/Entity/ParticipantList.swift b/Manito/Manito/Domain/Entity/ParticipantList.swift index ec0cbea70..6b29b4ea4 100644 --- a/Manito/Manito/Domain/Entity/ParticipantList.swift +++ b/Manito/Manito/Domain/Entity/ParticipantList.swift @@ -18,7 +18,7 @@ extension ParticipantList { } } -extension ParticipantList: Equatable { +extension ParticipantList: Hashable { static let testParticipantList = ParticipantList( count: 5, members: UserInfo.testUserList diff --git a/Manito/Manito/Domain/Entity/UserInfo.swift b/Manito/Manito/Domain/Entity/UserInfo.swift index 7ce7f3e4f..a6eeb9fb3 100644 --- a/Manito/Manito/Domain/Entity/UserInfo.swift +++ b/Manito/Manito/Domain/Entity/UserInfo.swift @@ -12,7 +12,7 @@ struct UserInfo { let nickname: String } -extension UserInfo: Equatable { +extension UserInfo: Hashable { static let testUserManittee = UserInfo(id: "1", nickname: "테스트마니띠") static let testUserManitto = UserInfo(id: "2", nickname: "테스트마니또") From 59472f37a7f387c1f869ac6c0b46e0fe16657739 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 2 Sep 2023 23:05:15 +0900 Subject: [PATCH 439/468] =?UTF-8?q?[CHORE]=20DTO=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EA=B5=AC=EC=A1=B0=EC=B2=B4=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManitoTests/DetailWaitViewModelTest.swift | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index 4963058da..5055167fd 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -299,13 +299,13 @@ extension DetailWaitViewModelTest { return RoomInfo( roomInformation: RoomListItem(id: 10, title: "목타이틀", state: "", participatingCount: 10, capacity: 10, startDate: "", endDate: ""), participants: ParticipantList.testParticipantList, - manittee: UserInfoDTO.testUserManitto, - manitto: UserInfoDTO.testUserManitto, - invitation: InvitationCodeDTO.testInvitationCodeDTO, + manittee: UserInfo.testUserManittee, + manitto: UserInfo.testUserManitto, + invitation: InvitationCode.testInvitationCode, didViewRoulette: false, - mission: IndividualMissionDTO.testIndividualMissionDTO, + mission: IndividualMission.testIndividualMission, admin: false, - messages: MessageCountInfoDTO.testMessageInfo) + messages: MessageCountInfo.testMessageInfo) } } @@ -314,19 +314,25 @@ final class MockDetailWaitService: DetailWaitServicable { func fetchWaitingRoomInfo(roomId: String) async throws -> Manito.RoomInfoDTO { let room = RoomInfoDTO( roomInformation: RoomListItemDTO(id: 10, title: "목타이틀", state: "", participatingCount: 10, capacity: 10, startDate: "", endDate: ""), - participants: ParticipantListDTO(count: 5, members: UserInfoDTO.testUserList), - manittee: UserInfoDTO.testUserManitto, - manitto: UserInfoDTO.testUserManitto, - invitation: InvitationCodeDTO.testInvitationCodeDTO, + participants: ParticipantListDTO(count: 5, members: [ + UserInfoDTO(id: "100", nickname: "유저1"), + UserInfoDTO(id: "200", nickname: "유저2"), + UserInfoDTO(id: "300", nickname: "유저3"), + UserInfoDTO(id: "400", nickname: "유저4"), + UserInfoDTO(id: "500", nickname: "유저5") + ]), + manittee: UserInfoDTO(id: "1", nickname: "테스트마니띠"), + manitto: UserInfoDTO(id: "2", nickname: "테스트마니또"), + invitation: InvitationCodeDTO(code: "ABCDEF"), didViewRoulette: false, - mission: IndividualMissionDTO.testIndividualMissionDTO, + mission: IndividualMissionDTO(id: 1, content: "테스트미션"), admin: false, - messages: MessageCountInfoDTO.testMessageInfo) + messages: MessageCountInfoDTO(count: 3)) return room } func patchStartManitto(roomId: String) async throws -> Manito.UserInfoDTO { - return UserInfoDTO.testUserManittee + return UserInfoDTO(id: "1", nickname: "테스트마니띠") } func deleteRoom(roomId: String) async throws -> Int { From 82403199305eb2afbe4b0f2fad77754c4dba77bf Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 2 Sep 2023 23:09:54 +0900 Subject: [PATCH 440/468] =?UTF-8?q?[CHORE]=20mock=20RoomInfo=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=20(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Domain/Entity/RoomInfo.swift | 2 +- .../ManitoTests/DetailWaitViewModelTest.swift | 23 ++++--------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/Manito/Manito/Domain/Entity/RoomInfo.swift b/Manito/Manito/Domain/Entity/RoomInfo.swift index 9ed5f6f0f..a9ba750c3 100644 --- a/Manito/Manito/Domain/Entity/RoomInfo.swift +++ b/Manito/Manito/Domain/Entity/RoomInfo.swift @@ -67,7 +67,7 @@ extension RoomInfo: Equatable { static let testRoom = RoomInfo( roomInformation: RoomListItem.testRoomListItem, participants: ParticipantList.testParticipantList, - manittee: UserInfo.testUserManitto, + manittee: UserInfo.testUserManittee, manitto: UserInfo.testUserManitto, invitation: InvitationCode.testInvitationCode, didViewRoulette: false, diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/DetailWaitViewModelTest.swift index 5055167fd..98af32272 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/DetailWaitViewModelTest.swift @@ -101,7 +101,7 @@ final class DetailWaitViewModelTest: XCTestCase { func testTransferRoomInformation() { // given - let checkRoom = mockRoom + let checkRoom = RoomInfo.testRoom let expectation = XCTestExpectation(description: "roomInformation test") var testRoom = RoomInfo.emptyRoom let testViewDidLoadSubject = PassthroughSubject() @@ -253,7 +253,7 @@ final class DetailWaitViewModelTest: XCTestCase { func testTransferChnageButtonDidTap() { // given - let checkRoom = mockRoom + let checkRoom = RoomInfo.testRoom let expectation = XCTestExpectation(description: "changeButton test") var testRoom = RoomInfo.emptyRoom let testChangeButtonDidTapSubject = PassthroughSubject() @@ -274,7 +274,7 @@ final class DetailWaitViewModelTest: XCTestCase { func testTransferViewDidLoad() { // given - let checkRoom = mockRoom + let checkRoom = RoomInfo.testRoom let expectation = XCTestExpectation(description: "viewDidLoad test") var testRoom = RoomInfo.emptyRoom let testViewDidLoadSubject = PassthroughSubject() @@ -294,26 +294,11 @@ final class DetailWaitViewModelTest: XCTestCase { } } -extension DetailWaitViewModelTest { - var mockRoom: RoomInfo { - return RoomInfo( - roomInformation: RoomListItem(id: 10, title: "목타이틀", state: "", participatingCount: 10, capacity: 10, startDate: "", endDate: ""), - participants: ParticipantList.testParticipantList, - manittee: UserInfo.testUserManittee, - manitto: UserInfo.testUserManitto, - invitation: InvitationCode.testInvitationCode, - didViewRoulette: false, - mission: IndividualMission.testIndividualMission, - admin: false, - messages: MessageCountInfo.testMessageInfo) - } -} - final class MockDetailWaitService: DetailWaitServicable { // FIXME: - network mocking 만들어야함. func fetchWaitingRoomInfo(roomId: String) async throws -> Manito.RoomInfoDTO { let room = RoomInfoDTO( - roomInformation: RoomListItemDTO(id: 10, title: "목타이틀", state: "", participatingCount: 10, capacity: 10, startDate: "", endDate: ""), + roomInformation: RoomListItemDTO(id: 1, title: "테스트타이틀", state: "PRE", participatingCount: 5, capacity: 5, startDate: "2023.01.01", endDate: "2023.01.05"), participants: ParticipantListDTO(count: 5, members: [ UserInfoDTO(id: "100", nickname: "유저1"), UserInfoDTO(id: "200", nickname: "유저2"), From b813020a6598d46ced643bd61b57e5ff9d68985e Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 2 Sep 2023 23:14:08 +0900 Subject: [PATCH 441/468] =?UTF-8?q?[CHORE]=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=20=EC=BD=94=EB=93=9C=20=ED=8F=B4=EB=8D=94=20=EA=B5=AC=EC=A1=B0?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20(#500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 38 +++++++++++++++- .../Service/MockDetailWaitService.swift | 44 +++++++++++++++++++ .../ViewModel}/DetailWaitViewModelTest.swift | 35 --------------- 3 files changed, 81 insertions(+), 36 deletions(-) create mode 100644 Manito/ManitoTests/Presentation/DetailWait/Service/MockDetailWaitService.swift rename Manito/ManitoTests/{ => Presentation/DetailWait/ViewModel}/DetailWaitViewModelTest.swift (86%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 5d9432933..9c1e3f2a5 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 3904F4FC2AA3729300B6264F /* InvitationCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3904F4FB2AA3729300B6264F /* InvitationCode.swift */; }; 3904F4FE2AA3743C00B6264F /* IndividualMission.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3904F4FD2AA3743C00B6264F /* IndividualMission.swift */; }; 3904F5002AA3754400B6264F /* MessageCountInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3904F4FF2AA3754400B6264F /* MessageCountInfo.swift */; }; + 3904F5062AA37A3C00B6264F /* MockDetailWaitService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3904F5052AA37A3C00B6264F /* MockDetailWaitService.swift */; }; 3915D54B2A7516A2002D6C25 /* Key.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3915D54A2A7516A2002D6C25 /* Key.plist */; }; 3915D54D2A7516E9002D6C25 /* Key+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */; }; 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391612D729E9231B004AE982 /* DetailWaitView.swift */; }; @@ -216,6 +217,7 @@ 3904F4FB2AA3729300B6264F /* InvitationCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InvitationCode.swift; sourceTree = ""; }; 3904F4FD2AA3743C00B6264F /* IndividualMission.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IndividualMission.swift; sourceTree = ""; }; 3904F4FF2AA3754400B6264F /* MessageCountInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageCountInfo.swift; sourceTree = ""; }; + 3904F5052AA37A3C00B6264F /* MockDetailWaitService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockDetailWaitService.swift; sourceTree = ""; }; 3915D54A2A7516A2002D6C25 /* Key.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Key.plist; sourceTree = ""; }; 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Key+Extension.swift"; sourceTree = ""; }; 391612D729E9231B004AE982 /* DetailWaitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitView.swift; sourceTree = ""; }; @@ -421,6 +423,39 @@ path = Cell; sourceTree = ""; }; + 3904F5012AA379CA00B6264F /* Presentation */ = { + isa = PBXGroup; + children = ( + 3904F5022AA379F100B6264F /* DetailWait */, + ); + path = Presentation; + sourceTree = ""; + }; + 3904F5022AA379F100B6264F /* DetailWait */ = { + isa = PBXGroup; + children = ( + 3904F5042AA37A2C00B6264F /* Service */, + 3904F5032AA37A2000B6264F /* ViewModel */, + ); + path = DetailWait; + sourceTree = ""; + }; + 3904F5032AA37A2000B6264F /* ViewModel */ = { + isa = PBXGroup; + children = ( + 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */, + ); + path = ViewModel; + sourceTree = ""; + }; + 3904F5042AA37A2C00B6264F /* Service */ = { + isa = PBXGroup; + children = ( + 3904F5052AA37A3C00B6264F /* MockDetailWaitService.swift */, + ); + path = Service; + sourceTree = ""; + }; 391612D629E92308004AE982 /* View */ = { isa = PBXGroup; children = ( @@ -450,7 +485,7 @@ 398B1CBA2A12415C00DEFCEC /* ManitoTests */ = { isa = PBXGroup; children = ( - 395B5BCB2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift */, + 3904F5012AA379CA00B6264F /* Presentation */, ); path = ManitoTests; sourceTree = ""; @@ -1390,6 +1425,7 @@ buildActionMask = 2147483647; files = ( 395B5BCC2A2F6A9700CE1420 /* DetailWaitViewModelTest.swift in Sources */, + 3904F5062AA37A3C00B6264F /* MockDetailWaitService.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Manito/ManitoTests/Presentation/DetailWait/Service/MockDetailWaitService.swift b/Manito/ManitoTests/Presentation/DetailWait/Service/MockDetailWaitService.swift new file mode 100644 index 000000000..a7a80c61d --- /dev/null +++ b/Manito/ManitoTests/Presentation/DetailWait/Service/MockDetailWaitService.swift @@ -0,0 +1,44 @@ +// +// MockDetailWaitService.swift +// ManitoTests +// +// Created by Mingwan Choi on 2023/09/02. +// + +import Foundation +@testable import Manito + +final class MockDetailWaitService: DetailWaitServicable { + // FIXME: - network mocking 만들어야함. + func fetchWaitingRoomInfo(roomId: String) async throws -> Manito.RoomInfoDTO { + let room = RoomInfoDTO( + roomInformation: RoomListItemDTO(id: 1, title: "테스트타이틀", state: "PRE", participatingCount: 5, capacity: 5, startDate: "2023.01.01", endDate: "2023.01.05"), + participants: ParticipantListDTO(count: 5, members: [ + UserInfoDTO(id: "100", nickname: "유저1"), + UserInfoDTO(id: "200", nickname: "유저2"), + UserInfoDTO(id: "300", nickname: "유저3"), + UserInfoDTO(id: "400", nickname: "유저4"), + UserInfoDTO(id: "500", nickname: "유저5") + ]), + manittee: UserInfoDTO(id: "1", nickname: "테스트마니띠"), + manitto: UserInfoDTO(id: "2", nickname: "테스트마니또"), + invitation: InvitationCodeDTO(code: "ABCDEF"), + didViewRoulette: false, + mission: IndividualMissionDTO(id: 1, content: "테스트미션"), + admin: false, + messages: MessageCountInfoDTO(count: 3)) + return room + } + + func patchStartManitto(roomId: String) async throws -> Manito.UserInfoDTO { + return UserInfoDTO(id: "1", nickname: "테스트마니띠") + } + + func deleteRoom(roomId: String) async throws -> Int { + return 200 + } + + func deleteLeaveRoom(roomId: String) async throws -> Int { + return 200 + } +} diff --git a/Manito/ManitoTests/DetailWaitViewModelTest.swift b/Manito/ManitoTests/Presentation/DetailWait/ViewModel/DetailWaitViewModelTest.swift similarity index 86% rename from Manito/ManitoTests/DetailWaitViewModelTest.swift rename to Manito/ManitoTests/Presentation/DetailWait/ViewModel/DetailWaitViewModelTest.swift index 98af32272..fba6c0e59 100644 --- a/Manito/ManitoTests/DetailWaitViewModelTest.swift +++ b/Manito/ManitoTests/Presentation/DetailWait/ViewModel/DetailWaitViewModelTest.swift @@ -293,38 +293,3 @@ final class DetailWaitViewModelTest: XCTestCase { XCTAssertEqual(checkRoom, testRoom) } } - -final class MockDetailWaitService: DetailWaitServicable { - // FIXME: - network mocking 만들어야함. - func fetchWaitingRoomInfo(roomId: String) async throws -> Manito.RoomInfoDTO { - let room = RoomInfoDTO( - roomInformation: RoomListItemDTO(id: 1, title: "테스트타이틀", state: "PRE", participatingCount: 5, capacity: 5, startDate: "2023.01.01", endDate: "2023.01.05"), - participants: ParticipantListDTO(count: 5, members: [ - UserInfoDTO(id: "100", nickname: "유저1"), - UserInfoDTO(id: "200", nickname: "유저2"), - UserInfoDTO(id: "300", nickname: "유저3"), - UserInfoDTO(id: "400", nickname: "유저4"), - UserInfoDTO(id: "500", nickname: "유저5") - ]), - manittee: UserInfoDTO(id: "1", nickname: "테스트마니띠"), - manitto: UserInfoDTO(id: "2", nickname: "테스트마니또"), - invitation: InvitationCodeDTO(code: "ABCDEF"), - didViewRoulette: false, - mission: IndividualMissionDTO(id: 1, content: "테스트미션"), - admin: false, - messages: MessageCountInfoDTO(count: 3)) - return room - } - - func patchStartManitto(roomId: String) async throws -> Manito.UserInfoDTO { - return UserInfoDTO(id: "1", nickname: "테스트마니띠") - } - - func deleteRoom(roomId: String) async throws -> Int { - return 200 - } - - func deleteLeaveRoom(roomId: String) async throws -> Int { - return 200 - } -} From b82ef784742cd2c3033778196bb8e89575ebdb8f Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 4 Sep 2023 14:08:31 +0900 Subject: [PATCH 442/468] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20-=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=BB=A8=EB=B2=A4=EC=85=98=20=ED=86=B5=EC=9D=BC=20(#505)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewControllers/SettingViewController.swift | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift b/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift index c8144bff3..1b4bb452c 100644 --- a/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift @@ -138,14 +138,21 @@ extension SettingViewController: SettingViewDelegate { } func logoutButtonDidTap() { - self.makeRequestAlert(title: TextLiteral.settingViewControllerLogoutAlertTitle, message: "", okTitle: TextLiteral.confirm, cancelTitle: TextLiteral.cancel, okAction: { [weak self] _ in + self.makeRequestAlert(title: TextLiteral.settingViewControllerLogoutAlertTitle, + message: "", + okTitle: TextLiteral.confirm, + cancelTitle: TextLiteral.cancel, + okAction: { [weak self] _ in self?.settingView.logoutButtonPublisher.send() }) } func withdrawalButtonDidTap() { - self.makeRequestAlert(title: TextLiteral.alert, message: TextLiteral.settingViewControllerWithdrawalMessage, okTitle: TextLiteral.settingViewControllerWithdrawal) { [weak self] _ in + self.makeRequestAlert(title: TextLiteral.alert, + message: TextLiteral.settingViewControllerWithdrawalMessage, + okTitle: TextLiteral.settingViewControllerWithdrawal, + okAction: { [weak self] _ in self?.settingView.withdrawalButtonPublisher.send() - } + }) } } From c0d8c7451ce3ec48f9911a7dbaaade644fa843f7 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 4 Sep 2023 14:17:17 +0900 Subject: [PATCH 443/468] =?UTF-8?q?[CHORE]=20=EC=9C=A0=EC=A0=80=EB=94=94?= =?UTF-8?q?=ED=8F=B4=ED=8A=B8=20=EC=82=AD=EC=A0=9C=20=EC=9C=84=EC=B9=98=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(#505)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/Setting/ViewControllers/SettingViewController.swift | 2 ++ Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift b/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift index 1b4bb452c..6369d274f 100644 --- a/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift +++ b/Manito/Manito/Screens/Setting/ViewControllers/SettingViewController.swift @@ -98,6 +98,8 @@ final class SettingViewController: BaseViewController { } private func deleteUser() { + UserDefaultHandler.clearAllDataExcludingFcmToken() + guard let sceneDelgate = UIApplication.shared.connectedScenes.first?.delegate as? SceneDelegate else { return } sceneDelgate.moveToLoginViewController() diff --git a/Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift b/Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift index 126e542cf..acfb86611 100644 --- a/Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift +++ b/Manito/Manito/Screens/Setting/ViewModel/SettingViewModel.swift @@ -32,7 +32,6 @@ final class SettingViewModel { input.withdrawalButtonDidTap .sink(receiveValue: { [weak self] _ in self?.requestDeleteUser() - UserDefaultHandler.clearAllDataExcludingFcmToken() }) .store(in: &self.cancellable) From 9e5bce2e790ac510b56df1b87fb166258ba792ee Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 4 Sep 2023 17:00:41 +0900 Subject: [PATCH 444/468] =?UTF-8?q?[CHORE]=20count=20=ED=95=A9=EC=B3=90?= =?UTF-8?q?=EC=84=9C=20output=EC=9C=BC=EB=A1=9C=20=EB=B9=BC=EA=B8=B0=20(#5?= =?UTF-8?q?07)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChangeNicknameViewController.swift | 11 ++++---- .../CreateNicknameViewController.swift | 10 ++----- .../ViewModel/NicknameViewModel.swift | 27 ++++++++++--------- .../UserDefaultStorage.swift | 2 +- 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift b/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift index fc9dd41e6..65af541b2 100644 --- a/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift +++ b/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift @@ -67,16 +67,15 @@ final class ChangeNicknameViewController: BaseViewController { } private func bindOutputToViewModel(_ output: NicknameViewModel.Output) { - output.nicknameMaxCount - .sink { [weak self] nicknameMaxCount in - self?.nicknameView.updateTextCount(count: nicknameMaxCount.nickname.count, maxLength: nicknameMaxCount.maxCount) - self?.nicknameView.setupNickname(nickname: nicknameMaxCount.nickname) + output.nickname + .sink { [weak self] nickname in + self?.nicknameView.setupNickname(nickname: nickname) } .store(in: &self.cancellable) output.counts - .sink { [weak self] counts in - self?.nicknameView.updateTextCount(count: counts.textCount, maxLength: counts.maxCount) + .sink { [weak self] (textCount, maxCount) in + self?.nicknameView.updateTextCount(count: textCount, maxLength: maxCount) } .store(in: &self.cancellable) diff --git a/Manito/Manito/Screens/NickName/ViewControllers/CreateNicknameViewController.swift b/Manito/Manito/Screens/NickName/ViewControllers/CreateNicknameViewController.swift index 62f018d99..c7cc0e931 100644 --- a/Manito/Manito/Screens/NickName/ViewControllers/CreateNicknameViewController.swift +++ b/Manito/Manito/Screens/NickName/ViewControllers/CreateNicknameViewController.swift @@ -94,15 +94,9 @@ final class CreateNicknameViewController: BaseViewController { } private func bindOutputToViewModel(_ output: NicknameViewModel.Output) { - output.nicknameMaxCount - .sink { [weak self] nicknameMaxCount in - self?.nicknameView.updateTextCount(count: 0, maxLength: nicknameMaxCount.maxCount) - } - .store(in: &self.cancellable) - output.counts - .sink { [weak self] counts in - self?.nicknameView.updateTextCount(count: counts.textCount, maxLength: counts.maxCount) + .sink { [weak self] (textCount, maxCount) in + self?.nicknameView.updateTextCount(count: textCount, maxLength: maxCount) } .store(in: &self.cancellable) diff --git a/Manito/Manito/Screens/NickName/ViewModel/NicknameViewModel.swift b/Manito/Manito/Screens/NickName/ViewModel/NicknameViewModel.swift index fd4e81e8b..8494bc92f 100644 --- a/Manito/Manito/Screens/NickName/ViewModel/NicknameViewModel.swift +++ b/Manito/Manito/Screens/NickName/ViewModel/NicknameViewModel.swift @@ -11,7 +11,6 @@ import Foundation final class NicknameViewModel { typealias Counts = (textCount: Int, maxCount: Int) - typealias NicknameMaxCount = (nickname: String, maxCount: Int) // MARK: - property @@ -30,7 +29,7 @@ final class NicknameViewModel { } struct Output { - let nicknameMaxCount: AnyPublisher + let nickname: AnyPublisher let counts: AnyPublisher let fixedTitleByMaxCount: AnyPublisher let isEnabled: AnyPublisher @@ -38,20 +37,22 @@ final class NicknameViewModel { } func transform(from input: Input) -> Output { - let nicknameMaxCount = input.viewDidLoad - .map { [weak self] _ -> NicknameMaxCount in - let nickname = UserDefaultStorage.nickname - return NicknameMaxCount(nickname, self!.maxCount) - } + let nickname = input.viewDidLoad + .map { UserDefaultStorage.nickname } .eraseToAnyPublisher() + + let changeTypeCount = input.viewDidLoad + .map { [weak self] _ -> Counts in + return (UserDefaultStorage.nickname.count, self?.maxCount ?? 0) + } - let counts = input.textFieldDidChanged + let createTypeCount = input.textFieldDidChanged .map { [weak self] text -> Counts in self?.nicknameSubject.send(text) - - return Counts(text.count, self!.maxCount) + return (text.count, self?.maxCount ?? 0) } - .eraseToAnyPublisher() + + let mergeCount = Publishers.Merge(createTypeCount, changeTypeCount).eraseToAnyPublisher() let fixedTitle = input.textFieldDidChanged .map { [weak self] text -> String in @@ -79,8 +80,8 @@ final class NicknameViewModel { }) .store(in: &self.cancellable) - return Output(nicknameMaxCount: nicknameMaxCount, - counts: counts, + return Output(nickname: nickname, + counts: mergeCount, fixedTitleByMaxCount: fixedTitle, isEnabled: isEnabled, doneButton: self.doneButtonSubject) diff --git a/Manito/Manito/Service/UserDefaultService/UserDefaultStorage.swift b/Manito/Manito/Service/UserDefaultService/UserDefaultStorage.swift index 8d0779d1f..3baf5cb14 100644 --- a/Manito/Manito/Service/UserDefaultService/UserDefaultStorage.swift +++ b/Manito/Manito/Service/UserDefaultService/UserDefaultStorage.swift @@ -35,7 +35,7 @@ struct UserDefaultStorage { } static var nickname: String { - return UserData.getValue(forKey: .nickname) ?? "당신" + return UserData.getValue(forKey: .nickname) ?? "" } static var fcmToken: String { From f0259155e0d4246b1a69752de5efd0d4115420e9 Mon Sep 17 00:00:00 2001 From: LEE SUNG HO <59243274+dangsal@users.noreply.github.com> Date: Mon, 4 Sep 2023 23:38:33 +0900 Subject: [PATCH 445/468] =?UTF-8?q?[CHORE]=20setup=20->=20update=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(#507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/NickName/View/NicknameView.swift | 2 +- .../NickName/ViewControllers/ChangeNicknameViewController.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito/Screens/NickName/View/NicknameView.swift b/Manito/Manito/Screens/NickName/View/NicknameView.swift index bac716e29..9a65f5e23 100644 --- a/Manito/Manito/Screens/NickName/View/NicknameView.swift +++ b/Manito/Manito/Screens/NickName/View/NicknameView.swift @@ -132,7 +132,7 @@ final class NicknameView: UIView { self.doneButton.isDisabled = !isEnabled } - func setupNickname(nickname: String) { + func updateNickname(nickname: String) { self.nicknameTextField.text = nickname } diff --git a/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift b/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift index 65af541b2..9dd1ca4b0 100644 --- a/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift +++ b/Manito/Manito/Screens/NickName/ViewControllers/ChangeNicknameViewController.swift @@ -69,7 +69,7 @@ final class ChangeNicknameViewController: BaseViewController { private func bindOutputToViewModel(_ output: NicknameViewModel.Output) { output.nickname .sink { [weak self] nickname in - self?.nicknameView.setupNickname(nickname: nickname) + self?.nicknameView.updateNickname(nickname: nickname) } .store(in: &self.cancellable) From 10041facdbe220d1d85cb7fc5cbca0288816bf42 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 5 Sep 2023 21:49:30 +0900 Subject: [PATCH 446/468] =?UTF-8?q?[ADD]=20=EB=9D=BC=EC=9D=B4=EB=B8=8C?= =?UTF-8?q?=EB=9F=AC=EB=A6=AC=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=20?= =?UTF-8?q?=EB=B2=84=EC=A0=84=20=EC=97=85(#513)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xcshareddata/swiftpm/Package.resolved | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a3ff76c5d..a5da03197 100644 --- a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleDataTransport.git", "state" : { - "revision" : "f6b558e3f801f2cac336b04f615ce111fa9ddaa0", - "version" : "9.2.1" + "revision" : "aae45a320fd0d11811820335b1eabc8753902a40", + "version" : "9.2.5" } }, { @@ -68,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleUtilities.git", "state" : { - "revision" : "0543562f85620b5b7c510c6bcbef75b562a5127b", - "version" : "7.11.0" + "revision" : "c38ce365d77b04a9a300c31061c5227589e5597b", + "version" : "7.11.5" } }, { @@ -113,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/promises.git", "state" : { - "revision" : "ec957ccddbcc710ccc64c9dcbd4c7006fcf8b73a", - "version" : "2.2.0" + "revision" : "e70e889c0196c76d22759eb50d6a0270ca9f1d9e", + "version" : "2.3.1" } }, { @@ -140,8 +140,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "0af9125c4eae12a4973fb66574c53a54962a9e1e", - "version" : "1.21.0" + "revision" : "cf62cdaea48b77f1a631e5cb3aeda6047c2cba1d", + "version" : "1.23.0" } } ], From 492543acdcfc550d5f6f8490266a562e9c5d972e Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 5 Sep 2023 21:52:37 +0900 Subject: [PATCH 447/468] =?UTF-8?q?[MOVE]=20Presention=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=ED=95=98=EC=9C=84=EB=A1=9C=20Base=20=ED=8F=B4?= =?UTF-8?q?=EB=8D=94=20=EC=9D=B4=EB=8F=99(#513)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 22 +++++++++---------- .../Base/BaseCollectionViewCell.swift | 0 .../Base/BaseTableViewCell.swift | 0 .../Base/BaseViewController.swift | 0 4 files changed, 11 insertions(+), 11 deletions(-) rename Manito/Manito/{Global => Presentation}/Base/BaseCollectionViewCell.swift (100%) rename Manito/Manito/{Global => Presentation}/Base/BaseTableViewCell.swift (100%) rename Manito/Manito/{Global => Presentation}/Base/BaseViewController.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 5516e2227..e06dafef7 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -769,6 +769,7 @@ B58CA2FC2A9CC29A00977592 /* Presentation */ = { isa = PBXGroup; children = ( + B5C7FBE62AA75B9C00862021 /* Base */, B58CA3052A9CC37000977592 /* Scene */, ); path = Presentation; @@ -920,6 +921,16 @@ path = ViewControllers; sourceTree = ""; }; + B5C7FBE62AA75B9C00862021 /* Base */ = { + isa = PBXGroup; + children = ( + B5F525192851A12600614FF7 /* BaseViewController.swift */, + B5F5251B2851A19A00614FF7 /* BaseCollectionViewCell.swift */, + B5F5251D2851A1C700614FF7 /* BaseTableViewCell.swift */, + ); + path = Base; + sourceTree = ""; + }; B5F524C228519AA000614FF7 = { isa = PBXGroup; children = ( @@ -984,7 +995,6 @@ B54741E529A4945100B75BA3 /* Error */, B5F525272851A29C00614FF7 /* Utils */, B5F524F828519BC700614FF7 /* Literal */, - B5F524F728519BC400614FF7 /* Base */, B5F524F628519BC000614FF7 /* Protocol */, B5F524F428519BB500614FF7 /* Extension */, B5F524F328519BB100614FF7 /* UIComponent */, @@ -1115,16 +1125,6 @@ path = Protocol; sourceTree = ""; }; - B5F524F728519BC400614FF7 /* Base */ = { - isa = PBXGroup; - children = ( - B5F525192851A12600614FF7 /* BaseViewController.swift */, - B5F5251B2851A19A00614FF7 /* BaseCollectionViewCell.swift */, - B5F5251D2851A1C700614FF7 /* BaseTableViewCell.swift */, - ); - path = Base; - sourceTree = ""; - }; B5F524F828519BC700614FF7 /* Literal */ = { isa = PBXGroup; children = ( diff --git a/Manito/Manito/Global/Base/BaseCollectionViewCell.swift b/Manito/Manito/Presentation/Base/BaseCollectionViewCell.swift similarity index 100% rename from Manito/Manito/Global/Base/BaseCollectionViewCell.swift rename to Manito/Manito/Presentation/Base/BaseCollectionViewCell.swift diff --git a/Manito/Manito/Global/Base/BaseTableViewCell.swift b/Manito/Manito/Presentation/Base/BaseTableViewCell.swift similarity index 100% rename from Manito/Manito/Global/Base/BaseTableViewCell.swift rename to Manito/Manito/Presentation/Base/BaseTableViewCell.swift diff --git a/Manito/Manito/Global/Base/BaseViewController.swift b/Manito/Manito/Presentation/Base/BaseViewController.swift similarity index 100% rename from Manito/Manito/Global/Base/BaseViewController.swift rename to Manito/Manito/Presentation/Base/BaseViewController.swift From c4568978ec343b21cbf9986ade17777e1d65296b Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Tue, 5 Sep 2023 22:00:23 +0900 Subject: [PATCH 448/468] =?UTF-8?q?[MOVE]=20Common=20=ED=8F=B4=EB=8D=94=20?= =?UTF-8?q?=ED=95=98=EC=9C=84=EB=A1=9C=20=EC=9D=B4=EB=8F=99(#513)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 12 ++++++++++-- .../{ => Common}/Base/BaseCollectionViewCell.swift | 0 .../{ => Common}/Base/BaseTableViewCell.swift | 0 .../{ => Common}/Base/BaseViewController.swift | 0 4 files changed, 10 insertions(+), 2 deletions(-) rename Manito/Manito/Presentation/{ => Common}/Base/BaseCollectionViewCell.swift (100%) rename Manito/Manito/Presentation/{ => Common}/Base/BaseTableViewCell.swift (100%) rename Manito/Manito/Presentation/{ => Common}/Base/BaseViewController.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index e06dafef7..ebc300064 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -769,7 +769,7 @@ B58CA2FC2A9CC29A00977592 /* Presentation */ = { isa = PBXGroup; children = ( - B5C7FBE62AA75B9C00862021 /* Base */, + B5C7FBE62AA75B9C00862021 /* Common */, B58CA3052A9CC37000977592 /* Scene */, ); path = Presentation; @@ -921,7 +921,15 @@ path = ViewControllers; sourceTree = ""; }; - B5C7FBE62AA75B9C00862021 /* Base */ = { + B5C7FBE62AA75B9C00862021 /* Common */ = { + isa = PBXGroup; + children = ( + B5C7FBEB2AA75DC700862021 /* Base */, + ); + path = Common; + sourceTree = ""; + }; + B5C7FBEB2AA75DC700862021 /* Base */ = { isa = PBXGroup; children = ( B5F525192851A12600614FF7 /* BaseViewController.swift */, diff --git a/Manito/Manito/Presentation/Base/BaseCollectionViewCell.swift b/Manito/Manito/Presentation/Common/Base/BaseCollectionViewCell.swift similarity index 100% rename from Manito/Manito/Presentation/Base/BaseCollectionViewCell.swift rename to Manito/Manito/Presentation/Common/Base/BaseCollectionViewCell.swift diff --git a/Manito/Manito/Presentation/Base/BaseTableViewCell.swift b/Manito/Manito/Presentation/Common/Base/BaseTableViewCell.swift similarity index 100% rename from Manito/Manito/Presentation/Base/BaseTableViewCell.swift rename to Manito/Manito/Presentation/Common/Base/BaseTableViewCell.swift diff --git a/Manito/Manito/Presentation/Base/BaseViewController.swift b/Manito/Manito/Presentation/Common/Base/BaseViewController.swift similarity index 100% rename from Manito/Manito/Presentation/Base/BaseViewController.swift rename to Manito/Manito/Presentation/Common/Base/BaseViewController.swift From abdb35d1b5a4d01a4fdb84a35ae34aee6c475c28 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 6 Sep 2023 14:25:56 +0900 Subject: [PATCH 449/468] =?UTF-8?q?[CHORE]=20BaseViewType=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=ED=94=84=EB=A1=9C=ED=86=A0=EC=BD=9C=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=20=EB=B3=80=EA=B2=BD(#513)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++++ .../Presentation/Common/Base/BaseViewType.swift | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 Manito/Manito/Presentation/Common/Base/BaseViewType.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index ebc300064..e6a8cf68d 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -115,6 +115,7 @@ B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */; }; B5B3C1652A427B5800AABD6F /* UIControl+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */; }; B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */; }; + B5C7FBED2AA7607300862021 /* BaseViewType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C7FBEC2AA7607300862021 /* BaseViewType.swift */; }; B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2AD285B2917006D880B /* Int+Extension.swift */; }; B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */; }; B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */; }; @@ -324,6 +325,7 @@ B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModelType.swift; sourceTree = ""; }; B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Combine.swift"; sourceTree = ""; }; B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Combine.swift"; sourceTree = ""; }; + B5C7FBEC2AA7607300862021 /* BaseViewType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseViewType.swift; sourceTree = ""; }; B5E1F2AD285B2917006D880B /* Int+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Extension.swift"; sourceTree = ""; }; B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeViewController.swift; sourceTree = ""; }; B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultStorage.swift; sourceTree = ""; }; @@ -935,6 +937,7 @@ B5F525192851A12600614FF7 /* BaseViewController.swift */, B5F5251B2851A19A00614FF7 /* BaseCollectionViewCell.swift */, B5F5251D2851A1C700614FF7 /* BaseTableViewCell.swift */, + B5C7FBEC2AA7607300862021 /* BaseViewType.swift */, ); path = Base; sourceTree = ""; @@ -1696,6 +1699,7 @@ B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */, B5F31BB228BE1CD700F61D0F /* UserDefaultHandler.swift in Sources */, CB9592B52855D52700847751 /* CommonMissionView.swift in Sources */, + B5C7FBED2AA7607300862021 /* BaseViewType.swift in Sources */, CBA4D7A42856CE9F0018BDC2 /* CreateRoomCollectionViewCell.swift in Sources */, D7C4A1A72A0B2EB000C3AE4C /* CharacterCollectionView.swift in Sources */, 39C95802287DACC300A04A2B /* RoomParticipationEndPoint.swift in Sources */, diff --git a/Manito/Manito/Presentation/Common/Base/BaseViewType.swift b/Manito/Manito/Presentation/Common/Base/BaseViewType.swift new file mode 100644 index 000000000..e6acf282c --- /dev/null +++ b/Manito/Manito/Presentation/Common/Base/BaseViewType.swift @@ -0,0 +1,12 @@ +// +// BaseViewType.swift +// Manito +// +// Created by SHIN YOON AH on 2023/09/05. +// + +import UIKit + +protocol BaseViewType: UIView { + +} From 97e1c61ab941a320289bda485f62762427cea713 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 6 Sep 2023 15:19:49 +0900 Subject: [PATCH 450/468] =?UTF-8?q?[FEAT]=20BaseViewType=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=ED=86=A0=EC=BD=9C=20=EB=82=B4=EB=B6=80=20=EB=A9=94?= =?UTF-8?q?=EC=84=9C=EB=93=9C=20=EC=B6=94=EA=B0=80(#513)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Presentation/Common/Base/BaseViewType.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Manito/Manito/Presentation/Common/Base/BaseViewType.swift b/Manito/Manito/Presentation/Common/Base/BaseViewType.swift index e6acf282c..4ac3793bf 100644 --- a/Manito/Manito/Presentation/Common/Base/BaseViewType.swift +++ b/Manito/Manito/Presentation/Common/Base/BaseViewType.swift @@ -8,5 +8,13 @@ import UIKit protocol BaseViewType: UIView { + func setupLayout() + func configureUI() +} +extension BaseViewType { + func baseInit() { + self.setupLayout() + self.configureUI() + } } From 78c1912477ca6140f5af5b4a366914545e95f67c Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 6 Sep 2023 15:20:32 +0900 Subject: [PATCH 451/468] =?UTF-8?q?[DEL]=20BaseCollectionViewCell,=20BaseT?= =?UTF-8?q?ableViewCell=20=EC=82=AD=EC=A0=9C(#513)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 8 ----- .../Common/Base/BaseCollectionViewCell.swift | 33 ------------------- .../Common/Base/BaseTableViewCell.swift | 33 ------------------- 3 files changed, 74 deletions(-) delete mode 100644 Manito/Manito/Presentation/Common/Base/BaseCollectionViewCell.swift delete mode 100644 Manito/Manito/Presentation/Common/Base/BaseTableViewCell.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index e6a8cf68d..878bd5888 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -137,8 +137,6 @@ B5F5250E2851A07700614FF7 /* LetterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5250D2851A07700614FF7 /* LetterViewController.swift */; }; B5F525162851A0F600614FF7 /* DetailIng.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B5F525152851A0F600614FF7 /* DetailIng.storyboard */; }; B5F5251A2851A12600614FF7 /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F525192851A12600614FF7 /* BaseViewController.swift */; }; - B5F5251C2851A19A00614FF7 /* BaseCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5251B2851A19A00614FF7 /* BaseCollectionViewCell.swift */; }; - B5F5251E2851A1C700614FF7 /* BaseTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5251D2851A1C700614FF7 /* BaseTableViewCell.swift */; }; B5F525202851A21D00614FF7 /* UIViewController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5251F2851A21D00614FF7 /* UIViewController+Extension.swift */; }; B5F525222851A24100614FF7 /* UITableView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F525212851A24100614FF7 /* UITableView+Extension.swift */; }; B5F525242851A25400614FF7 /* UICollectionView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F525232851A25400614FF7 /* UICollectionView+Extension.swift */; }; @@ -349,8 +347,6 @@ B5F5250D2851A07700614FF7 /* LetterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterViewController.swift; sourceTree = ""; }; B5F525152851A0F600614FF7 /* DetailIng.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = DetailIng.storyboard; sourceTree = ""; }; B5F525192851A12600614FF7 /* BaseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseViewController.swift; sourceTree = ""; }; - B5F5251B2851A19A00614FF7 /* BaseCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseCollectionViewCell.swift; sourceTree = ""; }; - B5F5251D2851A1C700614FF7 /* BaseTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseTableViewCell.swift; sourceTree = ""; }; B5F5251F2851A21D00614FF7 /* UIViewController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Extension.swift"; sourceTree = ""; }; B5F525212851A24100614FF7 /* UITableView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableView+Extension.swift"; sourceTree = ""; }; B5F525232851A25400614FF7 /* UICollectionView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UICollectionView+Extension.swift"; sourceTree = ""; }; @@ -935,8 +931,6 @@ isa = PBXGroup; children = ( B5F525192851A12600614FF7 /* BaseViewController.swift */, - B5F5251B2851A19A00614FF7 /* BaseCollectionViewCell.swift */, - B5F5251D2851A1C700614FF7 /* BaseTableViewCell.swift */, B5C7FBEC2AA7607300862021 /* BaseViewType.swift */, ); path = Base; @@ -1660,7 +1654,6 @@ D724AF5F28708D830003F280 /* TopCharacterImageView.swift in Sources */, 7EA25C2728C4FEA800746AEA /* ChangeNicknameViewController.swift in Sources */, 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */, - B5F5251E2851A1C700614FF7 /* BaseTableViewCell.swift in Sources */, D719395F2AA23F2300A73D6C /* NicknameViewModel.swift in Sources */, 39BDDCC42A52BB4A005E0A71 /* DetailWaitService.swift in Sources */, B5A086022A974B8100C8A98D /* RoomListItem.swift in Sources */, @@ -1716,7 +1709,6 @@ 33BDF5622856E03800564211 /* FriendListViewController.swift in Sources */, D71939552AA1C85300A73D6C /* SettingViewModel.swift in Sources */, B5F5250E2851A07700614FF7 /* LetterViewController.swift in Sources */, - B5F5251C2851A19A00614FF7 /* BaseCollectionViewCell.swift in Sources */, B5F525082851A05E00614FF7 /* InvitedCodeViewController.swift in Sources */, 398B1C9B29F10B0300DEFCEC /* DetailEditView.swift in Sources */, B50B1AFD2856C3500080992C /* CreateLetterTextView.swift in Sources */, diff --git a/Manito/Manito/Presentation/Common/Base/BaseCollectionViewCell.swift b/Manito/Manito/Presentation/Common/Base/BaseCollectionViewCell.swift deleted file mode 100644 index 62ec541e1..000000000 --- a/Manito/Manito/Presentation/Common/Base/BaseCollectionViewCell.swift +++ /dev/null @@ -1,33 +0,0 @@ -// -// BaseCollectionViewCell.swift -// Manito -// -// Created by SHIN YOON AH on 2022/06/09. -// - -import UIKit - -class BaseCollectionViewCell: UICollectionViewCell { - - // MARK: - init - - override init(frame: CGRect) { - super.init(frame: frame) - setupLayout() - configureUI() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - func - - func setupLayout() { - // Override Layout - } - - func configureUI() { - // View Configuration - } -} diff --git a/Manito/Manito/Presentation/Common/Base/BaseTableViewCell.swift b/Manito/Manito/Presentation/Common/Base/BaseTableViewCell.swift deleted file mode 100644 index 7c8811a52..000000000 --- a/Manito/Manito/Presentation/Common/Base/BaseTableViewCell.swift +++ /dev/null @@ -1,33 +0,0 @@ -// -// BaseTableViewCell.swift -// Manito -// -// Created by SHIN YOON AH on 2022/06/09. -// - -import UIKit - -class BaseTableViewCell: UITableViewCell { - - // MARK: - init - - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - super.init(style: style, reuseIdentifier: reuseIdentifier) - render() - configUI() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - // MARK: - func - - func render() { - // Override Layout - } - - func configUI() { - // Override ConfigUI - } -} From 39095d6957192a6a46df9b1cf98132e46906a370 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 6 Sep 2023 15:33:09 +0900 Subject: [PATCH 452/468] =?UTF-8?q?[CHORE]=20BaseViewType=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20BaseCollectionViewCell=20=ED=83=80=EC=9E=85=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD(#513)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/Cell/LetterCollectionViewCell.swift | 9 ++++---- .../CharacterCollectionViewCell.swift | 20 +++++++++++++---- .../Cell/MemoryCollectionViewCell.swift | 22 ++++++++++++++----- .../Cell/OpenManittoCollectionViewCell.swift | 20 +++++++++++++---- .../Cell/CreateRoomCollectionViewCell.swift | 20 +++++++++++++---- .../Main/Cell/ManitoRoomCollectionCell.swift | 20 +++++++++++++---- .../Cell/DeveloperInfoViewCell.swift | 9 ++++---- 7 files changed, 91 insertions(+), 29 deletions(-) diff --git a/Manito/Manito/Presentation/Scene/LetterScene/View/Cell/LetterCollectionViewCell.swift b/Manito/Manito/Presentation/Scene/LetterScene/View/Cell/LetterCollectionViewCell.swift index 0c467b4e4..745324d3a 100644 --- a/Manito/Manito/Presentation/Scene/LetterScene/View/Cell/LetterCollectionViewCell.swift +++ b/Manito/Manito/Presentation/Scene/LetterScene/View/Cell/LetterCollectionViewCell.swift @@ -10,7 +10,7 @@ import UIKit import SnapKit -final class LetterCollectionViewCell: BaseCollectionViewCell { +final class LetterCollectionViewCell: UICollectionViewCell, BaseViewType { typealias ConfigurationData = (mission: String, content: String?, imageURL: String?, isTodayLetter: Bool, canReport: Bool?) @@ -84,6 +84,7 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { override init(frame: CGRect) { super.init(frame: frame) + self.baseInit() self.setupImageGesture() } @@ -92,9 +93,9 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { fatalError("init(coder:) has not been implemented") } - // MARK: - override + // MARK: - base func - override func setupLayout() { + func setupLayout() { self.contentView.addSubview(self.wholeStackView) self.wholeStackView.snp.makeConstraints { $0.top.leading.trailing.equalToSuperview() @@ -118,7 +119,7 @@ final class LetterCollectionViewCell: BaseCollectionViewCell { } } - override func configureUI() { + func configureUI() { self.clipsToBounds = true self.makeBorderLayer(color: .white.withAlphaComponent(0.5)) } diff --git a/Manito/Manito/Screens/ChooseCharacter/UIComponent/CharacterCollectionViewCell.swift b/Manito/Manito/Screens/ChooseCharacter/UIComponent/CharacterCollectionViewCell.swift index 07f046f63..a5e87c32d 100644 --- a/Manito/Manito/Screens/ChooseCharacter/UIComponent/CharacterCollectionViewCell.swift +++ b/Manito/Manito/Screens/ChooseCharacter/UIComponent/CharacterCollectionViewCell.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -final class CharacterCollectionViewCell: BaseCollectionViewCell { +final class CharacterCollectionViewCell: UICollectionViewCell, BaseViewType { // MARK: - ui component @@ -23,10 +23,22 @@ final class CharacterCollectionViewCell: BaseCollectionViewCell { // MARK: - property private var characterBackgroundColor: UIColor? + + // MARK: - init + + override init(frame: CGRect) { + super.init(frame: frame) + self.baseInit() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } - // MARK: - override + // MARK: - base func - override func setupLayout() { + func setupLayout() { self.contentView.addSubview(self.characterImageView) self.characterImageView.snp.makeConstraints { $0.center.equalToSuperview() @@ -34,7 +46,7 @@ final class CharacterCollectionViewCell: BaseCollectionViewCell { } } - override func configureUI() { + func configureUI() { self.makeBorderLayer(color: .white) layer.cornerRadius = self.frame.size.width / 2 } diff --git a/Manito/Manito/Screens/Detail-Ing/Cell/MemoryCollectionViewCell.swift b/Manito/Manito/Screens/Detail-Ing/Cell/MemoryCollectionViewCell.swift index e5d75bb73..6dac5a356 100644 --- a/Manito/Manito/Screens/Detail-Ing/Cell/MemoryCollectionViewCell.swift +++ b/Manito/Manito/Screens/Detail-Ing/Cell/MemoryCollectionViewCell.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -final class MemoryCollectionViewCell: BaseCollectionViewCell { +final class MemoryCollectionViewCell: UICollectionViewCell, BaseViewType { var didTappedImage: ((UIImage) -> ())? // MARK: - properties @@ -28,8 +28,20 @@ final class MemoryCollectionViewCell: BaseCollectionViewCell { label.lineBreakMode = .byCharWrapping return label }() + + // MARK: - init + + override init(frame: CGRect) { + super.init(frame: frame) + self.baseInit() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } - // MARK: - life cycle + // MARK: - override override func prepareForReuse() { super.prepareForReuse() @@ -37,9 +49,9 @@ final class MemoryCollectionViewCell: BaseCollectionViewCell { contentLabel.text = "" } - // MARK: - func + // MARK: - base func - override func setupLayout() { + func setupLayout() { addSubview(photoImageView) photoImageView.snp.makeConstraints { $0.edges.equalToSuperview() @@ -51,7 +63,7 @@ final class MemoryCollectionViewCell: BaseCollectionViewCell { } } - override func configureUI() { + func configureUI() { backgroundColor = .darkGrey002 makeBorderLayer(color: .white) layer.masksToBounds = true diff --git a/Manito/Manito/Screens/Interaction/Cell/OpenManittoCollectionViewCell.swift b/Manito/Manito/Screens/Interaction/Cell/OpenManittoCollectionViewCell.swift index 28afadf09..b5d80ad59 100644 --- a/Manito/Manito/Screens/Interaction/Cell/OpenManittoCollectionViewCell.swift +++ b/Manito/Manito/Screens/Interaction/Cell/OpenManittoCollectionViewCell.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -final class OpenManittoCollectionViewCell: BaseCollectionViewCell { +final class OpenManittoCollectionViewCell: UICollectionViewCell, BaseViewType { // MARK: - ui component @@ -19,9 +19,21 @@ final class OpenManittoCollectionViewCell: BaseCollectionViewCell { return imageView }() - // MARK: - override + // MARK: - init + + override init(frame: CGRect) { + super.init(frame: frame) + self.baseInit() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - base func - override func setupLayout() { + func setupLayout() { self.contentView.addSubview(self.characterImageView) self.characterImageView.snp.makeConstraints { $0.center.equalToSuperview() @@ -29,7 +41,7 @@ final class OpenManittoCollectionViewCell: BaseCollectionViewCell { } } - override func configureUI() { + func configureUI() { self.contentView.makeBorderLayer(color: .white) self.contentView.layer.cornerRadius = self.frame.size.width / 2 } diff --git a/Manito/Manito/Screens/Main/Cell/CreateRoomCollectionViewCell.swift b/Manito/Manito/Screens/Main/Cell/CreateRoomCollectionViewCell.swift index 448922563..9a0044d5d 100644 --- a/Manito/Manito/Screens/Main/Cell/CreateRoomCollectionViewCell.swift +++ b/Manito/Manito/Screens/Main/Cell/CreateRoomCollectionViewCell.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -final class CreateRoomCollectionViewCell: BaseCollectionViewCell { +final class CreateRoomCollectionViewCell: UICollectionViewCell, BaseViewType { // MARK: - ui component @@ -29,10 +29,22 @@ final class CreateRoomCollectionViewCell: BaseCollectionViewCell { label.font = .font(.regular, ofSize: 14) return label }() + + // MARK: - init + + override init(frame: CGRect) { + super.init(frame: frame) + self.baseInit() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } - // MARK: - override + // MARK: - base func - override func setupLayout() { + func setupLayout() { self.addSubview(self.circleView) self.circleView.snp.makeConstraints { $0.top.equalToSuperview().inset(22) @@ -54,7 +66,7 @@ final class CreateRoomCollectionViewCell: BaseCollectionViewCell { } } - override func configureUI(){ + func configureUI(){ self.backgroundColor = .darkGrey002.withAlphaComponent(0.8) self.makeBorderLayer(color: UIColor.white.withAlphaComponent(0.5)) } diff --git a/Manito/Manito/Screens/Main/Cell/ManitoRoomCollectionCell.swift b/Manito/Manito/Screens/Main/Cell/ManitoRoomCollectionCell.swift index 2a034ecfd..87eb749f4 100644 --- a/Manito/Manito/Screens/Main/Cell/ManitoRoomCollectionCell.swift +++ b/Manito/Manito/Screens/Main/Cell/ManitoRoomCollectionCell.swift @@ -10,7 +10,7 @@ import UIKit import SkeletonView import SnapKit -final class ManitoRoomCollectionViewCell: BaseCollectionViewCell { +final class ManitoRoomCollectionViewCell: UICollectionViewCell, BaseViewType { private enum RoomStatus: String { case PRE = "대기중" @@ -45,10 +45,22 @@ final class ManitoRoomCollectionViewCell: BaseCollectionViewCell { return label }() lazy var roomStateView: RoomStateView = RoomStateView() + + // MARK: - init + + override init(frame: CGRect) { + super.init(frame: frame) + self.baseInit() + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } - // MARK: - override + // MARK: - base func - override func setupLayout() { + func setupLayout() { self.contentView.addSubview(self.imageView) self.imageView.snp.makeConstraints { $0.top.leading.equalToSuperview().inset(9) @@ -83,7 +95,7 @@ final class ManitoRoomCollectionViewCell: BaseCollectionViewCell { } } - override func configureUI() { + func configureUI() { self.backgroundColor = .darkGrey002.withAlphaComponent(0.8) self.makeBorderLayer(color: UIColor.white.withAlphaComponent(0.5)) diff --git a/Manito/Manito/Screens/SettingDeveloperInfo/Cell/DeveloperInfoViewCell.swift b/Manito/Manito/Screens/SettingDeveloperInfo/Cell/DeveloperInfoViewCell.swift index c492d9987..ff6db443e 100644 --- a/Manito/Manito/Screens/SettingDeveloperInfo/Cell/DeveloperInfoViewCell.swift +++ b/Manito/Manito/Screens/SettingDeveloperInfo/Cell/DeveloperInfoViewCell.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -class DeveloperInfoViewCell: BaseCollectionViewCell { +class DeveloperInfoViewCell: UICollectionViewCell, BaseViewType { // MARK: - property @@ -37,22 +37,23 @@ class DeveloperInfoViewCell: BaseCollectionViewCell { override init(frame: CGRect) { super.init(frame: frame) + self.baseInit() } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } - // MARK: - func + // MARK: - base func - override func configureUI() { + func configureUI() { backgroundColor = .grey001.withAlphaComponent(0.1) layer.borderWidth = 1 layer.borderColor = UIColor.white.withAlphaComponent(0.1).cgColor layer.cornerRadius = 10 } - override func setupLayout() { + func setupLayout() { addSubview(developerImageView) developerImageView.snp.makeConstraints { $0.top.bottom.equalToSuperview().inset(10) From 2244013e214cfb830dd618cd1178204d7a8056be Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 6 Sep 2023 15:35:10 +0900 Subject: [PATCH 453/468] =?UTF-8?q?[DEL]=20ViewController=EC=97=90?= =?UTF-8?q?=EC=84=9C=20setupLayout,=20configureUI=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C(#513)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/Common/Base/BaseViewController.swift | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Manito/Manito/Presentation/Common/Base/BaseViewController.swift b/Manito/Manito/Presentation/Common/Base/BaseViewController.swift index 94f4faeba..049cc382c 100644 --- a/Manito/Manito/Presentation/Common/Base/BaseViewController.swift +++ b/Manito/Manito/Presentation/Common/Base/BaseViewController.swift @@ -40,8 +40,6 @@ class BaseViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - setupLayout() - configureUI() setupBackButton() hidekeyboardWhenTappedAround() setupNavigationBar() @@ -57,14 +55,6 @@ class BaseViewController: UIViewController { setupInteractivePopGestureRecognizer() } - func setupLayout() { - // Override Layout - } - - func configureUI() { - view.backgroundColor = .backgroundGrey - } - func setupNavigationBar() { guard let navigationBar = navigationController?.navigationBar else { return } let appearance = UINavigationBarAppearance() From 254a00788da0f840a1a65431e754335c2d7725dd Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 6 Sep 2023 17:31:29 +0900 Subject: [PATCH 454/468] =?UTF-8?q?[CHORE]=20BaseType=20=EB=AA=A8=EB=91=90?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=20=EC=99=84=EB=A3=8C(#513)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++ .../Common/Base/BaseViewController.swift | 2 - .../Common/Base/BaseViewControllerType.swift | 25 +++++++++++ .../Common/Base/BaseViewType.swift | 4 ++ .../Scene/LetterScene/View/LetterView.swift | 13 ++++-- .../CheckRoom/CheckRoomViewController.swift | 11 +++-- .../View/ChooseCharacterView.swift | 14 ++++-- .../CreateRoom/CreateRoomViewController.swift | 12 +++--- .../CreateRoom/View/CreateRoomView.swift | 22 +++++----- .../Detail-Ing/FriendListViewController.swift | 19 +++++--- .../Detail-Ing/MemoryViewController.swift | 43 +++++++++++-------- .../MissionEditViewController.swift | 18 ++++---- .../Detail-Ing/View/DetailingView.swift | 14 ++++-- .../DetailEditViewController.swift | 12 +++--- .../Detail-Wait/View/DetailEditView.swift | 20 ++++++--- .../Detail-Wait/View/DetailWaitView.swift | 16 ++++--- .../SelectManitteeViewController.swift | 8 ++-- .../Interaction/View/OpenManittoView.swift | 14 ++++-- .../Interaction/View/SelectManitteeView.swift | 12 ++++-- .../InvitedCodeViewController.swift | 17 +++++--- .../CreateLetterViewController.swift | 8 ++-- .../Letter/Views/Views/CreateLetterView.swift | 14 ++++-- .../Letter/Views/Views/LetterImageView.swift | 14 ++++-- .../Screens/Login/LoginViewController.swift | 11 +++-- .../Screens/Main/MainViewController.swift | 13 ++++-- .../Screens/NickName/View/NicknameView.swift | 14 ++++-- .../ParticipateRoom/ParticipateRoomView.swift | 14 ++++-- .../Screens/Setting/View/SettingView.swift | 14 ++++-- .../SettingDeveloperInfoViewController.swift | 27 +++++++++--- .../Screens/Splash/SplashViewController.swift | 14 ++++-- 30 files changed, 302 insertions(+), 141 deletions(-) create mode 100644 Manito/Manito/Presentation/Common/Base/BaseViewControllerType.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 878bd5888..3c63c4ca3 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -116,6 +116,7 @@ B5B3C1652A427B5800AABD6F /* UIControl+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */; }; B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */; }; B5C7FBED2AA7607300862021 /* BaseViewType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C7FBEC2AA7607300862021 /* BaseViewType.swift */; }; + B5C7FBF52AA859E300862021 /* BaseViewControllerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C7FBF42AA859E300862021 /* BaseViewControllerType.swift */; }; B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2AD285B2917006D880B /* Int+Extension.swift */; }; B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */; }; B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */; }; @@ -324,6 +325,7 @@ B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Combine.swift"; sourceTree = ""; }; B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Combine.swift"; sourceTree = ""; }; B5C7FBEC2AA7607300862021 /* BaseViewType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseViewType.swift; sourceTree = ""; }; + B5C7FBF42AA859E300862021 /* BaseViewControllerType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseViewControllerType.swift; sourceTree = ""; }; B5E1F2AD285B2917006D880B /* Int+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Extension.swift"; sourceTree = ""; }; B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeViewController.swift; sourceTree = ""; }; B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultStorage.swift; sourceTree = ""; }; @@ -932,6 +934,7 @@ children = ( B5F525192851A12600614FF7 /* BaseViewController.swift */, B5C7FBEC2AA7607300862021 /* BaseViewType.swift */, + B5C7FBF42AA859E300862021 /* BaseViewControllerType.swift */, ); path = Base; sourceTree = ""; @@ -1655,6 +1658,7 @@ 7EA25C2728C4FEA800746AEA /* ChangeNicknameViewController.swift in Sources */, 333BF66A285864CE0039F77F /* MemoryViewController.swift in Sources */, D719395F2AA23F2300A73D6C /* NicknameViewModel.swift in Sources */, + B5C7FBF52AA859E300862021 /* BaseViewControllerType.swift in Sources */, 39BDDCC42A52BB4A005E0A71 /* DetailWaitService.swift in Sources */, B5A086022A974B8100C8A98D /* RoomListItem.swift in Sources */, B53A35CC2A96F99D00B720BC /* SettingRepository.swift in Sources */, diff --git a/Manito/Manito/Presentation/Common/Base/BaseViewController.swift b/Manito/Manito/Presentation/Common/Base/BaseViewController.swift index 049cc382c..762846497 100644 --- a/Manito/Manito/Presentation/Common/Base/BaseViewController.swift +++ b/Manito/Manito/Presentation/Common/Base/BaseViewController.swift @@ -20,8 +20,6 @@ class BaseViewController: UIViewController { return button }() - private let tokenRepository: TokenRepository = TokenRepositoryImpl() - // MARK: - init init() { diff --git a/Manito/Manito/Presentation/Common/Base/BaseViewControllerType.swift b/Manito/Manito/Presentation/Common/Base/BaseViewControllerType.swift new file mode 100644 index 000000000..1f57de8b4 --- /dev/null +++ b/Manito/Manito/Presentation/Common/Base/BaseViewControllerType.swift @@ -0,0 +1,25 @@ +// +// BaseViewControllerType.swift +// Manito +// +// Created by SHIN YOON AH on 2023/09/06. +// + +import UIKit + +/// +/// UIViewController 타입의 클래스를 구성하기 위한 기본적인 함수를 제공합니다. +/// + +@available(iOS, deprecated, message: "아직 리팩토링을 하지 않은 화면이 남아있어서 임시적으로 만든 프로토콜입니다.") +protocol BaseViewControllerType: UIViewController { + func setupLayout() + func configureUI() +} + +extension BaseViewControllerType { + func baseViewDidLoad() { + self.setupLayout() + self.configureUI() + } +} diff --git a/Manito/Manito/Presentation/Common/Base/BaseViewType.swift b/Manito/Manito/Presentation/Common/Base/BaseViewType.swift index 4ac3793bf..04dc31949 100644 --- a/Manito/Manito/Presentation/Common/Base/BaseViewType.swift +++ b/Manito/Manito/Presentation/Common/Base/BaseViewType.swift @@ -7,6 +7,10 @@ import UIKit +/// +/// UIView 타입의 클래스를 구성하기 위한 기본적인 함수를 제공합니다. +/// + protocol BaseViewType: UIView { func setupLayout() func configureUI() diff --git a/Manito/Manito/Presentation/Scene/LetterScene/View/LetterView.swift b/Manito/Manito/Presentation/Scene/LetterScene/View/LetterView.swift index f46de09b2..2a21216e1 100644 --- a/Manito/Manito/Presentation/Scene/LetterScene/View/LetterView.swift +++ b/Manito/Manito/Presentation/Scene/LetterScene/View/LetterView.swift @@ -10,7 +10,7 @@ import UIKit import SnapKit -final class LetterView: UIView { +final class LetterView: UIView, BaseViewType { private enum ConstantSize { static let headerWidth: CGFloat = UIScreen.main.bounds.size.width @@ -87,7 +87,7 @@ final class LetterView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setupLayout() + self.baseInit() self.bindUI() } @@ -131,7 +131,8 @@ final class LetterView: UIView { } extension LetterView { - private func setupLayout() { + // MARK: - base func + func setupLayout() { self.addSubview(self.wholeStackView) self.wholeStackView.snp.makeConstraints { $0.edges.equalToSuperview() @@ -155,6 +156,12 @@ extension LetterView { } } + func configureUI() { + self.backgroundColor = .backgroundGrey + } + + // MARK: - private func + private func bindUI() { self.listCollectionView.scrollPublisher .sink(receiveValue: { [weak self] in diff --git a/Manito/Manito/Screens/CheckRoom/CheckRoomViewController.swift b/Manito/Manito/Screens/CheckRoom/CheckRoomViewController.swift index 6a4a3a9d6..e92adde5a 100644 --- a/Manito/Manito/Screens/CheckRoom/CheckRoomViewController.swift +++ b/Manito/Manito/Screens/CheckRoom/CheckRoomViewController.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -class CheckRoomViewController: BaseViewController { +class CheckRoomViewController: BaseViewController, BaseViewControllerType { var roomId: Int? var roomInfo: ParticipatedRoomInfoDTO? @@ -70,10 +70,13 @@ class CheckRoomViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() + self.baseViewDidLoad() setupViewController() } + + // MARK: - base func - override func setupLayout() { + func setupLayout() { view.addSubview(roomInfoImageView) roomInfoImageView.snp.makeConstraints { $0.center.equalToSuperview() @@ -110,8 +113,8 @@ class CheckRoomViewController: BaseViewController { } } - override func configureUI() { - view.backgroundColor = .black.withAlphaComponent(0.7) + func configureUI() { + self.view.backgroundColor = .black.withAlphaComponent(0.7) } // MARK: - func diff --git a/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift b/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift index f33e79636..fa1f32697 100644 --- a/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift +++ b/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift @@ -15,7 +15,7 @@ protocol ChooseCharacterViewDelegate: AnyObject { func joinButtonDidTap(characterIndex: Int) } -final class ChooseCharacterView: UIView { +final class ChooseCharacterView: UIView, BaseViewType { // MARK: - ui component @@ -57,7 +57,7 @@ final class ChooseCharacterView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setupLayout() + self.baseInit() self.setupButtonAction() } @@ -66,9 +66,9 @@ final class ChooseCharacterView: UIView { fatalError("init(coder:) has not been implemented") } - // MARK: - func + // MARK: - base func - private func setupLayout() { + func setupLayout() { self.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { $0.top.equalTo(self.safeAreaLayoutGuide).inset(20) @@ -95,6 +95,12 @@ final class ChooseCharacterView: UIView { $0.bottom.equalTo(self.joinButton.snp.top) } } + + func configureUI() { + self.backgroundColor = .backgroundGrey + } + + // MARK: - func private func setupButtonAction() { let didTapBackButton = UIAction { [weak self] _ in diff --git a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift index 4de73fb15..a15ea76bb 100644 --- a/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift +++ b/Manito/Manito/Screens/CreateRoom/CreateRoomViewController.swift @@ -45,22 +45,22 @@ final class CreateRoomViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() + self.setupNavigationBarHiddenState() self.configureDelegation() self.bindViewModel() } // MARK: - override - override func configureUI() { - super.configureUI() - self.navigationController?.navigationBar.isHidden = true - } - override func endEditingView() { self.createRoomView.endEditingView() } - + // MARK: - func + + private func setupNavigationBarHiddenState() { + self.navigationController?.navigationBar.isHidden = true + } private func configureDelegation() { self.createRoomView.configureDelegate(self) diff --git a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift index 695da7d34..c03fa89f6 100644 --- a/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift +++ b/Manito/Manito/Screens/CreateRoom/View/CreateRoomView.swift @@ -14,7 +14,7 @@ protocol CreateRoomViewDelegate: AnyObject { func didTapCloseButton() } -final class CreateRoomView: UIView { +final class CreateRoomView: UIView, BaseViewType { // MARK: - ui component @@ -67,10 +67,9 @@ final class CreateRoomView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setupLayout() + self.baseInit() self.setupAction() self.setupNotificationCenter() - self.configureUI() } @available(*, unavailable) @@ -78,9 +77,9 @@ final class CreateRoomView: UIView { fatalError("init(coder:) has not been implemented") } - // MARK: - func + // MARK: - base func - private func setupLayout() { + func setupLayout() { self.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { $0.top.equalTo(self.safeAreaLayoutGuide).inset(66) @@ -124,7 +123,14 @@ final class CreateRoomView: UIView { self.bringSubviewToFront(self.nextButton) } - + + func configureUI() { + self.backgroundColor = .backgroundGrey + self.roomStep = .inputTitle + } + + // MARK: - func + private func setupAction() { let closeAction = UIAction { [weak self] _ in self?.delegate?.didTapCloseButton() @@ -210,10 +216,6 @@ final class CreateRoomView: UIView { self.nextButton.isDisabled = !isEnable } - private func configureUI() { - self.roomStep = .inputTitle - } - func configureDelegate(_ delegate: CreateRoomViewDelegate) { self.delegate = delegate } diff --git a/Manito/Manito/Screens/Detail-Ing/FriendListViewController.swift b/Manito/Manito/Screens/Detail-Ing/FriendListViewController.swift index 15738a2e7..32ac2bda8 100644 --- a/Manito/Manito/Screens/Detail-Ing/FriendListViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/FriendListViewController.swift @@ -7,7 +7,7 @@ import UIKit -final class FriendListViewController: BaseViewController { +final class FriendListViewController: BaseViewController, BaseViewControllerType { var friendArray: [MemberInfoDTO] = [] { didSet { friendListCollectionView.reloadData() @@ -33,13 +33,22 @@ final class FriendListViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() + self.baseViewDidLoad() setupDelegation() } - - override func configureUI() { - super.configureUI() - friendListCollectionView.backgroundColor = .clear + + // MARK: - base func + + func setupLayout() { + // FIXME: - 스토리보드를 코드 베이스로 바꿔야 하는 화면입니다. } + + func configureUI() { + self.view.backgroundColor = .backgroundGrey + self.friendListCollectionView.backgroundColor = .clear + } + + // MARK: - func private func setupDelegation() { friendListCollectionView.delegate = self diff --git a/Manito/Manito/Screens/Detail-Ing/MemoryViewController.swift b/Manito/Manito/Screens/Detail-Ing/MemoryViewController.swift index c5d6ea7e3..7c7603131 100644 --- a/Manito/Manito/Screens/Detail-Ing/MemoryViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/MemoryViewController.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -final class MemoryViewController: BaseViewController { +final class MemoryViewController: BaseViewController, BaseViewControllerType { private enum MemoryType: Int { case manittee = 0 @@ -115,8 +115,27 @@ final class MemoryViewController: BaseViewController { } // MARK: - life cycle + + override func viewDidLoad() { + super.viewDidLoad() + self.baseViewDidLoad() + } + + // MARK: - override + + override func setupNavigationBar() { + super.setupNavigationBar() + let shareButton = makeBarButtonItem(with: shareButton) + + navigationItem.rightBarButtonItem = shareButton + navigationController?.navigationBar.prefersLargeTitles = false + navigationItem.largeTitleDisplayMode = .automatic + title = TextLiteral.memoryViewControllerTitleLabel + } + + // MARK: - base func - override func setupLayout() { + func setupLayout() { view.addSubview(segmentControl) segmentControl.snp.makeConstraints { $0.top.equalTo(view.safeAreaLayoutGuide).inset(30) @@ -178,22 +197,12 @@ final class MemoryViewController: BaseViewController { $0.width.height.equalTo(90) } } - - override func configureUI() { - super.configureUI() - setupAction() - } - - override func setupNavigationBar() { - super.setupNavigationBar() - let shareButton = makeBarButtonItem(with: shareButton) - - navigationItem.rightBarButtonItem = shareButton - navigationController?.navigationBar.prefersLargeTitles = false - navigationItem.largeTitleDisplayMode = .automatic - title = TextLiteral.memoryViewControllerTitleLabel + + func configureUI() { + self.view.backgroundColor = .backgroundGrey + self.setupAction() } - + // MARK: - func private func setupAction() { diff --git a/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift b/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift index d3673971a..5963e595c 100644 --- a/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Ing/MissionEditViewController.swift @@ -13,7 +13,7 @@ protocol MissionEditDelegate: AnyObject { func didChangeMission() } -final class MissionEditViewController: BaseViewController { +final class MissionEditViewController: BaseViewController, BaseViewControllerType { // MARK: - property @@ -77,18 +77,14 @@ final class MissionEditViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() + self.baseViewDidLoad() self.setupGesture() self.setupNotificationCenter() } - // MARK: - override + // MARK: - base func - override func configureUI() { - super.configureUI() - self.view.backgroundColor = .darkGrey001.withAlphaComponent(0.5) - } - - override func setupLayout() { + func setupLayout() { self.view.addSubview(self.backgroundView) self.backgroundView.snp.makeConstraints { $0.leading.trailing.equalToSuperview() @@ -109,7 +105,11 @@ final class MissionEditViewController: BaseViewController { $0.trailing.equalTo(self.missionTextField.snp.trailing) } } - + + func configureUI() { + self.view.backgroundColor = .darkGrey001.withAlphaComponent(0.5) + } + // MARK: - func func setDelegate(_ delegate: DetailingViewController) { diff --git a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift index e4cb129cf..9f1097be5 100644 --- a/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift +++ b/Manito/Manito/Screens/Detail-Ing/View/DetailingView.swift @@ -22,7 +22,7 @@ protocol DetailingDelegate: AnyObject { func didNotShowManitteeView(manitteeName: String) } -final class DetailingView: UIView { +final class DetailingView: UIView, BaseViewType { enum RoomType: String { case PROCESSING @@ -231,7 +231,7 @@ final class DetailingView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setupLayout() + self.baseInit() } @available(*, unavailable) @@ -239,9 +239,9 @@ final class DetailingView: UIView { fatalError("init(coder:) has not been implemented") } - // MARK: - func + // MARK: - base func - private func setupLayout() { + func setupLayout() { self.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { $0.top.equalToSuperview().offset(100) @@ -405,6 +405,12 @@ final class DetailingView: UIView { $0.width.height.equalTo(44) } } + + func configureUI() { + self.backgroundColor = .backgroundGrey + } + + // MARK: - func func configureDelegation(_ delegate: DetailingDelegate) { self.delegate = delegate diff --git a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift index 10b5755f8..62a47a58a 100644 --- a/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift +++ b/Manito/Manito/Screens/Detail-Wait/DetailEditViewController.swift @@ -48,22 +48,20 @@ final class DetailEditViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() + self.setupPresentationController() self.configureDelegation() self.setupCalendarDateRange() if self.editMode == .information { self.setupMemberSliderValue() } } - - // MARK: - override - - override func configureUI() { - super.configureUI() + + // MARK: - func + + private func setupPresentationController() { self.presentationController?.delegate = self self.isModalInPresentation = true } - - // MARK: - func private func configureDelegation() { self.detailEditView.configureDelegation(self) diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift index 5aaafbe76..86282cdae 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailEditView.swift @@ -14,7 +14,7 @@ protocol DetailEditDelegate: AnyObject { func changeButtonDidTap(capacity: Int, from startDate: String, to endDate: String) } -final class DetailEditView: UIView { +final class DetailEditView: UIView, BaseViewType { enum EditMode { case date @@ -120,9 +120,7 @@ final class DetailEditView: UIView { init(editMode: EditMode) { self.editMode = editMode super.init(frame: .zero) - self.setupLayout() - self.setupCancleButton() - self.setupChangeButton() + self.baseInit() } @available(*, unavailable) @@ -130,9 +128,9 @@ final class DetailEditView: UIView { fatalError("init(coder:) has not been implemented") } - // MARK: - func + // MARK: - base func - private func setupLayout() { + func setupLayout() { self.addSubview(self.cancelButton) self.cancelButton.snp.makeConstraints { $0.top.equalToSuperview().inset(24) @@ -185,7 +183,15 @@ final class DetailEditView: UIView { self.setupMemberSlider() } } - + + func configureUI() { + self.backgroundColor = .backgroundGrey + self.setupCancleButton() + self.setupChangeButton() + } + + // MARK: - func + private func setupEditMembersLayout() { self.addSubview(self.numberOfParticipantsTitleLabel) self.numberOfParticipantsTitleLabel.snp.makeConstraints { diff --git a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift index 29755b35d..8eb4fd310 100644 --- a/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift +++ b/Manito/Manito/Screens/Detail-Wait/View/DetailWaitView.swift @@ -10,7 +10,7 @@ import UIKit import SnapKit -final class DetailWaitView: UIView { +final class DetailWaitView: UIView, BaseViewType { private enum UserStatus { case admin case member @@ -95,7 +95,7 @@ final class DetailWaitView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setupLayout() + self.baseInit() } @available(*, unavailable) @@ -103,9 +103,9 @@ final class DetailWaitView: UIView { fatalError("init(coder:) has not been implemented") } - // MARK: - func + // MARK: - base func - private func setupLayout() { + func setupLayout() { self.addSubview(self.titleView) self.titleView.snp.makeConstraints { $0.leading.trailing.equalToSuperview().inset(Size.leadingTrailingPadding) @@ -153,7 +153,13 @@ final class DetailWaitView: UIView { $0.height.equalTo(60) } } - + + func configureUI() { + self.backgroundColor = .backgroundGrey + } + + // MARK: - func + private func setupTitleViewData(title: String, state: String, dateRange: String) { self.titleView.setStartState(state: state) self.titleView.setupLabelData(title: title, dateRange: dateRange) diff --git a/Manito/Manito/Screens/Interaction/SelectManitteeViewController.swift b/Manito/Manito/Screens/Interaction/SelectManitteeViewController.swift index 1ce737376..cf0e5ddc9 100644 --- a/Manito/Manito/Screens/Interaction/SelectManitteeViewController.swift +++ b/Manito/Manito/Screens/Interaction/SelectManitteeViewController.swift @@ -48,18 +48,16 @@ final class SelectManitteeViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() + self.setupStepType() self.configureDelegation() } - // MARK: - override + // MARK: - func - override func configureUI() { - super.configureUI() + private func setupStepType() { self.stepType = .showJoystick } - // MARK: - func - private func configureDelegation() { self.selectManitteeView.configureDelegation(self) } diff --git a/Manito/Manito/Screens/Interaction/View/OpenManittoView.swift b/Manito/Manito/Screens/Interaction/View/OpenManittoView.swift index f4714eb8c..fe7fad7af 100644 --- a/Manito/Manito/Screens/Interaction/View/OpenManittoView.swift +++ b/Manito/Manito/Screens/Interaction/View/OpenManittoView.swift @@ -13,7 +13,7 @@ protocol OpenManittoViewDelegate: AnyObject { func confirmButtonTapped() } -final class OpenManittoView: UIView { +final class OpenManittoView: UIView, BaseViewType { private enum InternalSize { static let collectionHorizontalSpacing: CGFloat = 29.0 @@ -69,7 +69,7 @@ final class OpenManittoView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setupLayout() + self.baseInit() } @available(*, unavailable) @@ -77,9 +77,9 @@ final class OpenManittoView: UIView { fatalError("init(coder:) has not been implemented") } - // MARK: - func + // MARK: - base func - private func setupLayout() { + func setupLayout() { self.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { $0.top.equalTo(self.safeAreaLayoutGuide).inset(57) @@ -98,6 +98,12 @@ final class OpenManittoView: UIView { } } + func configureUI() { + self.backgroundColor = .backgroundGrey + } + + // MARK: - func + private func animateManittoCollectionView(with friendList: FriendListDTO, _ manittoIndex: Int, _ manittoNickname: String) { diff --git a/Manito/Manito/Screens/Interaction/View/SelectManitteeView.swift b/Manito/Manito/Screens/Interaction/View/SelectManitteeView.swift index f54833ff0..b4c909de3 100644 --- a/Manito/Manito/Screens/Interaction/View/SelectManitteeView.swift +++ b/Manito/Manito/Screens/Interaction/View/SelectManitteeView.swift @@ -15,7 +15,7 @@ protocol SelectManitteeViewDelegate: AnyObject { func moveToNextStep() } -final class SelectManitteeView: UIView { +final class SelectManitteeView: UIView, BaseViewType { // MARK: - ui component @@ -51,7 +51,7 @@ final class SelectManitteeView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setupLayout() + self.baseInit() self.setupButtonAction() self.setupSwipeGesture() } @@ -63,7 +63,7 @@ final class SelectManitteeView: UIView { // MARK: - func - private func setupLayout() { + func setupLayout() { self.addSubview(self.joystickBackgroundView) self.joystickBackgroundView.snp.makeConstraints { $0.edges.equalTo(self.safeAreaLayoutGuide) @@ -103,6 +103,12 @@ final class SelectManitteeView: UIView { } } + func configureUI() { + self.backgroundColor = .backgroundGrey + } + + // MARK: - func + private func setupButtonAction() { let confirmAction = UIAction { [weak self] _ in self?.delegate?.confirmButtonDidTap() diff --git a/Manito/Manito/Screens/InvitedCode/InvitedCodeViewController.swift b/Manito/Manito/Screens/InvitedCode/InvitedCodeViewController.swift index 256368dd7..205fdd438 100644 --- a/Manito/Manito/Screens/InvitedCode/InvitedCodeViewController.swift +++ b/Manito/Manito/Screens/InvitedCode/InvitedCodeViewController.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -class InvitedCodeViewController: BaseViewController { +class InvitedCodeViewController: BaseViewController, BaseViewControllerType { var roomInfo: RoomListItemDTO var code: String @@ -101,9 +101,16 @@ class InvitedCodeViewController: BaseViewController { print("\(#file) is dead") } - // MARK: - configure + // MARK: - life cycle + + override func viewDidLoad() { + super.viewDidLoad() + self.baseViewDidLoad() + } + + // MARK: - base func - override func setupLayout() { + func setupLayout() { view.addSubview(invitedImageView) invitedImageView.snp.makeConstraints { $0.top.equalTo(view.safeAreaLayoutGuide).inset(142) @@ -153,7 +160,7 @@ class InvitedCodeViewController: BaseViewController { } } - override func configureUI() { - view.backgroundColor = .black.withAlphaComponent(0.8) + func configureUI() { + self.view.backgroundColor = .black.withAlphaComponent(0.8) } } diff --git a/Manito/Manito/Screens/Letter/Views/ViewControllers/CreateLetterViewController.swift b/Manito/Manito/Screens/Letter/Views/ViewControllers/CreateLetterViewController.swift index b62618a35..0737f9f19 100644 --- a/Manito/Manito/Screens/Letter/Views/ViewControllers/CreateLetterViewController.swift +++ b/Manito/Manito/Screens/Letter/Views/ViewControllers/CreateLetterViewController.swift @@ -52,20 +52,18 @@ final class CreateLetterViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() + self.configureUI() self.configureDelegation() self.configureNavigationController() } - // MARK: - override + // MARK: - func - override func configureUI() { - super.configureUI() + private func configureUI() { self.createLetterView.configureMission(self.mission) self.createLetterView.configureViewController(self) } - // MARK: - func - private func configureDelegation() { self.createLetterView.configureDelegation(self) } diff --git a/Manito/Manito/Screens/Letter/Views/Views/CreateLetterView.swift b/Manito/Manito/Screens/Letter/Views/Views/CreateLetterView.swift index 46cb0819c..9ed930f0e 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/CreateLetterView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/CreateLetterView.swift @@ -15,7 +15,7 @@ protocol CreateLetterViewDelegate: AnyObject { func sendLetterToManittee(with content: String?, _ image: UIImage?) } -final class CreateLetterView: UIView { +final class CreateLetterView: UIView, BaseViewType { // MARK: - ui component @@ -73,7 +73,7 @@ final class CreateLetterView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setupLayout() + self.baseInit() self.setupButtonAction() self.observeSendButtonEnabledState() } @@ -83,9 +83,9 @@ final class CreateLetterView: UIView { fatalError("init(coder:) has not been implemented") } - // MARK: - func + // MARK: - base func - private func setupLayout() { + func setupLayout() { self.addSubview(self.indicatorView) self.indicatorView.snp.makeConstraints { $0.top.equalToSuperview().inset(9) @@ -127,6 +127,12 @@ final class CreateLetterView: UIView { } } + func configureUI() { + self.backgroundColor = .backgroundGrey + } + + // MARK: - func + private func setupButtonAction() { let cancelAction = UIAction { [weak self] _ in self?.presentationControllerDidAttemptToDismiss() diff --git a/Manito/Manito/Screens/Letter/Views/Views/LetterImageView.swift b/Manito/Manito/Screens/Letter/Views/Views/LetterImageView.swift index cddd851b5..5cbbd2fa6 100644 --- a/Manito/Manito/Screens/Letter/Views/Views/LetterImageView.swift +++ b/Manito/Manito/Screens/Letter/Views/Views/LetterImageView.swift @@ -14,7 +14,7 @@ protocol LetterImageViewDelegate: AnyObject { func closeButtonTapped() } -final class LetterImageView: UIView { +final class LetterImageView: UIView, BaseViewType { // MARK: - ui component @@ -56,7 +56,7 @@ final class LetterImageView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setupLayout() + self.baseInit() self.setupAction() self.setupImagePinchGesture() } @@ -66,9 +66,9 @@ final class LetterImageView: UIView { fatalError("init(coder:) has not been implemented") } - // MARK: - func + // MARK: - base func - private func setupLayout() { + func setupLayout() { self.addSubview(self.scrollView) self.scrollView.addSubview(self.imageView) @@ -86,6 +86,12 @@ final class LetterImageView: UIView { } } + func configureUI() { + self.backgroundColor = .backgroundGrey + } + + // MARK: - func + private func setupAction() { let downloadAction = UIAction { [weak self] _ in let downloadImage = self?.imageView.image diff --git a/Manito/Manito/Screens/Login/LoginViewController.swift b/Manito/Manito/Screens/Login/LoginViewController.swift index b9a2a68b5..0771e224f 100644 --- a/Manito/Manito/Screens/Login/LoginViewController.swift +++ b/Manito/Manito/Screens/Login/LoginViewController.swift @@ -10,7 +10,7 @@ import UIKit import SnapKit -final class LoginViewController: BaseViewController { +final class LoginViewController: BaseViewController, BaseViewControllerType { // MARK: - ui component @@ -36,13 +36,14 @@ final class LoginViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() + self.baseViewDidLoad() self.setupLoginButton() self.configureNavigationBar() } - // MARK: - override + // MARK: - base func - override func setupLayout() { + func setupLayout() { self.view.addSubview(self.logoImageView) self.logoImageView.snp.makeConstraints { $0.centerX.equalToSuperview() @@ -64,6 +65,10 @@ final class LoginViewController: BaseViewController { $0.bottom.equalTo(self.view.safeAreaLayoutGuide).inset(35) } } + + func configureUI() { + self.view.backgroundColor = .backgroundGrey + } // MARK: - func diff --git a/Manito/Manito/Screens/Main/MainViewController.swift b/Manito/Manito/Screens/Main/MainViewController.swift index b87e0a578..e1f289ded 100644 --- a/Manito/Manito/Screens/Main/MainViewController.swift +++ b/Manito/Manito/Screens/Main/MainViewController.swift @@ -11,7 +11,7 @@ import Gifu import SkeletonView import SnapKit -final class MainViewController: BaseViewController { +final class MainViewController: BaseViewController, BaseViewControllerType { private enum InternalSize { static let collectionHorizontalSpacing: CGFloat = 20 @@ -111,6 +111,7 @@ final class MainViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() + self.baseViewDidLoad() self.setupGifImage() self.setupRefreshControl() self.setupSkeletonView() @@ -122,9 +123,9 @@ final class MainViewController: BaseViewController { self.requestManittoRoomList() } - // MARK: - override + // MARK: - base func - override func setupLayout() { + func setupLayout() { self.view.addSubview(self.backgroundImageView) self.backgroundImageView.snp.makeConstraints { $0.edges.equalToSuperview() @@ -184,6 +185,12 @@ final class MainViewController: BaseViewController { self.guideView.setupGuideViewLayout() } + func configureUI() { + self.view.backgroundColor = .backgroundGrey + } + + // MARK: - override + override func setupNavigationBar() { super.setupNavigationBar() diff --git a/Manito/Manito/Screens/NickName/View/NicknameView.swift b/Manito/Manito/Screens/NickName/View/NicknameView.swift index 9a65f5e23..9733244b2 100644 --- a/Manito/Manito/Screens/NickName/View/NicknameView.swift +++ b/Manito/Manito/Screens/NickName/View/NicknameView.swift @@ -10,7 +10,7 @@ import UIKit import SnapKit -final class NicknameView: UIView { +final class NicknameView: UIView, BaseViewType { // MARK: - ui components @@ -64,7 +64,7 @@ final class NicknameView: UIView { init(title: String) { self.title = title super.init(frame: .zero) - self.setupLayout() + self.baseInit() self.setupNotificationCenter() } @@ -73,9 +73,9 @@ final class NicknameView: UIView { fatalError("init(coder:) has not been implemented") } - // MARK: - func + // MARK: - base func - private func setupLayout() { + func setupLayout() { self.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { $0.top.equalTo(self.safeAreaLayoutGuide).inset(20) @@ -101,6 +101,12 @@ final class NicknameView: UIView { $0.centerX.equalToSuperview() } } + + func configureUI() { + self.backgroundColor = .backgroundGrey + } + + // MARK: - func private func setupNotificationCenter() { NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil) diff --git a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift index b12dc23ab..cff222b5c 100644 --- a/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift +++ b/Manito/Manito/Screens/ParticipateRoom/ParticipateRoomView.swift @@ -15,7 +15,7 @@ protocol ParticipateRoomViewDelegate: AnyObject { func observeNextNotification(roomId: Int) } -final class ParticipateRoomView: UIView { +final class ParticipateRoomView: UIView, BaseViewType { // MARK: - ui component @@ -46,7 +46,7 @@ final class ParticipateRoomView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setupLayout() + self.baseInit() self.setupButtonAction() self.setupNotificationCenter() self.detectNextButtonStatus() @@ -57,9 +57,9 @@ final class ParticipateRoomView: UIView { fatalError("init(coder:) has not been implemented") } - // MARK: - func + // MARK: - base func - private func setupLayout() { + func setupLayout() { self.addSubview(self.titleLabel) self.titleLabel.snp.makeConstraints { $0.top.equalTo(self.safeAreaLayoutGuide).inset(20) @@ -82,6 +82,12 @@ final class ParticipateRoomView: UIView { self.bringSubviewToFront(self.nextButton) } + + func configureUI() { + self.backgroundColor = .backgroundGrey + } + + // MARK: - func private func setupButtonAction() { let didTapCloseButton = UIAction { [weak self] _ in diff --git a/Manito/Manito/Screens/Setting/View/SettingView.swift b/Manito/Manito/Screens/Setting/View/SettingView.swift index b94d105d2..3c6cfc000 100644 --- a/Manito/Manito/Screens/Setting/View/SettingView.swift +++ b/Manito/Manito/Screens/Setting/View/SettingView.swift @@ -20,7 +20,7 @@ protocol SettingViewDelegate: AnyObject { func withdrawalButtonDidTap() } -final class SettingView: UIView { +final class SettingView: UIView, BaseViewType { struct Option { let title: String @@ -61,7 +61,7 @@ final class SettingView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.setupLayout() + self.baseInit() self.setupButtonAction() self.configureModels() } @@ -71,9 +71,9 @@ final class SettingView: UIView { fatalError("init(coder:) has not been implemented") } - // MARK: - func + // MARK: - base func - private func setupLayout() { + func setupLayout() { self.addSubview(self.imageRow) self.imageRow.snp.makeConstraints { $0.top.equalTo(self.safeAreaLayoutGuide) @@ -95,6 +95,12 @@ final class SettingView: UIView { $0.centerX.equalToSuperview() } } + + func configureUI() { + self.backgroundColor = .backgroundGrey + } + + // MARK: - func private func setupButtonAction() { let withdrawalButtonDidTap = UIAction { [weak self] _ in diff --git a/Manito/Manito/Screens/SettingDeveloperInfo/SettingDeveloperInfoViewController.swift b/Manito/Manito/Screens/SettingDeveloperInfo/SettingDeveloperInfoViewController.swift index a37ded00b..48edd106c 100644 --- a/Manito/Manito/Screens/SettingDeveloperInfo/SettingDeveloperInfoViewController.swift +++ b/Manito/Manito/Screens/SettingDeveloperInfo/SettingDeveloperInfoViewController.swift @@ -9,7 +9,7 @@ import UIKit import SnapKit -final class SettingDeveloperInfoViewController: BaseViewController { +final class SettingDeveloperInfoViewController: BaseViewController, BaseViewControllerType { // 개발자 정보 데이터 private let developerData: [[String: Any]] = [ @@ -102,24 +102,39 @@ final class SettingDeveloperInfoViewController: BaseViewController { } // MARK: - life cycle + + override func viewDidLoad() { + super.viewDidLoad() + self.baseViewDidLoad() + } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) setupLargeTitle() } - override func setupLayout() { + // MARK: - override + + override func setupNavigationBar() { + super.setupNavigationBar() + title = TextLiteral.settingDeveloperInfoTitle + } + + // MARK: - base func + + func setupLayout() { view.addSubview(listCollectionView) listCollectionView.snp.makeConstraints { $0.top.equalTo(view.safeAreaLayoutGuide).offset(30) $0.leading.trailing.bottom.equalToSuperview() } } - - override func setupNavigationBar() { - super.setupNavigationBar() - title = TextLiteral.settingDeveloperInfoTitle + + func configureUI() { + self.view.backgroundColor = .backgroundGrey } + + // MARK: - func private func setupLargeTitle() { navigationController?.navigationBar.prefersLargeTitles = true diff --git a/Manito/Manito/Screens/Splash/SplashViewController.swift b/Manito/Manito/Screens/Splash/SplashViewController.swift index 9a7c18aa3..78bbb7f9c 100644 --- a/Manito/Manito/Screens/Splash/SplashViewController.swift +++ b/Manito/Manito/Screens/Splash/SplashViewController.swift @@ -9,7 +9,7 @@ import UIKit import Gifu -final class SplashViewController: UIViewController { +final class SplashViewController: UIViewController, BaseViewControllerType { // MARK: - ui component @@ -31,17 +31,23 @@ final class SplashViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - self.configureUI() + self.baseViewDidLoad() self.setupGifImage() self.presentViewControllerAfterDelay() } - // MARK: - func + // MARK: - base func + + func setupLayout() { + // FIXME: - 스토리보드를 코드 베이스로 바꿔야 하는 화면입니다. + } - private func configureUI() { + func configureUI() { self.view.backgroundColor = .backgroundGrey } + // MARK: - func + private func presentLoginViewConroller() { let viewController = LoginViewController() let navigtionViewController = UINavigationController(rootViewController: viewController) From 5fe9e257419925e9af5e1609e9e37386c98f159a Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 6 Sep 2023 17:46:25 +0900 Subject: [PATCH 455/468] =?UTF-8?q?[FEAT]=20=EC=84=A4=EB=AA=85=20=EC=A3=BC?= =?UTF-8?q?=EC=84=9D=20=EC=B6=94=EA=B0=80(#513)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Presentation/Common/Base/BaseViewType.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Manito/Manito/Presentation/Common/Base/BaseViewType.swift b/Manito/Manito/Presentation/Common/Base/BaseViewType.swift index 04dc31949..cec2b9a8c 100644 --- a/Manito/Manito/Presentation/Common/Base/BaseViewType.swift +++ b/Manito/Manito/Presentation/Common/Base/BaseViewType.swift @@ -17,6 +17,7 @@ protocol BaseViewType: UIView { } extension BaseViewType { + /// 기본적인 메서드를 한 번에 호출하는 메서드 func baseInit() { self.setupLayout() self.configureUI() From 5853b1ffb4f1bde086715935d829a32c312de332 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 6 Sep 2023 19:12:28 +0900 Subject: [PATCH 456/468] =?UTF-8?q?[MOVE]=20./Global/Utils=20=EB=82=B4?= =?UTF-8?q?=EB=B6=80=20=ED=8C=8C=EC=9D=BC=20=EC=9D=B4=EB=8F=99(#516)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 54 +++++++++++++++---- .../xcshareddata/swiftpm/Package.resolved | 16 +++--- .../ImageCacheManager.swift | 0 .../Extension/UI}/UIImageView+Cache.swift | 0 .../Utils => Util/Logger}/Logger.swift | 0 5 files changed, 51 insertions(+), 19 deletions(-) rename Manito/Manito/{Global/Utils => Service/ImageCacheManager}/ImageCacheManager.swift (100%) rename Manito/Manito/{Global/Utils => Util/Extension/UI}/UIImageView+Cache.swift (100%) rename Manito/Manito/{Global/Utils => Util/Logger}/Logger.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 5516e2227..ab31b26c5 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -626,6 +626,7 @@ B53A35B22A9630FE00B720BC /* Service */ = { isa = PBXGroup; children = ( + B5C7FC032AA8876700862021 /* ImageCacheManager */, B53A35B32A96310700B720BC /* UserDefaultService */, ); path = Service; @@ -920,6 +921,47 @@ path = ViewControllers; sourceTree = ""; }; + B5C7FC022AA886F300862021 /* Util */ = { + isa = PBXGroup; + children = ( + B5C7FC042AA887A400862021 /* Logger */, + B5C7FC052AA887CC00862021 /* Extension */, + ); + path = Util; + sourceTree = ""; + }; + B5C7FC032AA8876700862021 /* ImageCacheManager */ = { + isa = PBXGroup; + children = ( + B5FEE9DA28C8498A00DEA07E /* ImageCacheManager.swift */, + ); + path = ImageCacheManager; + sourceTree = ""; + }; + B5C7FC042AA887A400862021 /* Logger */ = { + isa = PBXGroup; + children = ( + B5F525282851A2A400614FF7 /* Logger.swift */, + ); + path = Logger; + sourceTree = ""; + }; + B5C7FC052AA887CC00862021 /* Extension */ = { + isa = PBXGroup; + children = ( + B5C7FC062AA887E100862021 /* UI */, + ); + path = Extension; + sourceTree = ""; + }; + B5C7FC062AA887E100862021 /* UI */ = { + isa = PBXGroup; + children = ( + B5FEE9DC28C849B400DEA07E /* UIImageView+Cache.swift */, + ); + path = UI; + sourceTree = ""; + }; B5F524C228519AA000614FF7 = { isa = PBXGroup; children = ( @@ -951,6 +993,7 @@ B53A35B82A9640EB00B720BC /* Data */, B5F524E328519AC300614FF7 /* Screens */, B5F524E428519AC600614FF7 /* Global */, + B5C7FC022AA886F300862021 /* Util */, B53A35B22A9630FE00B720BC /* Service */, ); path = Manito; @@ -982,7 +1025,6 @@ isa = PBXGroup; children = ( B54741E529A4945100B75BA3 /* Error */, - B5F525272851A29C00614FF7 /* Utils */, B5F524F828519BC700614FF7 /* Literal */, B5F524F728519BC400614FF7 /* Base */, B5F524F628519BC000614FF7 /* Protocol */, @@ -1156,16 +1198,6 @@ path = Fonts; sourceTree = ""; }; - B5F525272851A29C00614FF7 /* Utils */ = { - isa = PBXGroup; - children = ( - B5F525282851A2A400614FF7 /* Logger.swift */, - B5FEE9DA28C8498A00DEA07E /* ImageCacheManager.swift */, - B5FEE9DC28C849B400DEA07E /* UIImageView+Cache.swift */, - ); - path = Utils; - sourceTree = ""; - }; B5F5253328547EE000614FF7 /* UIComponents */ = { isa = PBXGroup; children = ( diff --git a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a3ff76c5d..a5da03197 100644 --- a/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Manito/Manito.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -59,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleDataTransport.git", "state" : { - "revision" : "f6b558e3f801f2cac336b04f615ce111fa9ddaa0", - "version" : "9.2.1" + "revision" : "aae45a320fd0d11811820335b1eabc8753902a40", + "version" : "9.2.5" } }, { @@ -68,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleUtilities.git", "state" : { - "revision" : "0543562f85620b5b7c510c6bcbef75b562a5127b", - "version" : "7.11.0" + "revision" : "c38ce365d77b04a9a300c31061c5227589e5597b", + "version" : "7.11.5" } }, { @@ -113,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/promises.git", "state" : { - "revision" : "ec957ccddbcc710ccc64c9dcbd4c7006fcf8b73a", - "version" : "2.2.0" + "revision" : "e70e889c0196c76d22759eb50d6a0270ca9f1d9e", + "version" : "2.3.1" } }, { @@ -140,8 +140,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "0af9125c4eae12a4973fb66574c53a54962a9e1e", - "version" : "1.21.0" + "revision" : "cf62cdaea48b77f1a631e5cb3aeda6047c2cba1d", + "version" : "1.23.0" } } ], diff --git a/Manito/Manito/Global/Utils/ImageCacheManager.swift b/Manito/Manito/Service/ImageCacheManager/ImageCacheManager.swift similarity index 100% rename from Manito/Manito/Global/Utils/ImageCacheManager.swift rename to Manito/Manito/Service/ImageCacheManager/ImageCacheManager.swift diff --git a/Manito/Manito/Global/Utils/UIImageView+Cache.swift b/Manito/Manito/Util/Extension/UI/UIImageView+Cache.swift similarity index 100% rename from Manito/Manito/Global/Utils/UIImageView+Cache.swift rename to Manito/Manito/Util/Extension/UI/UIImageView+Cache.swift diff --git a/Manito/Manito/Global/Utils/Logger.swift b/Manito/Manito/Util/Logger/Logger.swift similarity index 100% rename from Manito/Manito/Global/Utils/Logger.swift rename to Manito/Manito/Util/Logger/Logger.swift From 08ccd508cb55de1624a9fd37039461546b37fb24 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 6 Sep 2023 19:15:26 +0900 Subject: [PATCH 457/468] =?UTF-8?q?[CHORE]=20ViewModelType=20=EB=84=A4?= =?UTF-8?q?=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD(#513)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 8 ++++---- .../{ViewModelType.swift => BaseViewModelType.swift} | 4 ++-- .../LetterScene/ViewController/LetterViewController.swift | 4 ++-- .../Scene/LetterScene/ViewModel/LetterViewModel.swift | 2 +- .../CreateRoom/ViewModel/CreateRoomViewModel.swift | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) rename Manito/Manito/Global/Protocol/{ViewModelType.swift => BaseViewModelType.swift} (76%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 30d2e2294..f2604416f 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -112,7 +112,7 @@ B5AE11F429D32EE700F86FF8 /* SelectManitteeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */; }; B5B3C15D2A41D6EB00AABD6F /* LetterViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C15C2A41D6EB00AABD6F /* LetterViewModel.swift */; }; B5B3C15F2A41D6F400AABD6F /* LetterUsecase.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C15E2A41D6F400AABD6F /* LetterUsecase.swift */; }; - B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */; }; + B5B3C1612A41D79E00AABD6F /* BaseViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1602A41D79E00AABD6F /* BaseViewModelType.swift */; }; B5B3C1652A427B5800AABD6F /* UIControl+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */; }; B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */; }; B5C7FBED2AA7607300862021 /* BaseViewType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C7FBEC2AA7607300862021 /* BaseViewType.swift */; }; @@ -322,7 +322,7 @@ B5AE11F329D32EE700F86FF8 /* SelectManitteeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeView.swift; sourceTree = ""; }; B5B3C15C2A41D6EB00AABD6F /* LetterViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterViewModel.swift; sourceTree = ""; }; B5B3C15E2A41D6F400AABD6F /* LetterUsecase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterUsecase.swift; sourceTree = ""; }; - B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModelType.swift; sourceTree = ""; }; + B5B3C1602A41D79E00AABD6F /* BaseViewModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseViewModelType.swift; sourceTree = ""; }; B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Combine.swift"; sourceTree = ""; }; B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Combine.swift"; sourceTree = ""; }; B5C7FBEC2AA7607300862021 /* BaseViewType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseViewType.swift; sourceTree = ""; }; @@ -1131,7 +1131,7 @@ B5F524F628519BC000614FF7 /* Protocol */ = { isa = PBXGroup; children = ( - B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */, + B5B3C1602A41D79E00AABD6F /* BaseViewModelType.swift */, ); path = Protocol; sourceTree = ""; @@ -1666,7 +1666,7 @@ B5A086022A974B8100C8A98D /* RoomListItem.swift in Sources */, B53A35CC2A96F99D00B720BC /* SettingRepository.swift in Sources */, B50CEEC02A6FF82600CF1C76 /* Publisher+Extension.swift in Sources */, - B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */, + B5B3C1612A41D79E00AABD6F /* BaseViewModelType.swift in Sources */, B53A35C02A96F21A00B720BC /* MainRepository.swift in Sources */, D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */, B5A085EA2A97309900C8A98D /* MessageListItem.swift in Sources */, diff --git a/Manito/Manito/Global/Protocol/ViewModelType.swift b/Manito/Manito/Global/Protocol/BaseViewModelType.swift similarity index 76% rename from Manito/Manito/Global/Protocol/ViewModelType.swift rename to Manito/Manito/Global/Protocol/BaseViewModelType.swift index 47c81c490..353c98050 100644 --- a/Manito/Manito/Global/Protocol/ViewModelType.swift +++ b/Manito/Manito/Global/Protocol/BaseViewModelType.swift @@ -1,5 +1,5 @@ // -// ViewModelType.swift +// BaseViewModelType.swift // Manito // // Created by SHIN YOON AH on 2023/06/20. @@ -7,7 +7,7 @@ import Foundation -protocol ViewModelType { +protocol BaseViewModelType { associatedtype Input associatedtype Output diff --git a/Manito/Manito/Presentation/Scene/LetterScene/ViewController/LetterViewController.swift b/Manito/Manito/Presentation/Scene/LetterScene/ViewController/LetterViewController.swift index 411c8a0dd..a80e7b456 100644 --- a/Manito/Manito/Presentation/Scene/LetterScene/ViewController/LetterViewController.swift +++ b/Manito/Manito/Presentation/Scene/LetterScene/ViewController/LetterViewController.swift @@ -31,11 +31,11 @@ final class LetterViewController: BaseViewController { private var viewModelOutput: LetterViewModel.Output? - private let viewModel: any ViewModelType + private let viewModel: any BaseViewModelType // MARK: - init - init(viewModel: any ViewModelType) { + init(viewModel: any BaseViewModelType) { self.viewModel = viewModel super.init() } diff --git a/Manito/Manito/Presentation/Scene/LetterScene/ViewModel/LetterViewModel.swift b/Manito/Manito/Presentation/Scene/LetterScene/ViewModel/LetterViewModel.swift index f1d5f103d..177be8c81 100644 --- a/Manito/Manito/Presentation/Scene/LetterScene/ViewModel/LetterViewModel.swift +++ b/Manito/Manito/Presentation/Scene/LetterScene/ViewModel/LetterViewModel.swift @@ -8,7 +8,7 @@ import Combine import Foundation -final class LetterViewModel: ViewModelType { +final class LetterViewModel: BaseViewModelType { typealias MessageDetails = (roomId: String, mission: String, missionId: String, manitteeId: String) typealias ReportDetails = (nickname: String, content: String) diff --git a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift index 97fddb4b8..e26cb01c0 100644 --- a/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift +++ b/Manito/Manito/Screens/CreateRoom/ViewModel/CreateRoomViewModel.swift @@ -8,7 +8,7 @@ import Combine import Foundation -final class CreateRoomViewModel: ViewModelType { +final class CreateRoomViewModel: BaseViewModelType { typealias CurrentNextStep = (current: CreateRoomStep, next: CreateRoomStep) From eb7c29d9b9b3f652946bf6812005e066996acbac Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 6 Sep 2023 19:16:42 +0900 Subject: [PATCH 458/468] =?UTF-8?q?[MOVE]=20BaseViewModelType=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=EB=A5=BC=20Common/Base=20=ED=95=98=EC=9C=84=EB=A1=9C?= =?UTF-8?q?=20=EC=9D=B4=EB=8F=99(#513)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 10 +--------- .../Common/Base}/BaseViewModelType.swift | 0 2 files changed, 1 insertion(+), 9 deletions(-) rename Manito/Manito/{Global/Protocol => Presentation/Common/Base}/BaseViewModelType.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index f2604416f..3846daf6a 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -938,6 +938,7 @@ B5F525192851A12600614FF7 /* BaseViewController.swift */, B5C7FBEC2AA7607300862021 /* BaseViewType.swift */, B5C7FBF42AA859E300862021 /* BaseViewControllerType.swift */, + B5B3C1602A41D79E00AABD6F /* BaseViewModelType.swift */, ); path = Base; sourceTree = ""; @@ -1006,7 +1007,6 @@ B54741E529A4945100B75BA3 /* Error */, B5F525272851A29C00614FF7 /* Utils */, B5F524F828519BC700614FF7 /* Literal */, - B5F524F628519BC000614FF7 /* Protocol */, B5F524F428519BB500614FF7 /* Extension */, B5F524F328519BB100614FF7 /* UIComponent */, B5F524F228519BA700614FF7 /* Resource */, @@ -1128,14 +1128,6 @@ path = Extension; sourceTree = ""; }; - B5F524F628519BC000614FF7 /* Protocol */ = { - isa = PBXGroup; - children = ( - B5B3C1602A41D79E00AABD6F /* BaseViewModelType.swift */, - ); - path = Protocol; - sourceTree = ""; - }; B5F524F828519BC700614FF7 /* Literal */ = { isa = PBXGroup; children = ( diff --git a/Manito/Manito/Global/Protocol/BaseViewModelType.swift b/Manito/Manito/Presentation/Common/Base/BaseViewModelType.swift similarity index 100% rename from Manito/Manito/Global/Protocol/BaseViewModelType.swift rename to Manito/Manito/Presentation/Common/Base/BaseViewModelType.swift From ded0aca2babf4953eed0587ffdef6807eec4f3ca Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 6 Sep 2023 19:21:03 +0900 Subject: [PATCH 459/468] =?UTF-8?q?[MOVE]=20Literal=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=EC=9D=84=20Util=20=EB=82=B4=EB=B6=80=EB=A1=9C=20=EC=9D=B4?= =?UTF-8?q?=EB=8F=99(#516)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 26 +++++++++---------- .../{Global => Util}/Literal/Character.swift | 0 .../Literal/ImageLiteral.swift | 0 .../{Global => Util}/Literal/Size.swift | 0 .../Literal/TextLiteral.swift | 0 .../{Global => Util}/Literal/URLLiteral.swift | 0 6 files changed, 13 insertions(+), 13 deletions(-) rename Manito/Manito/{Global => Util}/Literal/Character.swift (100%) rename Manito/Manito/{Global => Util}/Literal/ImageLiteral.swift (100%) rename Manito/Manito/{Global => Util}/Literal/Size.swift (100%) rename Manito/Manito/{Global => Util}/Literal/TextLiteral.swift (100%) rename Manito/Manito/{Global => Util}/Literal/URLLiteral.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index ab31b26c5..0925292ac 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -926,6 +926,7 @@ children = ( B5C7FC042AA887A400862021 /* Logger */, B5C7FC052AA887CC00862021 /* Extension */, + B5C7FC072AA889BD00862021 /* Literal */, ); path = Util; sourceTree = ""; @@ -962,6 +963,18 @@ path = UI; sourceTree = ""; }; + B5C7FC072AA889BD00862021 /* Literal */ = { + isa = PBXGroup; + children = ( + B5F5250028519EFB00614FF7 /* ImageLiteral.swift */, + 391B3002286198C200421F1D /* Size.swift */, + CB7B23A728C4ECA8004A4CF3 /* Character.swift */, + 7E15F67D28B35B3D00441305 /* TextLiteral.swift */, + D777D2C828C7780E008655BD /* URLLiteral.swift */, + ); + path = Literal; + sourceTree = ""; + }; B5F524C228519AA000614FF7 = { isa = PBXGroup; children = ( @@ -1025,7 +1038,6 @@ isa = PBXGroup; children = ( B54741E529A4945100B75BA3 /* Error */, - B5F524F828519BC700614FF7 /* Literal */, B5F524F728519BC400614FF7 /* Base */, B5F524F628519BC000614FF7 /* Protocol */, B5F524F428519BB500614FF7 /* Extension */, @@ -1167,18 +1179,6 @@ path = Base; sourceTree = ""; }; - B5F524F828519BC700614FF7 /* Literal */ = { - isa = PBXGroup; - children = ( - B5F5250028519EFB00614FF7 /* ImageLiteral.swift */, - 391B3002286198C200421F1D /* Size.swift */, - CB7B23A728C4ECA8004A4CF3 /* Character.swift */, - 7E15F67D28B35B3D00441305 /* TextLiteral.swift */, - D777D2C828C7780E008655BD /* URLLiteral.swift */, - ); - path = Literal; - sourceTree = ""; - }; B5F524F928519BD600614FF7 /* Storyboards */ = { isa = PBXGroup; children = ( diff --git a/Manito/Manito/Global/Literal/Character.swift b/Manito/Manito/Util/Literal/Character.swift similarity index 100% rename from Manito/Manito/Global/Literal/Character.swift rename to Manito/Manito/Util/Literal/Character.swift diff --git a/Manito/Manito/Global/Literal/ImageLiteral.swift b/Manito/Manito/Util/Literal/ImageLiteral.swift similarity index 100% rename from Manito/Manito/Global/Literal/ImageLiteral.swift rename to Manito/Manito/Util/Literal/ImageLiteral.swift diff --git a/Manito/Manito/Global/Literal/Size.swift b/Manito/Manito/Util/Literal/Size.swift similarity index 100% rename from Manito/Manito/Global/Literal/Size.swift rename to Manito/Manito/Util/Literal/Size.swift diff --git a/Manito/Manito/Global/Literal/TextLiteral.swift b/Manito/Manito/Util/Literal/TextLiteral.swift similarity index 100% rename from Manito/Manito/Global/Literal/TextLiteral.swift rename to Manito/Manito/Util/Literal/TextLiteral.swift diff --git a/Manito/Manito/Global/Literal/URLLiteral.swift b/Manito/Manito/Util/Literal/URLLiteral.swift similarity index 100% rename from Manito/Manito/Global/Literal/URLLiteral.swift rename to Manito/Manito/Util/Literal/URLLiteral.swift From 00c765cdfeb2c9b0cd5fc1201a0e8b8da1cedf2c Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 6 Sep 2023 19:45:31 +0900 Subject: [PATCH 460/468] =?UTF-8?q?[MOVE]=20/Global/Extension=20=EB=82=B4?= =?UTF-8?q?=EB=B6=80=20=ED=8C=8C=EC=9D=BC=EB=93=A4=20=EC=9D=B4=EB=8F=99(#5?= =?UTF-8?q?16)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 116 ++++++++++-------- .../Extension/Encodable+Extension.swift | 18 --- .../Extension/UITableView+Extension.swift | 22 ---- .../Extension/Combine/Publisher+Async.swift} | 2 +- .../Combine}/UIControl+Combine.swift | 0 .../Combine}/UIScrollView+Combine.swift | 0 .../Combine}/UIViewController+Combine.swift | 0 .../Extension/Type}/Date+Extension.swift | 0 .../Extension/Type/Int+RandomNumber.swift} | 2 +- .../Extension/Type/NSObject+ClassName.swift} | 2 +- .../Type}/Notification+Extension.swift | 0 .../Extension/Type/String+Date.swift} | 0 .../Extension/UI}/UIColor+Extension.swift | 0 .../Extension/UI}/UIFont+Extension.swift | 0 .../UI/UIView}/UIButton+Extension.swift | 0 .../UIView}/UICollectionView+Extension.swift | 0 .../UI/{ => UIView}/UIImageView+Cache.swift | 0 .../UI/UIView}/UILabel+Extension.swift | 0 .../UI/UIView}/UIView+Extension.swift | 0 .../UIViewController+Alert.swift} | 32 ++--- .../UIViewController+Keyboard.swift | 20 +++ 21 files changed, 102 insertions(+), 112 deletions(-) delete mode 100644 Manito/Manito/Global/Extension/Encodable+Extension.swift delete mode 100644 Manito/Manito/Global/Extension/UITableView+Extension.swift rename Manito/Manito/{Global/Extension/Publisher+Extension.swift => Util/Extension/Combine/Publisher+Async.swift} (98%) rename Manito/Manito/{Global/Extension => Util/Extension/Combine}/UIControl+Combine.swift (100%) rename Manito/Manito/{Global/Extension => Util/Extension/Combine}/UIScrollView+Combine.swift (100%) rename Manito/Manito/{Global/Extension => Util/Extension/Combine}/UIViewController+Combine.swift (100%) rename Manito/Manito/{Global/Extension => Util/Extension/Type}/Date+Extension.swift (100%) rename Manito/Manito/{Global/Extension/Int+Extension.swift => Util/Extension/Type/Int+RandomNumber.swift} (94%) rename Manito/Manito/{Global/Extension/NSObject+Extension.swift => Util/Extension/Type/NSObject+ClassName.swift} (86%) rename Manito/Manito/{Global/Extension => Util/Extension/Type}/Notification+Extension.swift (100%) rename Manito/Manito/{Global/Extension/String+Extension.swift => Util/Extension/Type/String+Date.swift} (100%) rename Manito/Manito/{Global/Extension => Util/Extension/UI}/UIColor+Extension.swift (100%) rename Manito/Manito/{Global/Extension => Util/Extension/UI}/UIFont+Extension.swift (100%) rename Manito/Manito/{Global/Extension => Util/Extension/UI/UIView}/UIButton+Extension.swift (100%) rename Manito/Manito/{Global/Extension => Util/Extension/UI/UIView}/UICollectionView+Extension.swift (100%) rename Manito/Manito/Util/Extension/UI/{ => UIView}/UIImageView+Cache.swift (100%) rename Manito/Manito/{Global/Extension => Util/Extension/UI/UIView}/UILabel+Extension.swift (100%) rename Manito/Manito/{Global/Extension => Util/Extension/UI/UIView}/UIView+Extension.swift (100%) rename Manito/Manito/{Global/Extension/UIViewController+Extension.swift => Util/Extension/UI/UIViewController/UIViewController+Alert.swift} (84%) create mode 100644 Manito/Manito/Util/Extension/UI/UIViewController/UIViewController+Keyboard.swift diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 0925292ac..eb1abd762 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -31,13 +31,12 @@ 399D17AB2856C83B00F50D9D /* DetailEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */; }; 39BDDCC42A52BB4A005E0A71 /* DetailWaitService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39BDDCC32A52BB4A005E0A71 /* DetailWaitService.swift */; }; 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */; }; - 39C957D02879521400A04A2B /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CF2879521400A04A2B /* String+Extension.swift */; }; + 39C957D02879521400A04A2B /* String+Date.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957CF2879521400A04A2B /* String+Date.swift */; }; 39C957D22879523200A04A2B /* Date+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957D12879523200A04A2B /* Date+Extension.swift */; }; 39C957ED287AE4D100A04A2B /* MainEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C957EC287AE4D100A04A2B /* MainEndPoint.swift */; }; 39C95802287DACC300A04A2B /* RoomParticipationEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95801287DACC300A04A2B /* RoomParticipationEndPoint.swift */; }; 39C95804287DAD3000A04A2B /* LetterEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95803287DAD3000A04A2B /* LetterEndPoint.swift */; }; 39C95808287DB05C00A04A2B /* SettingEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95807287DB05C00A04A2B /* SettingEndPoint.swift */; }; - 39C9580A287DC03500A04A2B /* Encodable+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39C95809287DC03500A04A2B /* Encodable+Extension.swift */; }; 39D95265285B097800183B09 /* CalendarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39D95264285B097800183B09 /* CalendarView.swift */; }; 39EE956D2A401ED400AF6857 /* DetailingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EE956C2A401ED400AF6857 /* DetailingView.swift */; }; 39EE956F2A404A3800AF6857 /* MissionEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39EE956E2A404A3800AF6857 /* MissionEditViewController.swift */; }; @@ -67,7 +66,7 @@ B50B1B41285B048A0080992C /* OpenManittoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50B1B40285B048A0080992C /* OpenManittoViewController.swift */; }; B50B1B44285B146A0080992C /* OpenManittoCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50B1B43285B146A0080992C /* OpenManittoCollectionViewCell.swift */; }; B50CEE912A445EB700CF1C76 /* UIScrollView+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */; }; - B50CEEC02A6FF82600CF1C76 /* Publisher+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50CEEBF2A6FF82600CF1C76 /* Publisher+Extension.swift */; }; + B50CEEC02A6FF82600CF1C76 /* Publisher+Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = B50CEEBF2A6FF82600CF1C76 /* Publisher+Async.swift */; }; B517C04A28D1F7EC0008BED0 /* TokenEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */; }; B53A35AD2A962E9C00B720BC /* MTNetwork in Frameworks */ = {isa = PBXBuildFile; productRef = B53A35AC2A962E9C00B720BC /* MTNetwork */; }; B53A35B72A963F2100B720BC /* DetailRoomEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = B53A35B62A963F2100B720BC /* DetailRoomEndPoint.swift */; }; @@ -115,7 +114,9 @@ B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */; }; B5B3C1652A427B5800AABD6F /* UIControl+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */; }; B5B3C16F2A42B37000AABD6F /* UIViewController+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */; }; - B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2AD285B2917006D880B /* Int+Extension.swift */; }; + B5C7FC0C2AA88AF500862021 /* UIViewController+Alert.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C7FC0B2AA88AF500862021 /* UIViewController+Alert.swift */; }; + B5C7FC0E2AA88B3500862021 /* UIViewController+Keyboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C7FC0D2AA88B3500862021 /* UIViewController+Keyboard.swift */; }; + B5E1F2AE285B2917006D880B /* Int+RandomNumber.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2AD285B2917006D880B /* Int+RandomNumber.swift */; }; B5E1F2B2285ECBDF006D880B /* SelectManitteeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */; }; B5F31BB028BE1CA700F61D0F /* UserDefaultStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */; }; B5F31BB228BE1CD700F61D0F /* UserDefaultHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F31BB128BE1CD700F61D0F /* UserDefaultHandler.swift */; }; @@ -138,10 +139,8 @@ B5F5251A2851A12600614FF7 /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F525192851A12600614FF7 /* BaseViewController.swift */; }; B5F5251C2851A19A00614FF7 /* BaseCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5251B2851A19A00614FF7 /* BaseCollectionViewCell.swift */; }; B5F5251E2851A1C700614FF7 /* BaseTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5251D2851A1C700614FF7 /* BaseTableViewCell.swift */; }; - B5F525202851A21D00614FF7 /* UIViewController+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5251F2851A21D00614FF7 /* UIViewController+Extension.swift */; }; - B5F525222851A24100614FF7 /* UITableView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F525212851A24100614FF7 /* UITableView+Extension.swift */; }; B5F525242851A25400614FF7 /* UICollectionView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F525232851A25400614FF7 /* UICollectionView+Extension.swift */; }; - B5F525262851A26D00614FF7 /* NSObject+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F525252851A26D00614FF7 /* NSObject+Extension.swift */; }; + B5F525262851A26D00614FF7 /* NSObject+ClassName.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F525252851A26D00614FF7 /* NSObject+ClassName.swift */; }; B5F525292851A2A400614FF7 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F525282851A2A400614FF7 /* Logger.swift */; }; B5F5253128545E4C00614FF7 /* BackButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5253028545E4C00614FF7 /* BackButton.swift */; }; B5F5253528547F1900614FF7 /* LetterHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F5253428547F1900614FF7 /* LetterHeaderView.swift */; }; @@ -238,14 +237,13 @@ 399D17AA2856C83B00F50D9D /* DetailEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailEditViewController.swift; sourceTree = ""; }; 39BDDCC32A52BB4A005E0A71 /* DetailWaitService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitService.swift; sourceTree = ""; }; 39C957CD2876E2ED00A04A2B /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; - 39C957CF2879521400A04A2B /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = ""; }; + 39C957CF2879521400A04A2B /* String+Date.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Date.swift"; sourceTree = ""; }; 39C957D12879523200A04A2B /* Date+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Extension.swift"; sourceTree = ""; }; 39C957EC287AE4D100A04A2B /* MainEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainEndPoint.swift; sourceTree = ""; }; 39C957F0287D984900A04A2B /* APIEnvironment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIEnvironment.swift; sourceTree = ""; }; 39C95801287DACC300A04A2B /* RoomParticipationEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomParticipationEndPoint.swift; sourceTree = ""; }; 39C95803287DAD3000A04A2B /* LetterEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterEndPoint.swift; sourceTree = ""; }; 39C95807287DB05C00A04A2B /* SettingEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingEndPoint.swift; sourceTree = ""; }; - 39C95809287DC03500A04A2B /* Encodable+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Encodable+Extension.swift"; sourceTree = ""; }; 39D95264285B097800183B09 /* CalendarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarView.swift; sourceTree = ""; }; 39E6321328BDE59C00CFC6C4 /* Manito.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Manito.entitlements; sourceTree = ""; }; 39EE956C2A401ED400AF6857 /* DetailingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailingView.swift; sourceTree = ""; }; @@ -273,7 +271,7 @@ B50B1B40285B048A0080992C /* OpenManittoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoViewController.swift; sourceTree = ""; }; B50B1B43285B146A0080992C /* OpenManittoCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenManittoCollectionViewCell.swift; sourceTree = ""; }; B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIScrollView+Combine.swift"; sourceTree = ""; }; - B50CEEBF2A6FF82600CF1C76 /* Publisher+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Publisher+Extension.swift"; sourceTree = ""; }; + B50CEEBF2A6FF82600CF1C76 /* Publisher+Async.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Publisher+Async.swift"; sourceTree = ""; }; B517C04928D1F7EC0008BED0 /* TokenEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenEndPoint.swift; sourceTree = ""; }; B53A35B62A963F2100B720BC /* DetailRoomEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailRoomEndPoint.swift; sourceTree = ""; }; B53A35BF2A96F21A00B720BC /* MainRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainRepository.swift; sourceTree = ""; }; @@ -324,7 +322,9 @@ B5B3C1602A41D79E00AABD6F /* ViewModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModelType.swift; sourceTree = ""; }; B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Combine.swift"; sourceTree = ""; }; B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Combine.swift"; sourceTree = ""; }; - B5E1F2AD285B2917006D880B /* Int+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Extension.swift"; sourceTree = ""; }; + B5C7FC0B2AA88AF500862021 /* UIViewController+Alert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Alert.swift"; sourceTree = ""; }; + B5C7FC0D2AA88B3500862021 /* UIViewController+Keyboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Keyboard.swift"; sourceTree = ""; }; + B5E1F2AD285B2917006D880B /* Int+RandomNumber.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+RandomNumber.swift"; sourceTree = ""; }; B5E1F2B1285ECBDF006D880B /* SelectManitteeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectManitteeViewController.swift; sourceTree = ""; }; B5F31BAF28BE1CA700F61D0F /* UserDefaultStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultStorage.swift; sourceTree = ""; }; B5F31BB128BE1CD700F61D0F /* UserDefaultHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultHandler.swift; sourceTree = ""; }; @@ -349,10 +349,8 @@ B5F525192851A12600614FF7 /* BaseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseViewController.swift; sourceTree = ""; }; B5F5251B2851A19A00614FF7 /* BaseCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseCollectionViewCell.swift; sourceTree = ""; }; B5F5251D2851A1C700614FF7 /* BaseTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseTableViewCell.swift; sourceTree = ""; }; - B5F5251F2851A21D00614FF7 /* UIViewController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Extension.swift"; sourceTree = ""; }; - B5F525212851A24100614FF7 /* UITableView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableView+Extension.swift"; sourceTree = ""; }; B5F525232851A25400614FF7 /* UICollectionView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UICollectionView+Extension.swift"; sourceTree = ""; }; - B5F525252851A26D00614FF7 /* NSObject+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+Extension.swift"; sourceTree = ""; }; + B5F525252851A26D00614FF7 /* NSObject+ClassName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+ClassName.swift"; sourceTree = ""; }; B5F525282851A2A400614FF7 /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = ""; }; B5F5253028545E4C00614FF7 /* BackButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackButton.swift; sourceTree = ""; }; B5F5253428547F1900614FF7 /* LetterHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterHeaderView.swift; sourceTree = ""; }; @@ -950,7 +948,9 @@ B5C7FC052AA887CC00862021 /* Extension */ = { isa = PBXGroup; children = ( + B5C7FC102AA88F4A00862021 /* Combine */, B5C7FC062AA887E100862021 /* UI */, + B5C7FC0F2AA88C0400862021 /* Type */, ); path = Extension; sourceTree = ""; @@ -958,7 +958,10 @@ B5C7FC062AA887E100862021 /* UI */ = { isa = PBXGroup; children = ( - B5FEE9DC28C849B400DEA07E /* UIImageView+Cache.swift */, + B5F524FC28519EEC00614FF7 /* UIColor+Extension.swift */, + B5F524FE28519EF300614FF7 /* UIFont+Extension.swift */, + B5C7FC082AA88ABB00862021 /* UIViewController */, + B5C7FC092AA88AC800862021 /* UIView */, ); path = UI; sourceTree = ""; @@ -975,6 +978,50 @@ path = Literal; sourceTree = ""; }; + B5C7FC082AA88ABB00862021 /* UIViewController */ = { + isa = PBXGroup; + children = ( + B5C7FC0B2AA88AF500862021 /* UIViewController+Alert.swift */, + B5C7FC0D2AA88B3500862021 /* UIViewController+Keyboard.swift */, + ); + path = UIViewController; + sourceTree = ""; + }; + B5C7FC092AA88AC800862021 /* UIView */ = { + isa = PBXGroup; + children = ( + B5FEE9DC28C849B400DEA07E /* UIImageView+Cache.swift */, + B5F525232851A25400614FF7 /* UICollectionView+Extension.swift */, + B5F5253C2854B8CB00614FF7 /* UIView+Extension.swift */, + B5F525412855C97900614FF7 /* UILabel+Extension.swift */, + 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */, + ); + path = UIView; + sourceTree = ""; + }; + B5C7FC0F2AA88C0400862021 /* Type */ = { + isa = PBXGroup; + children = ( + B5F525252851A26D00614FF7 /* NSObject+ClassName.swift */, + B5E1F2AD285B2917006D880B /* Int+RandomNumber.swift */, + D77224DE285DDAB7008B760B /* Notification+Extension.swift */, + 39C957CF2879521400A04A2B /* String+Date.swift */, + 39C957D12879523200A04A2B /* Date+Extension.swift */, + ); + path = Type; + sourceTree = ""; + }; + B5C7FC102AA88F4A00862021 /* Combine */ = { + isa = PBXGroup; + children = ( + B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */, + B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */, + B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */, + B50CEEBF2A6FF82600CF1C76 /* Publisher+Async.swift */, + ); + path = Combine; + sourceTree = ""; + }; B5F524C228519AA000614FF7 = { isa = PBXGroup; children = ( @@ -1040,7 +1087,6 @@ B54741E529A4945100B75BA3 /* Error */, B5F524F728519BC400614FF7 /* Base */, B5F524F628519BC000614FF7 /* Protocol */, - B5F524F428519BB500614FF7 /* Extension */, B5F524F328519BB100614FF7 /* UIComponent */, B5F524F228519BA700614FF7 /* Resource */, ); @@ -1136,31 +1182,6 @@ path = UIComponent; sourceTree = ""; }; - B5F524F428519BB500614FF7 /* Extension */ = { - isa = PBXGroup; - children = ( - B5F524FC28519EEC00614FF7 /* UIColor+Extension.swift */, - B5F524FE28519EF300614FF7 /* UIFont+Extension.swift */, - B5F5251F2851A21D00614FF7 /* UIViewController+Extension.swift */, - B5F525212851A24100614FF7 /* UITableView+Extension.swift */, - B5F525232851A25400614FF7 /* UICollectionView+Extension.swift */, - B5F525252851A26D00614FF7 /* NSObject+Extension.swift */, - B5F5253C2854B8CB00614FF7 /* UIView+Extension.swift */, - B5F525412855C97900614FF7 /* UILabel+Extension.swift */, - D77224DE285DDAB7008B760B /* Notification+Extension.swift */, - B5E1F2AD285B2917006D880B /* Int+Extension.swift */, - 39C95809287DC03500A04A2B /* Encodable+Extension.swift */, - 39C957CF2879521400A04A2B /* String+Extension.swift */, - 39C957D12879523200A04A2B /* Date+Extension.swift */, - 39018F4128C4708A00C78DBA /* UIButton+Extension.swift */, - B5B3C1642A427B5800AABD6F /* UIControl+Combine.swift */, - B5B3C16E2A42B37000AABD6F /* UIViewController+Combine.swift */, - B50CEE902A445EB700CF1C76 /* UIScrollView+Combine.swift */, - B50CEEBF2A6FF82600CF1C76 /* Publisher+Extension.swift */, - ); - path = Extension; - sourceTree = ""; - }; B5F524F628519BC000614FF7 /* Protocol */ = { isa = PBXGroup; children = ( @@ -1635,7 +1656,6 @@ CB674C2128596A310063A6B7 /* CheckRoomViewController.swift in Sources */, B5A085DF2A972D2A00C8A98D /* LetterRequestDTO.swift in Sources */, 3904F5002AA3754400B6264F /* MessageCountInfo.swift in Sources */, - 39C9580A287DC03500A04A2B /* Encodable+Extension.swift in Sources */, B50B1AFB2856B5180080992C /* IndividualMissionView.swift in Sources */, B5F524FB28519C2A00614FF7 /* MainViewController.swift in Sources */, 7E3058C62854B47F00489E6A /* InputTitleView.swift in Sources */, @@ -1650,7 +1670,7 @@ B5F5250A2851A06700614FF7 /* DetailWaitViewController.swift in Sources */, B5A085F02A97326B00C8A98D /* FriendListDTO.swift in Sources */, D7C4A1AB2A0D1AA400C3AE4C /* ParticipateRoomView.swift in Sources */, - 39C957D02879521400A04A2B /* String+Extension.swift in Sources */, + 39C957D02879521400A04A2B /* String+Date.swift in Sources */, 399D17AB2856C83B00F50D9D /* DetailEditViewController.swift in Sources */, B5A086002A97496900C8A98D /* MessageListItemDTO.swift in Sources */, 7E15F67E28B35B3D00441305 /* TextLiteral.swift in Sources */, @@ -1660,15 +1680,16 @@ B5F525422855C97900614FF7 /* UILabel+Extension.swift in Sources */, B53A35CE2A96FA7A00B720BC /* LoginRepository.swift in Sources */, CB21C33928C4C10200128D25 /* CharacterCollectionViewCell.swift in Sources */, + B5C7FC0E2AA88B3500862021 /* UIViewController+Keyboard.swift in Sources */, 39C95804287DAD3000A04A2B /* LetterEndPoint.swift in Sources */, B50B1B44285B146A0080992C /* OpenManittoCollectionViewCell.swift in Sources */, B5F5253128545E4C00614FF7 /* BackButton.swift in Sources */, 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */, - B5F525202851A21D00614FF7 /* UIViewController+Extension.swift in Sources */, 7ED845BA2876BE530075AC61 /* SettingViewTableCell.swift in Sources */, B5B3C15F2A41D6F400AABD6F /* LetterUsecase.swift in Sources */, B5AE11F229D28CB500F86FF8 /* OpenManittoPopupView.swift in Sources */, B517C04A28D1F7EC0008BED0 /* TokenEndPoint.swift in Sources */, + B5C7FC0C2AA88AF500862021 /* UIViewController+Alert.swift in Sources */, 39EE956D2A401ED400AF6857 /* DetailingView.swift in Sources */, 39C95808287DB05C00A04A2B /* SettingEndPoint.swift in Sources */, B5A086062A977F1700C8A98D /* NetworkError.swift in Sources */, @@ -1686,7 +1707,7 @@ 39BDDCC42A52BB4A005E0A71 /* DetailWaitService.swift in Sources */, B5A086022A974B8100C8A98D /* RoomListItem.swift in Sources */, B53A35CC2A96F99D00B720BC /* SettingRepository.swift in Sources */, - B50CEEC02A6FF82600CF1C76 /* Publisher+Extension.swift in Sources */, + B50CEEC02A6FF82600CF1C76 /* Publisher+Async.swift in Sources */, B5B3C1612A41D79E00AABD6F /* ViewModelType.swift in Sources */, B53A35C02A96F21A00B720BC /* MainRepository.swift in Sources */, D739C36728C7B82500161117 /* NicknameDTO.swift in Sources */, @@ -1704,7 +1725,7 @@ D7B83FD62A95A48700BFD8FF /* CreateRoomService.swift in Sources */, 391B3003286198C200421F1D /* Size.swift in Sources */, B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */, - B5F525262851A26D00614FF7 /* NSObject+Extension.swift in Sources */, + B5F525262851A26D00614FF7 /* NSObject+ClassName.swift in Sources */, 3904F4FA2AA36F4F00B6264F /* UserInfo.swift in Sources */, 39FFE32828EEFFFE008442EE /* MoreButton.swift in Sources */, B5706BE129ADC20A0093D198 /* CreateLetterView.swift in Sources */, @@ -1725,7 +1746,7 @@ 39C95802287DACC300A04A2B /* RoomParticipationEndPoint.swift in Sources */, 395B5BC22A25E20000CE1420 /* DetailWaitViewModel.swift in Sources */, B5F524FD28519EEC00614FF7 /* UIColor+Extension.swift in Sources */, - B5E1F2AE285B2917006D880B /* Int+Extension.swift in Sources */, + B5E1F2AE285B2917006D880B /* Int+RandomNumber.swift in Sources */, D7C4A1AD2A0DD8FA00C3AE4C /* SettingView.swift in Sources */, 39C957CE2876E2ED00A04A2B /* LoginViewController.swift in Sources */, B53A35D42A97266D00B720BC /* CreatedRoomRequestDTO.swift in Sources */, @@ -1747,7 +1768,6 @@ B50B1B41285B048A0080992C /* OpenManittoViewController.swift in Sources */, CB5AE3E6285AB76800382EA3 /* PeopleInfoView.swift in Sources */, B5B3C1652A427B5800AABD6F /* UIControl+Combine.swift in Sources */, - B5F525222851A24100614FF7 /* UITableView+Extension.swift in Sources */, B5A085F82A9744CC00C8A98D /* RoomListDTO.swift in Sources */, B5A085F62A9733F900C8A98D /* TokenDTO.swift in Sources */, B5F5253B2854ABF200614FF7 /* MainButton.swift in Sources */, diff --git a/Manito/Manito/Global/Extension/Encodable+Extension.swift b/Manito/Manito/Global/Extension/Encodable+Extension.swift deleted file mode 100644 index c713be209..000000000 --- a/Manito/Manito/Global/Extension/Encodable+Extension.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// Encodable+Extension.swift -// Manito -// -// Created by Mingwan Choi on 2022/07/12. -// - -import Foundation - -extension Encodable { - func encode() -> Data? { - do { - return try JSONEncoder().encode(self) - } catch { - return nil - } - } -} diff --git a/Manito/Manito/Global/Extension/UITableView+Extension.swift b/Manito/Manito/Global/Extension/UITableView+Extension.swift deleted file mode 100644 index 94102b855..000000000 --- a/Manito/Manito/Global/Extension/UITableView+Extension.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// UITableView+Extension.swift -// Manito -// -// Created by SHIN YOON AH on 2022/06/09. -// - -import UIKit - -extension UITableView { - func dequeueReusableCell(withType cellType: T.Type, for indexPath: IndexPath) -> T { - guard let cell = self.dequeueReusableCell(withIdentifier: T.className, for: indexPath) as? T else { - fatalError("Could not find cell with reuseID \(T.className)") - } - return cell - } - - func register(cell: T.Type, - forCellReuseIdentifier reuseIdentifier: String = T.className) where T: UITableViewCell { - register(cell, forCellReuseIdentifier: reuseIdentifier) - } -} diff --git a/Manito/Manito/Global/Extension/Publisher+Extension.swift b/Manito/Manito/Util/Extension/Combine/Publisher+Async.swift similarity index 98% rename from Manito/Manito/Global/Extension/Publisher+Extension.swift rename to Manito/Manito/Util/Extension/Combine/Publisher+Async.swift index 4ad40896d..d36c2d68f 100644 --- a/Manito/Manito/Global/Extension/Publisher+Extension.swift +++ b/Manito/Manito/Util/Extension/Combine/Publisher+Async.swift @@ -1,5 +1,5 @@ // -// Publisher+Extension.swift +// Publisher+Async.swift // Manito // // Created by SHIN YOON AH on 2023/07/25. diff --git a/Manito/Manito/Global/Extension/UIControl+Combine.swift b/Manito/Manito/Util/Extension/Combine/UIControl+Combine.swift similarity index 100% rename from Manito/Manito/Global/Extension/UIControl+Combine.swift rename to Manito/Manito/Util/Extension/Combine/UIControl+Combine.swift diff --git a/Manito/Manito/Global/Extension/UIScrollView+Combine.swift b/Manito/Manito/Util/Extension/Combine/UIScrollView+Combine.swift similarity index 100% rename from Manito/Manito/Global/Extension/UIScrollView+Combine.swift rename to Manito/Manito/Util/Extension/Combine/UIScrollView+Combine.swift diff --git a/Manito/Manito/Global/Extension/UIViewController+Combine.swift b/Manito/Manito/Util/Extension/Combine/UIViewController+Combine.swift similarity index 100% rename from Manito/Manito/Global/Extension/UIViewController+Combine.swift rename to Manito/Manito/Util/Extension/Combine/UIViewController+Combine.swift diff --git a/Manito/Manito/Global/Extension/Date+Extension.swift b/Manito/Manito/Util/Extension/Type/Date+Extension.swift similarity index 100% rename from Manito/Manito/Global/Extension/Date+Extension.swift rename to Manito/Manito/Util/Extension/Type/Date+Extension.swift diff --git a/Manito/Manito/Global/Extension/Int+Extension.swift b/Manito/Manito/Util/Extension/Type/Int+RandomNumber.swift similarity index 94% rename from Manito/Manito/Global/Extension/Int+Extension.swift rename to Manito/Manito/Util/Extension/Type/Int+RandomNumber.swift index d74dad54a..f27dc8760 100644 --- a/Manito/Manito/Global/Extension/Int+Extension.swift +++ b/Manito/Manito/Util/Extension/Type/Int+RandomNumber.swift @@ -1,5 +1,5 @@ // -// Int+Extension.swift +// Int+RandomNumber.swift // Manito // // Created by SHIN YOON AH on 2022/06/16. diff --git a/Manito/Manito/Global/Extension/NSObject+Extension.swift b/Manito/Manito/Util/Extension/Type/NSObject+ClassName.swift similarity index 86% rename from Manito/Manito/Global/Extension/NSObject+Extension.swift rename to Manito/Manito/Util/Extension/Type/NSObject+ClassName.swift index 186ce1afb..088c8562b 100644 --- a/Manito/Manito/Global/Extension/NSObject+Extension.swift +++ b/Manito/Manito/Util/Extension/Type/NSObject+ClassName.swift @@ -1,5 +1,5 @@ // -// NSObject+Extension.swift +// NSObject+ClassName.swift // Manito // // Created by SHIN YOON AH on 2022/06/09. diff --git a/Manito/Manito/Global/Extension/Notification+Extension.swift b/Manito/Manito/Util/Extension/Type/Notification+Extension.swift similarity index 100% rename from Manito/Manito/Global/Extension/Notification+Extension.swift rename to Manito/Manito/Util/Extension/Type/Notification+Extension.swift diff --git a/Manito/Manito/Global/Extension/String+Extension.swift b/Manito/Manito/Util/Extension/Type/String+Date.swift similarity index 100% rename from Manito/Manito/Global/Extension/String+Extension.swift rename to Manito/Manito/Util/Extension/Type/String+Date.swift diff --git a/Manito/Manito/Global/Extension/UIColor+Extension.swift b/Manito/Manito/Util/Extension/UI/UIColor+Extension.swift similarity index 100% rename from Manito/Manito/Global/Extension/UIColor+Extension.swift rename to Manito/Manito/Util/Extension/UI/UIColor+Extension.swift diff --git a/Manito/Manito/Global/Extension/UIFont+Extension.swift b/Manito/Manito/Util/Extension/UI/UIFont+Extension.swift similarity index 100% rename from Manito/Manito/Global/Extension/UIFont+Extension.swift rename to Manito/Manito/Util/Extension/UI/UIFont+Extension.swift diff --git a/Manito/Manito/Global/Extension/UIButton+Extension.swift b/Manito/Manito/Util/Extension/UI/UIView/UIButton+Extension.swift similarity index 100% rename from Manito/Manito/Global/Extension/UIButton+Extension.swift rename to Manito/Manito/Util/Extension/UI/UIView/UIButton+Extension.swift diff --git a/Manito/Manito/Global/Extension/UICollectionView+Extension.swift b/Manito/Manito/Util/Extension/UI/UIView/UICollectionView+Extension.swift similarity index 100% rename from Manito/Manito/Global/Extension/UICollectionView+Extension.swift rename to Manito/Manito/Util/Extension/UI/UIView/UICollectionView+Extension.swift diff --git a/Manito/Manito/Util/Extension/UI/UIImageView+Cache.swift b/Manito/Manito/Util/Extension/UI/UIView/UIImageView+Cache.swift similarity index 100% rename from Manito/Manito/Util/Extension/UI/UIImageView+Cache.swift rename to Manito/Manito/Util/Extension/UI/UIView/UIImageView+Cache.swift diff --git a/Manito/Manito/Global/Extension/UILabel+Extension.swift b/Manito/Manito/Util/Extension/UI/UIView/UILabel+Extension.swift similarity index 100% rename from Manito/Manito/Global/Extension/UILabel+Extension.swift rename to Manito/Manito/Util/Extension/UI/UIView/UILabel+Extension.swift diff --git a/Manito/Manito/Global/Extension/UIView+Extension.swift b/Manito/Manito/Util/Extension/UI/UIView/UIView+Extension.swift similarity index 100% rename from Manito/Manito/Global/Extension/UIView+Extension.swift rename to Manito/Manito/Util/Extension/UI/UIView/UIView+Extension.swift diff --git a/Manito/Manito/Global/Extension/UIViewController+Extension.swift b/Manito/Manito/Util/Extension/UI/UIViewController/UIViewController+Alert.swift similarity index 84% rename from Manito/Manito/Global/Extension/UIViewController+Extension.swift rename to Manito/Manito/Util/Extension/UI/UIViewController/UIViewController+Alert.swift index 44100c7a6..a0edc248b 100644 --- a/Manito/Manito/Global/Extension/UIViewController+Extension.swift +++ b/Manito/Manito/Util/Extension/UI/UIViewController/UIViewController+Alert.swift @@ -1,8 +1,8 @@ // -// UIViewController+Extension.swift +// UIViewController+Alert.swift // Manito // -// Created by SHIN YOON AH on 2022/06/09. +// Created by SHIN YOON AH on 2023/09/06. // import UIKit @@ -17,10 +17,10 @@ extension UIViewController { preferredStyle: .alert) let okAction = UIAlertAction(title: "확인", style: .default, handler: okAction) alertViewController.addAction(okAction) - + self.present(alertViewController, animated: true, completion: completion) } - + func makeRequestAlert(title: String, message: String, okTitle: String = "확인", @@ -31,41 +31,31 @@ extension UIViewController { completion : (() -> Void)? = nil) { let generator = UIImpactFeedbackGenerator(style: .medium) generator.impactOccurred() - + let alertViewController = UIAlertController(title: title, message: message, preferredStyle: .alert) - + let cancelAction = UIAlertAction(title: cancelTitle, style: .default, handler: cancelAction) alertViewController.addAction(cancelAction) - + let okAction = UIAlertAction(title: okTitle, style: okStyle, handler: okAction) alertViewController.addAction(okAction) - + self.present(alertViewController, animated: true, completion: completion) } - + func makeActionSheet(title: String? = nil, message: String? = nil, actionTitles:[String?], actionStyle:[UIAlertAction.Style], actions:[((UIAlertAction) -> Void)?]) { let alert = UIAlertController(title: title, message: message, preferredStyle: .actionSheet) - + for (index, title) in actionTitles.enumerated() { let action = UIAlertAction(title: title, style: actionStyle[index], handler: actions[index]) alert.addAction(action) } - + self.present(alert, animated: true, completion: nil) } - - func hidekeyboardWhenTappedAround() { - let tap = UITapGestureRecognizer(target: self, action: #selector(endEditingView)) - tap.cancelsTouchesInView = false - view.addGestureRecognizer(tap) - } - - @objc func endEditingView() { - view.endEditing(true) - } } diff --git a/Manito/Manito/Util/Extension/UI/UIViewController/UIViewController+Keyboard.swift b/Manito/Manito/Util/Extension/UI/UIViewController/UIViewController+Keyboard.swift new file mode 100644 index 000000000..8e7dc80bd --- /dev/null +++ b/Manito/Manito/Util/Extension/UI/UIViewController/UIViewController+Keyboard.swift @@ -0,0 +1,20 @@ +// +// UIViewController+Keyboard.swift +// Manito +// +// Created by SHIN YOON AH on 2023/09/06. +// + +import UIKit + +extension UIViewController { + func hidekeyboardWhenTappedAround() { + let tap = UITapGestureRecognizer(target: self, action: #selector(endEditingView)) + tap.cancelsTouchesInView = false + view.addGestureRecognizer(tap) + } + + @objc func endEditingView() { + view.endEditing(true) + } +} From f67476b1e1493f80a0b095d475b64c4bf32a1c9d Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Wed, 6 Sep 2023 19:57:49 +0900 Subject: [PATCH 461/468] =?UTF-8?q?[MOVE]=20Character=20enum=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD(#516)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 2 +- Manito/Manito/{Util/Literal => Domain/Entity}/Character.swift | 0 Manito/Manito/Util/Extension/Type/Notification+Extension.swift | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) rename Manito/Manito/{Util/Literal => Domain/Entity}/Character.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index eb1abd762..f47d95a55 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -886,6 +886,7 @@ 3904F4FB2AA3729300B6264F /* InvitationCode.swift */, 3904F4FD2AA3743C00B6264F /* IndividualMission.swift */, 3904F4FF2AA3754400B6264F /* MessageCountInfo.swift */, + CB7B23A728C4ECA8004A4CF3 /* Character.swift */, ); path = Entity; sourceTree = ""; @@ -971,7 +972,6 @@ children = ( B5F5250028519EFB00614FF7 /* ImageLiteral.swift */, 391B3002286198C200421F1D /* Size.swift */, - CB7B23A728C4ECA8004A4CF3 /* Character.swift */, 7E15F67D28B35B3D00441305 /* TextLiteral.swift */, D777D2C828C7780E008655BD /* URLLiteral.swift */, ); diff --git a/Manito/Manito/Util/Literal/Character.swift b/Manito/Manito/Domain/Entity/Character.swift similarity index 100% rename from Manito/Manito/Util/Literal/Character.swift rename to Manito/Manito/Domain/Entity/Character.swift diff --git a/Manito/Manito/Util/Extension/Type/Notification+Extension.swift b/Manito/Manito/Util/Extension/Type/Notification+Extension.swift index fef122a70..f01d6d829 100644 --- a/Manito/Manito/Util/Extension/Type/Notification+Extension.swift +++ b/Manito/Manito/Util/Extension/Type/Notification+Extension.swift @@ -7,7 +7,6 @@ import Foundation - extension Notification.Name { static let nextNotification = Notification.Name("NextNotification") static let createRoomInvitedCode = Notification.Name("CreateRoomInvitedCode") From 24f582d7d7af26ed732121d91c5412cdaa789d18 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 7 Sep 2023 11:45:34 +0900 Subject: [PATCH 462/468] =?UTF-8?q?[MOVE]=20Presention=20=ED=95=98?= =?UTF-8?q?=EC=9C=84=20Common=20=ED=8C=8C=EC=9D=BC=20=EB=82=B4=EB=B6=80?= =?UTF-8?q?=EB=A1=9C=20Component=20=ED=8C=8C=EC=9D=BC=20=EC=9D=B4=EB=8F=99?= =?UTF-8?q?(#518)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 44 +++++++++++++------ .../Common/Component/Button}/BackButton.swift | 0 .../Common/Component/Button}/MainButton.swift | 0 .../Common/Component/Button}/MoreButton.swift | 0 .../Component/Button}/SettingButton.swift | 0 .../Common/Component/View}/GuideView.swift | 0 .../Component/View}/ToastPopupView.swift | 0 7 files changed, 30 insertions(+), 14 deletions(-) rename Manito/Manito/{Global/UIComponent => Presentation/Common/Component/Button}/BackButton.swift (100%) rename Manito/Manito/{Global/UIComponent => Presentation/Common/Component/Button}/MainButton.swift (100%) rename Manito/Manito/{Global/UIComponent => Presentation/Common/Component/Button}/MoreButton.swift (100%) rename Manito/Manito/{Global/UIComponent => Presentation/Common/Component/Button}/SettingButton.swift (100%) rename Manito/Manito/{Global/UIComponent => Presentation/Common/Component/View}/GuideView.swift (100%) rename Manito/Manito/{Global/UIComponent => Presentation/Common/Component/View}/ToastPopupView.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 5bdb2802c..b1c0e2b18 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -759,6 +759,35 @@ path = App; sourceTree = ""; }; + B55469B72AA96FB9004D9FE6 /* Component */ = { + isa = PBXGroup; + children = ( + B55469BF2AA9704B004D9FE6 /* View */, + B55469BC2AA96FE4004D9FE6 /* Button */, + ); + path = Component; + sourceTree = ""; + }; + B55469BC2AA96FE4004D9FE6 /* Button */ = { + isa = PBXGroup; + children = ( + 392EC77D2855C388006918A9 /* SettingButton.swift */, + B5F5253028545E4C00614FF7 /* BackButton.swift */, + B5F5253A2854ABF200614FF7 /* MainButton.swift */, + 39FFE32728EEFFFE008442EE /* MoreButton.swift */, + ); + path = Button; + sourceTree = ""; + }; + B55469BF2AA9704B004D9FE6 /* View */ = { + isa = PBXGroup; + children = ( + 7E7542B22923744300D725CB /* ToastPopupView.swift */, + B5706BF529B9D4650093D198 /* GuideView.swift */, + ); + path = View; + sourceTree = ""; + }; B57CB3022A763BB200474042 /* Packages */ = { isa = PBXGroup; children = ( @@ -928,6 +957,7 @@ isa = PBXGroup; children = ( B5C7FBEB2AA75DC700862021 /* Base */, + B55469B72AA96FB9004D9FE6 /* Component */, ); path = Common; sourceTree = ""; @@ -1108,7 +1138,6 @@ isa = PBXGroup; children = ( B54741E529A4945100B75BA3 /* Error */, - B5F524F328519BB100614FF7 /* UIComponent */, B5F524F228519BA700614FF7 /* Resource */, ); path = Global; @@ -1190,19 +1219,6 @@ path = Resource; sourceTree = ""; }; - B5F524F328519BB100614FF7 /* UIComponent */ = { - isa = PBXGroup; - children = ( - 392EC77D2855C388006918A9 /* SettingButton.swift */, - B5F5253028545E4C00614FF7 /* BackButton.swift */, - B5F5253A2854ABF200614FF7 /* MainButton.swift */, - 39FFE32728EEFFFE008442EE /* MoreButton.swift */, - 7E7542B22923744300D725CB /* ToastPopupView.swift */, - B5706BF529B9D4650093D198 /* GuideView.swift */, - ); - path = UIComponent; - sourceTree = ""; - }; B5F524F928519BD600614FF7 /* Storyboards */ = { isa = PBXGroup; children = ( diff --git a/Manito/Manito/Global/UIComponent/BackButton.swift b/Manito/Manito/Presentation/Common/Component/Button/BackButton.swift similarity index 100% rename from Manito/Manito/Global/UIComponent/BackButton.swift rename to Manito/Manito/Presentation/Common/Component/Button/BackButton.swift diff --git a/Manito/Manito/Global/UIComponent/MainButton.swift b/Manito/Manito/Presentation/Common/Component/Button/MainButton.swift similarity index 100% rename from Manito/Manito/Global/UIComponent/MainButton.swift rename to Manito/Manito/Presentation/Common/Component/Button/MainButton.swift diff --git a/Manito/Manito/Global/UIComponent/MoreButton.swift b/Manito/Manito/Presentation/Common/Component/Button/MoreButton.swift similarity index 100% rename from Manito/Manito/Global/UIComponent/MoreButton.swift rename to Manito/Manito/Presentation/Common/Component/Button/MoreButton.swift diff --git a/Manito/Manito/Global/UIComponent/SettingButton.swift b/Manito/Manito/Presentation/Common/Component/Button/SettingButton.swift similarity index 100% rename from Manito/Manito/Global/UIComponent/SettingButton.swift rename to Manito/Manito/Presentation/Common/Component/Button/SettingButton.swift diff --git a/Manito/Manito/Global/UIComponent/GuideView.swift b/Manito/Manito/Presentation/Common/Component/View/GuideView.swift similarity index 100% rename from Manito/Manito/Global/UIComponent/GuideView.swift rename to Manito/Manito/Presentation/Common/Component/View/GuideView.swift diff --git a/Manito/Manito/Global/UIComponent/ToastPopupView.swift b/Manito/Manito/Presentation/Common/Component/View/ToastPopupView.swift similarity index 100% rename from Manito/Manito/Global/UIComponent/ToastPopupView.swift rename to Manito/Manito/Presentation/Common/Component/View/ToastPopupView.swift From fed7b6d94a40c8abdf3de457be04cea2c1ce0f44 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 7 Sep 2023 11:47:05 +0900 Subject: [PATCH 463/468] =?UTF-8?q?[MOVE]=20Resource=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=99=B8=EB=B6=80=EB=A1=9C=20=EB=BA=8C(#518)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 24 +++++++++--------- .../AccentColor.colorset/Contents.json | 0 .../AppIcon.appiconset/1024.png | Bin .../AppIcon.appiconset/114.png | Bin .../AppIcon.appiconset/120.png | Bin .../AppIcon.appiconset/180.png | Bin .../Assets.xcassets/AppIcon.appiconset/29.png | Bin .../Assets.xcassets/AppIcon.appiconset/40.png | Bin .../Assets.xcassets/AppIcon.appiconset/57.png | Bin .../Assets.xcassets/AppIcon.appiconset/58.png | Bin .../Assets.xcassets/AppIcon.appiconset/60.png | Bin .../Assets.xcassets/AppIcon.appiconset/80.png | Bin .../Assets.xcassets/AppIcon.appiconset/87.png | Bin .../AppIcon.appiconset/Contents.json | 0 .../Resource/Assets.xcassets/Contents.json | 0 .../btnList.imageset/Contents.json | 0 .../btnList.imageset/btnList.png | Bin .../btnList.imageset/btnList@2x.png | Bin .../btnList.imageset/btnList@3x.png | Bin .../btnManiTti.imageset/Contents.json | 0 .../btnManiTti.imageset/btnManiTti.png | Bin .../btnManiTti.imageset/btnManiTti@2x.png | Bin .../btnManiTti.imageset/btnManiTti@3x.png | Bin .../btnNewRoom.imageset/Contents.json | 0 .../btnNewRoom.imageset/btnNewRoom.png | Bin .../btnNewRoom.imageset/btnNewRoom@2x.png | Bin .../btnNewRoom.imageset/btnNewRoom@3x.png | Bin .../btnSliderThumb.imageset/Contents.json | 0 .../btnSllderThumb.png | Bin .../btnSllderThumb@2x.png | Bin .../btnSllderThumb@3x.png | Bin .../ic_back.imageset/Contents.json | 0 .../ic_back.imageset/ic_back.png | Bin .../ic_back.imageset/ic_back@2x.png | Bin .../ic_back.imageset/ic_back@3x.png | Bin .../ic_camera.imageset/Contents.json | 0 .../ic_camera.imageset/ic_camera.png | Bin .../ic_camera.imageset/ic_camera@2x.png | Bin .../ic_camera.imageset/ic_camera@3x.png | Bin .../ic_exit.imageset/Contents.json | 0 .../ic_exit.imageset/ic_exit.png | Bin .../ic_exit.imageset/ic_exit@2x.png | Bin .../ic_exit.imageset/ic_exit@3x.png | Bin .../ic_insta.imageset/Contents.json | 0 .../ic_insta.imageset/ic_insta.png | Bin .../ic_insta.imageset/ic_insta@2x.png | Bin .../ic_insta.imageset/ic_insta@3x.png | Bin .../ic_letterInfo.imageset/Contents.json | 0 .../ic_letterInfo.imageset/ic_letterInfo.png | Bin .../ic_letterInfo@2x.png | Bin .../ic_letterInfo@3x.png | Bin .../ic_missionInfo.imageset/Contents.json | 0 .../ic_missionInfo.png | Bin .../ic_missionInfo@2x.png | Bin .../ic_missionInfo@3x.png | Bin .../ic_more.imageset/Contents.json | 0 .../ic_more.imageset/ic_more.png | Bin .../ic_more.imageset/ic_more@2x.png | Bin .../ic_more.imageset/ic_more@3x.png | Bin .../ic_pencil.imageset/Contents.json | 0 .../ic_pencil.imageset/ic_pencil.pdf | Bin .../ic_report.imageset/Contents.json | 0 .../ic_report.imageset/ic_report.png | Bin .../ic_report.imageset/ic_report@2x.png | Bin .../ic_report.imageset/ic_report@3x.png | Bin .../ic_right.imageset/Contents.json | 0 .../ic_right.imageset/ic_right.png | Bin .../ic_right.imageset/ic_right@2x.png | Bin .../ic_right.imageset/ic_right@3x.png | Bin .../ic_save.imageset/Contents.json | 0 .../ic_save.imageset/ic_save.png | Bin .../ic_save.imageset/ic_save@2x.png | Bin .../ic_save.imageset/ic_save@3x.png | Bin .../ic_setting.imageset/Contents.json | 0 .../ic_setting.imageset/ic_setting.png | Bin .../ic_setting.imageset/ic_setting@2x.png | Bin .../ic_setting.imageset/ic_setting@3x.png | Bin .../imgAppIcon.imageset/Contents.json | 0 .../imgAppIcon.imageset/imgAppIcon.png | Bin .../imgAppIcon.imageset/imgAppIcon@2x.png | Bin .../imgAppIcon.imageset/imgAppIcon@3x.png | Bin .../imgBackground.imageset/Contents.json | 0 .../imgBackground.imageset/imgBackground.png | Bin .../imgBackground@2x.png | Bin .../imgBackground@3x.png | Bin .../imgCharacterBlue.imageset/Contents.json | 0 .../imgCharacterBlue.png | Bin .../imgCharacterBrown.imageset/Contents.json | 0 .../imgCharacterBrown.png | Bin .../Contents.json | 0 .../imgCharacterHeavyPink.png | Bin .../Contents.json | 0 .../imgCharacterLightGreen.png | Bin .../imgCharacterOrange.imageset/Contents.json | 0 .../imgCharacterOrange.png | Bin .../imgCharacterPink.imageset/Contents.json | 0 .../imgCharacterPink.png | Bin .../imgCharacterPurple.imageset/Contents.json | 0 .../imgCharacterPurple.png | Bin .../imgCharacterRed.imageset/Contents.json | 0 .../imgCharacterRed.png | Bin .../imgCharacterYellow.imageset/Contents.json | 0 .../imgCharacterYellow.png | Bin .../imgCodeBackground.imageset/Contents.json | 0 .../imgCodeBackground.png | Bin .../imgCodeBackground@2x.png | Bin .../imgCodeBackground@3x.png | Bin .../imgCommonMisson.imageset/Contents.json | 0 .../imgCommonMisson.png | Bin .../imgCommonMisson@2x.png | Bin .../imgCommonMisson@3x.png | Bin .../imgDevBackground.imageset/Contents.json | 0 .../imgBackground.png | Bin .../imgEnterRoom.imageset/Contents.json | 0 .../imgEnterRoom.imageset/imgEnterRoom.png | Bin .../imgEnterRoom.imageset/imgEnterRoom@2x.png | Bin .../imgEnterRoom.imageset/imgEnterRoom@3x.png | Bin .../imgLogo.imageset/Contents.json | 0 .../imgLogo.imageset/imgLogo.png | Bin .../imgLogo.imageset/imgLogo@2x.png | Bin .../imgLogo.imageset/imgLogo@3x.png | Bin .../imgMa.imageset/Contents.json | 0 .../Assets.xcassets/imgMa.imageset/imgMa.png | Bin .../imgMa.imageset/imgMa@2x.png | Bin .../imgMa.imageset/imgMa@3x.png | Bin .../imgMaChemi.imageset/Chemi01 1.png | Bin .../imgMaChemi.imageset/Chemi01 1@2x.png | Bin .../imgMaChemi.imageset/Chemi01 1@3x.png | Bin .../imgMaChemi.imageset/Contents.json | 0 .../imgMaCoby.imageset/Coby01 1.png | Bin .../imgMaCoby.imageset/Coby01 1@2x.png | Bin .../imgMaCoby.imageset/Coby01 1@3x.png | Bin .../imgMaCoby.imageset/Contents.json | 0 .../imgMaDaon.imageset/Contents.json | 0 .../imgMaDaon.imageset/imgMaDaon.png | Bin .../imgMaDinner.imageset/Contents.json | 0 .../imgMaDinner.imageset/Dinner01 1.png | Bin .../imgMaDinner.imageset/Dinner01 1@2x.png | Bin .../imgMaDinner.imageset/Dinner01 1@3x.png | Bin .../imgMaDuna.imageset/Contents.json | 0 .../imgMaDuna.imageset/Duna01 1.png | Bin .../imgMaDuna.imageset/Duna01 1@2x.png | Bin .../imgMaDuna.imageset/Duna01 1@3x.png | Bin .../imgMaHoya.imageset/Contents.json | 0 .../imgMaHoya.imageset/Hoya 1.png | Bin .../imgMaHoya.imageset/Hoya 1@2x.png | Bin .../imgMaHoya.imageset/Hoya 1@3x.png | Bin .../imgMaLeo.imageset/Contents.json | 0 .../imgMaLeo.imageset/imgMaLeo.png | Bin .../imgMaLivvy.imageset/Contents.json | 0 .../imgMaLivvy.imageset/Livvy01 1.png | Bin .../imgMaLivvy.imageset/Livvy01 1@2x.png | Bin .../imgMaLivvy.imageset/Livvy01 1@3x.png | Bin .../imgNi.imageset/Contents.json | 0 .../Assets.xcassets/imgNi.imageset/imgNi.png | Bin .../imgNi.imageset/imgNi@2x.png | Bin .../imgNi.imageset/imgNi@3x.png | Bin .../imgStar.imageset/Contents.json | 0 .../imgStar.imageset/imgStar.png | Bin .../imgStar.imageset/imgStar@2x.png | Bin .../imgStar.imageset/imgStar@3x.png | Bin .../imgTextLogo.imageset/Contents.json | 0 .../imgTextLogo.imageset/imgTextLogo.png | Bin .../imgTextLogo.imageset/imgTextLogo@2x.png | Bin .../imgTextLogo.imageset/imgTextLogo@3x.png | Bin .../imgTto.imageset/Contents.json | 0 .../imgTto.imageset/imgTti.png | Bin .../imgTto.imageset/imgTti@2x.png | Bin .../imgTto.imageset/imgTti@3x.png | Bin .../img_characters.imageset/Contents.json | 0 .../img_characters.png | Bin .../img_characters@2x.png | Bin .../img_characters@3x.png | Bin .../img_guideBox.imageset/Contents.json | 0 .../img_guideBox.imageset/img_guideBox.png | Bin .../img_guideBox.imageset/img_guideBox@2x.png | Bin .../img_guideBox.imageset/img_guideBox@3x.png | Bin .../Resource/Fonts/DungGeunMo.otf | Bin .../{Global => }/Resource/GIFs/capsule.gif | Bin .../{Global => }/Resource/GIFs/gifMa.gif | Bin .../{Global => }/Resource/GIFs/gifNi.gif | Bin .../{Global => }/Resource/GIFs/gifTto.gif | Bin .../{Global => }/Resource/GIFs/joystick.gif | Bin .../{Global => }/Resource/GIFs/logo.gif | Bin .../Base.lproj/LaunchScreen.storyboard | 0 .../Storyboards/Base.lproj/Main.storyboard | 0 .../Resource/Storyboards/DetailIng.storyboard | 0 .../Resource/Storyboards/Splash.storyboard | 0 188 files changed, 12 insertions(+), 12 deletions(-) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/AccentColor.colorset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/AppIcon.appiconset/1024.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/AppIcon.appiconset/114.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/AppIcon.appiconset/120.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/AppIcon.appiconset/180.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/AppIcon.appiconset/29.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/AppIcon.appiconset/40.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/AppIcon.appiconset/57.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/AppIcon.appiconset/58.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/AppIcon.appiconset/60.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/AppIcon.appiconset/80.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/AppIcon.appiconset/87.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/btnList.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/btnList.imageset/btnList.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/btnList.imageset/btnList@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/btnList.imageset/btnList@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/btnManiTti.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/btnManiTti.imageset/btnManiTti.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/btnManiTti.imageset/btnManiTti@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/btnManiTti.imageset/btnManiTti@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/btnNewRoom.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/btnNewRoom.imageset/btnNewRoom.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/btnNewRoom.imageset/btnNewRoom@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/btnNewRoom.imageset/btnNewRoom@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/btnSliderThumb.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/btnSliderThumb.imageset/btnSllderThumb.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/btnSliderThumb.imageset/btnSllderThumb@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/btnSliderThumb.imageset/btnSllderThumb@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_back.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_back.imageset/ic_back.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_back.imageset/ic_back@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_back.imageset/ic_back@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_camera.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_camera.imageset/ic_camera.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_camera.imageset/ic_camera@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_camera.imageset/ic_camera@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_exit.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_exit.imageset/ic_exit.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_exit.imageset/ic_exit@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_exit.imageset/ic_exit@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_insta.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_insta.imageset/ic_insta.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_insta.imageset/ic_insta@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_insta.imageset/ic_insta@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_letterInfo.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_letterInfo.imageset/ic_letterInfo.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_letterInfo.imageset/ic_letterInfo@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_letterInfo.imageset/ic_letterInfo@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_missionInfo.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_missionInfo.imageset/ic_missionInfo.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_missionInfo.imageset/ic_missionInfo@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_missionInfo.imageset/ic_missionInfo@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_more.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_more.imageset/ic_more.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_more.imageset/ic_more@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_more.imageset/ic_more@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_pencil.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_pencil.imageset/ic_pencil.pdf (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_report.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_report.imageset/ic_report.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_report.imageset/ic_report@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_report.imageset/ic_report@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_right.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_right.imageset/ic_right.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_right.imageset/ic_right@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_right.imageset/ic_right@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_save.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_save.imageset/ic_save.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_save.imageset/ic_save@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_save.imageset/ic_save@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_setting.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_setting.imageset/ic_setting.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_setting.imageset/ic_setting@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/ic_setting.imageset/ic_setting@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgAppIcon.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgAppIcon.imageset/imgAppIcon.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgAppIcon.imageset/imgAppIcon@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgAppIcon.imageset/imgAppIcon@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgBackground.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgBackground.imageset/imgBackground.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgBackground.imageset/imgBackground@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgBackground.imageset/imgBackground@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterBlue.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterBlue.imageset/imgCharacterBlue.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterBrown.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterBrown.imageset/imgCharacterBrown.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterHeavyPink.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterHeavyPink.imageset/imgCharacterHeavyPink.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterLightGreen.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterLightGreen.imageset/imgCharacterLightGreen.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterOrange.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterOrange.imageset/imgCharacterOrange.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterPink.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterPink.imageset/imgCharacterPink.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterPurple.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterPurple.imageset/imgCharacterPurple.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterRed.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterRed.imageset/imgCharacterRed.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterYellow.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCharacterYellow.imageset/imgCharacterYellow.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCodeBackground.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCodeBackground.imageset/imgCodeBackground.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCodeBackground.imageset/imgCodeBackground@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCodeBackground.imageset/imgCodeBackground@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCommonMisson.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCommonMisson.imageset/imgCommonMisson.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCommonMisson.imageset/imgCommonMisson@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgCommonMisson.imageset/imgCommonMisson@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgDevBackground.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgDevBackground.imageset/imgBackground.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgEnterRoom.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgEnterRoom.imageset/imgEnterRoom.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgEnterRoom.imageset/imgEnterRoom@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgEnterRoom.imageset/imgEnterRoom@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgLogo.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgLogo.imageset/imgLogo.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgLogo.imageset/imgLogo@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgLogo.imageset/imgLogo@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMa.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMa.imageset/imgMa.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMa.imageset/imgMa@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMa.imageset/imgMa@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaChemi.imageset/Chemi01 1.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaChemi.imageset/Chemi01 1@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaChemi.imageset/Chemi01 1@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaChemi.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaCoby.imageset/Coby01 1.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaCoby.imageset/Coby01 1@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaCoby.imageset/Coby01 1@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaCoby.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaDaon.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaDaon.imageset/imgMaDaon.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaDinner.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaDinner.imageset/Dinner01 1.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaDinner.imageset/Dinner01 1@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaDinner.imageset/Dinner01 1@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaDuna.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaDuna.imageset/Duna01 1.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaDuna.imageset/Duna01 1@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaDuna.imageset/Duna01 1@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaHoya.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaHoya.imageset/Hoya 1.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaHoya.imageset/Hoya 1@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaHoya.imageset/Hoya 1@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaLeo.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaLeo.imageset/imgMaLeo.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaLivvy.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaLivvy.imageset/Livvy01 1.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaLivvy.imageset/Livvy01 1@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgMaLivvy.imageset/Livvy01 1@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgNi.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgNi.imageset/imgNi.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgNi.imageset/imgNi@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgNi.imageset/imgNi@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgStar.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgStar.imageset/imgStar.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgStar.imageset/imgStar@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgStar.imageset/imgStar@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgTextLogo.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgTextLogo.imageset/imgTextLogo.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgTextLogo.imageset/imgTextLogo@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgTextLogo.imageset/imgTextLogo@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgTto.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgTto.imageset/imgTti.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgTto.imageset/imgTti@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/imgTto.imageset/imgTti@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/img_characters.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/img_characters.imageset/img_characters.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/img_characters.imageset/img_characters@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/img_characters.imageset/img_characters@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/img_guideBox.imageset/Contents.json (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/img_guideBox.imageset/img_guideBox.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/img_guideBox.imageset/img_guideBox@2x.png (100%) rename Manito/Manito/{Global => }/Resource/Assets.xcassets/img_guideBox.imageset/img_guideBox@3x.png (100%) rename Manito/Manito/{Global => }/Resource/Fonts/DungGeunMo.otf (100%) rename Manito/Manito/{Global => }/Resource/GIFs/capsule.gif (100%) rename Manito/Manito/{Global => }/Resource/GIFs/gifMa.gif (100%) rename Manito/Manito/{Global => }/Resource/GIFs/gifNi.gif (100%) rename Manito/Manito/{Global => }/Resource/GIFs/gifTto.gif (100%) rename Manito/Manito/{Global => }/Resource/GIFs/joystick.gif (100%) rename Manito/Manito/{Global => }/Resource/GIFs/logo.gif (100%) rename Manito/Manito/{Global => }/Resource/Storyboards/Base.lproj/LaunchScreen.storyboard (100%) rename Manito/Manito/{Global => }/Resource/Storyboards/Base.lproj/Main.storyboard (100%) rename Manito/Manito/{Global => }/Resource/Storyboards/DetailIng.storyboard (100%) rename Manito/Manito/{Global => }/Resource/Storyboards/Splash.storyboard (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index b1c0e2b18..9634f1479 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -788,6 +788,17 @@ path = View; sourceTree = ""; }; + B55469C02AA970DF004D9FE6 /* Resource */ = { + isa = PBXGroup; + children = ( + B5F524D728519AA100614FF7 /* Assets.xcassets */, + B50B1B36285AC28B0080992C /* GIFs */, + B5F5250228519F6A00614FF7 /* Fonts */, + B5F524F928519BD600614FF7 /* Storyboards */, + ); + path = Resource; + sourceTree = ""; + }; B57CB3022A763BB200474042 /* Packages */ = { isa = PBXGroup; children = ( @@ -1108,6 +1119,7 @@ B5F524E428519AC600614FF7 /* Global */, B5C7FC022AA886F300862021 /* Util */, B53A35B22A9630FE00B720BC /* Service */, + B55469C02AA970DF004D9FE6 /* Resource */, ); path = Manito; sourceTree = ""; @@ -1138,7 +1150,6 @@ isa = PBXGroup; children = ( B54741E529A4945100B75BA3 /* Error */, - B5F524F228519BA700614FF7 /* Resource */, ); path = Global; sourceTree = ""; @@ -1208,17 +1219,6 @@ path = Letter; sourceTree = ""; }; - B5F524F228519BA700614FF7 /* Resource */ = { - isa = PBXGroup; - children = ( - B50B1B36285AC28B0080992C /* GIFs */, - B5F5250228519F6A00614FF7 /* Fonts */, - B5F524D728519AA100614FF7 /* Assets.xcassets */, - B5F524F928519BD600614FF7 /* Storyboards */, - ); - path = Resource; - sourceTree = ""; - }; B5F524F928519BD600614FF7 /* Storyboards */ = { isa = PBXGroup; children = ( diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/AccentColor.colorset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/AccentColor.colorset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/AccentColor.colorset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/AccentColor.colorset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/1024.png b/Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/1024.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/1024.png rename to Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/1024.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/114.png b/Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/114.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/114.png rename to Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/114.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/120.png b/Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/120.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/120.png rename to Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/120.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/180.png b/Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/180.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/180.png rename to Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/180.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/29.png b/Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/29.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/29.png rename to Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/29.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/40.png b/Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/40.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/40.png rename to Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/40.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/57.png b/Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/57.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/57.png rename to Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/57.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/58.png b/Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/58.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/58.png rename to Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/58.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/60.png b/Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/60.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/60.png rename to Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/60.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/80.png b/Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/80.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/80.png rename to Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/80.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/87.png b/Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/87.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/87.png rename to Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/87.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/Contents.json b/Manito/Manito/Resource/Assets.xcassets/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/btnList.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/btnList.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/btnList.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/btnList.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/btnList.imageset/btnList.png b/Manito/Manito/Resource/Assets.xcassets/btnList.imageset/btnList.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/btnList.imageset/btnList.png rename to Manito/Manito/Resource/Assets.xcassets/btnList.imageset/btnList.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/btnList.imageset/btnList@2x.png b/Manito/Manito/Resource/Assets.xcassets/btnList.imageset/btnList@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/btnList.imageset/btnList@2x.png rename to Manito/Manito/Resource/Assets.xcassets/btnList.imageset/btnList@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/btnList.imageset/btnList@3x.png b/Manito/Manito/Resource/Assets.xcassets/btnList.imageset/btnList@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/btnList.imageset/btnList@3x.png rename to Manito/Manito/Resource/Assets.xcassets/btnList.imageset/btnList@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/btnManiTti.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/btnManiTti.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/btnManiTti.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/btnManiTti.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/btnManiTti.imageset/btnManiTti.png b/Manito/Manito/Resource/Assets.xcassets/btnManiTti.imageset/btnManiTti.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/btnManiTti.imageset/btnManiTti.png rename to Manito/Manito/Resource/Assets.xcassets/btnManiTti.imageset/btnManiTti.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/btnManiTti.imageset/btnManiTti@2x.png b/Manito/Manito/Resource/Assets.xcassets/btnManiTti.imageset/btnManiTti@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/btnManiTti.imageset/btnManiTti@2x.png rename to Manito/Manito/Resource/Assets.xcassets/btnManiTti.imageset/btnManiTti@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/btnManiTti.imageset/btnManiTti@3x.png b/Manito/Manito/Resource/Assets.xcassets/btnManiTti.imageset/btnManiTti@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/btnManiTti.imageset/btnManiTti@3x.png rename to Manito/Manito/Resource/Assets.xcassets/btnManiTti.imageset/btnManiTti@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/btnNewRoom.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/btnNewRoom.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/btnNewRoom.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/btnNewRoom.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/btnNewRoom.imageset/btnNewRoom.png b/Manito/Manito/Resource/Assets.xcassets/btnNewRoom.imageset/btnNewRoom.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/btnNewRoom.imageset/btnNewRoom.png rename to Manito/Manito/Resource/Assets.xcassets/btnNewRoom.imageset/btnNewRoom.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/btnNewRoom.imageset/btnNewRoom@2x.png b/Manito/Manito/Resource/Assets.xcassets/btnNewRoom.imageset/btnNewRoom@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/btnNewRoom.imageset/btnNewRoom@2x.png rename to Manito/Manito/Resource/Assets.xcassets/btnNewRoom.imageset/btnNewRoom@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/btnNewRoom.imageset/btnNewRoom@3x.png b/Manito/Manito/Resource/Assets.xcassets/btnNewRoom.imageset/btnNewRoom@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/btnNewRoom.imageset/btnNewRoom@3x.png rename to Manito/Manito/Resource/Assets.xcassets/btnNewRoom.imageset/btnNewRoom@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/btnSliderThumb.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/btnSliderThumb.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/btnSliderThumb.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/btnSliderThumb.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/btnSliderThumb.imageset/btnSllderThumb.png b/Manito/Manito/Resource/Assets.xcassets/btnSliderThumb.imageset/btnSllderThumb.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/btnSliderThumb.imageset/btnSllderThumb.png rename to Manito/Manito/Resource/Assets.xcassets/btnSliderThumb.imageset/btnSllderThumb.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/btnSliderThumb.imageset/btnSllderThumb@2x.png b/Manito/Manito/Resource/Assets.xcassets/btnSliderThumb.imageset/btnSllderThumb@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/btnSliderThumb.imageset/btnSllderThumb@2x.png rename to Manito/Manito/Resource/Assets.xcassets/btnSliderThumb.imageset/btnSllderThumb@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/btnSliderThumb.imageset/btnSllderThumb@3x.png b/Manito/Manito/Resource/Assets.xcassets/btnSliderThumb.imageset/btnSllderThumb@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/btnSliderThumb.imageset/btnSllderThumb@3x.png rename to Manito/Manito/Resource/Assets.xcassets/btnSliderThumb.imageset/btnSllderThumb@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_back.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/ic_back.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_back.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/ic_back.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_back.imageset/ic_back.png b/Manito/Manito/Resource/Assets.xcassets/ic_back.imageset/ic_back.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_back.imageset/ic_back.png rename to Manito/Manito/Resource/Assets.xcassets/ic_back.imageset/ic_back.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_back.imageset/ic_back@2x.png b/Manito/Manito/Resource/Assets.xcassets/ic_back.imageset/ic_back@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_back.imageset/ic_back@2x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_back.imageset/ic_back@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_back.imageset/ic_back@3x.png b/Manito/Manito/Resource/Assets.xcassets/ic_back.imageset/ic_back@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_back.imageset/ic_back@3x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_back.imageset/ic_back@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_camera.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/ic_camera.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_camera.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/ic_camera.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_camera.imageset/ic_camera.png b/Manito/Manito/Resource/Assets.xcassets/ic_camera.imageset/ic_camera.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_camera.imageset/ic_camera.png rename to Manito/Manito/Resource/Assets.xcassets/ic_camera.imageset/ic_camera.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_camera.imageset/ic_camera@2x.png b/Manito/Manito/Resource/Assets.xcassets/ic_camera.imageset/ic_camera@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_camera.imageset/ic_camera@2x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_camera.imageset/ic_camera@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_camera.imageset/ic_camera@3x.png b/Manito/Manito/Resource/Assets.xcassets/ic_camera.imageset/ic_camera@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_camera.imageset/ic_camera@3x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_camera.imageset/ic_camera@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_exit.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/ic_exit.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_exit.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/ic_exit.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_exit.imageset/ic_exit.png b/Manito/Manito/Resource/Assets.xcassets/ic_exit.imageset/ic_exit.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_exit.imageset/ic_exit.png rename to Manito/Manito/Resource/Assets.xcassets/ic_exit.imageset/ic_exit.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_exit.imageset/ic_exit@2x.png b/Manito/Manito/Resource/Assets.xcassets/ic_exit.imageset/ic_exit@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_exit.imageset/ic_exit@2x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_exit.imageset/ic_exit@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_exit.imageset/ic_exit@3x.png b/Manito/Manito/Resource/Assets.xcassets/ic_exit.imageset/ic_exit@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_exit.imageset/ic_exit@3x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_exit.imageset/ic_exit@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_insta.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/ic_insta.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_insta.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/ic_insta.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_insta.imageset/ic_insta.png b/Manito/Manito/Resource/Assets.xcassets/ic_insta.imageset/ic_insta.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_insta.imageset/ic_insta.png rename to Manito/Manito/Resource/Assets.xcassets/ic_insta.imageset/ic_insta.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_insta.imageset/ic_insta@2x.png b/Manito/Manito/Resource/Assets.xcassets/ic_insta.imageset/ic_insta@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_insta.imageset/ic_insta@2x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_insta.imageset/ic_insta@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_insta.imageset/ic_insta@3x.png b/Manito/Manito/Resource/Assets.xcassets/ic_insta.imageset/ic_insta@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_insta.imageset/ic_insta@3x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_insta.imageset/ic_insta@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_letterInfo.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/ic_letterInfo.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_letterInfo.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/ic_letterInfo.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_letterInfo.imageset/ic_letterInfo.png b/Manito/Manito/Resource/Assets.xcassets/ic_letterInfo.imageset/ic_letterInfo.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_letterInfo.imageset/ic_letterInfo.png rename to Manito/Manito/Resource/Assets.xcassets/ic_letterInfo.imageset/ic_letterInfo.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_letterInfo.imageset/ic_letterInfo@2x.png b/Manito/Manito/Resource/Assets.xcassets/ic_letterInfo.imageset/ic_letterInfo@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_letterInfo.imageset/ic_letterInfo@2x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_letterInfo.imageset/ic_letterInfo@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_letterInfo.imageset/ic_letterInfo@3x.png b/Manito/Manito/Resource/Assets.xcassets/ic_letterInfo.imageset/ic_letterInfo@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_letterInfo.imageset/ic_letterInfo@3x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_letterInfo.imageset/ic_letterInfo@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_missionInfo.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/ic_missionInfo.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_missionInfo.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/ic_missionInfo.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_missionInfo.imageset/ic_missionInfo.png b/Manito/Manito/Resource/Assets.xcassets/ic_missionInfo.imageset/ic_missionInfo.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_missionInfo.imageset/ic_missionInfo.png rename to Manito/Manito/Resource/Assets.xcassets/ic_missionInfo.imageset/ic_missionInfo.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_missionInfo.imageset/ic_missionInfo@2x.png b/Manito/Manito/Resource/Assets.xcassets/ic_missionInfo.imageset/ic_missionInfo@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_missionInfo.imageset/ic_missionInfo@2x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_missionInfo.imageset/ic_missionInfo@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_missionInfo.imageset/ic_missionInfo@3x.png b/Manito/Manito/Resource/Assets.xcassets/ic_missionInfo.imageset/ic_missionInfo@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_missionInfo.imageset/ic_missionInfo@3x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_missionInfo.imageset/ic_missionInfo@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_more.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/ic_more.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_more.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/ic_more.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_more.imageset/ic_more.png b/Manito/Manito/Resource/Assets.xcassets/ic_more.imageset/ic_more.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_more.imageset/ic_more.png rename to Manito/Manito/Resource/Assets.xcassets/ic_more.imageset/ic_more.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_more.imageset/ic_more@2x.png b/Manito/Manito/Resource/Assets.xcassets/ic_more.imageset/ic_more@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_more.imageset/ic_more@2x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_more.imageset/ic_more@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_more.imageset/ic_more@3x.png b/Manito/Manito/Resource/Assets.xcassets/ic_more.imageset/ic_more@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_more.imageset/ic_more@3x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_more.imageset/ic_more@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_pencil.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/ic_pencil.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_pencil.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/ic_pencil.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_pencil.imageset/ic_pencil.pdf b/Manito/Manito/Resource/Assets.xcassets/ic_pencil.imageset/ic_pencil.pdf similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_pencil.imageset/ic_pencil.pdf rename to Manito/Manito/Resource/Assets.xcassets/ic_pencil.imageset/ic_pencil.pdf diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_report.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/ic_report.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_report.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/ic_report.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_report.imageset/ic_report.png b/Manito/Manito/Resource/Assets.xcassets/ic_report.imageset/ic_report.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_report.imageset/ic_report.png rename to Manito/Manito/Resource/Assets.xcassets/ic_report.imageset/ic_report.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_report.imageset/ic_report@2x.png b/Manito/Manito/Resource/Assets.xcassets/ic_report.imageset/ic_report@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_report.imageset/ic_report@2x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_report.imageset/ic_report@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_report.imageset/ic_report@3x.png b/Manito/Manito/Resource/Assets.xcassets/ic_report.imageset/ic_report@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_report.imageset/ic_report@3x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_report.imageset/ic_report@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_right.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/ic_right.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_right.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/ic_right.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_right.imageset/ic_right.png b/Manito/Manito/Resource/Assets.xcassets/ic_right.imageset/ic_right.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_right.imageset/ic_right.png rename to Manito/Manito/Resource/Assets.xcassets/ic_right.imageset/ic_right.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_right.imageset/ic_right@2x.png b/Manito/Manito/Resource/Assets.xcassets/ic_right.imageset/ic_right@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_right.imageset/ic_right@2x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_right.imageset/ic_right@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_right.imageset/ic_right@3x.png b/Manito/Manito/Resource/Assets.xcassets/ic_right.imageset/ic_right@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_right.imageset/ic_right@3x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_right.imageset/ic_right@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_save.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/ic_save.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_save.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/ic_save.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_save.imageset/ic_save.png b/Manito/Manito/Resource/Assets.xcassets/ic_save.imageset/ic_save.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_save.imageset/ic_save.png rename to Manito/Manito/Resource/Assets.xcassets/ic_save.imageset/ic_save.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_save.imageset/ic_save@2x.png b/Manito/Manito/Resource/Assets.xcassets/ic_save.imageset/ic_save@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_save.imageset/ic_save@2x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_save.imageset/ic_save@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_save.imageset/ic_save@3x.png b/Manito/Manito/Resource/Assets.xcassets/ic_save.imageset/ic_save@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_save.imageset/ic_save@3x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_save.imageset/ic_save@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_setting.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/ic_setting.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_setting.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/ic_setting.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_setting.imageset/ic_setting.png b/Manito/Manito/Resource/Assets.xcassets/ic_setting.imageset/ic_setting.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_setting.imageset/ic_setting.png rename to Manito/Manito/Resource/Assets.xcassets/ic_setting.imageset/ic_setting.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_setting.imageset/ic_setting@2x.png b/Manito/Manito/Resource/Assets.xcassets/ic_setting.imageset/ic_setting@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_setting.imageset/ic_setting@2x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_setting.imageset/ic_setting@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/ic_setting.imageset/ic_setting@3x.png b/Manito/Manito/Resource/Assets.xcassets/ic_setting.imageset/ic_setting@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/ic_setting.imageset/ic_setting@3x.png rename to Manito/Manito/Resource/Assets.xcassets/ic_setting.imageset/ic_setting@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgAppIcon.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgAppIcon.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgAppIcon.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgAppIcon.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgAppIcon.imageset/imgAppIcon.png b/Manito/Manito/Resource/Assets.xcassets/imgAppIcon.imageset/imgAppIcon.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgAppIcon.imageset/imgAppIcon.png rename to Manito/Manito/Resource/Assets.xcassets/imgAppIcon.imageset/imgAppIcon.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgAppIcon.imageset/imgAppIcon@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgAppIcon.imageset/imgAppIcon@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgAppIcon.imageset/imgAppIcon@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgAppIcon.imageset/imgAppIcon@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgAppIcon.imageset/imgAppIcon@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgAppIcon.imageset/imgAppIcon@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgAppIcon.imageset/imgAppIcon@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgAppIcon.imageset/imgAppIcon@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgBackground.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgBackground.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgBackground.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgBackground.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgBackground.imageset/imgBackground.png b/Manito/Manito/Resource/Assets.xcassets/imgBackground.imageset/imgBackground.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgBackground.imageset/imgBackground.png rename to Manito/Manito/Resource/Assets.xcassets/imgBackground.imageset/imgBackground.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgBackground.imageset/imgBackground@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgBackground.imageset/imgBackground@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgBackground.imageset/imgBackground@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgBackground.imageset/imgBackground@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgBackground.imageset/imgBackground@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgBackground.imageset/imgBackground@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgBackground.imageset/imgBackground@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgBackground.imageset/imgBackground@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterBlue.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgCharacterBlue.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterBlue.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterBlue.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterBlue.imageset/imgCharacterBlue.png b/Manito/Manito/Resource/Assets.xcassets/imgCharacterBlue.imageset/imgCharacterBlue.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterBlue.imageset/imgCharacterBlue.png rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterBlue.imageset/imgCharacterBlue.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterBrown.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgCharacterBrown.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterBrown.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterBrown.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterBrown.imageset/imgCharacterBrown.png b/Manito/Manito/Resource/Assets.xcassets/imgCharacterBrown.imageset/imgCharacterBrown.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterBrown.imageset/imgCharacterBrown.png rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterBrown.imageset/imgCharacterBrown.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterHeavyPink.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgCharacterHeavyPink.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterHeavyPink.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterHeavyPink.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterHeavyPink.imageset/imgCharacterHeavyPink.png b/Manito/Manito/Resource/Assets.xcassets/imgCharacterHeavyPink.imageset/imgCharacterHeavyPink.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterHeavyPink.imageset/imgCharacterHeavyPink.png rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterHeavyPink.imageset/imgCharacterHeavyPink.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterLightGreen.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgCharacterLightGreen.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterLightGreen.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterLightGreen.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterLightGreen.imageset/imgCharacterLightGreen.png b/Manito/Manito/Resource/Assets.xcassets/imgCharacterLightGreen.imageset/imgCharacterLightGreen.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterLightGreen.imageset/imgCharacterLightGreen.png rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterLightGreen.imageset/imgCharacterLightGreen.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterOrange.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgCharacterOrange.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterOrange.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterOrange.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterOrange.imageset/imgCharacterOrange.png b/Manito/Manito/Resource/Assets.xcassets/imgCharacterOrange.imageset/imgCharacterOrange.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterOrange.imageset/imgCharacterOrange.png rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterOrange.imageset/imgCharacterOrange.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterPink.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgCharacterPink.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterPink.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterPink.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterPink.imageset/imgCharacterPink.png b/Manito/Manito/Resource/Assets.xcassets/imgCharacterPink.imageset/imgCharacterPink.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterPink.imageset/imgCharacterPink.png rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterPink.imageset/imgCharacterPink.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterPurple.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgCharacterPurple.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterPurple.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterPurple.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterPurple.imageset/imgCharacterPurple.png b/Manito/Manito/Resource/Assets.xcassets/imgCharacterPurple.imageset/imgCharacterPurple.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterPurple.imageset/imgCharacterPurple.png rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterPurple.imageset/imgCharacterPurple.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterRed.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgCharacterRed.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterRed.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterRed.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterRed.imageset/imgCharacterRed.png b/Manito/Manito/Resource/Assets.xcassets/imgCharacterRed.imageset/imgCharacterRed.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterRed.imageset/imgCharacterRed.png rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterRed.imageset/imgCharacterRed.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterYellow.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgCharacterYellow.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterYellow.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterYellow.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterYellow.imageset/imgCharacterYellow.png b/Manito/Manito/Resource/Assets.xcassets/imgCharacterYellow.imageset/imgCharacterYellow.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCharacterYellow.imageset/imgCharacterYellow.png rename to Manito/Manito/Resource/Assets.xcassets/imgCharacterYellow.imageset/imgCharacterYellow.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCodeBackground.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgCodeBackground.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCodeBackground.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgCodeBackground.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCodeBackground.imageset/imgCodeBackground.png b/Manito/Manito/Resource/Assets.xcassets/imgCodeBackground.imageset/imgCodeBackground.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCodeBackground.imageset/imgCodeBackground.png rename to Manito/Manito/Resource/Assets.xcassets/imgCodeBackground.imageset/imgCodeBackground.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCodeBackground.imageset/imgCodeBackground@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgCodeBackground.imageset/imgCodeBackground@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCodeBackground.imageset/imgCodeBackground@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgCodeBackground.imageset/imgCodeBackground@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCodeBackground.imageset/imgCodeBackground@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgCodeBackground.imageset/imgCodeBackground@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCodeBackground.imageset/imgCodeBackground@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgCodeBackground.imageset/imgCodeBackground@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCommonMisson.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgCommonMisson.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCommonMisson.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgCommonMisson.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCommonMisson.imageset/imgCommonMisson.png b/Manito/Manito/Resource/Assets.xcassets/imgCommonMisson.imageset/imgCommonMisson.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCommonMisson.imageset/imgCommonMisson.png rename to Manito/Manito/Resource/Assets.xcassets/imgCommonMisson.imageset/imgCommonMisson.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCommonMisson.imageset/imgCommonMisson@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgCommonMisson.imageset/imgCommonMisson@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCommonMisson.imageset/imgCommonMisson@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgCommonMisson.imageset/imgCommonMisson@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgCommonMisson.imageset/imgCommonMisson@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgCommonMisson.imageset/imgCommonMisson@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgCommonMisson.imageset/imgCommonMisson@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgCommonMisson.imageset/imgCommonMisson@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgDevBackground.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgDevBackground.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgDevBackground.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgDevBackground.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgDevBackground.imageset/imgBackground.png b/Manito/Manito/Resource/Assets.xcassets/imgDevBackground.imageset/imgBackground.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgDevBackground.imageset/imgBackground.png rename to Manito/Manito/Resource/Assets.xcassets/imgDevBackground.imageset/imgBackground.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgEnterRoom.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgEnterRoom.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgEnterRoom.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgEnterRoom.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgEnterRoom.imageset/imgEnterRoom.png b/Manito/Manito/Resource/Assets.xcassets/imgEnterRoom.imageset/imgEnterRoom.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgEnterRoom.imageset/imgEnterRoom.png rename to Manito/Manito/Resource/Assets.xcassets/imgEnterRoom.imageset/imgEnterRoom.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgEnterRoom.imageset/imgEnterRoom@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgEnterRoom.imageset/imgEnterRoom@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgEnterRoom.imageset/imgEnterRoom@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgEnterRoom.imageset/imgEnterRoom@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgEnterRoom.imageset/imgEnterRoom@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgEnterRoom.imageset/imgEnterRoom@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgEnterRoom.imageset/imgEnterRoom@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgEnterRoom.imageset/imgEnterRoom@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgLogo.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgLogo.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgLogo.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgLogo.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgLogo.imageset/imgLogo.png b/Manito/Manito/Resource/Assets.xcassets/imgLogo.imageset/imgLogo.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgLogo.imageset/imgLogo.png rename to Manito/Manito/Resource/Assets.xcassets/imgLogo.imageset/imgLogo.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgLogo.imageset/imgLogo@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgLogo.imageset/imgLogo@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgLogo.imageset/imgLogo@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgLogo.imageset/imgLogo@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgLogo.imageset/imgLogo@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgLogo.imageset/imgLogo@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgLogo.imageset/imgLogo@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgLogo.imageset/imgLogo@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMa.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgMa.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMa.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgMa.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMa.imageset/imgMa.png b/Manito/Manito/Resource/Assets.xcassets/imgMa.imageset/imgMa.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMa.imageset/imgMa.png rename to Manito/Manito/Resource/Assets.xcassets/imgMa.imageset/imgMa.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMa.imageset/imgMa@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgMa.imageset/imgMa@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMa.imageset/imgMa@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgMa.imageset/imgMa@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMa.imageset/imgMa@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgMa.imageset/imgMa@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMa.imageset/imgMa@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgMa.imageset/imgMa@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaChemi.imageset/Chemi01 1.png b/Manito/Manito/Resource/Assets.xcassets/imgMaChemi.imageset/Chemi01 1.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaChemi.imageset/Chemi01 1.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaChemi.imageset/Chemi01 1.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaChemi.imageset/Chemi01 1@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgMaChemi.imageset/Chemi01 1@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaChemi.imageset/Chemi01 1@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaChemi.imageset/Chemi01 1@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaChemi.imageset/Chemi01 1@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgMaChemi.imageset/Chemi01 1@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaChemi.imageset/Chemi01 1@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaChemi.imageset/Chemi01 1@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaChemi.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgMaChemi.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaChemi.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgMaChemi.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaCoby.imageset/Coby01 1.png b/Manito/Manito/Resource/Assets.xcassets/imgMaCoby.imageset/Coby01 1.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaCoby.imageset/Coby01 1.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaCoby.imageset/Coby01 1.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaCoby.imageset/Coby01 1@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgMaCoby.imageset/Coby01 1@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaCoby.imageset/Coby01 1@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaCoby.imageset/Coby01 1@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaCoby.imageset/Coby01 1@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgMaCoby.imageset/Coby01 1@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaCoby.imageset/Coby01 1@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaCoby.imageset/Coby01 1@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaCoby.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgMaCoby.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaCoby.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgMaCoby.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaDaon.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgMaDaon.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaDaon.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgMaDaon.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaDaon.imageset/imgMaDaon.png b/Manito/Manito/Resource/Assets.xcassets/imgMaDaon.imageset/imgMaDaon.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaDaon.imageset/imgMaDaon.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaDaon.imageset/imgMaDaon.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaDinner.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgMaDinner.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaDinner.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgMaDinner.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaDinner.imageset/Dinner01 1.png b/Manito/Manito/Resource/Assets.xcassets/imgMaDinner.imageset/Dinner01 1.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaDinner.imageset/Dinner01 1.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaDinner.imageset/Dinner01 1.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaDinner.imageset/Dinner01 1@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgMaDinner.imageset/Dinner01 1@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaDinner.imageset/Dinner01 1@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaDinner.imageset/Dinner01 1@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaDinner.imageset/Dinner01 1@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgMaDinner.imageset/Dinner01 1@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaDinner.imageset/Dinner01 1@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaDinner.imageset/Dinner01 1@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaDuna.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgMaDuna.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaDuna.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgMaDuna.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaDuna.imageset/Duna01 1.png b/Manito/Manito/Resource/Assets.xcassets/imgMaDuna.imageset/Duna01 1.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaDuna.imageset/Duna01 1.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaDuna.imageset/Duna01 1.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaDuna.imageset/Duna01 1@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgMaDuna.imageset/Duna01 1@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaDuna.imageset/Duna01 1@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaDuna.imageset/Duna01 1@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaDuna.imageset/Duna01 1@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgMaDuna.imageset/Duna01 1@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaDuna.imageset/Duna01 1@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaDuna.imageset/Duna01 1@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaHoya.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgMaHoya.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaHoya.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgMaHoya.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaHoya.imageset/Hoya 1.png b/Manito/Manito/Resource/Assets.xcassets/imgMaHoya.imageset/Hoya 1.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaHoya.imageset/Hoya 1.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaHoya.imageset/Hoya 1.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaHoya.imageset/Hoya 1@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgMaHoya.imageset/Hoya 1@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaHoya.imageset/Hoya 1@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaHoya.imageset/Hoya 1@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaHoya.imageset/Hoya 1@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgMaHoya.imageset/Hoya 1@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaHoya.imageset/Hoya 1@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaHoya.imageset/Hoya 1@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaLeo.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgMaLeo.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaLeo.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgMaLeo.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaLeo.imageset/imgMaLeo.png b/Manito/Manito/Resource/Assets.xcassets/imgMaLeo.imageset/imgMaLeo.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaLeo.imageset/imgMaLeo.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaLeo.imageset/imgMaLeo.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaLivvy.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgMaLivvy.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaLivvy.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgMaLivvy.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaLivvy.imageset/Livvy01 1.png b/Manito/Manito/Resource/Assets.xcassets/imgMaLivvy.imageset/Livvy01 1.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaLivvy.imageset/Livvy01 1.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaLivvy.imageset/Livvy01 1.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaLivvy.imageset/Livvy01 1@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgMaLivvy.imageset/Livvy01 1@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaLivvy.imageset/Livvy01 1@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaLivvy.imageset/Livvy01 1@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgMaLivvy.imageset/Livvy01 1@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgMaLivvy.imageset/Livvy01 1@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgMaLivvy.imageset/Livvy01 1@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgMaLivvy.imageset/Livvy01 1@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgNi.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgNi.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgNi.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgNi.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgNi.imageset/imgNi.png b/Manito/Manito/Resource/Assets.xcassets/imgNi.imageset/imgNi.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgNi.imageset/imgNi.png rename to Manito/Manito/Resource/Assets.xcassets/imgNi.imageset/imgNi.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgNi.imageset/imgNi@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgNi.imageset/imgNi@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgNi.imageset/imgNi@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgNi.imageset/imgNi@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgNi.imageset/imgNi@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgNi.imageset/imgNi@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgNi.imageset/imgNi@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgNi.imageset/imgNi@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgStar.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgStar.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgStar.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgStar.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgStar.imageset/imgStar.png b/Manito/Manito/Resource/Assets.xcassets/imgStar.imageset/imgStar.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgStar.imageset/imgStar.png rename to Manito/Manito/Resource/Assets.xcassets/imgStar.imageset/imgStar.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgStar.imageset/imgStar@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgStar.imageset/imgStar@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgStar.imageset/imgStar@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgStar.imageset/imgStar@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgStar.imageset/imgStar@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgStar.imageset/imgStar@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgStar.imageset/imgStar@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgStar.imageset/imgStar@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgTextLogo.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgTextLogo.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgTextLogo.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgTextLogo.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgTextLogo.imageset/imgTextLogo.png b/Manito/Manito/Resource/Assets.xcassets/imgTextLogo.imageset/imgTextLogo.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgTextLogo.imageset/imgTextLogo.png rename to Manito/Manito/Resource/Assets.xcassets/imgTextLogo.imageset/imgTextLogo.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgTextLogo.imageset/imgTextLogo@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgTextLogo.imageset/imgTextLogo@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgTextLogo.imageset/imgTextLogo@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgTextLogo.imageset/imgTextLogo@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgTextLogo.imageset/imgTextLogo@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgTextLogo.imageset/imgTextLogo@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgTextLogo.imageset/imgTextLogo@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgTextLogo.imageset/imgTextLogo@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgTto.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/imgTto.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgTto.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/imgTto.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgTto.imageset/imgTti.png b/Manito/Manito/Resource/Assets.xcassets/imgTto.imageset/imgTti.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgTto.imageset/imgTti.png rename to Manito/Manito/Resource/Assets.xcassets/imgTto.imageset/imgTti.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgTto.imageset/imgTti@2x.png b/Manito/Manito/Resource/Assets.xcassets/imgTto.imageset/imgTti@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgTto.imageset/imgTti@2x.png rename to Manito/Manito/Resource/Assets.xcassets/imgTto.imageset/imgTti@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/imgTto.imageset/imgTti@3x.png b/Manito/Manito/Resource/Assets.xcassets/imgTto.imageset/imgTti@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/imgTto.imageset/imgTti@3x.png rename to Manito/Manito/Resource/Assets.xcassets/imgTto.imageset/imgTti@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/img_characters.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/img_characters.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/img_characters.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/img_characters.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/img_characters.imageset/img_characters.png b/Manito/Manito/Resource/Assets.xcassets/img_characters.imageset/img_characters.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/img_characters.imageset/img_characters.png rename to Manito/Manito/Resource/Assets.xcassets/img_characters.imageset/img_characters.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/img_characters.imageset/img_characters@2x.png b/Manito/Manito/Resource/Assets.xcassets/img_characters.imageset/img_characters@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/img_characters.imageset/img_characters@2x.png rename to Manito/Manito/Resource/Assets.xcassets/img_characters.imageset/img_characters@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/img_characters.imageset/img_characters@3x.png b/Manito/Manito/Resource/Assets.xcassets/img_characters.imageset/img_characters@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/img_characters.imageset/img_characters@3x.png rename to Manito/Manito/Resource/Assets.xcassets/img_characters.imageset/img_characters@3x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/img_guideBox.imageset/Contents.json b/Manito/Manito/Resource/Assets.xcassets/img_guideBox.imageset/Contents.json similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/img_guideBox.imageset/Contents.json rename to Manito/Manito/Resource/Assets.xcassets/img_guideBox.imageset/Contents.json diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/img_guideBox.imageset/img_guideBox.png b/Manito/Manito/Resource/Assets.xcassets/img_guideBox.imageset/img_guideBox.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/img_guideBox.imageset/img_guideBox.png rename to Manito/Manito/Resource/Assets.xcassets/img_guideBox.imageset/img_guideBox.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/img_guideBox.imageset/img_guideBox@2x.png b/Manito/Manito/Resource/Assets.xcassets/img_guideBox.imageset/img_guideBox@2x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/img_guideBox.imageset/img_guideBox@2x.png rename to Manito/Manito/Resource/Assets.xcassets/img_guideBox.imageset/img_guideBox@2x.png diff --git a/Manito/Manito/Global/Resource/Assets.xcassets/img_guideBox.imageset/img_guideBox@3x.png b/Manito/Manito/Resource/Assets.xcassets/img_guideBox.imageset/img_guideBox@3x.png similarity index 100% rename from Manito/Manito/Global/Resource/Assets.xcassets/img_guideBox.imageset/img_guideBox@3x.png rename to Manito/Manito/Resource/Assets.xcassets/img_guideBox.imageset/img_guideBox@3x.png diff --git a/Manito/Manito/Global/Resource/Fonts/DungGeunMo.otf b/Manito/Manito/Resource/Fonts/DungGeunMo.otf similarity index 100% rename from Manito/Manito/Global/Resource/Fonts/DungGeunMo.otf rename to Manito/Manito/Resource/Fonts/DungGeunMo.otf diff --git a/Manito/Manito/Global/Resource/GIFs/capsule.gif b/Manito/Manito/Resource/GIFs/capsule.gif similarity index 100% rename from Manito/Manito/Global/Resource/GIFs/capsule.gif rename to Manito/Manito/Resource/GIFs/capsule.gif diff --git a/Manito/Manito/Global/Resource/GIFs/gifMa.gif b/Manito/Manito/Resource/GIFs/gifMa.gif similarity index 100% rename from Manito/Manito/Global/Resource/GIFs/gifMa.gif rename to Manito/Manito/Resource/GIFs/gifMa.gif diff --git a/Manito/Manito/Global/Resource/GIFs/gifNi.gif b/Manito/Manito/Resource/GIFs/gifNi.gif similarity index 100% rename from Manito/Manito/Global/Resource/GIFs/gifNi.gif rename to Manito/Manito/Resource/GIFs/gifNi.gif diff --git a/Manito/Manito/Global/Resource/GIFs/gifTto.gif b/Manito/Manito/Resource/GIFs/gifTto.gif similarity index 100% rename from Manito/Manito/Global/Resource/GIFs/gifTto.gif rename to Manito/Manito/Resource/GIFs/gifTto.gif diff --git a/Manito/Manito/Global/Resource/GIFs/joystick.gif b/Manito/Manito/Resource/GIFs/joystick.gif similarity index 100% rename from Manito/Manito/Global/Resource/GIFs/joystick.gif rename to Manito/Manito/Resource/GIFs/joystick.gif diff --git a/Manito/Manito/Global/Resource/GIFs/logo.gif b/Manito/Manito/Resource/GIFs/logo.gif similarity index 100% rename from Manito/Manito/Global/Resource/GIFs/logo.gif rename to Manito/Manito/Resource/GIFs/logo.gif diff --git a/Manito/Manito/Global/Resource/Storyboards/Base.lproj/LaunchScreen.storyboard b/Manito/Manito/Resource/Storyboards/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from Manito/Manito/Global/Resource/Storyboards/Base.lproj/LaunchScreen.storyboard rename to Manito/Manito/Resource/Storyboards/Base.lproj/LaunchScreen.storyboard diff --git a/Manito/Manito/Global/Resource/Storyboards/Base.lproj/Main.storyboard b/Manito/Manito/Resource/Storyboards/Base.lproj/Main.storyboard similarity index 100% rename from Manito/Manito/Global/Resource/Storyboards/Base.lproj/Main.storyboard rename to Manito/Manito/Resource/Storyboards/Base.lproj/Main.storyboard diff --git a/Manito/Manito/Global/Resource/Storyboards/DetailIng.storyboard b/Manito/Manito/Resource/Storyboards/DetailIng.storyboard similarity index 100% rename from Manito/Manito/Global/Resource/Storyboards/DetailIng.storyboard rename to Manito/Manito/Resource/Storyboards/DetailIng.storyboard diff --git a/Manito/Manito/Global/Resource/Storyboards/Splash.storyboard b/Manito/Manito/Resource/Storyboards/Splash.storyboard similarity index 100% rename from Manito/Manito/Global/Resource/Storyboards/Splash.storyboard rename to Manito/Manito/Resource/Storyboards/Splash.storyboard From 5eca782d9645863075b1f7a75dc5545ecbb2dd41 Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Thu, 7 Sep 2023 11:55:10 +0900 Subject: [PATCH 464/468] =?UTF-8?q?[MOVE]=20Error=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=EC=9D=84=20Presentation=20=EB=82=B4=EB=B6=80=EC=9D=98=20Error?= =?UTF-8?q?=20=ED=8C=8C=EC=9D=BC=EB=A1=9C=20=EC=9D=B4=EB=8F=99(#518)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 50 +++++++------------ .../Error}/LetterScene/LetterImageError.swift | 0 2 files changed, 17 insertions(+), 33 deletions(-) rename Manito/Manito/{Global/Error/Presentation => Presentation/Error}/LetterScene/LetterImageError.swift (100%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 9634f1479..5bdd16a13 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -724,30 +724,6 @@ path = Views; sourceTree = ""; }; - B54741E529A4945100B75BA3 /* Error */ = { - isa = PBXGroup; - children = ( - B54741E629A4945A00B75BA3 /* Presentation */, - ); - path = Error; - sourceTree = ""; - }; - B54741E629A4945A00B75BA3 /* Presentation */ = { - isa = PBXGroup; - children = ( - B54741E729A4947C00B75BA3 /* LetterScene */, - ); - path = Presentation; - sourceTree = ""; - }; - B54741E729A4947C00B75BA3 /* LetterScene */ = { - isa = PBXGroup; - children = ( - B54741E929A494E200B75BA3 /* LetterImageError.swift */, - ); - path = LetterScene; - sourceTree = ""; - }; B54B72A12AA3616600D60E4B /* App */ = { isa = PBXGroup; children = ( @@ -799,6 +775,22 @@ path = Resource; sourceTree = ""; }; + B55469C62AA97273004D9FE6 /* Error */ = { + isa = PBXGroup; + children = ( + B55469C72AA9727D004D9FE6 /* LetterScene */, + ); + path = Error; + sourceTree = ""; + }; + B55469C72AA9727D004D9FE6 /* LetterScene */ = { + isa = PBXGroup; + children = ( + B54741E929A494E200B75BA3 /* LetterImageError.swift */, + ); + path = LetterScene; + sourceTree = ""; + }; B57CB3022A763BB200474042 /* Packages */ = { isa = PBXGroup; children = ( @@ -811,6 +803,7 @@ isa = PBXGroup; children = ( B5C7FBE62AA75B9C00862021 /* Common */, + B55469C62AA97273004D9FE6 /* Error */, B58CA3052A9CC37000977592 /* Scene */, ); path = Presentation; @@ -1116,7 +1109,6 @@ B5A085E72A97302900C8A98D /* Domain */, B53A35B82A9640EB00B720BC /* Data */, B5F524E328519AC300614FF7 /* Screens */, - B5F524E428519AC600614FF7 /* Global */, B5C7FC022AA886F300862021 /* Util */, B53A35B22A9630FE00B720BC /* Service */, B55469C02AA970DF004D9FE6 /* Resource */, @@ -1146,14 +1138,6 @@ path = Screens; sourceTree = ""; }; - B5F524E428519AC600614FF7 /* Global */ = { - isa = PBXGroup; - children = ( - B54741E529A4945100B75BA3 /* Error */, - ); - path = Global; - sourceTree = ""; - }; B5F524E528519ACA00614FF7 /* CreateRoom */ = { isa = PBXGroup; children = ( diff --git a/Manito/Manito/Global/Error/Presentation/LetterScene/LetterImageError.swift b/Manito/Manito/Presentation/Error/LetterScene/LetterImageError.swift similarity index 100% rename from Manito/Manito/Global/Error/Presentation/LetterScene/LetterImageError.swift rename to Manito/Manito/Presentation/Error/LetterScene/LetterImageError.swift From 9673a1e1111bac7bf496a1674d0b8bdcd66a282d Mon Sep 17 00:00:00 2001 From: YoonAh-dev Date: Fri, 8 Sep 2023 13:15:21 +0900 Subject: [PATCH 465/468] =?UTF-8?q?[CHORE]=20Size=20=EB=A6=AC=ED=84=B0?= =?UTF-8?q?=EB=84=90=20=ED=8C=8C=EC=9D=BC=20=EC=9D=B4=EB=A6=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95(#516)=5F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito.xcodeproj/project.pbxproj | 8 ++++---- .../Manito/Util/Literal/{Size.swift => SizeLiteral.swift} | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) rename Manito/Manito/Util/Literal/{Size.swift => SizeLiteral.swift} (86%) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 7b4786f68..44cd896c9 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -19,7 +19,7 @@ 3915D54B2A7516A2002D6C25 /* Key.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3915D54A2A7516A2002D6C25 /* Key.plist */; }; 3915D54D2A7516E9002D6C25 /* Key+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */; }; 391612D829E9231B004AE982 /* DetailWaitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391612D729E9231B004AE982 /* DetailWaitView.swift */; }; - 391B3003286198C200421F1D /* Size.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391B3002286198C200421F1D /* Size.swift */; }; + 391B3003286198C200421F1D /* SizeLiteral.swift in Sources */ = {isa = PBXBuildFile; fileRef = 391B3002286198C200421F1D /* SizeLiteral.swift */; }; 392EC77E2855C388006918A9 /* SettingButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392EC77D2855C388006918A9 /* SettingButton.swift */; }; 392EC7812855D17D006918A9 /* DetailWaitTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 392EC7802855D17D006918A9 /* DetailWaitTitleView.swift */; }; 395B5BC22A25E20000CE1420 /* DetailWaitViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */; }; @@ -228,7 +228,7 @@ 3915D54A2A7516A2002D6C25 /* Key.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Key.plist; sourceTree = ""; }; 3915D54C2A7516E9002D6C25 /* Key+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Key+Extension.swift"; sourceTree = ""; }; 391612D729E9231B004AE982 /* DetailWaitView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitView.swift; sourceTree = ""; }; - 391B3002286198C200421F1D /* Size.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Size.swift; sourceTree = ""; }; + 391B3002286198C200421F1D /* SizeLiteral.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SizeLiteral.swift; sourceTree = ""; }; 392EC77D2855C388006918A9 /* SettingButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingButton.swift; sourceTree = ""; }; 392EC7802855D17D006918A9 /* DetailWaitTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitTitleView.swift; sourceTree = ""; }; 395B5BC12A25E20000CE1420 /* DetailWaitViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailWaitViewModel.swift; sourceTree = ""; }; @@ -974,7 +974,7 @@ isa = PBXGroup; children = ( B5F5250028519EFB00614FF7 /* ImageLiteral.swift */, - 391B3002286198C200421F1D /* Size.swift */, + 391B3002286198C200421F1D /* SizeLiteral.swift */, 7E15F67D28B35B3D00441305 /* TextLiteral.swift */, D777D2C828C7780E008655BD /* URLLiteral.swift */, ); @@ -1726,7 +1726,7 @@ B5F524FF28519EF300614FF7 /* UIFont+Extension.swift in Sources */, D777D2C928C7780E008655BD /* URLLiteral.swift in Sources */, D7B83FD62A95A48700BFD8FF /* CreateRoomService.swift in Sources */, - 391B3003286198C200421F1D /* Size.swift in Sources */, + 391B3003286198C200421F1D /* SizeLiteral.swift in Sources */, B55BCEB428D8449E00AF7E45 /* MemoryCollectionViewCell.swift in Sources */, B5F525262851A26D00614FF7 /* NSObject+ClassName.swift in Sources */, 3904F4FA2AA36F4F00B6264F /* UserInfo.swift in Sources */, diff --git a/Manito/Manito/Util/Literal/Size.swift b/Manito/Manito/Util/Literal/SizeLiteral.swift similarity index 86% rename from Manito/Manito/Util/Literal/Size.swift rename to Manito/Manito/Util/Literal/SizeLiteral.swift index 90aaa9aef..fa7543607 100644 --- a/Manito/Manito/Util/Literal/Size.swift +++ b/Manito/Manito/Util/Literal/SizeLiteral.swift @@ -1,5 +1,5 @@ // -// ValueLiteral.swift +// SizeLiteral.swift // Manito // // Created by Mingwan Choi on 2022/06/21. From fee3af11e90e689049b494aa914c48937b164845 Mon Sep 17 00:00:00 2001 From: chemi Date: Sat, 9 Sep 2023 17:57:40 +0900 Subject: [PATCH 466/468] =?UTF-8?q?[CHORE]=20CurrentValueSubject=EB=A1=9C?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20(#525)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screens/ChooseCharacter/View/ChooseCharacterView.swift | 2 +- .../CreateRoom/UIComponent/CharacterCollectionView.swift | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift b/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift index fa1f32697..afd2d7640 100644 --- a/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift +++ b/Manito/Manito/Screens/ChooseCharacter/View/ChooseCharacterView.swift @@ -110,7 +110,7 @@ final class ChooseCharacterView: UIView, BaseViewType { self?.delegate?.closeButtonDidTap() } let didTapJoinButton = UIAction { [weak self] _ in - self?.delegate?.joinButtonDidTap(characterIndex: self?.manittoCollectionView.characterIndex ?? 0) + self?.delegate?.joinButtonDidTap(characterIndex: self?.manittoCollectionView.characterIndexTapPublisher.value ?? 0) } self.backButton.addAction(didTapBackButton, for: .touchUpInside) diff --git a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift index 685d18de0..954be5495 100644 --- a/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift +++ b/Manito/Manito/Screens/CreateRoom/UIComponent/CharacterCollectionView.swift @@ -45,9 +45,8 @@ final class CharacterCollectionView: UIView { }() // MARK: - property - // FIXME: characterIndex 삭제예정 - private(set) var characterIndex: Int = 0 - let characterIndexTapPublisher = PassthroughSubject() + + let characterIndexTapPublisher = CurrentValueSubject(0) // MARK: - init From 9371c9f7aa6767970e54ec8a7baf76f99a0dca63 Mon Sep 17 00:00:00 2001 From: chemi Date: Mon, 11 Sep 2023 14:37:48 +0900 Subject: [PATCH 467/468] [CHORE] v1.6.0_6 --- Manito/Manito.xcodeproj/project.pbxproj | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 4fe65c2e7..409e48210 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -1664,11 +1664,9 @@ 7E3058C62854B47F00489E6A /* InputTitleView.swift in Sources */, B5F5250128519EFB00614FF7 /* ImageLiteral.swift in Sources */, 39F1C12E28D756E600585B83 /* LetterImageViewController.swift in Sources */, - B55469DF2AAAD82D004D9FE6 /* BaseViewController.swift in Sources */, 7E7542B32923744300D725CB /* ToastPopupView.swift in Sources */, D71939592AA2343E00A73D6C /* NicknameView.swift in Sources */, B5A085FE2A97493900C8A98D /* UserInfoDTO.swift in Sources */, - B55469E12AAAD84F004D9FE6 /* Character.swift in Sources */, 39C957D22879523200A04A2B /* Date+Extension.swift in Sources */, B55469B62AA96F54004D9FE6 /* Character.swift in Sources */, B53A35C82A96F84700B720BC /* LetterRepository.swift in Sources */, @@ -1795,7 +1793,6 @@ CB5AE3E4285AAF7400382EA3 /* RoomInfoView.swift in Sources */, B5FEE9DD28C849B400DEA07E /* UIImageView+Cache.swift in Sources */, CB9592B22855C09A00847751 /* ManitoRoomCollectionCell.swift in Sources */, - B55469DE2AAAD82D004D9FE6 /* BaseViewModelType.swift in Sources */, D70220232A7A22EC0024BACD /* CreateRoomView.swift in Sources */, B5AE11F429D32EE700F86FF8 /* SelectManitteeView.swift in Sources */, B5A085E12A972D7900C8A98D /* LoginRequestDTO.swift in Sources */, @@ -2009,7 +2006,7 @@ CODE_SIGN_ENTITLEMENTS = Manito/App/Manito.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = HF8GHZB58X; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Manito/App/Info.plist; @@ -2028,7 +2025,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.5.0; + MARKETING_VERSION = 1.6.0; OTHER_SWIFT_FLAGS = "-DDEV"; PRODUCT_BUNDLE_IDENTIFIER = com.TeamFirefighter.Manito; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2049,7 +2046,7 @@ CODE_SIGN_ENTITLEMENTS = Manito/App/Manito.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = HF8GHZB58X; ENABLE_TESTABILITY = YES; GENERATE_INFOPLIST_FILE = YES; @@ -2069,7 +2066,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.5.0; + MARKETING_VERSION = 1.6.0; OTHER_SWIFT_FLAGS = "-DPROD"; PRODUCT_BUNDLE_IDENTIFIER = com.TeamFirefighter.Manito; PRODUCT_NAME = "$(TARGET_NAME)"; From 82fd5586c19d83d10e97644691eb4ec349d3e849 Mon Sep 17 00:00:00 2001 From: chemi Date: Tue, 12 Sep 2023 14:02:59 +0900 Subject: [PATCH 468/468] [CHORE] v1.6.0_7 --- Manito/Manito.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Manito/Manito.xcodeproj/project.pbxproj b/Manito/Manito.xcodeproj/project.pbxproj index 409e48210..75a21934e 100644 --- a/Manito/Manito.xcodeproj/project.pbxproj +++ b/Manito/Manito.xcodeproj/project.pbxproj @@ -2006,7 +2006,7 @@ CODE_SIGN_ENTITLEMENTS = Manito/App/Manito.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 7; DEVELOPMENT_TEAM = HF8GHZB58X; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = Manito/App/Info.plist; @@ -2046,7 +2046,7 @@ CODE_SIGN_ENTITLEMENTS = Manito/App/Manito.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 6; + CURRENT_PROJECT_VERSION = 7; DEVELOPMENT_TEAM = HF8GHZB58X; ENABLE_TESTABILITY = YES; GENERATE_INFOPLIST_FILE = YES;