DFWatchFaceModels.swift
2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//
// DFWatchFaceModels.swift
// hippo-watch-extension
//
import SwiftUI
enum DFWatchFaceKind: String, CaseIterable {
case defaultHome
case singleStress
case coupleStress
var widgetKind: String {
"hippo_watch_extension_\(rawValue)"
}
var displayName: String {
switch self {
case .defaultHome:
return "DoubleFeel 默认表盘"
case .singleStress:
return "DoubleFeel 单人压力"
case .coupleStress:
return "DoubleFeel 双人压力"
}
}
var description: String {
switch self {
case .defaultHome:
return "展示时间、HRV 状态和今日健康指标。"
case .singleStress:
return "展示个人实时压力状态。"
case .coupleStress:
return "展示你和另一半的压力状态。"
}
}
}
enum DFStressStatus: String {
case excellent
case normal
case little
case overloaded
var title: String {
switch self {
case .excellent:
return "状态优秀"
case .normal:
return "状态正常"
case .little:
return "注意压力"
case .overloaded:
return "压力过载"
}
}
var color: Color {
switch self {
case .excellent:
return DFWatchFaceColor.green
case .normal:
return DFWatchFaceColor.blue
case .little:
return DFWatchFaceColor.orange
case .overloaded:
return DFWatchFaceColor.red
}
}
}
struct DFWatchFaceData: Equatable {
var hasData: Bool
var hrvValue: Int
var hrvTime: String
var heartRate: Int
var steps: Int
var closePercent: Int
var myName: String
var partnerName: String
var myStatus: DFStressStatus
var partnerStatus: DFStressStatus
var myHRV: Int
var partnerHRV: Int
static let placeholder = DFWatchFaceData(
hasData: true,
hrvValue: 38,
hrvTime: "19:04",
heartRate: 79,
steps: 2486,
closePercent: 72,
myName: "我",
partnerName: "男朋友",
myStatus: .excellent,
partnerStatus: .overloaded,
myHRV: 80,
partnerHRV: 30
)
}
enum DFWatchFaceColor {
static let background = Color(hex: "0F0F11")
static let purple = Color(hex: "845EEE")
static let green = Color(hex: "3BD49D")
static let red = Color(hex: "FF5279")
static let orange = Color(hex: "FF9A6E")
static let blue = Color(hex: "7B9BFB")
static let grayText = Color(hex: "B0B0B6")
static let grayBar = Color(hex: "78787D")
}