mirror of
https://github.com/cyberarm/w3d_hub_linux_launcher.git
synced 2025-12-16 01:02:34 +00:00
Updates are now checked
This commit is contained in:
@@ -88,7 +88,7 @@ class W3DHub
|
||||
|
||||
return false if !installed?(app_id, channel) || installing?(app_id, channel)
|
||||
|
||||
return false unless (game = Store.applications.games.find { |g| g.id == app_id})
|
||||
return false unless (game = Store.applications.games.find { |g| g.id == app_id })
|
||||
|
||||
push_state(
|
||||
States::ConfirmDialog,
|
||||
@@ -255,6 +255,25 @@ class W3DHub
|
||||
@tasks.find { |t| t.is_a?(Installer) && t.app_id == app_id && t.release_channel == channel }
|
||||
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
|
||||
def idle?
|
||||
!busy?
|
||||
|
||||
@@ -128,9 +128,15 @@ class W3DHub
|
||||
# background 0xff_551100
|
||||
|
||||
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
|
||||
Store.application_manager.play_now(game.id, channel.id)
|
||||
end
|
||||
end
|
||||
|
||||
button "<b>#{I18n.t(:"interface.single_player")}</b>", margin_left: 24 do
|
||||
Store.application_manager.run(game.id, channel.id)
|
||||
|
||||
@@ -204,8 +204,9 @@ class W3DHub
|
||||
|
||||
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_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
|
||||
# prompt for nickname
|
||||
# !abort unless nickname set
|
||||
|
||||
@@ -15,6 +15,7 @@ en:
|
||||
community: Community
|
||||
download_manager: Download Manager
|
||||
play_now: Play Now
|
||||
update_now: Update Now
|
||||
single_player: Single Player
|
||||
import: Import
|
||||
install: Install
|
||||
|
||||
Reference in New Issue
Block a user