Updates are now checked

This commit is contained in:
2021-12-06 09:55:53 -06:00
parent 451f92b9d6
commit a7a5b98955
4 changed files with 31 additions and 4 deletions

View File

@@ -255,6 +255,25 @@ class W3DHub
@tasks.find { |t| t.is_a?(Installer) && t.app_id == app_id && t.release_channel == channel } @tasks.find { |t| t.is_a?(Installer) && t.app_id == app_id && t.release_channel == channel }
end end
def updateable?(app_id, channel)
installed_app = installed?(app_id, channel)
return false unless installed_app
listed_app = Store.applications.games.find { |g| g.id == app_id }
return false unless listed_app
listed_app_channel = listed_app&.channels&.find { |c| c.id == channel }
return false unless listed_app_channel
current_version = Gem::Version.new(installed_app[:installed_version])
listed_version = Gem::Version.new(listed_app_channel.current_version)
listed_version > current_version
end
# No application tasks are being done # No application tasks are being done
def idle? def idle?
!busy? !busy?

View File

@@ -128,9 +128,15 @@ class W3DHub
# background 0xff_551100 # background 0xff_551100
if Store.application_manager.installed?(game.id, channel.id) if Store.application_manager.installed?(game.id, channel.id)
if Store.application_manager.updateable?(game.id, channel.id)
button "<b>#{I18n.t(:"interface.update_now")}</b>", margin_left: 24, background: 0xff_ffac00 do
# Store.application_manager.update(game.id, channel.id)
end
else
button "<b>#{I18n.t(:"interface.play_now")}</b>", margin_left: 24 do button "<b>#{I18n.t(:"interface.play_now")}</b>", margin_left: 24 do
Store.application_manager.play_now(game.id, channel.id) Store.application_manager.play_now(game.id, channel.id)
end end
end
button "<b>#{I18n.t(:"interface.single_player")}</b>", margin_left: 24 do button "<b>#{I18n.t(:"interface.single_player")}</b>", margin_left: 24 do
Store.application_manager.run(game.id, channel.id) Store.application_manager.run(game.id, channel.id)

View File

@@ -204,8 +204,9 @@ class W3DHub
stack(width: 1.0, height: 0.25) do stack(width: 1.0, height: 0.25) do
game_installed = Store.application_manager.installed?(server.game, Store.applications.games.find { |g| g.id == server.game }.channels.first.id) game_installed = Store.application_manager.installed?(server.game, Store.applications.games.find { |g| g.id == server.game }.channels.first.id)
game_updated = Store.application_manager.updateable?(server.game, Store.applications.games.find { |g| g.id == server.game }.channels.first.id)
button "<b>#{I18n.t(:"server_browser.join_server")}</b>", enabled: !game_installed.nil? do button "<b>#{I18n.t(:"server_browser.join_server")}</b>", enabled: (game_installed && !game_updated) do
# Check for nickname # Check for nickname
# prompt for nickname # prompt for nickname
# !abort unless nickname set # !abort unless nickname set

View File

@@ -15,6 +15,7 @@ en:
community: Community community: Community
download_manager: Download Manager download_manager: Download Manager
play_now: Play Now play_now: Play Now
update_now: Update Now
single_player: Single Player single_player: Single Player
import: Import import: Import
install: Install install: Install