Bump chucker from 2.0.4 to 3.1.1 (#733)

This commit is contained in:
Mikołaj Pich 2020-03-28 11:44:09 +01:00 committed by GitHub
parent 95a833ea85
commit 0320079d02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 35 additions and 28 deletions

View File

@ -113,7 +113,8 @@ ext {
work_manager = "2.3.4" work_manager = "2.3.4"
room = "2.2.5" room = "2.2.5"
dagger = "2.27" dagger = "2.27"
chucker = "2.0.4" // don't update https://github.com/ChuckerTeam/chucker/issues/242
chucker = "3.1.1"
mockk = "1.9.2" mockk = "1.9.2"
} }
@ -122,7 +123,7 @@ configurations.all {
} }
dependencies { dependencies {
implementation "io.github.wulkanowy:sdk:85d47f6" implementation "io.github.wulkanowy:sdk:be7ed9c"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "androidx.core:core-ktx:1.2.0" implementation "androidx.core:core-ktx:1.2.0"
@ -182,9 +183,9 @@ dependencies {
playImplementation "com.google.firebase:firebase-core:17.2.3" playImplementation "com.google.firebase:firebase-core:17.2.3"
playImplementation "com.crashlytics.sdk.android:crashlytics:2.10.1" playImplementation "com.crashlytics.sdk.android:crashlytics:2.10.1"
releaseImplementation "fr.o80.chucker:library-no-op:$chucker" releaseImplementation "com.github.ChuckerTeam.Chucker:library-no-op:$chucker"
debugImplementation "fr.o80.chucker:library:$chucker" debugImplementation "com.github.ChuckerTeam.Chucker:library:$chucker"
debugImplementation "com.amitshekhar.android:debug-db:1.0.6" debugImplementation "com.amitshekhar.android:debug-db:1.0.6"
testImplementation "junit:junit:4.13" testImplementation "junit:junit:4.13"

View File

@ -0,0 +1,4 @@
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
<bool name="pref_default_notification_debug">true</bool>
</resources>

View File

@ -7,9 +7,9 @@ import android.content.res.Resources
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.strategy.WalledGardenInternetObservingStrategy import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.strategy.WalledGardenInternetObservingStrategy
import com.readystatesoftware.chuck.api.ChuckCollector import com.chuckerteam.chucker.api.ChuckerCollector
import com.readystatesoftware.chuck.api.ChuckInterceptor import com.chuckerteam.chucker.api.ChuckerInterceptor
import com.readystatesoftware.chuck.api.RetentionManager import com.chuckerteam.chucker.api.RetentionManager
import dagger.Module import dagger.Module
import dagger.Provides import dagger.Provides
import io.github.wulkanowy.data.db.AppDatabase import io.github.wulkanowy.data.db.AppDatabase
@ -32,23 +32,25 @@ internal class RepositoryModule {
@Singleton @Singleton
@Provides @Provides
fun provideSdk(chuckCollector: ChuckCollector, context: Context): Sdk { fun provideSdk(chuckerCollector: ChuckerCollector, context: Context): Sdk {
return Sdk().apply { return Sdk().apply {
androidVersion = android.os.Build.VERSION.RELEASE androidVersion = android.os.Build.VERSION.RELEASE
buildTag = android.os.Build.MODEL buildTag = android.os.Build.MODEL
setSimpleHttpLogger { Timber.d(it) } setSimpleHttpLogger { Timber.d(it) }
// for debug only // for debug only
addInterceptor(ChuckInterceptor(context, chuckCollector).maxContentLength(250000L), true) addInterceptor(ChuckerInterceptor(context, chuckerCollector), true)
} }
} }
@Singleton @Singleton
@Provides @Provides
fun provideChuckCollector(context: Context, prefRepository: PreferencesRepository): ChuckCollector { fun provideChuckerCollector(context: Context, prefRepository: PreferencesRepository): ChuckerCollector {
return ChuckCollector(context) return ChuckerCollector(
.showNotification(prefRepository.isDebugNotificationEnable) context = context,
.retentionManager(RetentionManager(context, ChuckCollector.Period.ONE_HOUR)) showNotification = prefRepository.isDebugNotificationEnable,
retentionPeriod = RetentionManager.Period.ONE_HOUR
)
} }
@Singleton @Singleton

View File

@ -1,7 +1,7 @@
package io.github.wulkanowy.ui.base package io.github.wulkanowy.ui.base
import android.content.res.Resources import android.content.res.Resources
import com.readystatesoftware.chuck.api.ChuckCollector import com.chuckerteam.chucker.api.ChuckerCollector
import io.github.wulkanowy.R import io.github.wulkanowy.R
import io.github.wulkanowy.data.exceptions.NoCurrentStudentException import io.github.wulkanowy.data.exceptions.NoCurrentStudentException
import io.github.wulkanowy.sdk.exception.BadCredentialsException import io.github.wulkanowy.sdk.exception.BadCredentialsException
@ -15,7 +15,7 @@ import java.net.SocketTimeoutException
import java.net.UnknownHostException import java.net.UnknownHostException
import javax.inject.Inject import javax.inject.Inject
open class ErrorHandler @Inject constructor(protected val resources: Resources, private val chuckCollector: ChuckCollector) { open class ErrorHandler @Inject constructor(protected val resources: Resources, private val chuckerCollector: ChuckerCollector) {
var showErrorMessage: (String, Throwable) -> Unit = { _, _ -> } var showErrorMessage: (String, Throwable) -> Unit = { _, _ -> }
@ -24,7 +24,7 @@ open class ErrorHandler @Inject constructor(protected val resources: Resources,
var onNoCurrentStudent: () -> Unit = {} var onNoCurrentStudent: () -> Unit = {}
fun dispatch(error: Throwable) { fun dispatch(error: Throwable) {
chuckCollector.onError(error.javaClass.simpleName, error) chuckerCollector.onError(error.javaClass.simpleName, error)
Timber.e(error, "An exception occurred while the Wulkanowy was running") Timber.e(error, "An exception occurred while the Wulkanowy was running")
proceed(error) proceed(error)
} }

View File

@ -2,7 +2,7 @@ package io.github.wulkanowy.ui.modules.login
import android.content.res.Resources import android.content.res.Resources
import android.database.sqlite.SQLiteConstraintException import android.database.sqlite.SQLiteConstraintException
import com.readystatesoftware.chuck.api.ChuckCollector import com.chuckerteam.chucker.api.ChuckerCollector
import io.github.wulkanowy.R import io.github.wulkanowy.R
import io.github.wulkanowy.sdk.exception.BadCredentialsException import io.github.wulkanowy.sdk.exception.BadCredentialsException
import io.github.wulkanowy.sdk.mobile.exception.InvalidPinException import io.github.wulkanowy.sdk.mobile.exception.InvalidPinException
@ -14,8 +14,8 @@ import javax.inject.Inject
class LoginErrorHandler @Inject constructor( class LoginErrorHandler @Inject constructor(
resources: Resources, resources: Resources,
chuckCollector: ChuckCollector chuckerCollector: ChuckerCollector
) : ErrorHandler(resources, chuckCollector) { ) : ErrorHandler(resources, chuckerCollector) {
var onBadCredentials: () -> Unit = {} var onBadCredentials: () -> Unit = {}

View File

@ -1,7 +1,7 @@
package io.github.wulkanowy.ui.modules.login.recover package io.github.wulkanowy.ui.modules.login.recover
import android.content.res.Resources import android.content.res.Resources
import com.readystatesoftware.chuck.api.ChuckCollector import com.chuckerteam.chucker.api.ChuckerCollector
import io.github.wulkanowy.sdk.scrapper.exception.InvalidCaptchaException import io.github.wulkanowy.sdk.scrapper.exception.InvalidCaptchaException
import io.github.wulkanowy.sdk.scrapper.exception.InvalidEmailException import io.github.wulkanowy.sdk.scrapper.exception.InvalidEmailException
import io.github.wulkanowy.sdk.scrapper.exception.NoAccountFoundException import io.github.wulkanowy.sdk.scrapper.exception.NoAccountFoundException
@ -10,8 +10,8 @@ import javax.inject.Inject
class RecoverErrorHandler @Inject constructor( class RecoverErrorHandler @Inject constructor(
resources: Resources, resources: Resources,
chuckCollector: ChuckCollector chuckerCollector: ChuckerCollector
) : ErrorHandler(resources, chuckCollector) { ) : ErrorHandler(resources, chuckerCollector) {
var onInvalidUsername: (String) -> Unit = {} var onInvalidUsername: (String) -> Unit = {}

View File

@ -1,6 +1,6 @@
package io.github.wulkanowy.ui.modules.settings package io.github.wulkanowy.ui.modules.settings
import com.readystatesoftware.chuck.api.ChuckCollector import com.chuckerteam.chucker.api.ChuckerCollector
import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository import io.github.wulkanowy.data.repositories.preferences.PreferencesRepository
import io.github.wulkanowy.data.repositories.student.StudentRepository import io.github.wulkanowy.data.repositories.student.StudentRepository
import io.github.wulkanowy.services.sync.SyncManager import io.github.wulkanowy.services.sync.SyncManager
@ -21,7 +21,7 @@ class SettingsPresenter @Inject constructor(
private val preferencesRepository: PreferencesRepository, private val preferencesRepository: PreferencesRepository,
private val analytics: FirebaseAnalyticsHelper, private val analytics: FirebaseAnalyticsHelper,
private val syncManager: SyncManager, private val syncManager: SyncManager,
private val chuckCollector: ChuckCollector, private val chuckerCollector: ChuckerCollector,
private val appInfo: AppInfo private val appInfo: AppInfo
) : BasePresenter<SettingsView>(errorHandler, studentRepository, schedulers) { ) : BasePresenter<SettingsView>(errorHandler, studentRepository, schedulers) {
@ -38,7 +38,7 @@ class SettingsPresenter @Inject constructor(
when (key) { when (key) {
serviceEnableKey -> with(syncManager) { if (isServiceEnabled) startSyncWorker() else stopSyncWorker() } serviceEnableKey -> with(syncManager) { if (isServiceEnabled) startSyncWorker() else stopSyncWorker() }
servicesIntervalKey, servicesOnlyWifiKey -> syncManager.startSyncWorker(true) servicesIntervalKey, servicesOnlyWifiKey -> syncManager.startSyncWorker(true)
isDebugNotificationEnableKey -> chuckCollector.showNotification(isDebugNotificationEnable) isDebugNotificationEnableKey -> chuckerCollector.showNotification = isDebugNotificationEnable
appThemeKey -> view?.recreateView() appThemeKey -> view?.recreateView()
appLanguageKey -> view?.run { appLanguageKey -> view?.run {
updateLanguage(if (appLanguage == "system") appInfo.systemLanguage else appLanguage) updateLanguage(if (appLanguage == "system") appInfo.systemLanguage else appLanguage)

View File

@ -1,15 +1,15 @@
package io.github.wulkanowy.ui.modules.timetable.completed package io.github.wulkanowy.ui.modules.timetable.completed
import android.content.res.Resources import android.content.res.Resources
import com.readystatesoftware.chuck.api.ChuckCollector import com.chuckerteam.chucker.api.ChuckerCollector
import io.github.wulkanowy.sdk.exception.FeatureDisabledException import io.github.wulkanowy.sdk.exception.FeatureDisabledException
import io.github.wulkanowy.ui.base.ErrorHandler import io.github.wulkanowy.ui.base.ErrorHandler
import javax.inject.Inject import javax.inject.Inject
class CompletedLessonsErrorHandler @Inject constructor( class CompletedLessonsErrorHandler @Inject constructor(
resources: Resources, resources: Resources,
chuckCollector: ChuckCollector chuckerCollector: ChuckerCollector
) : ErrorHandler(resources, chuckCollector) { ) : ErrorHandler(resources, chuckerCollector) {
var onFeatureDisabled: () -> Unit = {} var onFeatureDisabled: () -> Unit = {}