diff options
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt | 7 | ||||
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt | 5 | ||||
| -rw-r--r-- | mullvad-jni/src/lib.rs | 12 | ||||
| -rw-r--r-- | mullvad-problem-report/src/lib.rs | 3 | ||||
| -rw-r--r-- | mullvad-problem-report/src/main.rs | 3 |
5 files changed, 24 insertions, 6 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt index 4bbc29c8c3..bebac103d7 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt @@ -13,6 +13,7 @@ const val PROBLEM_REPORT_FILE = "problem_report.txt" class MullvadProblemReport { val logDirectory = CompletableDeferred<File>() + val resourcesDirectory = CompletableDeferred<File>() private val problemReportPath = GlobalScope.async(Dispatchers.Default) { File(logDirectory.await(), PROBLEM_REPORT_FILE) @@ -66,7 +67,8 @@ class MullvadProblemReport { sendProblemReport( userEmail, userMessage, - problemReportPath.await().absolutePath + problemReportPath.await().absolutePath, + resourcesDirectory.await().absolutePath ) if (result) { @@ -102,6 +104,7 @@ class MullvadProblemReport { private external fun sendProblemReport( userEmail: String, userMessage: String, - reportPath: String + reportPath: String, + resourcesDirectory: String ): Boolean } diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt index 0128df069a..a7a6f3dbef 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt @@ -84,7 +84,10 @@ class MainActivity : FragmentActivity() { super.onCreate(savedInstanceState) - problemReport.logDirectory.complete(filesDir) + problemReport.apply { + logDirectory.complete(filesDir) + resourcesDirectory.complete(filesDir) + } setContentView(R.layout.main) diff --git a/mullvad-jni/src/lib.rs b/mullvad-jni/src/lib.rs index 243bb7c65e..dd45177cdf 100644 --- a/mullvad-jni/src/lib.rs +++ b/mullvad-jni/src/lib.rs @@ -943,14 +943,24 @@ pub extern "system" fn Java_net_mullvad_mullvadvpn_dataproxy_MullvadProblemRepor userEmail: JString<'_>, userMessage: JString<'_>, outputPath: JString<'_>, + resourcesDirectory: JString<'_>, ) -> jboolean { let env = JnixEnv::from(env); let user_email = String::from_java(&env, userEmail); let user_message = String::from_java(&env, userMessage); let output_path_string = String::from_java(&env, outputPath); let output_path = Path::new(&output_path_string); + let resources_directory_string = String::from_java(&env, resourcesDirectory); + let resources_directory = Path::new(&resources_directory_string); - match mullvad_problem_report::send_problem_report(&user_email, &user_message, output_path) { + let send_result = mullvad_problem_report::send_problem_report( + &user_email, + &user_message, + output_path, + resources_directory, + ); + + match send_result { Ok(()) => JNI_TRUE, Err(error) => { log::error!( diff --git a/mullvad-problem-report/src/lib.rs b/mullvad-problem-report/src/lib.rs index eac0dd4638..af2680efb7 100644 --- a/mullvad-problem-report/src/lib.rs +++ b/mullvad-problem-report/src/lib.rs @@ -253,6 +253,7 @@ pub fn send_problem_report( user_email: &str, user_message: &str, report_path: &Path, + resource_dir: &Path, ) -> Result<(), Error> { let report_content = normalize_newlines( read_file_lossy(report_path, REPORT_MAX_SIZE).map_err(|source| { @@ -274,7 +275,7 @@ pub fn send_problem_report( let mut rpc_manager = runtime .block_on(mullvad_rpc::MullvadRpcRuntime::with_cache( runtime.handle().clone(), - &mullvad_paths::get_resource_dir(), + resource_dir, None, )) .map_err(Error::CreateRpcClientError)?; diff --git a/mullvad-problem-report/src/main.rs b/mullvad-problem-report/src/main.rs index 457133fc49..7090cecd6d 100644 --- a/mullvad-problem-report/src/main.rs +++ b/mullvad-problem-report/src/main.rs @@ -113,7 +113,8 @@ fn run() -> Result<(), Error> { let report_path = Path::new(send_matches.value_of_os("report").unwrap()); let user_email = send_matches.value_of("email").unwrap_or(""); let user_message = send_matches.value_of("message").unwrap_or(""); - send_problem_report(user_email, user_message, report_path) + let resource_dir = mullvad_paths::get_resource_dir(); + send_problem_report(user_email, user_message, report_path, &resource_dir) } else { unreachable!("No sub command given"); } |
