Enabled updater, TODO: make updater do less work than installer

This commit is contained in:
2021-12-06 10:34:06 -06:00
parent a6c194b762
commit 4f675644ee
4 changed files with 13 additions and 20 deletions

View File

@@ -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}"

View File

@@ -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

View File

@@ -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 "<b>#{I18n.t(:"interface.update_now")}</b>", 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 "<b>#{I18n.t(:"interface.play_now")}</b>", margin_left: 24 do

View File

@@ -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"