Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
6a154f00bc
commit
1fd0c88d3d
@ -42,29 +42,39 @@ struct AlarmView: View {
|
|||||||
.frame(maxWidth: Design.Size.maxContentWidthPortrait)
|
.frame(maxWidth: Design.Size.maxContentWidthPortrait)
|
||||||
.frame(maxWidth: .infinity, alignment: .center)
|
.frame(maxWidth: .infinity, alignment: .center)
|
||||||
} else {
|
} else {
|
||||||
ScrollView {
|
List {
|
||||||
VStack(spacing: Design.Spacing.medium) {
|
if !isKeepAwakeEnabled {
|
||||||
if !isKeepAwakeEnabled {
|
AlarmLimitationsBanner()
|
||||||
AlarmLimitationsBanner()
|
.listRowInsets(EdgeInsets(top: Design.Spacing.large, leading: Design.Spacing.large, bottom: Design.Spacing.small, trailing: Design.Spacing.large))
|
||||||
}
|
.listRowBackground(Color.clear)
|
||||||
|
.listRowSeparator(.hidden)
|
||||||
ForEach(viewModel.alarms) { alarm in
|
}
|
||||||
AlarmRowView(
|
|
||||||
alarm: alarm,
|
ForEach(viewModel.alarms) { alarm in
|
||||||
onToggle: {
|
AlarmRowView(
|
||||||
Task {
|
alarm: alarm,
|
||||||
await viewModel.toggleAlarm(id: alarm.id)
|
onToggle: {
|
||||||
}
|
Task {
|
||||||
},
|
await viewModel.toggleAlarm(id: alarm.id)
|
||||||
onEdit: {
|
}
|
||||||
selectedAlarmForEdit = alarm
|
},
|
||||||
}
|
onEdit: {
|
||||||
)
|
selectedAlarmForEdit = alarm
|
||||||
}
|
},
|
||||||
|
onDelete: {
|
||||||
|
Task {
|
||||||
|
await viewModel.deleteAlarm(id: alarm.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.listRowInsets(EdgeInsets(top: Design.Spacing.small, leading: Design.Spacing.large, bottom: Design.Spacing.small, trailing: Design.Spacing.large))
|
||||||
|
.listRowBackground(Color.clear)
|
||||||
|
.listRowSeparator(.hidden)
|
||||||
}
|
}
|
||||||
.padding(.horizontal, Design.Spacing.large)
|
|
||||||
.padding(.top, Design.Spacing.large)
|
|
||||||
}
|
}
|
||||||
|
.listStyle(.plain)
|
||||||
|
.scrollContentBackground(.hidden)
|
||||||
|
.background(AppSurface.primary.ignoresSafeArea())
|
||||||
.frame(maxWidth: Design.Size.maxContentWidthPortrait)
|
.frame(maxWidth: Design.Size.maxContentWidthPortrait)
|
||||||
.frame(maxWidth: .infinity, alignment: .center)
|
.frame(maxWidth: .infinity, alignment: .center)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@ struct AlarmRowView: View {
|
|||||||
let alarm: Alarm
|
let alarm: Alarm
|
||||||
let onToggle: () -> Void
|
let onToggle: () -> Void
|
||||||
let onEdit: () -> Void
|
let onEdit: () -> Void
|
||||||
|
let onDelete: () -> Void
|
||||||
@AppStorage(ClockStyle.appStorageKey) private var clockStyleData: Data = Data()
|
@AppStorage(ClockStyle.appStorageKey) private var clockStyleData: Data = Data()
|
||||||
|
|
||||||
// MARK: - Body
|
// MARK: - Body
|
||||||
@ -65,6 +66,13 @@ struct AlarmRowView: View {
|
|||||||
onEdit()
|
onEdit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
|
||||||
|
Button(role: .destructive) {
|
||||||
|
onDelete()
|
||||||
|
} label: {
|
||||||
|
Label("Delete", systemImage: "trash")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var isKeepAwakeEnabled: Bool {
|
private var isKeepAwakeEnabled: Bool {
|
||||||
@ -82,7 +90,8 @@ struct AlarmRowView: View {
|
|||||||
AlarmRowView(
|
AlarmRowView(
|
||||||
alarm: Alarm(time: Date()),
|
alarm: Alarm(time: Date()),
|
||||||
onToggle: {},
|
onToggle: {},
|
||||||
onEdit: {}
|
onEdit: {},
|
||||||
|
onDelete: {}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,6 @@ struct OnboardingView: View {
|
|||||||
@State private var currentPage = 0
|
@State private var currentPage = 0
|
||||||
@State private var alarmKitPermissionGranted = false
|
@State private var alarmKitPermissionGranted = false
|
||||||
@State private var keepAwakeEnabled = false
|
@State private var keepAwakeEnabled = false
|
||||||
@State private var showCelebration = false
|
|
||||||
|
|
||||||
private let totalPages = 4
|
private let totalPages = 4
|
||||||
|
|
||||||
@ -59,11 +58,6 @@ struct OnboardingView: View {
|
|||||||
.padding(.horizontal, Design.Spacing.xLarge)
|
.padding(.horizontal, Design.Spacing.xLarge)
|
||||||
.padding(.bottom, Design.Spacing.xxLarge)
|
.padding(.bottom, Design.Spacing.xxLarge)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Celebration overlay
|
|
||||||
if showCelebration {
|
|
||||||
celebrationOverlay
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,30 +369,6 @@ struct OnboardingView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Celebration
|
|
||||||
|
|
||||||
private var celebrationOverlay: some View {
|
|
||||||
ZStack {
|
|
||||||
Color.black.opacity(0.3)
|
|
||||||
.ignoresSafeArea()
|
|
||||||
|
|
||||||
VStack(spacing: Design.Spacing.large) {
|
|
||||||
Image(systemName: "party.popper.fill")
|
|
||||||
.font(.system(size: 60))
|
|
||||||
.foregroundStyle(AppAccent.primary)
|
|
||||||
|
|
||||||
Text("Let's go!")
|
|
||||||
.typography(.heroBold)
|
|
||||||
.foregroundStyle(AppTextColors.primary)
|
|
||||||
}
|
|
||||||
.padding(Design.Spacing.xxxLarge)
|
|
||||||
.background(AppSurface.overlay)
|
|
||||||
.cornerRadius(Design.CornerRadius.xxLarge)
|
|
||||||
.shadow(radius: 20)
|
|
||||||
}
|
|
||||||
.transition(.opacity.combined(with: .scale))
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Actions
|
// MARK: - Actions
|
||||||
|
|
||||||
private func requestAlarmKitPermission() {
|
private func requestAlarmKitPermission() {
|
||||||
@ -447,13 +417,8 @@ struct OnboardingView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func triggerCelebration() {
|
private func triggerCelebration() {
|
||||||
withAnimation(.spring(duration: 0.4)) {
|
// Use a more subtle transition to the main app
|
||||||
showCelebration = true
|
withAnimation(.easeIn(duration: 0.3)) {
|
||||||
}
|
|
||||||
|
|
||||||
// Dismiss after short celebration
|
|
||||||
Task {
|
|
||||||
try? await Task.sleep(for: .milliseconds(1200))
|
|
||||||
onComplete()
|
onComplete()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user