Use open-meteo for weather data outside the US

Fixes #50
This commit is contained in:
James Babcock committed 2026-10-23 14:11:40 -07:00
1 parent cb165d90d2
commit 2c819c8d0e
13 files changed
+537 -25

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
import { Utils } from "@nativescript/core";
import { type Place } from "./location-types";
declare const com: any;
/** The place at a coordinate from Android's Geocoder, or null when the phone can't name it. */
export function reverseGeocode(latitude: number, longitude: number): Promise<Place | null> {
const context = Utils.android.getApplicationContext();
if (!context) return Promise.resolve(null);
return new Promise<Place | null>((resolve) => {
const geocoder = new com.faceclaw.app.FaceclawReverseGeocoder(context);
// The lookup thread holds the listener proxy until its one callback.
geocoder.lookup(latitude, longitude, new com.faceclaw.app.FaceclawReverseGeocoder.Listener({
onResult: (locality: string | null, region: string | null, country: string | null) => {
resolve({ locality: locality ? String(locality) : "", region: region ? String(region) : "", country: country ? String(country) : "" });
},
}));
});
}