Фикс: пуш-уведомления — убраны кастомные in-app баннеры, Desktop-active suppression, NSE timeout safety
This commit is contained in:
@@ -4,10 +4,8 @@ import UserNotifications
|
||||
|
||||
// MARK: - Foreground Notification Suppression Tests
|
||||
|
||||
/// Tests for the in-app notification banner suppression logic (Telegram parity).
|
||||
/// System banners are always suppressed (`willPresent` returns `[]`).
|
||||
/// `InAppNotificationManager.shouldSuppress()` decides whether the
|
||||
/// custom in-app banner should be shown or hidden.
|
||||
/// Tests for foreground notification suppression logic.
|
||||
/// `willPresent` returns `[.banner, .sound]` by default, `[]` for active/muted chats.
|
||||
@MainActor
|
||||
struct ForegroundNotificationTests {
|
||||
|
||||
@@ -17,21 +15,23 @@ struct ForegroundNotificationTests {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - System Banner Always Suppressed
|
||||
// MARK: - System Banner Presentation
|
||||
|
||||
@Test("System banner always suppressed — foregroundPresentationOptions returns []")
|
||||
func systemBannerAlwaysSuppressed() {
|
||||
@Test("Non-suppressed chat shows system banner with sound")
|
||||
func nonSuppressedShowsBanner() {
|
||||
clearActiveDialogs()
|
||||
let userInfo: [AnyHashable: Any] = ["dialog": "02aaa", "title": "Alice"]
|
||||
let options = AppDelegate.foregroundPresentationOptions(for: userInfo)
|
||||
#expect(options == [])
|
||||
#expect(options == [.banner, .sound])
|
||||
}
|
||||
|
||||
@Test("System banner suppressed even for inactive chats")
|
||||
func systemBannerSuppressedInactive() {
|
||||
@Test("Active chat suppresses system banner")
|
||||
func activeChatSuppressesBanner() {
|
||||
clearActiveDialogs()
|
||||
MessageRepository.shared.setDialogActive("02bbb", isActive: true)
|
||||
let userInfo: [AnyHashable: Any] = ["dialog": "02bbb"]
|
||||
#expect(AppDelegate.foregroundPresentationOptions(for: userInfo) == [])
|
||||
MessageRepository.shared.setDialogActive("02bbb", isActive: false)
|
||||
}
|
||||
|
||||
// MARK: - In-App Banner: Active Chat → Suppress
|
||||
|
||||
Reference in New Issue
Block a user