|
|
@@ -19,8 +19,14 @@ val List<LocalProfileInfo>.operational: List<LocalProfileInfo>
|
|
|
val List<EuiccChannel>.hasMultipleChips: Boolean
|
|
|
get() = distinctBy { it.slotId }.size > 1
|
|
|
|
|
|
-fun LocalProfileAssistant.disableActiveProfileWithUndo(): () -> Unit =
|
|
|
- profiles.find { it.state == LocalProfileInfo.State.Enabled }?.let {
|
|
|
- disableProfile(it.iccid)
|
|
|
+/**
|
|
|
+ * Disable the active profile, return a lambda that reverts this action when called.
|
|
|
+ * If refreshOnDisable is true, also cause a eUICC refresh command. Note that refreshing
|
|
|
+ * will disconnect the eUICC and might need some time before being operational again.
|
|
|
+ * See EuiccManager.waitForReconnect()
|
|
|
+ */
|
|
|
+fun LocalProfileAssistant.disableActiveProfileWithUndo(refreshOnDisable: Boolean): () -> Unit =
|
|
|
+ profiles.find { it.isEnabled }?.let {
|
|
|
+ disableProfile(it.iccid, refreshOnDisable)
|
|
|
return { enableProfile(it.iccid) }
|
|
|
} ?: { }
|