Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.3 kB
3
Indexable
Never
private fun removeIconAndDescription(sections: List<DynamicMenuSection>): List<DynamicMenuSection> {
    return sections.map { section ->
        val modifiedContent = section.content?.map { content ->
            removeDescriptionFromContent(content)
        }
        DynamicMenuSection(
            section.title,
            modifiedContent,
            section.toggle,
            section.validate
        )
    }
}

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

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

    return DynamicMenuContent(
        content.id,
        content.title,
        content.name,
        content.colorText,
        content.badgeNotification,
        null,  // Remove description
        content.highlight,
        content.keep,
        null,  // Remove icon
        content.colorIcon,
        content.accessibility,
        content.analytics,
        content.tag,
        content.action,
        content.badge,
        content.toggle,
        content.validate,
        content.separator,
        content.isUnavailable,
        modifiedChildren,
        content.unavailability
    )
}