Skip to content

Commit

Permalink
feat: restore selected files only
Browse files Browse the repository at this point in the history
  • Loading branch information
goofyz committed Jun 5, 2024
1 parent 0450cd3 commit a7b5154
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions app/src/main/java/com/osfans/trime/ui/fragments/ProfileFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,20 @@ class ProfileFragment :
lifecycleScope.withLoadingDialog(context) {
withContext(Dispatchers.IO) {
res =
items.fold(true) { acc, asset ->
ResourceUtils.copyFiles("$rimeFolder/$asset", DataManager.sharedDataDir, "$rimeFolder/").fold({
acc and true // on success
}, {
acc and false // on failure
})
}
items.filterIndexed { index, _ -> checkedItems[index] }
.fold(true) { acc, asset ->
ResourceUtils.copyFiles(
"$rimeFolder/$asset",
DataManager.sharedDataDir,
"$rimeFolder/",
)
.fold({ acc and true }, { acc and false })
}
}
ToastUtils.showShort(
if (res) R.string.reset_success else R.string.reset_failure,
)
}
ToastUtils.showShort(
if (res) R.string.reset_success else R.string.reset_failure,
)
}.show()
true
}
Expand Down

0 comments on commit a7b5154

Please sign in to comment.