From 19096fbe55c58b471c69ce95c6bb384da8891876 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Sat, 28 Jan 2023 12:40:58 +0100 Subject: [PATCH] Fix crash when failing to unsubscribe push notifications (#3234) --- .../components/notifications/PushNotificationHelper.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/notifications/PushNotificationHelper.kt b/app/src/main/java/com/keylesspalace/tusky/components/notifications/PushNotificationHelper.kt index 0d804dd9..cf1dd438 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/notifications/PushNotificationHelper.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/notifications/PushNotificationHelper.kt @@ -36,7 +36,6 @@ import com.keylesspalace.tusky.util.CryptoUtil import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import org.unifiedpush.android.connector.UnifiedPush -import retrofit2.HttpException private const val TAG = "PushNotificationHelper" @@ -210,10 +209,8 @@ suspend fun updateUnifiedPushSubscription(context: Context, api: MastodonApi, ac suspend fun unregisterUnifiedPushEndpoint(api: MastodonApi, accountManager: AccountManager, account: AccountEntity) { withContext(Dispatchers.IO) { api.unsubscribePushNotifications("Bearer ${account.accessToken}", account.domain) - .onFailure { - Log.d(TAG, "Error unregistering push endpoint for account " + account.id) - Log.d(TAG, Log.getStackTraceString(it)) - Log.d(TAG, (it as HttpException).response().toString()) + .onFailure { throwable -> + Log.w(TAG, "Error unregistering push endpoint for account " + account.id, throwable) } .onSuccess { Log.d(TAG, "UnifiedPush unregistration succeeded for account " + account.id)