diff --git a/LionHeart-iOS/LionHeart-iOS.xcodeproj/project.pbxproj b/LionHeart-iOS/LionHeart-iOS.xcodeproj/project.pbxproj index 3bea3fec..0cd7f7b0 100644 --- a/LionHeart-iOS/LionHeart-iOS.xcodeproj/project.pbxproj +++ b/LionHeart-iOS/LionHeart-iOS.xcodeproj/project.pbxproj @@ -98,6 +98,7 @@ B5C6A2BE2A5DE6590021BE5E /* GeneralTitleTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C6A2BD2A5DE6590021BE5E /* GeneralTitleTableViewCell.swift */; }; B5C6A2C22A5DEA1B0021BE5E /* CopyRightTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C6A2C12A5DEA1B0021BE5E /* CopyRightTableViewCell.swift */; }; B5C6A2C82A5EF4EB0021BE5E /* ArticleDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C6A2C72A5EF4EB0021BE5E /* ArticleDetail.swift */; }; + B5F323E92A6A8F0000047869 /* CurriculumWeekBackgroundDummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5F323E82A6A8F0000047869 /* CurriculumWeekBackgroundDummy.swift */; }; C00780B72A5FFE0E0043EB36 /* UILabel+.swift in Sources */ = {isa = PBXBuildFile; fileRef = C00780B62A5FFE0E0043EB36 /* UILabel+.swift */; }; C00780BA2A60149D0043EB36 /* LHTodayArticleTitle.swift in Sources */ = {isa = PBXBuildFile; fileRef = C00780B92A60149D0043EB36 /* LHTodayArticleTitle.swift */; }; C06E381B2A65346700B00600 /* UserDefaultToken.swift in Sources */ = {isa = PBXBuildFile; fileRef = C06E381A2A65346700B00600 /* UserDefaultToken.swift */; }; @@ -305,6 +306,7 @@ B5C6A2BD2A5DE6590021BE5E /* GeneralTitleTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralTitleTableViewCell.swift; sourceTree = ""; }; B5C6A2C12A5DEA1B0021BE5E /* CopyRightTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CopyRightTableViewCell.swift; sourceTree = ""; }; B5C6A2C72A5EF4EB0021BE5E /* ArticleDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleDetail.swift; sourceTree = ""; }; + B5F323E82A6A8F0000047869 /* CurriculumWeekBackgroundDummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurriculumWeekBackgroundDummy.swift; sourceTree = ""; }; C00780B62A5FFE0E0043EB36 /* UILabel+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UILabel+.swift"; sourceTree = ""; }; C00780B92A60149D0043EB36 /* LHTodayArticleTitle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LHTodayArticleTitle.swift; sourceTree = ""; }; C06E381A2A65346700B00600 /* UserDefaultToken.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultToken.swift; sourceTree = ""; }; @@ -1360,6 +1362,7 @@ children = ( F4490C062A5CEEA300A6D9D7 /* CurriculumDummyData.swift */, F4DB30AF2A611C9700413EB9 /* CurriculumListByWeekData.swift */, + B5F323E82A6A8F0000047869 /* CurriculumWeekBackgroundDummy.swift */, ); path = Model; sourceTree = ""; @@ -1589,6 +1592,7 @@ B59892EC2A5B94E100CE1FEB /* UIApplication+.swift in Sources */, 4AE19A172A65864F00C1DB7E /* BookmarkService.swift in Sources */, 4AE19A1A2A65886100C1DB7E /* BookmarkReponse.swift in Sources */, + B5F323E92A6A8F0000047869 /* CurriculumWeekBackgroundDummy.swift in Sources */, C0DF039F2A5CABC10037F740 /* GetPregnancyViewController.swift in Sources */, C0DF035F2A5A9C330037F740 /* ArticleListByWeekViewController.swift in Sources */, F4DB30BC2A61691F00413EB9 /* CurriculumArticleByWeekRowZeroTableViewCell.swift in Sources */, diff --git a/LionHeart-iOS/LionHeart-iOS/Application/AppDelegate.swift b/LionHeart-iOS/LionHeart-iOS/Application/AppDelegate.swift index 50dfea1e..d41a7f3a 100644 --- a/LionHeart-iOS/LionHeart-iOS/Application/AppDelegate.swift +++ b/LionHeart-iOS/LionHeart-iOS/Application/AppDelegate.swift @@ -63,8 +63,8 @@ extension AppDelegate: MessagingDelegate { print("✅✅✅✅✅✅✅✅✅✅✅✅✅fcmToken받아오기 성공✅✅✅✅✅✅✅✅✅✅✅✅✅✅") print("fcmToken: ", fcmToken) - var refeshToken = UserDefaultsManager.tokenKey?.refreshToken - var accessToken = UserDefaultsManager.tokenKey?.accessToken + let refeshToken = UserDefaultsManager.tokenKey?.refreshToken + let accessToken = UserDefaultsManager.tokenKey?.accessToken UserDefaultsManager.tokenKey = UserDefaultToken(refreshToken: refeshToken, accessToken: accessToken, fcmToken: fcmToken) } } diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Article/ArticleDetail/Cells/ThumnailTableViewCell.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Article/ArticleDetail/Cells/ThumnailTableViewCell.swift index 5e4e80bd..4eb6a47f 100644 --- a/LionHeart-iOS/LionHeart-iOS/Scenes/Article/ArticleDetail/Cells/ThumnailTableViewCell.swift +++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Article/ArticleDetail/Cells/ThumnailTableViewCell.swift @@ -25,6 +25,12 @@ final class ThumnailTableViewCell: UITableViewCell, TableViewCellRegisterDequeue return imageView }() + let gradientImageView: UIImageView = { + let imageView = UIImageView() + imageView.image = ImageLiterals.Curriculum.gradient + return imageView + }() + private let imageCaptionLabel: UILabel = { let label = UILabel() label.font = .pretendard(.body4) @@ -67,12 +73,17 @@ final class ThumnailTableViewCell: UITableViewCell, TableViewCellRegisterDequeue required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + override func prepareForReuse() { + self.thumbnailImageView.image = nil + } } private extension ThumnailTableViewCell { func setHierarchy() { contentView.addSubviews(thumbnailImageView, imageCaptionLabel, bookMarkButton) + thumbnailImageView.addSubview(gradientImageView) } func setLayout() { @@ -82,6 +93,11 @@ private extension ThumnailTableViewCell { make.height.equalTo(thumbnailImageView.snp.width).multipliedBy(Size.thumbnailWidthHeightRatio) } + gradientImageView.snp.makeConstraints { make in + make.top.equalToSuperview() + make.leading.trailing.equalToSuperview() + } + imageCaptionLabel.snp.makeConstraints { make in make.top.equalTo(thumbnailImageView.snp.bottom).offset(12) make.centerX.equalTo(thumbnailImageView) diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Article/ArticleDetail/ViewControllers/ArticleDetailViewController.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Article/ArticleDetail/ViewControllers/ArticleDetailViewController.swift index cffd55d7..26a9888e 100644 --- a/LionHeart-iOS/LionHeart-iOS/Scenes/Article/ArticleDetail/ViewControllers/ArticleDetailViewController.swift +++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Article/ArticleDetail/ViewControllers/ArticleDetailViewController.swift @@ -18,8 +18,6 @@ final class ArticleDetailViewController: UIViewController { private var progressBar = LHProgressView() private let articleTableView = ArticleDetailTableView() - - private let loadingIndicatorView = LHLoadingView() private lazy var scrollToTopButton: UIButton = { let button = UIButton() @@ -52,6 +50,7 @@ final class ArticleDetailViewController: UIViewController { public override func viewDidLoad() { super.viewDidLoad() + setStyle() setUI() setHierarchy() setLayout() @@ -118,6 +117,10 @@ extension ArticleDetailViewController: ViewControllerServiceable { // MARK: - UI & Layout private extension ArticleDetailViewController { + + func setStyle() { + self.view.backgroundColor = .designSystem(.background) + } func setUI() { view.backgroundColor = .designSystem(.background) diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Cells/CurriculumArticleByWeekRowZeroTableViewCell.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Cells/CurriculumArticleByWeekRowZeroTableViewCell.swift index 58a0bcf6..ef0b6d47 100644 --- a/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Cells/CurriculumArticleByWeekRowZeroTableViewCell.swift +++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Cells/CurriculumArticleByWeekRowZeroTableViewCell.swift @@ -11,20 +11,22 @@ import UIKit import SnapKit final class CurriculumArticleByWeekRowZeroTableViewCell: UITableViewCell, TableViewCellRegisterDequeueProtocol { - + var inputData: Int? { didSet { guard let inputData else { return } //inputData는 row가 0부터인데 주차정보는 4주차부터 시작이므로 +4를 해줌 + weekLabel.text = "\(inputData)주차" - + weekBackGroundImageView.image = WeekBackgroundImage.dummy()[inputData-4].weekBackgroundImage + } } private enum Size { static let weekBackGroundImageSize: CGFloat = 200 / 375 } - + private let weekBackGroundImageView: UIImageView = { let imageView = UIImageView() imageView.backgroundColor = .designSystem(.gray500) @@ -37,7 +39,7 @@ final class CurriculumArticleByWeekRowZeroTableViewCell: UITableViewCell, TableV button.setImage(ImageLiterals.Curriculum.arrowLeftWeek, for: .normal) button.addButtonAction { _ in - NotificationCenter.default.post(name: NSNotification.Name("leftButton"), + NotificationCenter.default.post(name: NSNotification.Name("leftButton"), object: nil) } return button @@ -72,7 +74,7 @@ final class CurriculumArticleByWeekRowZeroTableViewCell: UITableViewCell, TableV }() private let curriculumAndWeekStackView: UIStackView = { - let stackView = UIStackView() + let stackView = UIStackView() stackView.spacing = 2 stackView.distribution = .fill stackView.axis = .vertical diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Cells/CurriculumTableViewCell.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Cells/CurriculumTableViewCell.swift index e2a377c9..468ac471 100644 --- a/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Cells/CurriculumTableViewCell.swift +++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Cells/CurriculumTableViewCell.swift @@ -16,7 +16,7 @@ protocol CurriculumTableViewToggleButtonTappedProtocol: AnyObject { } final class CurriculumTableViewCell: UITableViewCell, TableViewCellRegisterDequeueProtocol { - + weak var delegate: CurriculumTableViewToggleButtonTappedProtocol? var cellIndexPath: IndexPath? @@ -78,9 +78,10 @@ final class CurriculumTableViewCell: UITableViewCell, TableViewCellRegisterDeque return line }() - private lazy var curriculumToggleDirectionButton: UIButton = { + lazy var curriculumToggleDirectionButton: UIButton = { var button = UIButton() button.setImage(ImageLiterals.Curriculum.arrowDownSmall, for: .normal) + button.setImage(ImageLiterals.Curriculum.arrowUpSmall, for: .selected) button.setContentCompressionResistancePriority(.required, for: .horizontal) button.addButtonAction { _ in self.delegate?.toggleButtonTapped(indexPath: self.cellIndexPath) diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Model/CurriculumWeekBackgroundDummy.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Model/CurriculumWeekBackgroundDummy.swift new file mode 100644 index 00000000..4dbf73fe --- /dev/null +++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/Model/CurriculumWeekBackgroundDummy.swift @@ -0,0 +1,59 @@ +// +// CurriculumWeekBackgroundDummy.swift +// LionHeart-iOS +// +// Created by 김민재 on 2023/07/21. +// + +import UIKit + +struct WeekBackgroundImage: AppData { + let weekBackgroundImage: UIImage +} + +extension WeekBackgroundImage { + static func dummy() -> [WeekBackgroundImage] { + return [WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week4Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week5Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week6Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week7Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week8Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week9Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week10Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week11Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week12Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week13Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week14Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week15Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week16Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week17Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week18Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week19Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week20Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week21Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week22Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week23Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week24Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week25Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week26Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week27Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week28Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week29Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week30Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week31Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week32Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week33Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week34Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week35Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week36Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week37Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week38Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week39Image), + WeekBackgroundImage(weekBackgroundImage: ImageLiterals.Curriculum.week40Image) + + + + ] + + } +} diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/ViewControllers/CurriculumListByWeekViewController.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/ViewControllers/CurriculumListByWeekViewController.swift index df1462d4..4565c254 100644 --- a/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/ViewControllers/CurriculumListByWeekViewController.swift +++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/ViewControllers/CurriculumListByWeekViewController.swift @@ -154,8 +154,9 @@ private extension CurriculumListByWeekViewController { guard let indexPath = notification.userInfo?["bookmarkCellIndexPath"] as? Int else { return } guard let buttonSelected = notification.userInfo?["bookmarkButtonSelected"] as? Bool else { return } guard let listByWeekDatas else { return } - try await BookmarkService.shared.postBookmark(BookmarkRequest(articleId: listByWeekDatas.articleData[indexPath-1].articleId, - bookmarkStatus: buttonSelected)) + try await BookmarkService.shared.postBookmark( + BookmarkRequest(articleId: listByWeekDatas.articleData[indexPath].articleId, + bookmarkStatus: buttonSelected)) hideLoading() buttonSelected ? LHToast.show(message: "북마크가 추가되었습니다") : LHToast.show(message: "북마크가 해제되었습니다") } catch { @@ -182,7 +183,7 @@ private extension CurriculumListByWeekViewController { : currentPage + 1 guard let listByWeekDatas else { return } - let nextPage = min(listByWeekDatas.articleData.count - 1, nextIndexPathItem) + let nextPage = min(pregnancy - 1, nextIndexPathItem) self.currentPage = nextPage } diff --git a/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/ViewControllers/CurriculumViewController.swift b/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/ViewControllers/CurriculumViewController.swift index 7ba9112f..dbdd1c0e 100644 --- a/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/ViewControllers/CurriculumViewController.swift +++ b/LionHeart-iOS/LionHeart-iOS/Scenes/Curriculum/ViewControllers/CurriculumViewController.swift @@ -213,10 +213,13 @@ extension CurriculumViewController: UITableViewDataSource { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = CurriculumTableViewCell.dequeueReusableCell(to: tableView) - cell.inputData = curriculumViewDatas[indexPath.section].weekDatas[indexPath.row] + let data = curriculumViewDatas[indexPath.section].weekDatas[indexPath.row] + cell.inputData = data cell.selectionStyle = .none cell.delegate = self cell.cellIndexPath = indexPath + + cell.curriculumToggleDirectionButton.isSelected = data.isExpanded return cell } @@ -253,15 +256,7 @@ extension CurriculumViewController: UITableViewDataSource { } let listByWeekVC = CurriculumListByWeekViewController() - - - if indexPath.section == curriculumViewDatas.count - 1 { - listByWeekVC.weekToIndexPathItem = (indexPath.section * 4) + indexPath.row + 1 - - } else { - listByWeekVC.weekToIndexPathItem = (indexPath.section * 4) + indexPath.row - } - + listByWeekVC.weekToIndexPathItem = (indexPath.section * 4) + indexPath.row self.navigationController?.pushViewController(listByWeekVC, animated: true) }