From 47962a01e667f774458820955da8cdea62b4cec1 Mon Sep 17 00:00:00 2001
From: Lachezar Lechev <lachezar@ambire.com>
Date: Tue, 31 Oct 2023 09:23:57 +0200
Subject: [PATCH 1/8] chore: update core and most of the models & fields

Signed-off-by: Lachezar Lechev <lachezar@ambire.com>
---
 Cargo.lock                                    | 359 +++++++++++-------
 Cargo.toml                                    |  29 +-
 src/commonMain/rust/bridge/action.rs          |   7 +-
 .../rust/bridge/continue_watching_item.rs     |  50 +++
 src/commonMain/rust/bridge/event.rs           |  16 +
 src/commonMain/rust/bridge/library_item.rs    |   9 +-
 src/commonMain/rust/bridge/meta_preview.rs    |   3 +-
 src/commonMain/rust/bridge/mod.rs             |   3 +
 src/commonMain/rust/bridge/profile.rs         |  10 +-
 src/commonMain/rust/bridge/stream.rs          |  28 +-
 src/commonMain/rust/env/env.rs                |  40 +-
 src/commonMain/rust/env/kotlin_class_name.rs  |   7 +-
 src/commonMain/rust/model/addons.rs           |   2 +-
 .../model/fields/continue_watching_preview.rs |   2 +-
 src/commonMain/rust/model/fields/library.rs   |   5 +-
 .../rust/model/fields/library_by_type.rs      |   5 +-
 .../rust/model/fields/meta_details.rs         |  30 ++
 src/commonMain/rust/model/fields/player.rs    |  19 +-
 src/commonMain/rust/model/model.rs            |  24 +-
 src/commonMain/rust/stremio_core_android.rs   |  24 +-
 .../models/continue_watching_preview.proto    |  18 +-
 .../stremio/core/models/meta_details.proto    |   1 +
 .../proto/stremio/core/models/player.proto    |  12 +-
 .../core/runtime/action_meta_details.proto    |   4 +-
 .../proto/stremio/core/runtime/event.proto    |  70 ++--
 .../stremio/core/runtime/event.proto.orig     | 184 +++++++++
 .../proto/stremio/core/types/profile.proto    |  15 +-
 src/main/proto/stremio/core/types/video.proto |   8 +-
 28 files changed, 740 insertions(+), 244 deletions(-)
 create mode 100644 src/commonMain/rust/bridge/continue_watching_item.rs
 create mode 100644 src/main/proto/stremio/core/runtime/event.proto.orig

diff --git a/Cargo.lock b/Cargo.lock
index 2027a8c..dcbae41 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -20,9 +20,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
 
 [[package]]
 name = "aho-corasick"
-version = "0.7.18"
+version = "1.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
+checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
 dependencies = [
  "memchr",
 ]
@@ -656,6 +656,12 @@ dependencies = [
  "cfg-if 1.0.0",
 ]
 
+[[package]]
+name = "equivalent"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
+
 [[package]]
 name = "event-listener"
 version = "2.5.2"
@@ -716,14 +722,19 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
 
 [[package]]
 name = "form_urlencoded"
-version = "1.0.1"
+version = "1.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
+checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
 dependencies = [
- "matches",
  "percent-encoding",
 ]
 
+[[package]]
+name = "fst"
+version = "0.4.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ab85b9b05e3978cc9a9cf8fea7f01b494e1a09ed3037e16ba39edc7a29eb61a"
+
 [[package]]
 name = "futures"
 version = "0.3.21"
@@ -828,6 +839,15 @@ dependencies = [
  "slab",
 ]
 
+[[package]]
+name = "fxhash"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
+dependencies = [
+ "byteorder",
+]
+
 [[package]]
 name = "generic-array"
 version = "0.12.4"
@@ -888,7 +908,7 @@ dependencies = [
  "futures-sink",
  "futures-util",
  "http",
- "indexmap",
+ "indexmap 1.8.2",
  "slab",
  "tokio",
  "tokio-util",
@@ -901,6 +921,12 @@ version = "0.11.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
 
+[[package]]
+name = "hashbrown"
+version = "0.14.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
+
 [[package]]
 name = "heck"
 version = "0.3.3"
@@ -912,9 +938,9 @@ dependencies = [
 
 [[package]]
 name = "heck"
-version = "0.4.0"
+version = "0.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
+checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
 
 [[package]]
 name = "hermit-abi"
@@ -1112,11 +1138,10 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
 
 [[package]]
 name = "idna"
-version = "0.2.3"
+version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
+checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
 dependencies = [
- "matches",
  "unicode-bidi",
  "unicode-normalization",
 ]
@@ -1128,7 +1153,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a"
 dependencies = [
  "autocfg",
- "hashbrown",
+ "hashbrown 0.11.2",
+]
+
+[[package]]
+name = "indexmap"
+version = "2.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897"
+dependencies = [
+ "equivalent",
+ "hashbrown 0.14.2",
 ]
 
 [[package]]
@@ -1155,6 +1190,15 @@ dependencies = [
  "either",
 ]
 
+[[package]]
+name = "itertools"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
+dependencies = [
+ "either",
+]
+
 [[package]]
 name = "itoa"
 version = "1.0.2"
@@ -1226,6 +1270,17 @@ dependencies = [
  "cc",
 ]
 
+[[package]]
+name = "localsearch"
+version = "0.1.0"
+source = "git+https://github.com/Stremio/local-search?branch=main#74fefe1da2fa17d2b4ef7e3e629da00f3946ee72"
+dependencies = [
+ "fst",
+ "fxhash",
+ "num-traits",
+ "utf8-ranges",
+]
+
 [[package]]
 name = "log"
 version = "0.4.17"
@@ -1255,7 +1310,7 @@ dependencies = [
  "fnv",
  "proc-macro2",
  "quote",
- "regex-syntax",
+ "regex-syntax 0.6.26",
  "syn 2.0.18",
 ]
 
@@ -1278,12 +1333,6 @@ dependencies = [
  "regex",
 ]
 
-[[package]]
-name = "matches"
-version = "0.1.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
-
 [[package]]
 name = "maybe-uninit"
 version = "2.0.0"
@@ -1437,6 +1486,28 @@ dependencies = [
  "winapi",
 ]
 
+[[package]]
+name = "num"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af"
+dependencies = [
+ "num-complex",
+ "num-integer",
+ "num-iter",
+ "num-rational",
+ "num-traits",
+]
+
+[[package]]
+name = "num-complex"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214"
+dependencies = [
+ "num-traits",
+]
+
 [[package]]
 name = "num-integer"
 version = "0.1.45"
@@ -1447,6 +1518,28 @@ dependencies = [
  "num-traits",
 ]
 
+[[package]]
+name = "num-iter"
+version = "0.1.43"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
+dependencies = [
+ "autocfg",
+ "num-integer",
+ "num-traits",
+]
+
+[[package]]
+name = "num-rational"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
+dependencies = [
+ "autocfg",
+ "num-integer",
+ "num-traits",
+]
+
 [[package]]
 name = "num-traits"
 version = "0.2.15"
@@ -1477,9 +1570,9 @@ dependencies = [
 
 [[package]]
 name = "once_cell"
-version = "1.12.0"
+version = "1.18.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
+checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
 
 [[package]]
 name = "opaque-debug"
@@ -1556,9 +1649,9 @@ checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
 
 [[package]]
 name = "percent-encoding"
-version = "2.1.0"
+version = "2.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
+checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
 
 [[package]]
 name = "petgraph"
@@ -1567,7 +1660,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143"
 dependencies = [
  "fixedbitset",
- "indexmap",
+ "indexmap 1.8.2",
 ]
 
 [[package]]
@@ -1603,21 +1696,22 @@ dependencies = [
 
 [[package]]
 name = "prettyplease"
-version = "0.1.25"
+version = "0.2.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86"
+checksum = "9825a04601d60621feed79c4e6b56d65db77cdca55cef43b46b0de1096d1c282"
 dependencies = [
  "proc-macro2",
- "syn 1.0.96",
+ "syn 2.0.18",
 ]
 
 [[package]]
 name = "proc-macro-crate"
-version = "0.1.5"
+version = "1.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785"
+checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
 dependencies = [
- "toml",
+ "once_cell",
+ "toml_edit",
 ]
 
 [[package]]
@@ -1655,114 +1749,91 @@ dependencies = [
 
 [[package]]
 name = "proc_macro_roids"
-version = "0.7.0"
+version = "0.8.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06675fa2c577f52bcf77fbb511123927547d154faa08097cc012c66ec3c9611a"
+checksum = "d0c2a098cd8aaa29f66da27a684ad19f4b7bc886f576abf12f7df4a7391071c7"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 1.0.96",
-]
-
-[[package]]
-name = "prost"
-version = "0.10.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e"
-dependencies = [
- "bytes",
- "prost-derive 0.10.1",
+ "syn 2.0.18",
 ]
 
 [[package]]
 name = "prost"
-version = "0.11.9"
+version = "0.12.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd"
+checksum = "f4fdd22f3b9c31b53c060df4a0613a1c7f062d4115a2b984dd15b1858f7e340d"
 dependencies = [
  "bytes",
- "prost-derive 0.11.9",
+ "prost-derive",
 ]
 
 [[package]]
 name = "prost-build"
-version = "0.11.9"
+version = "0.12.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270"
+checksum = "8bdf592881d821b83d471f8af290226c8d51402259e9bb5be7f9f8bdebbb11ac"
 dependencies = [
  "bytes",
- "heck 0.4.0",
- "itertools",
- "lazy_static",
+ "heck 0.4.1",
+ "itertools 0.11.0",
  "log",
  "multimap",
+ "once_cell",
  "petgraph",
  "prettyplease",
- "prost 0.11.9",
+ "prost",
  "prost-types",
  "regex",
- "syn 1.0.96",
+ "syn 2.0.18",
  "tempfile",
  "which",
 ]
 
 [[package]]
 name = "prost-derive"
-version = "0.10.1"
+version = "0.12.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc"
+checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32"
 dependencies = [
  "anyhow",
- "itertools",
+ "itertools 0.11.0",
  "proc-macro2",
  "quote",
- "syn 1.0.96",
-]
-
-[[package]]
-name = "prost-derive"
-version = "0.11.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4"
-dependencies = [
- "anyhow",
- "itertools",
- "proc-macro2",
- "quote",
- "syn 1.0.96",
+ "syn 2.0.18",
 ]
 
 [[package]]
 name = "prost-reflect"
-version = "0.11.4"
+version = "0.12.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "000e1e05ebf7b26e1eba298e66fe4eee6eb19c567d0ffb35e0dd34231cdac4c8"
+checksum = "057237efdb71cf4b3f9396302a3d6599a92fa94063ba537b66130980ea9909f3"
 dependencies = [
  "logos",
  "miette 5.9.0",
  "once_cell",
- "prost 0.11.9",
+ "prost",
  "prost-types",
 ]
 
 [[package]]
 name = "prost-types"
-version = "0.11.9"
+version = "0.12.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13"
+checksum = "e081b29f63d83a4bc75cfc9f3fe424f9156cf92d8a4f0c9407cce9a1b67327cf"
 dependencies = [
- "prost 0.11.9",
+ "prost",
 ]
 
 [[package]]
 name = "protox"
-version = "0.3.3"
+version = "0.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "33583a76f29d02e8c8153e36d6676dd6d6aaff934a51a80809d710e143b61977"
+checksum = "66eb3a834c1ffe362107daab84dd87cfc1e1d2beda30e2eb8e4801f262839364"
 dependencies = [
  "bytes",
  "miette 5.9.0",
- "prost 0.11.9",
+ "prost",
  "prost-reflect",
  "prost-types",
  "protox-parse",
@@ -1771,9 +1842,9 @@ dependencies = [
 
 [[package]]
 name = "protox-parse"
-version = "0.3.3"
+version = "0.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "712a2a651fa4466e67df6c967df5d7fc6cbffac89afc7b834f97ec49846c9c11"
+checksum = "7b4581f441c58863525a3e6bec7b8de98188cf75239a56c725a3e7288450a33f"
 dependencies = [
  "logos",
  "miette 5.9.0",
@@ -1801,13 +1872,25 @@ dependencies = [
 
 [[package]]
 name = "regex"
-version = "1.5.6"
+version = "1.9.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1"
+checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29"
 dependencies = [
  "aho-corasick",
  "memchr",
- "regex-syntax",
+ "regex-automata",
+ "regex-syntax 0.7.5",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.3.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax 0.7.5",
 ]
 
 [[package]]
@@ -1816,6 +1899,12 @@ version = "0.6.26"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
 
+[[package]]
+name = "regex-syntax"
+version = "0.7.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
+
 [[package]]
 name = "remove_dir_all"
 version = "0.5.3"
@@ -2237,23 +2326,10 @@ dependencies = [
  "thiserror",
 ]
 
-[[package]]
-name = "stremio-analytics"
-version = "0.1.0"
-source = "git+https://github.com/Stremio/stremio-core?branch=development#1b2f6d7427ae08f9155ec74686f285b28004dd72"
-dependencies = [
- "derivative",
- "enclose",
- "futures",
- "serde",
- "serde_json",
- "stremio-core",
-]
-
 [[package]]
 name = "stremio-core"
 version = "0.1.0"
-source = "git+https://github.com/Stremio/stremio-core?branch=development#1b2f6d7427ae08f9155ec74686f285b28004dd72"
+source = "git+https://github.com/Stremio/stremio-core?branch=development#8c6fcd0bab1aa918107775938ccd67a73e5c6b25"
 dependencies = [
  "anyhow",
  "base64 0.21.0",
@@ -2267,11 +2343,15 @@ dependencies = [
  "futures",
  "hex 0.4.3",
  "http",
- "itertools",
+ "itertools 0.11.0",
  "lazy_static",
  "lazysort",
+ "localsearch",
  "magnet-url",
+ "num",
+ "once_cell",
  "percent-encoding",
+ "regex",
  "semver",
  "serde",
  "serde_bencode",
@@ -2283,7 +2363,8 @@ dependencies = [
  "stremio-official-addons",
  "stremio-serde-hex",
  "stremio-watched-bitfield",
- "strum 0.24.1",
+ "strum 0.25.0",
+ "thiserror",
  "tracing",
  "url",
 ]
@@ -2308,13 +2389,13 @@ dependencies = [
  "hex 0.4.3",
  "http",
  "http-cache-reqwest",
- "itertools",
+ "itertools 0.10.3",
  "jni",
  "lazy_static",
  "once_cell",
  "openssl",
  "percent-encoding",
- "prost 0.10.4",
+ "prost",
  "prost-build",
  "prost-types",
  "protox",
@@ -2324,12 +2405,9 @@ dependencies = [
  "serde",
  "serde_json",
  "serde_path_to_error",
- "stremio-analytics",
  "stremio-core",
- "stremio-derive",
  "stremio-watched-bitfield",
  "strum 0.22.0",
- "strum_macros 0.22.0",
  "tokio",
  "url",
 ]
@@ -2337,21 +2415,21 @@ dependencies = [
 [[package]]
 name = "stremio-derive"
 version = "0.1.0"
-source = "git+https://github.com/Stremio/stremio-core?branch=development#1b2f6d7427ae08f9155ec74686f285b28004dd72"
+source = "git+https://github.com/Stremio/stremio-core?branch=development#8c6fcd0bab1aa918107775938ccd67a73e5c6b25"
 dependencies = [
  "case",
  "proc-macro-crate",
  "proc-macro2",
  "proc_macro_roids",
  "quote",
- "syn 1.0.96",
+ "syn 2.0.18",
 ]
 
 [[package]]
 name = "stremio-official-addons"
-version = "2.0.10"
+version = "2.0.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f85866d77a26e83d3774dfcbb3871540b3e5e4fc753e26bdd5e8e4aa3bb9f9be"
+checksum = "7e078e462526ca579a7a6e46bcb0106457006abec0ecb97a643b4d6257613db6"
 
 [[package]]
 name = "stremio-serde-hex"
@@ -2367,7 +2445,7 @@ dependencies = [
 [[package]]
 name = "stremio-watched-bitfield"
 version = "0.1.0"
-source = "git+https://github.com/Stremio/stremio-core?branch=development#1b2f6d7427ae08f9155ec74686f285b28004dd72"
+source = "git+https://github.com/Stremio/stremio-core?branch=development#8c6fcd0bab1aa918107775938ccd67a73e5c6b25"
 dependencies = [
  "base64 0.13.0",
  "flate2",
@@ -2385,14 +2463,17 @@ name = "strum"
 version = "0.22.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "f7ac893c7d471c8a21f31cfe213ec4f6d9afeed25537c772e08ef3f005f8729e"
+dependencies = [
+ "strum_macros 0.22.0",
+]
 
 [[package]]
 name = "strum"
-version = "0.24.1"
+version = "0.25.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f"
+checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125"
 dependencies = [
- "strum_macros 0.24.3",
+ "strum_macros 0.25.3",
 ]
 
 [[package]]
@@ -2409,15 +2490,15 @@ dependencies = [
 
 [[package]]
 name = "strum_macros"
-version = "0.24.3"
+version = "0.25.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59"
+checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0"
 dependencies = [
- "heck 0.4.0",
+ "heck 0.4.1",
  "proc-macro2",
  "quote",
  "rustversion",
- "syn 1.0.96",
+ "syn 2.0.18",
 ]
 
 [[package]]
@@ -2582,12 +2663,20 @@ dependencies = [
 ]
 
 [[package]]
-name = "toml"
-version = "0.5.9"
+name = "toml_datetime"
+version = "0.6.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
+checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
+
+[[package]]
+name = "toml_edit"
+version = "0.19.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
 dependencies = [
- "serde",
+ "indexmap 2.0.2",
+ "toml_datetime",
+ "winnow",
 ]
 
 [[package]]
@@ -2651,9 +2740,9 @@ dependencies = [
 
 [[package]]
 name = "unicode-bidi"
-version = "0.3.8"
+version = "0.3.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
+checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
 
 [[package]]
 name = "unicode-ident"
@@ -2663,9 +2752,9 @@ checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee"
 
 [[package]]
 name = "unicode-normalization"
-version = "0.1.19"
+version = "0.1.22"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
+checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
 dependencies = [
  "tinyvec",
 ]
@@ -2690,17 +2779,22 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
 
 [[package]]
 name = "url"
-version = "2.2.2"
+version = "2.4.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
+checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5"
 dependencies = [
  "form_urlencoded",
  "idna",
- "matches",
  "percent-encoding",
  "serde",
 ]
 
+[[package]]
+name = "utf8-ranges"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7fcfc827f90e53a02eaef5e535ee14266c1d569214c6aa70133a624d8a3164ba"
+
 [[package]]
 name = "value-bag"
 version = "1.0.0-alpha.9"
@@ -3011,6 +3105,15 @@ version = "0.48.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
 
+[[package]]
+name = "winnow"
+version = "0.5.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c"
+dependencies = [
+ "memchr",
+]
+
 [[package]]
 name = "winreg"
 version = "0.10.1"
diff --git a/Cargo.toml b/Cargo.toml
index 7ae412c..95c5484 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,7 +2,10 @@
 name = "stremio-core-android"
 version = "1.1.0"
 authors = ["Smart Code OOD"]
-edition = "2018"
+edition = "2021"
+resolver = "2"
+
+rust-version = "1.67.1"
 
 [lib]
 crate_type = ["staticlib", "dylib"]
@@ -13,16 +16,19 @@ lto = true
 opt-level = 3
 
 [dependencies]
-stremio-core = { git = "https://github.com/Stremio/stremio-core", branch = "development", features = ["env-future-send"] }
-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/Stremio/stremio-core", branch = "development", features = [
+    "derive",
+    "analytics",
+    "env-future-send",
+] }
+
 stremio-watched-bitfield = { git = "https://github.com/Stremio/stremio-core", branch = "development" }
 serde = "1.0.*"
 serde_json = "1.0.*"
 futures = "0.3.*"
 http = "0.2.*"
-url = { version = "2.2.*", features = ["serde"] }
-percent-encoding = "2.1.*"
+url = { version = "2.4", features = ["serde"] }
+percent-encoding = "2.1"
 chrono = "0.4.*"
 semver = { version = "1", features = ["serde"] }
 base64 = "0.13.*"
@@ -32,8 +38,7 @@ either = "1.6.*"
 lazy_static = "1.4.*"
 enclose = "1.1.*"
 itertools = "0.10.*"
-strum = "0.22.*"
-strum_macros = "0.22.*"
+strum = { version = "0.22.*", features = ["derive"] }
 boolinator = "2.4.*"
 Inflector = "0.11.*"
 getrandom = "0.2.*"
@@ -45,13 +50,13 @@ reqwest = { version = "0.11", features = ["json", "rustls-tls"] }
 tokio = { version = "1.12.*", features = ["rt", "rt-multi-thread"] }
 openssl = { version = "0.10.*", features = ["vendored"] }
 bytes = "1.1.0"
-prost = "0.10.4"
-prost-types = "0.11.9"
+prost = "0.12"
+prost-types = "0.12"
 http-cache-reqwest = "0.4.5"
 reqwest-middleware = "0.1.6"
 once_cell = "1.12.0"
 
 [build-dependencies]
-prost-build = "0.11.9"
-protox = "0.3.3"
+prost-build = "0.12"
+protox = "0.5"
 glob = "0.3.0"
diff --git a/src/commonMain/rust/bridge/action.rs b/src/commonMain/rust/bridge/action.rs
index ee49ea0..67fc5fc 100644
--- a/src/commonMain/rust/bridge/action.rs
+++ b/src/commonMain/rust/bridge/action.rs
@@ -109,7 +109,7 @@ impl FromProtobuf<Action> for runtime::Action {
                     }
                     Some(action_meta_details::Args::MarkVideoAsWatched(video_state)) => {
                         Action::MetaDetails(ActionMetaDetails::MarkVideoAsWatched(
-                            video_state.video_id.to_owned(),
+                            video_state.video.from_protobuf(),
                             video_state.is_watched,
                         ))
                     }
@@ -212,7 +212,10 @@ impl FromProtobuf<Action> for runtime::Action {
 impl FromProtobuf<RuntimeAction<AndroidEnv, AndroidModel>> for runtime::RuntimeAction {
     fn from_protobuf(&self) -> RuntimeAction<AndroidEnv, AndroidModel> {
         RuntimeAction {
-            field: self.field.and_then(Field::from_i32).from_protobuf(),
+            field: self
+                .field
+                .and_then(|value| Field::try_from(value).ok())
+                .from_protobuf(),
             action: self.action.from_protobuf(),
         }
     }
diff --git a/src/commonMain/rust/bridge/continue_watching_item.rs b/src/commonMain/rust/bridge/continue_watching_item.rs
new file mode 100644
index 0000000..5c528f1
--- /dev/null
+++ b/src/commonMain/rust/bridge/continue_watching_item.rs
@@ -0,0 +1,50 @@
+use stremio_core::deep_links::LibraryItemDeepLinks;
+use stremio_core::models::continue_watching_preview::Item;
+use stremio_core::types::profile::Settings;
+use stremio_core::types::streams::StreamsItem;
+use url::Url;
+
+use crate::protobuf::stremio::core::models;
+use crate::protobuf::stremio::core::types;
+
+use super::ToProtobuf;
+
+impl ToProtobuf<models::ContinueWatchingItem, (Option<&StreamsItem>, Option<&Url>, &Settings)> for Item {
+    fn to_protobuf(&self, args: &(Option<&StreamsItem>, Option<&Url>, &Settings)) -> models::ContinueWatchingItem {
+        // Option<&StreamsItem>,
+        // Option<&Url>,
+        // &Settings,
+
+        let deep_links = LibraryItemDeepLinks::from((&self.library_item, args.0, args.1, args.2));
+        models::ContinueWatchingItem {
+            id: self.library_item.id.to_string(),
+            r#type: self.library_item.r#type.to_string(),
+            name: self.library_item.name.to_string(),
+            poster: self.library_item.poster.to_protobuf(&()),
+            poster_shape: self.library_item.poster_shape.to_protobuf(&()) as i32,
+            state: types::LibraryItemState {
+                time_offset: self.library_item.state.time_offset,
+                duration: self.library_item.state.duration,
+                video_id: self.library_item.state.video_id.clone(),
+            },
+            behavior_hints: self.library_item.behavior_hints.to_protobuf(&()),
+            deep_links: types::MetaItemDeepLinks {
+                meta_details_videos: deep_links.meta_details_videos,
+                meta_details_streams: deep_links.meta_details_streams,
+                player: deep_links.player,
+            },
+            progress: if self.library_item.state.time_offset > 0
+                && self.library_item.state.duration > 0
+            {
+                Some(
+                    self.library_item.state.time_offset as f64
+                        / self.library_item.state.duration as f64,
+                )
+            } else {
+                None
+            },
+            watched: self.library_item.state.times_watched > 0,
+            notifications: self.notifications as u64,
+        }
+    }
+}
diff --git a/src/commonMain/rust/bridge/event.rs b/src/commonMain/rust/bridge/event.rs
index 2c03920..28ff3d4 100644
--- a/src/commonMain/rust/bridge/event.rs
+++ b/src/commonMain/rust/bridge/event.rs
@@ -18,6 +18,14 @@ impl ToProtobuf<runtime::Event, ()> for Event {
                     runtime::event::LibraryItemsPushedToStorage { ids: ids.clone() },
                 )
             }
+            Event::StreamsPushedToStorage { uid } => runtime::event::Type::StreamsPushedToStorage(
+                runtime::event::StreamsPushedToStorage { uid: uid.clone() },
+            ),
+            Event::NotificationsPushedToStorage { ids } => {
+                runtime::event::Type::NotificationsPushedToStorage(
+                    runtime::event::NotificationsPushedToStorage { ids: ids.clone() },
+                )
+            }
             Event::UserPulledFromAPI { uid } => {
                 runtime::event::Type::UserPulledFromApi(runtime::event::UserPulledFromApi {
                     uid: uid.clone(),
@@ -96,6 +104,14 @@ impl ToProtobuf<runtime::Event, ()> for Event {
                     id: id.to_owned(),
                 })
             }
+            Event::LibraryItemNotificationsToggled { id } => {
+                runtime::event::Type::LibraryItemNotificationsToggled(
+                    runtime::event::LibraryItemNotificationsToggled { id: id.clone() },
+                )
+            }
+            Event::NotificationsDismissed { id } => runtime::event::Type::NotificationsDismissed(
+                runtime::event::NotificationsDismissed { id: id.clone() },
+            ),
             Event::LibrarySyncWithAPIPlanned { uid, plan } => {
                 runtime::event::Type::LibrarySyncWithApiPlanned(
                     runtime::event::LibrarySyncWithApiPlanned {
diff --git a/src/commonMain/rust/bridge/library_item.rs b/src/commonMain/rust/bridge/library_item.rs
index cbae397..3cb868f 100644
--- a/src/commonMain/rust/bridge/library_item.rs
+++ b/src/commonMain/rust/bridge/library_item.rs
@@ -1,12 +1,15 @@
 use stremio_core::deep_links::LibraryItemDeepLinks;
 use stremio_core::types::library::LibraryItem;
+use stremio_core::types::profile::Settings;
+use stremio_core::types::streams::StreamsItem;
+use url::Url;
 
 use crate::bridge::ToProtobuf;
 use crate::protobuf::stremio::core::types;
 
-impl ToProtobuf<types::LibraryItem, ()> for LibraryItem {
-    fn to_protobuf(&self, _args: &()) -> types::LibraryItem {
-        let deep_links = LibraryItemDeepLinks::from(self);
+impl ToProtobuf<types::LibraryItem, (Option<&StreamsItem>, Option<&Url>, &Settings)> for LibraryItem {
+    fn to_protobuf(&self, args: &(Option<&StreamsItem>, Option<&Url>, &Settings)) -> types::LibraryItem {
+        let deep_links = LibraryItemDeepLinks::from((self, args.0, args.1, args.2));
         types::LibraryItem {
             id: self.id.to_string(),
             r#type: self.r#type.to_string(),
diff --git a/src/commonMain/rust/bridge/meta_preview.rs b/src/commonMain/rust/bridge/meta_preview.rs
index b056f3f..52fd282 100644
--- a/src/commonMain/rust/bridge/meta_preview.rs
+++ b/src/commonMain/rust/bridge/meta_preview.rs
@@ -26,7 +26,8 @@ impl FromProtobuf<MetaItemPreview> for types::MetaItemPreview {
             id: self.id.to_owned(),
             r#type: self.r#type.to_owned(),
             name: self.name.to_owned(),
-            poster_shape: types::PosterShape::from_i32(self.poster_shape)
+            poster_shape: types::PosterShape::try_from(self.poster_shape)
+                .ok()
                 .from_protobuf()
                 .unwrap_or(PosterShape::Poster),
             poster: self.poster.from_protobuf(),
diff --git a/src/commonMain/rust/bridge/mod.rs b/src/commonMain/rust/bridge/mod.rs
index 0755d13..7c2ea6a 100644
--- a/src/commonMain/rust/bridge/mod.rs
+++ b/src/commonMain/rust/bridge/mod.rs
@@ -7,6 +7,9 @@ pub use android_model_field::*;
 mod auth_request;
 pub use auth_request::*;
 
+mod continue_watching_item;
+pub use continue_watching_item::*;
+
 mod date;
 pub use date::*;
 
diff --git a/src/commonMain/rust/bridge/profile.rs b/src/commonMain/rust/bridge/profile.rs
index 6a367ac..878c480 100644
--- a/src/commonMain/rust/bridge/profile.rs
+++ b/src/commonMain/rust/bridge/profile.rs
@@ -61,9 +61,10 @@ impl FromProtobuf<Settings> for types::profile::Settings {
             binge_watching: self.binge_watching,
             play_in_background: self.play_in_background,
             hardware_decoding: self.hardware_decoding,
-            frame_rate_matching_strategy: types::profile::FrameRateMatchingStrategy::from_i32(
+            frame_rate_matching_strategy: types::profile::FrameRateMatchingStrategy::try_from(
                 self.frame_rate_matching_strategy,
             )
+            .ok()
             .from_protobuf()
             .unwrap_or(FrameRateMatchingStrategy::Disabled),
             next_video_notification_duration: u32::try_from(cmp::max(
@@ -83,8 +84,12 @@ impl FromProtobuf<Settings> for types::profile::Settings {
             subtitles_text_color: self.subtitles_text_color.to_string(),
             subtitles_background_color: self.subtitles_background_color.to_string(),
             subtitles_outline_color: self.subtitles_outline_color.to_string(),
+            esc_exit_fullscreen: self.esc_exit_fullscreen,
             seek_time_duration: u32::try_from(cmp::max(self.seek_time_duration, 0))
                 .unwrap_or(u32::MAX),
+            seek_short_time_duration: u32::try_from(cmp::max(self.seek_time_duration, 0))
+                .unwrap_or(u32::MAX),
+            pause_on_minimize: self.pause_on_minimize,
             streaming_server_warning_dismissed: None,
         }
     }
@@ -161,7 +166,10 @@ impl ToProtobuf<types::profile::Settings, ()> for Settings {
             subtitles_text_color: self.subtitles_text_color.to_string(),
             subtitles_background_color: self.subtitles_background_color.to_string(),
             subtitles_outline_color: self.subtitles_outline_color.to_string(),
+            esc_exit_fullscreen: self.esc_exit_fullscreen,
             seek_time_duration: self.seek_time_duration as i64,
+            seek_short_time_duration: self.seek_short_time_duration as i64,
+            pause_on_minimize: self.pause_on_minimize,
             secondary_audio_language: self.secondary_audio_language.clone(),
             secondary_subtitles_language: self.secondary_subtitles_language.clone(),
             player_type: self.player_type.clone(),
diff --git a/src/commonMain/rust/bridge/stream.rs b/src/commonMain/rust/bridge/stream.rs
index 5f689fc..ca1fca6 100644
--- a/src/commonMain/rust/bridge/stream.rs
+++ b/src/commonMain/rust/bridge/stream.rs
@@ -131,18 +131,26 @@ impl
             Option<&ResourceRequest>,
         ),
     ) -> types::Stream {
-        let streaming_server_url =
-            ctx.map(|ctx| ctx.profile.settings.streaming_server_url.to_owned());
-        let deep_links = if stream_request.is_some() && meta_request.is_some() {
-            StreamDeepLinks::from((
+        // in calls that have None for ctx this would panic if we don't set it to default.
+        let settings = ctx
+            .map(|ctx| ctx.profile.settings.to_owned())
+            .unwrap_or_default();
+
+        let deep_links = match (stream_request, meta_request) {
+            (Some(stream_request), Some(meta_request)) => StreamDeepLinks::from((
+                self,
+                *stream_request,
+                *meta_request,
+                &ctx.map(|ctx| ctx.profile.settings.streaming_server_url.clone()),
+                &settings,
+            )),
+            _ => StreamDeepLinks::from((
                 self,
-                stream_request.unwrap(),
-                meta_request.unwrap(),
-                &streaming_server_url,
-            ))
-        } else {
-            StreamDeepLinks::from((self, &streaming_server_url))
+                &ctx.map(|ctx| ctx.profile.settings.streaming_server_url.clone()),
+                &settings,
+            )),
         };
+
         types::Stream {
             name: self.name.to_owned().or_else(|| addon_name.cloned()),
             description: self.description.clone(),
diff --git a/src/commonMain/rust/env/env.rs b/src/commonMain/rust/env/env.rs
index 911ab62..905499c 100644
--- a/src/commonMain/rust/env/env.rs
+++ b/src/commonMain/rust/env/env.rs
@@ -1,25 +1,29 @@
-use crate::env::{fetch, AndroidEvent, KotlinClassName, Storage};
-use crate::model::AndroidModel;
+use std::{
+    collections::HashMap,
+    os::raw::{c_char, c_int},
+    sync::{LockResult, RwLock, RwLockReadGuard},
+};
+
 use chrono::{DateTime, Utc};
 use futures::{Future, TryFutureExt};
 use http::Request;
-use jni::objects::{GlobalRef, JObject};
-use jni::JNIEnv;
+use jni::{objects::{GlobalRef, JObject}, JNIEnv};
 use lazy_static::lazy_static;
 use serde::{Deserialize, Serialize};
 use serde_json::json;
-use std::collections::HashMap;
-#[cfg(debug_assertions)]
-use std::ffi::CString;
-use std::os::raw::{c_char, c_int};
-use std::sync::{LockResult, RwLock, RwLockReadGuard};
-use stremio_analytics::Analytics;
-use stremio_core::models::ctx::Ctx;
-use stremio_core::models::streaming_server::StreamingServer;
-use stremio_core::runtime::msg::Event;
-use stremio_core::runtime::{Env, EnvError, EnvFuture, EnvFutureExt, TryEnvFuture};
 use strum::IntoEnumIterator;
 
+use stremio_core::{
+    analytics::Analytics,
+    models::{ctx::Ctx, streaming_server::StreamingServer},
+    runtime::{msg::Event, Env, EnvError, EnvFuture, EnvFutureExt, TryEnvFuture},
+};
+
+use crate::{
+    env::{fetch, AndroidEvent, KotlinClassName, Storage},
+    model::AndroidModel,
+};
+
 const INSTALLATION_ID_STORAGE_KEY: &str = "installation_id";
 #[cfg(debug_assertions)]
 const LOG_DEBUG_PRIORITY: i32 = 3;
@@ -208,9 +212,11 @@ impl Env for AndroidEnv {
     }
     #[cfg(debug_assertions)]
     fn log(message: String) {
+        use std::ffi::CString;
+        let tag = CString::new(LOG_TAG).unwrap();
+        let message = CString::new(message).unwrap();
+
         unsafe {
-            let tag = CString::new(LOG_TAG).unwrap();
-            let message = CString::new(message).unwrap();
             __android_log_write(LOG_DEBUG_PRIORITY as c_int, tag.as_ptr(), message.as_ptr());
         }
     }
@@ -232,4 +238,4 @@ async fn get_installation_id() -> Result<String, EnvError> {
         installation_id.unwrap_or_else(|| hex::encode(AndroidEnv::random_buffer(10)));
     AndroidEnv::set_storage(INSTALLATION_ID_STORAGE_KEY, Some(&installation_id)).await?;
     Ok(installation_id)
-}
+}
\ No newline at end of file
diff --git a/src/commonMain/rust/env/kotlin_class_name.rs b/src/commonMain/rust/env/kotlin_class_name.rs
index 41d85a5..49a5280 100644
--- a/src/commonMain/rust/env/kotlin_class_name.rs
+++ b/src/commonMain/rust/env/kotlin_class_name.rs
@@ -1,7 +1,6 @@
-use std::convert::TryFrom;
-use std::hash::Hash;
-use strum::IntoEnumIterator;
-use strum_macros::EnumIter;
+use std::{convert::TryFrom, hash::Hash};
+
+use strum::{EnumIter, IntoEnumIterator};
 
 #[derive(Clone, PartialEq, Eq, Hash, EnumIter)]
 #[allow(non_camel_case_types)]
diff --git a/src/commonMain/rust/model/addons.rs b/src/commonMain/rust/model/addons.rs
index a314a18..58c9de1 100644
--- a/src/commonMain/rust/model/addons.rs
+++ b/src/commonMain/rust/model/addons.rs
@@ -6,7 +6,7 @@ use stremio_core::runtime::{Effects, Env, UpdateWithCtx};
 use stremio_core::types::addon::DescriptorPreview;
 use stremio_core::types::profile::Profile;
 
-#[derive(Default)]
+#[derive(Default, Clone)]
 pub struct AddonsWithFilters {
     pub remote_addons: CatalogWithFilters<DescriptorPreview>,
     pub installed_addons: InstalledAddonsWithFilters,
diff --git a/src/commonMain/rust/model/fields/continue_watching_preview.rs b/src/commonMain/rust/model/fields/continue_watching_preview.rs
index baaad17..c95c9d2 100644
--- a/src/commonMain/rust/model/fields/continue_watching_preview.rs
+++ b/src/commonMain/rust/model/fields/continue_watching_preview.rs
@@ -6,7 +6,7 @@ use crate::protobuf::stremio::core::models;
 impl ToProtobuf<models::ContinueWatchingPreview, ()> for ContinueWatchingPreview {
     fn to_protobuf(&self, _args: &()) -> models::ContinueWatchingPreview {
         models::ContinueWatchingPreview {
-            library_items: self.library_items.to_protobuf(&()),
+            items: self.items.to_protobuf(todo!()),
         }
     }
 }
diff --git a/src/commonMain/rust/model/fields/library.rs b/src/commonMain/rust/model/fields/library.rs
index ffa1fce..f8646c4 100644
--- a/src/commonMain/rust/model/fields/library.rs
+++ b/src/commonMain/rust/model/fields/library.rs
@@ -26,7 +26,8 @@ impl FromProtobuf<LibraryRequest> for models::library_with_filters::LibraryReque
         let page = LibraryRequestPage(NonZeroUsize::new(page).unwrap());
         LibraryRequest {
             r#type: self.r#type.to_owned(),
-            sort: models::library_with_filters::Sort::from_i32(self.sort)
+            sort: models::library_with_filters::Sort::try_from(self.sort)
+                .ok()
                 .from_protobuf()
                 .unwrap_or(Sort::LastWatched),
             page,
@@ -114,7 +115,7 @@ impl<F> ToProtobuf<models::LibraryWithFilters, ()> for LibraryWithFilters<F> {
         models::LibraryWithFilters {
             selected: self.selected.to_protobuf(&()),
             selectable: self.selectable.to_protobuf(&()),
-            catalog: self.catalog.to_protobuf(&()),
+            catalog: self.catalog.to_protobuf(todo!("Args")),
         }
     }
 }
diff --git a/src/commonMain/rust/model/fields/library_by_type.rs b/src/commonMain/rust/model/fields/library_by_type.rs
index bfc45f0..a4a86fc 100644
--- a/src/commonMain/rust/model/fields/library_by_type.rs
+++ b/src/commonMain/rust/model/fields/library_by_type.rs
@@ -9,7 +9,8 @@ use crate::protobuf::stremio::core::models;
 impl FromProtobuf<Selected> for models::library_by_type::Selected {
     fn from_protobuf(&self) -> Selected {
         Selected {
-            sort: models::library_with_filters::Sort::from_i32(self.sort)
+            sort: models::library_with_filters::Sort::try_from(self.sort)
+                .ok()
                 .from_protobuf()
                 .unwrap_or(Sort::LastWatched),
         }
@@ -46,7 +47,7 @@ impl ToProtobuf<models::LibraryCatalog, ()> for Catalog {
         let items = self
             .iter()
             .flatten()
-            .map(|item| item.to_protobuf(&()))
+            .map(|item| item.to_protobuf(todo!("Args")))
             .collect::<Vec<_>>();
         let r#type = items.first().map(|item| item.r#type.to_owned());
         models::LibraryCatalog { r#type, items }
diff --git a/src/commonMain/rust/model/fields/meta_details.rs b/src/commonMain/rust/model/fields/meta_details.rs
index ec1b0bc..4c5eb62 100644
--- a/src/commonMain/rust/model/fields/meta_details.rs
+++ b/src/commonMain/rust/model/fields/meta_details.rs
@@ -17,6 +17,7 @@ impl FromProtobuf<Selected> for models::meta_details::Selected {
         Selected {
             meta_path: self.meta_path.from_protobuf(),
             stream_path: self.stream_path.from_protobuf(),
+            guess_stream: self.guess_stream,
         }
     }
 }
@@ -26,6 +27,7 @@ impl ToProtobuf<models::meta_details::Selected, ()> for Selected {
         models::meta_details::Selected {
             meta_path: self.meta_path.to_protobuf(&()),
             stream_path: self.stream_path.to_protobuf(&()),
+            guess_stream: self.guess_stream,
         }
     }
 }
@@ -39,6 +41,15 @@ impl ToProtobuf<types::video::SeriesInfo, ()> for SeriesInfo {
     }
 }
 
+impl FromProtobuf<SeriesInfo> for types::video::SeriesInfo {
+    fn from_protobuf(&self) -> SeriesInfo {
+        SeriesInfo {
+            season: self.season.unsigned_abs() as u32,
+            episode: self.episode.unsigned_abs() as u32,
+        }
+    }
+}
+
 impl
     ToProtobuf<
         types::Video,
@@ -65,6 +76,8 @@ impl
             thumbnail: self.thumbnail.clone(),
             streams: self.streams.to_protobuf(&(None, *addon_name, None, None)),
             series_info: self.series_info.to_protobuf(&()),
+            // trailer_streams: self.trailer_streams.to_protobuf(&()),
+            trailer_streams: todo!(),
             upcoming: self
                 .released
                 .map(|released| released > AndroidEnv::now())
@@ -80,6 +93,23 @@ impl
     }
 }
 
+impl FromProtobuf<Video> for types::Video {
+    fn from_protobuf(&self) -> Video {
+        Video {
+            id: self.id.to_owned(),
+            title: self.title.to_owned(),
+            released: self.released.to_owned().from_protobuf(),
+            overview: self.overview.to_owned(),
+            thumbnail: self.thumbnail.to_owned(),
+            streams: self.streams.to_owned().from_protobuf(),
+            series_info: self.series_info.to_owned().from_protobuf(),
+            // trailer_streams: self.trailer_streams.to_owned(),
+            // TODO: implement trailer streams!
+            trailer_streams: vec![],
+        }
+    }
+}
+
 impl
     ToProtobuf<
         types::MetaItem,
diff --git a/src/commonMain/rust/model/fields/player.rs b/src/commonMain/rust/model/fields/player.rs
index e740afa..400b9ff 100644
--- a/src/commonMain/rust/model/fields/player.rs
+++ b/src/commonMain/rust/model/fields/player.rs
@@ -1,5 +1,6 @@
 use stremio_core::models::ctx::Ctx;
 use stremio_core::models::player::{Player, Selected, VideoParams};
+use stremio_core::types::streams::StreamsItemKey;
 
 use crate::bridge::{FromProtobuf, ToProtobuf};
 use crate::protobuf::stremio::core::models;
@@ -11,7 +12,6 @@ impl FromProtobuf<Selected> for models::player::Selected {
             stream_request: self.stream_request.from_protobuf(),
             meta_request: self.meta_request.from_protobuf(),
             subtitles_path: self.subtitles_path.from_protobuf(),
-            video_params: self.video_params.from_protobuf(),
         }
     }
 }
@@ -50,15 +50,28 @@ impl ToProtobuf<models::player::Selected, Ctx> for Selected {
             stream_request: self.stream_request.to_protobuf(&()),
             meta_request: self.meta_request.to_protobuf(&()),
             subtitles_path: self.subtitles_path.to_protobuf(&()),
-            video_params: self.video_params.to_protobuf(&()),
         }
     }
 }
 
 impl ToProtobuf<models::Player, Ctx> for Player {
     fn to_protobuf(&self, ctx: &Ctx) -> models::Player {
+
+
+        // let stream_item = ctx.streams.items.get(StreamsItemKey { meta_id: self.selected.map(|selected| selected.meta_request.and_then) ), video_id: () });
+        
+        // let streaming_server_url = match ctx.streaming_server.base_url.clone() {
+        //     Loadable::Ready(url) => Some(url),
+        //     _ => None,
+        // };
+        // let meta_item_id = self.meta_item.map(|meta_item| meta_item.request.path.id.clone());
+        // let meta_item_id = self.vi.and_then(|meta_item| meta_item.request.path.id.clone());
+        // let stream_item = ctx.streams.items.get(StreamsItemKey { meta_id: self., video_id: () });
+
+
         models::Player {
             selected: self.selected.to_protobuf(ctx),
+            video_params: self.video_params.to_protobuf(&()),
             meta_item: self.meta_item.as_ref().to_protobuf(&(
                 ctx,
                 self.library_item.as_ref(),
@@ -71,7 +84,7 @@ impl ToProtobuf<models::Player, Ctx> for Player {
                 None,
             )),
             series_info: self.series_info.to_protobuf(&()),
-            library_item: self.library_item.to_protobuf(&()),
+            library_item: todo!(), //self.library_item.to_protobuf(&()),
         }
     }
 }
diff --git a/src/commonMain/rust/model/model.rs b/src/commonMain/rust/model/model.rs
index 1441ea2..ed20f4e 100644
--- a/src/commonMain/rust/model/model.rs
+++ b/src/commonMain/rust/model/model.rs
@@ -13,15 +13,17 @@ use stremio_core::models::streaming_server::StreamingServer;
 use stremio_core::runtime::Effects;
 use stremio_core::types::api::LinkAuthKey;
 use stremio_core::types::library::LibraryBucket;
+use stremio_core::types::notifications::NotificationsBucket;
 use stremio_core::types::profile::Profile;
 use stremio_core::types::resource::MetaItemPreview;
-use stremio_derive::Model;
+use stremio_core::types::streams::StreamsBucket;
+use stremio_core::Model;
 
 use crate::bridge::ToProtobuf;
 use crate::env::AndroidEnv;
 use crate::model::AddonsWithFilters;
 
-#[derive(Model)]
+#[derive(Model, Clone)]
 #[model(AndroidEnv)]
 pub struct AndroidModel {
     pub ctx: Ctx,
@@ -40,12 +42,20 @@ pub struct AndroidModel {
 }
 
 impl AndroidModel {
-    pub fn new(profile: Profile, library: LibraryBucket) -> (AndroidModel, Effects) {
-        let ctx = Ctx::new(profile, library);
+    pub fn new(
+        profile: Profile,
+        library: LibraryBucket,
+        streams: StreamsBucket,
+        notifications: NotificationsBucket,
+    ) -> (AndroidModel, Effects) {
         let (continue_watching_preview, continue_watching_preview_effects) =
-            ContinueWatchingPreview::new(&ctx.library);
+            ContinueWatchingPreview::new(&library, &notifications);
+
+        let ctx = Ctx::new(profile, library, streams, notifications);
+
         let (discover, discover_effects) = CatalogWithFilters::<MetaItemPreview>::new(&ctx.profile);
-        let (library_, library_effects) = LibraryWithFilters::<NotRemovedFilter>::new(&ctx.library);
+        let (library_, library_effects) =
+            LibraryWithFilters::<NotRemovedFilter>::new(&ctx.library, &ctx.notifications);
         let (library_by_type, library_by_type_effects) = LibraryByType::<NotRemovedFilter>::new();
         let (addons, addons_effects) = AddonsWithFilters::new(&ctx.profile);
         let (streaming_server, streaming_server_effects) =
@@ -104,4 +114,4 @@ impl AndroidModel {
             AndroidModelField::Player => self.player.to_protobuf(&self.ctx).encode_to_vec(),
         }
     }
-}
+}
\ No newline at end of file
diff --git a/src/commonMain/rust/stremio_core_android.rs b/src/commonMain/rust/stremio_core_android.rs
index f123490..03a71e3 100644
--- a/src/commonMain/rust/stremio_core_android.rs
+++ b/src/commonMain/rust/stremio_core_android.rs
@@ -12,13 +12,16 @@ use jni::{JNIEnv, JavaVM};
 use lazy_static::lazy_static;
 use prost::Message;
 use stremio_core::constants::{
-    LIBRARY_RECENT_STORAGE_KEY, LIBRARY_STORAGE_KEY, PROFILE_STORAGE_KEY,
+    LIBRARY_RECENT_STORAGE_KEY, LIBRARY_STORAGE_KEY, NOTIFICATIONS_STORAGE_KEY,
+    PROFILE_STORAGE_KEY, STREAMS_STORAGE_KEY,
 };
 use stremio_core::models::common::Loadable;
 use stremio_core::runtime::{Env, EnvError, Runtime, RuntimeEvent};
 use stremio_core::types::library::LibraryBucket;
+use stremio_core::types::notifications::NotificationsBucket;
 use stremio_core::types::profile::Profile;
 use stremio_core::types::resource::Stream;
+use stremio_core::types::streams::StreamsBucket;
 
 use crate::bridge::{FromProtobuf, ToJNIByteArray, ToProtobuf};
 use crate::env::{AndroidEnv, AndroidEvent, KotlinClassName};
@@ -55,13 +58,15 @@ pub unsafe extern "C" fn Java_com_stremio_core_Core_initializeNative(
     let init_result = AndroidEnv::exec_sync(AndroidEnv::init(&env, storage));
     match init_result {
         Ok(_) => {
-            let storage_result = AndroidEnv::exec_sync(future::try_join3(
+            let storage_result = AndroidEnv::exec_sync(future::try_join5(
                 AndroidEnv::get_storage::<Profile>(PROFILE_STORAGE_KEY),
                 AndroidEnv::get_storage::<LibraryBucket>(LIBRARY_RECENT_STORAGE_KEY),
                 AndroidEnv::get_storage::<LibraryBucket>(LIBRARY_STORAGE_KEY),
+                AndroidEnv::get_storage::<StreamsBucket>(STREAMS_STORAGE_KEY),
+                AndroidEnv::get_storage::<NotificationsBucket>(NOTIFICATIONS_STORAGE_KEY),
             ));
             match storage_result {
-                Ok((profile, recent_bucket, other_bucket)) => {
+                Ok((profile, recent_bucket, other_bucket, streams, notifications)) => {
                     let profile = profile.unwrap_or_default();
                     let mut library = LibraryBucket::new(profile.uid(), vec![]);
                     if let Some(recent_bucket) = recent_bucket {
@@ -70,7 +75,14 @@ pub unsafe extern "C" fn Java_com_stremio_core_Core_initializeNative(
                     if let Some(other_bucket) = other_bucket {
                         library.merge_bucket(other_bucket);
                     };
-                    let (model, effects) = AndroidModel::new(profile, library);
+                    let streams = streams.unwrap_or(StreamsBucket::new(profile.uid()));
+                    let notifications = notifications.unwrap_or(NotificationsBucket::new::<
+                        AndroidEnv,
+                    >(
+                        profile.uid(), vec![]
+                    ));
+                    let (model, effects) =
+                        AndroidModel::new(profile, library, streams, notifications);
                     let (runtime, rx) = Runtime::<AndroidEnv, _>::new(
                         model,
                         effects.into_iter().collect::<Vec<_>>(),
@@ -169,7 +181,7 @@ pub unsafe extern "C" fn Java_com_stremio_core_Core_getStateNative(
         .call_method(field, "getValue", "()I", &[])
         .and_then(|result| result.i())
         .ok()
-        .and_then(|result| Field::from_i32(result).from_protobuf())
+        .and_then(|result| Field::try_from(result).ok().from_protobuf())
         .expect("AndroidModelField convert failed");
     let runtime = RUNTIME.read().expect("RUNTIME read failed");
     let runtime = runtime
@@ -209,4 +221,4 @@ pub unsafe extern "C" fn Java_com_stremio_core_Core_sendNextAnalyticsBatch(
     _class: JClass,
 ) {
     AndroidEnv::exec_concurrent(AndroidEnv::send_next_analytics_batch());
-}
+}
\ No newline at end of file
diff --git a/src/main/proto/stremio/core/models/continue_watching_preview.proto b/src/main/proto/stremio/core/models/continue_watching_preview.proto
index c98f373..1b54017 100644
--- a/src/main/proto/stremio/core/models/continue_watching_preview.proto
+++ b/src/main/proto/stremio/core/models/continue_watching_preview.proto
@@ -6,6 +6,22 @@ option java_package = "com.stremio.core.models";
 
 import "stremio/core/types/library.proto";
 
+import "stremio/core/types/meta_item.proto";
+
+message ContinueWatchingItem {
+  required string id = 1;
+  required string type = 2;
+  required string name = 3;
+  optional string poster = 4;
+  required stremio.core.types.PosterShape poster_shape = 5;
+  required stremio.core.types.LibraryItemState state = 6;
+  required stremio.core.types.MetaItemBehaviorHints behavior_hints = 7;
+  required stremio.core.types.MetaItemDeepLinks deep_links = 8;
+  optional double progress = 9;
+  required bool watched = 10;
+  required uint64 notifications = 11;
+}
+
 message ContinueWatchingPreview {
-  repeated stremio.core.types.LibraryItem library_items = 1;
+  repeated ContinueWatchingItem items = 1;
 }
\ No newline at end of file
diff --git a/src/main/proto/stremio/core/models/meta_details.proto b/src/main/proto/stremio/core/models/meta_details.proto
index c5058f9..0f3cfc0 100644
--- a/src/main/proto/stremio/core/models/meta_details.proto
+++ b/src/main/proto/stremio/core/models/meta_details.proto
@@ -18,6 +18,7 @@ message MetaDetails {
   message Selected {
     required stremio.core.types.ResourcePath meta_path = 1;
     optional stremio.core.types.ResourcePath stream_path = 2;
+    required bool guess_stream = 3;
   }
 }
 
diff --git a/src/main/proto/stremio/core/models/player.proto b/src/main/proto/stremio/core/models/player.proto
index 8881078..c4ab831 100644
--- a/src/main/proto/stremio/core/models/player.proto
+++ b/src/main/proto/stremio/core/models/player.proto
@@ -15,11 +15,12 @@ import "stremio/core/types/video.proto";
 
 message Player {
   optional Selected selected = 1;
-  optional LoadableMetaItem meta_item = 2;
-  repeated LoadableSubtitles subtitles = 3;
-  optional stremio.core.types.Video next_video = 4;
-  optional stremio.core.types.Video.SeriesInfo series_info = 5;
-  optional stremio.core.types.LibraryItem library_item = 6;
+  optional VideoParams video_params = 2;
+  optional LoadableMetaItem meta_item = 3;
+  repeated LoadableSubtitles subtitles = 4;
+  optional stremio.core.types.Video next_video = 5;
+  optional stremio.core.types.Video.SeriesInfo series_info = 6;
+  optional stremio.core.types.LibraryItem library_item = 7;
 
   message VideoParams {
     optional string hash = 1;
@@ -30,7 +31,6 @@ message Player {
     optional stremio.core.types.ResourceRequest stream_request = 2;
     optional stremio.core.types.ResourceRequest meta_request = 3;
     optional stremio.core.types.ResourcePath subtitles_path = 4;
-    optional VideoParams video_params = 5;
   }
 }
 
diff --git a/src/main/proto/stremio/core/runtime/action_meta_details.proto b/src/main/proto/stremio/core/runtime/action_meta_details.proto
index 904d3e1..9d39335 100644
--- a/src/main/proto/stremio/core/runtime/action_meta_details.proto
+++ b/src/main/proto/stremio/core/runtime/action_meta_details.proto
@@ -6,6 +6,8 @@ option java_package = "com.stremio.core.runtime.msg";
 
 import "google/protobuf/empty.proto";
 
+import "stremio/core/types/video.proto";
+
 message ActionMetaDetails {
   oneof args {
     bool mark_as_watched = 1;
@@ -13,7 +15,7 @@ message ActionMetaDetails {
   }
 
   message VideoState {
-    required string video_id = 1;
+    required stremio.core.types.Video video = 1;
     required bool is_watched = 2;
   }
 }
\ No newline at end of file
diff --git a/src/main/proto/stremio/core/runtime/event.proto b/src/main/proto/stremio/core/runtime/event.proto
index 0505c5e..55f1ab3 100644
--- a/src/main/proto/stremio/core/runtime/event.proto
+++ b/src/main/proto/stremio/core/runtime/event.proto
@@ -11,33 +11,37 @@ message Event {
   oneof type {
     ProfilePushedToStorage profile_pushed_to_storage = 1;
     LibraryItemsPushedToStorage library_items_pushed_to_storage = 2;
-    UserPulledFromAPI user_pulled_from_api = 3;
-    UserPushedToAPI user_pushed_to_api = 4;
-    AddonsPulledFromAPI addons_pulled_from_api = 5;
-    AddonsPushedToAPI addons_pushed_to_api = 6;
-    LibrarySyncWithAPIPlanned library_sync_with_api_planned = 7;
-    LibraryItemsPushedToAPI library_items_pushed_to_api = 8;
-    LibraryItemsPulledFromAPI library_items_pulled_from_api = 9;
-    UserAuthenticated user_authenticated = 10;
-    UserLoggedOut user_logged_out = 11;
-    SessionDeleted session_deleted = 12;
-    TraktAddonFetched trakt_addon_fetched = 13;
-    TraktLoggedOut trakt_logged_out = 14;
-    AddonInstalled addon_installed = 15;
-    AddonUpgraded addon_upgraded = 16;
-    AddonUninstalled addon_uninstalled = 17;
-    SettingsUpdated settings_updated = 18;
-    LibraryItemAdded library_item_added = 19;
-    LibraryItemRemoved library_item_removed = 20;
-    LibraryItemRewinded library_item_rewinded = 21;
-    PlayerPlaying player_playing = 22;
-    PlayerStopped player_stopped = 23;
-    PlayerEnded player_ended = 24;
-    TraktPlaying trakt_playing = 25;
-    TraktPaused trakt_paused = 26;
-    MagnetParsed magnet_parsed = 27;
-    TorrentParsed torrent_parsed = 28;
-    PlayingOnDevice playing_on_device = 29;
+    StreamsPushedToStorage streams_pushed_to_storage = 3;
+    NotificationsPushedToStorage notifications_pushed_to_storage = 4;
+    UserPulledFromAPI user_pulled_from_api = 5;
+    UserPushedToAPI user_pushed_to_api = 6;
+    AddonsPulledFromAPI addons_pulled_from_api = 7;
+    AddonsPushedToAPI addons_pushed_to_api = 8;
+    LibrarySyncWithAPIPlanned library_sync_with_api_planned = 9;
+    LibraryItemsPushedToAPI library_items_pushed_to_api = 10;
+    LibraryItemsPulledFromAPI library_items_pulled_from_api = 11;
+    UserAuthenticated user_authenticated = 12;
+    UserLoggedOut user_logged_out = 13;
+    SessionDeleted session_deleted = 14;
+    TraktAddonFetched trakt_addon_fetched = 15;
+    TraktLoggedOut trakt_logged_out = 16;
+    AddonInstalled addon_installed = 17;
+    AddonUpgraded addon_upgraded = 18;
+    AddonUninstalled addon_uninstalled = 19;
+    SettingsUpdated settings_updated = 20;
+    LibraryItemAdded library_item_added = 21;
+    LibraryItemRemoved library_item_removed = 22;
+    LibraryItemRewinded library_item_rewinded = 23;
+    LibraryItemNotificationsToggled library_item_notifications_toggled = 24;
+    NotificationsDismissed notifications_dismissed = 25;
+    PlayerPlaying player_playing = 26;
+    PlayerStopped player_stopped = 27;
+    PlayerEnded player_ended = 28;
+    TraktPlaying trakt_playing = 29;
+    TraktPaused trakt_paused = 30;
+    MagnetParsed magnet_parsed = 31;
+    TorrentParsed torrent_parsed = 32;
+    PlayingOnDevice playing_on_device = 33;
     Error error = 100;
   }
 
@@ -47,6 +51,12 @@ message Event {
   message LibraryItemsPushedToStorage {
     repeated string ids = 1;
   }
+  message StreamsPushedToStorage {
+    optional string uid = 1;
+  }
+  message NotificationsPushedToStorage {
+    repeated string ids = 1;
+  }
   message UserPulledFromAPI {
     optional string uid = 1;
   }
@@ -108,6 +118,12 @@ message Event {
   message LibraryItemRewinded {
     required string id = 1;
   }
+  message LibraryItemNotificationsToggled {
+    required string id = 1;
+  }
+  message NotificationsDismissed {
+    required string id = 1;
+  }
   message PlayerPlaying {
     // Empty
   }
diff --git a/src/main/proto/stremio/core/runtime/event.proto.orig b/src/main/proto/stremio/core/runtime/event.proto.orig
new file mode 100644
index 0000000..6d3b0fb
--- /dev/null
+++ b/src/main/proto/stremio/core/runtime/event.proto.orig
@@ -0,0 +1,184 @@
+syntax = "proto2";
+
+package stremio.core.runtime;
+
+option java_package = "com.stremio.core.runtime.msg";
+
+import "stremio/core/types/profile.proto";
+import "stremio/core/types/auth_request.proto";
+
+message Event {
+  oneof type {
+    ProfilePushedToStorage profile_pushed_to_storage = 1;
+    LibraryItemsPushedToStorage library_items_pushed_to_storage = 2;
+<<<<<<< HEAD
+    UserPulledFromAPI user_pulled_from_api = 3;
+    UserPushedToAPI user_pushed_to_api = 4;
+    AddonsPulledFromAPI addons_pulled_from_api = 5;
+    AddonsPushedToAPI addons_pushed_to_api = 6;
+    LibrarySyncWithAPIPlanned library_sync_with_api_planned = 7;
+    LibraryItemsPushedToAPI library_items_pushed_to_api = 8;
+    LibraryItemsPulledFromAPI library_items_pulled_from_api = 9;
+    UserAuthenticated user_authenticated = 10;
+    UserLoggedOut user_logged_out = 11;
+    SessionDeleted session_deleted = 12;
+    TraktAddonFetched trakt_addon_fetched = 13;
+    TraktLoggedOut trakt_logged_out = 14;
+    AddonInstalled addon_installed = 15;
+    AddonUpgraded addon_upgraded = 16;
+    AddonUninstalled addon_uninstalled = 17;
+    SettingsUpdated settings_updated = 18;
+    LibraryItemAdded library_item_added = 19;
+    LibraryItemRemoved library_item_removed = 20;
+    LibraryItemRewinded library_item_rewinded = 21;
+    PlayerPlaying player_playing = 22;
+    PlayerStopped player_stopped = 23;
+    PlayerEnded player_ended = 24;
+    TraktPlaying trakt_playing = 25;
+    TraktPaused trakt_paused = 26;
+    MagnetParsed magnet_parsed = 27;
+    TorrentParsed torrent_parsed = 28;
+    PlayingOnDevice playing_on_device = 29;
+=======
+    StreamsPushedToStorage streams_pushed_to_storage = 3;
+    NotificationsPushedToStorage notifications_pushed_to_storage = 4;
+    UserPulledFromAPI user_pulled_from_api = 5;
+    UserPushedToAPI user_pushed_to_api = 6;
+    AddonsPulledFromAPI addons_pulled_from_api = 7;
+    AddonsPushedToAPI addons_pushed_to_api = 8;
+    LibrarySyncWithAPIPlanned library_sync_with_api_planned = 9;
+    LibraryItemsPushedToAPI library_items_pushed_to_api = 10;
+    LibraryItemsPulledFromAPI library_items_pulled_from_api = 11;
+    UserAuthenticated user_authenticated = 12;
+    UserLoggedOut user_logged_out = 13;
+    SessionDeleted session_deleted = 14;
+    TraktAddonFetched trakt_addon_fetched = 15;
+    TraktLoggedOut trakt_logged_out = 16;
+    AddonInstalled addon_installed = 17;
+    AddonUpgraded addon_upgraded = 18;
+    AddonUninstalled addon_uninstalled = 19;
+    SettingsUpdated settings_updated = 20;
+    LibraryItemAdded library_item_added = 21;
+    LibraryItemRemoved library_item_removed = 22;
+    LibraryItemRewinded library_item_rewinded = 23;
+    LibraryItemNotificationsToggled library_item_notifications_toggled = 24;
+    NotificationsDismissed notifications_dismissed = 25;
+    PlayerPlaying player_playing = 26;
+    PlayerStopped player_stopped = 27;
+    PlayerEnded player_ended = 28;
+    TraktPlaying trakt_playing = 29;
+    TraktPaused trakt_paused = 30;
+    MagnetParsed magnet_parsed = 31;
+    TorrentParsed torrent_parsed = 32;
+    PlayingOnDevice playing_on_device = 33;
+>>>>>>> 0b39eef (chore: Add missing runtime events for notifications)
+    Error error = 100;
+  }
+
+  message ProfilePushedToStorage {
+    optional string uid = 1;
+  }
+  message LibraryItemsPushedToStorage {
+    repeated string ids = 1;
+  }
+  message UserPulledFromAPI {
+    optional string uid = 1;
+  }
+  message UserPushedToAPI {
+    optional string uid = 1;
+  }
+  message AddonsPulledFromAPI {
+    repeated string transport_urls = 1;
+  }
+  message AddonsPushedToAPI {
+    repeated string transport_urls = 1;
+  }
+  message LibrarySyncWithAPIPlanned {
+    optional string uid = 1;
+    required PlanPair plan = 2;
+  }
+  message LibraryItemsPushedToAPI {
+    repeated string ids = 1;
+  }
+  message LibraryItemsPulledFromAPI {
+    repeated string ids = 1;
+  }
+  message UserAuthenticated {
+    required stremio.core.types.AuthRequest auth_request = 1;
+  }
+  message UserLoggedOut {
+    optional string uid = 1;
+  }
+  message SessionDeleted {
+    required string auth_key = 1;
+  }
+  message TraktAddonFetched {
+    optional string uid = 1;
+  }
+  message TraktLoggedOut {
+    optional string uid = 1;
+  }
+  message AddonInstalled {
+    required string transport_url = 1;
+    required string id = 2;
+  }
+  message AddonUpgraded {
+    required string transport_url = 1;
+    required string id = 2;
+  }
+  message AddonUninstalled {
+    required string transport_url = 1;
+    required string id = 2;
+  }
+  message SettingsUpdated {
+    required stremio.core.types.Profile.Settings settings = 1;
+  }
+  message LibraryItemAdded {
+    required string id = 1;
+  }
+  message LibraryItemRemoved {
+    required string id = 1;
+  }
+  message LibraryItemRewinded {
+    required string id = 1;
+  }
+  message LibraryItemNotificationsToggled {
+    required string id = 1;
+  }
+  message NotificationsDismissed {
+    required string id = 1;
+  }
+  message PlayerPlaying {
+    // Empty
+  }
+  message PlayerStopped {
+    // Empty
+  }
+  message PlayerEnded {
+    // Empty
+  }
+  message TraktPlaying {
+    // Empty
+  }
+  message TraktPaused {
+    // Empty
+  }
+  message MagnetParsed {
+    required string magnet = 1;
+  }
+  message TorrentParsed {
+    required bytes torrent = 1;
+  }
+  message PlayingOnDevice {
+    required string device = 1;
+  }
+  message Error {
+    required string error = 1;
+    required Event source = 2;
+  }
+}
+
+message PlanPair {
+  repeated string first = 1;
+  repeated string second = 2;
+}
\ No newline at end of file
diff --git a/src/main/proto/stremio/core/types/profile.proto b/src/main/proto/stremio/core/types/profile.proto
index 3303b1e..19ccd09 100644
--- a/src/main/proto/stremio/core/types/profile.proto
+++ b/src/main/proto/stremio/core/types/profile.proto
@@ -27,12 +27,15 @@ message Profile {
     required string subtitles_text_color = 14;
     required string subtitles_background_color = 15;
     required string subtitles_outline_color = 16;
-    required int64 seek_time_duration = 17;
-    optional string secondary_audio_language = 18;
-    optional string secondary_subtitles_language = 19;
-    optional string player_type = 20;
-    required FrameRateMatchingStrategy frame_rate_matching_strategy = 21;
-    required int64 next_video_notification_duration = 22;
+    required bool esc_exit_fullscreen = 17;
+    required int64 seek_time_duration = 18;
+    required int64 seek_short_time_duration = 19;
+    required bool pause_on_minimize = 20;
+    optional string secondary_audio_language = 21;
+    optional string secondary_subtitles_language = 22;
+    optional string player_type = 23;
+    required FrameRateMatchingStrategy frame_rate_matching_strategy = 24;
+    required int64 next_video_notification_duration = 25;
   }
 
   enum FrameRateMatchingStrategy {
diff --git a/src/main/proto/stremio/core/types/video.proto b/src/main/proto/stremio/core/types/video.proto
index c507d84..36e75cc 100644
--- a/src/main/proto/stremio/core/types/video.proto
+++ b/src/main/proto/stremio/core/types/video.proto
@@ -15,9 +15,11 @@ message Video {
   optional string thumbnail = 5;
   repeated Stream streams = 6;
   optional SeriesInfo seriesInfo = 7;
-  required bool upcoming = 8;
-  required bool watched = 9;
-  required bool current_video = 10;
+  // TODO: Add trailer streams
+  repeated Stream trailer_streams = 8;
+  required bool upcoming = 9;
+  required bool watched = 10;
+  required bool current_video = 11;
 
   message SeriesInfo {
     required int64 season = 1;

From bb12cf8cd1135357c1865d9c78ebf6f4613b8a4c Mon Sep 17 00:00:00 2001
From: Lachezar Lechev <lachezar@ambire.com>
Date: Tue, 31 Oct 2023 09:24:12 +0200
Subject: [PATCH 2/8] chore(ci): bump MSRV in build action

Signed-off-by: Lachezar Lechev <lachezar@ambire.com>
---
 .github/workflows/build.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 28d7404..447bd69 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -12,7 +12,7 @@ jobs:
       - name: Checkout
         uses: actions/checkout@v2
       - name: Set default rust toolchain
-        run: rustup default 1.61.0
+        run: rustup default 1.67.1
       - name: Install rustfmt
         run: rustup component add rustfmt
       - name: Install clippy

From 1d1fd9432c0765bf0abbd4f4cf06066794e89769 Mon Sep 17 00:00:00 2001
From: Lachezar Lechev <lachezar@ambire.com>
Date: Wed, 1 Nov 2023 15:45:11 +0200
Subject: [PATCH 3/8] chore: remove event.proto.orig

Signed-off-by: Lachezar Lechev <lachezar@ambire.com>
---
 .../stremio/core/runtime/event.proto.orig     | 184 ------------------
 1 file changed, 184 deletions(-)
 delete mode 100644 src/main/proto/stremio/core/runtime/event.proto.orig

diff --git a/src/main/proto/stremio/core/runtime/event.proto.orig b/src/main/proto/stremio/core/runtime/event.proto.orig
deleted file mode 100644
index 6d3b0fb..0000000
--- a/src/main/proto/stremio/core/runtime/event.proto.orig
+++ /dev/null
@@ -1,184 +0,0 @@
-syntax = "proto2";
-
-package stremio.core.runtime;
-
-option java_package = "com.stremio.core.runtime.msg";
-
-import "stremio/core/types/profile.proto";
-import "stremio/core/types/auth_request.proto";
-
-message Event {
-  oneof type {
-    ProfilePushedToStorage profile_pushed_to_storage = 1;
-    LibraryItemsPushedToStorage library_items_pushed_to_storage = 2;
-<<<<<<< HEAD
-    UserPulledFromAPI user_pulled_from_api = 3;
-    UserPushedToAPI user_pushed_to_api = 4;
-    AddonsPulledFromAPI addons_pulled_from_api = 5;
-    AddonsPushedToAPI addons_pushed_to_api = 6;
-    LibrarySyncWithAPIPlanned library_sync_with_api_planned = 7;
-    LibraryItemsPushedToAPI library_items_pushed_to_api = 8;
-    LibraryItemsPulledFromAPI library_items_pulled_from_api = 9;
-    UserAuthenticated user_authenticated = 10;
-    UserLoggedOut user_logged_out = 11;
-    SessionDeleted session_deleted = 12;
-    TraktAddonFetched trakt_addon_fetched = 13;
-    TraktLoggedOut trakt_logged_out = 14;
-    AddonInstalled addon_installed = 15;
-    AddonUpgraded addon_upgraded = 16;
-    AddonUninstalled addon_uninstalled = 17;
-    SettingsUpdated settings_updated = 18;
-    LibraryItemAdded library_item_added = 19;
-    LibraryItemRemoved library_item_removed = 20;
-    LibraryItemRewinded library_item_rewinded = 21;
-    PlayerPlaying player_playing = 22;
-    PlayerStopped player_stopped = 23;
-    PlayerEnded player_ended = 24;
-    TraktPlaying trakt_playing = 25;
-    TraktPaused trakt_paused = 26;
-    MagnetParsed magnet_parsed = 27;
-    TorrentParsed torrent_parsed = 28;
-    PlayingOnDevice playing_on_device = 29;
-=======
-    StreamsPushedToStorage streams_pushed_to_storage = 3;
-    NotificationsPushedToStorage notifications_pushed_to_storage = 4;
-    UserPulledFromAPI user_pulled_from_api = 5;
-    UserPushedToAPI user_pushed_to_api = 6;
-    AddonsPulledFromAPI addons_pulled_from_api = 7;
-    AddonsPushedToAPI addons_pushed_to_api = 8;
-    LibrarySyncWithAPIPlanned library_sync_with_api_planned = 9;
-    LibraryItemsPushedToAPI library_items_pushed_to_api = 10;
-    LibraryItemsPulledFromAPI library_items_pulled_from_api = 11;
-    UserAuthenticated user_authenticated = 12;
-    UserLoggedOut user_logged_out = 13;
-    SessionDeleted session_deleted = 14;
-    TraktAddonFetched trakt_addon_fetched = 15;
-    TraktLoggedOut trakt_logged_out = 16;
-    AddonInstalled addon_installed = 17;
-    AddonUpgraded addon_upgraded = 18;
-    AddonUninstalled addon_uninstalled = 19;
-    SettingsUpdated settings_updated = 20;
-    LibraryItemAdded library_item_added = 21;
-    LibraryItemRemoved library_item_removed = 22;
-    LibraryItemRewinded library_item_rewinded = 23;
-    LibraryItemNotificationsToggled library_item_notifications_toggled = 24;
-    NotificationsDismissed notifications_dismissed = 25;
-    PlayerPlaying player_playing = 26;
-    PlayerStopped player_stopped = 27;
-    PlayerEnded player_ended = 28;
-    TraktPlaying trakt_playing = 29;
-    TraktPaused trakt_paused = 30;
-    MagnetParsed magnet_parsed = 31;
-    TorrentParsed torrent_parsed = 32;
-    PlayingOnDevice playing_on_device = 33;
->>>>>>> 0b39eef (chore: Add missing runtime events for notifications)
-    Error error = 100;
-  }
-
-  message ProfilePushedToStorage {
-    optional string uid = 1;
-  }
-  message LibraryItemsPushedToStorage {
-    repeated string ids = 1;
-  }
-  message UserPulledFromAPI {
-    optional string uid = 1;
-  }
-  message UserPushedToAPI {
-    optional string uid = 1;
-  }
-  message AddonsPulledFromAPI {
-    repeated string transport_urls = 1;
-  }
-  message AddonsPushedToAPI {
-    repeated string transport_urls = 1;
-  }
-  message LibrarySyncWithAPIPlanned {
-    optional string uid = 1;
-    required PlanPair plan = 2;
-  }
-  message LibraryItemsPushedToAPI {
-    repeated string ids = 1;
-  }
-  message LibraryItemsPulledFromAPI {
-    repeated string ids = 1;
-  }
-  message UserAuthenticated {
-    required stremio.core.types.AuthRequest auth_request = 1;
-  }
-  message UserLoggedOut {
-    optional string uid = 1;
-  }
-  message SessionDeleted {
-    required string auth_key = 1;
-  }
-  message TraktAddonFetched {
-    optional string uid = 1;
-  }
-  message TraktLoggedOut {
-    optional string uid = 1;
-  }
-  message AddonInstalled {
-    required string transport_url = 1;
-    required string id = 2;
-  }
-  message AddonUpgraded {
-    required string transport_url = 1;
-    required string id = 2;
-  }
-  message AddonUninstalled {
-    required string transport_url = 1;
-    required string id = 2;
-  }
-  message SettingsUpdated {
-    required stremio.core.types.Profile.Settings settings = 1;
-  }
-  message LibraryItemAdded {
-    required string id = 1;
-  }
-  message LibraryItemRemoved {
-    required string id = 1;
-  }
-  message LibraryItemRewinded {
-    required string id = 1;
-  }
-  message LibraryItemNotificationsToggled {
-    required string id = 1;
-  }
-  message NotificationsDismissed {
-    required string id = 1;
-  }
-  message PlayerPlaying {
-    // Empty
-  }
-  message PlayerStopped {
-    // Empty
-  }
-  message PlayerEnded {
-    // Empty
-  }
-  message TraktPlaying {
-    // Empty
-  }
-  message TraktPaused {
-    // Empty
-  }
-  message MagnetParsed {
-    required string magnet = 1;
-  }
-  message TorrentParsed {
-    required bytes torrent = 1;
-  }
-  message PlayingOnDevice {
-    required string device = 1;
-  }
-  message Error {
-    required string error = 1;
-    required Event source = 2;
-  }
-}
-
-message PlanPair {
-  repeated string first = 1;
-  repeated string second = 2;
-}
\ No newline at end of file

From 34737ba765739c6c9ae8a987c00ef1a3c671bdac Mon Sep 17 00:00:00 2001
From: Lachezar Lechev <lachezar@ambire.com>
Date: Wed, 1 Nov 2023 16:14:38 +0200
Subject: [PATCH 4/8] chore: PR review comments

Signed-off-by: Lachezar Lechev <lachezar@ambire.com>
---
 .../rust/bridge/continue_watching_item.rs     | 24 +++++++++++++------
 .../rust/model/fields/meta_details.rs         |  2 --
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/src/commonMain/rust/bridge/continue_watching_item.rs b/src/commonMain/rust/bridge/continue_watching_item.rs
index 5c528f1..ddf424b 100644
--- a/src/commonMain/rust/bridge/continue_watching_item.rs
+++ b/src/commonMain/rust/bridge/continue_watching_item.rs
@@ -9,13 +9,23 @@ use crate::protobuf::stremio::core::types;
 
 use super::ToProtobuf;
 
-impl ToProtobuf<models::ContinueWatchingItem, (Option<&StreamsItem>, Option<&Url>, &Settings)> for Item {
-    fn to_protobuf(&self, args: &(Option<&StreamsItem>, Option<&Url>, &Settings)) -> models::ContinueWatchingItem {
-        // Option<&StreamsItem>,
-        // Option<&Url>,
-        // &Settings,
-
-        let deep_links = LibraryItemDeepLinks::from((&self.library_item, args.0, args.1, args.2));
+impl ToProtobuf<models::ContinueWatchingItem, (Option<&StreamsItem>, Option<&Url>, &Settings)>
+    for Item
+{
+    fn to_protobuf(
+        &self,
+        (streams_item, streaming_server_url, settings): &(
+            Option<&StreamsItem>,
+            Option<&Url>,
+            &Settings,
+        ),
+    ) -> models::ContinueWatchingItem {
+        let deep_links = LibraryItemDeepLinks::from((
+            &self.library_item,
+            *streams_item,
+            *streaming_server_url,
+            *settings,
+        ));
         models::ContinueWatchingItem {
             id: self.library_item.id.to_string(),
             r#type: self.library_item.r#type.to_string(),
diff --git a/src/commonMain/rust/model/fields/meta_details.rs b/src/commonMain/rust/model/fields/meta_details.rs
index 4c5eb62..72aa1c2 100644
--- a/src/commonMain/rust/model/fields/meta_details.rs
+++ b/src/commonMain/rust/model/fields/meta_details.rs
@@ -76,8 +76,6 @@ impl
             thumbnail: self.thumbnail.clone(),
             streams: self.streams.to_protobuf(&(None, *addon_name, None, None)),
             series_info: self.series_info.to_protobuf(&()),
-            // trailer_streams: self.trailer_streams.to_protobuf(&()),
-            trailer_streams: todo!(),
             upcoming: self
                 .released
                 .map(|released| released > AndroidEnv::now())

From 6a78e1d4270b82a348697e49b76bae3aa9ef4227 Mon Sep 17 00:00:00 2001
From: Lachezar Lechev <lachezar@ambire.com>
Date: Wed, 1 Nov 2023 17:57:56 +0200
Subject: [PATCH 5/8] fix: add missing ActionPlayer

Signed-off-by: Lachezar Lechev <lachezar@ambire.com>
---
 src/commonMain/rust/bridge/action.rs                |  5 +++++
 .../proto/stremio/core/runtime/action_player.proto  | 13 ++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/commonMain/rust/bridge/action.rs b/src/commonMain/rust/bridge/action.rs
index 67fc5fc..1aaf1e8 100644
--- a/src/commonMain/rust/bridge/action.rs
+++ b/src/commonMain/rust/bridge/action.rs
@@ -159,6 +159,11 @@ impl FromProtobuf<Action> for runtime::Action {
                 }
             }
             Some(runtime::action::Type::Player(action_player)) => match &action_player.args {
+                Some(action_player::Args::VideoParamsChanged(video_params_changed)) => {
+                    Action::Player(ActionPlayer::VideoParamsChanged {
+                        video_params: video_params_changed.video_param.from_protobuf(),
+                    })
+                }
                 Some(action_player::Args::TimeChanged(item_state)) => {
                     Action::Player(ActionPlayer::TimeChanged {
                         time: item_state.time,
diff --git a/src/main/proto/stremio/core/runtime/action_player.proto b/src/main/proto/stremio/core/runtime/action_player.proto
index 1c6c875..e0d4989 100644
--- a/src/main/proto/stremio/core/runtime/action_player.proto
+++ b/src/main/proto/stremio/core/runtime/action_player.proto
@@ -6,11 +6,14 @@ option java_package = "com.stremio.core.runtime.msg";
 
 import "google/protobuf/empty.proto";
 
+import "stremio/core/models/player.proto";
+
 message ActionPlayer {
   oneof args {
-    PlayerItemState time_changed = 1;
-    bool paused_changed = 2;
-    google.protobuf.Empty ended = 3;
+    VideoParamsChanged video_params_changed = 1;
+    PlayerItemState time_changed = 2;
+    bool paused_changed = 3;
+    google.protobuf.Empty ended = 4;
   }
 
   message PlayerItemState {
@@ -18,4 +21,8 @@ message ActionPlayer {
     required uint64 duration = 2;
     required string device = 3;
   }
+
+  message VideoParamsChanged {
+    optional stremio.core.models.Player.VideoParams video_param = 1;
+  }
 }
\ No newline at end of file

From 145cec91c942fab72d7079b768d96767014394bf Mon Sep 17 00:00:00 2001
From: Lachezar Lechev <lachezar@ambire.com>
Date: Wed, 1 Nov 2023 17:59:12 +0200
Subject: [PATCH 6/8] fix: remove Video's trailer_streams

Signed-off-by: Lachezar Lechev <lachezar@ambire.com>
---
 src/main/proto/stremio/core/types/video.proto | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/main/proto/stremio/core/types/video.proto b/src/main/proto/stremio/core/types/video.proto
index 36e75cc..c507d84 100644
--- a/src/main/proto/stremio/core/types/video.proto
+++ b/src/main/proto/stremio/core/types/video.proto
@@ -15,11 +15,9 @@ message Video {
   optional string thumbnail = 5;
   repeated Stream streams = 6;
   optional SeriesInfo seriesInfo = 7;
-  // TODO: Add trailer streams
-  repeated Stream trailer_streams = 8;
-  required bool upcoming = 9;
-  required bool watched = 10;
-  required bool current_video = 11;
+  required bool upcoming = 8;
+  required bool watched = 9;
+  required bool current_video = 10;
 
   message SeriesInfo {
     required int64 season = 1;

From a418dbe96d75de0b00441c29b09d1b9a9358c21f Mon Sep 17 00:00:00 2001
From: TheBeastLT <pauliox@beyond.lt>
Date: Thu, 2 Nov 2023 14:52:41 +0200
Subject: [PATCH 7/8] add missing proto and rust mapping impl

---
 .github/workflows/release.yml                 |  2 +-
 src/commonMain/rust/bridge/action.rs          |  4 +-
 .../rust/bridge/continue_watching_item.rs     | 60 -------------------
 src/commonMain/rust/bridge/event.rs           |  2 +-
 src/commonMain/rust/bridge/library_item.rs    | 26 ++++----
 src/commonMain/rust/bridge/mod.rs             |  3 -
 .../model/fields/continue_watching_preview.rs | 17 ++++--
 src/commonMain/rust/model/fields/library.rs   |  7 ++-
 .../rust/model/fields/library_by_type.rs      | 13 ++--
 .../rust/model/fields/meta_details.rs         |  4 +-
 src/commonMain/rust/model/fields/player.rs    | 16 +----
 src/commonMain/rust/model/model.rs            |  8 +--
 .../models/continue_watching_preview.proto    | 18 +-----
 .../stremio/core/models/meta_details.proto    |  2 +-
 .../stremio/core/runtime/action_player.proto  |  7 +--
 .../proto/stremio/core/types/library.proto    |  3 +-
 16 files changed, 54 insertions(+), 138 deletions(-)
 delete mode 100644 src/commonMain/rust/bridge/continue_watching_item.rs

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 5d35140..69679d0 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -21,7 +21,7 @@ jobs:
       - name: Setup Android NDK
         run: yes | sdkmanager "ndk;21.0.6113669" >/dev/null
       - name: Set default rust toolchain
-        run: rustup default 1.61.0
+        run: rustup default 1.67.1
       - name: Install rustfmt
         run: rustup component add rustfmt
       - name: Install clippy
diff --git a/src/commonMain/rust/bridge/action.rs b/src/commonMain/rust/bridge/action.rs
index 1aaf1e8..82caef5 100644
--- a/src/commonMain/rust/bridge/action.rs
+++ b/src/commonMain/rust/bridge/action.rs
@@ -159,9 +159,9 @@ impl FromProtobuf<Action> for runtime::Action {
                 }
             }
             Some(runtime::action::Type::Player(action_player)) => match &action_player.args {
-                Some(action_player::Args::VideoParamsChanged(video_params_changed)) => {
+                Some(action_player::Args::VideoParamsChanged(video_params)) => {
                     Action::Player(ActionPlayer::VideoParamsChanged {
-                        video_params: video_params_changed.video_param.from_protobuf(),
+                        video_params: Some(video_params.from_protobuf()),
                     })
                 }
                 Some(action_player::Args::TimeChanged(item_state)) => {
diff --git a/src/commonMain/rust/bridge/continue_watching_item.rs b/src/commonMain/rust/bridge/continue_watching_item.rs
deleted file mode 100644
index ddf424b..0000000
--- a/src/commonMain/rust/bridge/continue_watching_item.rs
+++ /dev/null
@@ -1,60 +0,0 @@
-use stremio_core::deep_links::LibraryItemDeepLinks;
-use stremio_core::models::continue_watching_preview::Item;
-use stremio_core::types::profile::Settings;
-use stremio_core::types::streams::StreamsItem;
-use url::Url;
-
-use crate::protobuf::stremio::core::models;
-use crate::protobuf::stremio::core::types;
-
-use super::ToProtobuf;
-
-impl ToProtobuf<models::ContinueWatchingItem, (Option<&StreamsItem>, Option<&Url>, &Settings)>
-    for Item
-{
-    fn to_protobuf(
-        &self,
-        (streams_item, streaming_server_url, settings): &(
-            Option<&StreamsItem>,
-            Option<&Url>,
-            &Settings,
-        ),
-    ) -> models::ContinueWatchingItem {
-        let deep_links = LibraryItemDeepLinks::from((
-            &self.library_item,
-            *streams_item,
-            *streaming_server_url,
-            *settings,
-        ));
-        models::ContinueWatchingItem {
-            id: self.library_item.id.to_string(),
-            r#type: self.library_item.r#type.to_string(),
-            name: self.library_item.name.to_string(),
-            poster: self.library_item.poster.to_protobuf(&()),
-            poster_shape: self.library_item.poster_shape.to_protobuf(&()) as i32,
-            state: types::LibraryItemState {
-                time_offset: self.library_item.state.time_offset,
-                duration: self.library_item.state.duration,
-                video_id: self.library_item.state.video_id.clone(),
-            },
-            behavior_hints: self.library_item.behavior_hints.to_protobuf(&()),
-            deep_links: types::MetaItemDeepLinks {
-                meta_details_videos: deep_links.meta_details_videos,
-                meta_details_streams: deep_links.meta_details_streams,
-                player: deep_links.player,
-            },
-            progress: if self.library_item.state.time_offset > 0
-                && self.library_item.state.duration > 0
-            {
-                Some(
-                    self.library_item.state.time_offset as f64
-                        / self.library_item.state.duration as f64,
-                )
-            } else {
-                None
-            },
-            watched: self.library_item.state.times_watched > 0,
-            notifications: self.notifications as u64,
-        }
-    }
-}
diff --git a/src/commonMain/rust/bridge/event.rs b/src/commonMain/rust/bridge/event.rs
index 28ff3d4..0441b0b 100644
--- a/src/commonMain/rust/bridge/event.rs
+++ b/src/commonMain/rust/bridge/event.rs
@@ -186,7 +186,7 @@ impl ToProtobuf<runtime::Event, ()> for Event {
 impl ToProtobuf<runtime::RuntimeEvent, ()> for RuntimeEvent<AndroidEnv, AndroidModel> {
     fn to_protobuf(&self, _args: &()) -> runtime::RuntimeEvent {
         let event = match self {
-            RuntimeEvent::NewState(fields) => {
+            RuntimeEvent::NewState(fields, ..) => {
                 runtime::runtime_event::Event::NewState(runtime::runtime_event::NewState {
                     fields: fields
                         .to_protobuf(&())
diff --git a/src/commonMain/rust/bridge/library_item.rs b/src/commonMain/rust/bridge/library_item.rs
index 3cb868f..e92aa62 100644
--- a/src/commonMain/rust/bridge/library_item.rs
+++ b/src/commonMain/rust/bridge/library_item.rs
@@ -1,15 +1,22 @@
 use stremio_core::deep_links::LibraryItemDeepLinks;
+use stremio_core::models::ctx::Ctx;
 use stremio_core::types::library::LibraryItem;
-use stremio_core::types::profile::Settings;
-use stremio_core::types::streams::StreamsItem;
-use url::Url;
 
 use crate::bridge::ToProtobuf;
 use crate::protobuf::stremio::core::types;
 
-impl ToProtobuf<types::LibraryItem, (Option<&StreamsItem>, Option<&Url>, &Settings)> for LibraryItem {
-    fn to_protobuf(&self, args: &(Option<&StreamsItem>, Option<&Url>, &Settings)) -> types::LibraryItem {
-        let deep_links = LibraryItemDeepLinks::from((self, args.0, args.1, args.2));
+impl ToProtobuf<types::LibraryItem, Ctx> for LibraryItem {
+    fn to_protobuf(&self, ctx: &Ctx) -> types::LibraryItem {
+        let notifications = ctx
+            .notifications
+            .items
+            .get(&self.id)
+            .map(|notifs| notifs.len())
+            .unwrap_or_default();
+        let settings = &ctx.profile.settings;
+        let streaming_server_url = &settings.streaming_server_url;
+        let deep_links =
+            LibraryItemDeepLinks::from((self, None, Some(streaming_server_url), settings));
         types::LibraryItem {
             id: self.id.to_string(),
             r#type: self.r#type.to_string(),
@@ -27,12 +34,9 @@ impl ToProtobuf<types::LibraryItem, (Option<&StreamsItem>, Option<&Url>, &Settin
                 meta_details_streams: deep_links.meta_details_streams,
                 player: deep_links.player,
             },
-            progress: if self.state.time_offset > 0 && self.state.duration > 0 {
-                Some(self.state.time_offset as f64 / self.state.duration as f64)
-            } else {
-                None
-            },
+            progress: self.progress(),
             watched: self.state.times_watched > 0,
+            notifications: notifications as u64,
         }
     }
 }
diff --git a/src/commonMain/rust/bridge/mod.rs b/src/commonMain/rust/bridge/mod.rs
index 7c2ea6a..0755d13 100644
--- a/src/commonMain/rust/bridge/mod.rs
+++ b/src/commonMain/rust/bridge/mod.rs
@@ -7,9 +7,6 @@ pub use android_model_field::*;
 mod auth_request;
 pub use auth_request::*;
 
-mod continue_watching_item;
-pub use continue_watching_item::*;
-
 mod date;
 pub use date::*;
 
diff --git a/src/commonMain/rust/model/fields/continue_watching_preview.rs b/src/commonMain/rust/model/fields/continue_watching_preview.rs
index c95c9d2..3afe78a 100644
--- a/src/commonMain/rust/model/fields/continue_watching_preview.rs
+++ b/src/commonMain/rust/model/fields/continue_watching_preview.rs
@@ -1,12 +1,19 @@
-use stremio_core::models::continue_watching_preview::ContinueWatchingPreview;
+use stremio_core::models::continue_watching_preview::{ContinueWatchingPreview, Item};
+use stremio_core::models::ctx::Ctx;
 
 use crate::bridge::ToProtobuf;
-use crate::protobuf::stremio::core::models;
+use crate::protobuf::stremio::core::{models, types};
 
-impl ToProtobuf<models::ContinueWatchingPreview, ()> for ContinueWatchingPreview {
-    fn to_protobuf(&self, _args: &()) -> models::ContinueWatchingPreview {
+impl ToProtobuf<types::LibraryItem, Ctx> for Item {
+    fn to_protobuf(&self, ctx: &Ctx) -> types::LibraryItem {
+        self.library_item.to_protobuf(ctx)
+    }
+}
+
+impl ToProtobuf<models::ContinueWatchingPreview, Ctx> for ContinueWatchingPreview {
+    fn to_protobuf(&self, ctx: &Ctx) -> models::ContinueWatchingPreview {
         models::ContinueWatchingPreview {
-            items: self.items.to_protobuf(todo!()),
+            library_items: self.items.to_protobuf(ctx),
         }
     }
 }
diff --git a/src/commonMain/rust/model/fields/library.rs b/src/commonMain/rust/model/fields/library.rs
index f8646c4..f9c94c4 100644
--- a/src/commonMain/rust/model/fields/library.rs
+++ b/src/commonMain/rust/model/fields/library.rs
@@ -1,6 +1,7 @@
 use std::cmp;
 use std::convert::TryFrom;
 use std::num::NonZeroUsize;
+use stremio_core::models::ctx::Ctx;
 
 use stremio_core::models::library_with_filters::{
     LibraryRequest, LibraryRequestPage, LibraryWithFilters, Selectable, SelectablePage,
@@ -110,12 +111,12 @@ impl ToProtobuf<models::library_with_filters::Selectable, ()> for Selectable {
     }
 }
 
-impl<F> ToProtobuf<models::LibraryWithFilters, ()> for LibraryWithFilters<F> {
-    fn to_protobuf(&self, _args: &()) -> models::LibraryWithFilters {
+impl<F> ToProtobuf<models::LibraryWithFilters, Ctx> for LibraryWithFilters<F> {
+    fn to_protobuf(&self, ctx: &Ctx) -> models::LibraryWithFilters {
         models::LibraryWithFilters {
             selected: self.selected.to_protobuf(&()),
             selectable: self.selectable.to_protobuf(&()),
-            catalog: self.catalog.to_protobuf(todo!("Args")),
+            catalog: self.catalog.to_protobuf(ctx),
         }
     }
 }
diff --git a/src/commonMain/rust/model/fields/library_by_type.rs b/src/commonMain/rust/model/fields/library_by_type.rs
index a4a86fc..6bb21d7 100644
--- a/src/commonMain/rust/model/fields/library_by_type.rs
+++ b/src/commonMain/rust/model/fields/library_by_type.rs
@@ -1,3 +1,4 @@
+use stremio_core::models::ctx::Ctx;
 use stremio_core::models::library_by_type::{
     Catalog, LibraryByType, Selectable, SelectableSort, Selected,
 };
@@ -42,24 +43,24 @@ impl ToProtobuf<models::library_by_type::Selectable, ()> for Selectable {
     }
 }
 
-impl ToProtobuf<models::LibraryCatalog, ()> for Catalog {
-    fn to_protobuf(&self, _args: &()) -> models::LibraryCatalog {
+impl ToProtobuf<models::LibraryCatalog, Ctx> for Catalog {
+    fn to_protobuf(&self, ctx: &Ctx) -> models::LibraryCatalog {
         let items = self
             .iter()
             .flatten()
-            .map(|item| item.to_protobuf(todo!("Args")))
+            .map(|item| item.to_protobuf(ctx))
             .collect::<Vec<_>>();
         let r#type = items.first().map(|item| item.r#type.to_owned());
         models::LibraryCatalog { r#type, items }
     }
 }
 
-impl<F> ToProtobuf<models::LibraryByType, ()> for LibraryByType<F> {
-    fn to_protobuf(&self, _args: &()) -> models::LibraryByType {
+impl<F> ToProtobuf<models::LibraryByType, Ctx> for LibraryByType<F> {
+    fn to_protobuf(&self, ctx: &Ctx) -> models::LibraryByType {
         models::LibraryByType {
             selected: self.selected.to_protobuf(&()),
             selectable: self.selectable.to_protobuf(&()),
-            catalogs: self.catalogs.to_protobuf(&()),
+            catalogs: self.catalogs.to_protobuf(ctx),
         }
     }
 }
diff --git a/src/commonMain/rust/model/fields/meta_details.rs b/src/commonMain/rust/model/fields/meta_details.rs
index 72aa1c2..960f12f 100644
--- a/src/commonMain/rust/model/fields/meta_details.rs
+++ b/src/commonMain/rust/model/fields/meta_details.rs
@@ -17,7 +17,7 @@ impl FromProtobuf<Selected> for models::meta_details::Selected {
         Selected {
             meta_path: self.meta_path.from_protobuf(),
             stream_path: self.stream_path.from_protobuf(),
-            guess_stream: self.guess_stream,
+            guess_stream: self.guess_stream_path,
         }
     }
 }
@@ -27,7 +27,7 @@ impl ToProtobuf<models::meta_details::Selected, ()> for Selected {
         models::meta_details::Selected {
             meta_path: self.meta_path.to_protobuf(&()),
             stream_path: self.stream_path.to_protobuf(&()),
-            guess_stream: self.guess_stream,
+            guess_stream_path: self.guess_stream,
         }
     }
 }
diff --git a/src/commonMain/rust/model/fields/player.rs b/src/commonMain/rust/model/fields/player.rs
index 400b9ff..e677a14 100644
--- a/src/commonMain/rust/model/fields/player.rs
+++ b/src/commonMain/rust/model/fields/player.rs
@@ -1,6 +1,5 @@
 use stremio_core::models::ctx::Ctx;
 use stremio_core::models::player::{Player, Selected, VideoParams};
-use stremio_core::types::streams::StreamsItemKey;
 
 use crate::bridge::{FromProtobuf, ToProtobuf};
 use crate::protobuf::stremio::core::models;
@@ -56,19 +55,6 @@ impl ToProtobuf<models::player::Selected, Ctx> for Selected {
 
 impl ToProtobuf<models::Player, Ctx> for Player {
     fn to_protobuf(&self, ctx: &Ctx) -> models::Player {
-
-
-        // let stream_item = ctx.streams.items.get(StreamsItemKey { meta_id: self.selected.map(|selected| selected.meta_request.and_then) ), video_id: () });
-        
-        // let streaming_server_url = match ctx.streaming_server.base_url.clone() {
-        //     Loadable::Ready(url) => Some(url),
-        //     _ => None,
-        // };
-        // let meta_item_id = self.meta_item.map(|meta_item| meta_item.request.path.id.clone());
-        // let meta_item_id = self.vi.and_then(|meta_item| meta_item.request.path.id.clone());
-        // let stream_item = ctx.streams.items.get(StreamsItemKey { meta_id: self., video_id: () });
-
-
         models::Player {
             selected: self.selected.to_protobuf(ctx),
             video_params: self.video_params.to_protobuf(&()),
@@ -84,7 +70,7 @@ impl ToProtobuf<models::Player, Ctx> for Player {
                 None,
             )),
             series_info: self.series_info.to_protobuf(&()),
-            library_item: todo!(), //self.library_item.to_protobuf(&()),
+            library_item: self.library_item.to_protobuf(ctx),
         }
     }
 }
diff --git a/src/commonMain/rust/model/model.rs b/src/commonMain/rust/model/model.rs
index ed20f4e..e2eec01 100644
--- a/src/commonMain/rust/model/model.rs
+++ b/src/commonMain/rust/model/model.rs
@@ -92,11 +92,11 @@ impl AndroidModel {
             AndroidModelField::AuthLink => self.auth_link.to_protobuf(&()).encode_to_vec(),
             AndroidModelField::ContinueWatchingPreview => self
                 .continue_watching_preview
-                .to_protobuf(&())
+                .to_protobuf(&self.ctx)
                 .encode_to_vec(),
-            AndroidModelField::Library => self.library.to_protobuf(&()).encode_to_vec(),
+            AndroidModelField::Library => self.library.to_protobuf(&self.ctx).encode_to_vec(),
             AndroidModelField::LibraryByType => {
-                self.library_by_type.to_protobuf(&()).encode_to_vec()
+                self.library_by_type.to_protobuf(&self.ctx).encode_to_vec()
             }
             AndroidModelField::Board => self.board.to_protobuf(&self.ctx).encode_to_vec(),
             AndroidModelField::Search => self.search.to_protobuf(&self.ctx).encode_to_vec(),
@@ -114,4 +114,4 @@ impl AndroidModel {
             AndroidModelField::Player => self.player.to_protobuf(&self.ctx).encode_to_vec(),
         }
     }
-}
\ No newline at end of file
+}
diff --git a/src/main/proto/stremio/core/models/continue_watching_preview.proto b/src/main/proto/stremio/core/models/continue_watching_preview.proto
index 1b54017..c98f373 100644
--- a/src/main/proto/stremio/core/models/continue_watching_preview.proto
+++ b/src/main/proto/stremio/core/models/continue_watching_preview.proto
@@ -6,22 +6,6 @@ option java_package = "com.stremio.core.models";
 
 import "stremio/core/types/library.proto";
 
-import "stremio/core/types/meta_item.proto";
-
-message ContinueWatchingItem {
-  required string id = 1;
-  required string type = 2;
-  required string name = 3;
-  optional string poster = 4;
-  required stremio.core.types.PosterShape poster_shape = 5;
-  required stremio.core.types.LibraryItemState state = 6;
-  required stremio.core.types.MetaItemBehaviorHints behavior_hints = 7;
-  required stremio.core.types.MetaItemDeepLinks deep_links = 8;
-  optional double progress = 9;
-  required bool watched = 10;
-  required uint64 notifications = 11;
-}
-
 message ContinueWatchingPreview {
-  repeated ContinueWatchingItem items = 1;
+  repeated stremio.core.types.LibraryItem library_items = 1;
 }
\ No newline at end of file
diff --git a/src/main/proto/stremio/core/models/meta_details.proto b/src/main/proto/stremio/core/models/meta_details.proto
index 0f3cfc0..599495a 100644
--- a/src/main/proto/stremio/core/models/meta_details.proto
+++ b/src/main/proto/stremio/core/models/meta_details.proto
@@ -18,7 +18,7 @@ message MetaDetails {
   message Selected {
     required stremio.core.types.ResourcePath meta_path = 1;
     optional stremio.core.types.ResourcePath stream_path = 2;
-    required bool guess_stream = 3;
+    required bool guess_stream_path = 3;
   }
 }
 
diff --git a/src/main/proto/stremio/core/runtime/action_player.proto b/src/main/proto/stremio/core/runtime/action_player.proto
index e0d4989..93a0c73 100644
--- a/src/main/proto/stremio/core/runtime/action_player.proto
+++ b/src/main/proto/stremio/core/runtime/action_player.proto
@@ -5,12 +5,11 @@ package stremio.core.runtime;
 option java_package = "com.stremio.core.runtime.msg";
 
 import "google/protobuf/empty.proto";
-
 import "stremio/core/models/player.proto";
 
 message ActionPlayer {
   oneof args {
-    VideoParamsChanged video_params_changed = 1;
+    stremio.core.models.Player.VideoParams video_params_changed = 1;
     PlayerItemState time_changed = 2;
     bool paused_changed = 3;
     google.protobuf.Empty ended = 4;
@@ -21,8 +20,4 @@ message ActionPlayer {
     required uint64 duration = 2;
     required string device = 3;
   }
-
-  message VideoParamsChanged {
-    optional stremio.core.models.Player.VideoParams video_param = 1;
-  }
 }
\ No newline at end of file
diff --git a/src/main/proto/stremio/core/types/library.proto b/src/main/proto/stremio/core/types/library.proto
index e60f027..469248b 100644
--- a/src/main/proto/stremio/core/types/library.proto
+++ b/src/main/proto/stremio/core/types/library.proto
@@ -15,8 +15,9 @@ message LibraryItem {
   required LibraryItemState state = 6;
   required MetaItemBehaviorHints behavior_hints = 7;
   required MetaItemDeepLinks deep_links = 8;
-  optional double progress = 9;
+  required double progress = 9;
   required bool watched = 10;
+  required uint64 notifications = 11;
 }
 
 message LibraryItemState {

From e3bde63de08f861830ff72b87bd1be65cf57ee25 Mon Sep 17 00:00:00 2001
From: Lachezar Lechev <lachezar@ambire.com>
Date: Thu, 2 Nov 2023 15:08:38 +0200
Subject: [PATCH 8/8] fix: rustfmt & clippy linting

---
 build.rs                                    | 2 +-
 src/commonMain/rust/env/env.rs              | 7 +++++--
 src/commonMain/rust/stremio_core_android.rs | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/build.rs b/build.rs
index ab491a0..ea016eb 100644
--- a/build.rs
+++ b/build.rs
@@ -12,7 +12,7 @@ fn main() {
         println!("cargo:rerun-if-changed={display_path}");
     }
     let file_descriptors =
-        protox::compile(proto_paths, &[proto_dir]).expect("Expected file descriptors");
+        protox::compile(proto_paths, [proto_dir]).expect("Expected file descriptors");
     Config::new()
         .compile_well_known_types()
         .out_dir("src/commonMain/rust/protobuf")
diff --git a/src/commonMain/rust/env/env.rs b/src/commonMain/rust/env/env.rs
index 905499c..eaae1ca 100644
--- a/src/commonMain/rust/env/env.rs
+++ b/src/commonMain/rust/env/env.rs
@@ -7,7 +7,10 @@ use std::{
 use chrono::{DateTime, Utc};
 use futures::{Future, TryFutureExt};
 use http::Request;
-use jni::{objects::{GlobalRef, JObject}, JNIEnv};
+use jni::{
+    objects::{GlobalRef, JObject},
+    JNIEnv,
+};
 use lazy_static::lazy_static;
 use serde::{Deserialize, Serialize};
 use serde_json::json;
@@ -238,4 +241,4 @@ async fn get_installation_id() -> Result<String, EnvError> {
         installation_id.unwrap_or_else(|| hex::encode(AndroidEnv::random_buffer(10)));
     AndroidEnv::set_storage(INSTALLATION_ID_STORAGE_KEY, Some(&installation_id)).await?;
     Ok(installation_id)
-}
\ No newline at end of file
+}
diff --git a/src/commonMain/rust/stremio_core_android.rs b/src/commonMain/rust/stremio_core_android.rs
index 03a71e3..051cff5 100644
--- a/src/commonMain/rust/stremio_core_android.rs
+++ b/src/commonMain/rust/stremio_core_android.rs
@@ -221,4 +221,4 @@ pub unsafe extern "C" fn Java_com_stremio_core_Core_sendNextAnalyticsBatch(
     _class: JClass,
 ) {
     AndroidEnv::exec_concurrent(AndroidEnv::send_next_analytics_batch());
-}
\ No newline at end of file
+}