mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
VoIP: clean code and fix decline/reject state
This commit is contained in:
parent
d87beff434
commit
e0cd210852
5 changed files with 11 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue