|
|
@@ -3,7 +3,7 @@ package im.angry.openeuicc.ui
|
|
|
import android.os.Bundle
|
|
|
import androidx.appcompat.app.AppCompatActivity
|
|
|
import androidx.lifecycle.lifecycleScope
|
|
|
-import im.angry.openeuicc.util.openEuiccApplication
|
|
|
+import im.angry.openeuicc.util.*
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
import kotlinx.coroutines.launch
|
|
|
import kotlinx.coroutines.withContext
|
|
|
@@ -16,8 +16,21 @@ class DirectProfileDownloadActivity : AppCompatActivity(), SlotSelectFragment.Sl
|
|
|
openEuiccApplication.euiccChannelManager.enumerateEuiccChannels()
|
|
|
}
|
|
|
|
|
|
- SlotSelectFragment.newInstance()
|
|
|
- .show(supportFragmentManager, SlotSelectFragment.TAG)
|
|
|
+ val knownChannels = openEuiccApplication.euiccChannelManager.knownChannels
|
|
|
+ when {
|
|
|
+ knownChannels.isEmpty() -> {
|
|
|
+ finish()
|
|
|
+ }
|
|
|
+ knownChannels.hasMultipleChips -> {
|
|
|
+ SlotSelectFragment.newInstance()
|
|
|
+ .show(supportFragmentManager, SlotSelectFragment.TAG)
|
|
|
+ }
|
|
|
+ else -> {
|
|
|
+ // If the device has only one eSIM "chip" (but may be mapped to multiple slots),
|
|
|
+ // we can skip the slot selection dialog since there is only one chip to save to.
|
|
|
+ onSlotSelected(knownChannels[0].slotId, knownChannels[0].portId)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|