2022-08-09 07:17:54 +00:00
|
|
|
extends CanvasLayer
|
2022-07-31 05:27:58 +00:00
|
|
|
|
|
|
|
|
2022-08-03 01:01:10 +00:00
|
|
|
onready var user_info = get_node("/root/UserValues")
|
2022-08-07 01:08:10 +00:00
|
|
|
onready var program_info = get_node("/root/ProgramValues")
|
2022-07-31 05:27:58 +00:00
|
|
|
|
2022-08-09 07:17:54 +00:00
|
|
|
|
2022-07-31 05:27:58 +00:00
|
|
|
func _ready():
|
2022-08-08 08:53:39 +00:00
|
|
|
$HTTPRequest.connect("request_completed", self, "_on_request_completed")
|
2022-08-09 07:17:54 +00:00
|
|
|
$version_label.text = str(program_info.current_version)
|
2022-08-08 08:53:39 +00:00
|
|
|
|
2022-07-31 05:27:58 +00:00
|
|
|
|
2022-08-08 06:42:26 +00:00
|
|
|
func _process(_delta):
|
|
|
|
$welcome_title.text = "Good morning " + user_info.user_first_name + "!"
|
2022-08-08 08:53:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_button_update_check_pressed():
|
2022-08-08 09:16:19 +00:00
|
|
|
$HTTPRequest.request("https://raw.githubusercontent.com/hobbesjaap/wellbeingapp/main/version_info.csv")
|
2022-08-08 08:53:39 +00:00
|
|
|
|
|
|
|
|
2022-08-08 08:55:30 +00:00
|
|
|
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
|
2022-08-08 08:53:39 +00:00
|
|
|
var json = JSON.parse(body.get_string_from_utf8())
|
|
|
|
program_info.web_release_version = json.result
|
2022-08-08 08:55:30 +00:00
|
|
|
if program_info.web_release_version > program_info.release_version:
|
|
|
|
print("There's an update!")
|
2022-08-09 07:17:54 +00:00
|
|
|
elif program_info.web_release_version == program_info.release_version:
|
|
|
|
print("There is no update!")
|