Skip to content

Commit

Permalink
Small refactor last exit info
Browse files Browse the repository at this point in the history
  • Loading branch information
iBicha committed May 7, 2024
1 parent 18445fd commit b254a1f
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions playlet-lib/src/components/Logger/Logger.bs
Original file line number Diff line number Diff line change
Expand Up @@ -131,25 +131,16 @@ end function

function GetLastExitInfo() as dynamic
' roAppManager.GetLastExitInfo() is only available on Roku OS 13 and above
if not IsOs13OrHigher()
appManager = CreateObject("roAppManager")
hasMethod = FindMemberFunction(appManager, "GetLastExitInfo") <> invalid
if not hasMethod
return invalid
end if

appManager = CreateObject("roAppManager")
lastExitInfo = appManager.GetLastExitInfo()
if lastExitInfo = invalid
return invalid
end if

return ToString(lastExitInfo)
end function

function IsOs13OrHigher() as boolean
deviceInfo = CreateObject("roDeviceInfo")
osVersion = deviceInfo.GetOSVersion()
if osVersion = invalid or StringUtils.IsNullOrEmpty(osVersion.major)
return false
end if

return ValidInt(osVersion.major.ToInt()) >= 13
end function

0 comments on commit b254a1f

Please sign in to comment.