|
@@ -7,14 +7,12 @@ import android.content.Intent
|
|
|
import android.net.Uri
|
|
|
import android.os.Build
|
|
|
import androidx.core.net.toUri
|
|
|
-import com.hippo.unifile.UniFile
|
|
|
import eu.kanade.tachiyomi.data.backup.BackupRestoreJob
|
|
|
import eu.kanade.tachiyomi.data.download.DownloadManager
|
|
|
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
|
|
import eu.kanade.tachiyomi.data.updater.AppUpdateDownloadJob
|
|
|
import eu.kanade.tachiyomi.ui.main.MainActivity
|
|
|
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
|
|
-import eu.kanade.tachiyomi.util.storage.DiskUtil
|
|
|
import eu.kanade.tachiyomi.util.system.cancelNotification
|
|
|
import eu.kanade.tachiyomi.util.system.getParcelableExtraCompat
|
|
|
import eu.kanade.tachiyomi.util.system.notificationManager
|
|
@@ -65,12 +63,6 @@ class NotificationReceiver : BroadcastReceiver() {
|
|
|
context,
|
|
|
intent.getStringExtra(EXTRA_URI)!!.toUri(),
|
|
|
)
|
|
|
- // Delete image from path and dismiss notification
|
|
|
- ACTION_DELETE_IMAGE ->
|
|
|
- deleteImage(
|
|
|
- context,
|
|
|
- intent.getStringExtra(EXTRA_URI)!!.toUri(),
|
|
|
- )
|
|
|
// Share backup file
|
|
|
ACTION_SHARE_BACKUP ->
|
|
|
shareFile(
|
|
@@ -169,16 +161,6 @@ class NotificationReceiver : BroadcastReceiver() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Called to delete image
|
|
|
- *
|
|
|
- * @param uri path of file
|
|
|
- */
|
|
|
- private fun deleteImage(context: Context, uri: Uri) {
|
|
|
- UniFile.fromUri(context, uri)?.delete()
|
|
|
- DiskUtil.scanMedia(context, uri)
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Method called when user wants to stop a backup restore job.
|
|
|
*
|
|
@@ -415,26 +397,6 @@ class NotificationReceiver : BroadcastReceiver() {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Returns [PendingIntent] that starts a service which removes an image from disk
|
|
|
- *
|
|
|
- * @param context context of application
|
|
|
- * @param uri location path of file
|
|
|
- * @return [PendingIntent]
|
|
|
- */
|
|
|
- internal fun deleteImagePendingBroadcast(context: Context, uri: Uri): PendingIntent {
|
|
|
- val intent = Intent(context, NotificationReceiver::class.java).apply {
|
|
|
- action = ACTION_DELETE_IMAGE
|
|
|
- putExtra(EXTRA_URI, uri.toString())
|
|
|
- }
|
|
|
- return PendingIntent.getBroadcast(
|
|
|
- context,
|
|
|
- 0,
|
|
|
- intent,
|
|
|
- PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE,
|
|
|
- )
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Returns [PendingIntent] that starts a reader activity containing chapter.
|
|
|
*
|