Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Sep 21, 2023
1 parent 6152935 commit f6eebce
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions mullvad-types/src/custom_list.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use crate::relay_constraints::GeographicLocationConstraint;
#[cfg(target_os = "android")]
use jnix::{jni::objects::JString, FromJava, IntoJava, JnixEnv};
use jnix::{
jni::objects::{AutoLocal, JObject, JString},
FromJava, IntoJava, JnixEnv,
};
use serde::{Deserialize, Serialize};
use std::{
collections::BTreeSet,
Expand Down Expand Up @@ -44,7 +47,19 @@ where
let s = env
.get_string(source)
.expect("Failed to convert from Java String");
Id::from_str(&s).expect("invalid ID")
Id::from_str(s.to_str().unwrap()).expect("invalid ID")
}
}

#[cfg(target_os = "android")]
impl<'env, 'sub_env> FromJava<'env, JObject<'sub_env>> for Id
where
'env: 'sub_env,
{
const JNI_SIGNATURE: &'static str = "Ljava/lang/String;";

fn from_java(env: &JnixEnv<'env>, source: JObject<'sub_env>) -> Self {
Id::from_java(env, JString::from(source))
}
}

Expand Down

0 comments on commit f6eebce

Please sign in to comment.