Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions apps/HeartCoach/Shared/Models/ProactiveNotificationType.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// ProactiveNotificationType.swift
// ThumpCore
//
// Shared proactive notification identifiers and metadata.
// Used by both iOS notification scheduling and shared persistence.
//
// Platforms: iOS 17+, watchOS 10+

import Foundation

/// All proactive notification types added by the gap analysis.
enum ProactiveNotificationType: String, Sendable, CaseIterable {
case morningBriefing
case bedtimeWindDown
case postWorkoutRecovery
case trainingOpportunity
case illnessDetection
case eveningRecovery
case reboundConfirmation

var threadIdentifier: String {
"com.thump.alerts.\(rawValue)"
}

/// Stable identifier — one per type, no UUID, so scheduling replaces
/// any existing pending notification of the same type.
var notificationIdentifier: String {
"com.thump.\(rawValue)"
}

/// Priority for daily budget arbitration (higher = more important).
var priority: Int {
switch self {
case .illnessDetection: return 100
case .morningBriefing: return 90
case .reboundConfirmation: return 80
case .trainingOpportunity: return 70
case .eveningRecovery: return 60
case .bedtimeWindDown: return 50
case .postWorkoutRecovery: return 40
}
}
}
36 changes: 0 additions & 36 deletions apps/HeartCoach/iOS/Services/ProactiveNotificationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,6 @@
import Foundation
import UserNotifications

// MARK: - Notification Types

/// All proactive notification types added by the gap analysis.
enum ProactiveNotificationType: String, Sendable, CaseIterable {
case morningBriefing
case bedtimeWindDown
case postWorkoutRecovery
case trainingOpportunity
case illnessDetection
case eveningRecovery
case reboundConfirmation

var threadIdentifier: String {
"com.thump.alerts.\(rawValue)"
}

/// Stable identifier — one per type, no UUID, so scheduling replaces
/// any existing pending notification of the same type (GPT-5.4 fix #2).
var notificationIdentifier: String {
"com.thump.\(rawValue)"
}

/// Priority for daily budget arbitration (higher = more important).
var priority: Int {
switch self {
case .illnessDetection: return 100
case .morningBriefing: return 90
case .reboundConfirmation: return 80
case .trainingOpportunity: return 70
case .eveningRecovery: return 60
case .bedtimeWindDown: return 50
case .postWorkoutRecovery: return 40
}
}
}

// MARK: - Configuration

/// All thresholds in one testable struct — no magic numbers (Gemini design).
Expand Down
Loading