mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-08-29 11:01:34 +00:00
30559048fd
* FIX - preserve LB custom app lifecycle * FIX - reset LB export aliases before startup * FIX - report competing custom app providers * FIX - identify LB app frames as live NUI * FIX - complete LB custom app compatibility * FIX - provide LB PicChat runtime exports * FIX - route LB PicChat through Sky Phone * FIX - return cached LB equipped phone number * FIX - harden PicChat compatibility migration * ENH - complete modular phone provider and Creator APIs * DOC - document the Sky Phone Creator API --------- Co-authored-by: DerEchteAlec <bycraky@gmail.com> Co-authored-by: DerEchteAlec <alec.schitzkat@luwan.io>
53 lines
1.3 KiB
Lua
53 lines
1.3 KiB
Lua
SkyPhonePublicApi = {}
|
|
|
|
local API_VERSION = "1.0.0"
|
|
|
|
local function copy_value(value)
|
|
if type(value) ~= "table" then
|
|
return value
|
|
end
|
|
|
|
local copy = {}
|
|
for key, nested_value in pairs(value) do
|
|
copy[key] = copy_value(nested_value)
|
|
end
|
|
return copy
|
|
end
|
|
|
|
local function get_api_version()
|
|
return API_VERSION
|
|
end
|
|
|
|
local function normalize_phone_number(phone_number)
|
|
local normalized = SkyPhoneSimNumber.Normalize(
|
|
phone_number,
|
|
Config.Sim.NumberLength,
|
|
Config.Sim.NumberPrefix
|
|
)
|
|
if not normalized then
|
|
return nil, "invalid_phone_number"
|
|
end
|
|
return normalized
|
|
end
|
|
|
|
local function format_phone_number(phone_number)
|
|
local normalized, normalize_error = normalize_phone_number(phone_number)
|
|
if not normalized then
|
|
return nil, normalize_error
|
|
end
|
|
return SkyPhoneSimNumber.Format(
|
|
normalized,
|
|
Config.Sim.NumberGroups,
|
|
Config.Sim.NumberLength,
|
|
Config.Sim.NumberPrefix
|
|
)
|
|
end
|
|
|
|
SkyPhonePublicApi.Copy = copy_value
|
|
SkyPhonePublicApi.Version = API_VERSION
|
|
|
|
exports("GetApiVersion", get_api_version)
|
|
exports("NormalizePhoneNumber", normalize_phone_number)
|
|
exports("FormatPhoneNumber", format_phone_number)
|
|
exports("IsValidImei", SkyPhoneImei.IsValid)
|