feat(mvp): complete M13 clean-up milestone (real usernames, avatar studio redesign, pause menu, audio manager)
checkpoint / checkpoint (push) Successful in 6m22s
checkpoint / checkpoint (push) Successful in 6m22s
This commit is contained in:
@@ -41,6 +41,12 @@ var _friend_presence_map: Dictionary = {} # user_id (int) -> {"status": String,
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if send_req_input:
|
||||
send_req_input.placeholder_text = "Enter username or ID..."
|
||||
if follow_input:
|
||||
follow_input.placeholder_text = "Enter username or ID..."
|
||||
if block_input:
|
||||
block_input.placeholder_text = "Enter username or ID..."
|
||||
_api_client = _get_api()
|
||||
_wire_signals()
|
||||
if _api_client != null and _api_client.has_token():
|
||||
@@ -78,6 +84,12 @@ func _on_back_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://scenes/main_menu.tscn")
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_cancel"):
|
||||
get_viewport().set_input_as_handled()
|
||||
_on_back_pressed()
|
||||
|
||||
|
||||
func show_message(text: String, is_error: bool = false) -> void:
|
||||
if status_label:
|
||||
status_label.text = text
|
||||
@@ -254,7 +266,10 @@ func refresh_requests() -> void:
|
||||
hbox.add_theme_constant_override("separation", 12)
|
||||
|
||||
var lbl := Label.new()
|
||||
lbl.text = "Request from User #%d (%s)" % [from_id, created_at]
|
||||
var sender_name: String = str(req.get("requester_username", ""))
|
||||
if sender_name.is_empty():
|
||||
sender_name = "User #%d" % from_id
|
||||
lbl.text = "Request from %s (%s)" % [sender_name, created_at]
|
||||
lbl.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
hbox.add_child(lbl)
|
||||
|
||||
@@ -292,13 +307,12 @@ func _on_decline_request(req_id: int) -> void:
|
||||
|
||||
func _on_send_req_pressed() -> void:
|
||||
var target_text := send_req_input.text.strip_edges()
|
||||
if not target_text.is_valid_int():
|
||||
show_message("Enter a valid integer user ID.", true)
|
||||
if target_text.is_empty():
|
||||
show_message("Enter a username or user ID.", true)
|
||||
return
|
||||
var target_id := int(target_text)
|
||||
var res: Dictionary = await _api_client.send_friend_request(target_id)
|
||||
var res: Dictionary = await _api_client.send_friend_request(target_text)
|
||||
if res.ok:
|
||||
show_message("Friend request sent to User #%d!" % target_id)
|
||||
show_message("Friend request sent to %s!" % target_text)
|
||||
send_req_input.text = ""
|
||||
else:
|
||||
show_message("Failed to send request: " + res.detail, true)
|
||||
@@ -357,13 +371,12 @@ func _on_unfollow(uid: int) -> void:
|
||||
|
||||
func _on_follow_pressed() -> void:
|
||||
var target_text := follow_input.text.strip_edges()
|
||||
if not target_text.is_valid_int():
|
||||
show_message("Enter a valid integer user ID.", true)
|
||||
if target_text.is_empty():
|
||||
show_message("Enter a username or user ID.", true)
|
||||
return
|
||||
var target_id := int(target_text)
|
||||
var res: Dictionary = await _api_client.follow_user(target_id)
|
||||
var res: Dictionary = await _api_client.follow_user(target_text)
|
||||
if res.ok:
|
||||
show_message("Following User #%d." % target_id)
|
||||
show_message("Following %s." % target_text)
|
||||
follow_input.text = ""
|
||||
refresh_following()
|
||||
else:
|
||||
@@ -423,13 +436,12 @@ func _on_unblock(uid: int) -> void:
|
||||
|
||||
func _on_block_pressed() -> void:
|
||||
var target_text := block_input.text.strip_edges()
|
||||
if not target_text.is_valid_int():
|
||||
show_message("Enter a valid integer user ID.", true)
|
||||
if target_text.is_empty():
|
||||
show_message("Enter a username or user ID.", true)
|
||||
return
|
||||
var target_id := int(target_text)
|
||||
var res: Dictionary = await _api_client.block_user(target_id)
|
||||
var res: Dictionary = await _api_client.block_user(target_text)
|
||||
if res.ok:
|
||||
show_message("Blocked User #%d." % target_id)
|
||||
show_message("Blocked %s." % target_text)
|
||||
block_input.text = ""
|
||||
refresh_blocked()
|
||||
refresh_friends()
|
||||
|
||||
Reference in New Issue
Block a user