mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-08-29 01:08:59 +00:00
FIX - accept custom app registration retries
This commit is contained in:
@@ -30,7 +30,7 @@ local function copy_record_data(value)
|
||||
return copied
|
||||
end
|
||||
|
||||
local function register_provider_app(provider, owner_resource, definition, vendor_data, update_existing)
|
||||
local function register_provider_app(provider, owner_resource, definition, vendor_data)
|
||||
local app_id = definition.id
|
||||
local existing = provider_apps[app_id]
|
||||
if existing and (existing.owner_resource ~= owner_resource or existing.provider ~= provider) then
|
||||
@@ -38,7 +38,7 @@ local function register_provider_app(provider, owner_resource, definition, vendo
|
||||
end
|
||||
|
||||
local success, error_message
|
||||
if existing and update_existing then
|
||||
if existing then
|
||||
success, error_message = core.Update(owner_resource, definition)
|
||||
else
|
||||
success, error_message = core.Add(owner_resource, definition)
|
||||
@@ -104,7 +104,7 @@ function SkyPhoneApps.RegisterCompatibilityExport(owner_resource, app_data)
|
||||
))
|
||||
return false, definition_error
|
||||
end
|
||||
return register_provider_app(provider, owner_resource, definition, copy_record_data(app_data), false)
|
||||
return register_provider_app(provider, owner_resource, definition, copy_record_data(app_data))
|
||||
end
|
||||
|
||||
SkyPhoneApps.OnCompatibilityAppRemoved = function(owner_resource, app_id)
|
||||
@@ -133,8 +133,7 @@ local function add_17mov_application(app_data)
|
||||
providers.seventeen,
|
||||
owner_resource,
|
||||
definition,
|
||||
copy_record_data(app_data),
|
||||
false
|
||||
copy_record_data(app_data)
|
||||
)
|
||||
end
|
||||
|
||||
@@ -206,8 +205,7 @@ local function add_high_application(app_name, data, locales)
|
||||
providers.high,
|
||||
owner_resource,
|
||||
definition,
|
||||
copy_record_data(data),
|
||||
provider_apps[app_name] ~= nil
|
||||
copy_record_data(data)
|
||||
)
|
||||
end
|
||||
|
||||
@@ -241,8 +239,7 @@ local function add_quasar_app_for_owner(owner_resource, app_data)
|
||||
providers.quasar,
|
||||
owner_resource,
|
||||
definition,
|
||||
SkyPhoneCompatibility.CopyQuasarData(app_data),
|
||||
false
|
||||
SkyPhoneCompatibility.CopyQuasarData(app_data)
|
||||
)
|
||||
end
|
||||
|
||||
@@ -473,8 +470,7 @@ local function remove_high_server_app(owner_resource, app_id)
|
||||
providers.high,
|
||||
client_record.owner_resource,
|
||||
client_record.definition,
|
||||
nil,
|
||||
false
|
||||
nil
|
||||
)
|
||||
if not success then
|
||||
print(("[%s] Could not restore High Phone client application %s: %s."):format(
|
||||
|
||||
@@ -162,7 +162,7 @@ invoking_resource = "lb_app"
|
||||
local lifecycle_response_delivered = false
|
||||
local install_hook_after_response = false
|
||||
local open_hook_after_response = false
|
||||
local lb_success, lb_error = lb_add_custom_app({
|
||||
local lb_definition = {
|
||||
identifier = "dispatch",
|
||||
name = "Dispatch",
|
||||
description = "Dispatch terminal",
|
||||
@@ -175,12 +175,25 @@ local lb_success, lb_error = lb_add_custom_app({
|
||||
open_hook_after_response = lifecycle_response_delivered
|
||||
error(5)
|
||||
end),
|
||||
})
|
||||
}
|
||||
local lb_success, lb_error = lb_add_custom_app(lb_definition)
|
||||
assert(lb_success and lb_error == nil, "LB AddCustomApp must register through the shared export")
|
||||
lb_definition.name = "Dispatch Updated"
|
||||
local retry_success, retry_error = lb_add_custom_app(lb_definition)
|
||||
assert(retry_success and retry_error == nil, "same-owner LB registration retries must update in place")
|
||||
|
||||
local lifecycle_callback = assert(registered_nui_callbacks["custom-app:lifecycle"])
|
||||
local lifecycle_response
|
||||
SkyPhoneApps.SetPhoneOpen(true)
|
||||
local retry_catalog = nui_messages[#nui_messages]
|
||||
local retried_app
|
||||
for index = 1, #retry_catalog.data.apps do
|
||||
if retry_catalog.data.apps[index].id == "dispatch" then
|
||||
retried_app = retry_catalog.data.apps[index]
|
||||
break
|
||||
end
|
||||
end
|
||||
assert(retried_app and retried_app.name == "Dispatch Updated", "same-owner retry must publish the updated app")
|
||||
lifecycle_response_delivered = false
|
||||
lifecycle_callback({ appId = "dispatch", event = "install" }, function(response)
|
||||
lifecycle_response = response
|
||||
|
||||
Reference in New Issue
Block a user