Skip to content

Commit

Permalink
Set fragment instance id to all fragments. (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
Laimiux authored Oct 10, 2024
1 parent 2f1ff1d commit 21955e6
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,12 @@ internal fun Fragment.getFragmentKey(): FragmentKey {
* one if it doesn't exist.
*/
internal fun Fragment.getFragmentInstanceId(): String {
return if (this is BaseFormulaFragment<*>) {
val arguments = getOrSetArguments()
val id = arguments.getString(FormulaFragment.ARG_FORMULA_ID, "")
id.ifBlank {
val initializedId = UUID.randomUUID().toString()
arguments.putString(FormulaFragment.ARG_FORMULA_ID, initializedId)
initializedId
}
} else {
""
val arguments = getOrSetArguments()
val id = arguments.getString(FormulaFragment.ARG_FORMULA_ID, "")
return id.ifBlank {
val initializedId = UUID.randomUUID().toString()
arguments.putString(FormulaFragment.ARG_FORMULA_ID, initializedId)
initializedId
}
}

Expand Down

0 comments on commit 21955e6

Please sign in to comment.