diff options
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/foundation/e/privacycentralapp/data/repositories/TrackersRepository.kt | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/src/main/java/foundation/e/privacycentralapp/data/repositories/TrackersRepository.kt b/app/src/main/java/foundation/e/privacycentralapp/data/repositories/TrackersRepository.kt index b5310e1..ae55371 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/data/repositories/TrackersRepository.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/data/repositories/TrackersRepository.kt @@ -18,12 +18,12 @@ package foundation.e.privacycentralapp.data.repositories import android.content.Context -import android.util.Log import com.google.gson.Gson import foundation.e.privacymodules.trackers.api.Tracker import retrofit2.Retrofit import retrofit2.converter.scalars.ScalarsConverterFactory import retrofit2.http.GET +import timber.log.Timber import java.io.File import java.io.FileInputStream import java.io.FileWriter @@ -45,8 +45,12 @@ class TrackersRepository(private val context: Context) { suspend fun update() { val api = ETrackersApi.build() - saveData(eTrackerFile, api.trackers()) - initTrackersFile() + try { + saveData(eTrackerFile, api.trackers()) + initTrackersFile() + } catch (e: Exception) { + Timber.e("While updating trackers", e) + } } private fun initTrackersFile() { @@ -64,7 +68,7 @@ class TrackersRepository(private val context: Context) { reader.close() inputStream.close() } catch (e: Exception) { - Log.e("TrackersRepository", "While parsing trackers in assets", e) + Timber.e("While parsing trackers in assets", e) } } |