support is_special in featured gates

This commit is contained in:
Nordup 2025-08-15 20:25:14 +07:00
parent dc75df3d60
commit ca10a8482d
7 changed files with 18 additions and 11 deletions

View file

@ -11,8 +11,8 @@ func _ready() -> void:
bookmarks.on_unstar.connect(send_unbookmark)
func send_bookmark(gate: Gate, featured: bool) -> void:
if featured: return
func send_bookmark(gate: Gate) -> void:
if gate.featured: return
analytics.send_event(AnalyticsEvents.bookmark(gate.url))

View file

@ -4,6 +4,7 @@ const KEY_URL = "url"
const KEY_TITLE = "title"
const KEY_DESCRIPTION = "description"
const KEY_ICON = "icon"
const KEY_IS_SPECIAL = "is_special"
@export var api: ApiSettings
@export var bookmarks: Bookmarks
@ -44,7 +45,9 @@ func featured_gates_request() -> void:
func star_gate(gate_d: Dictionary) -> void:
var gate = Gate.create(gate_d[KEY_URL], gate_d[KEY_TITLE], gate_d[KEY_DESCRIPTION], gate_d[KEY_ICON], "")
bookmarks.star(gate, true)
gate.is_special = gate_d[KEY_IS_SPECIAL]
gate.featured = true
bookmarks.star(gate)
gate.icon = await FileDownloader.download(gate.icon_url)
bookmarks.update(gate)