From 4894c8b6eb31dacbad234c14af763ff976b6b5c5 Mon Sep 17 00:00:00 2001 From: alexandrev-tibco Date: Thu, 10 Sep 2026 20:53:12 +0200 Subject: [PATCH] home: el selector de semana sale de la toolbar a su propia barra MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit En premium la barra de navegacion lleva cuatro botones a la izquierda y mas a la derecha; el ToolbarItem(.principal) se comprimia y iOS recortaba las flechas, dejando solo el titulo — por eso no aparecian en el iPhone del usuario aunque en el simulador (modo free, dos botones) se vieran bien. Ahora el selector es una barra propia bajo la navegacion: flechas en circulo blanco con borde coral y el rango de semana con chevron.down al centro. Verificado con captura forzando los botones premium. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_013H6bXqGX1ygwib1Dm3n3UG --- MealMood/Views/Home/HomeView.swift | 128 +++++++++++++++-------------- MealMoodWatchWidget/Info.plist | 2 +- MealMoodWidget/Info.plist | 2 +- 3 files changed, 70 insertions(+), 62 deletions(-) diff --git a/MealMood/Views/Home/HomeView.swift b/MealMood/Views/Home/HomeView.swift index 0df222d..f09c21a 100644 --- a/MealMood/Views/Home/HomeView.swift +++ b/MealMood/Views/Home/HomeView.swift @@ -153,66 +153,6 @@ struct HomeView: View { } } } - ToolbarItem(placement: .principal) { - // Bold circled arrows: the previous thin chevrons were so - // subtle that users couldn't find how to change week. - HStack(spacing: 8) { - if let settings = settings { - Button { - viewModel.goToPreviousWeek() - showWeekLimitUpsell = false - } label: { - Image(systemName: "chevron.left") - .font(.system(size: 13, weight: .bold)) - .foregroundColor(.mealMoodCoral) - .frame(width: 30, height: 30) - .background(Circle().fill(Color.white.opacity(0.75))) - } - .buttonStyle(.plain) - .accessibilityLabel(Text("home_previous")) - - Button { - weekPickerDate = viewModel.currentWeekStart - showWeekPicker = true - } label: { - HStack(spacing: 4) { - Text(viewModel.weekRangeText) - .font(.mealMoodH2) - .foregroundColor(.mealMoodTextPrimary) - .lineLimit(1) - .minimumScaleFactor(0.7) - Image(systemName: "chevron.down") - .font(.system(size: 10, weight: .bold)) - .foregroundColor(.mealMoodTextSecondary) - } - } - .buttonStyle(.plain) - .accessibilityLabel(Text("home_select_week")) - - Button { - if canNavigateToNextWeek(settings: settings) { - viewModel.goToNextWeek() - showWeekLimitUpsell = false - } else { - withAnimation(.easeInOut(duration: 0.2)) { - showWeekLimitUpsell = true - } - AnalyticsService.logWeekLimitHit() - paywallPresentation = PaywallPresentation(source: "week_limit") - HapticManager.shared.notification(type: .warning) - } - } label: { - Image(systemName: "chevron.right") - .font(.system(size: 13, weight: .bold)) - .foregroundColor(.mealMoodCoral) - .frame(width: 30, height: 30) - .background(Circle().fill(Color.white.opacity(0.75))) - } - .buttonStyle(.plain) - .accessibilityLabel(Text("home_next")) - } - } - } ToolbarItem(placement: .navigationBarTrailing) { HStack(spacing: 10) { if let settings = settings, @@ -311,9 +251,77 @@ struct HomeView: View { } } + /// Week switcher. It used to live in the navigation bar's principal slot, + /// where a premium user's four leading buttons squeezed it until the arrows + /// were clipped away — leaving no visible way to change week. + private func weekSwitcher(settings: AppSettings) -> some View { + HStack(spacing: 12) { + Button { + viewModel.goToPreviousWeek() + showWeekLimitUpsell = false + } label: { + Image(systemName: "chevron.left") + .font(.system(size: 15, weight: .bold)) + .foregroundColor(.mealMoodCoral) + .frame(width: 36, height: 36) + .background(Circle().fill(Color.white)) + .overlay(Circle().stroke(Color.mealMoodCoral.opacity(0.35), lineWidth: 1)) + } + .buttonStyle(.plain) + .accessibilityLabel(Text("home_previous")) + + Button { + weekPickerDate = viewModel.currentWeekStart + showWeekPicker = true + } label: { + HStack(spacing: 5) { + Text(viewModel.weekRangeText) + .font(.mealMoodH2) + .foregroundColor(.mealMoodTextPrimary) + .lineLimit(1) + .minimumScaleFactor(0.7) + Image(systemName: "chevron.down") + .font(.system(size: 11, weight: .bold)) + .foregroundColor(.mealMoodTextSecondary) + } + .frame(maxWidth: .infinity) + } + .buttonStyle(.plain) + .accessibilityLabel(Text("home_select_week")) + + Button { + if canNavigateToNextWeek(settings: settings) { + viewModel.goToNextWeek() + showWeekLimitUpsell = false + } else { + withAnimation(.easeInOut(duration: 0.2)) { + showWeekLimitUpsell = true + } + AnalyticsService.logWeekLimitHit() + paywallPresentation = PaywallPresentation(source: "week_limit") + HapticManager.shared.notification(type: .warning) + } + } label: { + Image(systemName: "chevron.right") + .font(.system(size: 15, weight: .bold)) + .foregroundColor(.mealMoodCoral) + .frame(width: 36, height: 36) + .background(Circle().fill(Color.white)) + .overlay(Circle().stroke(Color.mealMoodCoral.opacity(0.35), lineWidth: 1)) + } + .buttonStyle(.plain) + .accessibilityLabel(Text("home_next")) + } + .padding(.horizontal, 16) + .padding(.top, 6) + .padding(.bottom, 10) + } + @ViewBuilder private func mainContent(plan: WeekPlan, settings: AppSettings) -> some View { VStack(spacing: 0) { + weekSwitcher(settings: settings) + if showWeekLimitUpsell && !settings.isPremium { PremiumUpsellBanner( messageKey: "premium_limit_future_weeks", diff --git a/MealMoodWatchWidget/Info.plist b/MealMoodWatchWidget/Info.plist index ed571c6..19b3d2a 100644 --- a/MealMoodWatchWidget/Info.plist +++ b/MealMoodWatchWidget/Info.plist @@ -17,7 +17,7 @@ CFBundleShortVersionString 2.1.1 CFBundleVersion - 84 + 85 NSExtension NSExtensionPointIdentifier diff --git a/MealMoodWidget/Info.plist b/MealMoodWidget/Info.plist index ed571c6..19b3d2a 100644 --- a/MealMoodWidget/Info.plist +++ b/MealMoodWidget/Info.plist @@ -17,7 +17,7 @@ CFBundleShortVersionString 2.1.1 CFBundleVersion - 84 + 85 NSExtension NSExtensionPointIdentifier