Skip to content

Commit

Permalink
fix(android): removed use of asset_path in favor of asset_resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Sep 24, 2023
1 parent 26acc28 commit f284213
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions aw-server/src/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,13 @@ pub mod android {
string_to_jstring(&env, obj.to_string())
}

lazy_static! {
static ref ASSET_PATH: Mutex<String> = Mutex::new(String::new());
}

#[no_mangle]
pub unsafe extern "C" fn Java_net_activitywatch_android_RustInterface_startServer(
env: JNIEnv,
_: JClass,
java_asset_path: JString,
) {
info!("Starting server...");

*ASSET_PATH.lock().unwrap() = jstring_to_string(&env, java_asset_path);

start_server();

info!("Server exited");
}

Expand All @@ -125,12 +116,11 @@ pub mod android {
unsafe {
let server_state: ServerState = endpoints::ServerState {
datastore: Mutex::new(openDatastore()),
asset_path: PathBuf::from(ASSET_PATH.lock().unwrap().to_owned()),
asset_resolver: endpoints::AssetResolver::new(None),
device_id: device_id::get_device_id(),
};
info!(
"Using server_state:: asset dir: {}; device_id: {}",
server_state.asset_path.display(),
"Using server_state:: device_id: {}",
server_state.device_id
);

Expand Down

0 comments on commit f284213

Please sign in to comment.