|
|
@@ -6,56 +6,59 @@ struct MainView: View {
|
|
|
@EnvironmentObject private var themeManager: ThemeManager
|
|
|
|
|
|
var body: some View {
|
|
|
- Group {
|
|
|
- if viewModel.isShowingPaywall {
|
|
|
- PaywallView(onClose: viewModel.hidePaywall)
|
|
|
- .transition(.opacity)
|
|
|
- } else {
|
|
|
- HStack(spacing: 0) {
|
|
|
- SidebarView(
|
|
|
- selectedDestination: Binding(
|
|
|
- get: { viewModel.selectedDestination },
|
|
|
- set: { destination in
|
|
|
- viewModel.selectedDestination = destination
|
|
|
- viewModel.hideSettings()
|
|
|
- }
|
|
|
- ),
|
|
|
- isShowingSettings: viewModel.isShowingSettings,
|
|
|
- isPremium: subscriptions.hasPremiumAccess,
|
|
|
- onUpgradeTapped: viewModel.showPaywall,
|
|
|
- onManageSubscriptionTapped: viewModel.showPaywall
|
|
|
- )
|
|
|
- .frame(maxHeight: .infinity)
|
|
|
+ HStack(spacing: 0) {
|
|
|
+ SidebarView(
|
|
|
+ selectedDestination: Binding(
|
|
|
+ get: { viewModel.selectedDestination },
|
|
|
+ set: { destination in
|
|
|
+ viewModel.selectDestination(destination)
|
|
|
+ }
|
|
|
+ ),
|
|
|
+ isShowingSettings: viewModel.isShowingSettings,
|
|
|
+ isPremium: subscriptions.hasPremiumAccess,
|
|
|
+ onUpgradeTapped: viewModel.showPaywall,
|
|
|
+ onManageSubscriptionTapped: subscriptions.openSubscriptionManagement
|
|
|
+ )
|
|
|
+ .frame(maxHeight: .infinity)
|
|
|
|
|
|
- Rectangle()
|
|
|
- .fill(AppTheme.border)
|
|
|
- .frame(width: 1)
|
|
|
- .frame(maxHeight: .infinity)
|
|
|
- .ignoresSafeArea(edges: .top)
|
|
|
+ Rectangle()
|
|
|
+ .fill(AppTheme.border)
|
|
|
+ .frame(width: 1)
|
|
|
+ .frame(maxHeight: .infinity)
|
|
|
+ .ignoresSafeArea(edges: .top)
|
|
|
|
|
|
- Group {
|
|
|
- if viewModel.isShowingSettings {
|
|
|
- SettingsView(
|
|
|
- onClose: viewModel.hideSettings,
|
|
|
- themeManager: themeManager
|
|
|
- )
|
|
|
- .transition(.opacity)
|
|
|
- } else {
|
|
|
- contentView
|
|
|
- .transition(.opacity)
|
|
|
- }
|
|
|
- }
|
|
|
- .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
|
|
- .frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
|
- .background(AppTheme.background)
|
|
|
- .ignoresSafeArea(edges: .top)
|
|
|
- .environment(\.onSettingsTapped, viewModel.showSettings)
|
|
|
- }
|
|
|
- .background {
|
|
|
- AppTheme.background
|
|
|
- .ignoresSafeArea(edges: .top)
|
|
|
+ Group {
|
|
|
+ if viewModel.isShowingSettings {
|
|
|
+ SettingsView(
|
|
|
+ onClose: viewModel.hideSettings,
|
|
|
+ themeManager: themeManager
|
|
|
+ )
|
|
|
+ .transition(.opacity)
|
|
|
+ } else {
|
|
|
+ contentView
|
|
|
+ .transition(.opacity)
|
|
|
}
|
|
|
}
|
|
|
+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
|
|
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
|
+ .background(AppTheme.background)
|
|
|
+ .ignoresSafeArea(edges: .top)
|
|
|
+ .environment(\.onSettingsTapped, viewModel.showSettings)
|
|
|
+ .environment(\.requirePremiumAccess, {
|
|
|
+ if subscriptions.hasPremiumAccess { return true }
|
|
|
+ viewModel.showPaywall()
|
|
|
+ return false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ .background {
|
|
|
+ AppTheme.background
|
|
|
+ .ignoresSafeArea(edges: .top)
|
|
|
+ }
|
|
|
+ .overlay {
|
|
|
+ if viewModel.isShowingPaywall {
|
|
|
+ PaywallView(onClose: viewModel.hidePaywall)
|
|
|
+ .transition(.opacity)
|
|
|
+ }
|
|
|
}
|
|
|
.id(themeManager.isDarkMode)
|
|
|
.animation(.easeInOut(duration: 0.2), value: viewModel.isShowingPaywall)
|