-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP dual backstack #5
base: 1.x
Are you sure you want to change the base?
Conversation
.../main/kotlin/com/bumble/appyx/navmodel/dualbackstack/transitionhandler/DualBackStackFader.kt
Fixed
Show fixed
Hide fixed
...main/kotlin/com/bumble/appyx/navmodel/dualbackstack/transitionhandler/DualBackStackSlider.kt
Fixed
Show fixed
Hide fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found 19 potential problems in the proposed changes. Check the Files changed tab for more details.
be19efe
to
26488a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found 12 potential problems in the proposed changes. Check the Files changed tab for more details.
26488a3
to
aa4429f
Compare
|
||
override fun isApplicable(elements: DualBackStackElements<T>): Boolean = true | ||
|
||
override fun invoke( |
Check warning
Code scanning / detekt
Prefer splitting up complex methods into smaller, easier to understand methods.
if (previousElement != null && previousElement.eitherState(Active1) && | ||
(element.eitherState(StashedInBackStack2) || element.eitherState(Active2)) |
Check warning
Code scanning / detekt
Complex conditions should be simplified and extracted into well-named methods if necessary.
if (twoPanelsEnabled && | ||
(element.eitherState(StashedInBackStack2) || element.eitherState(Active2)) && | ||
previousElement != null && previousElement.eitherState(StashedInBackStack1) |
Check warning
Code scanning / detekt
Complex conditions should be simplified and extracted into well-named methods if necessary.
while (listIterator.hasNext()) { | ||
val index = listIterator.nextIndex() | ||
val element = listIterator.next() | ||
|
||
if (element.targetState == Active1) { | ||
listIterator.remove() | ||
|
||
check(index != 0) { "Cannot pop the last active left panel" } | ||
|
||
val stashedPanel1 = listIterator.previous() | ||
listIterator.set( | ||
stashedPanel1.transitionTo( | ||
newTargetState = Active1, | ||
operation = this | ||
) | ||
) | ||
break | ||
|
||
} else if (element.targetState == StashedInBackStack2 || element.targetState == Active2) { | ||
// In this case there was no active panel 1, so we are not in 'two panel' mode. | ||
check(index > 1) { "Cannot pop the last active left panel" } | ||
|
||
listIterator.previous() | ||
listIterator.previous() | ||
listIterator.remove() | ||
break | ||
} | ||
} |
Check warning
Code scanning / detekt
The loop contains more than one break or continue statement. The code should be refactored to increase readability.
while (listIterator.hasNext()) { | ||
val index = listIterator.nextIndex() | ||
val element = listIterator.next() | ||
val isLast = index == newElementsList.lastIndex | ||
|
||
if (!twoPanelsEnabled) { | ||
if (previousElement != null && previousElement.eitherState(Active1) && | ||
(element.eitherState(StashedInBackStack2) || element.eitherState(Active2)) | ||
) { | ||
// We must call previous twice to actually go back to the previous element. | ||
listIterator.previous() | ||
val stashedBackStackElement = listIterator.previous() | ||
listIterator.set( | ||
stashedBackStackElement.transitionTo( | ||
newTargetState = StashedInBackStack1, | ||
operation = this | ||
) | ||
) | ||
break | ||
} else if (isLast && element.eitherState(StashedInBackStack1)) { | ||
listIterator.set( | ||
element.transitionTo( | ||
newTargetState = Active1, | ||
operation = this | ||
) | ||
) | ||
break | ||
} | ||
} | ||
if (twoPanelsEnabled && | ||
(element.eitherState(StashedInBackStack2) || element.eitherState(Active2)) && | ||
previousElement != null && previousElement.eitherState(StashedInBackStack1) | ||
) { | ||
// We must call previous twice to actually go back to the previous element. | ||
listIterator.previous() | ||
val stashedBackStackElement = listIterator.previous() | ||
listIterator.set( | ||
stashedBackStackElement.transitionTo( | ||
newTargetState = Active1, | ||
operation = this | ||
) | ||
) | ||
break | ||
} | ||
previousElement = element | ||
} |
Check warning
Code scanning / detekt
The loop contains more than one break or continue statement. The code should be refactored to increase readability.
Description
...
Check list
CHANGELOG.md
if required.