Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50aee499 authored by Jonathan Klee's avatar Jonathan Klee
Browse files

Catch IOexception for fetching privacy reports

parent d5c4efc7
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import java.lang.reflect.Modifier
import javax.inject.Inject
import javax.inject.Singleton
import foundation.e.apps.data.Result
import okio.IOException

@Singleton
class AppPrivacyInfoRepositoryImpl @Inject constructor(
@@ -72,6 +73,7 @@ class AppPrivacyInfoRepositoryImpl @Inject constructor(
            .post(jsonBody.toRequestBody("application/json".toMediaType()))
            .build()

        try {
            okHttpClient.newCall(request).execute().use { response ->
                if (response.isSuccessful) {
                    val responseBody = response.body?.string()
@@ -80,6 +82,11 @@ class AppPrivacyInfoRepositoryImpl @Inject constructor(
                    throw IllegalStateException("Failed to fetch reports")
                }
            }
        } catch (exception: IOException) {
           exception.printStackTrace()
        }

        return emptyList()
    }

    private fun parseReports(response: String): List<Report> {