diff --git a/Cargo.lock b/Cargo.lock index 0b738c4..5febf42 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -944,7 +944,7 @@ dependencies = [ [[package]] name = "stremio-core" version = "0.1.0" -source = "git+https://github.com/Stremio/stremio-core?branch=development#39fb65e8c28586b8214d14f1316053ba190a571d" +source = "git+https://github.com/Stremio/stremio-core?branch=development#f451b2cb3645c21463c84dd6446b266659c45ded" dependencies = [ "anyhow", "base64 0.21.2", @@ -1020,7 +1020,7 @@ dependencies = [ [[package]] name = "stremio-derive" version = "0.1.0" -source = "git+https://github.com/Stremio/stremio-core?branch=development#39fb65e8c28586b8214d14f1316053ba190a571d" +source = "git+https://github.com/Stremio/stremio-core?branch=development#f451b2cb3645c21463c84dd6446b266659c45ded" dependencies = [ "case", "proc-macro-crate", @@ -1050,7 +1050,7 @@ dependencies = [ [[package]] name = "stremio-watched-bitfield" version = "0.1.0" -source = "git+https://github.com/Stremio/stremio-core?branch=development#39fb65e8c28586b8214d14f1316053ba190a571d" +source = "git+https://github.com/Stremio/stremio-core?branch=development#f451b2cb3645c21463c84dd6446b266659c45ded" dependencies = [ "base64 0.13.1", "flate2", diff --git a/src/model/model.rs b/src/model/model.rs index 8b6ff74..8f4245b 100644 --- a/src/model/model.rs +++ b/src/model/model.rs @@ -21,9 +21,9 @@ use stremio_core::{ }, runtime::Effects, types::{ - addon::DescriptorPreview, api::LinkAuthKey, library::LibraryBucket, - notifications::NotificationsBucket, profile::Profile, resource::MetaItemPreview, - search_history::SearchHistoryBucket, streams::StreamsBucket, + addon::DescriptorPreview, api::LinkAuthKey, events::DismissedEventsBucket, + library::LibraryBucket, notifications::NotificationsBucket, profile::Profile, + resource::MetaItemPreview, search_history::SearchHistoryBucket, streams::StreamsBucket, }, Model, }; @@ -68,6 +68,7 @@ impl WebModel { streams: StreamsBucket, notifications: NotificationsBucket, search_history: SearchHistoryBucket, + dismissed_events: DismissedEventsBucket, ) -> (WebModel, Effects) { let (continue_watching_preview, continue_watching_preview_effects) = ContinueWatchingPreview::new(&library, ¬ifications); @@ -83,7 +84,14 @@ impl WebModel { let (streaming_server, streaming_server_effects) = StreamingServer::new::(&profile); let (local_search, local_search_effects) = LocalSearch::new::(); let model = WebModel { - ctx: Ctx::new(profile, library, streams, notifications, search_history), + ctx: Ctx::new( + profile, + library, + streams, + notifications, + search_history, + dismissed_events, + ), auth_link: Default::default(), data_export: Default::default(), local_search, diff --git a/src/model/serialize_ctx.rs b/src/model/serialize_ctx.rs index d22c76c..82635c7 100644 --- a/src/model/serialize_ctx.rs +++ b/src/model/serialize_ctx.rs @@ -16,7 +16,9 @@ mod model { use stremio_core::{ deep_links::SearchHistoryItemDeepLinks, - types::{notifications::NotificationItem, profile::Profile, resource::MetaItemId}, + types::{ + events::Events, notifications::NotificationItem, profile::Profile, resource::MetaItemId, + }, }; #[derive(Serialize)] @@ -26,6 +28,7 @@ mod model { pub profile: &'a Profile, pub notifications: Notifications<'a>, pub search_history: Vec>, + pub events: &'a Events, } #[derive(Serialize)] @@ -70,6 +73,7 @@ mod model { deep_links: SearchHistoryItemDeepLinks::from(query), }) .collect(), + events: &ctx.events, } } } diff --git a/src/stremio_core_web.rs b/src/stremio_core_web.rs index 5763be1..848a0aa 100644 --- a/src/stremio_core_web.rs +++ b/src/stremio_core_web.rs @@ -10,14 +10,16 @@ use wasm_bindgen::JsValue; use stremio_core::{ constants::{ - LIBRARY_RECENT_STORAGE_KEY, LIBRARY_STORAGE_KEY, NOTIFICATIONS_STORAGE_KEY, - PROFILE_STORAGE_KEY, SEARCH_HISTORY_STORAGE_KEY, STREAMS_STORAGE_KEY, + DISMISSED_EVENTS_STORAGE_KEY, LIBRARY_RECENT_STORAGE_KEY, LIBRARY_STORAGE_KEY, + NOTIFICATIONS_STORAGE_KEY, PROFILE_STORAGE_KEY, SEARCH_HISTORY_STORAGE_KEY, + STREAMS_STORAGE_KEY, }, models::common::Loadable, runtime::{msg::Action, Env, EnvError, Runtime, RuntimeAction, RuntimeEvent}, types::{ - library::LibraryBucket, notifications::NotificationsBucket, profile::Profile, - resource::Stream, search_history::SearchHistoryBucket, streams::StreamsBucket, + events::DismissedEventsBucket, library::LibraryBucket, notifications::NotificationsBucket, + profile::Profile, resource::Stream, search_history::SearchHistoryBucket, + streams::StreamsBucket, }, }; @@ -65,6 +67,7 @@ pub async fn initialize_runtime(emit_to_ui: js_sys::Function) -> Result<(), JsVa WebEnv::get_storage::(STREAMS_STORAGE_KEY), WebEnv::get_storage::(NOTIFICATIONS_STORAGE_KEY), WebEnv::get_storage::(SEARCH_HISTORY_STORAGE_KEY), + WebEnv::get_storage::(DISMISSED_EVENTS_STORAGE_KEY), ); match storage_result { Ok(( @@ -74,6 +77,7 @@ pub async fn initialize_runtime(emit_to_ui: js_sys::Function) -> Result<(), JsVa streams_bucket, notifications_bucket, search_history_bucket, + dismissed_events_bucket, )) => { let profile = profile.unwrap_or_default(); let mut library = LibraryBucket::new(profile.uid(), vec![]); @@ -89,12 +93,15 @@ pub async fn initialize_runtime(emit_to_ui: js_sys::Function) -> Result<(), JsVa .unwrap_or(NotificationsBucket::new::(profile.uid(), vec![])); let search_history_bucket = search_history_bucket.unwrap_or(SearchHistoryBucket::new(profile.uid())); + let dismissed_events_bucket = dismissed_events_bucket + .unwrap_or(DismissedEventsBucket::new(profile.uid())); let (model, effects) = WebModel::new( profile, library, streams_bucket, notifications_bucket, search_history_bucket, + dismissed_events_bucket, ); let (runtime, rx) = Runtime::::new( model,