From d4c4710b2d5cd62762516b9a56c5af014091eba8 Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Fri, 29 Nov 2024 07:05:06 +0530 Subject: [PATCH] Added success toasts --- .../local/subscription/workers/SubscriptionExportWorker.kt | 6 ++++++ .../local/subscription/workers/SubscriptionImportWorker.kt | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/workers/SubscriptionExportWorker.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/workers/SubscriptionExportWorker.kt index 42b77e21c..e41bf3b38 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/workers/SubscriptionExportWorker.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/workers/SubscriptionExportWorker.kt @@ -58,6 +58,12 @@ class SubscriptionExportWorker( Log.i(TAG, "Exported $qty subscriptions") } + withContext(Dispatchers.Main) { + Toast + .makeText(applicationContext, R.string.export_complete_toast, Toast.LENGTH_SHORT) + .show() + } + Result.success() } catch (e: Exception) { if (BuildConfig.DEBUG) { diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/workers/SubscriptionImportWorker.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/workers/SubscriptionImportWorker.kt index 4e5c2a541..e66e2a5df 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/workers/SubscriptionImportWorker.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/workers/SubscriptionImportWorker.kt @@ -6,6 +6,7 @@ import android.content.pm.ServiceInfo import android.os.Build import android.util.Pair import android.webkit.MimeTypeMap +import android.widget.Toast import androidx.core.app.NotificationCompat import androidx.core.net.toUri import androidx.work.CoroutineWorker @@ -98,6 +99,12 @@ class SubscriptionImportWorker( setForeground(createForegroundInfo(createNotification(title, null, index, qty))) } + withContext(Dispatchers.Main) { + Toast + .makeText(applicationContext, R.string.import_complete_toast, Toast.LENGTH_SHORT) + .show() + } + return Result.success() }