featured gates api initial

This commit is contained in:
Nordup 2024-04-10 01:52:00 +04:00
parent 5e9adfb7d4
commit d86fea31c3
5 changed files with 28 additions and 2 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=3 uid="uid://ct8gsph3wnepl"]
[gd_scene load_steps=18 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"]
@ -16,6 +16,7 @@
[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"]
[ext_resource type="Script" path="res://scripts/api/featured_gates.gd" id="15_c1fxl"]
[node name="App" type="Node" node_paths=PackedStringArray("scenes_root")]
script = ExtResource("1_skc7d")
@ -51,11 +52,16 @@ gate_events = ExtResource("2_cdryv")
script = ExtResource("13_74yg1")
bookmarks = ExtResource("6_rupvx")
[node name="AddGate" type="Node" parent="Api"]
[node name="DiscoverGate" type="Node" parent="Api"]
script = ExtResource("13_3xhql")
api = ExtResource("10_04o5h")
gate_events = ExtResource("2_cdryv")
[node name="FeaturedGates" type="Node" parent="Api"]
script = ExtResource("15_c1fxl")
api = ExtResource("10_04o5h")
bookmarks = ExtResource("6_rupvx")
[node name="Debug" parent="." instance=ExtResource("7_3xeb8")]
[node name="Window" parent="Debug" index="0"]

View file

@ -0,0 +1,13 @@
extends Node
@export var api: ApiSettings
@export var bookmarks: Bookmarks
func _ready() -> void:
bookmarks.on_ready.connect(on_bookmarks_ready)
func on_bookmarks_ready() -> void:
if bookmarks.gates.size() > 0: return
# TODO: Get featured gates

View file

@ -1,6 +1,7 @@
extends Node
class_name FileTools
static func remove_recursive(path: String) -> void:
if not DirAccess.dir_exists_absolute(path) and not FileAccess.file_exists(path): return

View file

@ -22,6 +22,9 @@ var create_user_id: String :
var discover_gate: String :
get: return url + "/api/discover_gate"
var featured_gates: String :
get: return url + "/api/featured_gates"
var search: String :
get: return url + "/api/search?query="

View file

@ -1,6 +1,7 @@
extends Resource
class_name Bookmarks
signal on_ready()
signal on_star(gate: Gate)
signal on_unstar(gate: Gate)
signal save_image(gate: Gate)
@ -15,6 +16,8 @@ func ready() -> void:
if gate == null or not Url.is_valid(gate.url): continue
gates[gate.url] = gate
on_ready.emit()
func update(gate: Gate) -> void:
if not gates.has(gate.url): return