commit 5d370776a55bc4f0be02813426fe3002cd93eaab
parent f66859b1fd4cf59c471837fc25afd9c47f238f59
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date: Sat, 25 Nov 2023 22:21:40 +0100
fix(action/bulk_remove_friends): error handling
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/action/impl/BulkRemoveFriends.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/action/impl/BulkRemoveFriends.kt
@@ -22,8 +22,13 @@ class BulkRemoveFriends : AbstractAction() {
.show()
context.coroutineScope.launch {
- friendIds.forEach {
- removeFriend(it)
+ friendIds.forEach { userId ->
+ runCatching {
+ removeFriend(userId)
+ }.onFailure {
+ context.log.error("Failed to remove friend $it", it)
+ context.shortToast("Failed to remove friend $userId")
+ }
index++
withContext(Dispatchers.Main) {
dialog.setTitle(
@@ -55,6 +60,7 @@ class BulkRemoveFriends : AbstractAction() {
"b42f1f70-5a8b-4c53-8c25-34e7ec9e6781", // myai
"84ee8839-3911-492d-8b94-72dd80f3713a", // teamsnapchat
)
+
context.coroutineScope.launch(Dispatchers.Main) {
val friends = context.database.getAllFriends().filter {
it.userId !in userIdBlacklist &&