Rebrand from Casera/MyCrib to honeyDue

Total rebrand across KMM project:
- Kotlin package: com.example.casera -> com.tt.honeyDue (dirs + declarations)
- Gradle: rootProject.name, namespace, applicationId
- Android: manifest, strings.xml (all languages), widget resources
- iOS: pbxproj bundle IDs, Info.plist, entitlements, xcconfig
- iOS directories: Casera/ -> HoneyDue/, CaseraTests/ -> HoneyDueTests/, etc.
- Swift source: all class/struct/enum renames
- Deep links: casera:// -> honeydue://, .casera -> .honeydue
- App icons replaced with honeyDue honeycomb icon
- Domains: casera.treytartt.com -> honeyDue.treytartt.com
- Bundle IDs: com.tt.casera -> com.tt.honeyDue
- Database table names preserved

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-03-07 06:33:57 -06:00
parent 9c574c4343
commit 1e2adf7660
450 changed files with 1730 additions and 1788 deletions

View File

@@ -0,0 +1,304 @@
//
// AppIntent.swift
// honeyDue
//
// Created by Trey Tartt on 11/5/25.
//
import WidgetKit
import AppIntents
import Foundation
// MARK: - Widget Configuration Intent
struct ConfigurationAppIntent: WidgetConfigurationIntent {
static var title: LocalizedStringResource { "honeyDue Configuration" }
static var description: IntentDescription { "Configure your honeyDue widget" }
}
// MARK: - Complete Task Intent
/// Marks a task as completed from the widget by calling the API directly
struct CompleteTaskIntent: AppIntent {
static var title: LocalizedStringResource { "Complete Task" }
static var description: IntentDescription { "Mark a task as completed" }
@Parameter(title: "Task ID")
var taskId: Int
@Parameter(title: "Task Title")
var taskTitle: String
init() {
self.taskId = 0
self.taskTitle = ""
}
init(taskId: Int, taskTitle: String) {
self.taskId = taskId
self.taskTitle = taskTitle
}
func perform() async throws -> some IntentResult {
print("CompleteTaskIntent: Starting completion for task \(taskId)")
// Check auth BEFORE marking pending if auth fails the task should remain visible
guard let token = WidgetActionManager.shared.getAuthToken() else {
print("CompleteTaskIntent: No auth token available")
WidgetCenter.shared.reloadTimelines(ofKind: "honeyDue")
return .result()
}
guard let baseURL = WidgetActionManager.shared.getAPIBaseURL() else {
print("CompleteTaskIntent: No API base URL available")
WidgetCenter.shared.reloadTimelines(ofKind: "honeyDue")
return .result()
}
// Mark task as pending completion (optimistic UI) only after auth is confirmed
WidgetActionManager.shared.markTaskPendingCompletion(taskId: taskId)
// Reload widget immediately to update task list and stats
WidgetCenter.shared.reloadTimelines(ofKind: "honeyDue")
// Make API call to complete the task
let success = await WidgetAPIClient.quickCompleteTask(
taskId: taskId,
token: token,
baseURL: baseURL
)
if success {
print("CompleteTaskIntent: Task \(taskId) completed successfully")
// Mark tasks as dirty so main app refreshes on next launch
WidgetActionManager.shared.markTasksDirty()
} else {
print("CompleteTaskIntent: Failed to complete task \(taskId)")
// Task will remain hidden until it times out or app refreshes
}
// Reload widget
WidgetCenter.shared.reloadTimelines(ofKind: "honeyDue")
return .result()
}
}
// MARK: - Widget API Client
/// Lightweight API client for widget network calls
enum WidgetAPIClient {
/// Complete a task via the quick-complete endpoint
/// Returns true on success, false on failure
static func quickCompleteTask(taskId: Int, token: String, baseURL: String) async -> Bool {
let urlString = "\(baseURL)/tasks/\(taskId)/quick-complete/"
guard let url = URL(string: urlString) else {
print("WidgetAPIClient: Invalid URL: \(urlString)")
return false
}
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Token \(token)", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.timeoutInterval = 10 // Short timeout for widget
do {
let (_, response) = try await URLSession.shared.data(for: request)
if let httpResponse = response as? HTTPURLResponse {
let isSuccess = httpResponse.statusCode == 200
print("WidgetAPIClient: quick-complete response: \(httpResponse.statusCode)")
return isSuccess
}
return false
} catch {
print("WidgetAPIClient: Error completing task: \(error.localizedDescription)")
return false
}
}
}
// MARK: - Open Task Intent
/// Opens a specific task in the main app
struct OpenTaskIntent: AppIntent {
static var title: LocalizedStringResource { "Open Task" }
static var description: IntentDescription { "Open task details in the app" }
@Parameter(title: "Task ID")
var taskId: Int
init() {
self.taskId = 0
}
init(taskId: Int) {
self.taskId = taskId
}
static var openAppWhenRun: Bool { true }
func perform() async throws -> some IntentResult {
// The app will handle deep linking via URL scheme
return .result()
}
}
// MARK: - Widget Action Manager
/// Manages shared data between the main app and widget extension via App Group
final class WidgetActionManager {
static let shared = WidgetActionManager()
private let appGroupIdentifier = "group.com.tt.honeyDue.HoneyDueDev"
private let pendingTasksFileName = "widget_pending_tasks.json"
private let tokenKey = "widget_auth_token"
private let dirtyFlagKey = "widget_tasks_dirty"
private let apiBaseURLKey = "widget_api_base_url"
private let limitationsEnabledKey = "widget_limitations_enabled"
private let isPremiumKey = "widget_is_premium"
private var sharedDefaults: UserDefaults? {
UserDefaults(suiteName: appGroupIdentifier)
}
private init() {}
// MARK: - Shared Container Access
private var sharedContainerURL: URL? {
FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupIdentifier)
}
private var pendingTasksFileURL: URL? {
sharedContainerURL?.appendingPathComponent(pendingTasksFileName)
}
// MARK: - Auth Token Access
/// Get auth token from shared App Group (set by main app)
func getAuthToken() -> String? {
return sharedDefaults?.string(forKey: tokenKey)
}
/// Get API base URL from shared App Group (set by main app)
func getAPIBaseURL() -> String? {
return sharedDefaults?.string(forKey: apiBaseURLKey)
}
// MARK: - Dirty Flag
/// Mark tasks as dirty (needs refresh from server)
func markTasksDirty() {
sharedDefaults?.set(true, forKey: dirtyFlagKey)
sharedDefaults?.synchronize()
print("WidgetActionManager: Marked tasks as dirty")
}
// MARK: - Subscription Status
/// Check if limitations are enabled (from backend)
func areLimitationsEnabled() -> Bool {
return sharedDefaults?.bool(forKey: limitationsEnabledKey) ?? false
}
/// Check if user has premium subscription
func isPremium() -> Bool {
return sharedDefaults?.bool(forKey: isPremiumKey) ?? false
}
/// Check if widget should show interactive features
/// Returns true if: limitations disabled OR user is premium
func shouldShowInteractiveWidget() -> Bool {
let limitationsEnabled = areLimitationsEnabled()
let premium = isPremium()
// Interactive if limitations are off, or if user is premium
return !limitationsEnabled || premium
}
// MARK: - Pending Task State Management
/// Tracks which tasks have pending completion (not yet synced with server)
struct PendingTaskState: Codable {
let taskId: Int
let timestamp: Date
}
/// Mark a task as pending completion (optimistic UI update - hides from widget)
func markTaskPendingCompletion(taskId: Int) {
var pendingTasks = loadPendingTaskStates()
// Remove any existing state for this task
pendingTasks.removeAll { $0.taskId == taskId }
// Add new pending state
pendingTasks.append(PendingTaskState(
taskId: taskId,
timestamp: Date()
))
savePendingTaskStates(pendingTasks)
}
/// Load pending task states
func loadPendingTaskStates() -> [PendingTaskState] {
guard let fileURL = pendingTasksFileURL,
FileManager.default.fileExists(atPath: fileURL.path) else {
return []
}
do {
let data = try Data(contentsOf: fileURL)
let states = try JSONDecoder().decode([PendingTaskState].self, from: data)
// Filter out stale states (older than 5 minutes)
let freshStates = states.filter { state in
Date().timeIntervalSince(state.timestamp) < 300 // 5 minutes
}
if freshStates.count != states.count {
savePendingTaskStates(freshStates)
}
return freshStates
} catch {
return []
}
}
/// Save pending task states
private func savePendingTaskStates(_ states: [PendingTaskState]) {
guard let fileURL = pendingTasksFileURL else { return }
do {
let data = try JSONEncoder().encode(states)
try data.write(to: fileURL, options: .atomic)
} catch {
print("WidgetActionManager: Error saving pending task states - \(error)")
}
}
/// Clear pending state for a task (called after synced with server)
func clearPendingState(forTaskId taskId: Int) {
var pendingTasks = loadPendingTaskStates()
pendingTasks.removeAll { $0.taskId == taskId }
savePendingTaskStates(pendingTasks)
// Also reload widget
WidgetCenter.shared.reloadTimelines(ofKind: "honeyDue")
}
/// Clear all pending states
func clearAllPendingStates() {
guard let fileURL = pendingTasksFileURL else { return }
do {
try FileManager.default.removeItem(at: fileURL)
} catch {
// File might not exist
}
}
/// Check if a task is pending completion
func isTaskPendingCompletion(taskId: Int) -> Bool {
let states = loadPendingTaskStates()
return states.contains { $0.taskId == taskId }
}
}

View File

@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,35 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "tinted"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,16 @@
//
// HoneyDueBundle.swift
// honeyDue
//
// Created by Trey Tartt on 11/5/25.
//
import WidgetKit
import SwiftUI
@main
struct HoneyDueBundle: WidgetBundle {
var body: some Widget {
honeyDue()
}
}

View File

@@ -0,0 +1,316 @@
import SwiftUI
// MARK: - Centered Icon View
struct HoneyDueIconView: View {
var houseProgress: CGFloat = 1.0
var windowScale: CGFloat = 1.0
var checkmarkScale: CGFloat = 1.0
var foregroundColor: Color = Color(red: 1.0, green: 0.96, blue: 0.92)
var backgroundColor: Color? = nil // nil uses default gradient, otherwise uses theme color
var body: some View {
GeometryReader { geo in
let size = min(geo.size.width, geo.size.height)
let center = CGPoint(x: geo.size.width / 2, y: geo.size.height / 2)
ZStack {
// Background - use provided color or default gradient
if let bgColor = backgroundColor {
RoundedRectangle(cornerRadius: size * 0.195)
.fill(
LinearGradient(
colors: [bgColor, bgColor.opacity(0.85)],
startPoint: .top,
endPoint: .bottom
)
)
.frame(width: size * 0.906, height: size * 0.906)
.position(center)
} else {
RoundedRectangle(cornerRadius: size * 0.195)
.fill(
LinearGradient(
colors: [
Color(red: 1.0, green: 0.64, blue: 0.28),
Color(red: 0.96, green: 0.51, blue: 0.20)
],
startPoint: .top,
endPoint: .bottom
)
)
.frame(width: size * 0.906, height: size * 0.906)
.position(center)
}
// House outline
HousePath(progress: houseProgress)
.stroke(foregroundColor, style: StrokeStyle(
lineWidth: size * 0.055,
lineCap: .round,
lineJoin: .round
))
.frame(width: size, height: size)
.position(center)
// Window
RoundedRectangle(cornerRadius: size * 0.023)
.fill(foregroundColor)
.frame(width: size * 0.102, height: size * 0.102)
.scaleEffect(windowScale)
.position(x: center.x, y: center.y - size * 0.09)
// Checkmark
CheckmarkShape()
.stroke(foregroundColor, style: StrokeStyle(
lineWidth: size * 0.0625,
lineCap: .round,
lineJoin: .round
))
.frame(width: size, height: size)
.scaleEffect(checkmarkScale)
.position(center)
}
}
.aspectRatio(1, contentMode: .fit)
}
}
// MARK: - House Path (both sides)
struct HousePath: Shape {
var progress: CGFloat = 1.0
var animatableData: CGFloat {
get { progress }
set { progress = newValue }
}
func path(in rect: CGRect) -> Path {
let w = rect.width
let h = rect.height
let cx = rect.midX
let cy = rect.midY
var path = Path()
// Left side: roof peak -> down left wall -> foot
path.move(to: CGPoint(x: cx, y: cy - h * 0.27))
path.addLine(to: CGPoint(x: cx - w * 0.232, y: cy - h * 0.09))
path.addQuadCurve(
to: CGPoint(x: cx - w * 0.266, y: cy + h * 0.02),
control: CGPoint(x: cx - w * 0.266, y: cy - h * 0.055)
)
path.addLine(to: CGPoint(x: cx - w * 0.266, y: cy + h * 0.195))
path.addQuadCurve(
to: CGPoint(x: cx - w * 0.207, y: cy + h * 0.254),
control: CGPoint(x: cx - w * 0.266, y: cy + h * 0.254)
)
path.addLine(to: CGPoint(x: cx - w * 0.154, y: cy + h * 0.254))
// Right side: roof peak -> down right wall -> foot
path.move(to: CGPoint(x: cx, y: cy - h * 0.27))
path.addLine(to: CGPoint(x: cx + w * 0.232, y: cy - h * 0.09))
path.addQuadCurve(
to: CGPoint(x: cx + w * 0.266, y: cy + h * 0.02),
control: CGPoint(x: cx + w * 0.266, y: cy - h * 0.055)
)
path.addLine(to: CGPoint(x: cx + w * 0.266, y: cy + h * 0.195))
path.addQuadCurve(
to: CGPoint(x: cx + w * 0.207, y: cy + h * 0.254),
control: CGPoint(x: cx + w * 0.266, y: cy + h * 0.254)
)
path.addLine(to: CGPoint(x: cx + w * 0.154, y: cy + h * 0.254))
return path.trimmedPath(from: 0, to: progress)
}
}
// MARK: - Checkmark Shape
struct CheckmarkShape: Shape {
var progress: CGFloat = 1.0
var animatableData: CGFloat {
get { progress }
set { progress = newValue }
}
func path(in rect: CGRect) -> Path {
let w = rect.width
let h = rect.height
let cx = rect.midX
let cy = rect.midY
var path = Path()
// Checkmark: starts bottom-left, goes to bottom-center, then up-right
path.move(to: CGPoint(x: cx - w * 0.158, y: cy + h * 0.145))
path.addLine(to: CGPoint(x: cx - w * 0.041, y: cy + h * 0.263))
path.addLine(to: CGPoint(x: cx + w * 0.193, y: cy + h * 0.01))
return path.trimmedPath(from: 0, to: progress)
}
}
// MARK: - Animations
struct FullIntroAnimationView: View {
@State private var houseProgress: CGFloat = 0
@State private var windowScale: CGFloat = 0
@State private var checkScale: CGFloat = 0
var body: some View {
HoneyDueIconView(
houseProgress: houseProgress,
windowScale: windowScale,
checkmarkScale: checkScale
)
.onAppear { animate() }
}
func animate() {
withAnimation(.easeOut(duration: 0.6)) {
houseProgress = 1.0
}
withAnimation(.spring(response: 0.4, dampingFraction: 0.6).delay(0.5)) {
windowScale = 1.0
}
withAnimation(.easeOut(duration: 0.25).delay(0.9)) {
checkScale = 1.2
}
withAnimation(.easeInOut(duration: 0.15).delay(1.15)) {
checkScale = 1.0
}
}
}
struct PulsatingCheckmarkView: View {
@State private var checkScale: CGFloat = 1.0
var body: some View {
HoneyDueIconView(checkmarkScale: checkScale)
.onAppear {
withAnimation(.easeInOut(duration: 0.5).repeatForever(autoreverses: true)) {
checkScale = 1.3
}
}
}
}
struct PulsingIconView: View {
@State private var scale: CGFloat = 1.0
var backgroundColor: Color? = nil
var body: some View {
HoneyDueIconView(backgroundColor: backgroundColor)
.scaleEffect(scale)
.onAppear {
withAnimation(.easeInOut(duration: 0.8).repeatForever(autoreverses: true)) {
scale = 1.08
}
}
}
}
struct BouncyIconView: View {
@State private var offset: CGFloat = -300
@State private var scale: CGFloat = 0.5
var body: some View {
HoneyDueIconView()
.scaleEffect(scale)
.offset(y: offset)
.onAppear {
withAnimation(.spring(response: 0.6, dampingFraction: 0.5)) {
offset = 0
scale = 1.0
}
}
}
}
struct WigglingIconView: View {
@State private var angle: Double = 0
var body: some View {
HoneyDueIconView()
.rotationEffect(.degrees(angle))
.onAppear {
withAnimation(.easeInOut(duration: 0.1).repeatForever(autoreverses: true)) {
angle = 5
}
}
}
}
// MARK: - Playground UI
struct PlaygroundContentView: View {
@State private var selectedAnimation = 0
@State private var animationKey = UUID()
let animations = ["Full Intro", "Pulsating", "Pulse", "Bounce", "Wiggle"]
var body: some View {
VStack(spacing: 20) {
Text("HoneyDue Icon Animations")
.font(.title)
.fontWeight(.bold)
ZStack {
RoundedRectangle(cornerRadius: 20)
.fill(Color(.systemGray6))
.frame(height: 250)
currentAnimation
.frame(width: 150, height: 150)
.id(animationKey)
}
.padding(.horizontal)
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 10) {
ForEach(0..<animations.count, id: \.self) { index in
Button {
selectedAnimation = index
animationKey = UUID()
} label: {
Text(animations[index])
.font(.caption)
.fontWeight(selectedAnimation == index ? .bold : .regular)
.padding(.horizontal, 12)
.padding(.vertical, 8)
.background(
Capsule().fill(selectedAnimation == index ? Color.orange : Color(.systemGray5))
)
.foregroundColor(selectedAnimation == index ? .white : .primary)
}
.buttonStyle(.plain)
}
}
.padding(.horizontal)
}
Button("Replay") { animationKey = UUID() }
.buttonStyle(.borderedProminent)
.tint(.orange)
Spacer()
}
.padding(.top, 30)
.frame(width: 450, height: 500)
.background(Color(.systemBackground))
}
@ViewBuilder
var currentAnimation: some View {
switch selectedAnimation {
case 0: FullIntroAnimationView()
case 1: PulsatingCheckmarkView()
case 2: PulsingIconView()
case 3: BouncyIconView()
case 4: WigglingIconView()
default: HoneyDueIconView()
}
}
}

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.widgetkit-extension</string>
</dict>
</dict>
</plist>