abbic
11/20/2023, 3:02 PMfun Modifier.featureToggleClick(
featureToggle: FeatureToggle?,
onClick: () -> Unit
) = composed {
val context = LocalContext.current
when {
featureToggle?.isHidden == true -> this
featureToggle?.needsUpdate == true -> this.clickable { context.showForceUpdateMessage() }
featureToggle?.isDisabled == true -> this.clickable {
context.showDisableMessage(
featureToggle
)
}
else -> this.clickable { onClick() }
}
}
basically, the clickable behaviour depends on the feature toggle (basically just a data class) that's passed in. however, its causing some issues. the main one now is that i use this modifier on the same screen for multiple clickable elements, but only the first one from the top is working (ie onClick triggers). There are no differences in usage of the modifier across all instances (its always Modifer.featureToggleClick(...)
) put this in android because of the use of context