66 lines
1.8 KiB
Swift
66 lines
1.8 KiB
Swift
import SwiftUI
|
|
|
|
struct ContentView: View {
|
|
@EnvironmentObject var iapService: IAPService
|
|
@EnvironmentObject var adMobService: AdMobService
|
|
@AppStorage("onboardingCompleted") private var onboardingCompleted = false
|
|
|
|
@State private var selectedTab = 0
|
|
|
|
var body: some View {
|
|
Group {
|
|
if !onboardingCompleted {
|
|
OnboardingView(onboardingCompleted: $onboardingCompleted)
|
|
} else {
|
|
mainContent
|
|
}
|
|
}
|
|
}
|
|
|
|
private var mainContent: some View {
|
|
ZStack(alignment: .bottom) {
|
|
TabView(selection: $selectedTab) {
|
|
DashboardView()
|
|
.tabItem {
|
|
Label("Dashboard", systemImage: "chart.pie.fill")
|
|
}
|
|
.tag(0)
|
|
|
|
SourceListView()
|
|
.tabItem {
|
|
Label("Sources", systemImage: "list.bullet")
|
|
}
|
|
.tag(1)
|
|
|
|
ChartsContainerView()
|
|
.tabItem {
|
|
Label("Charts", systemImage: "chart.xyaxis.line")
|
|
}
|
|
.tag(2)
|
|
|
|
SettingsView()
|
|
.tabItem {
|
|
Label("Settings", systemImage: "gearshape.fill")
|
|
}
|
|
.tag(3)
|
|
}
|
|
|
|
// Banner ad at bottom for free users
|
|
if !iapService.isPremium {
|
|
VStack(spacing: 0) {
|
|
Spacer()
|
|
BannerAdView()
|
|
.frame(height: 50)
|
|
}
|
|
.padding(.bottom, 49) // Account for tab bar height
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
ContentView()
|
|
.environmentObject(IAPService())
|
|
.environmentObject(AdMobService())
|
|
}
|