Skip to content
This repository was archived by the owner on Sep 24, 2026. It is now read-only.

About

University project done in the course Design and Development of Mobile Applications, in collaboration with one of the biggest railway companies in Italy: Trenord

Resources

Stars

0 stars

Watchers

0 watching

Forks

ย 
ย 

Latest commit

ย 

History

552 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš† Trenord Infotainment

Next-Generation Onboard Passenger Companion & Smart Infotainment Platform

An offline-resilient, beautifully crafted onboard mobile app for Trenord commuters across Lombardy.

React Native Expo TypeScript Jest Tests Localization


Home Dashboard Mobile ย ย  Journey Map & Timeline Mobile ย ย  Home Dashboard iPad Tablet


๐Ÿ“น Interactive Walkthrough

Watch the complete onboard experience in actionโ€”including ticket onboarding, live map telemetry, podcast playback, offline mini-games, and vehicle motion cues:

Trenord Infotainment Demo Walkthrough
Click animation to view or download the full high-definition video walkthrough (MP4).


๐Ÿ’ก What is Trenord Infotainment?

Trenord Infotainment turns daily train commutes into a smooth, connected, and relaxing journey. Built with a local-first, offline-ready architecture, the app stays snappy and fully usable even during alpine tunnel dead-zones or crowded mobile network handoffs.

โšก Highlights at a Glance

Feature Description
๐ŸŽŸ๏ธ Ticket Gate & Auth Fast optical ticket barcode scanning or manual train code entry with instant schedule & stop onboarding.
๐Ÿš† Live Journey Tracking Real-time velocity estimation, dynamic delay projection, tunnel dead-reckoning, and OSM polyline tracks.
๐Ÿ”” Proactive Notifications Automated push alerts for schedule delays, platform reassignments, and upcoming destination arrival.
๐ŸŒ€ Anti-Motion Sickness Hardware-accelerated 60 FPS inertial cues counteracting train sway to relieve reading discomfort.
๐ŸŽฎ 100% Offline Arcade Battery-efficient mini-games (Commuter Sudoku & Trenord Hop) playable anywhere with zero data needed.
๐ŸŽง Background Audio Podcast streaming with persistent lockscreen scrubber and variable speeds (1xโ€“2x) via expo-audio.
๐ŸŒฆ๏ธ Destination Intel Live weather forecasts, European AQI air quality gauges, UV alerts, destination news, and cultural POIs.
๐Ÿ“ฑ Universal Responsive Multi-column tablet spatial layouts ($w \ge 768,\mathrm{px}$) and phone-optimized single-column views.
๐Ÿšจ Shake to Report Emergency and onboard issue reporting triggered instantly by a physical device shake gesture.

โœจ Visual Feature Tour

1. ๐ŸŽŸ๏ธ Onboarding & Ticket Verification

Passengers start by scanning their physical ticket barcode / PNR booking code or entering a train number (e.g. 24869). The app automatically authenticates with the B2B timetable service, resolves the complete stop sequence, and sets up real-time telemetry:

Login Screen Dark ย ย ย ย  Destination Select Dark


2. ๐Ÿš† Live Journey Telemetry & Railway Map

Direct integration with the Trenord Cloud B2B platform and onboard device sensors provides live journey telemetry:

  • Interactive Railway Polylines: Real-time track geometry rendered from OpenStreetMap with dynamic train location tracking.
  • Smart Delay & Platform Allocation: Live arrival recalculation with station dwell times, track reassignments, and platform updates.
  • Tunnel Dead-Reckoning Velocity: High-frequency GPS velocity estimations that seamlessly fall back to inertial dead-reckoning during alpine tunnel signal blackouts.
  • Next-Stop HUD & Carriage Occupancy: At-a-glance speedometer, live delay badge, next stop countdowns, and real-time carriage crowding indicators.

Journey Map Dark ย ย ย ย  Journey Map Light


3. ๐Ÿ  Home Dashboard & Local Intelligence

The dashboard surfaces critical journey metrics along with destination-specific content:

  • Live Status Card: High-contrast indicator for on-time/delay status, current station, and estimated destination arrival.
  • Contextual Feeds: Destination municipality news and quick-access discovery cards with pedestrian walking distances.

Home Dashboard Dark ย ย ย ย  Home News and Discovery


4. ๐ŸŒ€ Vehicle Motion Cues (Anti-Kinetosis Engine)

Reading on a moving train often triggers visual-vestibular conflict. The app features a lightweight, unobtrusive motion cue overlay:

  • 40 Inertial Particles: Edge-aligned visual dots smoothly drift in opposition to train acceleration and track curves.
  • Native 60 FPS UI Thread: Driven by React Native Reanimated worklets without adding overhead to the JavaScript thread.

Motion Cues Active


5. ๐ŸŽฎ On-Board Games Arcade & Media Hub

Zero-latency casual entertainment and media designed to work seamlessly onboard without internet connectivity:

  • Commuter Sudoku: Clean 9x9 grid with Easy, Medium, and Hard puzzles, pencil note-taking, error highlighting, timer, and persistent auto-save.
  • Trenord Hop (60 FPS): Retro endless train-crossing runner featuring pixel rolling stock, conductor obstacle, coin collection, haptics, and dynamic audio.
  • Background Audio Player: Native playback powered by expo-audio with lockscreen media controls, draggable scrubber, and speed controls.

Media Films ย ย ย ย  Games and Podcasts

Trenord Hop 60 FPS Runner ย ย ย ย  Commuter Sudoku Light ย ย ย ย  Commuter Sudoku Dark


6. ๐ŸŒฆ๏ธ Destination Intelligence & Digital Magazine

  • Hyperlocal Weather & Air Quality: Real-time destination weather, ambient temperature, condition codes, and European Air Quality Index (AQI) ratings.
  • Interactive POI Map Sheet: Explore cultural landmarks, museums, and historical architecture with categorized map pins.
  • Digital News Magazine: Masonry-grid article reader keeping commuters informed with destination-pertinent municipal, regional, and national headlines.

Weather Light ย ย  Weather Dark ย ย  Explore Nearby POIs ย ย  Digital Magazine


7. ๐Ÿ”” Notifications & Travel Alerts

  • Proactive Train Status Notifications: Timely push notifications alerting passengers to upcoming stops, schedule delay adjustments, and track reassignments.
  • Notifications Timeline Sheet: Comprehensive chronological timeline of upcoming and past alerts for journey events and weather warnings.

Notifications Timeline ย ย ย ย  Notification Preferences


8. ๐ŸŽจ Themes & Passenger Preferences

  • Dynamic Dark & Light Themes: Adaptive color tokens with system auto-detection and static StyleSheet pre-compilation for instant zero-overhead transitions.
  • Travel Comfort & Storage Controls: Direct toggles for motion cues, language localization (IT / EN), and local offline cache management.

Settings Dark ย ย ย ย  Settings Light


9. ๐Ÿ“ฑ Universal Adaptive Layouts (Mobile vs. Tablet / iPad Bifurcation)

Built mobile-first, Trenord Infotainment dynamically adapts to wide tablet topologies ($w \ge 768,\mathrm{px}$) without duplicating routes, domain state, or network requests:

  • Simultaneous Multi-Column Composition: On tablet displays, the Journey tab bifurcates into side-by-side railway polyline map and stop timeline panels, while the Home dashboard displays concurrent telemetry widgets and discovery carousels.
  • Scanability & Bounded Constraints: Form cards and modal sheets enforce centered constraints ($\le 700,\mathrm{px}$), preventing excessive line lengths on wide screens.
  • Zero-State Duplication: Orientation changes and window resizes execute as render-time layout updates without resetting media playback or game progress.

Tablet Home Multi-Column ย ย  Tablet Journey Simultaneous Map and Timeline

Tablet Media Grid ย ย  Tablet Weather and AQI Modal


๐Ÿ›๏ธ System Architecture

flowchart TB
    subgraph UI ["Presentation Layer (Expo Router)"]
        Tabs["Tab Shell: /(tabs) (Home, Journey, Media, Settings)"]
        Modals["SlideSheet Modals: Weather, POI Map, News, Report Issue"]
        Games["Arcade Shell: /game-page (Sudoku, Trenord Hop)"]
        Cues["VehicleMotionCues (60 FPS Reanimated Worklet)"]
    end

    subgraph State ["Domain State (Zustand 5)"]
        Stores["11 Stores: Journey, Weather, News, Media, Podcast, Audio, Games, Settings..."]
        Storage["AsyncStorage Engine (createJSONStorage)"]
    end

    subgraph Native ["Device & Hardware Bridges"]
        Sensors["expo-sensors (Accelerometer)"]
        Location["expo-location (GPS Velocity & Dead-Reckoning)"]
        Audio["expo-audio (Native Sound & Audio Director)"]
        Haptics["expo-haptics (Tactile Feedback)"]
    end

    subgraph Edge ["Network & Edge Proxy"]
        Proxy["Expo Edge Serverless Proxy (/api/proxy)"]
        TrenordAPI["Trenord Cloud B2B API (OAuth RS256 JWT)"]
        External["Open-Meteo, CurrentsAPI, Listen Notes, TMDB, OSM"]
    end

    UI --> State
    State --> Storage
    UI --> Native
    State --> Proxy
    Proxy --> TrenordAPI
    Proxy --> External
Loading

Note

For the complete modular system design and architecture specifications, visit docs/architecture/.


๐Ÿ› ๏ธ For Developers & Contributors

๐Ÿš€ Getting Started

  1. Requirements:

    • Node.js $\ge 18$
    • pnpm $\ge 9$ (pnpm is strictly required; do not use npm or yarn)
  2. Installation:

    pnpm install
  3. Start Development Server:

    pnpm start

Tip

Web Development & CORS: Running pnpm web automatically routes external API calls through the local serverless proxy (/api/proxy+api.ts), eliminating CORS restrictions during local browser testing.


๐Ÿงช Quality Verification & Testing

The codebase features 142 test suites (921 unit tests) covering all domain state stores, math utilities, kinematics, and UI views with a 100% pass rate (>90% line coverage).

# Run complete test suite
pnpm test

# Run tests with coverage report
pnpm test:cov

# Run strict TypeScript type check
pnpm typecheck

# Lint codebase
pnpm lint

# Format with Prettier
pnpm format

๐Ÿ“ Architecture & Engineering Standards

The codebase strictly adheres to SOLID design principles:

  • SRP: Data fetching, kinematics math, and UI rendering are strictly decoupled into dedicated custom hooks and reusable components.
  • OCP & LSP: UI primitives and native API mocks follow extensible typed contracts.
  • ISP & DIP: State stores and services depend on minimal, well-defined abstractions.

For in-depth architectural guides, refer to:


๐Ÿ“ฑ Android Development from Linux / WSL

If you are developing inside WSL while running Android Studio and emulators on Windows:

  1. Set Windows Android SDK in WSL (~/.bashrc):

    export ANDROID_HOME=/mnt/c/Users/<WINDOWS_USER>/AppData/Local/Android/Sdk
    export ANDROID_SDK_ROOT=$ANDROID_HOME
    export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator:$ANDROID_HOME/cmdline-tools/latest/bin
  2. Create ADB Symlink:

    cd "$ANDROID_HOME/platform-tools"
    ln -s adb.exe adb
  3. Launch Emulator from CLI:

    # List available emulators
    "$ANDROID_HOME/emulator/emulator.exe" -list-avds
    
    # Start emulator
    "$ANDROID_HOME/emulator/emulator.exe" -avd <AVD_NAME>
    
    # Verify connection
    "$ANDROID_HOME/platform-tools/adb" devices

๐Ÿ“ฆ EAS Local Builds in WSL

Local Android builds (gradle) inside WSL require a Linux Android SDK, while pnpm start uses the Windows SDK for emulator communication.

Step 1: Install the Linux Android SDK (One-Time Setup)

mkdir -p ~/android-sdk/cmdline-tools
cd ~/android-sdk/cmdline-tools
wget -q https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
unzip -q commandlinetools-linux-11076708_latest.zip
mv cmdline-tools latest

export ANDROID_HOME=$HOME/android-sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME

yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "platform-tools" "platforms;android-36" "build-tools;36.0.0" "ndk;27.1.12297006"

Step 2: Add Build Helper to ~/.bashrc

eas-build-android() {
    local ndk_dir=$(ls -d $HOME/android-sdk/ndk/* 2>/dev/null | tail -n 1)
    ANDROID_HOME=$HOME/android-sdk \
    ANDROID_SDK_ROOT=$HOME/android-sdk \
    ANDROID_NDK_HOME=${ANDROID_NDK_HOME:-$ndk_dir} \
    eas build --platform android --local "$@"
}

Run source ~/.bashrc to reload.

Step 3: Run Build Commands

  • Development Build (Dev Client APK):

    eas-build-android --profile development
  • Release / Preview Package (Standalone Release APK):

    eas-build-android --profile preview
  • Production Release Package (App Bundle / AAB):

    eas-build-android --profile production

๐Ÿ”„ Managing Dependencies

# Update dependencies within version ranges
pnpm update

# Align Expo packages to SDK version
pnpm dlx expo install --check
pnpm dlx expo install --fix --pnpm

# Diagnose project health
npx expo-doctor

Built with โค๏ธ for Trenord commuters across Lombardy.

Crafted by @Bert0ns โ€ข @toto04 โ€ข @Suzani-Luca

About

University project done in the course Design and Development of Mobile Applications, in collaboration with one of the biggest railway companies in Italy: Trenord

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages