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:
@@ -1,5 +1,7 @@
|
||||
import Foundation
|
||||
|
||||
// MARK: - PulseTask
|
||||
|
||||
struct PulseTask: Codable, Identifiable {
|
||||
let id: Int
|
||||
var title: String
|
||||
@@ -11,6 +13,9 @@ struct PulseTask: Codable, Identifiable {
|
||||
var dueDate: String?
|
||||
var reminderTime: String?
|
||||
var createdAt: String?
|
||||
var isRecurring: Bool?
|
||||
var recurrenceType: String?
|
||||
var recurrenceInterval: Int?
|
||||
|
||||
var priorityColor: String {
|
||||
switch priority {
|
||||
@@ -31,22 +36,80 @@ struct PulseTask: Codable, Identifiable {
|
||||
}
|
||||
}
|
||||
|
||||
var isOverdue: Bool {
|
||||
guard !completed, let due = dueDate else { return false }
|
||||
let dateStr = String(due.prefix(10))
|
||||
let today = ISO8601DateFormatter().string(from: Date()).prefix(10)
|
||||
return dateStr < today
|
||||
}
|
||||
|
||||
var dueDateFormatted: String? {
|
||||
guard let due = dueDate else { return nil }
|
||||
let dateStr = String(due.prefix(10))
|
||||
let todayStr = String(ISO8601DateFormatter().string(from: Date()).prefix(10))
|
||||
let tomorrowDate = Calendar.current.date(byAdding: .day, value: 1, to: Date())!
|
||||
let tomorrowStr = String(ISO8601DateFormatter().string(from: tomorrowDate).prefix(10))
|
||||
if dateStr == todayStr { return "Сегодня" }
|
||||
if dateStr == tomorrowStr { return "Завтра" }
|
||||
let parts = dateStr.split(separator: "-")
|
||||
guard parts.count == 3 else { return dateStr }
|
||||
return "\(parts[2]).\(parts[1]).\(parts[0])"
|
||||
}
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case id, title, description, completed, priority, icon, color
|
||||
case dueDate = "due_date"
|
||||
case reminderTime = "reminder_time"
|
||||
case createdAt = "created_at"
|
||||
case isRecurring = "is_recurring"
|
||||
case recurrenceType = "recurrence_type"
|
||||
case recurrenceInterval = "recurrence_interval"
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - TaskStats
|
||||
|
||||
struct TaskStats: Codable {
|
||||
let totalTasks: Int?
|
||||
let completedTasks: Int?
|
||||
let todayTasks: Int?
|
||||
let todayCompleted: Int?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case totalTasks = "total_tasks"
|
||||
case completedTasks = "completed_tasks"
|
||||
case todayTasks = "today_tasks"
|
||||
case todayCompleted = "today_completed"
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - CreateTaskRequest
|
||||
|
||||
struct CreateTaskRequest: Codable {
|
||||
var title: String
|
||||
var description: String?
|
||||
var priority: Int?
|
||||
var dueDate: String?
|
||||
var icon: String?
|
||||
var color: String?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case title, description, priority
|
||||
case title, description, priority, icon, color
|
||||
case dueDate = "due_date"
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - UpdateTaskRequest
|
||||
|
||||
struct UpdateTaskRequest: Codable {
|
||||
var title: String?
|
||||
var description: String?
|
||||
var priority: Int?
|
||||
var dueDate: String?
|
||||
var completed: Bool?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case title, description, priority, completed
|
||||
case dueDate = "due_date"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user