Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions docs/development/android.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ The initial SDK 54 lockfile was checked with `npm audit` and compatible fixes ap

Brand assets add two Expo modules and enable one existing module's config plugin: `expo-font` (already a dependency; its config plugin now embeds the bundled Geist and Mona Sans TTFs as Android XML font families), `expo-splash-screen` (black splash with the brand mark; AndroidX `core-splashscreen`), and `expo-asset` (resolves the bundled font URLs that `src/theme/fonts.web.ts` declares with `@font-face` on the web). Their Android dependencies are AndroidX and React Native only; none pulls Google Play services. `@resvg/resvg-js` is a development-only renderer for `scripts/render-brand-assets.mjs` and is not part of the app. After changing the mark, run the script and commit the PNGs; `node scripts/render-brand-assets.mjs --check` fails when they are stale. Fonts and their OFL-1.1 texts are listed in [`assets/fonts/README.md`](../../assets/fonts/README.md).

The task sheet uses `@gorhom/bottom-sheet` 5.2.14, a JavaScript library (with `@gorhom/portal`) on the pinned Reanimated 4.1.1, react-native-worklets 0.5.1 and Gesture Handler 2.28. Its v5.2.8 example app pins the same SDK 54 / React Native 0.81.5 new-architecture stack. It adds no native module, permission or Google dependency. Gesture, keyboard and TalkBack behaviour still require a device check after each upgrade.
The planner's time chip uses `@react-native-community/datetimepicker` 8.4.7 (SDK 54 core has no date/time dialog and `@expo/ui` is beta). SDK 54 lists exactly 8.4.4, but its Kotlin sources call `getCurrentActivity()`, which the Kotlin 2.2.20 pinned by the navigation plugin rejects (`MaterialDatePickerModule.kt`/`MaterialTimePickerModule.kt`: "Function invocation 'getCurrentActivity()' expected"); 8.4.5 and later use `reactApplicationContext.currentActivity`. The package is therefore listed in `expo.install.exclude` so `bun run doctor` accepts the exact 8.4.7 pin; revisit when the SDK's expected version catches up. Only the imperative `DateTimePickerAndroid.open` API is used, with `timeZoneName: 'Europe/Rome'`; it shows the platform `DatePickerDialog`/`TimePickerDialog`. Its Android library depends on AndroidX `core-ktx` and `com.google.android.material:material` 1.12.0 (Material Components, Apache-2.0, a UI library with no Google Play services, location or network use). No config plugin is needed for the default dialogs, so none is added. It requires a rebuilt APK; verify the merged dependency graph and manifest stay free of `com.google.android.gms` and add no permission. The web preview uses the browser's date/time input instead.

## Browser preview

MapLibre GL JS 6 ships ESM workers separately. `bun install --frozen-lockfile` runs `scripts/prepare-web-assets.mjs` to copy the pinned worker into `public/vendor`, while the web map supplies its same-origin URL. The Expo Babel import-meta transform permits Metro's non-module bundle output. Keep these together when upgrading the browser renderer; an exported web bundle alone does not prove workers started. This browser dependency is separate from native MapLibre and is excluded from Android's platform-resolved bundle.
**Apri in un’altra app** calls `Linking.openURL` with a `geo:` URI. It needs no `<queries>` entry because the app never asks which handlers exist; with no map app installed the failure is reported in Italian.
2 changes: 1 addition & 1 deletion docs/development/tooling.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Bun is the package manager and the typecheck/test runner. Its version is pinned

Use `bun run verify` before handing off code. It runs the native typecheck, ESLint with zero warnings permitted, and all fixture tests through Bun's native test runner. The package scripts also expose each check separately, a TypeScript compiler comparison and live service probes. Generated datasets, native output and research archives are excluded from linting.

Run `bun run doctor` after Expo dependency/configuration changes. It runs the SDK compatibility check without an interactive fix prompt, then the pinned Expo Doctor. Use Expo’s installer with Bun for intentional dependency updates.
Run `bun run doctor` after Expo dependency/configuration changes. It runs the SDK compatibility check without an interactive fix prompt, then the pinned Expo Doctor. Check every new or updated native module with an Android build, not only typecheck and doctor: the Kotlin 2.2.20 pin from the navigation plugin can reject Kotlin sources written for older compilers. Use Expo’s installer with Bun for intentional dependency updates.

The Bun suite also invokes the Python standard-library place- and GTT-package regressions. fflate is a pure-JavaScript dependency (no native module) used to inflate ranged GTT ZIP members. Timetable store tests run the production SQL against Bun's built-in `bun:sqlite` through a small driver adapter (`src/transit-data/test-support`); on device the same SQL runs through expo-sqlite. Bun's own type package is not installed, so a minimal ambient declaration covers `bun:sqlite`. Python 3 prepares data and renders extraction SQL; executing the Overture extract needs DuckDB with its `httpfs` extension. See [data preparation](data.md) for pinned inputs, independent place/GTT refreshes and package validation.

Expand Down
5 changes: 5 additions & 0 deletions docs/development/ux.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ The map is the starting point. Search, discovery, transport and saved places are
- An empty search has no selected category or automatic discovery results. Put category shortcuts inside the search interaction. Category selection, typed search, transport and saved places reveal their own results and pins.
- Clearing or closing a search returns to the unselected map. Map movement alone does not begin discovery; searching a changed area is explicit.
- Submitting a search or choosing a category frames its leading nearby results once, above the sheet. Panning before they arrive keeps the user's view; typing alone never moves the map.
- Typed search matches every word somewhere in a place: its name (exact and prefix names rank first, one typo at most), its address including house numbers (exact), an Italian category word (`farmacia`, `bar`) or a neighbourhood from the bundled OpenStreetMap gazetteer (`Eataly Lingotto`, `bar San Salvario`). Linking words (`in`, `a`, `di`) are optional. A neighbourhood alone returns the neighbourhood, not every business inside it; its reading area is an approximate radius around the OSM node, never a boundary. Results say what they are: venue, address (**Indirizzo**), street (**Via**), area (**Quartiere**), GTT stop or line. A typed stop code (`472`, `fermata 472`) leads the list, a line name (`15`, `M1`, `linea 4`) offers its three stops nearest the searched area, and stops found by name follow the places unless the query starts with `fermata`. Stops and lines come from the bundled GTT catalog and appear in either search policy.
- Route planning starts from a fresh position or a deliberately chosen origin. Cancelling origin selection returns to the destination; a fallback viewport never silently becomes the departure point.
- The planner shows **Da** and **A** as two editable fields with a swap button. Each opens a search inside the planner (the same local, stop and, when allowed, Photon search, plus saved places); the origin editor also offers **La tua posizione** (a fresh fix) and **Scegli sulla mappa**. Back closes the editor before the planner. Swapping needs a settled origin; a device origin swapped into the destination is that fixed position, not a live one. Changing either endpoint keeps the planning session and frames the new route once.
- Transit time is one chip (**Partenza adesso**, **Partenza 17:45 · domani**, **Arrivo entro 09:00 · gio 15 ott**). It opens Partenza/Arrivo, **Adesso** and Android's own date and time dialogs, all in Europe/Rome whatever the device zone; each choice plans again. Nonexistent and ambiguous minutes at daylight-saving changes are refused with a message.
- **Apri in un’altra app** on a place and on the planner destination sends `geo:lat,lon?q=lat,lon(Nome)` to Android, which lets the user pick Organic Maps or another map app. The app itself sends nothing anywhere for this; the chosen map app receives the place and handles it under its own privacy terms. Organic Maps' geo URL parser reads the coordinates and the percent-encoded label from `q` (its `geo_url_tests.cpp`, `GeoURL_GeoLabel`, checked on 2026-11-02 at upstream commit fb0ea2c); parentheses in a name are replaced because they would end the label.
- Place details keep **Indicazioni** and **Salva** as the primary pair, then website (shown without scheme), phone and the hand-off. **Fonti e dettagli** lists every contributing source record with the field it supplied, its licence and its own date, Overture's existence estimate (never "open now"), and states that no used source supplies opening hours.
- Give one task the sheet at a time: results, place, stop, route planning or settings. Keep the map usable alongside it and provide a clear return to the map. Sheet titles and actions take precedence over explanatory text. Keep transport and saved shortcuts on the neutral map; task cards replace that chrome. Empty search uses a horizontal shortcut row.
- List distances are measured from the device when its fix is under five minutes old; otherwise they are measured from the centre the map currently shows and say **dal centro mappa**. A selected stop or place shows a distance only from the device. Show OpenStreetMap and Overture categories with Italian labels and a generic fallback, never a raw tag.
- Show coverage boundaries, result limits and data warnings with the results they explain. Keep mandatory map attribution accessible. Preserve place provenance, source timestamps, and live, scheduled, stale and unavailable distinctions in their relevant detail views.
Expand Down
2 changes: 2 additions & 0 deletions docs/research/online-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ The [official README](https://github.com/komoot/photon) documents multilingual O

The README permits use in projects while request volume remains reasonable, reserves throttling/banning for extensive use, and disclaims availability or change guarantees. This is more appropriate for bounded request volumes than assuming an unlimited hosted service. Debounce, cancel obsolete queries, cap results, cache appropriately and make the provider replaceable. A private instance is possible but adds substantial data/hosting work; it is not the proposed starting point.

**How the app uses it.** Only names and addresses go to Photon, with the map centre as location bias, one request per second, cancelled when superseded and cached for five minutes per text and rounded bias. Category words, neighbourhood words alone, stop codes and line names (`472`, `M1`, `fermata 472`, `linea 4`) are answered on the device. Photon, like the local index, needs every word to match: on 2026-11-02 `Eataly Lingotto` returned nothing while `Eataly` biased to the Lingotto node returned the Via Nizza 224 store 1.7 km from that node. So when the full query returns nothing and it names a neighbourhood from the bundled OSM gazetteer (`src/data/localities.json`, built by `scripts/localities.mjs` from one Overpass export), one more request sends the remaining words biased to that neighbourhood's public node instead of the map centre, and answers outside its approximate radius (2 km for suburbs, 900 m for quarters) are dropped. This adds at most one request per such search and discloses a public neighbourhood point rather than the user's map view. Results are labelled as venue, address, street or area from Photon's `osm_key`, `osm_value` and `type`.

A single bounded synthetic query returned HTTP 200 and matching OSM objects. This demonstrates technical access, not comprehensive business discovery. Photon cannot retrieve businesses absent from the data it indexes.

## FOSSGIS public routing: car, bike and foot
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@gorhom/bottom-sheet": "5.2.14",
"@maplibre/maplibre-react-native": "11.5.0",
"@react-native-async-storage/async-storage": "2.2.0",
"@react-native-community/datetimepicker": "8.4.7",
"expo": "54.0.37",
"expo-asset": "12.0.14",
"expo-clipboard": "~8.0.8",
Expand Down Expand Up @@ -74,6 +75,11 @@
},
"packageManager": "bun@1.4.3",
"expo": {
"install": {
"exclude": [
"@react-native-community/datetimepicker"
]
},
"autolinking": {
"android": {
"exclude": [
Expand Down
47 changes: 47 additions & 0 deletions scripts/localities.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env node
/**
* Builds src/data/localities.json, the small neighbourhood gazetteer used to read area words in
* search ("Eataly Lingotto", "bar San Salvario"). Input: an Overpass JSON export of OSM place nodes
* within the place-package rectangle, retrieved with
*
* [out:json][timeout:80];(node["place"~"^(suburb|quarter|neighbourhood)$"](44.98,7.57,45.15,7.78););out body;
*
* Usage: node scripts/localities.mjs <overpass.json> [retrievedAt YYYY-MM-DD]
*
* Selection: every place=suburb, plus quarter/neighbourhood nodes with multi-word names (single
* words such as "Rossi" or "Crimea" are too often part of business names). "Centro" is excluded as
* generic. A parenthetical suffix is dropped and the first node of a repeated name wins. Radii are
* approximate reading areas around the OSM node, not boundaries.
*/
import { readFileSync, writeFileSync } from 'node:fs';

const [input, retrievedAt = new Date().toISOString().slice(0, 10)] = process.argv.slice(2);
if (!input) { console.error('usage: node scripts/localities.mjs <overpass.json> [YYYY-MM-DD]'); process.exit(2); }
const data = JSON.parse(readFileSync(input, 'utf8'));
const RADIUS = { suburb: 2000, quarter: 900, neighbourhood: 900 };
const key = name => name.normalize('NFD').replace(/\p{Diacritic}/gu, '').toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
const seen = new Set();
const localities = [];
const order = { suburb: 0, quarter: 1, neighbourhood: 2 };
for (const element of [...data.elements].sort((a, b) => order[a.tags.place] - order[b.tags.place] || a.id - b.id)) {
const kind = element.tags.place;
const name = (element.tags.name ?? '').replace(/\s*\(.*\)\s*$/, '').trim();
if (!name || key(name) === 'centro' || seen.has(key(name))) continue;
if (kind !== 'suburb' && key(name).split(' ').length < 2) continue;
seen.add(key(name));
localities.push({ id: `osm:node:${element.id}`, name, kind, latitude: Number(element.lat.toFixed(5)), longitude: Number(element.lon.toFixed(5)), radiusMeters: RADIUS[kind] });
}
localities.sort((a, b) => a.name.localeCompare(b.name, 'it'));
const output = {
schemaVersion: 1,
source: 'OpenStreetMap place nodes via Overpass API',
license: 'ODbL-1.0',
attribution: '© OpenStreetMap contributors · ODbL',
osmBase: data.osm3s?.timestamp_osm_base ?? null,
retrievedAt,
query: '[out:json];(node["place"~"^(suburb|quarter|neighbourhood)$"](44.98,7.57,45.15,7.78););out body;',
selection: 'place=suburb, plus multi-word quarter/neighbourhood names; "Centro" excluded; radii are approximate.',
localities,
};
writeFileSync(new URL('../src/data/localities.json', import.meta.url), `${JSON.stringify(output, null, 1)}\n`);
console.log(`${localities.length} localities`);
Loading
Loading