Skip to content

Commit

Permalink
[MERGE] 디자인팀 2차 QA(UI위주) (Team-LionHeart#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjk4618 authored Jul 21, 2023
2 parents 237c5a2 + 1be6ede commit c94570e
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ private extension ArticleListByCategoryViewController {
guard let indexPath = notification.userInfo?["bookmarkCellIndexPath"] as? Int else { return }
guard let buttonSelected = notification.userInfo?["bookmarkButtonSelected"] as? Bool else { return }

try await BookmarkService.shared.postBookmark(BookmarkRequest(articleId: articleListData[indexPath].articleId,
try await BookmarkService.shared.postBookmark(BookmarkRequest(articleId: articleListData[indexPath+1].articleId,
bookmarkStatus: buttonSelected))
buttonSelected ? LHToast.show(message: "북마크에 추가되었습니다") : LHToast.show(message: "북마크에 해제되었습니다")
buttonSelected ? LHToast.show(message: "북마크에 추가되었습니다", isTabBar: true) : LHToast.show(message: "북마크에 해제되었습니다", isTabBar: true)
} catch {
guard let error = error as? NetworkError else { return }
handleError(error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ final class BookmarkDetailCollectionViewCell: UICollectionViewCell, CollectionVi
return label
}()

var inputData: DummyModel? {
var inputData: BookmarkAppData? {
didSet {
/// action
guard let inputData else { return }
bookmarkDetailLabel.text = inputData.nickName + " 아빠님이\n보관한 아티클이에요"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ extension BookmarkViewController: UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if indexPath.section == 0 {
let cell = BookmarkDetailCollectionViewCell.dequeueReusableCell(to: collectionView, indexPath: indexPath)
cell.inputData = bookmarkAppData
return cell
} else {
let cell = BookmarkListCollectionViewCell.dequeueReusableCell(to: collectionView, indexPath: indexPath)
Expand Down Expand Up @@ -178,3 +179,9 @@ extension BookmarkViewController: UICollectionViewDelegateFlowLayout {
section == 1 ? 20 : CGFloat()
}
}

extension BookmarkViewController: UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
self.presentArticleDetailFullScreen(articleID: bookmarkList[indexPath.item].articleID)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ final class ChallengeDayCheckCollectionViewCollectionViewCell: UICollectionViewC
}
}

var whiteTextColor: UIColor? {
didSet {
countLabel.textColor = whiteTextColor
}
}

private let countLabel: UILabel = {
let label = UILabel()
label.textAlignment = .center
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ final class ChallengeViewController: UIViewController {
self.nicknameLabel.text = "\(babyNickname)아빠 님,"

if let howLongDay = inputData?.howLongDay {
self.challengeDayLabel.text = "\(howLongDay)일째 도전 중"
self.challengeDayLabel.text = "\(howLongDay)일째 도전 중"
}

self.levelBadge.image = BadgeLevel(rawValue: inputData?.daddyLevel ?? "")?.badgeImage
Expand Down Expand Up @@ -290,6 +290,7 @@ extension ChallengeViewController: UICollectionViewDataSource {
if indexPath.item < tags.count {
cell.inputString = tags[indexPath.item]
cell.backgroundColor = .designSystem(.background)
cell.whiteTextColor = .designSystem(.white)
} else {
cell.inputString = "\(indexPath.section + indexPath.row + 1)"
cell.backgroundColor = .designSystem(.gray1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ final class CurriculumArticleByWeekRowZeroTableViewCell: UITableViewCell, TableV
let imageView = UIImageView()
imageView.backgroundColor = .designSystem(.gray500)
imageView.isUserInteractionEnabled = true
imageView.contentMode = .scaleAspectFill
return imageView
}()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ final class CurriculumArticleByWeekTableViewCell: UITableViewCell, TableViewCell
button.setImage(ImageLiterals.BookMark.activeBookmarkSmall, for: .selected)
button.addButtonAction { _ in

let indexPath = self.getIndexPath()
guard var indexPath = self.getIndexPath() else { return }
NotificationCenter.default.post(name: NSNotification.Name("isArticleBookmarked"),
object: nil, userInfo: ["bookmarkCellIndexPath": indexPath?.row ?? 0,
object: nil, userInfo: ["bookmarkCellIndexPath": indexPath.row-1,
"bookmarkButtonSelected": !button.isSelected])
button.isSelected.toggle()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ extension CurriculumListByWeekCollectionViewCell: UITableViewDataSource{
if indexPath.row == 0 {

let cell = CurriculumArticleByWeekRowZeroTableViewCell.dequeueReusableCell(to: curriculumListByWeekTableView)
guard let weekCount else { return CurriculumTableViewCell() }
// guard let weekCount else { return CurriculumTableViewCell() }
cell.inputData = inputData?.week
return cell
} else {
Expand All @@ -129,7 +129,7 @@ extension CurriculumListByWeekCollectionViewCell: UITableViewDataSource{
} else {
guard let inputData else { return }
NotificationCenter.default.post(name: NSNotification.Name("didSelectTableViewCell"),
object: inputData.articleData[indexPath.row - 1].articleId)
object: inputData.articleData[indexPath.row-1].articleId)

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,19 @@ private extension CurriculumListByWeekViewController {
@objc func bookmarkButtonTapped(notification: NSNotification) {
Task {
do {

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 }


print(indexPath)
print(buttonSelected)
try await BookmarkService.shared.postBookmark(
BookmarkRequest(articleId: listByWeekDatas.articleData[indexPath].articleId,
bookmarkStatus: buttonSelected))
hideLoading()
buttonSelected ? LHToast.show(message: "북마크가 추가되었습니다") : LHToast.show(message: "북마크가 해제되었습니다")
buttonSelected ? LHToast.show(message: "북마크가 추가되었습니다", isTabBar: true) : LHToast.show(message: "북마크가 해제되었습니다", isTabBar: true)
} catch {
guard let error = error as? NetworkError else { return }
handleError(error)
Expand All @@ -182,7 +187,7 @@ private extension CurriculumListByWeekViewController {
? weekToIndexPathItem + 1
: currentPage + 1

guard let listByWeekDatas else { return }
// guard let listByWeekDatas else { return }
let nextPage = min(pregnancy - 1, nextIndexPathItem)
self.currentPage = nextPage
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,10 @@ extension CurriculumViewController: UITableViewDataSource {
}

extension CurriculumViewController: UITableViewDelegate{
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
// func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
// let curriculumListByWeekViewController = CurriculumListByWeekViewController()
// self.navigationController?.pushViewController(curriculumListByWeekViewController, animated: true)
}
// }
}

extension CurriculumViewController: ViewControllerServiceable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class LHTodayArticleTitle: UILabel {
var userNickName: String? {
didSet {
guard let userNickName else { return }
self.text = userNickName + ","
self.text = userNickName + " 아빠님,"
}
}

Expand Down

0 comments on commit c94570e

Please sign in to comment.