mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-22 23:17:26 -04:00
bookmark fix duplicates
This commit is contained in:
parent
467d61f16b
commit
01ee2b08e1
3 changed files with 6 additions and 3 deletions
|
@ -72,5 +72,4 @@ open_debug={
|
|||
[rendering]
|
||||
|
||||
textures/canvas_textures/default_texture_filter=2
|
||||
renderer/rendering_method="mobile"
|
||||
textures/default_filters/anisotropic_filtering_level=1
|
||||
|
|
|
@ -14,6 +14,7 @@ func _ready() -> void:
|
|||
bookmarks.save_image.connect(save_image)
|
||||
bookmarks.on_star.connect(func(_gate, _featured): save_bookmarks())
|
||||
bookmarks.on_unstar.connect(func(_gate): save_bookmarks())
|
||||
bookmarks.on_update.connect(func(_gate): save_bookmarks())
|
||||
|
||||
|
||||
func load_bookmarks() -> void:
|
||||
|
|
|
@ -4,6 +4,7 @@ class_name Bookmarks
|
|||
signal on_ready()
|
||||
signal on_star(gate: Gate, featured: bool)
|
||||
signal on_unstar(gate: Gate)
|
||||
signal on_update(gate: Gate)
|
||||
signal save_image(gate: Gate)
|
||||
|
||||
@export var starred_gates: Array[Gate]
|
||||
|
@ -13,8 +14,9 @@ var gates = {}
|
|||
|
||||
|
||||
func ready() -> void:
|
||||
for gate in starred_gates:
|
||||
if gate == null or not Url.is_valid(gate.url): continue
|
||||
for gate in starred_gates.duplicate():
|
||||
if not is_instance_valid(gate) or not Url.is_valid(gate.url) or gates.has(gate.url):
|
||||
starred_gates.erase(gate); continue # Remove invalid and duplicates
|
||||
gates[gate.url] = gate
|
||||
|
||||
is_ready = true
|
||||
|
@ -32,6 +34,7 @@ func update(gate: Gate) -> void:
|
|||
starred_gates.erase(replace)
|
||||
starred_gates.append(gate)
|
||||
|
||||
on_update.emit(gate)
|
||||
save_image.emit(gate)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue