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

View File

@ -89,11 +89,11 @@ class VectorSyncService : SyncService() {
} }
override fun onRescheduleAsked(sessionId: String, isInitialSync: Boolean, timeout: Int, delay: Int) { 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) { 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 = val rescheduleSyncWorkRequest: WorkRequest =
OneTimeWorkRequestBuilder<RestartWhenNetworkOn>() OneTimeWorkRequestBuilder<RestartWhenNetworkOn>()
.setInputData(Data.Builder() .setInputData(Data.Builder()
@ -137,8 +137,11 @@ class VectorSyncService : SyncService() {
} }
} }
private fun Context.rescheduleSyncService(sessionId: String, timeout: Int, delay: Int, networkBack: Boolean = false) { private fun Context.rescheduleSyncService(sessionId: String,
val periodicIntent = VectorSyncService.newPeriodicIntent(this, sessionId, timeout, delay, networkBack) 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) { val pendingIntent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
PendingIntent.getForegroundService(this, 0, periodicIntent, 0) PendingIntent.getForegroundService(this, 0, periodicIntent, 0)
} else { } else {