feat: Add API usage disclosure to settings and update 'Life' progress bar color to blue.

This commit is contained in:
Paweł Orzech 2026-01-18 00:37:31 +00:00
parent 8d4645c2a2
commit 61235e78af
No known key found for this signature in database
3 changed files with 55 additions and 5 deletions

View file

@ -71,7 +71,7 @@ struct ProgressBarView: View {
ProgressBarView(label: "Energy", current: 75, maximum: 100, color: .green, icon: "bolt.fill")
ProgressBarView(label: "Nerve", current: 50, maximum: 50, color: .red, icon: "flame.fill")
ProgressBarView(label: "Happy", current: 500, maximum: 1000, color: .yellow, icon: "face.smiling.fill")
ProgressBarView(label: "Life", current: 0, maximum: 100, color: .pink, icon: "heart.fill")
ProgressBarView(label: "Life", current: 0, maximum: 100, color: .blue, icon: "heart.fill")
}
.padding()
.frame(width: 280)

View file

@ -41,6 +41,9 @@ struct SettingsView: View {
}
.padding(.horizontal)
// API ToS Compliance
apiUsageDisclosure
Divider()
// Settings
@ -164,6 +167,53 @@ struct SettingsView: View {
}
}
// MARK: - API Usage Disclosure
private var apiUsageDisclosure: some View {
DisclosureGroup {
VStack(alignment: .leading, spacing: 8) {
ForEach(apiSelections, id: \.selection) { item in
HStack(alignment: .top) {
Text(item.selection)
.font(.caption.monospaced())
.frame(width: 60, alignment: .leading)
.foregroundColor(.accentColor)
Text(item.purpose)
.font(.caption)
.foregroundColor(.secondary)
}
}
Divider()
Link("View Torn API Terms of Service",
destination: URL(string: "https://www.torn.com/api.html")!)
.font(.caption)
}
.padding(.top, 4)
} label: {
HStack(spacing: 4) {
Image(systemName: "doc.text")
.foregroundColor(.secondary)
Text("API Data Usage")
.font(.caption.bold())
}
}
.padding(.horizontal)
}
private var apiSelections: [(selection: String, purpose: String)] {
[
("basic", "Player name, ID, basic info"),
("bars", "Energy, Nerve, Happy, Life bars"),
("cooldowns", "Drug, Medical, Booster cooldowns"),
("travel", "Travel status and destination"),
("profile", "Battle stats, faction info"),
("events", "Recent events feed"),
("messages", "Unread message count"),
("market", "Item watchlist prices")
]
}
private func openTornProfile() {
let url = "https://www.torn.com/profiles.php?XID=\(developerID)"
if let url = URL(string: url) {

View file

@ -185,7 +185,7 @@ struct StatusView: View {
label: "Life",
current: bars.life.current,
maximum: bars.life.maximum,
color: .pink,
color: .blue,
icon: "heart.fill"
)
}