mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-23 17:17:31 -04:00
analytics bookmark
This commit is contained in:
parent
b09ebf0f10
commit
2bd2a4ebe9
4 changed files with 46 additions and 21 deletions
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=16 format=3 uid="uid://ct8gsph3wnepl"]
|
||||
[gd_scene load_steps=17 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"]
|
||||
|
@ -14,6 +14,7 @@
|
|||
[ext_resource type="Script" path="res://scripts/api/analytics/analytics_sender_app.gd" id="11_cwwqp"]
|
||||
[ext_resource type="Script" path="res://scripts/api/analytics/analytics_sender_error.gd" id="12_rfjm7"]
|
||||
[ext_resource type="Script" path="res://scripts/api/discover_gate.gd" id="13_3xhql"]
|
||||
[ext_resource type="Script" path="res://scripts/api/analytics/analytics_sender_bookmark.gd" id="13_74yg1"]
|
||||
[ext_resource type="Script" path="res://scripts/api/analytics/analytics_sender_gate.gd" id="13_jout6"]
|
||||
|
||||
[node name="App" type="Node" node_paths=PackedStringArray("scenes_root")]
|
||||
|
@ -46,6 +47,10 @@ script = ExtResource("12_rfjm7")
|
|||
script = ExtResource("13_jout6")
|
||||
gate_events = ExtResource("2_cdryv")
|
||||
|
||||
[node name="SenderBookmark" type="Node" parent="Api/Analytics"]
|
||||
script = ExtResource("13_74yg1")
|
||||
bookmarks = ExtResource("6_rupvx")
|
||||
|
||||
[node name="AddGate" type="Node" parent="Api"]
|
||||
script = ExtResource("13_3xhql")
|
||||
api = ExtResource("10_04o5h")
|
||||
|
@ -58,25 +63,5 @@ visible = false
|
|||
|
||||
[node name="Menu" parent="." instance=ExtResource("3_o1f7b")]
|
||||
|
||||
[node name="GoBack" parent="Menu/VBoxContainer/Top/MenuNavigation" index="0"]
|
||||
process_physics_priority = 0
|
||||
process_thread_group = 0
|
||||
|
||||
[node name="GoForward" parent="Menu/VBoxContainer/Top/MenuNavigation" index="1"]
|
||||
process_physics_priority = 0
|
||||
process_thread_group = 0
|
||||
|
||||
[node name="Reload" parent="Menu/VBoxContainer/Top/MenuNavigation" index="2"]
|
||||
process_physics_priority = 0
|
||||
process_thread_group = 0
|
||||
|
||||
[node name="Home" parent="Menu/VBoxContainer/Top/MenuNavigation" index="4"]
|
||||
process_physics_priority = 0
|
||||
process_thread_group = 0
|
||||
|
||||
[node name="Exit" parent="Menu/VBoxContainer/Top" index="2"]
|
||||
process_physics_priority = 0
|
||||
process_thread_group = 0
|
||||
|
||||
[editable path="Debug"]
|
||||
[editable path="Menu"]
|
||||
|
|
|
@ -57,6 +57,20 @@ func gate_exit(url: String, time_spend: int) -> Dictionary:
|
|||
return event
|
||||
|
||||
|
||||
# BOOKMARK
|
||||
|
||||
func bookmark(url: String) -> Dictionary:
|
||||
var event = base("bookmark")
|
||||
event.gate_url = url
|
||||
return event
|
||||
|
||||
|
||||
func unbookmark(url: String) -> Dictionary:
|
||||
var event = base("unbookmark")
|
||||
event.gate_url = url
|
||||
return event
|
||||
|
||||
|
||||
# ERROR
|
||||
|
||||
func error(msg: String) -> Dictionary:
|
||||
|
|
19
project/scripts/api/analytics/analytics_sender_bookmark.gd
Normal file
19
project/scripts/api/analytics/analytics_sender_bookmark.gd
Normal file
|
@ -0,0 +1,19 @@
|
|||
extends AnalyticsSender
|
||||
class_name AnalyticsSenderBookmark
|
||||
|
||||
@export var bookmarks: Bookmarks
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
super.start()
|
||||
|
||||
bookmarks.on_star.connect(send_bookmark)
|
||||
bookmarks.on_unstar.connect(send_unbookmark)
|
||||
|
||||
|
||||
func send_bookmark(gate: Gate):
|
||||
analytics.send_event(AnalyticsEvents.bookmark(gate.url))
|
||||
|
||||
|
||||
func send_unbookmark(gate: Gate):
|
||||
analytics.send_event(AnalyticsEvents.unbookmark(gate.url))
|
|
@ -1,10 +1,13 @@
|
|||
extends Resource
|
||||
class_name Bookmarks
|
||||
|
||||
signal on_star(gate: Gate)
|
||||
signal on_unstar(gate: Gate)
|
||||
signal save_image(gate: Gate)
|
||||
|
||||
@export var featured_gates: Array[Gate]
|
||||
@export var starred_gates: Array[Gate]
|
||||
|
||||
var gates = {}
|
||||
|
||||
|
||||
|
@ -45,7 +48,9 @@ func star(gate: Gate) -> void:
|
|||
|
||||
gates[gate.url] = gate
|
||||
starred_gates.append(gate)
|
||||
|
||||
save_image.emit(gate)
|
||||
on_star.emit(gate)
|
||||
|
||||
|
||||
func unstar(gate: Gate) -> void:
|
||||
|
@ -54,3 +59,5 @@ func unstar(gate: Gate) -> void:
|
|||
var erase: Gate = gates[gate.url]
|
||||
gates.erase(erase.url)
|
||||
starred_gates.erase(erase)
|
||||
|
||||
on_unstar.emit(gate)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue