Prevent running recycle bin check on Q+ devices

This commit is contained in:
Ensar Sarajčić
2023-07-25 12:22:46 +02:00
parent 950f5a0207
commit f511da5180

View File

@ -159,11 +159,19 @@ fun BaseSimpleActivity.moveRecordingsToRecycleBin(recordingsToMove: Collection<R
} }
fun BaseSimpleActivity.checkRecycleBinItems() { fun BaseSimpleActivity.checkRecycleBinItems() {
if (isQPlus()) {
// System is handling recycle bin on Q+ devices
return
}
if (config.useRecycleBin && config.lastRecycleBinCheck < System.currentTimeMillis() - DAY_SECONDS * 1000) { if (config.useRecycleBin && config.lastRecycleBinCheck < System.currentTimeMillis() - DAY_SECONDS * 1000) {
config.lastRecycleBinCheck = System.currentTimeMillis() config.lastRecycleBinCheck = System.currentTimeMillis()
ensureBackgroundThread { ensureBackgroundThread {
try { try {
deleteRecordings(getLegacyRecordings(trashed = true).filter { it.timestamp < System.currentTimeMillis() - MONTH_SECONDS * 1000L }) {} val recordingsToRemove = getLegacyRecordings(trashed = true).filter { it.timestamp < System.currentTimeMillis() - MONTH_SECONDS * 1000L }
if (recordingsToRemove.isNotEmpty()) {
deleteRecordings(recordingsToRemove) {}
}
} catch (e: Exception) { } catch (e: Exception) {
} }
} }