Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 97c93a70 authored by LuK1337's avatar LuK1337 Committed by Michael Bestas
Browse files

Settings: Make SIM toggle unchangable when not supported

Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/8290
Change-Id: I2e566c24969708c31f607af2baad88b388bda74d
parent 3df966cc
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -69,6 +69,11 @@ private fun SimPreference(subInfo: SubscriptionInfo) {
        SubscriptionRepository(context).isSubscriptionEnabledFlow(subInfo.subscriptionId)
    }.collectAsStateWithLifecycle(initialValue = false)
    val phoneNumber = phoneNumber(subInfo)
    val canDisablePhysicalSubscription by remember {
        flow {
            emit(SubscriptionRepository(context).canDisablePhysicalSubscription())
        }
    }.collectAsStateWithLifecycle(initialValue = false)
    val isConvertedPsim by remember(subInfo) {
        flow {
            emit(SubscriptionUtil.isConvertedPsimSubscription(subInfo))
@@ -90,7 +95,10 @@ private fun SimPreference(subInfo: SubscriptionInfo) {
                }
            }
            override val icon = @Composable { SimIcon(subInfo.isEmbedded) }
            override val changeable = { isActivationChangeable && !isConvertedPsim }
            override val changeable = {
                (subInfo.isEmbedded || canDisablePhysicalSubscription)
                    && isActivationChangeable && !isConvertedPsim
            }
            override val checked = { checked.value }
            override val onCheckedChange: (Boolean) -> Unit = { newChecked ->
                coroutineScope.launch {