Skip to content

Commit

Permalink
Merge pull request #45 from Stremio/feat/catalogs-with-extra-discover…
Browse files Browse the repository at this point in the history
…-deep-links

DiscoverDeepLinks and LibraryDeepLinks
  • Loading branch information
tymmesyde committed Mar 29, 2024
2 parents f8aacc8 + e995784 commit 39d5108
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/androidMain/kotlin/com/stremio/core/DeepLinks.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.stremio.core

class LibraryDeepLinks(
val library: String,
)
3 changes: 3 additions & 0 deletions src/commonMain/rust/bridge/resource_loadable.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use inflector::Inflector;
use stremio_core::deep_links::DiscoverDeepLinks;
use stremio_core::models::common::{DescriptorLoadable, ResourceLoadable};
use stremio_core::models::ctx::Ctx;
use stremio_core::types::addon::{DescriptorPreview, ResourceRequest};
Expand Down Expand Up @@ -40,10 +41,12 @@ impl ToProtobuf<models::LoadablePage, Ctx> for ResourceLoadable<Vec<MetaItemPrev
)
})
.unwrap_or_default();
let deep_links = DiscoverDeepLinks::from(&self.request).to_protobuf(&());
models::LoadablePage {
title,
request: self.request.to_protobuf(&()),
content: self.content.to_protobuf(&(ctx, &self.request)),
deep_links,
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/commonMain/rust/model/fields/catalogs_with_extra.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use stremio_core::deep_links::DiscoverDeepLinks;
use stremio_core::models::catalog_with_filters::Catalog;
use stremio_core::models::catalogs_with_extra::{CatalogsWithExtra, Selected};
use stremio_core::models::ctx::Ctx;
Expand Down Expand Up @@ -40,3 +41,11 @@ impl ToProtobuf<models::CatalogsWithExtra, Ctx> for CatalogsWithExtra {
}
}
}

impl ToProtobuf<models::DiscoverDeepLinks, ()> for DiscoverDeepLinks {
fn to_protobuf(&self, _args: &()) -> models::DiscoverDeepLinks {
models::DiscoverDeepLinks {
discover: self.discover.clone(),
}
}
}
7 changes: 6 additions & 1 deletion src/main/proto/stremio/core/models/catalogs_with_extra.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ message LoadablePage {
Error error = 4;
Page ready = 5;
}
required DiscoverDeepLinks deep_links = 6;
}

message Page {
repeated stremio.core.types.MetaItemPreview meta_items = 1;
}
}

message DiscoverDeepLinks {
required string discover = 1;
}

0 comments on commit 39d5108

Please sign in to comment.