Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sjk4618 committed Jul 21, 2023
2 parents 4ccf459 + 5d1e9bb commit 0dcbc33
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 27 deletions.
4 changes: 4 additions & 0 deletions LionHeart-iOS/LionHeart-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -305,6 +306,7 @@
B5C6A2BD2A5DE6590021BE5E /* GeneralTitleTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralTitleTableViewCell.swift; sourceTree = "<group>"; };
B5C6A2C12A5DEA1B0021BE5E /* CopyRightTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CopyRightTableViewCell.swift; sourceTree = "<group>"; };
B5C6A2C72A5EF4EB0021BE5E /* ArticleDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleDetail.swift; sourceTree = "<group>"; };
B5F323E82A6A8F0000047869 /* CurriculumWeekBackgroundDummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurriculumWeekBackgroundDummy.swift; sourceTree = "<group>"; };
C00780B62A5FFE0E0043EB36 /* UILabel+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UILabel+.swift"; sourceTree = "<group>"; };
C00780B92A60149D0043EB36 /* LHTodayArticleTitle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LHTodayArticleTitle.swift; sourceTree = "<group>"; };
C06E381A2A65346700B00600 /* UserDefaultToken.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultToken.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1360,6 +1362,7 @@
children = (
F4490C062A5CEEA300A6D9D7 /* CurriculumDummyData.swift */,
F4DB30AF2A611C9700413EB9 /* CurriculumListByWeekData.swift */,
B5F323E82A6A8F0000047869 /* CurriculumWeekBackgroundDummy.swift */,
);
path = Model;
sourceTree = "<group>";
Expand Down Expand Up @@ -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 */,
Expand Down
6 changes: 3 additions & 3 deletions LionHeart-iOS/LionHeart-iOS/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

extension AppDelegate: MessagingDelegate {
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
// guard let fcmToken else { return }
guard let fcmToken else { return }
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)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extension LHToastView {

self.addSubview(messageLabel)
self.snp.makeConstraints { make in
make.height.equalTo(700)
make.height.equalTo(50)
}
self.messageLabel.snp.makeConstraints { make in
make.center.equalToSuperview()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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() {
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -52,6 +50,7 @@ final class ArticleDetailViewController: UIViewController {

public override func viewDidLoad() {
super.viewDidLoad()
setStyle()
setUI()
setHierarchy()
setLayout()
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protocol CurriculumTableViewToggleButtonTappedProtocol: AnyObject {
}

final class CurriculumTableViewCell: UITableViewCell, TableViewCellRegisterDequeueProtocol {

weak var delegate: CurriculumTableViewToggleButtonTappedProtocol?

var cellIndexPath: IndexPath?
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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)



]

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,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
}

Expand Down Expand Up @@ -265,15 +268,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)

}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<br><br>
## 🍎 LionHeart-iOS Developers
<img src="https://github.com/gosopt-LionHeart/LionHeart-iOS/assets/113027703/61596b76-5a50-4b29-9d0b-b62bb6a86b8f" width="175"> | <img src="https://github.com/gosopt-LionHeart/LionHeart-iOS/assets/113027703/2bfbb1fe-2c2a-42b2-a589-cdd01b113e30" width="175"> | <img src="https://github.com/gosopt-LionHeart/LionHeart-iOS/assets/113027703/57f07e0c-ce1e-406f-b9cd-b49edc8d7485" width="175"> | <img src="https://github.com/gosopt-LionHeart/LionHeart-iOS/assets/113027703/4d70bfae-0ef8-4388-8d5b-a734a0a10184" width="175"> |<img src="https://github.com/gosopt-LionHeart/LionHeart-iOS/assets/113027703/1423bb08-4f33-41b9-8caa-56432794ecca" width="175"> |
<img src="https://github.com/gosopt-LionHeart/LionHeart-iOS/assets/113027703/61596b76-5a50-4b29-9d0b-b62bb6a86b8f" width="165"> | <img src="https://github.com/gosopt-LionHeart/LionHeart-iOS/assets/113027703/2bfbb1fe-2c2a-42b2-a589-cdd01b113e30" width="165"> | <img src="https://github.com/gosopt-LionHeart/LionHeart-iOS/assets/113027703/57f07e0c-ce1e-406f-b9cd-b49edc8d7485" width="165"> | <img src="https://github.com/gosopt-LionHeart/LionHeart-iOS/assets/113027703/4d70bfae-0ef8-4388-8d5b-a734a0a10184" width="165"> |<img src="https://github.com/gosopt-LionHeart/LionHeart-iOS/assets/113027703/1423bb08-4f33-41b9-8caa-56432794ecca" width="165"> |
:---------:|:----------:|:---------:|:---------:|:---------:|
김민재 | 김의성 | 김동현 | 곽성준 | 황찬미 |
[ffalswo2](https://github.com/ffalswo2) | [kimscastle](https://github.com/kimscastle) | [BrickSky](https://github.com/BrickSky) | [sjk4618](https://github.com/sjk4618) |[cchanmi](https://github.com/cchanmi) |
Expand Down

0 comments on commit 0dcbc33

Please sign in to comment.