From b9a82025e1625343f40a565e92897b559e8c20aa Mon Sep 17 00:00:00 2001 From: Jaap Marsman Date: Mon, 8 Aug 2022 16:53:39 +0800 Subject: [PATCH] trying out online update notifications --- PRIVACY.md | 2 +- godot/program_values.gd | 3 ++- godot/start_menu.gd | 16 ++++++++++++---- godot/start_screen.tscn | 11 +++++++++++ godot/test_download.gd | 16 ---------------- 5 files changed, 26 insertions(+), 22 deletions(-) delete mode 100644 godot/test_download.gd diff --git a/PRIVACY.md b/PRIVACY.md index 741cbdb..a93fe3c 100644 --- a/PRIVACY.md +++ b/PRIVACY.md @@ -2,6 +2,6 @@ - As can be seen by inspecting the source code, the app contains no tracking features or advertisement systems of ANY kind. I am not interested in your data. - Any data entered into the app (your name, birthdate, etc) is stored locally on your device. -- The only "phone home" function that the app will do (once programmed) is to check for app updates online. If you're not online, the check fails. Simple as that. +- The only internet connectivity that the app employs is to check for app updates online (by checking the file version_stuff.csv here on GitHub). If you're not online, the check fails, simple as that. The code for this function will only trigger if you press the "Check for Updates" button. It can be inspected in start_menu.gd Too often "free" apps make you their product. Or are free with a hefty subscription lurking around the corner. I get it, for some people, such apps are their livelihood. For me, it's something I wish to develop and hope other people find useful. There is no monetary gain here. Of course I'm curious to see who uses the app. That's why I offer the option to subscribe to a newsletter, which is different. It's opt-in privacy-by-design stuff. You don't want to sign up? Don't press the button. It's really that simple. :) \ No newline at end of file diff --git a/godot/program_values.gd b/godot/program_values.gd index d5fe24d..38796ab 100644 --- a/godot/program_values.gd +++ b/godot/program_values.gd @@ -8,10 +8,11 @@ extends Node # download button if there is. var release_version = 1 +var web_release_version = 0 func _ready(): pass - + # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta): # pass diff --git a/godot/start_menu.gd b/godot/start_menu.gd index ef11765..0fa78e1 100644 --- a/godot/start_menu.gd +++ b/godot/start_menu.gd @@ -4,11 +4,19 @@ extends Node2D onready var user_info = get_node("/root/UserValues") onready var program_info = get_node("/root/ProgramValues") -# Called when the node enters the scene tree for the first time. func _ready(): - pass + $HTTPRequest.connect("request_completed", self, "_on_request_completed") + -# Called every frame. 'delta' is the elapsed time since the previous frame. func _process(_delta): $welcome_title.text = "Good morning " + user_info.user_first_name + "!" -# pass + + +func _on_button_update_check_pressed(): + $HTTPRequest.request("https://raw.githubusercontent.com/hobbesjaap/wellbeingapp/main/version_stuff.csv") + + +#func _on_HTTPRequest_request_completed(result, response_code, headers, body): +func _on_request_completed(result, response_code, headers, body): + var json = JSON.parse(body.get_string_from_utf8()) + program_info.web_release_version = json.result diff --git a/godot/start_screen.tscn b/godot/start_screen.tscn index 844f70b..19ef95e 100644 --- a/godot/start_screen.tscn +++ b/godot/start_screen.tscn @@ -56,6 +56,15 @@ margin_bottom = 56.0 text = "Name" script = ExtResource( 5 ) +[node name="HTTPRequest" type="HTTPRequest" parent="start_menu"] + +[node name="button_update_check" type="Button" parent="start_menu"] +margin_left = 658.0 +margin_top = 354.0 +margin_right = 880.0 +margin_bottom = 391.0 +text = "Check for Updates" + [node name="user_details" type="Node2D" parent="."] visible = false @@ -84,4 +93,6 @@ text = "Day" [connection signal="pressed" from="start_menu/button_open_github" to="start_menu/button_open_github" method="_on_button_open_github_pressed"] [connection signal="pressed" from="start_menu/button_email_feedback" to="start_menu/button_email_feedback" method="_on_button_email_feedback_pressed"] [connection signal="pressed" from="start_menu/button_name" to="start_menu/button_name" method="_on_button_name_pressed"] +[connection signal="request_completed" from="start_menu/HTTPRequest" to="start_menu" method="_on_HTTPRequest_request_completed"] +[connection signal="pressed" from="start_menu/button_update_check" to="start_menu" method="_on_button_update_check_pressed"] [connection signal="pressed" from="user_details/button_user_save" to="user_details/button_user_save" method="_on_button_user_save_pressed"] diff --git a/godot/test_download.gd b/godot/test_download.gd deleted file mode 100644 index 0f46b31..0000000 --- a/godot/test_download.gd +++ /dev/null @@ -1,16 +0,0 @@ -extends CanvasLayer - - -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" - - -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass