fix kotlin format violations and remove unused function

Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
This commit is contained in:
Jonas Mayer 2023-11-29 10:36:55 +01:00
parent 0535cb8fbc
commit 2a3d698b20
2 changed files with 10 additions and 25 deletions

View file

@ -198,13 +198,17 @@ class FilesUploadWorker(
* adapted from [com.owncloud.android.files.services.FileUploader.notifyUploadStart] * adapted from [com.owncloud.android.files.services.FileUploader.notifyUploadStart]
*/ */
private fun createNotification(uploadFileOperation: UploadFileOperation) { private fun createNotification(uploadFileOperation: UploadFileOperation) {
val notificationActionIntent = Intent(context, FileUploader.UploadNotificationActionReceiver::class.java)
val notificationActionIntent = Intent(context,FileUploader.UploadNotificationActionReceiver::class.java) notificationActionIntent.putExtra(FileUploader.EXTRA_ACCOUNT_NAME, uploadFileOperation.user.accountName)
notificationActionIntent.putExtra(FileUploader.EXTRA_ACCOUNT_NAME,uploadFileOperation.user.accountName) notificationActionIntent.putExtra(FileUploader.EXTRA_REMOTE_PATH, uploadFileOperation.remotePath)
notificationActionIntent.putExtra(FileUploader.EXTRA_REMOTE_PATH,uploadFileOperation.remotePath)
notificationActionIntent.action = FileUploader.ACTION_CANCEL_BROADCAST notificationActionIntent.action = FileUploader.ACTION_CANCEL_BROADCAST
val pendingIntent = PendingIntent.getBroadcast(context,SecureRandom().nextInt(),notificationActionIntent, PendingIntent.FLAG_MUTABLE) val pendingIntent = PendingIntent.getBroadcast(
context,
SecureRandom().nextInt(),
notificationActionIntent,
PendingIntent.FLAG_MUTABLE
)
notificationBuilder notificationBuilder
.setOngoing(true) .setOngoing(true)
@ -219,8 +223,7 @@ class FilesUploadWorker(
) )
) )
.clearActions() // to make sure there is only one action .clearActions() // to make sure there is only one action
.addAction(R.drawable.ic_action_cancel_grey,context.getString(R.string.common_cancel),pendingIntent) .addAction(R.drawable.ic_action_cancel_grey, context.getString(R.string.common_cancel), pendingIntent)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
notificationBuilder.setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_UPLOAD) notificationBuilder.setChannelId(NotificationUtils.NOTIFICATION_CHANNEL_UPLOAD)

View file

@ -345,24 +345,6 @@ public class UploadsStorageManager extends Observable {
return getUploads(null, (String[]) null); return getUploads(null, (String[]) null);
} }
public OCUpload getUploadByRemotePath(String remotePath){
OCUpload result = null;
Cursor cursor = getDB().query(
ProviderTableMeta.CONTENT_URI_UPLOADS,
null,
ProviderTableMeta.UPLOADS_REMOTE_PATH + "=?",
new String[]{remotePath},
ProviderTableMeta.UPLOADS_REMOTE_PATH+ " ASC");
if (cursor != null) {
if (cursor.moveToFirst()) {
result = createOCUploadFromCursor(cursor);
}
}
Log_OC.d(TAG, "Retrieve job " + result + " for remote path " + remotePath);
return result;
}
public @Nullable public @Nullable
OCUpload getUploadById(long id) { OCUpload getUploadById(long id) {
OCUpload result = null; OCUpload result = null;