mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 03:49:04 +03:00
avoiding using the matrix getInstance internally within the sdk to allow us to inject a consistent instance
This commit is contained in:
parent
49a0555704
commit
2d80c6bc4e
2 changed files with 7 additions and 1 deletions
|
@ -192,12 +192,14 @@ abstract class SyncService : Service() {
|
|||
}
|
||||
}
|
||||
|
||||
abstract fun provideMatrix(): Matrix
|
||||
|
||||
private fun initialize(intent: Intent?): Boolean {
|
||||
if (intent == null) {
|
||||
Timber.d("## Sync: initialize intent is null")
|
||||
return false
|
||||
}
|
||||
val matrix = Matrix.getInstance(applicationContext)
|
||||
val matrix = provideMatrix()
|
||||
val safeSessionId = intent.getStringExtra(EXTRA_SESSION_ID) ?: return false
|
||||
syncTimeoutSeconds = intent.getIntExtra(EXTRA_TIMEOUT_SECONDS, getDefaultSyncTimeoutSeconds())
|
||||
syncDelaySeconds = intent.getIntExtra(EXTRA_DELAY_SECONDS, getDefaultSyncDelaySeconds())
|
||||
|
|
|
@ -35,6 +35,7 @@ import im.vector.app.R
|
|||
import im.vector.app.core.platform.PendingIntentCompat
|
||||
import im.vector.app.features.notifications.NotificationUtils
|
||||
import im.vector.app.features.settings.BackgroundSyncMode
|
||||
import org.matrix.android.sdk.api.Matrix
|
||||
import org.matrix.android.sdk.internal.session.sync.job.SyncService
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
@ -75,6 +76,9 @@ class VectorSyncService : SyncService() {
|
|||
}
|
||||
|
||||
@Inject lateinit var notificationUtils: NotificationUtils
|
||||
@Inject lateinit var matrix: Matrix
|
||||
|
||||
override fun provideMatrix() = matrix
|
||||
|
||||
override fun getDefaultSyncDelaySeconds() = BackgroundSyncMode.DEFAULT_SYNC_DELAY_SECONDS
|
||||
|
||||
|
|
Loading…
Reference in a new issue