diff --git a/app/build.gradle b/app/build.gradle
index c5aaeb0a4..ef9cf8e64 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -113,7 +113,8 @@ ext {
work_manager = "2.3.4"
room = "2.2.5"
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"
}
@@ -122,7 +123,7 @@ configurations.all {
}
dependencies {
- implementation "io.github.wulkanowy:sdk:85d47f6"
+ implementation "io.github.wulkanowy:sdk:be7ed9c"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "androidx.core:core-ktx:1.2.0"
@@ -182,9 +183,9 @@ dependencies {
playImplementation "com.google.firebase:firebase-core:17.2.3"
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"
testImplementation "junit:junit:4.13"
diff --git a/app/src/debug/res/values/preferences_defaults.xml b/app/src/debug/res/values/preferences_defaults.xml
new file mode 100644
index 000000000..f5a12464f
--- /dev/null
+++ b/app/src/debug/res/values/preferences_defaults.xml
@@ -0,0 +1,4 @@
+
+
+ true
+
diff --git a/app/src/main/java/io/github/wulkanowy/data/RepositoryModule.kt b/app/src/main/java/io/github/wulkanowy/data/RepositoryModule.kt
index 48e51e3ce..cb2daf685 100644
--- a/app/src/main/java/io/github/wulkanowy/data/RepositoryModule.kt
+++ b/app/src/main/java/io/github/wulkanowy/data/RepositoryModule.kt
@@ -7,9 +7,9 @@ import android.content.res.Resources
import androidx.preference.PreferenceManager
import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.InternetObservingSettings
import com.github.pwittchen.reactivenetwork.library.rx2.internet.observing.strategy.WalledGardenInternetObservingStrategy
-import com.readystatesoftware.chuck.api.ChuckCollector
-import com.readystatesoftware.chuck.api.ChuckInterceptor
-import com.readystatesoftware.chuck.api.RetentionManager
+import com.chuckerteam.chucker.api.ChuckerCollector
+import com.chuckerteam.chucker.api.ChuckerInterceptor
+import com.chuckerteam.chucker.api.RetentionManager
import dagger.Module
import dagger.Provides
import io.github.wulkanowy.data.db.AppDatabase
@@ -32,23 +32,25 @@ internal class RepositoryModule {
@Singleton
@Provides
- fun provideSdk(chuckCollector: ChuckCollector, context: Context): Sdk {
+ fun provideSdk(chuckerCollector: ChuckerCollector, context: Context): Sdk {
return Sdk().apply {
androidVersion = android.os.Build.VERSION.RELEASE
buildTag = android.os.Build.MODEL
setSimpleHttpLogger { Timber.d(it) }
// for debug only
- addInterceptor(ChuckInterceptor(context, chuckCollector).maxContentLength(250000L), true)
+ addInterceptor(ChuckerInterceptor(context, chuckerCollector), true)
}
}
@Singleton
@Provides
- fun provideChuckCollector(context: Context, prefRepository: PreferencesRepository): ChuckCollector {
- return ChuckCollector(context)
- .showNotification(prefRepository.isDebugNotificationEnable)
- .retentionManager(RetentionManager(context, ChuckCollector.Period.ONE_HOUR))
+ fun provideChuckerCollector(context: Context, prefRepository: PreferencesRepository): ChuckerCollector {
+ return ChuckerCollector(
+ context = context,
+ showNotification = prefRepository.isDebugNotificationEnable,
+ retentionPeriod = RetentionManager.Period.ONE_HOUR
+ )
}
@Singleton
diff --git a/app/src/main/java/io/github/wulkanowy/ui/base/ErrorHandler.kt b/app/src/main/java/io/github/wulkanowy/ui/base/ErrorHandler.kt
index ba10af6bf..34dc3418b 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/base/ErrorHandler.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/base/ErrorHandler.kt
@@ -1,7 +1,7 @@
package io.github.wulkanowy.ui.base
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.data.exceptions.NoCurrentStudentException
import io.github.wulkanowy.sdk.exception.BadCredentialsException
@@ -15,7 +15,7 @@ import java.net.SocketTimeoutException
import java.net.UnknownHostException
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 = { _, _ -> }
@@ -24,7 +24,7 @@ open class ErrorHandler @Inject constructor(protected val resources: Resources,
var onNoCurrentStudent: () -> Unit = {}
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")
proceed(error)
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/login/LoginErrorHandler.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/login/LoginErrorHandler.kt
index 090fe6de9..5ed181bf1 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/login/LoginErrorHandler.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/login/LoginErrorHandler.kt
@@ -2,7 +2,7 @@ package io.github.wulkanowy.ui.modules.login
import android.content.res.Resources
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.sdk.exception.BadCredentialsException
import io.github.wulkanowy.sdk.mobile.exception.InvalidPinException
@@ -14,8 +14,8 @@ import javax.inject.Inject
class LoginErrorHandler @Inject constructor(
resources: Resources,
- chuckCollector: ChuckCollector
-) : ErrorHandler(resources, chuckCollector) {
+ chuckerCollector: ChuckerCollector
+) : ErrorHandler(resources, chuckerCollector) {
var onBadCredentials: () -> Unit = {}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/login/recover/RecoverErrorHandler.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/login/recover/RecoverErrorHandler.kt
index ef81c410b..110dd82e5 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/login/recover/RecoverErrorHandler.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/login/recover/RecoverErrorHandler.kt
@@ -1,7 +1,7 @@
package io.github.wulkanowy.ui.modules.login.recover
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.InvalidEmailException
import io.github.wulkanowy.sdk.scrapper.exception.NoAccountFoundException
@@ -10,8 +10,8 @@ import javax.inject.Inject
class RecoverErrorHandler @Inject constructor(
resources: Resources,
- chuckCollector: ChuckCollector
-) : ErrorHandler(resources, chuckCollector) {
+ chuckerCollector: ChuckerCollector
+) : ErrorHandler(resources, chuckerCollector) {
var onInvalidUsername: (String) -> Unit = {}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsPresenter.kt
index 89ba0ee5e..3f2bf714c 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/settings/SettingsPresenter.kt
@@ -1,6 +1,6 @@
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.student.StudentRepository
import io.github.wulkanowy.services.sync.SyncManager
@@ -21,7 +21,7 @@ class SettingsPresenter @Inject constructor(
private val preferencesRepository: PreferencesRepository,
private val analytics: FirebaseAnalyticsHelper,
private val syncManager: SyncManager,
- private val chuckCollector: ChuckCollector,
+ private val chuckerCollector: ChuckerCollector,
private val appInfo: AppInfo
) : BasePresenter(errorHandler, studentRepository, schedulers) {
@@ -38,7 +38,7 @@ class SettingsPresenter @Inject constructor(
when (key) {
serviceEnableKey -> with(syncManager) { if (isServiceEnabled) startSyncWorker() else stopSyncWorker() }
servicesIntervalKey, servicesOnlyWifiKey -> syncManager.startSyncWorker(true)
- isDebugNotificationEnableKey -> chuckCollector.showNotification(isDebugNotificationEnable)
+ isDebugNotificationEnableKey -> chuckerCollector.showNotification = isDebugNotificationEnable
appThemeKey -> view?.recreateView()
appLanguageKey -> view?.run {
updateLanguage(if (appLanguage == "system") appInfo.systemLanguage else appLanguage)
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsErrorHandler.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsErrorHandler.kt
index 1d043af3a..c1389cedd 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsErrorHandler.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsErrorHandler.kt
@@ -1,15 +1,15 @@
package io.github.wulkanowy.ui.modules.timetable.completed
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.ui.base.ErrorHandler
import javax.inject.Inject
class CompletedLessonsErrorHandler @Inject constructor(
resources: Resources,
- chuckCollector: ChuckCollector
-) : ErrorHandler(resources, chuckCollector) {
+ chuckerCollector: ChuckerCollector
+) : ErrorHandler(resources, chuckerCollector) {
var onFeatureDisabled: () -> Unit = {}