Skip to content

Latest commit

 

History

History
108 lines (88 loc) · 5.56 KB

File metadata and controls

108 lines (88 loc) · 5.56 KB

Refactor Summary

This document summarizes the refactoring and modernization work completed in this session.

High-Level Goals Completed

  • SwiftUI modernization (deprecated APIs, accessibility labels, modifiers).
  • Concurrency safety improvements (cancellable tasks, removal of unstructured Task.detached where possible).
  • Large view extraction and logic cleanup (move logic out of body, create dedicated subviews).

SwiftUI Modernization

  • Replaced .foregroundColor(...) with .foregroundStyle(...) across the codebase.
  • Replaced icon-only toolbar buttons with labeled buttons using Label(...).labelStyle(.iconOnly) to improve VoiceOver support.
  • Converted Text + Text concatenation to string interpolation with styled Text fragments.
  • Replaced onTapGesture toggling on Toggle with .animation(..., value:) where appropriate.

Concurrency Improvements

  • Replaced Task.sleep(nanoseconds:) with Task.sleep(for:) and handled throwing sleeps with try? inside non-throwing task closures.
  • Converted DispatchQueue.* usage to Task where safe.
  • Added cancellable debounced tasks in several views to prevent overlapping work.
  • Removed Task.detached usage where it was unnecessary, keeping one debug-only detached task in CreateStreamingHandlers by design.

Extracted Subviews / New Files

Created new SwiftUI subviews to shrink large bodies and isolate responsibilities:

  • RsyncUI/Views/InspectorViews/LogRecords/LogRecordsFooterView.swift
  • RsyncUI/Views/Tasks/TasksFocusActionsView.swift
  • RsyncUI/Views/Snapshots/SnapshotsMainContentView.swift
  • RsyncUI/Views/Restore/RestoreContentView.swift
  • RsyncUI/Views/Restore/RestoreControlsView.swift
  • RsyncUI/Views/ScheduleView/CalendarMonthGridView.swift
  • RsyncUI/Views/Detailsview/SummarizedDetailsContentView.swift
  • RsyncUI/Views/Tasks/TasksListPanelView.swift
  • RsyncUI/Views/InspectorViews/Add/GlobalChangeFormView.swift
  • RsyncUI/Views/Quicktask/QuicktaskFormView.swift
  • RsyncUI/Views/Sidebar/SidebarStatusMessagesView.swift
  • RsyncUI/Views/InspectorViews/Add/AddTaskContentView.swift

Notable Behavior Changes

  • None intended. UI flows and task execution behavior should be identical; changes are structural and accessibility-oriented.

Files Added / Removed

Added:

  • RsyncUI/Views/InspectorViews/LogRecords/LogRecordsFooterView.swift
  • RsyncUI/Views/Tasks/TasksFocusActionsView.swift
  • RsyncUI/Views/Snapshots/SnapshotsMainContentView.swift
  • RsyncUI/Views/Restore/RestoreContentView.swift
  • RsyncUI/Views/Restore/RestoreControlsView.swift
  • RsyncUI/Views/ScheduleView/CalendarMonthGridView.swift
  • RsyncUI/Views/Detailsview/SummarizedDetailsContentView.swift
  • RsyncUI/Views/Tasks/TasksListPanelView.swift
  • RsyncUI/Views/InspectorViews/Add/GlobalChangeFormView.swift
  • RsyncUI/Views/Quicktask/QuicktaskFormView.swift
  • RsyncUI/Views/Sidebar/SidebarStatusMessagesView.swift
  • RsyncUI/Views/InspectorViews/Add/AddTaskContentView.swift

Removed:

  • None

Key Files Refactored

  • RsyncUI/Views/Tasks/TasksView.swift
  • RsyncUI/Views/InspectorViews/LogRecords/LogRecordsTabView.swift
  • RsyncUI/Views/Snapshots/SnapshotsView.swift
  • RsyncUI/Views/Restore/RestoreTableView.swift
  • RsyncUI/Views/ScheduleView/CalendarMonthView.swift
  • RsyncUI/Views/Detailsview/SummarizedDetailsView.swift
  • RsyncUI/Views/InspectorViews/Add/GlobalChangeTaskView.swift
  • RsyncUI/Views/Quicktask/QuicktaskView.swift
  • RsyncUI/Views/Sidebar/SidebarMainView.swift
  • RsyncUI/Views/InspectorViews/Add/AddTaskView.swift

Behavior Preserved

  • UI flows, navigation, and task execution logic are unchanged.
  • All extracted subviews preserve existing layout and logic, just moved into dedicated files.
  • Debug-only concurrency checks remain intact.

Diagnostics Run

  • XcodeRefreshCodeIssuesInFile for all refactored files; no outstanding issues remain.

Known Exceptions

  • A debug-only Task.detached remains in CreateStreamingHandlers for threading verification.

What To Do Next

  1. Optional view model extraction

    • Some views still have substantial business logic. If desired, extract to @Observable view models for QuicktaskView, TasksView, and SidebarMainView.
  2. Additional accessibility sweep

    • Verify any remaining labels/buttons for VoiceOver and Dynamic Type compliance.
  3. Build + tests

    • Run a full Xcode build to validate the refactors across the project.
    • If available, run unit/UI tests to catch regressions.
  4. Performance pass

    • Evaluate large tables/lists for expensive inline computations and consider caching or precomputing where appropriate.
  5. Optional follow-ups

    • Further subview extraction in SidebarMainView, QuicktaskView, and AddTaskView if desired.

Testing Recommendations

  • Add tests for VerifyConfiguration error propagation for each ValidateInputError case.
  • Verify snapshot side effects by asserting when snapshotcreateremotecatalog is invoked and when it is not.
  • Expand DeeplinkURL.handleURL tests for invalid schemes, unsupported actions, and validateNoAction.
  • Strengthen ArgumentsSynchronize coverage by validating specific argument flags per task type.
  • Add JSON decode/encode tests for DecodeSynchronizeConfiguration, DecodeLogRecords, and DecodeUserConfiguration, including invalid and backward-compat cases.
  • Cover storage read/write flows for log records, schedules, widgets, and configurations.
  • Add utility tests for SSHParams, Rsyncversion, and GetfullpathforRsync.
  • Add async/actor tests for storage actors (ActorReadSchedule, ActorReadSynchronizeConfigurationJSON, ActorLogToFile).