diff --git a/EATSSU/App/Resources/en.lproj/Localizable.strings b/EATSSU/App/Resources/en.lproj/Localizable.strings index 945082a5..28fd1dbd 100644 --- a/EATSSU/App/Resources/en.lproj/Localizable.strings +++ b/EATSSU/App/Resources/en.lproj/Localizable.strings @@ -460,6 +460,10 @@ // MARK: - Notification +/// ๐Ÿค” ์˜ค๋Š˜ ๋ฐฅ ๋ญ ๋จน์ง€โ€ฆ +"notification.dailyWeekdayNotificationTitle" = "๐Ÿค” What should I eat todayโ€ฆ"; +/// ์˜ค๋Š˜์˜ ํ•™์‹์„ ํ™•์ธํ•ด๋ณด์„ธ์š”! +"notification.dailyWeekdayNotificationBody" = "Check today's cafeteria menu!"; /// ์•Œ๋ฆผ ๊ถŒํ•œ ํ•„์š” "notification_error_permission_denied_message" = "Notification Permission Required"; /// ์•Œ๋ฆผ์„ ๋ฐ›์œผ๋ ค๋ฉด ์•Œ๋ฆผ ๊ถŒํ•œ์„ ํ™œ์„ฑํ™”ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.\n์„ค์ •์—์„œ ์•Œ๋ฆผ ๊ถŒํ•œ์„ ํ—ˆ์šฉํ•ด์ฃผ์„ธ์š”. diff --git a/EATSSU/App/Resources/ja.lproj/Localizable.strings b/EATSSU/App/Resources/ja.lproj/Localizable.strings index 5d9b97eb..973f3faf 100644 --- a/EATSSU/App/Resources/ja.lproj/Localizable.strings +++ b/EATSSU/App/Resources/ja.lproj/Localizable.strings @@ -461,6 +461,10 @@ // MARK: - Notification +/// ๐Ÿค” ์˜ค๋Š˜ ๋ฐฅ ๋ญ ๋จน์ง€โ€ฆ +"notification.dailyWeekdayNotificationTitle" = "๐Ÿค” ไปŠๆ—ฅไฝ•ใ‚’้ฃŸในใ‚ˆใ†โ€ฆ"; +/// ์˜ค๋Š˜์˜ ํ•™์‹์„ ํ™•์ธํ•ด๋ณด์„ธ์š”! +"notification.dailyWeekdayNotificationBody" = "ไปŠๆ—ฅใฎๅญฆ้ฃŸใƒกใƒ‹ใƒฅใƒผใ‚’ใƒใ‚งใƒƒใ‚ฏใ—ใพใ—ใ‚‡ใ†๏ผ"; /// ์•Œ๋ฆผ ๊ถŒํ•œ ํ•„์š” "notification_error_permission_denied_message" = "้€š็Ÿฅๆจฉ้™ใŒๅฟ…่ฆใงใ™"; /// ์•Œ๋ฆผ์„ ๋ฐ›์œผ๋ ค๋ฉด ์•Œ๋ฆผ ๊ถŒํ•œ์„ ํ™œ์„ฑํ™”ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.\n์„ค์ •์—์„œ ์•Œ๋ฆผ ๊ถŒํ•œ์„ ํ—ˆ์šฉํ•ด์ฃผ์„ธ์š”. diff --git a/EATSSU/App/Resources/ko.lproj/Localizable.strings b/EATSSU/App/Resources/ko.lproj/Localizable.strings index 34dc877e..fb4a1794 100644 --- a/EATSSU/App/Resources/ko.lproj/Localizable.strings +++ b/EATSSU/App/Resources/ko.lproj/Localizable.strings @@ -461,6 +461,10 @@ // MARK: - Notification +/// ๐Ÿค” ์˜ค๋Š˜ ๋ฐฅ ๋ญ ๋จน์ง€โ€ฆ +"notification.dailyWeekdayNotificationTitle" = "๐Ÿค” ์˜ค๋Š˜ ๋ฐฅ ๋ญ ๋จน์ง€โ€ฆ"; +/// ์˜ค๋Š˜์˜ ํ•™์‹์„ ํ™•์ธํ•ด๋ณด์„ธ์š”! +"notification.dailyWeekdayNotificationBody" = "์˜ค๋Š˜์˜ ํ•™์‹์„ ํ™•์ธํ•ด๋ณด์„ธ์š”!"; /// ์•Œ๋ฆผ ๊ถŒํ•œ ํ•„์š” "notification_error_permission_denied_message" = "์•Œ๋ฆผ ๊ถŒํ•œ ํ•„์š”"; /// ์•Œ๋ฆผ์„ ๋ฐ›์œผ๋ ค๋ฉด ์•Œ๋ฆผ ๊ถŒํ•œ์„ ํ™œ์„ฑํ™”ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.\n์„ค์ •์—์„œ ์•Œ๋ฆผ ๊ถŒํ•œ์„ ํ—ˆ์šฉํ•ด์ฃผ์„ธ์š”. diff --git a/EATSSU/App/Resources/vi.lproj/Localizable.strings b/EATSSU/App/Resources/vi.lproj/Localizable.strings index b4ef841b..cdae42c6 100644 --- a/EATSSU/App/Resources/vi.lproj/Localizable.strings +++ b/EATSSU/App/Resources/vi.lproj/Localizable.strings @@ -461,6 +461,10 @@ // MARK: - Notification +/// ๐Ÿค” ์˜ค๋Š˜ ๋ฐฅ ๋ญ ๋จน์ง€โ€ฆ +"notification.dailyWeekdayNotificationTitle" = "๐Ÿค” Hรดm nay ฤƒn gรฌ ฤ‘รขyโ€ฆ"; +/// ์˜ค๋Š˜์˜ ํ•™์‹์„ ํ™•์ธํ•ด๋ณด์„ธ์š”! +"notification.dailyWeekdayNotificationBody" = "Xem thแปฑc ฤ‘ฦกn nhร  ฤƒn hรดm nay!"; /// ์•Œ๋ฆผ ๊ถŒํ•œ ํ•„์š” "notification_error_permission_denied_message" = "Cแบงn quyแปn thรดng bรกo"; /// ์•Œ๋ฆผ์„ ๋ฐ›์œผ๋ ค๋ฉด ์•Œ๋ฆผ ๊ถŒํ•œ์„ ํ™œ์„ฑํ™”ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.\n์„ค์ •์—์„œ ์•Œ๋ฆผ ๊ถŒํ•œ์„ ํ—ˆ์šฉํ•ด์ฃผ์„ธ์š”. diff --git a/EATSSU/App/Sources/Notification/DailyMenuNotificationScheduler.swift b/EATSSU/App/Sources/Notification/DailyMenuNotificationScheduler.swift new file mode 100644 index 00000000..952f9ce6 --- /dev/null +++ b/EATSSU/App/Sources/Notification/DailyMenuNotificationScheduler.swift @@ -0,0 +1,114 @@ +// +// DailyMenuNotificationScheduler.swift +// EATSSU +// +// Created by ํ™ฉ์ƒํ™˜ on 11/9/26. +// + +import Foundation +import UserNotifications + +/// ํ‰์ผ 11์‹œ "์˜ค๋Š˜ ๋ฐฅ ๋ญ ๋จน์ง€โ€ฆ" ๋กœ์ปฌ ์•Œ๋ฆผ +/// +/// ์ฐœ ์•Œ๋ฆผ์€ ์„œ๋ฒ„๊ฐ€ ์ฐœํ•œ ๋ฉ”๋‰ด๊ฐ€ ๋‚˜์˜จ ์‚ฌ์šฉ์ž์—๊ฒŒ๋งŒ ํ‘ธ์‹œ๋กœ ๋ณด๋‚ด๊ณ , ๊ทธ ์™ธ ์‚ฌ์šฉ์ž์—๊ฒŒ ๊ฐ€๋Š” ์ผ๋ฐ˜ ํ•™์‹ ์•Œ๋ฆผ์€ +/// ์„œ๋ฒ„ ๋ฒ”์œ„๊ฐ€ ์•„๋‹ˆ์–ด์„œ ์•ฑ์ด ๋กœ์ปฌ ์•Œ๋ฆผ์œผ๋กœ ๋ณด๋‚ธ๋‹ค. "๋งˆ์ดํŽ˜์ด์ง€ ์•Œ๋ฆผ ON + ๊ธฐ๊ธฐ ์•Œ๋ฆผ ๊ถŒํ•œ ํ—ˆ์šฉ"์ผ ๋•Œ๋งŒ ์˜ˆ์•ฝํ•˜๊ณ , +/// ๊ทธ ์™ธ์—๋Š” ์ทจ์†Œํ•œ๋‹ค. ์„œ๋ฒ„ ์•Œ๋ฆผํ•จ์—๋Š” ๋‚จ์ง€ ์•Š๋Š”๋‹ค +enum DailyMenuNotificationScheduler { + + // MARK: - Constants + + /// ์•Œ๋ฆผ ์‹๋ณ„์ž ์ ‘๋‘์‚ฌ. ์š”์ผ๋ณ„๋กœ ํ•˜๋‚˜์”ฉ ์˜ˆ์•ฝํ•œ๋‹ค (`weekdayNotification-2` โ€ฆ `-6`) + static let identifierPrefix = "weekdayNotification-" + + /// ์›”~๊ธˆ (`Calendar.weekday`: 1์ด ์ผ์š”์ผ) + static let weekdays = [2, 3, 4, 5, 6] + + static let hour = 11 + + /// ๋‹น์ผ ์ฐœ ์•Œ๋ฆผ(์„œ๋ฒ„ ํ‘ธ์‹œ)์„ ๋ฐ›์€ ๋‚ ์งœ(yyyyMMdd). ๊ฐ™์€ ๋‚  ๋กœ์ปฌ ์•Œ๋ฆผ์€ ๋„์šฐ์ง€ ์•Š๋Š”๋‹ค + static let favoritePushReceivedDayKey = "dailyMenuNotification.favoritePushReceivedDay" + + // MARK: - Decision + + static func identifier(weekday: Int) -> String { + "\(identifierPrefix)\(weekday)" + } + + /// ์ฃผ์–ด์ง„ ์‹œ๊ฐ์ด ์†ํ•œ ์š”์ผ์˜ ์•Œ๋ฆผ ์‹๋ณ„์ž + static func identifier(for date: Date, calendar: Calendar = .current) -> String { + identifier(weekday: calendar.component(.weekday, from: date)) + } + + static func isDailyMenuNotification(identifier: String) -> Bool { + identifier.hasPrefix(identifierPrefix) + } + + // MARK: - Sync + + /// ์ง„ํ–‰ ์ค‘์ธ ๋งž์ถค ์ž‘์—…. ๋‹ค์Œ ํ˜ธ์ถœ์€ ์ด ์ž‘์—…์ด ๋๋‚œ ๋’ค ์‹คํ–‰ํ•ด, ํ† ๊ธ€์„ ๋น ๋ฅด๊ฒŒ ๊ป๋‹ค ์ผœ๋„ ์˜ˆ์•ฝยท์ทจ์†Œ ์ˆœ์„œ๊ฐ€ ๋’ค๋ฐ”๋€Œ์ง€ ์•Š๊ฒŒ ํ•œ๋‹ค + @MainActor private static var syncTask: Task? + + /// ํ˜„์žฌ ํ† ๊ธ€ยท๊ถŒํ•œ ์ƒํƒœ(`NotificationManager.isNotificationAllowed`)์— ๋งž๊ฒŒ ์˜ˆ์•ฝํ•˜๊ฑฐ๋‚˜ ์ทจ์†Œํ•œ๋‹ค + /// ํ˜ธ์ถœ ์‹œ์ : ์•ฑ ์‹คํ–‰, ์•Œ๋ฆผ ๊ถŒํ•œ ๊ฒฐ๊ณผ, ๋งˆ์ดํŽ˜์ด์ง€ ์•Œ๋ฆผ ํ† ๊ธ€ ๋ณ€๊ฒฝ, ์–ธ์–ด ๋ณ€๊ฒฝ(๋ฌธ๊ตฌ ๊ฐฑ์‹ ) + @MainActor + static func sync() { + let previous = syncTask + syncTask = Task { + await previous?.value + if await NotificationManager.shared.isNotificationEnabled() { + await schedule() + } else { + cancel() + } + } + } + + /// ์›”~๊ธˆ 11์‹œ์— ๋ฐ˜๋ณต๋˜๋Š” ์•Œ๋ฆผ์„ ๋“ฑ๋กํ•œ๋‹ค. ๊ฐ™์€ ์‹๋ณ„์ž๋กœ ๋‹ค์‹œ ๋“ฑ๋กํ•˜๋ฉด ๋ฎ์–ด์“ฐ๋ฏ€๋กœ(์–ธ์–ด ๋ณ€๊ฒฝ ๋“ฑ) ์ทจ์†Œ ์—†์ด ํ˜ธ์ถœํ•ด๋„ ๋œ๋‹ค + private static func schedule() async { + let center = UNUserNotificationCenter.current() + for weekday in weekdays { + let content = UNMutableNotificationContent() + content.title = TextLiteral.Notification.dailyWeekdayNotificationTitle + content.body = TextLiteral.Notification.dailyWeekdayNotificationBody + content.sound = .default + + var components = DateComponents() + components.weekday = weekday + components.hour = hour + components.minute = 0 + let trigger = UNCalendarNotificationTrigger(dateMatching: components, repeats: true) + + let request = UNNotificationRequest(identifier: identifier(weekday: weekday), content: content, trigger: trigger) + do { + try await center.add(request) + } catch { + print("11์‹œ ํ•™์‹ ์•Œ๋ฆผ ์˜ˆ์•ฝ ์‹คํŒจ: \(error.localizedDescription)") + } + } + } + + /// ์˜ˆ์•ฝ์„ ์ง€์šฐ๊ณ , ์˜ค๋Š˜ ์ด๋ฏธ ๋–  ์žˆ๋Š” ์•Œ๋ฆผ๋„ ์•Œ๋ฆผ ์„ผํ„ฐ์—์„œ ๋‚ด๋ฆฐ๋‹ค + static func cancel() { + let identifiers = weekdays.map(identifier(weekday:)) + let center = UNUserNotificationCenter.current() + center.removePendingNotificationRequests(withIdentifiers: identifiers) + center.removeDeliveredNotifications(withIdentifiers: identifiers) + } + + // MARK: - ์ฐœ ์•Œ๋ฆผ๊ณผ ์ค‘๋ณต ์ œ๊ฑฐ + + /// ์ฐœ ์•Œ๋ฆผ(์„œ๋ฒ„ ํ‘ธ์‹œ)์„ ๋ฐ›์•˜์„ ๋•Œ ํ˜ธ์ถœ. ์•Œ๋ฆผ์˜ ์‹๋‹จ ๋‚ ์งœ(`date`) ๊ธฐ์ค€์œผ๋กœ ๊ฐ™์€ ๋‚  ์ด๋ฏธ ๋–  ์žˆ๋Š” ๋กœ์ปฌ ์•Œ๋ฆผ์„ + /// ์•Œ๋ฆผ ์„ผํ„ฐ์—์„œ ์ง€์šฐ๊ณ , ์•„์ง ์•ˆ ๋–ด๋‹ค๋ฉด `shouldPresent`๊ฐ€ ๊ฑฐ๋ฅด๋„๋ก ๋‚ ์งœ๋ฅผ ๊ธฐ์–ตํ•œ๋‹ค + /// + /// ๋ฐ›์€ ์‹œ๊ฐ์ด ์•„๋‹ˆ๋ผ ์•Œ๋ฆผ์˜ ๋‚ ์งœ๋ฅผ ์จ์•ผ, ์–ด์ œ ์˜จ ํ‘ธ์‹œ๋ฅผ ์˜ค๋Š˜ ๋ˆŒ๋ €์„ ๋•Œ ์˜ค๋Š˜ ๋กœ์ปฌ ์•Œ๋ฆผ๊นŒ์ง€ ๊ฑฐ๋ฅด์ง€ ์•Š๋Š”๋‹ค. + /// ์•ฑ์ด ๋ฐฑ๊ทธ๋ผ์šด๋“œ์— ์žˆ๊ณ  ์‚ฌ์šฉ์ž๊ฐ€ ํ‘ธ์‹œ๋ฅผ ๋ˆ„๋ฅด์ง€ ์•Š์œผ๋ฉด ์ด ์ฝ”๋“œ๊ฐ€ ์‹คํ–‰๋˜์ง€ ์•Š์•„ ๋‘ ์•Œ๋ฆผ์ด ํ•จ๊ป˜ ๋‚จ์„ ์ˆ˜ ์žˆ๋‹ค + static func didReceiveFavoritePush(on date: Date) { + UserDefaults.standard.set(DateFormatter.serverDay.string(from: date), forKey: favoritePushReceivedDayKey) + UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: [identifier(for: date)]) + } + + /// ์•ฑ ์‚ฌ์šฉ ์ค‘ ๋กœ์ปฌ ์•Œ๋ฆผ์ด ๋„์ฐฉํ–ˆ์„ ๋•Œ ๋„์šธ์ง€. ๊ฐ™์€ ๋‚  ์ฐœ ์•Œ๋ฆผ์„ ์ด๋ฏธ ๋ฐ›์•˜์œผ๋ฉด ๋„์šฐ์ง€ ์•Š๋Š”๋‹ค + static func shouldPresent(dailyNotificationOn date: Date = Date()) -> Bool { + UserDefaults.standard.string(forKey: favoritePushReceivedDayKey) != DateFormatter.serverDay.string(from: date) + } +} diff --git a/EATSSU/App/Sources/Notification/NotificationManager.swift b/EATSSU/App/Sources/Notification/NotificationManager.swift index 666bdcb0..fef36d13 100644 --- a/EATSSU/App/Sources/Notification/NotificationManager.swift +++ b/EATSSU/App/Sources/Notification/NotificationManager.swift @@ -16,14 +16,6 @@ class NotificationManager { // MARK: - Methods - /// ์ด์ „ ๋ฒ„์ „์ด ๊ธฐ๊ธฐ์— ์˜ˆ์•ฝํ•ด ๋‘” ํ‰์ผ 11์‹œ ๋กœ์ปฌ ์•Œ๋ฆผ์„ ์ง€์šด๋‹ค - /// - /// 11์‹œ ํ•™์‹ ์•Œ๋ฆผ์€ ์„œ๋ฒ„ ํ‘ธ์‹œ(์ฐœ ์•Œ๋ฆผ / ์ผ๋ฐ˜ ํ•™์‹ ์•Œ๋ฆผ, ํ•˜๋ฃจ 1๊ฑด)๋กœ ์˜ฎ๊ฒจ, ์—…๋ฐ์ดํŠธ ํ›„์—๋„ ๋กœ์ปฌ ์•Œ๋ฆผ์ด ๋‚จ์•„ ์žˆ์œผ๋ฉด ์ค‘๋ณต์œผ๋กœ ์˜จ๋‹ค. - func removeLegacyDailyNotifications() { - let identifiers = [2, 3, 4, 5, 6].map { "weekdayNotification-\($0)" } - UNUserNotificationCenter.current().removePendingNotificationRequests(withIdentifiers: identifiers) - } - /// ์•ฑ ์‹คํ–‰ ์‹œ ์•Œ๋ฆผ ๋ฐœ์†ก ๊ถŒํ•œ์„ ์š”์ฒญํ•˜๋Š” ํŒ์—… ํ˜ธ์ถœ ๋ฉ”์†Œ๋“œ func requestNotificationPermission() async throws -> Bool { return try await UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) @@ -34,6 +26,28 @@ class NotificationManager { return await UNUserNotificationCenter.current().notificationSettings() } + /// ์•Œ๋ฆผ์„ ๋ณด๋‚ด๋„ ๋˜๋Š” ์ƒํƒœ์ธ์ง€: ๋งˆ์ดํŽ˜์ด์ง€ ์•Œ๋ฆผ ํ† ๊ธ€ ON + ๊ธฐ๊ธฐ ์•Œ๋ฆผ ๊ถŒํ•œ ํ—ˆ์šฉ + /// ์„œ๋ฒ„ ํ‘ธ์‹œ ํ† ํฐ ๋“ฑ๋ก(`PushTokenManager`)๊ณผ 11์‹œ ๋กœ์ปฌ ์•Œ๋ฆผ(`DailyMenuNotificationScheduler`)์ด ๊ฐ™์€ ๊ทœ์น™์„ ์“ด๋‹ค + static func isNotificationAllowed(authorization: UNAuthorizationStatus, isToggleOn: Bool) -> Bool { + guard isToggleOn else { return false } + switch authorization { + case .authorized, .provisional, .ephemeral: + return true + case .denied, .notDetermined: + return false + @unknown default: + return false + } + } + + /// ํ˜„์žฌ ํ† ๊ธ€ยท๊ถŒํ•œ ์ƒํƒœ๋กœ `isNotificationAllowed`๋ฅผ ํŒ๋‹จํ•œ๋‹ค + func isNotificationEnabled() async -> Bool { + let isToggleOn = UserDefaults.standard.bool(forKey: TextLiteral.MyPage.pushNotificationUserSettingKey) + guard isToggleOn else { return false } + let settings = await checkNotificationSetting() + return Self.isNotificationAllowed(authorization: settings.authorizationStatus, isToggleOn: isToggleOn) + } + /// ์•Œ๋ฆผ ๊ถŒํ•œ ์ƒํƒœ๋ฅผ ํ™•์ธํ•ด ํ† ๊ธ€์˜ ๋‹ค์Œ ์ƒํƒœ๋ฅผ ๋ฐ˜ํ™˜. ์„œ๋ฒ„ ๋ฐ˜์˜์€ `PushTokenManager.sync()`๊ฐ€ ํ•œ๋‹ค func handleNotificationToggle(currentState: Bool) async throws -> Bool { let settings = await checkNotificationSetting() diff --git a/EATSSU/App/Sources/Notification/NotificationPermissionPrompt.swift b/EATSSU/App/Sources/Notification/NotificationPermissionPrompt.swift index a22372d7..fc7a1279 100644 --- a/EATSSU/App/Sources/Notification/NotificationPermissionPrompt.swift +++ b/EATSSU/App/Sources/Notification/NotificationPermissionPrompt.swift @@ -39,7 +39,7 @@ enum NotificationPermissionPrompt { } /// "์•Œ๋ฆผ ํ—ˆ์šฉํ•˜๊ธฐ": ๋ฏธ๊ฒฐ์ •์ด๋ฉด ์‹œ์Šคํ…œ ๊ถŒํ•œ ์š”์ฒญ, ์ด๋ฏธ ๊ฑฐ๋ถ€๋ผ ์žˆ์œผ๋ฉด ์„ค์ • ์ด๋™ ์•ˆ๋‚ด - /// ํ—ˆ์šฉ๋˜๋ฉด ๋งˆ์ดํŽ˜์ด์ง€ ํ† ๊ธ€์„ ์ผœ๊ณ  ์„œ๋ฒ„์— ํ‘ธ์‹œ ํ† ํฐ์„ ๋“ฑ๋กํ•œ๋‹ค + /// ํ—ˆ์šฉ๋˜๋ฉด ๋งˆ์ดํŽ˜์ด์ง€ ํ† ๊ธ€์„ ์ผœ๊ณ , ์„œ๋ฒ„ ํ‘ธ์‹œ ํ† ํฐ ๋“ฑ๋ก๊ณผ 11์‹œ ๋กœ์ปฌ ์•Œ๋ฆผ ์˜ˆ์•ฝ์„ ๋งž์ถ˜๋‹ค static func requestPermission(on tabBar: CustomTabBarContainerController) { Task { @MainActor in let settings = await NotificationManager.shared.checkNotificationSetting() @@ -48,11 +48,13 @@ enum NotificationPermissionPrompt { let granted = (try? await NotificationManager.shared.requestNotificationPermission()) ?? false UserDefaults.standard.set(granted, forKey: TextLiteral.MyPage.pushNotificationUserSettingKey) PushTokenManager.shared.sync() + DailyMenuNotificationScheduler.sync() case .denied: presentSettingsDialog(on: tabBar) default: UserDefaults.standard.set(true, forKey: TextLiteral.MyPage.pushNotificationUserSettingKey) PushTokenManager.shared.sync() + DailyMenuNotificationScheduler.sync() } } } diff --git a/EATSSU/App/Sources/Notification/PushRoute.swift b/EATSSU/App/Sources/Notification/PushRoute.swift index 2168ad00..6afd9e79 100644 --- a/EATSSU/App/Sources/Notification/PushRoute.swift +++ b/EATSSU/App/Sources/Notification/PushRoute.swift @@ -18,6 +18,13 @@ struct PushRoute { /// ์•Œ๋ฆผํ•จ ํ•ญ๋ชฉ id. ์žˆ์œผ๋ฉด ์•Œ๋ฆผ์„ ๋ˆ„๋ฅธ ์‹œ์ ์— ์ฝ์Œ ์ฒ˜๋ฆฌํ•œ๋‹ค (์„œ๋ฒ„๊ฐ€ ์•Œ๋ฆผํ•จ์„ ์ง€์›ํ•˜๊ธฐ ์ „ ํ‘ธ์‹œ์—๋Š” ์—†๋‹ค) let notificationId: Int? + /// ์•ฑ์ด ์ง์ ‘ ๋งŒ๋“œ๋Š” ์ด๋™ (์˜ˆ: 11์‹œ ๋กœ์ปฌ ์•Œ๋ฆผ โ†’ ์˜ค๋Š˜ ํ•™์‹) + init(date: Date, mealTime: MealTime?, notificationId: Int?) { + self.date = date + self.mealTime = mealTime + self.notificationId = notificationId + } + /// ์„œ๋ฒ„ ํ‘ธ์‹œ data: `type`(MENU_FAVORITE / DAILY_MENU), `date`(yyyyMMdd), `timePart`(์ฐœ ์•Œ๋ฆผ๋งŒ), `notificationId`(๋ฌธ์ž์—ด) init?(userInfo: [AnyHashable: Any]) { guard let type = userInfo["type"] as? String, @@ -29,7 +36,13 @@ struct PushRoute { self.notificationId = (userInfo["notificationId"] as? String).flatMap(Int.init) } - private static let supportedTypes: Set = ["MENU_FAVORITE", "DAILY_MENU"] + private static let favoriteType = "MENU_FAVORITE" + private static let supportedTypes: Set = [favoriteType, "DAILY_MENU"] + + /// ์ฐœ ์•Œ๋ฆผ(์„œ๋ฒ„ ํ‘ธ์‹œ)์ธ์ง€. ์•Œ๋ฆผ ๋‚ ์งœ๊ฐ€ ์žˆ์–ด์•ผ ํ•˜๋ฏ€๋กœ ํ•ด์„์— ์„ฑ๊ณตํ•œ ๊ฒฝ์šฐ๋งŒ true + static func isFavorite(userInfo: [AnyHashable: Any]) -> Bool { + (userInfo["type"] as? String) == favoriteType && PushRoute(userInfo: userInfo) != nil + } } /// ์•Œ๋ฆผ์„ ๋ˆ„๋ฅธ ์‹œ์ ์— ํ™”๋ฉด์ด ์ค€๋น„๋ผ ์žˆ์ง€ ์•Š์„ ์ˆ˜ ์žˆ์–ด(์•ฑ ์‹คํ–‰ ์งํ›„ ์Šคํ”Œ๋ž˜์‹œยท๋กœ๊ทธ์ธ ๋“ฑ) ์ด๋™ํ•  ๊ณณ์„ ๋ณด๊ด€ํ–ˆ๋‹ค๊ฐ€ ์ ์šฉํ•œ๋‹ค @@ -53,6 +66,15 @@ final class PushRouter { return } guard let route = PushRoute(userInfo: userInfo) else { return } + handle(route: route) + } + + /// ํ•ด์„์ด ๋๋‚œ ์ด๋™์„ ๋ณด๊ด€ํ•˜๊ณ , ์•ฑ์ด ํ™œ์„ฑ ์ƒํƒœ๋ฉด ๋ฐ”๋กœ ์ ์šฉํ•œ๋‹ค + func handle(route: PushRoute) { + guard Thread.isMainThread else { + DispatchQueue.main.async { self.handle(route: route) } + return + } pendingRoute = (route, Date()) if UIApplication.shared.applicationState == .active { applyPendingRoute() diff --git a/EATSSU/App/Sources/Notification/PushTokenManager.swift b/EATSSU/App/Sources/Notification/PushTokenManager.swift index 9122a7a4..df8fb99c 100644 --- a/EATSSU/App/Sources/Notification/PushTokenManager.swift +++ b/EATSSU/App/Sources/Notification/PushTokenManager.swift @@ -174,17 +174,8 @@ final class PushTokenManager { // MARK: - Private - /// ๋งˆ์ดํŽ˜์ด์ง€ ์•Œ๋ฆผ ํ† ๊ธ€ ON + ๊ธฐ๊ธฐ ์•Œ๋ฆผ ๊ถŒํ•œ ํ—ˆ์šฉ + /// ๋งˆ์ดํŽ˜์ด์ง€ ์•Œ๋ฆผ ํ† ๊ธ€ ON + ๊ธฐ๊ธฐ ์•Œ๋ฆผ ๊ถŒํ•œ ํ—ˆ์šฉ (๊ทœ์น™์€ `NotificationManager.isNotificationAllowed`) private static func isNotificationEnabled() async -> Bool { - guard UserDefaults.standard.bool(forKey: TextLiteral.MyPage.pushNotificationUserSettingKey) else { return false } - let settings = await UNUserNotificationCenter.current().notificationSettings() - switch settings.authorizationStatus { - case .authorized, .provisional, .ephemeral: - return true - case .denied, .notDetermined: - return false - @unknown default: - return false - } + await NotificationManager.shared.isNotificationEnabled() } } diff --git a/EATSSU/App/Sources/Presentation/MyPage/ViewController/LanguageSettingViewController.swift b/EATSSU/App/Sources/Presentation/MyPage/ViewController/LanguageSettingViewController.swift index ab22ce68..0d1f66f0 100644 --- a/EATSSU/App/Sources/Presentation/MyPage/ViewController/LanguageSettingViewController.swift +++ b/EATSSU/App/Sources/Presentation/MyPage/ViewController/LanguageSettingViewController.swift @@ -121,6 +121,8 @@ final class LanguageSettingViewController: BaseViewController { AppLanguageManager.shared.changeLanguage(to: language) ServerLanguageSync.sync(language) + // ์˜ˆ์•ฝ๋œ 11์‹œ ๋กœ์ปฌ ์•Œ๋ฆผ ๋ฌธ๊ตฌ๋ฅผ ์ƒˆ ์–ธ์–ด๋กœ ๋‹ค์‹œ ๋“ฑ๋กํ•œ๋‹ค + DailyMenuNotificationScheduler.sync() didChangeLanguage = true AnalyticsService.logEvent("change_language", parameters: ["language": language.rawValue]) diff --git a/EATSSU/App/Sources/Presentation/MyPage/ViewController/MyPageViewController.swift b/EATSSU/App/Sources/Presentation/MyPage/ViewController/MyPageViewController.swift index ed1eec2d..0f11dc50 100644 --- a/EATSSU/App/Sources/Presentation/MyPage/ViewController/MyPageViewController.swift +++ b/EATSSU/App/Sources/Presentation/MyPage/ViewController/MyPageViewController.swift @@ -379,8 +379,9 @@ extension MyPageViewController: UITableViewDelegate { // ์Šค์œ„์น˜ ์ƒํƒœ ์—…๋ฐ์ดํŠธ self.switchState = newState self.saveSwitchStateToUserDefaults() - // ์„œ๋ฒ„๋Š” ํ‘ธ์‹œ ํ† ํฐ ๋“ฑ๋ก ์—ฌ๋ถ€๋กœ ์•Œ๋ฆผ ํ—ˆ์šฉ์„ ํŒ๋‹จํ•œ๋‹ค (ON: ๋“ฑ๋ก, OFF: ์‚ญ์ œ) + // ์„œ๋ฒ„๋Š” ํ‘ธ์‹œ ํ† ํฐ ๋“ฑ๋ก ์—ฌ๋ถ€๋กœ ์•Œ๋ฆผ ํ—ˆ์šฉ์„ ํŒ๋‹จํ•œ๋‹ค (ON: ๋“ฑ๋ก, OFF: ์‚ญ์ œ). 11์‹œ ๋กœ์ปฌ ์•Œ๋ฆผ๋„ ํ•จ๊ป˜ ๋งž์ถ˜๋‹ค PushTokenManager.shared.sync() + DailyMenuNotificationScheduler.sync() // UI ์—…๋ฐ์ดํŠธ if let cell = self.mypageView.myPageTableView.cellForRow(at: indexPath) as? NotificationSettingTableViewCell { diff --git a/EATSSU/App/Sources/Utility/Application/AppDelegate.swift b/EATSSU/App/Sources/Utility/Application/AppDelegate.swift index 2a585d19..2889df3a 100644 --- a/EATSSU/App/Sources/Utility/Application/AppDelegate.swift +++ b/EATSSU/App/Sources/Utility/Application/AppDelegate.swift @@ -53,13 +53,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // FCM ์•Œ๋ฆผ์ธ์ง€ ํ™•์ธ if isFCMNotification(userInfo) { LaunchSourceManager.shared.setSource(.remoteNotification) + // ํ•™์‹ ์•Œ๋ฆผ์ด๋ฉด ํ•ด๋‹น ๋‚ ์งœยท์‹œ๊ฐ„๋Œ€์˜ ํ•™์‹ ํ™”๋ฉด์œผ๋กœ ์ด๋™. ์ฐœ ์•Œ๋ฆผ์ด๋ฉด ๊ฐ™์€ ๋‚  11์‹œ ๋กœ์ปฌ ์•Œ๋ฆผ์€ ์ง€์šด๋‹ค + if let route = PushRoute(userInfo: userInfo) { + if PushRoute.isFavorite(userInfo: userInfo) { + DailyMenuNotificationScheduler.didReceiveFavoritePush(on: route.date) + } + PushRouter.shared.handle(route: route) + } } else { LaunchSourceManager.shared.setSource(.localNotification) + // 11์‹œ ๋กœ์ปฌ ์•Œ๋ฆผ์€ ์˜ค๋Š˜ ํ•™์‹ ํ™”๋ฉด์œผ๋กœ ์ด๋™ + if DailyMenuNotificationScheduler.isDailyMenuNotification(identifier: notification.request.identifier) { + PushRouter.shared.handle(route: PushRoute(date: Date(), mealTime: nil, notificationId: nil)) + } } - // ํ•™์‹ ์•Œ๋ฆผ์ด๋ฉด ํ•ด๋‹น ๋‚ ์งœยท์‹œ๊ฐ„๋Œ€์˜ ํ•™์‹ ํ™”๋ฉด์œผ๋กœ ์ด๋™ - PushRouter.shared.handle(userInfo: userInfo) - completionHandler() } @@ -117,13 +125,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD userInfo["fcm_options"] != nil } - /// ํ‘ธ์‹œ ์•Œ๋ฆผ ๊ถŒํ•œ์„ ์š”์ฒญํ•˜๊ณ  ์„ค์ •์„ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค. + /// ์•Œ๋ฆผ ๊ถŒํ•œยทํ† ๊ธ€ ์ƒํƒœ์— ๋งž๊ฒŒ ์•Œ๋ฆผ ์˜ˆ์•ฝ๊ณผ ์„œ๋ฒ„ ๋“ฑ๋ก์„ ๋งž์ถฅ๋‹ˆ๋‹ค. private func setupNotificationPermissions() { - // 11์‹œ ์•Œ๋ฆผ์€ ์„œ๋ฒ„ ํ‘ธ์‹œ๋กœ ์˜ฎ๊ฒจ, ์ด์ „ ๋ฒ„์ „์ด ์˜ˆ์•ฝํ•œ ๋กœ์ปฌ ์•Œ๋ฆผ์€ ์ง€์šด๋‹ค - NotificationManager.shared.removeLegacyDailyNotifications() // ์‹œ์Šคํ…œ ์•Œ๋ฆผ ๊ถŒํ•œ์€ ์•ฑ ์‹คํ–‰ ์‹œ ๋ฐ”๋กœ ๋ฌป์ง€ ์•Š๋Š”๋‹ค. ๊ฐ€์ž… ์งํ›„ ์•ˆ๋‚ด ๋‹ค์ด์–ผ๋กœ๊ทธ(`NotificationPermissionPrompt`)๋‚˜ // ๋งˆ์ดํŽ˜์ด์ง€ ํ† ๊ธ€์—์„œ ์‚ฌ์šฉ์ž๊ฐ€ ์„ ํƒํ–ˆ์„ ๋•Œ ์š”์ฒญํ•œ๋‹ค - // ๊ถŒํ•œยทํ† ๊ธ€ ์ƒํƒœ์— ๋งž๊ฒŒ ์„œ๋ฒ„ ํ‘ธ์‹œ ํ† ํฐ ๋“ฑ๋ก/์‚ญ์ œ (๋กœ๊ทธ์ธ ์ƒํƒœ์ผ ๋•Œ๋งŒ ๋™์ž‘) + // ๊ถŒํ•œยทํ† ๊ธ€ ์ƒํƒœ์— ๋งž๊ฒŒ ํ‰์ผ 11์‹œ ๋กœ์ปฌ ์•Œ๋ฆผ์„ ์˜ˆ์•ฝ/์ทจ์†Œํ•˜๊ณ , ์„œ๋ฒ„ ํ‘ธ์‹œ ํ† ํฐ์„ ๋“ฑ๋ก/์‚ญ์ œํ•œ๋‹ค (ํ† ํฐ์€ ๋กœ๊ทธ์ธ ์ƒํƒœ์ผ ๋•Œ๋งŒ) + DailyMenuNotificationScheduler.sync() PushTokenManager.shared.sync() } @@ -210,6 +217,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD extension AppDelegate { // Foreground์—์„œ๋„ ์•Œ๋ฆผ์ด ๋ณด์ด๋„๋ก ์„ค์ • func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { + let request = notification.request + if DailyMenuNotificationScheduler.isDailyMenuNotification(identifier: request.identifier) { + // 11์‹œ ๋กœ์ปฌ ์•Œ๋ฆผ: ๊ฐ™์€ ๋‚  ์ฐœ ์•Œ๋ฆผ์„ ์ด๋ฏธ ๋ฐ›์•˜์œผ๋ฉด ์ค‘๋ณต์ด๋ผ ๋„์šฐ์ง€ ์•Š๋Š”๋‹ค + guard DailyMenuNotificationScheduler.shouldPresent() else { + completionHandler([]) + return + } + } else if PushRoute.isFavorite(userInfo: request.content.userInfo), + let route = PushRoute(userInfo: request.content.userInfo) { + // ์ฐœ ์•Œ๋ฆผ์ด ๋จผ์ € ์™”์œผ๋ฉด ๊ฐ™์€ ๋‚  11์‹œ ๋กœ์ปฌ ์•Œ๋ฆผ์€ ์ง€์šฐ๊ฑฐ๋‚˜ ๊ฑฐ๋ฅธ๋‹ค + DailyMenuNotificationScheduler.didReceiveFavoritePush(on: route.date) + } // ์•ฑ ์‚ฌ์šฉ ์ค‘์— ์•Œ๋ฆผ์ด ์˜ค๋ฉด ํ•™์‹ ํƒญ ์•Œ๋ฆผ ์•„์ด์ฝ˜์— ์ ์„ ๋„์šด๋‹ค NotificationCenter.default.post(name: .didReceivePushNotification, object: nil) completionHandler([.banner, .sound, .badge]) diff --git a/EATSSU/App/Sources/Utility/Application/SceneDelegate.swift b/EATSSU/App/Sources/Utility/Application/SceneDelegate.swift index 87d67a6d..ff6164ff 100644 --- a/EATSSU/App/Sources/Utility/Application/SceneDelegate.swift +++ b/EATSSU/App/Sources/Utility/Application/SceneDelegate.swift @@ -65,6 +65,9 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { func sceneWillEnterForeground(_ scene: UIScene) { // ๋ฐฑ๊ทธ๋ผ์šด๋“œ์—์„œ ํฌ๊ทธ๋ผ์šด๋“œ๋กœ ์ „ํ™˜ ์‹œ ํ•„์š”ํ•œ ์ž‘์—… ์ˆ˜ํ–‰ TokenManager.refreshIfNeededAsync() + // ์„ค์ • ์•ฑ์—์„œ ์•Œ๋ฆผ ๊ถŒํ•œ์„ ๋ฐ”๊พธ๊ณ  ๋Œ์•„์˜จ ๊ฒฝ์šฐ๋ฅผ ๋ฐ˜์˜ํ•ด 11์‹œ ๋กœ์ปฌ ์•Œ๋ฆผ ์˜ˆ์•ฝ๊ณผ ์„œ๋ฒ„ ํ‘ธ์‹œ ํ† ํฐ ๋“ฑ๋ก์„ ๋‹ค์‹œ ๋งž์ถ˜๋‹ค + DailyMenuNotificationScheduler.sync() + PushTokenManager.shared.sync() } func sceneDidBecomeActive(_ scene: UIScene) { diff --git a/EATSSU/App/Sources/Utility/Literal/TextLiteral.swift b/EATSSU/App/Sources/Utility/Literal/TextLiteral.swift index 55970db3..929754f4 100644 --- a/EATSSU/App/Sources/Utility/Literal/TextLiteral.swift +++ b/EATSSU/App/Sources/Utility/Literal/TextLiteral.swift @@ -1210,6 +1210,14 @@ enum TextLiteral { // MARK: - Notification enum Notification { + /// ๐Ÿค” ์˜ค๋Š˜ ๋ฐฅ ๋ญ ๋จน์ง€โ€ฆ + static var dailyWeekdayNotificationTitle: String { + Localization.localized("notification.dailyWeekdayNotificationTitle", fallback: "๐Ÿค” ์˜ค๋Š˜ ๋ฐฅ ๋ญ ๋จน์ง€โ€ฆ") + } + /// ์˜ค๋Š˜์˜ ํ•™์‹์„ ํ™•์ธํ•ด๋ณด์„ธ์š”! + static var dailyWeekdayNotificationBody: String { + Localization.localized("notification.dailyWeekdayNotificationBody", fallback: "์˜ค๋Š˜์˜ ํ•™์‹์„ ํ™•์ธํ•ด๋ณด์„ธ์š”!") + } /// ์•Œ๋ฆผ ๊ถŒํ•œ ํ•„์š” static var permissionDeniedMessage: String { Localization.localized( diff --git a/EATSSU/Tests/UnitTests/DailyMenuNotificationSchedulerTests.swift b/EATSSU/Tests/UnitTests/DailyMenuNotificationSchedulerTests.swift new file mode 100644 index 00000000..52df315a --- /dev/null +++ b/EATSSU/Tests/UnitTests/DailyMenuNotificationSchedulerTests.swift @@ -0,0 +1,66 @@ +// +// DailyMenuNotificationSchedulerTests.swift +// EATSSUUnitTests +// +// Created by ํ™ฉ์ƒํ™˜ on 11/9/26. +// + +import XCTest +import UserNotifications + +@testable import EATSSU_DEV + +/// ํ‰์ผ 11์‹œ ๋กœ์ปฌ ์•Œ๋ฆผ์˜ ์˜ˆ์•ฝ ์กฐ๊ฑดยท์‹๋ณ„์ž ๊ทœ์น™ ๊ฒ€์ฆ +final class DailyMenuNotificationSchedulerTests: XCTestCase { + + /// ์ฐœ ์•Œ๋ฆผ ์ˆ˜์‹  ๋‚ ์งœ๋Š” ์‹ค์ œ UserDefaults์— ์ €์žฅ๋˜๋ฏ€๋กœ ํ…Œ์ŠคํŠธ ์ „ ๊ฐ’์„ ๋ณด๊ด€ํ–ˆ๋‹ค๊ฐ€ ๋˜๋Œ๋ฆฐ๋‹ค + private let favoritePushReceivedDayKey = DailyMenuNotificationScheduler.favoritePushReceivedDayKey + private var savedFavoritePushReceivedDay: String? + + override func setUp() { + super.setUp() + savedFavoritePushReceivedDay = UserDefaults.standard.string(forKey: favoritePushReceivedDayKey) + } + + override func tearDown() { + if let savedFavoritePushReceivedDay { + UserDefaults.standard.set(savedFavoritePushReceivedDay, forKey: favoritePushReceivedDayKey) + } else { + UserDefaults.standard.removeObject(forKey: favoritePushReceivedDayKey) + } + super.tearDown() + } + + func test_ํ† ๊ธ€์ด_์ผœ์ ธ_์žˆ๊ณ _๊ถŒํ•œ์ด_ํ—ˆ์šฉ๋ผ์•ผ_์•Œ๋ฆผ์„_๋ณด๋‚ธ๋‹ค() { + XCTAssertTrue(NotificationManager.isNotificationAllowed(authorization: .authorized, isToggleOn: true)) + XCTAssertTrue(NotificationManager.isNotificationAllowed(authorization: .provisional, isToggleOn: true)) + XCTAssertFalse(NotificationManager.isNotificationAllowed(authorization: .authorized, isToggleOn: false)) + XCTAssertFalse(NotificationManager.isNotificationAllowed(authorization: .denied, isToggleOn: true)) + XCTAssertFalse(NotificationManager.isNotificationAllowed(authorization: .notDetermined, isToggleOn: true)) + } + + func test_์›”์š”์ผ๋ถ€ํ„ฐ_๊ธˆ์š”์ผ๊นŒ์ง€_ํ•˜๋‚˜์”ฉ_์˜ˆ์•ฝํ•œ๋‹ค() { + XCTAssertEqual(DailyMenuNotificationScheduler.weekdays, [2, 3, 4, 5, 6]) + XCTAssertEqual(DailyMenuNotificationScheduler.hour, 11) + } + + func test_์‹๋ณ„์ž๋Š”_์š”์ผ๋กœ_๊ตฌ๋ถ„๋˜๊ณ _์ ‘๋‘์‚ฌ๋กœ_ํŒ๋ณ„ํ•œ๋‹ค() throws { + var calendar = Calendar(identifier: .gregorian) + calendar.timeZone = try XCTUnwrap(TimeZone(identifier: "Asia/Seoul")) + // 2026-11-09 ์›”์š”์ผ + let monday = try XCTUnwrap(calendar.date(from: DateComponents(year: 2026, month: 11, day: 9, hour: 11))) + let identifier = DailyMenuNotificationScheduler.identifier(for: monday, calendar: calendar) + XCTAssertEqual(identifier, "weekdayNotification-2") + XCTAssertTrue(DailyMenuNotificationScheduler.isDailyMenuNotification(identifier: identifier)) + XCTAssertFalse(DailyMenuNotificationScheduler.isDailyMenuNotification(identifier: "menuFavorite-20261109")) + } + + func test_๊ฐ™์€_๋‚ _์ฐœ_์•Œ๋ฆผ์„_๋ฐ›์•˜์œผ๋ฉด_๋กœ์ปฌ_์•Œ๋ฆผ์„_๋„์šฐ์ง€_์•Š๋Š”๋‹ค() throws { + let today = Date() + let yesterday = try XCTUnwrap(Calendar.current.date(byAdding: .day, value: -1, to: today)) + DailyMenuNotificationScheduler.didReceiveFavoritePush(on: yesterday) + XCTAssertTrue(DailyMenuNotificationScheduler.shouldPresent(dailyNotificationOn: today)) + DailyMenuNotificationScheduler.didReceiveFavoritePush(on: today) + XCTAssertFalse(DailyMenuNotificationScheduler.shouldPresent(dailyNotificationOn: today)) + } +} diff --git a/EATSSU/Tests/UnitTests/PushRouteTests.swift b/EATSSU/Tests/UnitTests/PushRouteTests.swift index d7a4de23..e36c2d7f 100644 --- a/EATSSU/Tests/UnitTests/PushRouteTests.swift +++ b/EATSSU/Tests/UnitTests/PushRouteTests.swift @@ -29,6 +29,12 @@ final class PushRouteTests: XCTestCase { XCTAssertNil(route.mealTime) } + func test_์ฐœ_์•Œ๋ฆผ_์—ฌ๋ถ€๋Š”_ํƒ€์ž…๊ณผ_๋‚ ์งœ๊ฐ€_๋ชจ๋‘_๋งž์•„์•ผ_ํ•œ๋‹ค() { + XCTAssertTrue(PushRoute.isFavorite(userInfo: ["type": "MENU_FAVORITE", "date": "20261109", "timePart": "LUNCH"])) + XCTAssertFalse(PushRoute.isFavorite(userInfo: ["type": "DAILY_MENU", "date": "20261109"])) + XCTAssertFalse(PushRoute.isFavorite(userInfo: ["type": "MENU_FAVORITE"])) + } + func test_์•Œ_์ˆ˜_์—†๋Š”_ํƒ€์ž…์ด๋‚˜_์ž˜๋ชป๋œ_๋‚ ์งœ๋Š”_๋ฌด์‹œํ•œ๋‹ค() { XCTAssertNil(PushRoute(userInfo: ["type": "PROMOTION", "date": "20261005"])) XCTAssertNil(PushRoute(userInfo: ["type": "MENU_FAVORITE", "date": "2026-10-05"]))