Closed Ivshti closed 5 years ago
Due to many complicated bits, like the player and detail page, we're most likely elm-ing it.
update(&mut self, &Ctx)
for regular containersCtx
itself will be a container that exposes an update(&mut self, &action)
Ctx
container may actually become cleaner than the contextM
since we'll just make a message Internal::UpdateCtx
and eliminate the need for interior mutability#[derive]
macro will allow us to compose many types that implement update
Ctx
; we can also provide glue:
update
LibAddon
's interior mutability might need to be re-thought tooExample API:
// TODO all those will have to take a type arg for Env....
#[derive(StremioModel)]
pub struct StremioModel {
pub discover: CatalogFiltered,
pub board: CatalogGrouped,
pub player: Player<PlayerImpl>
}
let mut stremio = StremioModel::new();
let ctx = Ctx::new();
stremio.update(&ctx); // will return a Vec of futures that have to be handled
// or more sophisticated
// TODO: figure out a better name for this
let (tx, rx) = App::with_managed_context::<Env>();
// send actions to tx
//rx.for_each() // do something with the new &model
NOTE: the models might have to take AddonTransport
besides Env
in light of using this in stremio-web, stremio-example-seed, stremio-example-sauron, stremio-example-ui and stremio-ng-example,
there are a few more design decisions to make before finalizing:
CatalogMuxer
, implement a#[derive]
macro that will allow the user to fill a struct with fields that implementContainer
; that is much more ergonomic; however, this struct should not have interior mutability, and mutability will need to be handled by the user (implementation-specific) - DOING ITupdate
function - GOING FOR ELM STYLEupdate
problem: many things are dependent on the user ctx, so we will have to somehow retrieve it before determining what tasks to issue; if we do a promise of the stylewith_ctx
, then it's kinda ugly (adding async logic toupdate
)update(&mut Model, &Ctx) -> Effects
RecommendedXXX
(as a result toOpen
) to load should lead to a page that will trigger this Loadaddon_aggr_req
; and in general, a mechanisms for Containers to define thier own Load parameters and effects; could be a trait associated type that we use in Actions - not neededfn effects(ctx: Ctx) -> Vec<EnvFuture<Action>>
- not neededupdate
function mutate the struct or return a new struct? - mutateStandardStremio
- a struct with all containers a usual stremio app has - not needed, derive macro handles this great/detail/movie/tt213
to/detail/movie/tt213/tt213
), but for now there's no point of doing this cause (1) the reducer will keep the old response and (2) the browser has a cache - not a problem with elm architectureAddonRequest
/AddonResponse
) - not a problem with elm architectureMetaItem
,MetaPreview
andLibItem
? - #53LibItemPreview
? - noupdate
function should focus on how they mutate, and do as little processing as possible; they will do sorting and filtering (e.g. Search) thoughEnvironment
trait?see also: https://github.com/Stremio/stremio-core/issues/28