mycode/myApp/HaruDanim/Shared/Settings.swift
songyc macbook 221dce1259 refactor(ui): redesign floating menu as one-hand glass bubble arc
The vertical capsule stack reached ~414pt up the screen, putting the top
tabs out of thumb range. Replace it with 'Glass Bubbles': liquid-glass
orbs that fan out from the FAB along a semicircular arc whose radius
(~152pt, clamped to screen width) keeps every tab inside the natural
thumb sweep from the bottom-center pivot.

- Each bubble: ultraThinMaterial circle + top white gradient (specular
  light) + white 0.4 hairline + soft shadow; label with shadow below.
  Current tab rendered as green glass with white symbol.
- Entrance: bubbles fly from the FAB to their arc slot while rotating
  -40deg -> 0 with a snappy spring (response 0.32, damping 0.72) and a
  per-item 0.03s stagger, like droplets bursting in sequence; collapse
  snaps back with no delay. All transform-only (offset/scale/opacity/
  rotation) so no per-frame blur recomputation.
- Struct renamed FloatingCapsuleMenu -> GlassBubbleMenu; storage key and
  NavStyle.radial rawValue unchanged for compatibility.
- Settings copy updated: nav style now '글래스 버블 메뉴' with a
  description of the fan-out and one-handed reach; order editor renamed
  '버블 메뉴 순서' with left-to-right arc wording.

Verified: clean rebuild (stale incremental link produced an old binary
despite BUILD SUCCEEDED; wiped DerivedData), expanded-arc screenshot
shows all 7 bubbles within thumb radius with legible labels, and the
settings screen shows the new name/description.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013yKDMhuF39GVYy3FMcGHh7
2026-07-13 01:31:45 +09:00

143 lines
5.1 KiB
Swift

//
// Settings.swift
// Haru_Danim
//
// , (CLAUDE.md §6.6, §7)
//
import Foundation
enum SettingsKeys {
/// "light" | "dark"
static let theme = "settings.theme"
/// "ko" | "en" | "ja"
static let language = "settings.language"
/// Calendar.weekday (1= ... 7=). 2()
static let weekStartWeekday = "settings.weekStartWeekday"
/// . 0 (00:00)
static let dayStartMinutes = "settings.dayStartMinutes"
/// "latest"( ) | "earliest"( ). latest
static let liveActivityMode = "settings.liveActivityMode"
// Shared/Premium.swift PremiumGate.cacheKey (App Group defaults)
/// . 3
static let gridColumns = "settings.gridColumns"
/// () . 0 =
static let minSessionSeconds = "settings.minSessionSeconds"
/// ( 1~3). AppTab rawValue
static let visibleTabs = "settings.visibleTabs"
/// . GoalCardStyle rawValue ("perQuest" | "combined")
static let goalCardStyle = "settings.goalCardStyle"
/// iPhone . NavStyle rawValue ("tabBar" | "radial"). ()
static let navStyle = "settings.navStyle"
/// . AppTab rawValue . ()
static let radialTabOrder = "settings.radialTabOrder"
}
/// iPhone (iPad·Mac , )
enum NavStyle: String, CaseIterable, Identifiable {
/// ( + )
case tabBar
/// (Glass Bubbles) rawValue radial
case radial
var id: String { rawValue }
var label: String {
switch self {
case .tabBar: return String(localized: "기본 하단 탭 바")
case .radial: return String(localized: "글래스 버블 메뉴")
}
}
}
/// ( )
enum GoalCardStyle: String, CaseIterable, Identifiable {
/// ( 3) //
case perQuest
/// // ()
case combined
var id: String { rawValue }
var label: String {
switch self {
case .perQuest: return String(localized: "다짐별로 각각")
case .combined: return String(localized: "전체 다짐 합산")
}
}
}
enum TabBarConfig {
/// : · · (+)
static let defaultVisibleTabs = "main,action,history"
static let maxVisible = 3
static let minVisible = 1
}
/// ()
enum MinSessionOption {
static let choices: [(seconds: Int, label: String)] = [
(0, String(localized: "사용 안 함")),
(3, String(localized: "3초")),
(5, String(localized: "5초")),
(10, String(localized: "10초")),
(30, String(localized: "30초")),
(60, String(localized: "1분")),
]
}
enum LiveActivityMode: String, CaseIterable, Identifiable {
case latest
case earliest
var id: String { rawValue }
var label: String {
switch self {
case .latest: return String(localized: "가장 나중에 시작한 행동")
case .earliest: return String(localized: "가장 먼저 시작한 행동")
}
}
}
enum AppLanguage: String, CaseIterable, Identifiable {
case ko, en, ja
var id: String { rawValue }
var label: String {
switch self {
case .ko: return "한국어"
case .en: return "English"
case .ja: return "日本語"
}
}
}
// (FreeLimits) Shared/Premium.swift (· )
///
struct TrackingSettings {
var weekStartWeekday: Int
var dayStartMinutes: Int
static func current() -> TrackingSettings {
// App Group (· ), standard
let group = AppGroup.defaults
let standard = UserDefaults.standard
func intValue(_ key: String, default defaultValue: Int) -> Int {
(group.object(forKey: key) ?? standard.object(forKey: key)) as? Int ?? defaultValue
}
return TrackingSettings(
weekStartWeekday: intValue(SettingsKeys.weekStartWeekday, default: 2),
dayStartMinutes: intValue(SettingsKeys.dayStartMinutes, default: 0)
)
}
var calendar: Calendar {
var cal = Calendar.current
cal.firstWeekday = weekStartWeekday
return cal
}
}