diff --git a/YELLO-iOS/YELLO-iOS/Global/Literals/String.swift b/YELLO-iOS/YELLO-iOS/Global/Literals/String.swift index 31441cae..b1aa20d8 100644 --- a/YELLO-iOS/YELLO-iOS/Global/Literals/String.swift +++ b/YELLO-iOS/YELLO-iOS/Global/Literals/String.swift @@ -463,7 +463,7 @@ enum StringLiterals { } enum Notification { - static let doNotSeeAgainLabel = "다시 보지 않기" + static let doNotSeeAgainLabel = "오늘 하루 보지 않기" static let close = "닫기" } diff --git a/YELLO-iOS/YELLO-iOS/Presentation/Around/View/AroundView.swift b/YELLO-iOS/YELLO-iOS/Presentation/Around/View/AroundView.swift index 48480c0f..b88c6360 100644 --- a/YELLO-iOS/YELLO-iOS/Presentation/Around/View/AroundView.swift +++ b/YELLO-iOS/YELLO-iOS/Presentation/Around/View/AroundView.swift @@ -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() } } @@ -221,10 +194,6 @@ final class AroundView: BaseView { } } - private func setAroundViewMode() { - - } - // MARK: Custom Function /// 친구가 없을 때 초대 뷰를 띄우는 로직 func updateView() { @@ -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 diff --git a/YELLO-iOS/YELLO-iOS/Presentation/Notification/NotificationView.swift b/YELLO-iOS/YELLO-iOS/Presentation/Notification/NotificationView.swift index 02636db6..59e4234e 100644 --- a/YELLO-iOS/YELLO-iOS/Presentation/Notification/NotificationView.swift +++ b/YELLO-iOS/YELLO-iOS/Presentation/Notification/NotificationView.swift @@ -96,6 +96,9 @@ 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 @@ -103,6 +106,9 @@ 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 diff --git a/YELLO-iOS/YELLO-iOS/Presentation/TabBar/YELLOTabBarController.swift b/YELLO-iOS/YELLO-iOS/Presentation/TabBar/YELLOTabBarController.swift index 8d9e19e7..7c2c7413 100644 --- a/YELLO-iOS/YELLO-iOS/Presentation/TabBar/YELLOTabBarController.swift +++ b/YELLO-iOS/YELLO-iOS/Presentation/TabBar/YELLOTabBarController.swift @@ -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) @@ -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