Fix crash when failing to unsubscribe push notifications (#3234)
This commit is contained in:
parent
8449a0f958
commit
19096fbe55
1 changed files with 2 additions and 5 deletions
|
@ -36,7 +36,6 @@ import com.keylesspalace.tusky.util.CryptoUtil
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.unifiedpush.android.connector.UnifiedPush
|
import org.unifiedpush.android.connector.UnifiedPush
|
||||||
import retrofit2.HttpException
|
|
||||||
|
|
||||||
private const val TAG = "PushNotificationHelper"
|
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) {
|
suspend fun unregisterUnifiedPushEndpoint(api: MastodonApi, accountManager: AccountManager, account: AccountEntity) {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
api.unsubscribePushNotifications("Bearer ${account.accessToken}", account.domain)
|
api.unsubscribePushNotifications("Bearer ${account.accessToken}", account.domain)
|
||||||
.onFailure {
|
.onFailure { throwable ->
|
||||||
Log.d(TAG, "Error unregistering push endpoint for account " + account.id)
|
Log.w(TAG, "Error unregistering push endpoint for account " + account.id, throwable)
|
||||||
Log.d(TAG, Log.getStackTraceString(it))
|
|
||||||
Log.d(TAG, (it as HttpException).response().toString())
|
|
||||||
}
|
}
|
||||||
.onSuccess {
|
.onSuccess {
|
||||||
Log.d(TAG, "UnifiedPush unregistration succeeded for account " + account.id)
|
Log.d(TAG, "UnifiedPush unregistration succeeded for account " + account.id)
|
||||||
|
|
Loading…
Reference in a new issue