Bläddra i källkod

Remove lateinit

Signed-off-by: alperozturk <alper_ozturk@proton.me>
alperozturk 11 månader sedan
förälder
incheckning
163e73e449

+ 0 - 1
app/src/main/java/com/nextcloud/client/jobs/BackgroundJobManagerImpl.kt

@@ -556,7 +556,6 @@ internal class BackgroundJobManagerImpl(
         val tag = startFileDownloadJobTag(user, file.fileId)
 
         val data = workDataOf(
-            FileDownloadWorker.WORKER_ID to file.fileId.toInt(),
             FileDownloadWorker.ACCOUNT_NAME to user.accountName,
             FileDownloadWorker.FILE_REMOTE_PATH to file.remotePath,
             FileDownloadWorker.BEHAVIOUR to behaviour,

+ 6 - 15
app/src/main/java/com/nextcloud/client/jobs/download/FileDownloadWorker.kt

@@ -65,7 +65,6 @@ class FileDownloadWorker(
             return pendingDownloads.all.any { it.value?.payload?.isMatching(accountName, fileId) == true }
         }
 
-        const val WORKER_ID = "WORKER_ID"
         const val FILE_REMOTE_PATH = "FILE_REMOTE_PATH"
         const val ACCOUNT_NAME = "ACCOUNT_NAME"
         const val BEHAVIOUR = "BEHAVIOUR"
@@ -94,7 +93,12 @@ class FileDownloadWorker(
     private var lastPercent = 0
 
     private val intents = FileDownloadIntents(context)
-    private var notificationManager: DownloadNotificationManager
+    private var notificationManager = DownloadNotificationManager(
+        SecureRandom().nextInt(),
+        context,
+        viewThemeUtils
+    )
+
     private var downloadProgressListener = FileDownloadProgressListener()
 
     private var user: User? = null
@@ -103,19 +107,8 @@ class FileDownloadWorker(
     private var currentUserFileStorageManager: FileDataStorageManager? = null
     private var fileDataStorageManager: FileDataStorageManager? = null
 
-    private var workerId: Int? = null
     private var downloadError: FileDownloadError? = null
 
-    init {
-        workerId = inputData.keyValueMap[WORKER_ID] as Int
-        notificationManager =
-            DownloadNotificationManager(
-                workerId ?: SecureRandom().nextInt(),
-                context,
-                viewThemeUtils
-            )
-    }
-
     @Suppress("TooGenericExceptionCaught")
     override fun doWork(): Result {
         return try {
@@ -173,8 +166,6 @@ class FileDownloadWorker(
     }
 
     private fun getRequestDownloads(): AbstractList<String> {
-        Log_OC.e(TAG, "FilesDownloadWorker started for $workerId")
-
         setUser()
         val files = getFiles()
         val downloadType = getDownloadType()