Skip to content

Commit

Permalink
refactor(deep_links): implement ToProtobuf trait for StreamDeepLinks
Browse files Browse the repository at this point in the history
  • Loading branch information
tymmesyde committed Oct 23, 2024
1 parent 9d76a80 commit c53612d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
11 changes: 10 additions & 1 deletion src/commonMain/rust/bridge/deep_links.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::bridge::ToProtobuf;
use crate::protobuf::stremio::core::types;
use stremio_core::deep_links::{ExternalPlayerLink, LibraryItemDeepLinks};
use stremio_core::deep_links::{ExternalPlayerLink, LibraryItemDeepLinks, StreamDeepLinks};

impl ToProtobuf<types::LibraryItemDeepLinks, ()> for LibraryItemDeepLinks {
fn to_protobuf(&self, _args: &()) -> types::LibraryItemDeepLinks {
Expand All @@ -13,6 +13,15 @@ impl ToProtobuf<types::LibraryItemDeepLinks, ()> for LibraryItemDeepLinks {
}
}

impl ToProtobuf<types::StreamDeepLinks, ()> for StreamDeepLinks {
fn to_protobuf(&self, _args: &()) -> types::StreamDeepLinks {
types::StreamDeepLinks {
player: self.player.to_owned(),
external_player: self.external_player.to_protobuf(&()),
}
}
}

impl ToProtobuf<types::ExternalPlayerLink, ()> for ExternalPlayerLink {
fn to_protobuf(&self, _args: &()) -> types::ExternalPlayerLink {
types::ExternalPlayerLink {
Expand Down
8 changes: 1 addition & 7 deletions src/commonMain/rust/bridge/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,7 @@ impl
video_hash: self.behavior_hints.video_hash.to_owned(),
video_size: self.behavior_hints.video_size,
},
deep_links: types::StreamDeepLinks {
player: deep_links.player,
external_player: types::ExternalPlayerLink {
download: deep_links.external_player.download,
streaming: deep_links.external_player.streaming,
},
},
deep_links: deep_links.to_protobuf(&()),
source: Some(self.source.to_protobuf(&())),
}
}
Expand Down

0 comments on commit c53612d

Please sign in to comment.