Skip to content

Commit 2be6f93

Browse files
authored
Prioritize updates in the same branch, warn when updating from 1.X to 2.0 (#294)
* Update the update button to prefer 1.X updates * Hide warning by default * removed uid * Remove an other sneacky uid and reset text
1 parent d30e68c commit 2be6f93

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

addons/gaea/editor/download_update_panel.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const TEMP_FILE_PATH = "user://temp.zip"
1010
@onready var label: Label = $MarginContainer/VBoxContainer/Label
1111
@onready var download_button: Button = %DownloadButton
1212
@onready var release_notes_button: LinkButton = %ReleaseNotesButton
13+
@onready var migration_warning: Label = %MigrationWarning
1314

1415
var next_version_release: Dictionary:
1516
set(value):

addons/gaea/editor/download_update_panel.tscn

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ anchor_right = 1.0
2121
anchor_bottom = 1.0
2222
grow_horizontal = 2
2323
grow_vertical = 2
24+
theme_override_constants/margin_left = 12
2425
theme_override_constants/margin_top = 12
26+
theme_override_constants/margin_right = 12
27+
theme_override_constants/margin_bottom = 12
2528

2629
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
2730
layout_mode = 2
@@ -39,6 +42,16 @@ text = "v1.0.0 is available for download"
3942
horizontal_alignment = 1
4043
vertical_alignment = 1
4144

45+
[node name="CenterContainer3" type="CenterContainer" parent="MarginContainer/VBoxContainer"]
46+
layout_mode = 2
47+
48+
[node name="MigrationWarning" type="Label" parent="MarginContainer/VBoxContainer/CenterContainer3"]
49+
unique_name_in_owner = true
50+
visible = false
51+
modulate = Color(0.952941, 0.611765, 0.0705882, 1)
52+
layout_mode = 2
53+
text = "Warning: Upgrading from 1.X to 2.X will break your projects!"
54+
4255
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/VBoxContainer"]
4356
layout_mode = 2
4457

addons/gaea/editor/update_button.gd

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ extends Button
44
## at https://github.com/nathanhoad/godot_dialogue_manager
55

66

7-
const RELEASES_URL := "https://api.github.com/repos/BenjaTK/Gaea/releases"
7+
const RELEASES_URL := "https://api.github.com/repos/gaea-godot/gaea/releases"
88
const LOCAL_CONFIG_PATH := "res://addons/gaea/plugin.cfg"
99

1010

@@ -42,8 +42,19 @@ func _on_http_request_request_completed(result: int, response_code: int, headers
4242
# GitHub releases are in order of creation, not order of version
4343
var versions = (response as Array).filter(func(release):
4444
var version: String = release.tag_name.substr(1)
45+
if version.left(3) != "v1.":
46+
return false
4547
return _version_to_number(version) > _version_to_number(current_version)
4648
)
49+
if versions.size() == 0:
50+
versions = (response as Array).filter(func(release):
51+
var version: String = release.tag_name.substr(1)
52+
return _version_to_number(version) > _version_to_number(current_version)
53+
)
54+
if versions.size() > 0:
55+
download_update_panel.migration_warning.show()
56+
57+
4758
if versions.size() > 0:
4859
download_update_panel.next_version_release = versions[0]
4960
text = "Gaea v%s available" % versions[0].tag_name.substr(1)
@@ -80,5 +91,3 @@ func _get_version() -> String:
8091
func _version_to_number(version: String) -> int:
8192
var bits = version.split(".")
8293
return bits[0].to_int() * 1000000 + bits[1].to_int() * 1000 + bits[2].to_int()
83-
84-

addons/gaea/editor/update_button.tscn

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ script = ExtResource("1_8ury3")
1313

1414
[node name="DownloadDialog" type="AcceptDialog" parent="."]
1515
title = "Update available!"
16-
size = Vector2i(400, 320)
16+
size = Vector2i(500, 400)
1717
unresizable = true
1818
min_size = Vector2i(300, 310)
1919
ok_button_text = "Close"
2020

2121
[node name="DownloadUpdatePanel" parent="DownloadDialog" instance=ExtResource("2_bw0il")]
22+
offset_left = 8.0
23+
offset_top = 8.0
24+
offset_right = -8.0
25+
offset_bottom = -49.0
2226

2327
[node name="UpdateFailedDialog" type="AcceptDialog" parent="."]
2428
size = Vector2i(381, 100)

0 commit comments

Comments
 (0)