feat(wm): GPS watermark color + place-name/time toggles, "commune, city" locality

This commit is contained in:
2026-09-10 18:05:57 +07:00
parent f13fd8e0f3
commit 299d81bade
6 changed files with 114 additions and 32 deletions
+10 -5
View File
@@ -49,12 +49,17 @@ export async function getCurrentGPS(): Promise<GPSInfo | null> {
}
}
// The one place-name picker: city first, because "the place" on a stamp means
// the town people would name, while subregion is Android's subAdminArea — the
// county/district, i.e. the wrong name for the same coordinates. Shared so the
// camera stamp and a photo's stamp can never disagree.
// The one place-name picker, shared so the camera stamp and a photo's stamp can
// never disagree. A Vietnamese geocoder answers with the commune/ward in
// subregion (post-2025 two-level administration: the commune is the district-
// level name) and the province/city in region, while city and district come
// back null, so the stamp reads "COMMUNE, CITY" instead of a bare city.
export function localityName(address: Location.LocationGeocodedAddress): string | null {
const name = address.city || address.subregion || address.district || address.region;
const district = address.subregion || address.district;
const city = address.city || address.region;
// Same name in both slots (one field echoed twice) must not print twice.
const parts = district && district !== city ? [district, city] : [district || city];
const name = parts.filter(Boolean).join(', ');
return name ? name.toUpperCase() : null;
}