-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added crate to manage .lotties (#23)
* feat: added crate to manage .lotties * feat: added dotlottie_manager * wip: multi animation support * chore: debug for ashraf * chore: clean up * chore: removed log * feat: added playback setting loading * fix: comments * feat: added manifest(), emscripten bindings + udl bindings * fix: bindings * chore: 🤖 fix emscripten target for fms crate * fix: bindings * fix: 🐛 emscripten-bindings * chore: 🤖 skip .d.ts generation * chore: 🤖 update emscripten-bindings for load_dotlottie_data * feat: 🎸 add manifest_string * fix: 🐛 panic when call manifest for a lottie json * chore: 🤖 fix typo * chore: 🤖 uncomment ts gen --------- Co-authored-by: Abdelrahman Ashraf <a.theashraf@gmail.com>
- Loading branch information
1 parent
8d88861
commit 68201b4
Showing
30 changed files
with
1,367 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub use dotlottie_fms::*; | ||
pub use dotlottie_player_core::*; | ||
|
||
uniffi::include_scaffolding!("dotlottie_player"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/uniffi-bindings | ||
/build | ||
/target | ||
**/*.rs.bk | ||
Cargo.lock | ||
bin/ | ||
/artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[package] | ||
name = "dotlottie_fms" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
[lib] | ||
crate-type = ["staticlib", "cdylib", "rlib"] | ||
name = "dotlottie_fms" | ||
|
||
[dependencies] | ||
zip = { version = "0.6.6", default-features = false, features = ["deflate"] } | ||
thiserror = "1.0.48" | ||
serde_json = "1.0.107" | ||
serde = { version = "1.0.188", features = ["derive"] } | ||
base64 = "0.21.4" | ||
json = "0.12.4" | ||
jzon = "0.12.5" | ||
|
||
|
||
[build-dependencies] | ||
lazy_static = "1.4.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use lazy_static::lazy_static; | ||
use std::env; | ||
|
||
// Target triple for WASM | ||
const WASM32_UNKNOWN_EMSCRIPTEN: &str = "wasm32-unknown-emscripten"; | ||
|
||
// Target-specifc build settings | ||
struct BuildSettings { | ||
link_args: Vec<String>, | ||
} | ||
|
||
fn is_wasm_build() -> bool { | ||
match env::var("TARGET") { | ||
Ok(target) => target == WASM32_UNKNOWN_EMSCRIPTEN, | ||
Err(_) => panic!("TARGET environment variable not set"), | ||
} | ||
} | ||
|
||
lazy_static! { | ||
// Native library dependencies | ||
static ref TARGET_BUILD_SETTINGS: BuildSettings = match is_wasm_build() { | ||
true => BuildSettings{ | ||
link_args: vec![String::from("--no-entry"), String::from("-sERROR_ON_UNDEFINED_SYMBOLS=0")], | ||
}, | ||
_ => BuildSettings{ | ||
link_args: vec![], | ||
}, | ||
}; | ||
} | ||
|
||
fn register_link_arg(arg: &String) { | ||
println!("cargo:rustc-link-arg={}", arg); | ||
} | ||
|
||
fn apply_build_settings(build_settings: &BuildSettings) { | ||
build_settings.link_args.iter().for_each(register_link_arg); | ||
} | ||
|
||
fn main() { | ||
// Apply build settings | ||
apply_build_settings(&TARGET_BUILD_SETTINGS); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#[derive(Debug)] | ||
pub struct AnimationContainer { | ||
pub id: String, | ||
pub animation_data: String, | ||
} |
Oops, something went wrong.