-
-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Bug Description
When attempting to exit the analytics view by clicking on different categories in the category switcher, users need to tap multiple times on different categories for the navigation to work properly.
Current Behavior
- User taps on a category tab while in analytics view
- The view doesn't immediately switch to the selected category
- Multiple taps on different categories are required before the navigation works
Steps to Reproduce
- Open the app
- Navigate to the analytics view
- Try to exit by tapping on one of the category tabs (Fossils, Bugs, Fish, Art)
- Notice that a single tap doesn't exit the analytics view
- Tap multiple times or on different categories to finally exit
Expected Behavior
The app should immediately exit the analytics view and navigate to the selected category with a single tap.
Possible Causes
Based on code review:
In ContentView.swift, the CategoryManager class handles switching between categories and the analytics view.
The issue might be in the switchCategory(_ newCategory: Category) method which currently only sets showingAnalytics = false if the new category is different from the selected category:
func switchCategory(_ newCategory: Category) {
if selectedCategory != newCategory {
selectedItem = nil // Clear selection when switching categories
selectedCategory = newCategory
showingAnalytics = false
}
}This means if you tap on the already "selected" category while in analytics view, it won't close the analytics view.
Proposed Fix
Modify the switchCategory method in CategoryManager to always exit analytics view regardless of whether the category changes:
func switchCategory(_ newCategory: Category) {
// Always exit analytics view when switching categories
if showingAnalytics {
showingAnalytics = false
}
// Only change the category if it's different
if selectedCategory != newCategory {
selectedItem = nil
selectedCategory = newCategory
}
}Priority
Medium - Affects user experience but doesn't prevent use of the app