Compare commits

..

No commits in common. "format-channel-name-in-compatibility-check" and "master" have entirely different histories.

View file

@ -127,9 +127,8 @@ open class QuickCompatibilityFragment : Fragment(), UnprivilegedEuiccContextMark
if (!service.isConnected) { if (!service.isConnected) {
return CompatibilityResult(Compatibility.NOT_COMPATIBLE) return CompatibilityResult(Compatibility.NOT_COMPATIBLE)
} }
val readers = service.readers.filter(Reader::isSIM) val omapiSlots = service.readers.filter { it.isSIM }.map { it.slotIndex }
val omapiSlots = readers.mapNotNull(Reader::slotIndex) val slots = service.readers.filter { it.isSIM }.mapNotNull { reader ->
val slots = readers.mapNotNull { reader ->
try { try {
// Note: we ONLY check the default ISD-R AID, because this test is for the _device_, // Note: we ONLY check the default ISD-R AID, because this test is for the _device_,
// NOT the eUICC. We don't care what AID a potential eUICC might use, all we need to // NOT the eUICC. We don't care what AID a potential eUICC might use, all we need to
@ -148,12 +147,10 @@ open class QuickCompatibilityFragment : Fragment(), UnprivilegedEuiccContextMark
if (omapiSlots.isEmpty()) { if (omapiSlots.isEmpty()) {
return CompatibilityResult(Compatibility.NOT_COMPATIBLE) return CompatibilityResult(Compatibility.NOT_COMPATIBLE)
} }
val formatChannelName = appContainer.customizableTextProvider::formatInternalChannelName
return CompatibilityResult( return CompatibilityResult(
Compatibility.COMPATIBLE, Compatibility.COMPATIBLE,
slotsOmapi = omapiSlots.map(formatChannelName), slotsOmapi = omapiSlots.map { "SIM$it" },
slotsIsdr = slots.map(formatChannelName), slotsIsdr = slots.map { "SIM$it" })
)
} }
open fun formatConclusion(result: CompatibilityResult): String { open fun formatConclusion(result: CompatibilityResult): String {
@ -179,8 +176,8 @@ open class QuickCompatibilityFragment : Fragment(), UnprivilegedEuiccContextMark
} }
} }
private inline val Reader.isSIM: Boolean val Reader.isSIM: Boolean
get() = name.startsWith("SIM") get() = name.startsWith("SIM")
private inline val Reader.slotIndex: Int val Reader.slotIndex: Int
get() = (name.replace("SIM", "").toIntOrNull() ?: 1) - 1 // 0-based index get() = (name.replace("SIM", "").toIntOrNull() ?: 1)