Window is no longer a fiber, should prevent window from locking up due to a fiber not yielding, replaced ui's direct async calls with BackgroundWorker.foreground_job, show pulsing circle behind app logo on boot

This commit is contained in:
2022-02-12 08:47:48 -06:00
parent 202966fd08
commit 232ed2032f
11 changed files with 236 additions and 153 deletions

View File

@@ -60,25 +60,20 @@ class W3DHub
para I18n.t(:"games.fetching_news"), padding: 8
end
Async do
internet = Async::HTTP::Internet.instance
fetch_w3dhub_news
populate_w3dhub_news
end
BackgroundWorker.foreground_job(-> { fetch_w3dhub_news }, ->(result) { populate_w3dhub_news })
end
end
def fetch_w3dhub_news
news = Api.news("launcher-home")
if news
news.items[0..9].each do |item|
Cache.fetch(item.image)
end
return unless news
@w3dhub_news = news
news.items[0..9].each do |item|
Cache.fetch(item.image)
end
@w3dhub_news = news
end
def populate_w3dhub_news