mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Let the Activity that created the result intent deserialize it.
This commit is contained in:
parent
6fd47594d4
commit
ffd2a762af
2 changed files with 13 additions and 10 deletions
|
@ -55,7 +55,6 @@ import im.vector.app.databinding.ActivityCallBinding
|
|||
import im.vector.app.features.call.dialpad.CallDialPadBottomSheet
|
||||
import im.vector.app.features.call.dialpad.DialPadFragment
|
||||
import im.vector.app.features.call.transfer.CallTransferActivity
|
||||
import im.vector.app.features.call.transfer.CallTransferResult
|
||||
import im.vector.app.features.call.utils.EglUtils
|
||||
import im.vector.app.features.call.webrtc.WebRtcCall
|
||||
import im.vector.app.features.call.webrtc.WebRtcCallManager
|
||||
|
@ -532,15 +531,13 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
|||
}
|
||||
|
||||
private val callTransferActivityResultLauncher = registerStartForActivityResult { activityResult ->
|
||||
|
||||
when (activityResult.resultCode) {
|
||||
Activity.RESULT_CANCELED -> {
|
||||
callViewModel.handle(VectorCallViewActions.CallTransferSelectionCancelled)
|
||||
}
|
||||
Activity.RESULT_OK -> {
|
||||
activityResult.data?.extras?.getParcelable<CallTransferResult>(CallTransferActivity.EXTRA_TRANSFER_RESULT)?.also {
|
||||
callViewModel.handle(VectorCallViewActions.CallTransferSelectionResult(it))
|
||||
}
|
||||
CallTransferActivity.getCallTransferResult(activityResult.data)
|
||||
?.let { callViewModel.handle(VectorCallViewActions.CallTransferSelectionResult(it)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.google.android.material.tabs.TabLayoutMediator
|
|||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.error.ErrorFormatter
|
||||
import im.vector.app.core.extensions.exhaustive
|
||||
import im.vector.app.core.platform.VectorBaseActivity
|
||||
import im.vector.app.databinding.ActivityCallTransferBinding
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
@ -56,7 +57,7 @@ class CallTransferActivity : VectorBaseActivity<ActivityCallTransferBinding>() {
|
|||
callTransferViewModel.observeViewEvents {
|
||||
when (it) {
|
||||
is CallTransferViewEvents.Complete -> handleComplete()
|
||||
}
|
||||
}.exhaustive
|
||||
}
|
||||
|
||||
sectionsPagerAdapter = CallTransferPagerAdapter(this)
|
||||
|
@ -104,11 +105,16 @@ class CallTransferActivity : VectorBaseActivity<ActivityCallTransferBinding>() {
|
|||
}
|
||||
|
||||
companion object {
|
||||
const val EXTRA_TRANSFER_RESULT = "EXTRA_TRANSFER_RESULT"
|
||||
private const val EXTRA_TRANSFER_RESULT = "EXTRA_TRANSFER_RESULT"
|
||||
|
||||
fun newIntent(context: Context, callId: String): Intent {
|
||||
return Intent(context, CallTransferActivity::class.java).also {
|
||||
it.putExtra(Mavericks.KEY_ARG, CallTransferArgs(callId))
|
||||
}
|
||||
}
|
||||
|
||||
fun getCallTransferResult(intent: Intent?): CallTransferResult? {
|
||||
return intent?.extras?.getParcelable(EXTRA_TRANSFER_RESULT)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue