diff options
Diffstat (limited to 'android/app/src')
| -rw-r--r-- | android/app/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt | 20 | ||||
| -rw-r--r-- | android/app/src/main/kotlin/net/mullvad/mullvadvpn/di/UiModule.kt | 3 |
2 files changed, 21 insertions, 2 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt index f4a0777e3f..3b4a460fea 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt @@ -5,6 +5,9 @@ import java.io.File import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext +import net.mullvad.mullvadvpn.lib.endpoint.ApiEndpointFromIntentHolder +import net.mullvad.mullvadvpn.lib.endpoint.ApiEndpointOverride +import net.mullvad.mullvadvpn.service.BuildConfig const val PROBLEM_REPORT_LOGS_FILE = "problem_report.txt" @@ -21,7 +24,12 @@ sealed interface SendProblemReportResult { data class UserReport(val email: String?, val description: String) -class MullvadProblemReport(context: Context, val dispatcher: CoroutineDispatcher = Dispatchers.IO) { +class MullvadProblemReport( + context: Context, + private val apiEndpointOverride: ApiEndpointOverride?, + private val apiEndpointFromIntentHolder: ApiEndpointFromIntentHolder, + val dispatcher: CoroutineDispatcher = Dispatchers.IO, +) { private val cacheDirectory = File(context.cacheDir.toURI()) private val logDirectory = File(context.filesDir.toURI()) @@ -47,11 +55,20 @@ class MullvadProblemReport(context: Context, val dispatcher: CoroutineDispatcher val sentSuccessfully = withContext(dispatcher) { + val intentApiOverride = apiEndpointFromIntentHolder.apiEndpointOverride + val apiOverride = + if (BuildConfig.DEBUG && intentApiOverride != null) { + intentApiOverride + } else { + apiEndpointOverride + } + sendProblemReport( userReport.email ?: "", userReport.description, logsPath.absolutePath, cacheDirectory.absolutePath, + apiOverride, ) } @@ -89,5 +106,6 @@ class MullvadProblemReport(context: Context, val dispatcher: CoroutineDispatcher userMessage: String, reportPath: String, cacheDirectory: String, + apiEndpointOverride: ApiEndpointOverride?, ): Boolean } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/di/UiModule.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/di/UiModule.kt index 4acf52c7b0..bc236cc792 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/di/UiModule.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/di/UiModule.kt @@ -33,6 +33,7 @@ import net.mullvad.mullvadvpn.repository.UserPreferencesMigration import net.mullvad.mullvadvpn.repository.UserPreferencesRepository import net.mullvad.mullvadvpn.repository.UserPreferencesSerializer import net.mullvad.mullvadvpn.repository.WireguardConstraintsRepository +import net.mullvad.mullvadvpn.service.DaemonConfig import net.mullvad.mullvadvpn.ui.MainActivity import net.mullvad.mullvadvpn.ui.serviceconnection.AppVersionInfoRepository import net.mullvad.mullvadvpn.ui.serviceconnection.ServiceConnectionManager @@ -129,7 +130,7 @@ val uiModule = module { single { ChangelogRepository(get()) } single { UserPreferencesRepository(get()) } single { SettingsRepository(get()) } - single { MullvadProblemReport(get()) } + single { MullvadProblemReport(get(), get<DaemonConfig>().apiEndpointOverride, get()) } single { RelayOverridesRepository(get()) } single { CustomListsRepository(get()) } single { RelayListRepository(get(), get()) } |
