Skip to content

Commit

Permalink
add progress dialog to deck options
Browse files Browse the repository at this point in the history
  • Loading branch information
RobozinhoD authored and david-allison committed May 5, 2024
1 parent d983b81 commit bc58dce
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion AnkiDroid/src/main/java/com/ichi2/anki/pages/DeckOptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import com.ichi2.anki.OnPageFinishedCallback
import com.ichi2.anki.R
import com.ichi2.anki.SingleFragmentActivity
import com.ichi2.anki.dialogs.DiscardChangesDialog
import com.ichi2.anki.withProgress
import com.ichi2.annotations.NeedsTest
import com.ichi2.libanki.undoableOp
import com.ichi2.libanki.updateDeckConfigsRaw
Expand Down Expand Up @@ -111,7 +112,13 @@ class DeckOptions : PageFragment() {
}

suspend fun FragmentActivity.updateDeckConfigsRaw(input: ByteArray): ByteArray {
val output = CollectionManager.withCol { updateDeckConfigsRaw(input) }
val output = withContext(Dispatchers.Main) {
withProgress {
withContext(Dispatchers.IO) {
CollectionManager.withCol { updateDeckConfigsRaw(input) }
}
}
}
undoableOp { OpChanges.parseFrom(output) }
withContext(Dispatchers.Main) { finish() }
return output
Expand Down

0 comments on commit bc58dce

Please sign in to comment.