diff options
Diffstat (limited to 'mullvad-problem-report/src')
| -rw-r--r-- | mullvad-problem-report/src/lib.rs | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/mullvad-problem-report/src/lib.rs b/mullvad-problem-report/src/lib.rs index cf37e6cb0f..eaeafbbf85 100644 --- a/mullvad-problem-report/src/lib.rs +++ b/mullvad-problem-report/src/lib.rs @@ -251,6 +251,22 @@ pub fn send_problem_report( user_email: &str, user_message: &str, report_path: &Path, + #[cfg(target_os = "android")] resource_dir: &Path, +) -> Result<(), Error> { + #[cfg(not(target_os = "android"))] + let ca_path = mullvad_paths::resources::get_api_ca_path(); + + #[cfg(target_os = "android")] + let ca_path = resource_dir.join(mullvad_paths::resources::API_CA_FILENAME); + + send_problem_report_inner(user_email, user_message, report_path, &ca_path) +} + +pub fn send_problem_report_inner( + user_email: &str, + user_message: &str, + report_path: &Path, + ca_path: &Path, ) -> Result<(), Error> { let report_content = normalize_newlines( read_file_lossy(report_path, REPORT_MAX_SIZE).map_err(|source| { @@ -263,10 +279,8 @@ pub fn send_problem_report( let metadata = ProblemReport::parse_metadata(&report_content).unwrap_or_else(|| metadata::collect()); - let ca_path = mullvad_paths::resources::get_api_ca_path(); - - let mut rpc_manager = mullvad_rpc::MullvadRpcRuntime::new(ca_path.as_ref()) - .map_err(Error::CreateRpcClientError)?; + let mut rpc_manager = + mullvad_rpc::MullvadRpcRuntime::new(ca_path).map_err(Error::CreateRpcClientError)?; let rpc_client = mullvad_rpc::ProblemReportProxy::new(rpc_manager.mullvad_rest_handle()); rpc_client |
