Skip to content

Commit

Permalink
Merge pull request #361 from team-yello/feat/#360
Browse files Browse the repository at this point in the history
Feat [#360] 3차 스프린트 건의사항 반영
  • Loading branch information
Heyjooo committed Mar 9, 2024
2 parents b059485 + 5d04df0 commit 5145a4b
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 35 deletions.
2 changes: 1 addition & 1 deletion YELLO-iOS/YELLO-iOS/Global/Literals/String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ enum StringLiterals {
}

enum Notification {
static let doNotSeeAgainLabel = "다시 보지 않기"
static let doNotSeeAgainLabel = "오늘 하루 보지 않기"
static let close = "닫기"
}

Expand Down
64 changes: 32 additions & 32 deletions YELLO-iOS/YELLO-iOS/Presentation/Around/View/AroundView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,7 @@ final class AroundView: BaseView {
var scrollCount = 0
var isUserSenderVote = false {
didSet {
if isUserSenderVote {
filterButtonLabel.text = StringLiterals.Around.myYello
filterButtonStackView.spacing = 0
filterButtonStackView.snp.updateConstraints {
$0.leading.equalToSuperview().inset(8.adjustedWidth)
}
aroundEmptyView.emptyDescriptionLabel.setTextWithLineHeight(
text: StringLiterals.Recommending.Empty.timeLineMyTitle,
lineHeight: 24)
} else {
filterButtonLabel.text = StringLiterals.Around.allYello
filterButtonStackView.spacing = 6.adjustedWidth
filterButtonStackView.snp.updateConstraints {
$0.leading.equalToSuperview().inset(20.adjustedWidth)
}
aroundEmptyView.emptyDescriptionLabel.setTextWithLineHeight(
text: StringLiterals.Recommending.Empty.timeLineAllTitle,
lineHeight: 24)
}

self.aroundPage = -1
self.aroundCount = -1
self.isFinishPaging = false
self.fetchingMore = false
self.aroundTableView.reloadData()
self.aroundModelDummy = []
self.around()
self.updateView()
updateAroundView()
}
}

Expand Down Expand Up @@ -221,10 +194,6 @@ final class AroundView: BaseView {
}
}

private func setAroundViewMode() {

}

// MARK: Custom Function
/// 친구가 없을 때 초대 뷰를 띄우는 로직
func updateView() {
Expand All @@ -236,6 +205,37 @@ final class AroundView: BaseView {
}
}

private func updateAroundView() {
if isUserSenderVote {
filterButtonLabel.text = StringLiterals.Around.myYello
filterButtonStackView.spacing = 0
filterButtonStackView.snp.updateConstraints {
$0.leading.equalToSuperview().inset(8.adjustedWidth)
}
aroundEmptyView.emptyDescriptionLabel.setTextWithLineHeight(
text: StringLiterals.Recommending.Empty.timeLineMyTitle,
lineHeight: 24)
} else {
filterButtonLabel.text = StringLiterals.Around.allYello
filterButtonStackView.spacing = 6.adjustedWidth
filterButtonStackView.snp.updateConstraints {
$0.leading.equalToSuperview().inset(20.adjustedWidth)
}
aroundEmptyView.emptyDescriptionLabel.setTextWithLineHeight(
text: StringLiterals.Recommending.Empty.timeLineAllTitle,
lineHeight: 24)
}

self.aroundPage = -1
self.aroundCount = -1
self.isFinishPaging = false
self.fetchingMore = false
self.aroundTableView.reloadData()
self.aroundModelDummy = []
self.around()
self.updateView()
}

// MARK: Objc Function
@objc func refreshTable(refresh: UIRefreshControl) {
self.isRefreshing = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,19 @@ extension NotificationView {
isTapped.toggle()
doNotSeeAgainButton.setImage(UIImage(imageLiteralResourceName: isTapped ? "btnCheckBox" : "btnNotCheckBox"), for: .normal)
UserDefaults.standard.set(isTapped, forKey: "isTapped")
if isTapped {
UserDefaults.standard.set(Date(), forKey: "tapDate")
}
}

@objc
private func doNotSeeLabelTapped() {
isTapped.toggle()
doNotSeeAgainButton.setImage(UIImage(imageLiteralResourceName: isTapped ? "btnCheckBox" : "btnNotCheckBox"), for: .normal)
UserDefaults.standard.set(isTapped, forKey: "isTapped")
if isTapped {
UserDefaults.standard.set(Date(), forKey: "tapDate")
}
}

@objc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,10 @@ extension YELLOTabBarController {
case .success(let data):
guard let data = data.data else { return }
if data.isAvailable && self.notificationReadCount == 0 {
// 다시 보지 않기 버튼을 안눌렀거나 이전 공지와 현재 공지의 title이 다른 경우에만 표시
if !UserDefaults.standard.bool(forKey: "isTapped") || UserDefaults.standard.string(forKey: "notificationTitle") != data.title {
// 다시 보지 않기 버튼을 안눌렀거나 하루가 지났거나 이전 공지와 현재 공지의 title이 다른 경우에만 표시
if !UserDefaults.standard.bool(forKey: "isTapped") ||
self.hasDayPassed(from: UserDefaults.standard.object(forKey: "tapDate") as? Date ?? Date()) ||
UserDefaults.standard.string(forKey: "notificationTitle") != data.title {
self.userNotificationView.frame = self.view.bounds
self.userNotificationView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.userNotificationView.notificationImageView.kfSetImage(url: data.imageUrl)
Expand All @@ -273,6 +275,17 @@ extension YELLOTabBarController {
purchaseSubscribeNeed()
}

// 하루 지났는지 확인하는 함수
func hasDayPassed(from date: Date) -> Bool {
let calendar = Calendar.current
let currentDate = Date()

let startOfToday = calendar.startOfDay(for: currentDate)
let startOfTappedDate = calendar.startOfDay(for: date)

return calendar.dateComponents([.day], from: startOfTappedDate, to: startOfToday).day ?? 0 > 0
}

/// 구독 연장 여부 서버통신
func purchaseSubscribeNeed() {
NetworkService.shared.purchaseService.purchaseSubscibeNeed { result in
Expand Down

0 comments on commit 5145a4b

Please sign in to comment.