Skip to content

Commit

Permalink
feat: remove manually set config menu
Browse files Browse the repository at this point in the history
  • Loading branch information
kyujin-cho committed Feb 18, 2024
1 parent 8d71000 commit 5444efb
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions app/src/main/java/dev/bluehouse/enablevolte/pages/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.os.Build.VERSION
import android.os.Build.VERSION_CODES
import android.telephony.CarrierConfigManager
import android.util.Log
import android.widget.Toast
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
Expand All @@ -29,12 +28,10 @@ import dev.bluehouse.enablevolte.CarrierModer
import dev.bluehouse.enablevolte.ClickablePropertyView
import dev.bluehouse.enablevolte.HeaderText
import dev.bluehouse.enablevolte.InfiniteLoadingDialog
import dev.bluehouse.enablevolte.KeyValueEditView
import dev.bluehouse.enablevolte.R
import dev.bluehouse.enablevolte.ShizukuStatus
import dev.bluehouse.enablevolte.SubscriptionModer
import dev.bluehouse.enablevolte.UserAgentPropertyView
import dev.bluehouse.enablevolte.ValueType
import dev.bluehouse.enablevolte.checkShizukuPermission
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -392,31 +389,6 @@ fun Config(navController: NavController, subId: Int) {
}
}
}
KeyValueEditView(label = stringResource(id = R.string.manually_set_config), availableKeys = configurableItems.keys + configurableItems.values) { key, valueType, value ->
val actualKey = configurableItems[key] ?: if (reversedConfigurableItems.containsKey(key)) { key } else { null }
if (actualKey == null) {
Toast.makeText(context, cannotFindKeyText, Toast.LENGTH_SHORT).show()
false
} else {
try {
when (valueType) {
ValueType.Bool -> moder.updateCarrierConfig(actualKey, value == "true")
ValueType.String -> moder.updateCarrierConfig(actualKey, value)
ValueType.Int -> moder.updateCarrierConfig(actualKey, value.toInt())
ValueType.Long -> moder.updateCarrierConfig(actualKey, value.toLong())
ValueType.BoolArray -> moder.updateCarrierConfig(actualKey, (value.split(",").map { it.trim() == "true" }).toBooleanArray())
ValueType.StringArray -> moder.updateCarrierConfig(actualKey, (value.split(",").map { it.trim() }).toTypedArray())
ValueType.IntArray -> moder.updateCarrierConfig(actualKey, (value.split(",").map { it.trim().toInt() }).toIntArray())
ValueType.LongArray -> moder.updateCarrierConfig(actualKey, (value.split(",").map { it.trim().toLong() }).toLongArray())
else -> {}
}
true
} catch (e: Exception) {
Toast.makeText(context, "Error while updating: ${e.message}", Toast.LENGTH_SHORT).show()
false
}
}
}
ClickablePropertyView(
label = stringResource(R.string.expert_mode),
value = "",
Expand Down

0 comments on commit 5444efb

Please sign in to comment.