Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import com.nextcloud.client.account.UserAccountManager
import com.nextcloud.client.database.entity.toOCUpload
import com.nextcloud.client.database.entity.toUploadEntity
import com.nextcloud.client.device.PowerManagementService
import com.nextcloud.client.jobs.BackgroundJobManager
import com.nextcloud.client.jobs.upload.FileUploadBroadcastManager
import com.nextcloud.client.jobs.upload.FileUploadWorker
import com.nextcloud.client.jobs.utils.UploadErrorNotificationManager
Expand Down Expand Up @@ -430,7 +429,6 @@ class AutoUploadWorker(
fileUploadBroadcastManager.sendFinished(
operation,
result,
operation.oldFile?.storagePath,
context
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,7 @@ class FileUploadBroadcastManager(private val broadcastManager: LocalBroadcastMan
* - [com.owncloud.android.ui.preview.PreviewImageActivity.UploadFinishReceiver]
*
*/
fun sendFinished(
upload: UploadFileOperation,
uploadResult: RemoteOperationResult<*>,
unlinkedFromRemotePath: String?,
context: Context
) {
fun sendFinished(upload: UploadFileOperation, uploadResult: RemoteOperationResult<*>, context: Context) {
Log_OC.d(TAG, "upload finished broadcast sent")
val intent = Intent(UPLOAD_FINISHED).apply {
// real remote path, after possible automatic renaming
Expand All @@ -102,9 +97,6 @@ class FileUploadBroadcastManager(private val broadcastManager: LocalBroadcastMan
putExtra(FileUploadWorker.EXTRA_OLD_FILE_PATH, upload.originalStoragePath)
putExtra(FileUploadWorker.ACCOUNT_NAME, upload.user.accountName)
putExtra(FileUploadWorker.EXTRA_UPLOAD_RESULT, uploadResult.isSuccess)
if (unlinkedFromRemotePath != null) {
putExtra(FileUploadWorker.EXTRA_LINKED_TO_PATH, unlinkedFromRemotePath)
}
setPackage(context.packageName)
}
broadcastManager.sendBroadcast(intent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class FileUploadWorker(
const val EXTRA_REMOTE_PATH = "REMOTE_PATH"
const val EXTRA_OLD_REMOTE_PATH = "OLD_REMOTE_PATH"
const val EXTRA_OLD_FILE_PATH = "OLD_FILE_PATH"
const val EXTRA_LINKED_TO_PATH = "LINKED_TO"
const val ACCOUNT_NAME = "ACCOUNT_NAME"
const val EXTRA_ACCOUNT_NAME = "ACCOUNT_NAME"
const val ACTION_CANCEL_BROADCAST = "CANCEL"
Expand Down Expand Up @@ -288,7 +287,6 @@ class FileUploadWorker(
fileUploadBroadcastManager.sendFinished(
operation,
result,
operation.oldFile?.storagePath,
context
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1698,10 +1698,7 @@ class FileDisplayActivity :
currentDir != null && uploadedRemotePath != null && uploadedRemotePath.startsWith(currentDir.remotePath)

if (sameAccount && isDescendant) {
val linkedToRemotePath = intent.getStringExtra(FileUploadWorker.EXTRA_LINKED_TO_PATH)
if (linkedToRemotePath == null || isAscendant(linkedToRemotePath)) {
updateListOfFilesFragment()
}
updateListOfFilesFragment()
}

val uploadWasFine = intent.getBooleanExtra(FileUploadWorker.EXTRA_UPLOAD_RESULT, false)
Expand Down Expand Up @@ -1749,12 +1746,6 @@ class FileDisplayActivity :
}
}
}

// TODO refactor this receiver, and maybe DownloadFinishReceiver; this method is duplicated :S
fun isAscendant(linkedToRemotePath: String): Boolean {
val currentDir = getCurrentDir()
return currentDir != null && currentDir.remotePath.startsWith(linkedToRemotePath)
}
}

/**
Expand Down
Loading