scan-flow: geolocation scan, location-aware SMS throttle (log sender), finder contact, sms_enabled toggle, branding — 19/19 phase-2 scenarios pass

This commit is contained in:
2026-08-05 18:23:34 +10:00
parent 4666751e92
commit c2fa04afd0
26 changed files with 698 additions and 43 deletions

View File

@@ -0,0 +1,16 @@
package sms
import "math"
const earthRadiusM = 6371000.0
// HaversineMeters returns the great-circle distance between two points
// (lat/lng in decimal degrees) in metres.
func HaversineMeters(lat1, lng1, lat2, lng2 float64) float64 {
rad := func(d float64) float64 { return d * math.Pi / 180 }
dLat := rad(lat2 - lat1)
dLng := rad(lng2 - lng1)
a := math.Sin(dLat/2)*math.Sin(dLat/2) +
math.Cos(rad(lat1))*math.Cos(rad(lat2))*math.Sin(dLng/2)*math.Sin(dLng/2)
return 2 * earthRadiusM * math.Asin(math.Sqrt(a))
}