Files
Reflect/Shared/Models/MoodEntryModel.swift
Trey t 920aaee35c Add premium features and reorganize Settings tab
Premium Features:
- Journal notes and photo attachments for mood entries
- Data export (CSV and PDF reports)
- Privacy lock with Face ID/Touch ID
- Apple Health integration for mood correlation
- 4 new personality packs (Motivational Coach, Zen Master, Best Friend, Data Analyst)

Settings Tab Reorganization:
- Combined Customize and Settings into single tab with segmented control
- Added upgrade banner with trial countdown above segment
- "Why Upgrade?" sheet showing all premium benefits
- Subscribe button opens improved StoreKit 2 subscription view

UI Improvements:
- Enhanced subscription store with feature highlights
- Entry detail view for viewing/editing notes and photos
- Removed duplicate subscription banners from tab content

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 12:22:06 -06:00

94 lines
2.0 KiB
Swift

//
// MoodEntryModel.swift
// Feels
//
// SwiftData model replacing Core Data MoodEntry
//
import Foundation
import SwiftData
// MARK: - Entry Type Enum
enum EntryType: Int, Codable {
case listView = 0
case widget = 1
case watch = 2
case shortcut = 3
case filledInMissing = 4
case notification = 5
case header = 6
}
// MARK: - SwiftData Model
@Model
final class MoodEntryModel {
// Primary attributes
var forDate: Date
var moodValue: Int
var timestamp: Date
var weekDay: Int
var entryType: Int
// Metadata
var canEdit: Bool
var canDelete: Bool
// Journal & Media (NEW)
var notes: String?
var photoID: UUID?
// Computed properties
var mood: Mood {
Mood(rawValue: moodValue) ?? .missing
}
var moodString: String {
mood.strValue
}
init(
forDate: Date,
mood: Mood,
entryType: EntryType,
canEdit: Bool = true,
canDelete: Bool = true,
notes: String? = nil,
photoID: UUID? = nil
) {
self.forDate = forDate
self.moodValue = mood.rawValue
self.timestamp = Date()
self.weekDay = Calendar.current.component(.weekday, from: forDate)
self.entryType = entryType.rawValue
self.canEdit = canEdit
self.canDelete = canDelete
self.notes = notes
self.photoID = photoID
}
// Convenience initializer for raw values
init(
forDate: Date,
moodValue: Int,
entryType: Int,
timestamp: Date = Date(),
weekDay: Int? = nil,
canEdit: Bool = true,
canDelete: Bool = true,
notes: String? = nil,
photoID: UUID? = nil
) {
self.forDate = forDate
self.moodValue = moodValue
self.timestamp = timestamp
self.weekDay = weekDay ?? Calendar.current.component(.weekday, from: forDate)
self.entryType = entryType
self.canEdit = canEdit
self.canDelete = canDelete
self.notes = notes
self.photoID = photoID
}
}