From 4f675644eef01176a79a141eebbb94e93f0d20c7 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Mon, 6 Dec 2021 10:34:06 -0600 Subject: [PATCH] Enabled updater, TODO: make updater do less work than installer --- lib/application_manager.rb | 10 ++++++++++ lib/application_manager/tasks/updater.rb | 12 +----------- lib/pages/games.rb | 10 +--------- w3d_hub_linux_launcher.rb | 1 + 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/lib/application_manager.rb b/lib/application_manager.rb index 7a9cd70..7ed4928 100644 --- a/lib/application_manager.rb +++ b/lib/application_manager.rb @@ -26,6 +26,16 @@ class W3DHub @tasks.push(installer) end + def update(app_id, channel) + puts "Update Request: #{app_id}-#{channel}" + + return false unless installed?(app_id, channel) + + updater = Updater.new(app_id, channel) + + @tasks.push(updater) + end + def import(app_id, channel, path) puts "Import Request: #{app_id}-#{channel} -> #{path}" diff --git a/lib/application_manager/tasks/updater.rb b/lib/application_manager/tasks/updater.rb index 10a7ae7..30f9414 100644 --- a/lib/application_manager/tasks/updater.rb +++ b/lib/application_manager/tasks/updater.rb @@ -1,19 +1,9 @@ class W3DHub class ApplicationManager - class Updater < Task + class Updater < Installer def type :updater end - - def exec_task - # Fetch manifests - # Load manifests - # build file list - # find new packages - # unpack new packages - # TODO: detect patch files and handle them - # update installed game version - end end end end diff --git a/lib/pages/games.rb b/lib/pages/games.rb index 35ad516..ce116e7 100644 --- a/lib/pages/games.rb +++ b/lib/pages/games.rb @@ -79,14 +79,6 @@ class W3DHub stack(width: 0.25, height: 1.0, padding: 8) do # background 0xff_550055 - # TODO: Show links for managing game install - # game.menu_items.each do |item| - # flow(width: 1.0, height: 22, margin_bottom: 8) do - # image item.image, width: 0.11 - # link item.label, text_size: 18 - # end - # end - if Store.application_manager.installed?(game.id, channel.id) Hash.new.tap { |hash| hash[I18n.t(:"games.game_settings")] = { icon: "gear", block: proc { Store.application_manager.settings(game.id, channel.id) } } @@ -132,7 +124,7 @@ class W3DHub if Store.application_manager.installed?(game.id, channel.id) if Store.application_manager.updateable?(game.id, channel.id) button "#{I18n.t(:"interface.update_now")}", margin_left: 24, background: 0xff_ffac00 do - # Store.application_manager.update(game.id, channel.id) + Store.application_manager.update(game.id, channel.id) end else button "#{I18n.t(:"interface.play_now")}", margin_left: 24 do diff --git a/w3d_hub_linux_launcher.rb b/w3d_hub_linux_launcher.rb index 6af286a..25f6426 100644 --- a/w3d_hub_linux_launcher.rb +++ b/w3d_hub_linux_launcher.rb @@ -38,6 +38,7 @@ require_relative "lib/application_manager/manifest" require_relative "lib/application_manager/status" require_relative "lib/application_manager/task" require_relative "lib/application_manager/tasks/installer" +require_relative "lib/application_manager/tasks/updater" require_relative "lib/application_manager/tasks/uninstaller" require_relative "lib/application_manager/tasks/repairer" require_relative "lib/application_manager/tasks/importer"