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

@@ -16,28 +16,40 @@ struct SavingsCategory: Codable, Identifiable {
var depositStartDate: String?
var depositEndDate: String?
var recurringAmount: Double?
var recurringDay: Int?
var icon: String {
if isCredit == true { return "creditcard.fill" }
if isDeposit == true { return "percent" }
if isAccount == true { return "building.columns.fill" }
if isRecurring == true { return "arrow.clockwise" }
return "banknote.fill"
}
var color: String {
var colorHex: String {
if isCredit == true { return "ff4757" }
if isDeposit == true { return "ffa502" }
if isAccount == true { return "7c3aed" }
if isRecurring == true { return "00d4aa" }
return "8888aa"
}
var typeLabel: String {
if isCredit == true { return "Кредит \(Int(interestRate ?? 0))%" }
if isDeposit == true { return "Вклад \(Int(interestRate ?? 0))%" }
if isAccount == true { return "Счёт" }
if isRecurring == true { return "Накопления" }
return "Копилка"
if isRecurring == true { return "Регулярные" }
return "Накопление"
}
var typeEmoji: String {
if isCredit == true { return "💳" }
if isDeposit == true { return "🏦" }
if isAccount == true { return "🏧" }
if isRecurring == true { return "🔄" }
return "💰"
}
enum CodingKeys: String, CodingKey {
case id, name, description
case isDeposit = "is_deposit"
@@ -52,6 +64,7 @@ struct SavingsCategory: Codable, Identifiable {
case depositStartDate = "deposit_start_date"
case depositEndDate = "deposit_end_date"
case recurringAmount = "recurring_amount"
case recurringDay = "recurring_day"
}
}
@@ -66,9 +79,18 @@ struct SavingsTransaction: Codable, Identifiable {
var createdAt: String?
var categoryName: String?
var userName: String?
var isDeposit: Bool { type == "deposit" }
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, type, description, date
case categoryId = "category_id"
@@ -84,11 +106,30 @@ struct SavingsStats: Codable {
var totalDeposits: Double?
var totalWithdrawals: Double?
var categoriesCount: Int?
var monthlyPayments: Double?
var overdueAmount: Double?
var overdueCount: Int?
enum CodingKeys: String, CodingKey {
case totalBalance = "total_balance"
case totalDeposits = "total_deposits"
case totalWithdrawals = "total_withdrawals"
case categoriesCount = "categories_count"
case monthlyPayments = "monthly_payments"
case overdueAmount = "overdue_amount"
case overdueCount = "overdue_count"
}
}
struct CreateSavingsTransactionRequest: Codable {
var categoryId: Int
var amount: Double
var type: String
var description: String?
var date: String?
enum CodingKeys: String, CodingKey {
case amount, type, description, date
case categoryId = "category_id"
}
}