Fixed start up crash on older OS version (11.5)

This commit is contained in:
Brahim Hadriche committed 2024-12-23 12:13:35 -05:00
1 parent 010d86f34e
commit 2c1306c563
6 files changed
+26 -4

No files matched your search

+6
View File
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- Start up crash on older OS version (11.5)
## [0.34.1] - 2024-12-23
### Fixed
+2 -1
View File
@@ -1,4 +1,5 @@
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/MessagePortUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
@@ -10,7 +11,7 @@ function Init()
m.top.ObserveField("logLine", port)
scene = m.top.getScene()
scene.ObserveFieldScopedEx("systemLogEvent", port)
MessagePortUtils.ObserveFieldScopedExSafe(scene, "systemLogEvent", port)
m.port = port
@@ -1,5 +1,6 @@
import "pkg:/components/Services/LoungeService/LoungeApi.bs"
import "pkg:/source/services/HttpClient.bs"
import "pkg:/source/utils/MessagePortUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
@asynctask
@@ -8,7 +9,7 @@ function LoungeGenerateManualPairingCodeTask(input as object) as object
if StringUtils.IsNullOrEmpty(input.loungeToken)
messagePort = CreateObject("roMessagePort")
loungeService.observeFieldScopedEx("loungeToken", messagePort)
MessagePortUtils.ObserveFieldScopedExSafe(loungeService, "loungeToken", messagePort)
loungeService.join = true
message = wait(30000, messagePort)
loungeService.unobserveFieldScoped("loungeToken")
@@ -1,4 +1,5 @@
import "pkg:/source/services/XmlObject.bs"
import "pkg:/source/utils/MessagePortUtils.bs"
namespace Http
@@ -67,7 +68,7 @@ namespace Http
loungeToken = m.loungeService.loungeToken
if StringUtils.IsNullOrEmpty(loungeToken)
messagePort = CreateObject("roMessagePort")
m.loungeService.observeFieldScopedEx("loungeToken", messagePort)
MessagePortUtils.ObserveFieldScopedExSafe(m.loungeService, "loungeToken", messagePort)
m.loungeService.join = true
message = wait(30000, messagePort)
m.loungeService.unobserveFieldScoped("loungeToken")
@@ -1,3 +1,4 @@
import "pkg:/source/utils/MessagePortUtils.bs"
import "pkg:/source/utils/Types.bs"
namespace Http
@@ -42,7 +43,7 @@ namespace Http
' If the lib_version_latest field is not available, we can give it a few seconds
' To make a request to Github to get the latest version.
msgPort = CreateObject("roMessagePort")
m.applicationInfoNode.observeFieldScopedEx("lib_version_latest", msgPort)
MessagePortUtils.ObserveFieldScopedExSafe(m.applicationInfoNode, "lib_version_latest", msgPort)
wait(5000, msgPort)
m.applicationInfoNode.unobserveFieldScoped("lib_version_latest")
@@ -0,0 +1,12 @@
namespace MessagePortUtils
function ObserveFieldScopedExSafe(node as dynamic, field as string, port as dynamic)
' ObserveFieldScopedEx was added in 12.0
if FindMemberFunction(node, "ObserveFieldScopedEx") <> invalid
node.ObserveFieldScopedEx(field, port)
else
node.ObserveFieldScoped(field, port)
end if
end function
end namespace