open link events

This commit is contained in:
Nordup 2025-08-19 02:38:20 +07:00
parent 1b80249b2b
commit fb4b6e8d45
4 changed files with 33 additions and 5 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=21 format=3 uid="uid://ct8gsph3wnepl"]
[gd_scene load_steps=23 format=3 uid="uid://ct8gsph3wnepl"]
[ext_resource type="Script" path="res://scripts/app.gd" id="1_skc7d"]
[ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_cdryv"]
@ -20,6 +20,8 @@
[ext_resource type="Script" path="res://scripts/api/featured_gates.gd" id="15_c1fxl"]
[ext_resource type="Resource" uid="uid://crjhix0osmtnf" path="res://resources/ui_events.res" id="16_6u24i"]
[ext_resource type="Script" path="res://scripts/api/analytics/analytics_sender_afk.gd" id="17_xfh2c"]
[ext_resource type="Script" path="res://scripts/api/analytics/analytics_sender_link.gd" id="18_wxdd5"]
[ext_resource type="Resource" uid="uid://bfg1kjboaitqt" path="res://resources/app_events.res" id="19_f1a0a"]
[node name="App" type="Node" node_paths=PackedStringArray("scenes_root")]
script = ExtResource("1_skc7d")
@ -67,6 +69,10 @@ ui_events = ExtResource("16_6u24i")
[node name="SenderAfk" type="Node" parent="Api/Analytics"]
script = ExtResource("17_xfh2c")
[node name="SenderLink" type="Node" parent="Api/Analytics"]
script = ExtResource("18_wxdd5")
app_events = ExtResource("19_f1a0a")
[node name="DiscoverGate" type="Node" parent="Api"]
script = ExtResource("13_3xhql")
api = ExtResource("10_04o5h")

View file

@ -112,3 +112,11 @@ func leave_afk(time_spent: float) -> Dictionary:
var event = base("leave_afk")
event.time_spent = time_spent
return event
# LINK
func open_link(url: String) -> Dictionary:
var event = base("open_link")
event.url = url
return event

View file

@ -0,0 +1,14 @@
extends AnalyticsSender
class_name AnalyticsSenderLink
@export var app_events: AppEvents
func start() -> void:
super.start()
app_events.open_link.connect(send_open_link)
func send_open_link(url: String) -> void:
analytics.send_event(AnalyticsEvents.open_link(url))

View file

@ -1,9 +1,9 @@
extends Resource
class_name AppEvents
signal open_link(uri: String)
signal open_link(url: String)
func open_link_emit(uri: String) -> void:
OS.shell_open(uri) # TODO: move somewhere else
open_link.emit(uri)
func open_link_emit(url: String) -> void:
OS.shell_open(url) # TODO: move somewhere else
open_link.emit(url)