mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-09 08:38:43 +01:00
klint
This commit is contained in:
parent
b5cdb44642
commit
46d7db8214
@ -38,5 +38,4 @@ enum class CallState {
|
||||
|
||||
/** Terminated. Incoming/Outgoing call, the call is terminated */
|
||||
TERMINATED,
|
||||
|
||||
}
|
||||
|
@ -274,5 +274,4 @@ internal abstract class SessionModule {
|
||||
|
||||
@Binds
|
||||
abstract fun bindSharedSecretStorageService(service: DefaultSharedSecretStorageService): SharedSecretStorageService
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ internal abstract class CallModule {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Binds
|
||||
abstract fun bindCallService(service:DefaultCallSignalingService): CallSignalingService
|
||||
|
||||
|
@ -101,7 +101,7 @@ internal class DefaultCallSignalingService @Inject constructor(
|
||||
// TODO if handled by other of my sessions
|
||||
// this test is too simple, should notify upstream
|
||||
if (event.senderId == userId) {
|
||||
//ignore local echos!
|
||||
// ignore local echos!
|
||||
return
|
||||
}
|
||||
when (event.getClearType()) {
|
||||
@ -139,7 +139,6 @@ internal class DefaultCallSignalingService @Inject constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,6 @@ internal class MxCallImpl(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun offerSdp(sdp: SessionDescription) {
|
||||
if (!isOutgoing) return
|
||||
state = CallState.REMOTE_RINGING
|
||||
|
@ -15,7 +15,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package im.vector.riotx.core.services
|
||||
|
||||
import android.content.Context
|
||||
@ -90,8 +89,6 @@ class CallService : VectorService() {
|
||||
private fun displayIncomingCallNotification(intent: Intent) {
|
||||
Timber.v("displayIncomingCallNotification")
|
||||
|
||||
|
||||
|
||||
// the incoming call in progress is already displayed
|
||||
if (!TextUtils.isEmpty(mIncomingCallId)) {
|
||||
Timber.v("displayIncomingCallNotification : the incoming call in progress is already displayed")
|
||||
|
@ -46,7 +46,7 @@ class CallControlsView @JvmOverloads constructor(
|
||||
|
||||
init {
|
||||
ConstraintLayout.inflate(context, R.layout.fragment_call_controls, this)
|
||||
//layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
// layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
ButterKnife.bind(this)
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
package im.vector.riotx.features.call
|
||||
|
||||
//import im.vector.riotx.features.call.service.CallHeadsUpService
|
||||
// import im.vector.riotx.features.call.service.CallHeadsUpService
|
||||
import android.app.KeyguardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
@ -161,7 +161,6 @@ class VectorCallActivity : VectorBaseActivity(), CallControlsView.InteractionLis
|
||||
renderState(it)
|
||||
}
|
||||
|
||||
|
||||
callViewModel.viewEvents
|
||||
.observe()
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -186,7 +185,6 @@ class VectorCallActivity : VectorBaseActivity(), CallControlsView.InteractionLis
|
||||
callControlsView.updateForState(state.callState.invoke())
|
||||
when (state.callState.invoke()) {
|
||||
CallState.IDLE -> {
|
||||
|
||||
}
|
||||
CallState.DIALING -> {
|
||||
callVideoGroup.isInvisible = true
|
||||
@ -232,7 +230,6 @@ class VectorCallActivity : VectorBaseActivity(), CallControlsView.InteractionLis
|
||||
finish()
|
||||
}
|
||||
null -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -277,7 +274,6 @@ class VectorCallActivity : VectorBaseActivity(), CallControlsView.InteractionLis
|
||||
pipRenderer.setEnableHardwareScaler(true /* enabled */)
|
||||
fullscreenRenderer.setEnableHardwareScaler(true /* enabled */)
|
||||
|
||||
|
||||
peerConnectionManager.attachViewRenderers(pipRenderer, fullscreenRenderer,
|
||||
intent.getStringExtra(EXTRA_MODE)?.takeIf { isFirstCreation() })
|
||||
return false
|
||||
|
@ -120,11 +120,11 @@ class VectorCallViewModel @AssistedInject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
//session.callService().addCallListener(callServiceListener)
|
||||
// session.callService().addCallListener(callServiceListener)
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
//session.callService().removeCallListener(callServiceListener)
|
||||
// session.callService().removeCallListener(callServiceListener)
|
||||
this.call?.removeListener(callStateListener)
|
||||
super.onCleared()
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
// omit empty :/
|
||||
if (it.isNotEmpty()) {
|
||||
Timber.v("## Sending local ice candidates to call")
|
||||
//it.forEach { peerConnection?.addIceCandidate(it) }
|
||||
// it.forEach { peerConnection?.addIceCandidate(it) }
|
||||
mxCall.sendLocalIceCandidates(it)
|
||||
}
|
||||
}
|
||||
@ -103,7 +103,6 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
var remoteIceCandidateDisposable: Disposable? = null
|
||||
|
||||
fun release() {
|
||||
|
||||
remoteIceCandidateDisposable?.dispose()
|
||||
iceCandidateDisposable?.dispose()
|
||||
|
||||
@ -174,7 +173,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
.setVideoDecoderFactory(defaultVideoDecoderFactory)
|
||||
.createPeerConnectionFactory()
|
||||
|
||||
//attachViewRenderersInternal()
|
||||
// attachViewRenderersInternal()
|
||||
}
|
||||
|
||||
private fun createPeerConnection(callContext: CallContext, turnServer: TurnServer?) {
|
||||
@ -192,7 +191,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
Timber.v("## VOIP creating peer connection...with iceServers ${iceServers} ")
|
||||
Timber.v("## VOIP creating peer connection...with iceServers $iceServers ")
|
||||
callContext.peerConnection = peerConnectionFactory?.createPeerConnection(iceServers, StreamObserver(callContext))
|
||||
}
|
||||
|
||||
@ -270,7 +269,6 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
attachViewRenderersInternal()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -307,7 +305,6 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
}
|
||||
|
||||
private fun createLocalStream(callContext: CallContext) {
|
||||
|
||||
if (callContext.localMediaStream != null) {
|
||||
Timber.e("## VOIP localMediaStream already created")
|
||||
return
|
||||
@ -325,12 +322,12 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
|
||||
val localMediaStream = peerConnectionFactory!!.createLocalMediaStream("ARDAMS") // magic value?
|
||||
|
||||
//Add audio track
|
||||
// Add audio track
|
||||
localMediaStream?.addTrack(localAudioTrack)
|
||||
|
||||
callContext.localMediaStream = localMediaStream
|
||||
|
||||
//add video track if needed
|
||||
// add video track if needed
|
||||
if (callContext.mxCall.isVideoCall) {
|
||||
val cameraIterator = if (Camera2Enumerator.isSupported(context)) Camera2Enumerator(context) else Camera1Enumerator(false)
|
||||
val frontCamera = cameraIterator.deviceNames
|
||||
@ -368,7 +365,6 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
}
|
||||
|
||||
private fun attachViewRenderersInternal() {
|
||||
|
||||
// render local video in pip view
|
||||
localSurfaceRenderer?.get()?.let { pipSurface ->
|
||||
pipSurface.setMirror(true)
|
||||
@ -395,7 +391,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
|
||||
fun detachRenderers() {
|
||||
Timber.v("## VOIP detachRenderers")
|
||||
//currentCall?.localMediaStream?.let { currentCall?.peerConnection?.removeStream(it) }
|
||||
// currentCall?.localMediaStream?.let { currentCall?.peerConnection?.removeStream(it) }
|
||||
localSurfaceRenderer?.get()?.let {
|
||||
currentCall?.localVideoTrack?.removeSink(it)
|
||||
}
|
||||
@ -503,7 +499,6 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
}
|
||||
executor.execute {
|
||||
call.peerConnection?.createAnswer(object : SdpObserverAdapter() {
|
||||
|
||||
override fun onCreateSuccess(p0: SessionDescription?) {
|
||||
if (p0 == null) return
|
||||
call.peerConnection?.setLocalDescription(object : SdpObserverAdapter() {}, p0)
|
||||
@ -529,7 +524,6 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
Timber.v("## VOIP onCallAnswerReceived ${callAnswerContent.callId}")
|
||||
val sdp = SessionDescription(SessionDescription.Type.ANSWER, callAnswerContent.answer.sdp)
|
||||
call.peerConnection?.setRemoteDescription(object : SdpObserverAdapter() {
|
||||
|
||||
}, sdp)
|
||||
}
|
||||
}
|
||||
@ -560,7 +554,6 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
PeerConnection.PeerConnectionState.DISCONNECTED,
|
||||
PeerConnection.PeerConnectionState.CLOSED,
|
||||
null -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -593,7 +586,6 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
override fun onAddStream(stream: MediaStream) {
|
||||
Timber.v("## VOIP StreamObserver onAddStream: $stream")
|
||||
executor.execute {
|
||||
|
||||
// reportError("Weird-looking stream: " + stream);
|
||||
if (stream.audioTracks.size > 1 || stream.videoTracks.size > 1) return@execute
|
||||
|
||||
|
@ -23,7 +23,6 @@ import im.vector.riotx.core.di.HasVectorInjector
|
||||
import im.vector.riotx.features.call.WebRtcPeerConnectionManager
|
||||
import im.vector.riotx.features.notifications.NotificationUtils
|
||||
import im.vector.riotx.features.settings.VectorLocale.context
|
||||
import timber.log.Timber
|
||||
|
||||
class CallHeadsUpActionReceiver : BroadcastReceiver() {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
///*
|
||||
// /*
|
||||
// * Copyright (c) 2020 New Vector Ltd
|
||||
// *
|
||||
// * Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -14,36 +14,36 @@
|
||||
// * limitations under the License.
|
||||
// */
|
||||
//
|
||||
//package im.vector.riotx.features.call.service
|
||||
// package im.vector.riotx.features.call.service
|
||||
//
|
||||
//import android.app.Notification
|
||||
//import android.app.NotificationChannel
|
||||
//import android.app.NotificationManager
|
||||
//import android.app.PendingIntent
|
||||
//import android.app.Service
|
||||
//import android.content.ContentResolver.SCHEME_ANDROID_RESOURCE
|
||||
//import android.content.Context
|
||||
//import android.content.Intent
|
||||
//import android.media.AudioAttributes
|
||||
//import android.net.Uri
|
||||
//import android.os.Binder
|
||||
//import android.os.Build
|
||||
//import android.os.IBinder
|
||||
//import androidx.core.app.NotificationCompat
|
||||
//import androidx.core.content.ContextCompat
|
||||
//import androidx.core.graphics.drawable.IconCompat
|
||||
//import im.vector.matrix.android.api.session.call.MxCallDetail
|
||||
//import im.vector.riotx.R
|
||||
//import im.vector.riotx.core.extensions.vectorComponent
|
||||
//import im.vector.riotx.features.call.VectorCallActivity
|
||||
//import im.vector.riotx.features.notifications.NotificationUtils
|
||||
//import im.vector.riotx.features.themes.ThemeUtils
|
||||
// import android.app.Notification
|
||||
// import android.app.NotificationChannel
|
||||
// import android.app.NotificationManager
|
||||
// import android.app.PendingIntent
|
||||
// import android.app.Service
|
||||
// import android.content.ContentResolver.SCHEME_ANDROID_RESOURCE
|
||||
// import android.content.Context
|
||||
// import android.content.Intent
|
||||
// import android.media.AudioAttributes
|
||||
// import android.net.Uri
|
||||
// import android.os.Binder
|
||||
// import android.os.Build
|
||||
// import android.os.IBinder
|
||||
// import androidx.core.app.NotificationCompat
|
||||
// import androidx.core.content.ContextCompat
|
||||
// import androidx.core.graphics.drawable.IconCompat
|
||||
// import im.vector.matrix.android.api.session.call.MxCallDetail
|
||||
// import im.vector.riotx.R
|
||||
// import im.vector.riotx.core.extensions.vectorComponent
|
||||
// import im.vector.riotx.features.call.VectorCallActivity
|
||||
// import im.vector.riotx.features.notifications.NotificationUtils
|
||||
// import im.vector.riotx.features.themes.ThemeUtils
|
||||
//
|
||||
//class CallHeadsUpService : Service() {
|
||||
////
|
||||
//// private val CHANNEL_ID = "CallChannel"
|
||||
//// private val CHANNEL_NAME = "Call Channel"
|
||||
//// private val CHANNEL_DESCRIPTION = "Call Notifications"
|
||||
// class CallHeadsUpService : Service() {
|
||||
// //
|
||||
// // private val CHANNEL_ID = "CallChannel"
|
||||
// // private val CHANNEL_NAME = "Call Channel"
|
||||
// // private val CHANNEL_DESCRIPTION = "Call Notifications"
|
||||
//
|
||||
// lateinit var notificationUtils: NotificationUtils
|
||||
// private val binder: IBinder = CallHeadsUpServiceBinder()
|
||||
@ -59,14 +59,14 @@
|
||||
// override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
// val callHeadsUpServiceArgs: CallHeadsUpServiceArgs? = intent?.extras?.getParcelable(EXTRA_CALL_HEADS_UP_SERVICE_PARAMS)
|
||||
//
|
||||
//// createNotificationChannel()
|
||||
// // createNotificationChannel()
|
||||
//
|
||||
//// val title = callHeadsUpServiceArgs?.otherUserId ?: ""
|
||||
//// val description = when {
|
||||
//// callHeadsUpServiceArgs?.isIncomingCall == false -> getString(R.string.call_ring)
|
||||
//// callHeadsUpServiceArgs?.isVideoCall == true -> getString(R.string.incoming_video_call)
|
||||
//// else -> getString(R.string.incoming_voice_call)
|
||||
//// }
|
||||
// // val title = callHeadsUpServiceArgs?.otherUserId ?: ""
|
||||
// // val description = when {
|
||||
// // callHeadsUpServiceArgs?.isIncomingCall == false -> getString(R.string.call_ring)
|
||||
// // callHeadsUpServiceArgs?.isVideoCall == true -> getString(R.string.incoming_video_call)
|
||||
// // else -> getString(R.string.incoming_voice_call)
|
||||
// // }
|
||||
//
|
||||
// // val actions = if (callHeadsUpServiceArgs?.isIncomingCall == true) createAnswerAndRejectActions() else emptyList()
|
||||
//
|
||||
@ -78,82 +78,82 @@
|
||||
// ).let {
|
||||
// startForeground(NOTIFICATION_ID, it)
|
||||
// }
|
||||
//// createNotification(title, description, actions).also {
|
||||
//// startForeground(NOTIFICATION_ID, it)
|
||||
//// }
|
||||
// // createNotification(title, description, actions).also {
|
||||
// // startForeground(NOTIFICATION_ID, it)
|
||||
// // }
|
||||
//
|
||||
// return START_STICKY
|
||||
// }
|
||||
//
|
||||
//// private fun createNotification(title: String, content: String, actions: List<NotificationCompat.Action>): Notification {
|
||||
//// val answerCallActionReceiver = Intent(applicationContext, CallHeadsUpActionReceiver::class.java).apply {
|
||||
//// putExtra(EXTRA_CALL_ACTION_KEY, CALL_ACTION_ANSWER)
|
||||
//// }.let {
|
||||
//// PendingIntent.getBroadcast(applicationContext, CALL_ACTION_ANSWER, it, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
//// }
|
||||
//// return NotificationCompat
|
||||
//// .Builder(applicationContext, CHANNEL_ID)
|
||||
//// .setContentTitle(title)
|
||||
//// .setContentText(content)
|
||||
//// .setSmallIcon(R.drawable.ic_call)
|
||||
//// .setPriority(NotificationCompat.PRIORITY_MAX)
|
||||
//// .setWhen(0)
|
||||
//// .setCategory(NotificationCompat.CATEGORY_CALL)
|
||||
//// .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
||||
//// .setDefaults(NotificationCompat.DEFAULT_SOUND or NotificationCompat.DEFAULT_VIBRATE)
|
||||
//// .setSound(Uri.parse(SCHEME_ANDROID_RESOURCE + "://" + applicationContext.packageName + "/raw/ring.ogg"))
|
||||
//// .setVibrate(longArrayOf(1000, 1000))
|
||||
//// .setFullScreenIntent(answerCallActionReceiver, true)
|
||||
//// .setOngoing(true)
|
||||
//// //.setStyle(NotificationCompat.BigTextStyle())
|
||||
//// .setAutoCancel(true)
|
||||
//// .apply { actions.forEach { addAction(it) } }
|
||||
//// .build()
|
||||
//// }
|
||||
// // private fun createNotification(title: String, content: String, actions: List<NotificationCompat.Action>): Notification {
|
||||
// // val answerCallActionReceiver = Intent(applicationContext, CallHeadsUpActionReceiver::class.java).apply {
|
||||
// // putExtra(EXTRA_CALL_ACTION_KEY, CALL_ACTION_ANSWER)
|
||||
// // }.let {
|
||||
// // PendingIntent.getBroadcast(applicationContext, CALL_ACTION_ANSWER, it, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
// // }
|
||||
// // return NotificationCompat
|
||||
// // .Builder(applicationContext, CHANNEL_ID)
|
||||
// // .setContentTitle(title)
|
||||
// // .setContentText(content)
|
||||
// // .setSmallIcon(R.drawable.ic_call)
|
||||
// // .setPriority(NotificationCompat.PRIORITY_MAX)
|
||||
// // .setWhen(0)
|
||||
// // .setCategory(NotificationCompat.CATEGORY_CALL)
|
||||
// // .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
||||
// // .setDefaults(NotificationCompat.DEFAULT_SOUND or NotificationCompat.DEFAULT_VIBRATE)
|
||||
// // .setSound(Uri.parse(SCHEME_ANDROID_RESOURCE + "://" + applicationContext.packageName + "/raw/ring.ogg"))
|
||||
// // .setVibrate(longArrayOf(1000, 1000))
|
||||
// // .setFullScreenIntent(answerCallActionReceiver, true)
|
||||
// // .setOngoing(true)
|
||||
// // //.setStyle(NotificationCompat.BigTextStyle())
|
||||
// // .setAutoCancel(true)
|
||||
// // .apply { actions.forEach { addAction(it) } }
|
||||
// // .build()
|
||||
// // }
|
||||
//
|
||||
//// private fun createAnswerAndRejectActions(): List<NotificationCompat.Action> {
|
||||
//// val answerCallActionReceiver = Intent(applicationContext, CallHeadsUpActionReceiver::class.java).apply {
|
||||
//// putExtra(EXTRA_CALL_ACTION_KEY, CALL_ACTION_ANSWER)
|
||||
//// }
|
||||
//// val rejectCallActionReceiver = Intent(applicationContext, CallHeadsUpActionReceiver::class.java).apply {
|
||||
//// putExtra(EXTRA_CALL_ACTION_KEY, CALL_ACTION_REJECT)
|
||||
//// }
|
||||
//// val answerCallPendingIntent = PendingIntent.getBroadcast(applicationContext, CALL_ACTION_ANSWER, answerCallActionReceiver, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
//// val rejectCallPendingIntent = PendingIntent.getBroadcast(applicationContext, CALL_ACTION_REJECT, rejectCallActionReceiver, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
////
|
||||
//// return listOf(
|
||||
//// NotificationCompat.Action(
|
||||
//// R.drawable.ic_call,
|
||||
//// //IconCompat.createWithResource(applicationContext, R.drawable.ic_call).setTint(ContextCompat.getColor(applicationContext, R.color.riotx_positive_accent)),
|
||||
//// getString(R.string.call_notification_answer),
|
||||
//// answerCallPendingIntent
|
||||
//// ),
|
||||
//// NotificationCompat.Action(
|
||||
//// IconCompat.createWithResource(applicationContext, R.drawable.ic_call_end).setTint(ContextCompat.getColor(applicationContext, R.color.riotx_notice)),
|
||||
//// getString(R.string.call_notification_reject),
|
||||
//// rejectCallPendingIntent)
|
||||
//// )
|
||||
//// }
|
||||
// // private fun createAnswerAndRejectActions(): List<NotificationCompat.Action> {
|
||||
// // val answerCallActionReceiver = Intent(applicationContext, CallHeadsUpActionReceiver::class.java).apply {
|
||||
// // putExtra(EXTRA_CALL_ACTION_KEY, CALL_ACTION_ANSWER)
|
||||
// // }
|
||||
// // val rejectCallActionReceiver = Intent(applicationContext, CallHeadsUpActionReceiver::class.java).apply {
|
||||
// // putExtra(EXTRA_CALL_ACTION_KEY, CALL_ACTION_REJECT)
|
||||
// // }
|
||||
// // val answerCallPendingIntent = PendingIntent.getBroadcast(applicationContext, CALL_ACTION_ANSWER, answerCallActionReceiver, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
// // val rejectCallPendingIntent = PendingIntent.getBroadcast(applicationContext, CALL_ACTION_REJECT, rejectCallActionReceiver, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
// //
|
||||
// // return listOf(
|
||||
// // NotificationCompat.Action(
|
||||
// // R.drawable.ic_call,
|
||||
// // //IconCompat.createWithResource(applicationContext, R.drawable.ic_call).setTint(ContextCompat.getColor(applicationContext, R.color.riotx_positive_accent)),
|
||||
// // getString(R.string.call_notification_answer),
|
||||
// // answerCallPendingIntent
|
||||
// // ),
|
||||
// // NotificationCompat.Action(
|
||||
// // IconCompat.createWithResource(applicationContext, R.drawable.ic_call_end).setTint(ContextCompat.getColor(applicationContext, R.color.riotx_notice)),
|
||||
// // getString(R.string.call_notification_reject),
|
||||
// // rejectCallPendingIntent)
|
||||
// // )
|
||||
// // }
|
||||
//
|
||||
//// private fun createNotificationChannel() {
|
||||
//// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
|
||||
////
|
||||
//// val channel = NotificationChannel(CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH).apply {
|
||||
//// description = CHANNEL_DESCRIPTION
|
||||
//// setSound(
|
||||
//// Uri.parse(SCHEME_ANDROID_RESOURCE + "://" + applicationContext.packageName + "/raw/ring.ogg"),
|
||||
//// AudioAttributes
|
||||
//// .Builder()
|
||||
//// .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||
//// .setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE)
|
||||
//// .build()
|
||||
//// )
|
||||
//// lockscreenVisibility = NotificationCompat.VISIBILITY_PUBLIC
|
||||
//// enableVibration(true)
|
||||
//// enableLights(true)
|
||||
//// }
|
||||
//// applicationContext.getSystemService(NotificationManager::class.java)?.createNotificationChannel(channel)
|
||||
//// }
|
||||
// // private fun createNotificationChannel() {
|
||||
// // if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
|
||||
// //
|
||||
// // val channel = NotificationChannel(CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_HIGH).apply {
|
||||
// // description = CHANNEL_DESCRIPTION
|
||||
// // setSound(
|
||||
// // Uri.parse(SCHEME_ANDROID_RESOURCE + "://" + applicationContext.packageName + "/raw/ring.ogg"),
|
||||
// // AudioAttributes
|
||||
// // .Builder()
|
||||
// // .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||
// // .setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE)
|
||||
// // .build()
|
||||
// // )
|
||||
// // lockscreenVisibility = NotificationCompat.VISIBILITY_PUBLIC
|
||||
// // enableVibration(true)
|
||||
// // enableLights(true)
|
||||
// // }
|
||||
// // applicationContext.getSystemService(NotificationManager::class.java)?.createNotificationChannel(channel)
|
||||
// // }
|
||||
//
|
||||
// inner class CallHeadsUpServiceBinder : Binder() {
|
||||
//
|
||||
@ -165,7 +165,7 @@
|
||||
// private const val EXTRA_CALL_HEADS_UP_SERVICE_PARAMS = "EXTRA_CALL_PARAMS"
|
||||
//
|
||||
// const val EXTRA_CALL_ACTION_KEY = "EXTRA_CALL_ACTION_KEY"
|
||||
//// const val CALL_ACTION_ANSWER = 100
|
||||
// // const val CALL_ACTION_ANSWER = 100
|
||||
// const val CALL_ACTION_REJECT = 101
|
||||
//
|
||||
// private const val NOTIFICATION_ID = 999
|
||||
@ -177,4 +177,4 @@
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// }
|
||||
|
@ -320,13 +320,13 @@ class NotificationUtils @Inject constructor(private val context: Context,
|
||||
val rejectCallActionReceiver = Intent(context, CallHeadsUpActionReceiver::class.java).apply {
|
||||
// putExtra(CallHeadsUpService.EXTRA_CALL_ACTION_KEY, CallHeadsUpService.CALL_ACTION_REJECT)
|
||||
}
|
||||
//val answerCallPendingIntent = PendingIntent.getBroadcast(context, requestId, answerCallActionReceiver, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
// val answerCallPendingIntent = PendingIntent.getBroadcast(context, requestId, answerCallActionReceiver, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
val rejectCallPendingIntent = PendingIntent.getBroadcast(context, requestId + 1, rejectCallActionReceiver, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
|
||||
builder.addAction(
|
||||
NotificationCompat.Action(
|
||||
R.drawable.ic_call,
|
||||
//IconCompat.createWithResource(applicationContext, R.drawable.ic_call).setTint(ContextCompat.getColor(applicationContext, R.color.riotx_positive_accent)),
|
||||
// IconCompat.createWithResource(applicationContext, R.drawable.ic_call).setTint(ContextCompat.getColor(applicationContext, R.color.riotx_positive_accent)),
|
||||
context.getString(R.string.call_notification_answer),
|
||||
answerCallPendingIntent
|
||||
)
|
||||
@ -376,7 +376,7 @@ class NotificationUtils @Inject constructor(private val context: Context,
|
||||
|
||||
val contentPendingIntent = TaskStackBuilder.create(context)
|
||||
.addNextIntentWithParentStack(Intent(context, HomeActivity::class.java))
|
||||
//TODO other userId
|
||||
// TODO other userId
|
||||
.addNextIntent(VectorCallActivity.newIntent(context, callId, roomId, "otherUserId", true, isVideo, false, null))
|
||||
.getPendingIntent(System.currentTimeMillis().toInt(), PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user