Compare commits

..

1 commit

Author SHA1 Message Date
d613ba403e
refactor: sim toolkit 2025-03-05 17:11:20 +08:00
2 changed files with 3 additions and 5 deletions

View file

@ -24,8 +24,9 @@ class UnprivilegedEuiccManagementFragment : EuiccManagementFragment() {
super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.fragment_sim_toolkit, menu)
menu.findItem(R.id.open_sim_toolkit).apply {
val slot = stk[slotId] ?: return@apply
isVisible = slot.available
val slot = stk[slotId]
if (slot == null) return@apply
isVisible = true
setOnMenuItemClickListener { slot.launch() }
}
}

View file

@ -39,9 +39,6 @@ class SIMToolkit(private val context: Context) {
get() = packageNames.flatMap(context.packageManager::getActivities)
.filter { it.exported }.map { ComponentName(it.packageName, it.name) }
val available: Boolean
get() = getIntent() != null || getDisabledPackageName() != null
private fun getIntent(): Intent? {
try {
val component = components.find(activities::contains) ?: return launchIntent