-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle TimerCategoryToggle state changes
- Loading branch information
1 parent
261ae98
commit 6300d2e
Showing
14 changed files
with
138 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
Hourglass/Hourglass/Assets.xcassets/Colors/toggleBackground.colorset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"color" : { | ||
"color-space" : "srgb", | ||
"components" : { | ||
"alpha" : "1.000", | ||
"blue" : "0x60", | ||
"green" : "0x60", | ||
"red" : "0x60" | ||
} | ||
}, | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
Hourglass/Hourglass/Assets.xcassets/Colors/toggleSelection.colorset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"color" : { | ||
"color-space" : "srgb", | ||
"components" : { | ||
"alpha" : "1.000", | ||
"blue" : "0x1E", | ||
"green" : "0x1E", | ||
"red" : "0x1E" | ||
} | ||
}, | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Hourglass/Hourglass/Presenter Models/TimerCategoryTogglePresenterModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Combine | ||
|
||
extension TimerCategoryToggle { | ||
class PresenterModel: ObservableObject { | ||
@Published var state: State { | ||
didSet { | ||
switch state { | ||
case .focus, .focusOnly: | ||
Timer.Model.category = .focus | ||
case .rest, .restOnly: | ||
Timer.Model.category = .rest | ||
} | ||
} | ||
} | ||
|
||
init(state: State = .focus) { | ||
self.state = state | ||
} | ||
} | ||
|
||
enum State { | ||
case focus | ||
case rest | ||
case focusOnly | ||
case restOnly | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
...ss/Hourglass/Data Models/TimerModel.swift → ...urglass/Presenter Models/TimerModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,14 @@ | ||
import SwiftUI | ||
|
||
extension Color { | ||
private enum Token: String { | ||
case background | ||
case onBackgroundPrimary | ||
case onBackgroundSecondary | ||
case surface | ||
case onSurface | ||
case accent | ||
|
||
var color: Color { | ||
Color(self.rawValue) | ||
} | ||
} | ||
|
||
enum Hourglass { | ||
static let background = Token.background.color | ||
static let onBackgroundPrimary = Token.onBackgroundPrimary.color | ||
static let onBackgroundSecondary = Token.onBackgroundSecondary.color | ||
static let surface = Token.surface.color | ||
static let onSurface = Token.onSurface.color | ||
static let accent = Token.accent.color | ||
static let background = Color("background") | ||
static let onBackgroundPrimary = Color("onBackgroundPrimary") | ||
static let onBackgroundSecondary = Color("onBackgroundSecondary") | ||
static let surface = Color("surface") | ||
static let onSurface = Color("onSurface") | ||
static let accent = Color("accent") | ||
static let toggleSelection = Color("toggleSelection") | ||
static let toggleBackground = Color("toggleBackground") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.