mirror of
https://github.com/FluxaMedia/fluxa-core.git
synced 2026-08-05 08:18:40 +00:00
Surface content_types on discover state for the client to build a dynamic Type filter
Kotlin's readDiscoverCatalogFilters effect now returns a contentTypes list (distinct catalog types found across installed addons, e.g. movie/series/anime), but the effect completion flows back through the engine's own discover state before Kotlin ever sees it again. Added content_types to DiscoverState and store it in the completion handler for readDiscoverCatalogFilters, preserving it across a fresh discover dispatch the same way catalogs/genres already are.
This commit is contained in:
parent
0b2acedd3c
commit
dff036ee63
1 changed files with 7 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ pub(super) struct DiscoverState {
|
|||
result_sources: Value,
|
||||
catalogs: Value,
|
||||
genres: Value,
|
||||
content_types: Value,
|
||||
error: Value,
|
||||
generation: u64,
|
||||
paging: DiscoverPaging,
|
||||
|
|
@ -140,6 +141,7 @@ pub(super) fn dispatch_discover(
|
|||
result_sources: Value::Null,
|
||||
catalogs: engine.state.discover.catalogs.clone(),
|
||||
genres: engine.state.discover.genres.clone(),
|
||||
content_types: engine.state.discover.content_types.clone(),
|
||||
error: Value::Null,
|
||||
generation,
|
||||
paging: DiscoverPaging::default(),
|
||||
|
|
@ -287,6 +289,11 @@ pub(super) fn complete(
|
|||
.get("genres")
|
||||
.cloned()
|
||||
.unwrap_or_else(|| serde_json::json!([]));
|
||||
engine.state.discover.content_types = result
|
||||
.value
|
||||
.get("contentTypes")
|
||||
.cloned()
|
||||
.unwrap_or_else(|| serde_json::json!([]));
|
||||
engine.state.discover.error = Value::Null;
|
||||
} else {
|
||||
engine.state.discover.error = normalize_error(result.error.clone());
|
||||
|
|
|
|||
Loading…
Reference in a new issue