2022-08-09 07:17:54 +00:00
|
|
|
extends CanvasLayer
|
2022-07-31 05:27:58 +00:00
|
|
|
|
2023-05-14 08:36:23 +00:00
|
|
|
var csv_url : String = "https://raw.githubusercontent.com/hobbesjaap/wellbeingapp/main/version_info.csv"
|
|
|
|
var welcome_day_part : String = " "
|
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():
|
2023-05-14 08:36:23 +00:00
|
|
|
$version_label.text = "Version " + str(ProgramValues.current_version)
|
2022-08-28 06:03:39 +00:00
|
|
|
|
2023-05-14 08:36:23 +00:00
|
|
|
UserValues.get_device_time()
|
|
|
|
UserValues.set_welcome_day_part()
|
2022-08-28 06:03:39 +00:00
|
|
|
|
2023-05-14 08:36:23 +00:00
|
|
|
$welcome_title.text = UserValues.welcome_day_part + UserValues.user_first_name + "!"
|
2022-08-08 08:53:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_button_update_check_pressed():
|
2022-08-21 08:34:39 +00:00
|
|
|
$HTTPRequest.request(csv_url)
|
2022-08-08 08:53:39 +00:00
|
|
|
|
2022-08-16 09:42:32 +00:00
|
|
|
|
2022-08-16 09:30:28 +00:00
|
|
|
func update_user_name_label():
|
2023-05-14 08:36:23 +00:00
|
|
|
$welcome_title.text = "Good morning, " + UserValues.user_first_name + "!"
|
2022-08-16 09:30:28 +00:00
|
|
|
|
2022-08-08 08:53:39 +00:00
|
|
|
|
2022-08-16 07:37:53 +00:00
|
|
|
func _on_HTTPRequest_request_completed(_result, _response_code, _headers, body):
|
2023-03-07 12:26:52 +00:00
|
|
|
var test_json_conv = JSON.new()
|
|
|
|
test_json_conv.parse(body.get_string_from_utf8())
|
|
|
|
var json = test_json_conv.get_data()
|
2023-05-14 08:36:23 +00:00
|
|
|
ProgramValues.web_release_version = json.result
|
|
|
|
if ProgramValues.web_release_version > ProgramValues.release_version:
|
2022-08-08 08:55:30 +00:00
|
|
|
print("There's an update!")
|
2023-05-14 08:36:23 +00:00
|
|
|
elif ProgramValues.web_release_version == ProgramValues.release_version:
|
2022-08-09 07:17:54 +00:00
|
|
|
print("There is no update!")
|