Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: require to accept terms and privacy policy to deploy a new profile #278

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 52 additions & 1 deletion godot/assets/themes/theme.tres
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_resource type="Theme" load_steps=83 format=3 uid="uid://bm1rvmngc833v"]
[gd_resource type="Theme" load_steps=85 format=3 uid="uid://bm1rvmngc833v"]

[ext_resource type="FontFile" uid="uid://hqi2efd5kd17" path="res://assets/themes/fonts/inter/Inter-Bold.ttf" id="2_l2aal"]
[ext_resource type="StyleBox" uid="uid://corto87blbgdd" path="res://assets/themes/panel.tres" id="3_8ip38"]
Expand Down Expand Up @@ -273,6 +273,33 @@ shadow_color = Color(0, 0, 0, 0.356863)
shadow_size = 2
shadow_offset = Vector2(2, 2)

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_c854h"]
content_margin_left = 4.0
content_margin_top = 4.0
content_margin_right = 4.0
content_margin_bottom = 4.0
bg_color = Color(1, 1, 1, 0.75)
draw_center = false
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3
corner_detail = 5
expand_margin_left = 2.0
expand_margin_top = 2.0
expand_margin_right = 2.0
expand_margin_bottom = 2.0

[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_275fk"]
content_margin_left = 0.0
content_margin_top = 0.0
content_margin_right = 0.0
content_margin_bottom = 0.0

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mcvo5"]
bg_color = Color(0.960784, 0.152941, 0.345098, 1)

Expand Down Expand Up @@ -566,6 +593,30 @@ ProgressBar/colors/font_outline_color = Color(1, 0.180392, 0.333333, 1)
ProgressBar/constants/outline_size = 4
ProgressBar/styles/background = ExtResource("17_8xvh3")
ProgressBar/styles/fill = ExtResource("18_tlppg")
RichTextLabel/colors/default_color = Color(1, 1, 1, 1)
RichTextLabel/colors/font_outline_color = Color(1, 1, 1, 1)
RichTextLabel/colors/font_selected_color = Color(0, 0, 0, 0)
RichTextLabel/colors/font_shadow_color = Color(0, 0, 0, 0)
RichTextLabel/colors/selection_color = Color(0.1, 0.1, 1, 0.8)
RichTextLabel/colors/table_border = Color(0, 0, 0, 0)
RichTextLabel/colors/table_even_row_bg = Color(0, 0, 0, 0)
RichTextLabel/colors/table_odd_row_bg = Color(0, 0, 0, 0)
RichTextLabel/constants/line_separation = 0
RichTextLabel/constants/outline_size = 0
RichTextLabel/constants/shadow_offset_x = 1
RichTextLabel/constants/shadow_offset_y = 1
RichTextLabel/constants/shadow_outline_size = 1
RichTextLabel/constants/table_h_separation = 3
RichTextLabel/constants/table_v_separation = 3
RichTextLabel/constants/text_highlight_h_padding = 3
RichTextLabel/constants/text_highlight_v_padding = 3
RichTextLabel/fonts/bold_font = ExtResource("2_l2aal")
RichTextLabel/fonts/bold_italics_font = ExtResource("2_l2aal")
RichTextLabel/fonts/italics_font = ExtResource("15_d4gyn")
RichTextLabel/fonts/mono_font = ExtResource("15_d4gyn")
RichTextLabel/fonts/normal_font = ExtResource("15_d4gyn")
RichTextLabel/styles/focus = SubResource("StyleBoxFlat_c854h")
RichTextLabel/styles/normal = SubResource("StyleBoxEmpty_275fk")
TabBar/styles/button_highlight = SubResource("StyleBoxFlat_mcvo5")
TabBar/styles/button_pressed = SubResource("StyleBoxFlat_jxfws")
TabBar/styles/tab_selected = SubResource("StyleBoxFlat_cdpqd")
Expand Down
45 changes: 42 additions & 3 deletions godot/src/ui/components/auth/lobby.gd
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ var loading_first_profile: bool = false
@onready var restore_panel = %VBoxContainer_RestorePanel
@onready var restore_loading = %TextureProgressBar_RestoreLoading

@onready var checkbox_terms_and_privacy = %CheckBox_TermsAndPrivacy
@onready var button_next = %Button_Next

# TODO: Change screen orientation for Mobile
#func set_portrait():
##DisplayServer.screen_set_orientation(DisplayServer.SCREEN_PORTRAIT)
Expand Down Expand Up @@ -136,8 +139,8 @@ func _on_button_start_pressed():

# gdlint:ignore = async-function-name
func _on_button_next_pressed():
if lineedit_choose_name.text.is_empty():
return # TODO: Add error message
if lineedit_choose_name.text.is_empty() or checkbox_terms_and_privacy.button_pressed == false:
return

current_profile.set_name(lineedit_choose_name.text)
current_profile.set_has_connected_web3(!Global.player_identity.is_guest)
Expand All @@ -152,7 +155,8 @@ func _on_button_next_pressed():


func _on_button_random_name_pressed():
lineedit_choose_name.text = RandomGeneratorUtil.generate_unique_name()
lineedit_choose_name.set_text(RandomGeneratorUtil.generate_unique_name())
_check_button_finish()


func _on_button_open_browser_pressed():
Expand Down Expand Up @@ -201,3 +205,38 @@ func _async_show_avatar_preview():

func _on_button_jump_in_pressed():
close_sign_in()


func toggle_terms_and_privacy_checkbox():
checkbox_terms_and_privacy.set_pressed(not checkbox_terms_and_privacy.button_pressed)


func _on_rich_text_label_gui_input(event):
if event is InputEventScreenTouch:
if !event.pressed:
toggle_terms_and_privacy_checkbox()


func _on_rich_text_label_meta_clicked(meta):
Global.open_url(meta)
# we're going to toggle in the rich text box gui input
# so here we toggle it again compensate, to let as it is
# not the best solution.
toggle_terms_and_privacy_checkbox()


func _on_check_box_terms_and_privacy_toggled(_toggled_on):
_check_button_finish()


func _on_line_edit_choose_name_text_changed(_new_text):
_check_button_finish()


func _check_button_finish():
var disabled = (
lineedit_choose_name.text.is_empty() or not checkbox_terms_and_privacy.button_pressed
)
if button_next.disabled != disabled:
avatar_preview.avatar.emote_controller.play_emote("shrug" if disabled else "clap")
button_next.disabled = disabled
29 changes: 28 additions & 1 deletion godot/src/ui/components/auth/lobby.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ text = "I ALREADY HAVE AN ACCOUNT"

[node name="Restore" type="Control" parent="Main"]
unique_name_in_owner = true
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
Expand Down Expand Up @@ -453,7 +454,6 @@ icon = ExtResource("13_43yag")

[node name="ChooseName" type="Control" parent="Main"]
unique_name_in_owner = true
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
Expand Down Expand Up @@ -552,13 +552,36 @@ layout_mode = 2
theme_override_constants/separation = 12
theme_override_styles/separator = SubResource("StyleBoxEmpty_8mib7")

[node name="HBoxContainer_Terms" type="HBoxContainer" parent="Main/ChooseName/VBoxContainer"]
layout_mode = 2

[node name="CheckBox_TermsAndPrivacy" type="CheckBox" parent="Main/ChooseName/VBoxContainer/HBoxContainer_Terms"]
unique_name_in_owner = true
layout_mode = 2

[node name="RichTextLabel" type="RichTextLabel" parent="Main/ChooseName/VBoxContainer/HBoxContainer_Terms"]
clip_contents = false
layout_mode = 2
size_flags_horizontal = 3
bbcode_enabled = true
text = "I agree with Decentraland [b][url=\"https://decentraland.org/terms/\"]Terms of Service[/url][/b] and [b][url=\"https://decentraland.org/privacy/\"]Privacy Policy[/url][/b]"
fit_content = true
scroll_active = false

[node name="HSeparator5" type="HSeparator" parent="Main/ChooseName/VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 12
theme_override_styles/separator = SubResource("StyleBoxEmpty_8mib7")

[node name="Button_Next" type="Button" parent="Main/ChooseName/VBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(250, 0)
layout_mode = 2
focus_mode = 0
theme_override_constants/icon_max_width = 24
theme_override_fonts/font = ExtResource("4_ghcwt")
theme_override_font_sizes/font_size = 24
disabled = true
text = "NEXT"
icon_alignment = 2

Expand Down Expand Up @@ -649,6 +672,10 @@ text = "Message"
[connection signal="pressed" from="Main/SignIn/VBoxContainer/VBoxContainer_SignInStep1/Button_OpenBrowser" to="." method="_on_button_open_browser_pressed"]
[connection signal="pressed" from="Main/SignIn/VBoxContainer/VBoxContainer_SignInStep1/Button_EnterAsGuest" to="." method="_on_button_enter_as_guest_pressed"]
[connection signal="pressed" from="Main/SignIn/VBoxContainer/VBoxContainer_SignInStep2/Button_Cancel" to="." method="_on_button_cancel_pressed"]
[connection signal="text_changed" from="Main/ChooseName/VBoxContainer/HBoxContainer/LineEdit_ChooseName" to="." method="_on_line_edit_choose_name_text_changed"]
[connection signal="pressed" from="Main/ChooseName/VBoxContainer/HBoxContainer/Button_RandomName" to="." method="_on_button_random_name_pressed"]
[connection signal="toggled" from="Main/ChooseName/VBoxContainer/HBoxContainer_Terms/CheckBox_TermsAndPrivacy" to="." method="_on_check_box_terms_and_privacy_toggled"]
[connection signal="gui_input" from="Main/ChooseName/VBoxContainer/HBoxContainer_Terms/RichTextLabel" to="." method="_on_rich_text_label_gui_input"]
[connection signal="meta_clicked" from="Main/ChooseName/VBoxContainer/HBoxContainer_Terms/RichTextLabel" to="." method="_on_rich_text_label_meta_clicked"]
[connection signal="pressed" from="Main/ChooseName/VBoxContainer/Button_Next" to="." method="_on_button_next_pressed"]
[connection signal="gui_input" from="AvatarPreview" to="." method="_on_avatar_preview_gui_input"]
1 change: 1 addition & 0 deletions godot/src/ui/components/backpack/backpack.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ autowrap_mode = 0

[node name="EmoteEditor" parent="VBoxContainer/HBoxContainer_Backpack/MarginContainer" instance=ExtResource("30_vfwc7")]
unique_name_in_owner = true
visible = false
layout_mode = 2

[node name="Color_Picker_Panel" parent="." instance=ExtResource("10_8s7x3")]
Expand Down
Loading