feat: full Pulse Mobile implementation - all modules

- Phase 0: project.yml fixes (CODE_SIGN_ENTITLEMENTS confirmed)
- Phase 1: Enhanced models (HabitModels, TaskModels, FinanceModels, SavingsModels, UserModels)
- Phase 1: Enhanced APIService with all endpoints (habits/log/stats, tasks/uncomplete, finance/analytics, savings/*)
- Phase 2: DashboardView rewrite - day progress bar, 4 stat cards, habit/task lists with Undo (3 sec)
- Phase 3: TrackerView - HabitListView (streak badge, swipe delete, archive), TaskListView (priority, overdue), StatisticsView (heatmap 84 days, line chart, bar chart via Swift Charts)
- Phase 4: FinanceView rewrite - month picker, summary card, top expenses progress bars, pie chart, line chart, transactions by day, analytics tab with bar chart + month comparison
- Phase 5: SavingsView rewrite - overview with overdue block, categories tab with type icons, operations tab with category filter + add sheet
- Phase 6: SettingsView - dark/light theme, profile edit, telegram chat id, notifications toggle + time, timezone picker, logout
- Added: AddHabitView with weekly day selector + interval days
- Added: AddTaskView with icon/color/due date picker
- Haptic feedback on all toggle actions
This commit is contained in:
Cosmo
2026-03-25 17:14:59 +00:00
parent 17b82a874f
commit e7af51af10
18 changed files with 2959 additions and 628 deletions

View File

@@ -1,5 +1,7 @@
import Foundation
// MARK: - FinanceTransaction
struct FinanceTransaction: Codable, Identifiable {
let id: Int
var amount: Double
@@ -9,6 +11,17 @@ struct FinanceTransaction: Codable, Identifiable {
var date: String?
var createdAt: String?
var isIncome: Bool { type == "income" }
var dateFormatted: String {
guard let d = date else { return "" }
let parts = String(d.prefix(10)).split(separator: "-")
guard parts.count == 3 else { return String(d.prefix(10)) }
return "\(parts[2]).\(parts[1]).\(parts[0])"
}
var dateOnly: String { String(date?.prefix(10) ?? "") }
enum CodingKeys: String, CodingKey {
case id, amount, description, type, date
case categoryId = "category_id"
@@ -16,6 +29,8 @@ struct FinanceTransaction: Codable, Identifiable {
}
}
// MARK: - FinanceCategory
struct FinanceCategory: Codable, Identifiable {
let id: Int
var name: String
@@ -24,21 +39,66 @@ struct FinanceCategory: Codable, Identifiable {
var type: String
}
// MARK: - FinanceSummary
struct FinanceSummary: Codable {
var totalIncome: Double?
var totalExpense: Double?
var balance: Double?
var carriedOver: Double?
var month: String?
var byCategory: [CategorySpend]?
var daily: [DailySpend]?
enum CodingKeys: String, CodingKey {
case balance, month
case totalIncome = "total_income"
case totalExpense = "total_expense"
case carriedOver = "carried_over"
case byCategory = "by_category"
case daily
}
}
struct CategorySpend: Codable, Identifiable {
var id: Int { categoryId ?? 0 }
var categoryId: Int?
var categoryName: String?
var total: Double?
var icon: String?
var color: String?
enum CodingKeys: String, CodingKey {
case total, icon, color
case categoryId = "category_id"
case categoryName = "category_name"
}
}
struct DailySpend: Codable, Identifiable {
var id: String { date }
let date: String
let total: Double?
let income: Double?
let expense: Double?
}
// MARK: - FinanceAnalytics
struct FinanceAnalytics: Codable {
var currentMonth: FinanceSummary?
var previousMonth: FinanceSummary?
var byCategory: [CategorySpend]?
enum CodingKeys: String, CodingKey {
case currentMonth = "current_month"
case previousMonth = "previous_month"
case byCategory = "by_category"
}
}
// MARK: - CreateTransactionRequest
struct CreateTransactionRequest: Codable {
var amount: Double
var categoryId: Int?