Skip to content

Mapbox Migration - #68

Merged
LourenzBani merged 47 commits into
developfrom
feature/mapbox-migration
Jul 9, 2026
Merged

Mapbox Migration#68
LourenzBani merged 47 commits into
developfrom
feature/mapbox-migration

Conversation

@LourenzBani

Copy link
Copy Markdown

Replaced existing route preview and navigation with Mapbox.

LourenzBani and others added 30 commits June 19, 2026 16:14
- 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
Copilot AI review requested due to automatic review settings July 9, 2026 03:25
@LourenzBani
LourenzBani merged commit 6f68591 into develop Jul 9, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Comment thread deploy.sh

# --- Step 2: Clone the repo ---
echo ""
echo "[2/7] Cloning HeyRoute repo (develop branch)..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants