From a412682a4b62412551483edfe489a1f7313caac8 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Fri, 11 Aug 2017 01:49:48 -0400 Subject: [PATCH] A3XX: New system for notifying about aircraft updates --- AircraftConfig/acconfig.nas | 22 ++++++- AircraftConfig/update.xml | 115 ++++++++++++++++++++++++++++++++++++ revision.txt | 2 +- 3 files changed, 137 insertions(+), 2 deletions(-) create mode 100644 AircraftConfig/update.xml diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index fd28db65..52cb806c 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -79,6 +79,8 @@ failReset(); setprop("/systems/acconfig/autoconfig-running", 0); setprop("/systems/acconfig/spinning", 0); setprop("/systems/acconfig/spin", "-"); +setprop("/systems/acconfig/new-revision", ""); +setprop("/systems/acconfig/out-of-date", 0); var main_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/main/dialog", "Aircraft/A320Family/AircraftConfig/main.xml"); var welcome_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/welcome/dialog", "Aircraft/A320Family/AircraftConfig/welcome.xml"); var ps_load_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/psload/dialog", "Aircraft/A320Family/AircraftConfig/psload.xml"); @@ -88,12 +90,30 @@ var help_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/help/dialog", "Aircraft/ var fbw_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/fbw/dialog", "Aircraft/A320Family/AircraftConfig/fbw.xml"); var fail_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/fail/dialog", "Aircraft/A320Family/AircraftConfig/fail.xml"); var about_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/about/dialog", "Aircraft/A320Family/AircraftConfig/about.xml"); +var update_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/update/dialog", "Aircraft/A320Family/AircraftConfig/update.xml"); spinning.start(); init_dlg.open(); +http.load("https://raw.githubusercontent.com/it0uchpods/A320Family/master/revision.txt").done(func(r) setprop("/systems/acconfig/new-revision", r.response)); +var revisionFile = (getprop("/sim/aircraft-dir")~"/revision.txt"); +var current_revision = io.readfile(revisionFile); + +setlistener("/systems/acconfig/new-revision", func { + if (getprop("/systems/acconfig/new-revision") > current_revision) { + setprop("/systems/acconfig/out-of-date", 1); + } else { + setprop("/systems/acconfig/out-of-date", 0); + } +}); + setlistener("/sim/signals/fdm-initialized", func { init_dlg.close(); - welcome_dlg.open(); + if (getprop("/systems/acconfig/out-of-date") == 1) { + update_dlg.open(); + print("The A320Family is out of date!"); + } else { + welcome_dlg.open(); + } spinning.stop(); }); diff --git a/AircraftConfig/update.xml b/AircraftConfig/update.xml new file mode 100644 index 00000000..180304d1 --- /dev/null +++ b/AircraftConfig/update.xml @@ -0,0 +1,115 @@ + + + + + + + + + + aircraft-config-update + vbox + + 0.5 + 0 + 0 + 1 + + + + hbox + + left + + + + + + + + + vbox + + + center + + + + center + + + + center + + + + + + + + + hbox + + + + + + diff --git a/revision.txt b/revision.txt index 1eb0c5e1..2a915b96 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -1443 +1443 \ No newline at end of file