2
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-08-22 01:58:16 +00:00

Fix error toast crash

This commit is contained in:
Michael Zh 2025-06-24 22:34:35 -04:00
parent 4c8d44b6ba
commit 366129eee2

View File

@ -10,6 +10,7 @@ import android.widget.Toast
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat import androidx.core.app.NotificationManagerCompat
import androidx.core.app.PendingIntentCompat import androidx.core.app.PendingIntentCompat
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
@ -136,9 +137,11 @@ class ErrorUtil {
NotificationManagerCompat.from(context) NotificationManagerCompat.from(context)
.notify(ERROR_REPORT_NOTIFICATION_ID, notificationBuilder.build()) .notify(ERROR_REPORT_NOTIFICATION_ID, notificationBuilder.build())
// since the notification is silent, also show a toast, otherwise the user is confused ContextCompat.getMainExecutor(context).execute {
Toast.makeText(context, R.string.error_report_notification_toast, Toast.LENGTH_SHORT) // since the notification is silent, also show a toast, otherwise the user is confused
.show() Toast.makeText(context, R.string.error_report_notification_toast, Toast.LENGTH_SHORT)
.show()
}
} }
private fun getErrorActivityIntent(context: Context, errorInfo: ErrorInfo): Intent { private fun getErrorActivityIntent(context: Context, errorInfo: ErrorInfo): Intent {