Skip to content
This repository has been archived by the owner on Dec 24, 2024. It is now read-only.

Commit

Permalink
update core
Browse files Browse the repository at this point in the history
  • Loading branch information
unclekingpin committed Jul 5, 2023
1 parent aded61b commit bd7978a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ lto = true
opt-level = 's'

[dependencies]
stremio-core = { git = "https://github.com/Stremio/stremio-core", branch = "development" }
stremio-derive = { git = "https://github.com/Stremio/stremio-core", branch = "development" }
stremio-analytics = { git = "https://github.com/Stremio/stremio-core", branch = "development" }
stremio-core = { git = "https://github.com/unclekingpin/stremio-core", branch = "override-meta-details-selected" }
stremio-derive = { git = "https://github.com/unclekingpin/stremio-core", branch = "override-meta-details-selected" }
stremio-analytics = { git = "https://github.com/unclekingpin/stremio-core", branch = "override-meta-details-selected" }
serde = { version = "1.0.*", features = ["derive"] }
serde_json = "1.0.*"
futures = "0.3.*"
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions src/model/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ use stremio_core::types::api::LinkAuthKey;
use stremio_core::types::library::LibraryBucket;
use stremio_core::types::profile::Profile;
use stremio_core::types::resource::MetaItemPreview;
use stremio_core::types::streams::StreamsBucket;
use stremio_derive::Model;
use wasm_bindgen::JsValue;

#[derive(Model)]
#[derive(Model, Clone)]
#[cfg_attr(debug_assertions, derive(Serialize))]
#[model(WebEnv)]
pub struct WebModel {
Expand All @@ -51,7 +52,11 @@ pub struct WebModel {
}

impl WebModel {
pub fn new(profile: Profile, library: LibraryBucket) -> (WebModel, Effects) {
pub fn new(
profile: Profile,
library: LibraryBucket,
streams: StreamsBucket,
) -> (WebModel, Effects) {
let (continue_watching_preview, continue_watching_preview_effects) =
ContinueWatchingPreview::new(&library);
let (discover, discover_effects) = CatalogWithFilters::<MetaItemPreview>::new(&profile);
Expand All @@ -64,7 +69,7 @@ impl WebModel {
InstalledAddonsWithFilters::new(&profile);
let (streaming_server, streaming_server_effects) = StreamingServer::new::<WebEnv>(&profile);
let model = WebModel {
ctx: Ctx::new(profile, library),
ctx: Ctx::new(profile, library, streams),
auth_link: Default::default(),
data_export: Default::default(),
continue_watching_preview,
Expand Down
11 changes: 7 additions & 4 deletions src/stremio_core_web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ use lazy_static::lazy_static;
use tracing::{info, Level};

use stremio_core::constants::{
LIBRARY_RECENT_STORAGE_KEY, LIBRARY_STORAGE_KEY, PROFILE_STORAGE_KEY,
LIBRARY_RECENT_STORAGE_KEY, LIBRARY_STORAGE_KEY, PROFILE_STORAGE_KEY, STREAMS_STORAGE_KEY,
};
use stremio_core::models::common::Loadable;
use stremio_core::runtime::msg::Action;
use stremio_core::runtime::{Env, EnvError, Runtime, RuntimeAction, RuntimeEvent};
use stremio_core::types::library::LibraryBucket;
use stremio_core::types::profile::Profile;
use stremio_core::types::resource::Stream;
use stremio_core::types::streams::StreamsBucket;

use tracing_wasm::WASMLayerConfigBuilder;
use wasm_bindgen::prelude::wasm_bindgen;
Expand Down Expand Up @@ -56,14 +57,15 @@ pub async fn initialize_runtime(emit_to_ui: js_sys::Function) -> Result<(), JsVa
let env_init_result = WebEnv::init().await;
match env_init_result {
Ok(_) => {
let storage_result = future::try_join3(
let storage_result = future::try_join4(
WebEnv::get_storage::<Profile>(PROFILE_STORAGE_KEY),
WebEnv::get_storage::<LibraryBucket>(LIBRARY_RECENT_STORAGE_KEY),
WebEnv::get_storage::<LibraryBucket>(LIBRARY_STORAGE_KEY),
WebEnv::get_storage::<StreamsBucket>(STREAMS_STORAGE_KEY),
)
.await;
match storage_result {
Ok((profile, recent_bucket, other_bucket)) => {
Ok((profile, recent_bucket, other_bucket, streams_bucket)) => {
let profile = profile.unwrap_or_default();
let mut library = LibraryBucket::new(profile.uid(), vec![]);
if let Some(recent_bucket) = recent_bucket {
Expand All @@ -72,7 +74,8 @@ pub async fn initialize_runtime(emit_to_ui: js_sys::Function) -> Result<(), JsVa
if let Some(other_bucket) = other_bucket {
library.merge_bucket(other_bucket);
};
let (model, effects) = WebModel::new(profile, library);
let streams_bucket = streams_bucket.unwrap_or_default();
let (model, effects) = WebModel::new(profile, library, streams_bucket);
let (runtime, rx) = Runtime::<WebEnv, _>::new(
model,
effects.into_iter().collect::<Vec<_>>(),
Expand Down

0 comments on commit bd7978a

Please sign in to comment.