From 4427c9b0591500090b679c72bc00ac67946c47c6 Mon Sep 17 00:00:00 2001 From: Isiah Manns Date: Wed, 24 May 2023 18:38:13 -0400 Subject: [PATCH] Todos cleanup (#90) * Remove font todo * Resolve Timer.Size concerns - Timer.Size is used as an accessibility id for timer buttons, and to map timer length settings to the appropriate timer models * Tag core data testing todo with #89 * Tag snapshot test todo with #85 * Decide rest setting defaults --- .../Hourglass/Data Models/TimerModel.swift | 1 - .../Hourglass/Managers/DataManager.swift | 24 +++++-------------- .../Managers/TimerModelStateManager.swift | 1 - Hourglass/Hourglass/Utilities/Constants.swift | 3 +-- Hourglass/Hourglass/Views/AboutView.swift | 2 +- .../Hourglass/Views/StatisticsView.swift | 3 +-- Hourglass/HourglassTests/ViewModelTests.swift | 2 +- 7 files changed, 10 insertions(+), 26 deletions(-) diff --git a/Hourglass/Hourglass/Data Models/TimerModel.swift b/Hourglass/Hourglass/Data Models/TimerModel.swift index c555913..3101b42 100644 --- a/Hourglass/Hourglass/Data Models/TimerModel.swift +++ b/Hourglass/Hourglass/Data Models/TimerModel.swift @@ -37,7 +37,6 @@ extension Timer { } } - // TODO: - May not be needed enum Size { case small case medium diff --git a/Hourglass/Hourglass/Managers/DataManager.swift b/Hourglass/Hourglass/Managers/DataManager.swift index 9b62d2f..bded5b3 100644 --- a/Hourglass/Hourglass/Managers/DataManager.swift +++ b/Hourglass/Hourglass/Managers/DataManager.swift @@ -19,24 +19,12 @@ class DataManager: DataManaging { store: CoreDataStore, timerEventProvider: TimerEventProviding) { let timerModels = [ - Timer.Model(length: settingsManager.getTimerLength(for: .timerFocusSmall), - category: .focus, - size: .small), - Timer.Model(length: settingsManager.getTimerLength(for: .timerFocusMedium), - category: .focus, - size: .medium), - Timer.Model(length: settingsManager.getTimerLength(for: .timerFocusLarge), - category: .focus, - size: .large), - Timer.Model(length: settingsManager.getTimerLength(for: .timerRestSmall), - category: .rest, - size: .small), - Timer.Model(length: settingsManager.getTimerLength(for: .timerRestMedium), - category: .rest, - size: .medium), - Timer.Model(length: settingsManager.getTimerLength(for: .timerRestLarge), - category: .rest, - size: .large) + Timer.Model(length: settingsManager.getTimerLength(for: .timerFocusSmall), category: .focus, size: .small), + Timer.Model(length: settingsManager.getTimerLength(for: .timerFocusMedium), category: .focus, size: .medium), + Timer.Model(length: settingsManager.getTimerLength(for: .timerFocusLarge), category: .focus, size: .large), + Timer.Model(length: settingsManager.getTimerLength(for: .timerRestSmall), category: .rest, size: .small), + Timer.Model(length: settingsManager.getTimerLength(for: .timerRestMedium), category: .rest, size: .medium), + Timer.Model(length: settingsManager.getTimerLength(for: .timerRestLarge), category: .rest, size: .large) ] self.init(timerModels: timerModels, diff --git a/Hourglass/Hourglass/Managers/TimerModelStateManager.swift b/Hourglass/Hourglass/Managers/TimerModelStateManager.swift index 741bda7..e615ee7 100644 --- a/Hourglass/Hourglass/Managers/TimerModelStateManager.swift +++ b/Hourglass/Hourglass/Managers/TimerModelStateManager.swift @@ -135,7 +135,6 @@ class TimerModelStateManager { } private func configureSettingsObservations() { - // TODO: - Sort by length and use array indices, to match UI logic let focusTimers = timerModels.filterByCategory(.focus) let restTimers = timerModels.filterByCategory(.rest) diff --git a/Hourglass/Hourglass/Utilities/Constants.swift b/Hourglass/Hourglass/Utilities/Constants.swift index 538c1a0..127b3e5 100644 --- a/Hourglass/Hourglass/Utilities/Constants.swift +++ b/Hourglass/Hourglass/Utilities/Constants.swift @@ -19,8 +19,7 @@ enum Constants { static let timerRestLarge = 20 // Timer threshold defaults - // TODO: - Decide these values! - static let restWarningThreshold: Int = 15 + static let restWarningThreshold: Int = 30 static let enforceRestThreshold: Int = -1 static let getBackToWorkIsEnabled: Bool = false diff --git a/Hourglass/Hourglass/Views/AboutView.swift b/Hourglass/Hourglass/Views/AboutView.swift index 5c76510..9f2367f 100644 --- a/Hourglass/Hourglass/Views/AboutView.swift +++ b/Hourglass/Hourglass/Views/AboutView.swift @@ -10,7 +10,7 @@ struct AboutView: View { VStack(alignment: .leading, spacing: 20) { VStack(alignment: .leading, spacing: 0) { Text("Hourglass") - .font(.poppins) // TODO: - Rename API with sizes + .font(.poppins) Text("Version 1.0") } diff --git a/Hourglass/Hourglass/Views/StatisticsView.swift b/Hourglass/Hourglass/Views/StatisticsView.swift index 692f43b..872eb59 100644 --- a/Hourglass/Hourglass/Views/StatisticsView.swift +++ b/Hourglass/Hourglass/Views/StatisticsView.swift @@ -12,7 +12,7 @@ struct StatisticsView: View { var body: some View { let timeChunks: [TimeBlock.Chunk] = timeBlocks.flatMap(\.chunks) - // TODO: - Write snapshot tests using test data sets + // TODO: - Write snapshot tests using test data sets (#89) //let timeChunks = [TimeBlock.Chunk]() //let timeChunks = TestData.timeChunks //let timeChunks = Array(TestData.timeChunks.prefix(25)) @@ -307,7 +307,6 @@ private extension TimeBlock { Calendar.current.dateComponents([.year, .month, .day, .hour, .minute, .second], from: end!) } - // TODO: - Test this with Core Data var doesIncludeNextDay: Bool { startDate.day! < endDate.day! } diff --git a/Hourglass/HourglassTests/ViewModelTests.swift b/Hourglass/HourglassTests/ViewModelTests.swift index 776e4f2..4fc8a0e 100644 --- a/Hourglass/HourglassTests/ViewModelTests.swift +++ b/Hourglass/HourglassTests/ViewModelTests.swift @@ -1,7 +1,7 @@ import XCTest @testable import Hourglass -// TODO: - Snapshot test is a better solution to create a state for the button and verify its appearance pixel for pixel. +// TODO: - Snapshot tests to validate timer button state pixel for pixel. (#85) final class ViewModelTests: XCTestCase {