ソースを参照

fix: Try to disable the current profile before switching

Peter Cai 1 年間 前
コミット
ff427759d7

+ 6 - 0
app-common/src/main/java/im/angry/openeuicc/ui/EuiccManagementFragment.kt

@@ -130,6 +130,12 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
         lifecycleScope.launch {
             beginTrackedOperation {
                 val res = if (enable) {
+                    channel.lpa.profiles.find { it.isEnabled }?.let {
+                        Log.i(TAG, "Profile ${it.iccid} is enabled; disabling before switching to new profile")
+                        // Don't refresh -- we'll refresh later when enabling.
+                        // Also ignore errors -- this is only a hard error if the enabling step fails.
+                        channel.lpa.disableProfile(it.iccid, false)
+                    }
                     channel.lpa.enableProfile(iccid)
                 } else {
                     channel.lpa.disableProfile(iccid)