Stop using internal context of VectorLocal in CallHeadsUpActionReceiver...
This commit is contained in:
parent
69e9a79ac1
commit
efa3aa5cf8
|
@ -21,8 +21,6 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import im.vector.app.core.di.HasVectorInjector
|
||||
import im.vector.app.features.call.WebRtcPeerConnectionManager
|
||||
import im.vector.app.features.notifications.NotificationUtils
|
||||
import im.vector.app.features.settings.VectorLocale.context
|
||||
import timber.log.Timber
|
||||
|
||||
class CallHeadsUpActionReceiver : BroadcastReceiver() {
|
||||
|
@ -32,20 +30,14 @@ class CallHeadsUpActionReceiver : BroadcastReceiver() {
|
|||
const val CALL_ACTION_REJECT = 0
|
||||
}
|
||||
|
||||
private lateinit var peerConnectionManager: WebRtcPeerConnectionManager
|
||||
private lateinit var notificationUtils: NotificationUtils
|
||||
|
||||
init {
|
||||
val appContext = context.applicationContext
|
||||
if (appContext is HasVectorInjector) {
|
||||
peerConnectionManager = appContext.injector().webRtcPeerConnectionManager()
|
||||
notificationUtils = appContext.injector().notificationUtils()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent?) {
|
||||
val peerConnectionManager = (context.applicationContext as? HasVectorInjector)
|
||||
?.injector()
|
||||
?.webRtcPeerConnectionManager()
|
||||
?: return
|
||||
|
||||
when (intent?.getIntExtra(EXTRA_CALL_ACTION_KEY, 0)) {
|
||||
CALL_ACTION_REJECT -> onCallRejectClicked()
|
||||
CALL_ACTION_REJECT -> onCallRejectClicked(peerConnectionManager)
|
||||
}
|
||||
|
||||
// Not sure why this should be needed
|
||||
|
@ -56,7 +48,7 @@ class CallHeadsUpActionReceiver : BroadcastReceiver() {
|
|||
// context.stopService(Intent(context, CallHeadsUpService::class.java))
|
||||
}
|
||||
|
||||
private fun onCallRejectClicked() {
|
||||
private fun onCallRejectClicked(peerConnectionManager: WebRtcPeerConnectionManager) {
|
||||
Timber.d("onCallRejectClicked")
|
||||
peerConnectionManager.endCall()
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ object VectorLocale {
|
|||
var applicationLocale = defaultLocale
|
||||
private set
|
||||
|
||||
lateinit var context: Context
|
||||
private lateinit var context: Context
|
||||
|
||||
/**
|
||||
* Init this object
|
||||
|
|
Loading…
Reference in New Issue