Rename existing SyncService to SyncAndroidService to avoid confusion
This commit is contained in:
parent
f62d598b79
commit
dd22cdf7f2
@ -46,7 +46,7 @@ import java.util.concurrent.atomic.AtomicBoolean
|
||||
* in order to be able to perform a sync even if the app is not running.
|
||||
* The <receiver> and <service> must be declared in the Manifest or the app using the SDK
|
||||
*/
|
||||
abstract class SyncService : Service() {
|
||||
abstract class SyncAndroidService : Service() {
|
||||
|
||||
private var sessionId: String? = null
|
||||
private var mIsSelfDestroyed: Boolean = false
|
@ -26,9 +26,9 @@ import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.getSystemService
|
||||
import im.vector.app.core.extensions.singletonEntryPoint
|
||||
import im.vector.app.core.platform.PendingIntentCompat
|
||||
import im.vector.app.core.services.VectorSyncService
|
||||
import im.vector.app.core.services.VectorSyncAndroidService
|
||||
import im.vector.app.core.time.Clock
|
||||
import org.matrix.android.sdk.api.session.sync.job.SyncService
|
||||
import org.matrix.android.sdk.api.session.sync.job.SyncAndroidService
|
||||
import timber.log.Timber
|
||||
|
||||
class AlarmSyncBroadcastReceiver : BroadcastReceiver() {
|
||||
@ -43,8 +43,8 @@ class AlarmSyncBroadcastReceiver : BroadcastReceiver() {
|
||||
val vectorPreferences = singletonEntryPoint.vectorPreferences()
|
||||
val clock = singletonEntryPoint.clock()
|
||||
|
||||
val sessionId = intent.getStringExtra(SyncService.EXTRA_SESSION_ID) ?: return
|
||||
VectorSyncService.newPeriodicIntent(
|
||||
val sessionId = intent.getStringExtra(SyncAndroidService.EXTRA_SESSION_ID) ?: return
|
||||
VectorSyncAndroidService.newPeriodicIntent(
|
||||
context = context,
|
||||
sessionId = sessionId,
|
||||
syncTimeoutSeconds = vectorPreferences.backgroundSyncTimeOut(),
|
||||
@ -69,8 +69,8 @@ class AlarmSyncBroadcastReceiver : BroadcastReceiver() {
|
||||
// Reschedule
|
||||
Timber.v("## Sync: Scheduling alarm for background sync in $delayInSeconds seconds")
|
||||
val intent = Intent(context, AlarmSyncBroadcastReceiver::class.java).apply {
|
||||
putExtra(SyncService.EXTRA_SESSION_ID, sessionId)
|
||||
putExtra(SyncService.EXTRA_PERIODIC, true)
|
||||
putExtra(SyncAndroidService.EXTRA_SESSION_ID, sessionId)
|
||||
putExtra(SyncAndroidService.EXTRA_PERIODIC, true)
|
||||
}
|
||||
val pIntent = PendingIntent.getBroadcast(
|
||||
context,
|
||||
@ -100,7 +100,7 @@ class AlarmSyncBroadcastReceiver : BroadcastReceiver() {
|
||||
alarmMgr.cancel(pIntent)
|
||||
|
||||
// Stop current service to restart
|
||||
VectorSyncService.stopIntent(context).let {
|
||||
VectorSyncAndroidService.stopIntent(context).let {
|
||||
try {
|
||||
ContextCompat.startForegroundService(context, it)
|
||||
} catch (ex: Throwable) {
|
||||
|
@ -358,7 +358,7 @@
|
||||
|
||||
<!-- Add tools:ignore="Instantiatable" for the error reported only by Buildkite and for lintGplayRelease check :/ -->
|
||||
<service
|
||||
android:name=".core.services.VectorSyncService"
|
||||
android:name=".core.services.VectorSyncAndroidService"
|
||||
android:exported="false"
|
||||
tools:ignore="Instantiatable" />
|
||||
|
||||
|
@ -20,7 +20,7 @@ import android.content.Context
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.ProcessLifecycleOwner
|
||||
import im.vector.app.core.services.VectorSyncService
|
||||
import im.vector.app.core.services.VectorSyncAndroidService
|
||||
import im.vector.app.features.session.VectorSessionStore
|
||||
import org.matrix.android.sdk.api.session.Session
|
||||
import org.matrix.android.sdk.api.session.crypto.keysbackup.KeysBackupState
|
||||
@ -42,7 +42,7 @@ fun Session.startSyncing(context: Context) {
|
||||
val applicationContext = context.applicationContext
|
||||
if (!syncService().hasAlreadySynced()) {
|
||||
// initial sync is done as a service so it can continue below app lifecycle
|
||||
VectorSyncService.newOneShotIntent(
|
||||
VectorSyncAndroidService.newOneShotIntent(
|
||||
context = applicationContext,
|
||||
sessionId = sessionId
|
||||
)
|
||||
|
@ -38,12 +38,12 @@ import im.vector.app.core.time.DefaultClock
|
||||
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.api.session.sync.job.SyncService
|
||||
import org.matrix.android.sdk.api.session.sync.job.SyncAndroidService
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class VectorSyncService : SyncService() {
|
||||
class VectorSyncAndroidService : SyncAndroidService() {
|
||||
|
||||
companion object {
|
||||
|
||||
@ -51,7 +51,7 @@ class VectorSyncService : SyncService() {
|
||||
context: Context,
|
||||
sessionId: String
|
||||
): Intent {
|
||||
return Intent(context, VectorSyncService::class.java).also {
|
||||
return Intent(context, VectorSyncAndroidService::class.java).also {
|
||||
it.putExtra(EXTRA_SESSION_ID, sessionId)
|
||||
it.putExtra(EXTRA_TIMEOUT_SECONDS, 0)
|
||||
it.putExtra(EXTRA_PERIODIC, false)
|
||||
@ -65,7 +65,7 @@ class VectorSyncService : SyncService() {
|
||||
syncDelaySeconds: Int,
|
||||
isNetworkBack: Boolean
|
||||
): Intent {
|
||||
return Intent(context, VectorSyncService::class.java).also {
|
||||
return Intent(context, VectorSyncAndroidService::class.java).also {
|
||||
it.putExtra(EXTRA_SESSION_ID, sessionId)
|
||||
it.putExtra(EXTRA_TIMEOUT_SECONDS, syncTimeoutSeconds)
|
||||
it.putExtra(EXTRA_PERIODIC, true)
|
||||
@ -75,7 +75,7 @@ class VectorSyncService : SyncService() {
|
||||
}
|
||||
|
||||
fun stopIntent(context: Context): Intent {
|
||||
return Intent(context, VectorSyncService::class.java).also {
|
||||
return Intent(context, VectorSyncAndroidService::class.java).also {
|
||||
it.action = ACTION_STOP
|
||||
}
|
||||
}
|
||||
@ -209,7 +209,7 @@ private fun Context.rescheduleSyncService(
|
||||
) {
|
||||
Timber.d("## Sync: rescheduleSyncService")
|
||||
val intent = if (isPeriodic) {
|
||||
VectorSyncService.newPeriodicIntent(
|
||||
VectorSyncAndroidService.newPeriodicIntent(
|
||||
context = this,
|
||||
sessionId = sessionId,
|
||||
syncTimeoutSeconds = syncTimeoutSeconds,
|
||||
@ -217,7 +217,7 @@ private fun Context.rescheduleSyncService(
|
||||
isNetworkBack = isNetworkBack
|
||||
)
|
||||
} else {
|
||||
VectorSyncService.newOneShotIntent(
|
||||
VectorSyncAndroidService.newOneShotIntent(
|
||||
context = this,
|
||||
sessionId = sessionId
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user