Skip to content

Commit

Permalink
Add NavigationInstructionFilter for acceptFromFlow
Browse files Browse the repository at this point in the history
  • Loading branch information
isaac-udy committed Sep 16, 2024
1 parent bf71892 commit 2dd3627
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package dev.enro.core.container
import dev.enro.core.NavigationDirection
import dev.enro.core.NavigationInstruction
import dev.enro.core.NavigationKey
import dev.enro.core.result.flows.FlowStep

/**
* A NavigationContainerFilter is used to determine whether or not a given [NavigationInstruction.Open]
Expand Down Expand Up @@ -75,6 +76,14 @@ public class NavigationContainerFilterBuilder internal constructor() {
*/
public fun acceptAll(): NavigationInstructionFilter = NavigationInstructionFilter { true }

/**
* A [NavigationInstructionFilter] that accepts only [NavigationInstruction.Open] instructions which have been added to the container
* by a [dev.enro.core.result.flows.NavigationFlow].
*/
public fun acceptFromFlow(): NavigationInstructionFilter = NavigationInstructionFilter {
it.internal.resultKey is FlowStep<*>
}

/**
* A [NavigationInstructionFilter] that accepts no [NavigationInstruction.Open] instructions.
*
Expand Down

0 comments on commit 2dd3627

Please sign in to comment.