Merge pull request #2743 from Bnyro/master

Remove some unused constants
This commit is contained in:
Bnyro 2023-01-17 19:33:40 +01:00 committed by GitHub
commit 7f30bf7a7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -41,10 +41,7 @@ const val FALLBACK_INSTANCES_URL = "https://instances.tokhmi.xyz"
* Notification IDs * Notification IDs
*/ */
const val PLAYER_NOTIFICATION_ID = 1 const val PLAYER_NOTIFICATION_ID = 1
const val DOWNLOAD_PENDING_NOTIFICATION_ID = 2 const val DOWNLOAD_PROGRESS_NOTIFICATION_ID = 2
const val DOWNLOAD_FAILURE_NOTIFICATION_ID = 3
const val DOWNLOAD_SUCCESS_NOTIFICATION_ID = 4
const val DOWNLOAD_PROGRESS_NOTIFICATION_ID = 5
/** /**
* Notification Channel IDs * Notification Channel IDs

View File

@ -12,6 +12,7 @@ import androidx.work.Worker
import androidx.work.WorkerParameters import androidx.work.WorkerParameters
import com.github.libretube.R import com.github.libretube.R
import com.github.libretube.api.SubscriptionHelper import com.github.libretube.api.SubscriptionHelper
import com.github.libretube.constants.DOWNLOAD_PROGRESS_NOTIFICATION_ID
import com.github.libretube.constants.IntentData import com.github.libretube.constants.IntentData
import com.github.libretube.constants.PUSH_CHANNEL_ID import com.github.libretube.constants.PUSH_CHANNEL_ID
import com.github.libretube.constants.PreferenceKeys import com.github.libretube.constants.PreferenceKeys
@ -35,9 +36,9 @@ class NotificationWorker(appContext: Context, parameters: WorkerParameters) :
// the id where notification channels start // the id where notification channels start
private var notificationId = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { private var notificationId = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val nManager = appContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager val nManager = appContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
nManager.activeNotifications.size + 5 nManager.activeNotifications.size + DOWNLOAD_PROGRESS_NOTIFICATION_ID
} else { } else {
5 DOWNLOAD_PROGRESS_NOTIFICATION_ID
} }
override fun doWork(): Result { override fun doWork(): Result {