VoIP: clean code and fix decline/reject state

This commit is contained in:
ganfra 2020-12-22 17:29:24 +01:00
parent d87beff434
commit e0cd210852
5 changed files with 11 additions and 10 deletions

View file

@ -51,7 +51,10 @@ data class CallTransferArgs(val callId: String) : Parcelable
private const val USER_LIST_FRAGMENT_TAG = "USER_LIST_FRAGMENT_TAG"
class CallTransferActivity : VectorBaseActivity<ActivityCallTransferBinding>(), CallTransferViewModel.Factory, UserListViewModel.Factory, ContactsBookViewModel.Factory {
class CallTransferActivity : VectorBaseActivity<ActivityCallTransferBinding>(),
CallTransferViewModel.Factory,
UserListViewModel.Factory,
ContactsBookViewModel.Factory {
private lateinit var sharedActionViewModel: UserListSharedActionViewModel
@Inject lateinit var userListViewModelFactory: UserListViewModel.Factory

View file

@ -17,7 +17,6 @@
package im.vector.app.features.call.transfer
import im.vector.app.core.platform.VectorViewEvents
import im.vector.app.features.roommemberprofile.RoomMemberProfileViewEvents
sealed class CallTransferViewEvents : VectorViewEvents {
object Dismiss : CallTransferViewEvents()

View file

@ -18,7 +18,6 @@ package im.vector.app.features.call.transfer
import androidx.lifecycle.viewModelScope
import com.airbnb.mvrx.ActivityViewModelContext
import com.airbnb.mvrx.Fail
import com.airbnb.mvrx.MvRxViewModelFactory
import com.airbnb.mvrx.ViewModelContext
import com.squareup.inject.assisted.Assisted
@ -29,7 +28,6 @@ import im.vector.app.features.call.webrtc.WebRtcCallManager
import kotlinx.coroutines.launch
import org.matrix.android.sdk.api.session.call.CallState
import org.matrix.android.sdk.api.session.call.MxCall
import timber.log.Timber
class CallTransferViewModel @AssistedInject constructor(@Assisted initialState: CallTransferViewState,
private val callManager: WebRtcCallManager)

View file

@ -711,7 +711,6 @@ class WebRtcCall(val mxCall: MxCall,
if (mxCall.state == CallState.Terminated) {
return
}
mxCall.state = CallState.Terminated
// Close tracks ASAP
localVideoTrack?.setEnabled(false)
localVideoTrack?.setEnabled(false)
@ -724,11 +723,13 @@ class WebRtcCall(val mxCall: MxCall,
}
onCallEnded(this)
if (originatedByMe) {
if (mxCall.state is CallState.Connected || mxCall.isOutgoing) {
mxCall.hangUp(reason)
} else {
if (mxCall.state is CallState.LocalRinging) {
mxCall.reject()
} else {
mxCall.hangUp(reason)
}
} else {
mxCall.state = CallState.Terminated
}
}

View file

@ -67,12 +67,12 @@ class UserListFragment @Inject constructor(
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
sharedActionViewModel = activityViewModelProvider.get(UserListSharedActionViewModel::class.java)
if(args.showToolbar) {
if (args.showToolbar) {
views.userListTitle.text = args.title
vectorBaseActivity.setSupportActionBar(views.userListToolbar)
setupCloseView()
views.userListToolbar.isVisible = true
}else{
} else {
views.userListToolbar.isVisible = false
}
setupRecyclerView()