From 9794b3a49d4caf115a62586036346d354287ff54 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 20 Sep 2019 17:35:10 +0200 Subject: [PATCH] Fix compilation issue of F-Droid build --- .../vector/riotx/fdroid/service/VectorSyncService.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vector/src/fdroid/java/im/vector/riotx/fdroid/service/VectorSyncService.kt b/vector/src/fdroid/java/im/vector/riotx/fdroid/service/VectorSyncService.kt index a3f999a001..b2a45eff81 100644 --- a/vector/src/fdroid/java/im/vector/riotx/fdroid/service/VectorSyncService.kt +++ b/vector/src/fdroid/java/im/vector/riotx/fdroid/service/VectorSyncService.kt @@ -21,11 +21,19 @@ import android.content.Intent import android.os.Build import im.vector.matrix.android.internal.session.sync.job.SyncService import im.vector.riotx.R +import im.vector.riotx.core.extensions.vectorComponent import im.vector.riotx.features.notifications.NotificationUtils import timber.log.Timber class VectorSyncService : SyncService() { + private lateinit var notificationUtils: NotificationUtils + + override fun onCreate() { + super.onCreate() + notificationUtils = vectorComponent().notificationUtils() + } + override fun onDestroy() { removeForegroundNotif() super.onDestroy() @@ -43,7 +51,7 @@ class VectorSyncService : SyncService() { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { Timber.v("VectorSyncService - onStartCommand ") if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - val notification = NotificationUtils.buildForegroundServiceNotification(applicationContext, R.string.notification_listening_for_events, false) + val notification = notificationUtils.buildForegroundServiceNotification(R.string.notification_listening_for_events, false) startForeground(NotificationUtils.NOTIFICATION_ID_FOREGROUND_SERVICE, notification) } return super.onStartCommand(intent, flags, startId)