diff --git a/SobokSobok/SobokSobok.xcodeproj/project.pbxproj b/SobokSobok/SobokSobok.xcodeproj/project.pbxproj index a8bebd55..169a5b15 100644 --- a/SobokSobok/SobokSobok.xcodeproj/project.pbxproj +++ b/SobokSobok/SobokSobok.xcodeproj/project.pbxproj @@ -186,6 +186,7 @@ EC4BF2EF27C0BD5700B28F90 /* ButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC4BF2EE27C0BD5700B28F90 /* ButtonViewController.swift */; }; EC4BF2F127C0BEAC00B28F90 /* ButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC4BF2F027C0BEAC00B28F90 /* ButtonView.swift */; }; EC51A41A27D4AC9E00BB01AF /* PillPeriodViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC51A41927D4AC9E00BB01AF /* PillPeriodViewController.swift */; }; + EC63638A2935CE9400D3C600 /* NoticeListCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC6363892935CE9400D3C600 /* NoticeListCollectionViewCell.swift */; }; EC63A21327D37FDA006EBED7 /* PillDayTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC63A21227D37FDA006EBED7 /* PillDayTableViewCell.swift */; }; EC666A8D28855C630089A4CA /* BaseProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC666A8C28855C630089A4CA /* BaseProtocol.swift */; }; EC7E85BF28B7BAE200AF1A65 /* PillEditEndPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC7E85BE28B7BAE100AF1A65 /* PillEditEndPoint.swift */; }; @@ -259,7 +260,6 @@ F61CDD5C28B8D46F00D6BBCC /* EditFriendNameViewController+Network.swift in Sources */ = {isa = PBXBuildFile; fileRef = F61CDD5B28B8D46F00D6BBCC /* EditFriendNameViewController+Network.swift */; }; F635EEA427C55A07009B9246 /* NoticeAlertController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F635EEA327C55A07009B9246 /* NoticeAlertController.swift */; }; F635EEAB27C78B72009B9246 /* PillInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F635EEAA27C78B72009B9246 /* PillInfoView.swift */; }; - F638460228648EB000F60A9F /* NoticeListCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F638460128648EB000F60A9F /* NoticeListCollectionViewCell.swift */; }; F6494F312795AECC00F43A94 /* SendStickerPopUpViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6494F2F2795AECC00F43A94 /* SendStickerPopUpViewController.swift */; }; F6494F322795AECC00F43A94 /* SendStickerPopUpViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6494F302795AECC00F43A94 /* SendStickerPopUpViewController.xib */; }; F6538FA8278D814900B20B5E /* PillInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6538FA6278D814900B20B5E /* PillInfoViewController.swift */; }; @@ -458,6 +458,7 @@ EC4BF2EE27C0BD5700B28F90 /* ButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonViewController.swift; sourceTree = ""; }; EC4BF2F027C0BEAC00B28F90 /* ButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonView.swift; sourceTree = ""; }; EC51A41927D4AC9E00BB01AF /* PillPeriodViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PillPeriodViewController.swift; sourceTree = ""; }; + EC6363892935CE9400D3C600 /* NoticeListCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeListCollectionViewCell.swift; sourceTree = ""; }; EC63A21227D37FDA006EBED7 /* PillDayTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PillDayTableViewCell.swift; sourceTree = ""; }; EC666A8C28855C630089A4CA /* BaseProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseProtocol.swift; sourceTree = ""; }; EC7E85BE28B7BAE100AF1A65 /* PillEditEndPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PillEditEndPoint.swift; sourceTree = ""; }; @@ -530,7 +531,6 @@ F61CDD5B28B8D46F00D6BBCC /* EditFriendNameViewController+Network.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "EditFriendNameViewController+Network.swift"; sourceTree = ""; }; F635EEA327C55A07009B9246 /* NoticeAlertController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeAlertController.swift; sourceTree = ""; }; F635EEAA27C78B72009B9246 /* PillInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PillInfoView.swift; sourceTree = ""; }; - F638460128648EB000F60A9F /* NoticeListCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeListCollectionViewCell.swift; sourceTree = ""; }; F6494F2F2795AECC00F43A94 /* SendStickerPopUpViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SendStickerPopUpViewController.swift; sourceTree = ""; }; F6494F302795AECC00F43A94 /* SendStickerPopUpViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SendStickerPopUpViewController.xib; sourceTree = ""; }; F6538FA6278D814900B20B5E /* PillInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PillInfoViewController.swift; sourceTree = ""; }; @@ -1844,8 +1844,8 @@ children = ( F605027527BE18790010DEC8 /* EmptyView.swift */, F69516772890FF36000F88D7 /* NoticeListSection.swift */, - F638460128648EB000F60A9F /* NoticeListCollectionViewCell.swift */, F67798A928A0210900AAD2EF /* NoticeListCollectionViewCell+Interaction.swift */, + EC6363892935CE9400D3C600 /* NoticeListCollectionViewCell.swift */, ); path = Cell; sourceTree = ""; @@ -2096,8 +2096,6 @@ ECB97F3428AA36AC009C8637 /* StopPillView.swift in Sources */, ECCF5E6128A03F1A00BC6862 /* UITextField+Extension.swift in Sources */, F61CDD5228B8551700D6BBCC /* AccountManager.swift in Sources */, - F638460228648EB000F60A9F /* NoticeListCollectionViewCell.swift in Sources */, - F638460228648EB000F60A9F /* NoticeListCollectionViewCell.swift in Sources */, ECCF5E4D289CF1B700BC6862 /* SelectFriendViewModel.swift in Sources */, BD7120F6279722A50068B981 /* ShareAPI.swift in Sources */, BDF4D54128A018340043FA8D /* PillCount.swift in Sources */, @@ -2290,6 +2288,7 @@ ECAF4D29284F8D0000B12DA7 /* String+Extension.swift in Sources */, EC666A8D28855C630089A4CA /* BaseProtocol.swift in Sources */, BD382F6D286D9A6B002E91F0 /* ScheduleEndPoint.swift in Sources */, + EC63638A2935CE9400D3C600 /* NoticeListCollectionViewCell.swift in Sources */, EC7E85F228B9F7A900AF1A65 /* EditPillDateView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/SobokSobok/SobokSobok/Presentation/Notice/NoticeFirst/Views/Cell/NoticeListCollectionViewCell.swift b/SobokSobok/SobokSobok/Presentation/Notice/NoticeFirst/Views/Cell/NoticeListCollectionViewCell.swift new file mode 100644 index 00000000..4cd91f7b --- /dev/null +++ b/SobokSobok/SobokSobok/Presentation/Notice/NoticeFirst/Views/Cell/NoticeListCollectionViewCell.swift @@ -0,0 +1,197 @@ +// +// NoticeListCollectionViewCell.swift +// SobokSobok +// +// Created by 김승찬 on 2022/11/29. +// + +import UIKit + +import SnapKit +import Then + +final class NoticeListCollectionViewCell: UICollectionViewCell, NoticeListPresentable { + // MARK: - Properties + lazy var info: (() -> Void) = {} + lazy var accept: (() -> Void) = {} + lazy var refuse: (() -> Void) = {} + + var sectionType: SectionType = .pill { + didSet { + layoutIfNeeded() + } + } + var statusType: StatusType = .waite { + didSet { + layoutIfNeeded() + } + } + + // MARK: - UI Components + lazy var containerStackView = UIStackView().then { + $0.axis = .vertical + $0.distribution = .fill + } + private lazy var topStackView = UIStackView().then { + $0.axis = .horizontal + $0.distribution = .fill + $0.spacing = 10 + } + private lazy var iconImageView = UIImageView().then { + $0.contentMode = .scaleAspectFit + } + let nameLabel = UILabel().then { + $0.font = UIFont.font(.pretendardSemibold, ofSize: 18) + $0.textAlignment = .left + $0.textColor = Color.gray900 + } + let detailButton = UIButton().then { + $0.contentMode = .scaleAspectFit + $0.setImage(Image.icDetail16, for: .normal) + } + let toolTipView = SobokToolTipView( + tipContent: "친구가 보낸 약 알림 일정을 확인해보세요", + tipStartX: 184, tipWidth: 10, tipHeight: 6.2, + duration: 1.0).then { + $0.isHidden = true + } + private lazy var middleStackView = UIStackView().then { + $0.axis = .vertical + $0.distribution = .fill + } + private lazy var lineView = UIView().then { + $0.backgroundColor = Color.gray150 + } + let descriptionLabel = UILabel().then { + $0.font = UIFont.font(.pretendardMedium, ofSize: 14) + $0.lineBreakMode = .byCharWrapping + $0.numberOfLines = 2 + $0.textAlignment = .left + $0.textColor = Color.gray600 + } + let timeLabel = UILabel().then { + $0.font = UIFont.font(.pretendardMedium, ofSize: 12) + $0.textAlignment = .left + $0.textColor = Color.gray500 + } + private lazy var bottomStackView = UIStackView().then { + $0.axis = .horizontal + $0.distribution = .fillEqually + $0.spacing = 7 + } + let refuseButton = SobokButton(frame: .zero, mode: .lightMint, text: "거절", fontSize: 13) + let acceptButton = SobokButton(frame: .zero, mode: .mainMint, text: "수락", fontSize: 13) + + // MARK: - Initialization + override init(frame: CGRect) { + super.init(frame: frame) + + setupView(section: .pill, status: .waite) + setupConstraint() + + presentDetailView() + addAcceptAlert() + addRefuseAlert() + } + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError() + } + + // MARK: - Functions + func setupView(section: SectionType, status: StatusType) { + sectionType = section + statusType = status + divideSection() + + topStackView.addArrangedSubviews(iconImageView, nameLabel, detailButton) +// topStackView.bringSubviewToFront(toolTipView) + middleStackView.addArrangedSubviews(descriptionLabel, timeLabel) + bottomStackView.addArrangedSubviews(refuseButton, acceptButton) + containerStackView.addArrangedSubviews(topStackView, middleStackView, bottomStackView) + + contentView.addSubviews(lineView, containerStackView) + contentView.backgroundColor = Color.white + contentView.makeRounded(radius: 12) + + } + + func setupConstraint() { + containerStackView.snp.makeConstraints { + $0.edges.equalToSuperview().inset(18) + } + + // MARK: - top + topStackView.snp.makeConstraints { make in + make.height.equalTo(25.adjustedHeight) + } + iconImageView.snp.makeConstraints { make in + make.width.height.equalTo(22) + make.top.equalTo(topStackView.snp.top).offset(1.5) + make.leading.equalTo(topStackView.snp.leading) + } + nameLabel.snp.makeConstraints { make in + make.width.equalTo(156.adjustedWidth) + make.top.equalTo(topStackView.snp.top) + make.leading.equalTo(topStackView.snp.leading).inset(30) + } + detailButton.snp.makeConstraints { make in + make.width.equalTo(72.adjustedWidth) + make.top.equalTo(topStackView.snp.top) + make.leading.equalTo(topStackView.snp.leading).inset(217) + } + toolTipView.snp.makeConstraints { make in + make.width.equalTo(247.adjustedWidth) + make.height.equalTo(36.adjustedHeight) + make.top.equalTo(detailButton.snp.bottom).offset(1) + } + + // MARK: - middle + lineView.snp.makeConstraints { make in + make.height.equalTo(2.adjustedHeight) + make.top.equalTo(topStackView.snp.bottom).offset(18) + make.leading.trailing.equalTo(middleStackView) + } + middleStackView.snp.makeConstraints { make in + make.height.equalTo(50.adjustedHeight) + make.top.equalTo(lineView.snp.bottom).offset(8) + } + descriptionLabel.snp.makeConstraints { make in + make.height.equalTo(21.adjustedHeight) + make.top.equalTo(middleStackView.snp.top) + } + timeLabel.snp.makeConstraints { make in + make.height.equalTo(17) + make.top.equalTo(middleStackView.snp.top).offset(25) + } + + bottomStackView.snp.makeConstraints { + $0.height.equalTo(52.adjustedHeight) + } + refuseButton.snp.makeConstraints { make in + make.width.equalTo(146.adjustedWidth) + make.height.equalTo(40.adjustedHeight) + make.top.equalTo(bottomStackView.snp.top).offset(12) + } + } + + func divideSection() { + switch sectionType { + case .pill: + iconImageView.image = Image.icPillAlarm + detailButton.isHidden = false + case .calender: + iconImageView.image = Image.icShareAlarm + detailButton.isHidden = true + } + switch statusType { + case .waite: + descriptionLabel.textColor = Color.gray700 + [topStackView, lineView, bottomStackView].forEach { $0.isHidden = false } + case .done: + descriptionLabel.textColor = Color.gray600 + [topStackView, lineView, bottomStackView].forEach { $0.isHidden = true } + } + } +} + diff --git a/SobokSobok/SobokSobok/Presentation/Pill/Me/AddSuccessView.swift b/SobokSobok/SobokSobok/Presentation/Pill/Me/AddSuccessView.swift index e48a857d..fef6bc11 100644 --- a/SobokSobok/SobokSobok/Presentation/Pill/Me/AddSuccessView.swift +++ b/SobokSobok/SobokSobok/Presentation/Pill/Me/AddSuccessView.swift @@ -40,7 +40,9 @@ final class AddSuccessView: BaseView { override func setupConstraints() { backgroundView.snp.makeConstraints { - $0.edges.equalToSuperview() + $0.height.equalTo(166) + $0.width.equalTo(283) + $0.centerX.centerY.equalToSuperview() } successLabel.snp.makeConstraints { diff --git a/SobokSobok/SobokSobok/Presentation/Pill/Me/PillFirst/AddPill/View/ViewController/AddPillFirstViewController.swift b/SobokSobok/SobokSobok/Presentation/Pill/Me/PillFirst/AddPill/View/ViewController/AddPillFirstViewController.swift index 78e0e120..648a58b4 100644 --- a/SobokSobok/SobokSobok/Presentation/Pill/Me/PillFirst/AddPill/View/ViewController/AddPillFirstViewController.swift +++ b/SobokSobok/SobokSobok/Presentation/Pill/Me/PillFirst/AddPill/View/ViewController/AddPillFirstViewController.swift @@ -280,6 +280,8 @@ extension AddPillFirstViewController: UICollectionViewDelegate, UICollectionView if self.pillTimeViewModel.timeList.value.count == 1 { cell.deleteButton.isHidden = true + } else { + cell.deleteButton.isHidden = false } return cell