Skip to content

Commit d666764

Browse files
committed
delete unused functions
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent 3a89291 commit d666764

2 files changed

Lines changed: 6 additions & 29 deletions

File tree

app/src/main/java/com/nextcloud/client/jobs/upload/FileUploadWorker.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,13 @@ class FileUploadWorker(
133133
notificationManager.dismissNotification()
134134
result
135135
} catch (t: Throwable) {
136-
Log_OC.e(TAG, "Error caught at FileUploadWorker $t")
137-
cleanup()
136+
Log_OC.e(TAG, "exception $t")
137+
currentUploadFileOperation?.cancel(null)
138138
Result.failure()
139+
} finally {
140+
// Ensure all database operations are complete before signaling completion
141+
uploadsStorageManager.notifyObserversNow()
142+
notificationManager.dismissNotification()
139143
}
140144

141145
private suspend fun trySetForeground() {
@@ -183,13 +187,6 @@ class FileUploadWorker(
183187
.setSilent(true)
184188
.build()
185189

186-
private fun cleanup() {
187-
Log_OC.e(TAG, "FileUploadWorker stopped")
188-
189-
currentUploadFileOperation?.cancel(null)
190-
notificationManager.dismissNotification()
191-
}
192-
193190
@Suppress("ReturnCount", "LongMethod", "DEPRECATION")
194191
private suspend fun uploadFiles(): Result = withContext(Dispatchers.IO) {
195192
val accountName = inputData.getString(ACCOUNT)

app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,24 +1050,4 @@ public void cleanup() {
10501050
ocFileListDelegate.cleanup();
10511051
helper.cleanup();
10521052
}
1053-
1054-
public void insertFile(@NonNull OCFile file) {
1055-
mFiles.add(file);
1056-
mFilesAll.add(file);
1057-
1058-
// Re-sort to maintain order
1059-
if (sortOrder != null) {
1060-
boolean foldersBeforeFiles = preferences.isSortFoldersBeforeFiles();
1061-
boolean favoritesFirst = preferences.isSortFavoritesFirst();
1062-
mFiles = sortOrder.sortCloudFiles(mFiles, foldersBeforeFiles, favoritesFirst);
1063-
}
1064-
1065-
// Find actual position and notify
1066-
int position = mFiles.indexOf(file);
1067-
if (shouldShowHeader()) {
1068-
position++;
1069-
}
1070-
1071-
notifyItemInserted(position);
1072-
}
10731053
}

0 commit comments

Comments
 (0)