From e03689f38c627abce76a3f87fe37cbac3a6193f0 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Sat, 7 Feb 2026 15:56:55 -0600 Subject: [PATCH] Signed-off-by: Matt Bruce --- .../Features/Alarms/Views/AddAlarmView.swift | 17 ------ .../Features/Alarms/Views/AlarmView.swift | 19 ------ .../Components/AlarmLimitationsBanner.swift | 58 ------------------- .../Features/Alarms/Views/EditAlarmView.swift | 17 ------ 4 files changed, 111 deletions(-) delete mode 100644 TheNoiseClock/Features/Alarms/Views/Components/AlarmLimitationsBanner.swift diff --git a/TheNoiseClock/Features/Alarms/Views/AddAlarmView.swift b/TheNoiseClock/Features/Alarms/Views/AddAlarmView.swift index a134e0a..b97a49c 100644 --- a/TheNoiseClock/Features/Alarms/Views/AddAlarmView.swift +++ b/TheNoiseClock/Features/Alarms/Views/AddAlarmView.swift @@ -15,7 +15,6 @@ struct AddAlarmView: View { // MARK: - Properties let viewModel: AlarmViewModel @Binding var isPresented: Bool - @AppStorage(ClockStyle.appStorageKey) private var clockStyleData: Data = Data() @State private var newAlarmTime = Calendar.current.date(bySettingHour: 6, minute: 0, second: 0, of: Date()) ?? Date() @State private var selectedSoundName = "digital-alarm.caf" @@ -35,15 +34,6 @@ struct AddAlarmView: View { // List for settings below List { - if !isKeepAwakeEnabled { - Section { - AlarmLimitationsBanner() - .listRowInsets(EdgeInsets()) - .listRowBackground(Color.clear) - .listRowSeparator(.hidden) - } - } - // Label Section NavigationLink(destination: LabelEditView(label: $alarmLabel)) { HStack { @@ -138,11 +128,4 @@ struct AddAlarmView: View { private func getSoundDisplayName(_ fileName: String) -> String { return AlarmSoundService.shared.getSoundDisplayName(fileName) } - - private var isKeepAwakeEnabled: Bool { - guard let decoded = try? JSONDecoder().decode(ClockStyle.self, from: clockStyleData) else { - return ClockStyle().keepAwake - } - return decoded.keepAwake - } } diff --git a/TheNoiseClock/Features/Alarms/Views/AlarmView.swift b/TheNoiseClock/Features/Alarms/Views/AlarmView.swift index 8654f21..921343e 100644 --- a/TheNoiseClock/Features/Alarms/Views/AlarmView.swift +++ b/TheNoiseClock/Features/Alarms/Views/AlarmView.swift @@ -16,7 +16,6 @@ struct AlarmView: View { @Bindable var viewModel: AlarmViewModel @State private var showAddAlarm = false @State private var selectedAlarmForEdit: Alarm? - @AppStorage(ClockStyle.appStorageKey) private var clockStyleData: Data = Data() // MARK: - Body var body: some View { @@ -31,10 +30,6 @@ struct AlarmView: View { Group { if viewModel.alarms.isEmpty { VStack(spacing: Design.Spacing.large) { - if !isKeepAwakeEnabled { - AlarmLimitationsBanner() - } - EmptyAlarmsView { showAddAlarm = true } @@ -45,13 +40,6 @@ struct AlarmView: View { } } else { List { - if !isKeepAwakeEnabled { - 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, @@ -128,13 +116,6 @@ struct AlarmView: View { } } } - - private var isKeepAwakeEnabled: Bool { - guard let decoded = try? JSONDecoder().decode(ClockStyle.self, from: clockStyleData) else { - return ClockStyle().keepAwake - } - return decoded.keepAwake - } } // MARK: - Preview diff --git a/TheNoiseClock/Features/Alarms/Views/Components/AlarmLimitationsBanner.swift b/TheNoiseClock/Features/Alarms/Views/Components/AlarmLimitationsBanner.swift deleted file mode 100644 index 4dd84a6..0000000 --- a/TheNoiseClock/Features/Alarms/Views/Components/AlarmLimitationsBanner.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// AlarmLimitationsBanner.swift -// TheNoiseClock -// -// Created by Matt Bruce on 2/2/26. -// - -import SwiftUI -import Bedrock -import Foundation - -/// Banner explaining background alarm limitations and mitigation. -struct AlarmLimitationsBanner: View { - @AppStorage(ClockStyle.appStorageKey) private var clockStyleData: Data = Data() - - var body: some View { - if isKeepAwakeEnabled { - EmptyView() - } else { - SettingsCard(backgroundColor: AppSurface.card, borderColor: AppBorder.subtle) { - VStack(alignment: .leading, spacing: Design.Spacing.xSmall) { - HStack(spacing: Design.Spacing.xSmall) { - Image(systemName: "exclamationmark.triangle.fill") - .foregroundStyle(AppStatus.warning) - Text("Alarm reliability") - .typography(.body) - .fontWeight(.semibold) - .foregroundStyle(AppTextColors.primary) - } - - Text("iOS only allows notification sounds when the app is backgrounded. For a full alarm sound and screen, keep TheNoiseClock open in the foreground.") - .typography(.caption) - .foregroundStyle(AppTextColors.secondary) - - Text("Tip: Use the Keep Awake prompt to keep the app on-screen while alarms are active.") - .typography(.caption) - .foregroundStyle(AppTextColors.secondary) - } - .padding(Design.Spacing.medium) - .frame(maxWidth: .infinity, alignment: .leading) - .background(AppSurface.primary) - } - } - } - - private var isKeepAwakeEnabled: Bool { - guard let decoded = try? JSONDecoder().decode(ClockStyle.self, from: clockStyleData) else { - return ClockStyle().keepAwake - } - return decoded.keepAwake - } -} - -#Preview { - AlarmLimitationsBanner() - .padding() - .background(AppSurface.primary) -} diff --git a/TheNoiseClock/Features/Alarms/Views/EditAlarmView.swift b/TheNoiseClock/Features/Alarms/Views/EditAlarmView.swift index 6cad965..28caa6f 100644 --- a/TheNoiseClock/Features/Alarms/Views/EditAlarmView.swift +++ b/TheNoiseClock/Features/Alarms/Views/EditAlarmView.swift @@ -17,7 +17,6 @@ struct EditAlarmView: View { let viewModel: AlarmViewModel let alarm: Alarm @Environment(\.dismiss) private var dismiss - @AppStorage(ClockStyle.appStorageKey) private var clockStyleData: Data = Data() @State private var alarmTime: Date @State private var selectedSoundName: String @@ -54,15 +53,6 @@ struct EditAlarmView: View { // List for settings below List { - if !isKeepAwakeEnabled { - Section { - AlarmLimitationsBanner() - .listRowInsets(EdgeInsets()) - .listRowBackground(Color.clear) - .listRowSeparator(.hidden) - } - } - // Label Section NavigationLink(destination: LabelEditView(label: $alarmLabel)) { HStack { @@ -169,13 +159,6 @@ struct EditAlarmView: View { private func getSoundDisplayName(_ fileName: String) -> String { return AlarmSoundService.shared.getSoundDisplayName(fileName) } - - private var isKeepAwakeEnabled: Bool { - guard let decoded = try? JSONDecoder().decode(ClockStyle.self, from: clockStyleData) else { - return ClockStyle().keepAwake - } - return decoded.keepAwake - } } // MARK: - Preview