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) {
if (callType == null) {
Timber.tag(loggerTag.value).d("Re-opened the activity but we have no url to load or a cached one, finish the activity") Timber.tag(loggerTag.value).d("Re-opened the activity but we have no url to load or a cached one, finish the activity")
finish() finish()
} else if (currentCallType == null) { } else {
Timber.tag(loggerTag.value).d("Set the call type and create the presenter") Timber.tag(loggerTag.value).d("Set the call type and create the presenter")
webViewTarget.value = callType webViewTarget.value = callType
presenter = presenterFactory.create(callType!!, this) presenter = presenterFactory.create(callType, this)
} else if (callType == null) { }
} else {
if (callType == null) {
Timber.tag(loggerTag.value).d("Coming back from notification, do nothing") Timber.tag(loggerTag.value).d("Coming back from notification, do nothing")
} else if (callType != currentCallType) { } else if (callType != currentCallType) {
Timber.tag(loggerTag.value).d("User starts another call, restart the Activity") Timber.tag(loggerTag.value).d("User starts another call, restart the Activity")
setIntent(intent) setIntent(intent)
recreate() recreate()
} else { } else {
Timber.tag(loggerTag.value).d("Other case, do nothing") // 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")
}
} }
} }