Update the code to improve readability

This commit is contained in:
Benoit Marty 2024-11-22 11:13:13 +01:00
parent 1503d2f00d
commit c411572d6b

View file

@ -198,21 +198,26 @@ class ElementCallActivity :
?: intent.dataString?.let(::parseUrl)?.let(::ExternalUrl) ?: intent.dataString?.let(::parseUrl)?.let(::ExternalUrl)
} }
val currentCallType = webViewTarget.value val currentCallType = webViewTarget.value
if (currentCallType == null && callType == null) { if (currentCallType == null) {
Timber.tag(loggerTag.value).d("Re-opened the activity but we have no url to load or a cached one, finish the activity") if (callType == null) {
finish() Timber.tag(loggerTag.value).d("Re-opened the activity but we have no url to load or a cached one, finish the activity")
} else if (currentCallType == null) { finish()
Timber.tag(loggerTag.value).d("Set the call type and create the presenter") } else {
webViewTarget.value = callType Timber.tag(loggerTag.value).d("Set the call type and create the presenter")
presenter = presenterFactory.create(callType!!, this) webViewTarget.value = callType
} else if (callType == null) { presenter = presenterFactory.create(callType, this)
Timber.tag(loggerTag.value).d("Coming back from notification, do nothing") }
} else if (callType != currentCallType) {
Timber.tag(loggerTag.value).d("User starts another call, restart the Activity")
setIntent(intent)
recreate()
} else { } else {
Timber.tag(loggerTag.value).d("Other case, do nothing") if (callType == null) {
Timber.tag(loggerTag.value).d("Coming back from notification, do nothing")
} else if (callType != currentCallType) {
Timber.tag(loggerTag.value).d("User starts another call, restart the Activity")
setIntent(intent)
recreate()
} else {
// Starting the same call again, should not happen, the UI is preventing this. But maybe when using external links.
Timber.tag(loggerTag.value).d("Starting the same call again, do nothing")
}
} }
} }