Untitled

 avatar
unknown
plain_text
a year ago
1.4 kB
4
Indexable
fun removeIconAndDescription(sections: List<DynamicMenuSection>) {
    sections.forEach { dynamicMenuSection ->
        dynamicMenuSection.content?.forEach { dynamicMenuContent ->
            dynamicMenuContent.icon = null
            dynamicMenuContent.description = null
            dynamicMenuContent.children?.forEach { dynamicMenuSection ->
                dynamicMenuSection.content?.forEach { dynamicMenuSectionContent ->
                    dynamicMenuSectionContent.description = null
                    dynamicMenuSectionContent.children?.forEach { dynamicMenuSectionContentChildren ->
                        dynamicMenuSectionContentChildren.content?.forEach { dynamicMenuSectionContentLastChildren ->
                            dynamicMenuSectionContentLastChildren.description = null
                        }
                    }
                }
            }
        }
    }
}

fun fun checkFilter(filter: String, sections: List<DynamicMenuSection>) {
    val sectionsWithoutIconAndDescription = sections.toMutableList()
    removeIconAndDescription(sectionsWithoutIconAndDescription)

    if (filter.isEmpty()) {
        view.hideInlineInfoView()
        view.setAdapterContent(sections)
    } else {
        analyticsValue = filter
        view.setAdapterContentFilter(sectionsWithoutIconAndDescription, filter)
    }
}
Editor is loading...