Untitled

 avatar
unknown
plain_text
2 years ago
817 B
6
Indexable
private fun removeIconAndDescription(sections: List<DynamicMenuSection>): List<DynamicMenuSection> {
    return sections.map { section ->
        val modifiedContent = section.content?.map { content ->
            removeDescriptionFromContent(content)
        }
        DynamicMenuSection(
            section.title,
            modifiedContent ?: emptyList(),
            section.toggle,
            section.validate
        )
    }
}

private fun removeDescriptionFromContent(content: DynamicMenuContent?): DynamicMenuContent? {
    if (content == null) return null

    val modifiedChildren = content.children?.map { child ->
        removeDescriptionFromContent(child)
    }

    // Remove description at this level
    return content.copy(description = null, children = modifiedChildren)
}
Editor is loading...