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

Commit c676c273 authored by septs's avatar septs Committed by Peter Cai
Browse files

fix: channel title (#292)

parent 81810b22
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -76,13 +76,11 @@ class EuiccInfoActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {
            intent.getParcelableExtra("seId")
        } ?: EuiccChannel.SecureElementId.DEFAULT

        val channelTitle = if (logicalSlotId == EuiccChannelManager.USB_CHANNEL_ID) {
            getString(R.string.channel_type_usb)
        } else {
        setChannelTitle(
            if (logicalSlotId == EuiccChannelManager.USB_CHANNEL_ID)
                getString(R.string.channel_type_usb) else
                appContainer.customizableTextProvider.formatNonUsbChannelName(logicalSlotId)
        }

        title = getString(R.string.euicc_info_activity_title, channelTitle)
        )

        swipeRefresh.setOnRefreshListener { refresh() }

@@ -103,6 +101,10 @@ class EuiccInfoActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {
        else -> super.onOptionsItemSelected(item)
    }

    private fun setChannelTitle(title: CharSequence) {
        super.setTitle(getString(R.string.euicc_info_activity_title, title))
    }

    override fun onInit() {
        refresh()
    }
@@ -117,8 +119,9 @@ class EuiccInfoActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {
                // 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 title = appContainer.customizableTextProvider
                            .formatNonUsbChannelNameWithSeId(logicalSlotId, seId)
                        setChannelTitle(title)
                    }
                }

@@ -166,7 +169,7 @@ class EuiccInfoActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {
            // FS.27 v2.0, Security Guidelines for UICC Profiles (Page 25 of 27, 2024-01-30)
            // https://www.gsma.com/solutions-and-impact/technologies/security/wp-content/uploads/2024/01/FS.27-Security-Guidelines-for-UICC-Credentials-v2.0-FINAL-23-July.pdf#page=25
            val resId = when {
                signers.isEmpty() -> R.string.euicc_info_unknown // the case is not mp, but it's is not common
                signers.isEmpty() -> R.string.euicc_info_unknown // the case is not mp, but it is not common
                PKID_GSMA_LIVE_CI.any(signers::contains) -> R.string.euicc_info_ci_gsma_live
                PKID_GSMA_TEST_CI.any(signers::contains) -> R.string.euicc_info_ci_gsma_test
                else -> R.string.euicc_info_ci_unknown
+12 −9
Original line number Diff line number Diff line
@@ -74,13 +74,11 @@ class NotificationsActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker

        // This is slightly different from the MainActivity logic
        // due to the length (we don't want to display the full USB product name)
        val channelTitle = if (logicalSlotId == EuiccChannelManager.USB_CHANNEL_ID) {
            getString(R.string.channel_type_usb)
        } else {
        setChannelTitle(
            if (logicalSlotId == EuiccChannelManager.USB_CHANNEL_ID)
                getString(R.string.channel_type_usb) else
                appContainer.customizableTextProvider.formatNonUsbChannelName(logicalSlotId)
        }

        title = getString(R.string.profile_notifications_detailed_format, channelTitle)
        )

        swipeRefresh.setOnRefreshListener {
            refresh()
@@ -116,6 +114,10 @@ class NotificationsActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker
            else -> super.onOptionsItemSelected(item)
        }

    private fun setChannelTitle(title: CharSequence) {
        super.setTitle(getString(R.string.profile_notifications_detailed_format, title))
    }

    private fun launchTask(task: suspend () -> Unit) {
        swipeRefresh.isRefreshing = true

@@ -135,8 +137,9 @@ class NotificationsActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker
            notificationAdapter.notifications = withEuiccChannel { channel ->
                if (channel.hasMultipleSE && logicalSlotId != EuiccChannelManager.USB_CHANNEL_ID) {
                    withContext(Dispatchers.Main) {
                        title =
                            appContainer.customizableTextProvider.formatNonUsbChannelNameWithSeId(logicalSlotId, seId)
                        val channelTitle = appContainer.customizableTextProvider
                            .formatNonUsbChannelNameWithSeId(logicalSlotId, seId)
                        setChannelTitle(channelTitle)
                    }
                }