Skip to content

Commit deea967

Browse files
committed
style: Avoid complex conditional
Address lint rule.
1 parent 57cbd92 commit deea967

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

WordPress/src/main/java/org/wordpress/android/ui/deeplinks/DeepLinkingIntentReceiverViewModel.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,21 @@ class DeepLinkingIntentReceiverViewModel
7070
if (action != null) {
7171
deepLinkTrackingUtils.track(action, it, uriWrapper)
7272
}
73-
if (accountStore.hasAccessToken() || it is OpenInBrowser || it is ShowSignInFlow || it is OpenHome) {
73+
if (loginIsUnnecessary(it)) {
7474
_navigateAction.value = Event(it)
7575
} else {
7676
_navigateAction.value = Event(LoginForResult)
7777
}
7878
} != null
7979
}
8080

81+
private fun loginIsUnnecessary(action: NavigateAction): Boolean {
82+
return accountStore.hasAccessToken() ||
83+
action is OpenInBrowser ||
84+
action is ShowSignInFlow ||
85+
action is OpenHome
86+
}
87+
8188
private fun buildNavigateAction(uri: UriWrapper, rootUri: UriWrapper = uri): NavigateAction? {
8289
return when {
8390
deepLinkUriUtils.isTrackingUrl(uri) -> getRedirectUriAndBuildNavigateAction(uri, rootUri)

0 commit comments

Comments
 (0)