mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-22 14:38:15 +08:00
Use clock.
This commit is contained in:
parent
fbef34f3b2
commit
ebfac823c5
@ -23,12 +23,14 @@ import dagger.hilt.android.AndroidEntryPoint
|
|||||||
import im.vector.app.core.extensions.startForegroundCompat
|
import im.vector.app.core.extensions.startForegroundCompat
|
||||||
import im.vector.app.core.services.VectorAndroidService
|
import im.vector.app.core.services.VectorAndroidService
|
||||||
import im.vector.app.features.notifications.NotificationUtils
|
import im.vector.app.features.notifications.NotificationUtils
|
||||||
|
import im.vector.lib.core.utils.timer.Clock
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class MicrophoneAccessService : VectorAndroidService() {
|
class MicrophoneAccessService : VectorAndroidService() {
|
||||||
|
|
||||||
@Inject lateinit var notificationUtils: NotificationUtils
|
@Inject lateinit var notificationUtils: NotificationUtils
|
||||||
|
@Inject lateinit var clock: Clock
|
||||||
private val binder = LocalBinder()
|
private val binder = LocalBinder()
|
||||||
|
|
||||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||||
@ -38,7 +40,7 @@ class MicrophoneAccessService : VectorAndroidService() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun showMicrophoneAccessNotification() {
|
private fun showMicrophoneAccessNotification() {
|
||||||
val notificationId = System.currentTimeMillis().toInt()
|
val notificationId = clock.epochMillis().toInt()
|
||||||
val notification = notificationUtils.buildMicrophoneAccessNotification()
|
val notification = notificationUtils.buildMicrophoneAccessNotification()
|
||||||
startForegroundCompat(notificationId, notification)
|
startForegroundCompat(notificationId, notification)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user