✨ feat(offline): implement complete offline mode with routing fallback hierarchy#8
Merged
✨ feat(offline): implement complete offline mode with routing fallback hierarchy#8
Conversation
…k hierarchy Add fully functional offline mode for PH Fare Calculator enabling fare computation and route planning without network connectivity. Implements 4-level routing fallback (OSRM → Cache → Graph → Haversine), auto-caching for map tiles with LRU eviction, geocoding cache with 7-day expiration, and offline map picker with coordinate-only selection. Includes accuracy indicators (Precise/Estimated/Approximate) and comprehensive test coverage with 371/371 tests passing. Features: - Offline mode toggle in main screen and settings - Automatic map tile caching (5000 tile limit, LRU eviction) - 4-level routing service fallback hierarchy - Offline map picker with coordinate-only location selection - Accuracy level indicators with consistent display - Geocoding cache service with 7-day expiration - Offline mode status banner with connectivity indicators - Cross-region warning banner for inter-regional routes Tests: - Integration tests for offline workflow - Performance tests for offline operations - Unit tests for all new services - Accuracy consistency reproduction tests Fixes: - Accuracy level consistency across fare results - Settings screen toggle state management - Route result null handling for offline scenarios BREAKING CHANGE: AUTH_SECRET environment variable is now required. Applications must set this before upgrading. Closes: #42, #43 Refs: #38
MasuRii
added a commit
that referenced
this pull request
Mar 16, 2026
feat(offline): implement complete offline mode with routing fallback hierarchy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary
This PR implements comprehensive offline mode for PH Fare Calculator, enabling fare calculations even without internet connectivity. The feature includes a 4-level routing fallback hierarchy, automatic map tile caching, geocoding cache with 7-day expiration, and accuracy indicators showing calculation precision.
✨ Changes
🆕 New Services (4)
OfflineModeServiceRoutingRepositoryRouteCacheServiceGeocodingCacheService🆕 New Models (1)
AccuracyLevel🔧 Modified Services
HybridEngine: Integrated offline mode toggleConnectivityService: Enhanced monitoring with state callbacksOSRM RoutingService: Cache integration for online routesHaversineRoutingService: Fallback routing capabilities🎨 New UI Components
📁 Files Changed
Total: 53 files
Lines Changed: +4,662 / -496
🧪 Testing
Test Suite Results
New Test Coverage
offline_mode_service_test.dart: 34 testsoffline_workflow_test.dart: 3 integration testsoffline_performance_test.dart: 3 performance testsoffline_screens_test.dart: 7 widget testsRegression Tests Added
repro_accuracy_consistency_test.dart: Accuracy level consistencyrepro_accuracy_sort_ui_test.dart: Sort option compatibilityrepro_connectivity_persistence.dart: Offline toggle persistence🔧 Technical Highlights
Routing Fallback Hierarchy
Auto-Caching Strategy
Accuracy Level System
None - All changes are backward compatible.
Migration Strategy
🔗 Related Issues
📋 Checklist
📚 Documentation
User-Facing
README.md: Offline mode section with usage guideCHANGELOG.md: v2.3.0 release notesTechnical
🛠️ Verification Steps
Build Verification
Test Execution
Manual Testing
📦 Version Information