Skip to content

Commit

Permalink
Update the code to improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarty committed Nov 22, 2024
1 parent 75202f1 commit 0a1c441
Showing 1 changed file with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,21 +198,26 @@ class ElementCallActivity :
?: intent.dataString?.let(::parseUrl)?.let(::ExternalUrl)
}
val currentCallType = webViewTarget.value
if (currentCallType == null && 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")
finish()
} else if (currentCallType == null) {
Timber.tag(loggerTag.value).d("Set the call type and create the presenter")
webViewTarget.value = callType
presenter = presenterFactory.create(callType!!, this)
} else 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()
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")
finish()

Check warning on line 204 in features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/ElementCallActivity.kt

View check run for this annotation

Codecov / codecov/patch

features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/ElementCallActivity.kt#L203-L204

Added lines #L203 - L204 were not covered by tests
} else {
Timber.tag(loggerTag.value).d("Set the call type and create the presenter")
webViewTarget.value = callType
presenter = presenterFactory.create(callType, this)

Check warning on line 208 in features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/ElementCallActivity.kt

View check run for this annotation

Codecov / codecov/patch

features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/ElementCallActivity.kt#L206-L208

Added lines #L206 - L208 were not covered by tests
}
} else {
Timber.tag(loggerTag.value).d("Other case, do nothing")
if (callType == null) {
Timber.tag(loggerTag.value).d("Coming back from notification, do nothing")

Check warning on line 212 in features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/ElementCallActivity.kt

View check run for this annotation

Codecov / codecov/patch

features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/ElementCallActivity.kt#L212

Added line #L212 was not covered by tests
} else if (callType != currentCallType) {
Timber.tag(loggerTag.value).d("User starts another call, restart the Activity")
setIntent(intent)
recreate()

Check warning on line 216 in features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/ElementCallActivity.kt

View check run for this annotation

Codecov / codecov/patch

features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/ElementCallActivity.kt#L214-L216

Added lines #L214 - L216 were not covered by tests
} 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")

Check warning on line 219 in features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/ElementCallActivity.kt

View check run for this annotation

Codecov / codecov/patch

features/call/impl/src/main/kotlin/io/element/android/features/call/impl/ui/ElementCallActivity.kt#L219

Added line #L219 was not covered by tests
}
}
}

Expand Down

0 comments on commit 0a1c441

Please sign in to comment.