Subrise/Sunset widget: check location permission

This commit is contained in:
Evgeny
2024-09-12 09:42:08 +03:00
parent 11a8cf2ad6
commit 97947882df

View File

@@ -11,6 +11,14 @@ local fmt = require "fmt"
function on_alarm()
local location = system:location()
if location == nil then
return
elseif location == "permission_error" then
ui:show_text("No location permission")
return
end
local url = "https://api.sunrise-sunset.org/json?lat=" .. location[1] .. "&lng=" .. location[2] .. "&formatted=0"
http:get(url)