mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 18:35:40 +03:00
Bind to screen sharing service after app killed and relaunched.
This commit is contained in:
parent
b486559469
commit
cf3d145cd6
2 changed files with 11 additions and 2 deletions
|
@ -164,6 +164,9 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bind to service in case of user killed the app while there is an ongoing call
|
||||
bindToScreenCaptureService()
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent?) {
|
||||
|
@ -662,9 +665,13 @@ class VectorCallActivity : VectorBaseActivity<ActivityCallBinding>(), CallContro
|
|||
this,
|
||||
Intent(this, ScreenCaptureService::class.java)
|
||||
)
|
||||
bindToScreenCaptureService(activityResult)
|
||||
}
|
||||
|
||||
private fun bindToScreenCaptureService(activityResult: ActivityResult? = null) {
|
||||
screenCaptureServiceConnection.bind(object : ScreenCaptureServiceConnection.Callback {
|
||||
override fun onServiceConnected() {
|
||||
startScreenSharing(activityResult)
|
||||
activityResult?.let { startScreenSharing(it) }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -38,7 +38,9 @@ class ScreenCaptureServiceConnection @Inject constructor(
|
|||
fun bind(callback: Callback) {
|
||||
this.callback = callback
|
||||
|
||||
if (!isBound) {
|
||||
if (isBound) {
|
||||
callback.onServiceConnected()
|
||||
} else {
|
||||
Intent(context, ScreenCaptureService::class.java).also { intent ->
|
||||
context.bindService(intent, this, 0)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue