diff --git a/app/src/main/java/com/vanced/manager/core/downloader/DownloadBroadcastReceiver.kt b/app/src/main/java/com/vanced/manager/core/downloader/DownloadBroadcastReceiver.kt index f950b98a..7a2e94a4 100644 --- a/app/src/main/java/com/vanced/manager/core/downloader/DownloadBroadcastReceiver.kt +++ b/app/src/main/java/com/vanced/manager/core/downloader/DownloadBroadcastReceiver.kt @@ -9,8 +9,7 @@ import com.downloader.PRDownloader class DownloadBroadcastReceiver: BroadcastReceiver() { override fun onReceive(context: Context?, intent: Intent?) { - val tag: Int? = intent?.getIntExtra("tag", 0) - PRDownloader.cancel(tag) - Log.d("VMNotification", "Canceled $tag download") + PRDownloader.cancelAll() + Log.d("VMNotification", "Canceled downloads") } } \ No newline at end of file diff --git a/app/src/main/java/com/vanced/manager/core/downloader/MicrogDownloadService.kt b/app/src/main/java/com/vanced/manager/core/downloader/MicrogDownloadService.kt index bda334cb..3ff2b533 100644 --- a/app/src/main/java/com/vanced/manager/core/downloader/MicrogDownloadService.kt +++ b/app/src/main/java/com/vanced/manager/core/downloader/MicrogDownloadService.kt @@ -37,7 +37,6 @@ class MicrogDownloadService: Service() { val dwnldUrl = apkUrl.get("url").asString val channel = 420 PRDownloader.download(dwnldUrl, filesDir.path, "microg.apk") - .setTag(55) .build() .setOnStartOrResumeListener { OnStartOrResumeListener { prefs?.edit()?.putBoolean("isMicrogDownloading", true)?.apply() } } .setOnProgressListener { progress -> @@ -46,7 +45,6 @@ class MicrogDownloadService: Service() { channel, mProgress.toInt(), getFileNameFromUrl(dwnldUrl), - 55, this ) } diff --git a/app/src/main/java/com/vanced/manager/core/downloader/VancedDownloadService.kt b/app/src/main/java/com/vanced/manager/core/downloader/VancedDownloadService.kt index f705bb0a..a023c1ab 100644 --- a/app/src/main/java/com/vanced/manager/core/downloader/VancedDownloadService.kt +++ b/app/src/main/java/com/vanced/manager/core/downloader/VancedDownloadService.kt @@ -64,12 +64,11 @@ class VancedDownloadService: Service() { val channel = 69 PRDownloader .download(url, cacheDir.path, getFileNameFromUrl(url)) - .setTag(66) .build() .setOnStartOrResumeListener { OnStartOrResumeListener { prefs?.edit()?.putBoolean("isVancedDownloading", true)?.apply() } } .setOnProgressListener { progress -> val mProgress = progress.currentBytes * 100 / progress.totalBytes - displayDownloadNotif(channel, mProgress.toInt(), getFileNameFromUrl(url), 66, this) + displayDownloadNotif(channel, mProgress.toInt(), getFileNameFromUrl(url), this) } .setOnCancelListener { OnCancelListener { cancelNotif(channel, this) diff --git a/app/src/main/java/com/vanced/manager/utils/NotificationHelper.kt b/app/src/main/java/com/vanced/manager/utils/NotificationHelper.kt index 6937486a..2b54b5b5 100644 --- a/app/src/main/java/com/vanced/manager/utils/NotificationHelper.kt +++ b/app/src/main/java/com/vanced/manager/utils/NotificationHelper.kt @@ -24,7 +24,7 @@ object NotificationHelper { } } - fun displayDownloadNotif(channel: Int, progress:Int, filename: String, tag: Int, context: Context) { + fun displayDownloadNotif(channel: Int, progress:Int, filename: String, context: Context) { val notifBuilder = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) Notification.Builder(context, channel.toString()).setChannelId("69420") @@ -32,7 +32,6 @@ object NotificationHelper { Notification.Builder(context).setPriority(Notification.PRIORITY_HIGH) val cancelDownload = Intent(context, DownloadBroadcastReceiver::class.java) - cancelDownload.putExtra("tag", tag) val cancelPendingIntent = PendingIntent.getBroadcast(context, 0, cancelDownload, PendingIntent.FLAG_UPDATE_CURRENT)