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

Commit 0c305ff6 authored by Peter Cai's avatar Peter Cai
Browse files

ui: Fix multi-SE channel title in the rest of activities

Of course all of this needs to be refactored including adding support
for multi-SE chips over USB readers, but that will be a task for the
next release cycle.
parent e5568e21
Loading
Loading
Loading
Loading
+25 −6
Original line number Diff line number Diff line
@@ -31,7 +31,9 @@ import im.angry.openeuicc.util.formatFreeSpace
import im.angry.openeuicc.util.mainViewPaddingInsetHandler
import im.angry.openeuicc.util.setupRootViewSystemBarInsets
import im.angry.openeuicc.util.tryParseEuiccVendorInfo
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import net.typeblog.lpac_jni.impl.PKID_GSMA_LIVE_CI
import net.typeblog.lpac_jni.impl.PKID_GSMA_TEST_CI

@@ -92,10 +94,12 @@ class EuiccInfoActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {

        swipeRefresh.setOnRefreshListener { refresh() }

        setupRootViewSystemBarInsets(window.decorView.rootView, arrayOf(
        setupRootViewSystemBarInsets(
            window.decorView.rootView, arrayOf(
                this::activityToolbarInsetHandler,
                mainViewPaddingInsetHandler(infoList)
        ))
            )
        )
    }

    override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) {
@@ -115,8 +119,23 @@ class EuiccInfoActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {
        swipeRefresh.isRefreshing = true

        lifecycleScope.launch {
            (infoList.adapter!! as EuiccInfoAdapter).euiccInfoItems =
                euiccChannelManager.withEuiccChannel(logicalSlotId, seId, fn = ::buildEuiccInfoItems)
            euiccChannelManager.withEuiccChannel(logicalSlotId, seId) { channel ->
                // When the chip multi-SE, we need to include seId in the title (because we don't have access
                // to hasMultipleSE in the onCreate() function, we need to do it here).
                // TODO: Move channel formatting to somewhere centralized and remove this hack. (And also, of course, add support for USB)
                if (channel.hasMultipleSE && logicalSlotId != EuiccChannelManager.USB_CHANNEL_ID) {
                    withContext(Dispatchers.Main) {
                        title =
                            appContainer.customizableTextProvider.formatNonUsbChannelNameWithSeId(logicalSlotId, seId)
                    }
                }

                val items = buildEuiccInfoItems(channel)

                withContext(Dispatchers.Main) {
                    (infoList.adapter!! as EuiccInfoAdapter).euiccInfoItems = items
                }
            }

            swipeRefresh.isRefreshing = false
        }
+7 −0
Original line number Diff line number Diff line
@@ -137,6 +137,13 @@ class NotificationsActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker
    private fun refresh() {
        launchTask {
            notificationAdapter.notifications = withEuiccChannel { channel ->
                if (channel.hasMultipleSE && logicalSlotId != EuiccChannelManager.USB_CHANNEL_ID) {
                    withContext(Dispatchers.Main) {
                        title =
                            appContainer.customizableTextProvider.formatNonUsbChannelNameWithSeId(logicalSlotId, seId)
                    }
                }

                val nameMap = channel.lpa.profiles
                    .associate { Pair(it.iccid, it.displayName) }