fix: Do not look for channel in the process of switching profiles
All checks were successful
/ build-debug (push) Successful in 5m13s
All checks were successful
/ build-debug (push) Successful in 5m13s
Fixes #36
This commit is contained in:
parent
829f019aa2
commit
67927cf7ef
|
@ -180,7 +180,7 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
|
||||||
return@beginTrackedOperation false
|
return@beginTrackedOperation false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!refreshed && channel.slotId != EuiccChannelManager.USB_CHANNEL_ID) {
|
if (!refreshed && !isUsb) {
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
AlertDialog.Builder(requireContext()).apply {
|
AlertDialog.Builder(requireContext()).apply {
|
||||||
setMessage(R.string.switch_did_not_refresh)
|
setMessage(R.string.switch_did_not_refresh)
|
||||||
|
@ -197,7 +197,7 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
|
||||||
return@beginTrackedOperation true
|
return@beginTrackedOperation true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel.slotId != EuiccChannelManager.USB_CHANNEL_ID) {
|
if (!isUsb) {
|
||||||
try {
|
try {
|
||||||
euiccChannelManager.waitForReconnect(
|
euiccChannelManager.waitForReconnect(
|
||||||
slotId,
|
slotId,
|
||||||
|
|
|
@ -23,11 +23,13 @@ fun <T> newInstanceEuicc(clazz: Class<T>, slotId: Int, portId: Int, addArguments
|
||||||
return instance
|
return instance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convenient methods to avoid using `channel` for these
|
||||||
|
// `channel` requires that the channel actually exists in EuiccChannelManager, which is
|
||||||
|
// not always the case during operations such as switching
|
||||||
val <T> T.slotId: Int where T: Fragment, T: EuiccChannelFragmentMarker
|
val <T> T.slotId: Int where T: Fragment, T: EuiccChannelFragmentMarker
|
||||||
get() = requireArguments().getInt("slotId")
|
get() = requireArguments().getInt("slotId")
|
||||||
val <T> T.portId: Int where T: Fragment, T: EuiccChannelFragmentMarker
|
val <T> T.portId: Int where T: Fragment, T: EuiccChannelFragmentMarker
|
||||||
get() = requireArguments().getInt("portId")
|
get() = requireArguments().getInt("portId")
|
||||||
|
|
||||||
val <T> T.isUsb: Boolean where T: Fragment, T: EuiccChannelFragmentMarker
|
val <T> T.isUsb: Boolean where T: Fragment, T: EuiccChannelFragmentMarker
|
||||||
get() = requireArguments().getInt("slotId") == EuiccChannelManager.USB_CHANNEL_ID
|
get() = requireArguments().getInt("slotId") == EuiccChannelManager.USB_CHANNEL_ID
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue