Add interactive widget voting and fix warnings/bugs

Widget Features:
- Add inline voting to timeline widget when no entry exists for today
- Show random prompt from notification strings in voting mode
- Update vote widget to use simple icon style for selection
- Make stats bar full width in voted state view
- Add Localizable.strings to widget extension target

Bug Fixes:
- Fix inverted date calculation in InsightsViewModel streak logic
- Replace force unwraps with safe optional handling in widgets
- Replace fatalError calls with graceful error handling
- Fix CSV import safety in SettingsView

Warning Fixes:
- Add @retroactive to Color and Date extension conformances
- Update deprecated onChange(of:perform:) to new syntax
- Replace deprecated applicationIconBadgeNumber with setBadgeCount
- Replace deprecated UIApplication.shared.windows API
- Add @preconcurrency for Swift 6 protocol conformances
- Add missing widget family cases to switch statement
- Remove unused variables and #warning directives

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-12-10 16:23:12 -06:00
parent aaaf04f05e
commit f822927e98
20 changed files with 317 additions and 220 deletions

View File

@@ -58,29 +58,27 @@ struct MainTabView: View {
})
})
.onAppear(perform: {
switch theme {
case .system:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .unspecified
case .iFeel:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .unspecified
case .dark:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .dark
case .light:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .light
}
})
.onChange(of: theme, perform: { value in
switch theme {
case .system:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .unspecified
case .iFeel:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .unspecified
case .dark:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .dark
case .light:
UIApplication.shared.windows.first?.overrideUserInterfaceStyle = .light
}
applyTheme(theme)
})
.onChange(of: theme) { _, newTheme in
applyTheme(newTheme)
}
}
private func applyTheme(_ theme: Theme) {
let style: UIUserInterfaceStyle
switch theme {
case .system, .iFeel:
style = .unspecified
case .dark:
style = .dark
case .light:
style = .light
}
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
let window = windowScene.windows.first else { return }
window.overrideUserInterfaceStyle = style
}
}