Mapbox Migration - #68
Merged
Merged
Conversation
…ute preview to the destination
…upport cross-VM communication
…bypass port translation
- Replaced Picovoice/Porcupine wake word engine with local OpenWakeWord TFLite models - Created WakeWordService (Java) to run inference directly on the native thread for zero-latency audio streaming - Exposed WakeWordModule NativeEventEmitter to React Native - Removed Picovoice dependencies and cleaned up obsolete environment variables and model files
This reverts commit 3ae28fd.
This reverts commit c466911.
This reverts commit f180f19.
…force initial map render
Fix destination parsing to properly send coordinates to mapbox navigation native module. Inject mapbox voice APIs (MapboxSpeechApi & MapboxVoiceInstructionsPlayer) directly into MapboxNavigationView.kt via patch-package.
There was a problem hiding this comment.
Pull request overview
This PR migrates the app’s map rendering and turn-by-turn navigation away from the Google Navigation SDK to Mapbox, while also updating voice-related infrastructure (wake word + ASR/LLM plumbing) to align with the new stack.
Changes:
- Replaced Google navigation UI with Mapbox map rendering + Mapbox Navigation SDK integration.
- Reworked wake word detection from Picovoice Porcupine to a custom native OpenWakeWord-based Android module.
- Updated backend routing/LLM/ASR integrations (Mapbox Directions adapter, Qwen LLM + remote ASR, and more resilient JSON extraction).
Reviewed changes
Copilot reviewed 34 out of 43 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/template.env | Updates env template for Mapbox token while keeping Google key for Places. |
| frontend/src/utils/tts.ts | Adds reusable TTS utility to fetch/play MP3 from ASR service. |
| frontend/src/types/navigation.ts | Makes voice modal callbacks optional and adds onResponse. |
| frontend/src/screens/home.jsx | Switches map background to Mapbox; adds Android mic/location permission gating; adds wake word simulation long-press. |
| frontend/src/hooks/useWakeWord.tsx | Replaces Picovoice wake word hook with native module + event emitter approach. |
| frontend/src/hooks/useVoiceAssistant.tsx | Adds GPS header injection, response callback, and factors TTS into shared utility. |
| frontend/src/hooks/useManualInput.tsx | Adds departure_time=now and uses traffic durations when available. |
| frontend/src/components/route-preview.tsx | Migrates preview map to Mapbox; adds Google Routes API fallback geometry fetching; adds ETA/TTS announcement plumbing. |
| frontend/src/components/navigation-screen.tsx | Replaces GoogleNavView with Mapbox Navigation SDK component and destination coordinate extraction. |
| frontend/src/components/mapbox-map-view.tsx | Adds Mapbox map component with optional polyline rendering and camera fit for preview. |
| frontend/src/components/google-nav-view.tsx | Removes Google Navigation SDK component. |
| frontend/src/components/active-voice-modal.tsx | Wires new onResponse prop through to voice assistant hook. |
| frontend/patches/@roberto497+react-native-mapbox-navigation+0.2.2.patch | Patches Mapbox Navigation wrapper (SDK version bump, exclude prop, voice instructions, route line rendering, etc.). |
| frontend/package.json | Removes Google/Picovoice deps; adds Mapbox deps + patch-package postinstall. |
| frontend/package-lock.json | Lockfile updates reflecting dependency migration. |
| frontend/env.d.ts | Updates env typings to include Mapbox + Google Maps key, removes Picovoice key. |
| frontend/App.js | Removes Google NavigationProvider wrapper. |
| frontend/android/template_local.properties | Adds Mapbox downloads token placeholder alongside Google key. |
| frontend/android/gradle.properties | Updates Gradle JVM args; adds Jetifier; (currently contains Mapbox token). |
| frontend/android/build.gradle | Adjusts Android target SDK setting. |
| frontend/android/app/src/main/java/com/heyroute/wakeword/WakeWordService.java | Adds Android OpenWakeWord TFLite wake word implementation and event emission to JS. |
| frontend/android/app/src/main/java/com/heyroute/wakeword/WakeWordPackage.java | Registers the new wake word native module package. |
| frontend/android/app/src/main/java/com/heyroute/wakeword/WakeWordModule.java | Exposes start/stop/simulate methods and event emitter hooks to React Native. |
| frontend/android/app/src/main/java/com/heyroute/MainApplication.kt | Manually adds WakeWordPackage to the RN package list. |
| frontend/android/app/src/main/AndroidManifest.xml | Removes Google Maps API key meta-data entry. |
| frontend/android/app/build.gradle | Adds TFLite deps and noCompress for .tflite assets. |
| deploy.sh | Adds a backend deployment script (system packages, service + nginx setup). |
| backend/template.env | Adds Mapbox token + Qwen server settings to backend template. |
| backend/model.py | Switches to Mapbox adapter and uses robust JSON extraction for LLM outputs. |
| backend/manual_navigation.py | Uses JSON extraction helper when parsing LLM output. |
| backend/llm_gpt.py | Switches LLM calls from OpenRouter to self-hosted Qwen (timeouts + logging). |
| backend/helpers.py | Adjusts response phrasing and adds extract_json helper. |
| backend/asr.py | Switches ASR to remote Qwen3-ASR GPU server; adds optional GPS headers ingestion. |
| backend/adapters/openrouteservice_adapter.py | Adds PH-only geocode filter. |
| backend/adapters/mapbox_directions_adapter.py | Adds Mapbox Directions adapter using Geoapify geocoding and Mapbox traffic-aware routing. |
| backend/adapters/google_routes_adapter.py | Adds PH-only geocode filter and improves no-route diagnostics. |
Files not reviewed (1)
- frontend/package-lock.json: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+6
| import { useEffect, useRef } from 'react'; | ||
| import { NativeModules, NativeEventEmitter, Platform } from 'react-native'; | ||
| import { customEvent } from 'vexo-analytics'; | ||
|
|
||
| const { WakeWordModule } = NativeModules; | ||
| const wakeWordEmitter = new NativeEventEmitter(WakeWordModule); |
| if (responseText) { | ||
| try { | ||
| await playTTS(responseText); | ||
| playTTS(responseText); |
Comment on lines
+4
to
+5
| import Geolocation from 'react-native-geolocation-service'; | ||
| import { MAPBOX_ACCESS_TOKEN, GOOGLE_MAPS_API_KEY } from '@env'; |
Comment on lines
+392
to
+395
| <Pressable onLongPress={() => { | ||
| const { NativeModules } = require('react-native'); | ||
| NativeModules.WakeWordModule.simulateWakeWord(); | ||
| }}> |
| @@ -44,3 +43,5 @@ hermesEnabled=true | |||
| edgeToEdgeEnabled=false | |||
|
|
|||
| MAPBOX_DOWNLOADS_TOKEN=sk.eyJ1IjoiZ2VvaGFja2VyOTI5IiwiYSI6ImNtbG5zcmFjbDBzYnQzZ3NjeDFqdW95MjUifQ.KdtjrBEQZQ5D4bsjv752bg | |||
|
|
||
| # --- Step 2: Clone the repo --- | ||
| echo "" | ||
| echo "[2/7] Cloning HeyRoute repo (develop branch)..." |
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.
Replaced existing route preview and navigation with Mapbox.