Files
Reflect/Shared/Views/MainTabView.swift
Trey t 277e277750 Add XCUITest suite with 27 test files covering unmapped P1 test cases
- Add 8 new test files: HeaderMoodLogging (TC-002), DayViewGrouping (TC-019),
  AllDayViewStyles (TC-021), MonthViewInteraction (TC-030), PaywallGate
  (TC-032/039/048), AppTheme (TC-070), IconPack (TC-072),
  PremiumCustomization (TC-075)
- Add accessibility IDs for paywall overlays, icon packs, app theme cards,
  and day view section headers
- Add --expire-trial launch argument to UITestMode for paywall gate testing
- Update QA test plan spreadsheet with XCUITest names for 14 test cases
- Include existing test infrastructure: screen objects, helpers, base class,
  and 19 previously written test files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:37:54 -06:00

98 lines
3.5 KiB
Swift

//
// MainTabView.swift
// Feels (iOS)
//
// Created by Trey Tartt on 2/18/22.
//
import SwiftUI
struct MainTabView: View {
@AppStorage(UserDefaultsStore.Keys.needsOnboarding.rawValue, store: GroupUserDefaults.groupDefaults) private var needsOnboarding = true
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
private var textColor: Color { theme.currentTheme.labelColor }
let onboardingData = OnboardingDataDataManager.shared.savedOnboardingData
let dayView: DayView
let monthView: MonthView
let yearView: YearView
let insightsView: InsightsView
var body: some View {
return TabView {
dayView
.tabItem {
Label(String(localized: "content_view_tab_main"), systemImage: "list.dash")
}
.accessibilityIdentifier(AccessibilityID.Tab.day)
monthView
.tabItem {
Label(String(localized: "content_view_tab_month"), systemImage: "calendar")
}
.accessibilityIdentifier(AccessibilityID.Tab.month)
yearView
.tabItem {
Label(String(localized: "content_view_tab_filter"), systemImage: "line.3.horizontal.decrease.circle")
}
.accessibilityIdentifier(AccessibilityID.Tab.year)
insightsView
.tabItem {
Label(String(localized: "content_view_tab_insights"), systemImage: "lightbulb.fill")
}
.accessibilityIdentifier(AccessibilityID.Tab.insights)
SettingsTabView()
.tabItem {
Label("Settings", systemImage: "gear")
}
.accessibilityIdentifier(AccessibilityID.Tab.settings)
}
.accentColor(textColor)
.sheet(isPresented: $needsOnboarding, onDismiss: { }, content: {
OnboardingMain(onboardingData: onboardingData,
updateBoardingDataClosure: { onboardingData in
needsOnboarding = false
OnboardingDataDataManager.shared.updateOnboardingData(onboardingData: onboardingData)
})
})
.onAppear(perform: {
applyTheme(theme)
})
.onChange(of: theme) { _, newTheme in
applyTheme(newTheme)
}
}
private func applyTheme(_ theme: Theme) {
let style: UIUserInterfaceStyle
switch theme {
case .system, .iFeel:
style = .unspecified
case .dark:
style = .dark
case .light:
style = .light
}
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
let window = windowScene.windows.first else { return }
window.overrideUserInterfaceStyle = style
}
}
struct MainTabView_Previews: PreviewProvider {
static var previews: some View {
MainTabView(dayView: DayView(viewModel: DayViewViewModel(addMonthStartWeekdayPadding: false)),
monthView: MonthView(viewModel: DayViewViewModel(addMonthStartWeekdayPadding: true)),
yearView: YearView(viewModel: YearViewModel()),
insightsView: InsightsView())
}
}