Skip to content

Commit

Permalink
chore(android): AndroidModel should be enabled only by the env. impl …
Browse files Browse the repository at this point in the history
…with `kotlin` feature

Signed-off-by: Lachezar Lechev <[email protected]>
  • Loading branch information
elpiel committed Aug 23, 2024
1 parent 260c524 commit 8068ee7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
20 changes: 11 additions & 9 deletions src/commonMain/rust/env/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,17 @@ impl AndroidEnv {
load_kotlin_classes(env).expect("kotlin classes load failed");
*STORAGE.write().expect("STORAGE write failed") =
Some(Storage::new(env, storage).expect("Create Storage failed"));
AndroidEnv::migrate_storage_schema()
.and_then(|_| async {
let installation_id = get_installation_id().await?;
*INSTALLATION_ID
.write()
.expect("INSTALLATION_ID write failed") = Some(installation_id);
Ok(())
})
.boxed_env()

async {
Self::migrate_storage_schema().await?;

let installation_id = get_installation_id().await?;
*INSTALLATION_ID
.write()
.expect("INSTALLATION_ID write failed") = Some(installation_id);
Ok(())
}
.boxed_env()
}
pub fn kotlin_classes<'a>(
) -> LockResult<RwLockReadGuard<'a, HashMap<KotlinClassName, GlobalRef>>> {
Expand Down
9 changes: 7 additions & 2 deletions src/commonMain/rust/model.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
pub use addons::*;
#[cfg(feature = "kotlin")]
pub use model::*;

mod addons;
mod fields;
pub use addons::*;

#[cfg(feature = "kotlin")]
// model is only available when the feature is enabled
// because of the `AndroidEnv` impl
mod model;
pub use model::*;

0 comments on commit 8068ee7

Please sign in to comment.