fix: lỗi áp dụng recipe lên live view của camera

This commit is contained in:
2026-07-17 15:02:05 +07:00
parent 2775662b62
commit 4c419f266c
11 changed files with 715 additions and 98 deletions
+12
View File
@@ -50,6 +50,18 @@ export async function getCurrentGPS(): Promise<GPSInfo | null> {
}
}
export async function reverseGeocode(latitude: number, longitude: number): Promise<string | null> {
try {
const geo = await Location.reverseGeocodeAsync({ latitude, longitude });
if (geo && geo.length > 0) {
return (geo[0].subregion || geo[0].city || geo[0].region || '').toUpperCase() || null;
}
} catch (e) {
console.warn('Reverse geocode failed:', e);
}
return null;
}
export function formatCoordinate(val: number, type: 'lat' | 'lon'): string {
const absolute = Math.abs(val);
const degrees = Math.floor(absolute);