-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feat/#122] watchOS 기능 구현
- Loading branch information
Showing
105 changed files
with
3,847 additions
and
139 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
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
9 changes: 0 additions & 9 deletions
9
Projects/App/WatchExtension/Sources/Domain/HealthClient.swift
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
Projects/App/WatchExtension/Sources/Domain/PumpingTimer.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,41 @@ | ||
// | ||
// PumpingTimer.swift | ||
// AppWatchExtension | ||
// | ||
// Created by 송영모 on 2023/07/04. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct PumpingTimer: Codable, Equatable { | ||
public let id: UUID | ||
public let workoutCategoryIdentifier: WorkoutCategoryIdentifier | ||
public var time: Int | ||
|
||
public var heartRateSum: Double | ||
public var heartRateCount: Int | ||
public var calorie: Double | ||
|
||
public var pinTime: Int | ||
public var isActive: Bool | ||
|
||
public init( | ||
id: UUID, | ||
workoutCategoryIdentifier: WorkoutCategoryIdentifier, | ||
time: Int = 0, | ||
heartRateSum: Double = 0.0, | ||
heartRateCount: Int = 0, | ||
calorie: Double = 0, | ||
pinTime: Int = 0, | ||
isActive: Bool = false | ||
) { | ||
self.id = id | ||
self.workoutCategoryIdentifier = workoutCategoryIdentifier | ||
self.time = time | ||
self.heartRateSum = heartRateSum | ||
self.heartRateCount = heartRateCount | ||
self.calorie = calorie | ||
self.pinTime = pinTime | ||
self.isActive = isActive | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
Projects/App/WatchExtension/Sources/Domain/PumpingTimerData.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,23 @@ | ||
// | ||
// PumpingTimerData.swift | ||
// AppWatchExtension | ||
// | ||
// Created by 송영모 on 2023/07/04. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct PumpingTimerData: Codable, Equatable { | ||
public let timers: [PumpingTimer] | ||
public let updatedTime: Double | ||
public let isHardPush: Bool | ||
|
||
public init( | ||
timers: [PumpingTimer], | ||
updatedTime: Double, | ||
isHardPush: Bool = false) { | ||
self.timers = timers | ||
self.updatedTime = updatedTime | ||
self.isHardPush = isHardPush | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
Projects/App/WatchExtension/Sources/Domain/WorkoutCategory.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,51 @@ | ||
// | ||
// WorkoutCategory.swift | ||
// AppWatchExtension | ||
// | ||
// Created by 송영모 on 2023/07/04. | ||
// | ||
|
||
import Foundation | ||
|
||
//MARK: WorkoutCategoryIdentifierType | ||
public enum WorkoutCategoryIdentifierType: String, CaseIterable { | ||
case whole = "전신" | ||
case upper = "상체" | ||
case lower = "하체" | ||
} | ||
|
||
public extension WorkoutCategoryIdentifierType { | ||
var identifiers: [WorkoutCategoryIdentifier] { | ||
switch self { | ||
case .whole: | ||
return [.aerobic] | ||
case .upper: | ||
return [.shoulder, .chest, .arms, .back] | ||
case .lower: | ||
return [.butt] | ||
} | ||
} | ||
} | ||
|
||
//MARK: WorkoutCategoryIdentifier | ||
public enum WorkoutCategoryIdentifier: String, Codable, CaseIterable, Equatable { | ||
case aerobic = "유산소" | ||
case shoulder = "어깨" | ||
case chest = "가슴" | ||
case arms = "팔" | ||
case back = "등" | ||
case butt = "엉덩이" | ||
} | ||
|
||
public extension WorkoutCategoryIdentifier { | ||
var type: WorkoutCategoryIdentifierType { | ||
switch self { | ||
case .aerobic: | ||
return .whole | ||
case .shoulder, .chest, .arms, .back: | ||
return .upper | ||
case .butt: | ||
return .lower | ||
} | ||
} | ||
} |
8 changes: 0 additions & 8 deletions
8
Projects/App/WatchExtension/Sources/Domain/WorkoutClient.swift
This file was deleted.
Oops, something went wrong.
77 changes: 77 additions & 0 deletions
77
Projects/App/WatchExtension/Sources/Feature/Home/Components/Cells/TimerCellStore.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,77 @@ | ||
// | ||
// TimerCellStore.swift | ||
// Pumping | ||
// | ||
// Created by 송영모 on 2023/07/05. | ||
// | ||
|
||
import SwiftUI | ||
|
||
import ComposableArchitecture | ||
|
||
import WatchSharedDesignSystem | ||
import WatchSharedUtil | ||
|
||
public struct TimerCellStore: ReducerProtocol { | ||
public enum ResultType { | ||
case time, heatRate, calorie | ||
|
||
public var title: String { | ||
switch self { | ||
case .time: return "총 시간" | ||
case .heatRate: return "심박수" | ||
case .calorie: return "총 칼로리" | ||
} | ||
} | ||
|
||
public var image: Image { | ||
switch self { | ||
case .time: return PumpingImages.iconTimer.swiftUIImage | ||
case .heatRate: return PumpingImages.iconHeartbeat.swiftUIImage | ||
case .calorie: return PumpingImages.iconFire.swiftUIImage | ||
} | ||
} | ||
|
||
public func toSyntax(value: Double) -> String { | ||
switch self { | ||
case .time: | ||
return DateManager.toClockString(from: Int(value)) | ||
|
||
case .heatRate: | ||
if value == 0 { | ||
return "-" | ||
} else { | ||
return String(describing: "\(Int(value))bpm") | ||
} | ||
|
||
case .calorie: | ||
if value == 0 { | ||
return "-" | ||
} else { | ||
return String(describing: "\(Int(value))Kcal") | ||
} | ||
} | ||
} | ||
} | ||
|
||
public struct State: Equatable, Identifiable { | ||
public let id: UUID | ||
public let timer: PumpingTimer | ||
|
||
public init(id: UUID, timer: PumpingTimer) { | ||
self.id = id | ||
self.timer = timer | ||
} | ||
} | ||
|
||
public enum Action: Equatable { | ||
case tapped | ||
} | ||
|
||
public func reduce(into state: inout State, action: Action) -> EffectTask<Action> { | ||
switch action { | ||
case .tapped: | ||
return .none | ||
} | ||
} | ||
} |
Oops, something went wrong.