Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
1hitsong committed Nov 8, 2024
1 parent bfa5162 commit 9758167
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions source/Main.bs
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ sub Main (args as dynamic) as void
' Downloads and stores a fallback font to tmp:/
configEncoding = api.system.GetConfigurationByName("encoding")

if isValid(configEncoding) and isValid(configEncoding.EnableFallbackFont)
if isChainValid(configEncoding, "EnableFallbackFont")
if configEncoding.EnableFallbackFont
re = CreateObject("roRegex", "Name.:.(.*?).,.Size", "s")
filename = APIRequest("FallbackFont/Fonts").GetToString()
if isValid(filename)
filename = re.match(filename)
if isValid(filename) and filename.count() > 0
if isValidAndNotEmpty(filename)
filename = filename[1]
APIRequest("FallbackFont/Fonts/" + filename).gettofile("tmp:/font")
end if
Expand All @@ -89,8 +89,8 @@ sub Main (args as dynamic) as void

' Delete any old library filters
for each settingKeys in m.global.session.user.settings.keys()
if left(settingKeys, 8) = "display."
if right(settingKeys, 7) = ".filter" or right(settingKeys, 14) = ".filterOptions"
if isStringEqual(left(settingKeys, 8), "display.")
if isStringEqual(right(settingKeys, 7), ".filter") or isStringEqual(right(settingKeys, 14), ".filterOptions")
m.global.session.user.settings.delete(settingKeys)
unset_user_setting(settingKeys)
end if
Expand Down Expand Up @@ -136,10 +136,6 @@ sub Main (args as dynamic) as void
' Check if we were sent content to play with the startup command (Deep Link)
handleDeepLinking(args)

' This is the core logic loop. Mostly for transitioning between scenes
' This now only references m. fields so could be placed anywhere, in theory
' "group" is always "whats on the screen"
' m.scene's children is the "previous view" stack
while true
msg = wait(0, m.port)

Expand Down

0 comments on commit 9758167

Please sign in to comment.