Avoid default value for param

This commit is contained in:
Benoit Marty 2021-01-12 11:21:22 +01:00 committed by Benoit Marty
parent b69d8ad71a
commit 561b89830a
1 changed files with 7 additions and 4 deletions

View File

@ -89,11 +89,11 @@ class VectorSyncService : SyncService() {
}
override fun onRescheduleAsked(sessionId: String, isInitialSync: Boolean, timeout: Int, delay: Int) {
rescheduleSyncService(sessionId, timeout, delay)
rescheduleSyncService(sessionId, timeout, delay, false)
}
override fun onNetworkError(sessionId: String, isInitialSync: Boolean, timeout: Int, delay: Int) {
Timber.d("## Sync: A network error occured during sync")
Timber.d("## Sync: A network error occurred during sync")
val rescheduleSyncWorkRequest: WorkRequest =
OneTimeWorkRequestBuilder<RestartWhenNetworkOn>()
.setInputData(Data.Builder()
@ -137,8 +137,11 @@ class VectorSyncService : SyncService() {
}
}
private fun Context.rescheduleSyncService(sessionId: String, timeout: Int, delay: Int, networkBack: Boolean = false) {
val periodicIntent = VectorSyncService.newPeriodicIntent(this, sessionId, timeout, delay, networkBack)
private fun Context.rescheduleSyncService(sessionId: String,
timeout: Int,
delay: Int,
isNetworkBack: Boolean) {
val periodicIntent = VectorSyncService.newPeriodicIntent(this, sessionId, timeout, delay, isNetworkBack)
val pendingIntent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
PendingIntent.getForegroundService(this, 0, periodicIntent, 0)
} else {