microsoftconnect / ms-intune-app-sdk-android

Intune App SDK for Android enables data protection features and mobile app management via Microsoft Intune
41 stars 17 forks source link

Support Jetpack Compose in the MAMification process #147

Open mick1418 opened 1 year ago

mick1418 commented 1 year ago

Currently the MAMification process only replaces regular views (like TextView, EditText...), but not their Jetpack Compose equivalents.

Is it planned at some point in the future, or are we stuck with using the old "View" system?

We could try bridging both worlds with something like the example below, but it's far from ideal since we are missing a lot of Compose functionalities:


fun ComposableTextView(
    text: String,
    modifier: Modifier = Modifier,
    color: Color = Color.Unspecified,
    fontSize: TextUnit = TextUnit.Unspecified,
    maxLines: Int = Int.MAX_VALUE,
    style: TextStyle = LocalTextStyle.current
) {
    val textColor = color.takeOrElse {
        style.color.takeOrElse {
            LocalContentColor.current
        }
    }
    AndroidView(
        modifier = modifier,
        factory = { context ->
            TextView(context).apply {
                layoutParams = LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT)
            }
        },
        update = {
            it.apply {
                setText(text)
                setTextColor(textColor.toArgb())
                setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize.value)
                setMaxLines(maxLines)
            }
        }
    )
}```
bannus commented 1 year ago

Hi @mick1418, thanks for reaching out. Jetpack Compose is not currently supported but we are currently investigating our options.

(internal tracking #16814898)
meghandaly commented 1 year ago

As Bannus mentioned, we are tracking this internally and we will update this issue when we have a definite timeline as to added support.

mick1418 commented 8 months ago

Any news on the support of Jetpack Compose? Is it still planned?

alfdev commented 5 months ago

We're facing the same issue with jetpack compose, any news? A release date would also be really appreciated :) Thanks

d2callpod commented 4 months ago

@mick1418 are you able to use the SDK in an app that has some Jetpack Compose UI? I'm wondering if it's possible to use xml layouts for the parts that integrate with the Intune SDK.

I've tried using the Intune wrapper on an app that uses Compose as well as xml layouts. It works fine with views created with xml layouts but crashes when opening a view that uses Compose. I'm wondering if using the SDK instead of the wrapper would be a possible work around. It would be great to know if that's possible before I go down that path.

mikektmobile commented 1 month ago

@meghandaly Its been over a year on this issue, have you heard any updates? Thanks in advance.

d2callpod commented 1 month ago

My issue for this with the wrapper was closed as won't fix. So I'm not hopeful with the SDK either.

Crash opening views implemented with Jetpack Compose #98

I had a chat with the author of this blog post. It explains just the tip of the iceberg of what he's gone through with this SDK. e.g. lack of support for other issues. So that makes me even less hopeful.

Is ViewPump A Security Risk?