Skip to content
Merged
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 @@ -34,6 +34,7 @@ object FileNameValidator {
* @return An error message if the filename is invalid, null otherwise.
*/
@Suppress("ReturnCount", "NestedBlockDepth")
@JvmOverloads
fun checkFileName(
filename: String,
capability: OCCapability,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ private boolean checkFolderPath(String filename) {
}

private String checkFileName(String filename) {
return FileNameValidator.INSTANCE.checkFileName(filename, getCapabilities(), getNonNullContext(),null);
return FileNameValidator.INSTANCE.checkFileName(filename, getCapabilities(), getNonNullContext());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public void selectFile(OCFile file) {
return;
}

String filenameErrorMessage = FileNameValidator.INSTANCE.checkFileName(file.getFileName(), optionalCapabilities.get(), this, null);
String filenameErrorMessage = FileNameValidator.INSTANCE.checkFileName(file.getFileName(), optionalCapabilities.get(), this);
if (filenameErrorMessage != null) {
DisplayUtils.showSnackMessage(this, filenameErrorMessage);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import javax.inject.Inject

/**
* Dialog requiring confirmation before removing a collection of given OCFiles.
* Triggers the removal according to the user response.
*/
class RemoveFilesDialogFragment :
ConfirmationDialogFragment(),
ConfirmationDialogFragmentListener,
Expand Down Expand Up @@ -110,8 +106,9 @@ class RemoveFilesDialogFragment :
offlineFiles.forEach(fileDataStorageManager::deleteOfflineOperation)

val listener = getTypedActivity(OnFilesRemovedListener::class.java)
val fileActivity = getTypedActivity(FileActivity::class.java)

lifecycleScope.launch(Dispatchers.IO) {
fileActivity?.lifecycleScope?.launch(Dispatchers.IO) {
val (autoUploadEntities, filesToRemove) =
FileUploadHelper.instance().splitFilesByAutoUpload(files, userAccountManager.user.accountName)
withContext(Dispatchers.Main) {
Expand All @@ -123,10 +120,11 @@ class RemoveFilesDialogFragment :
)
}

val fileActivity = getTypedActivity(FileActivity::class.java)
fileActivity?.removeFiles(offlineFiles, filesToRemove, onlyLocalCopy, listener)
fileActivity.removeFiles(offlineFiles, filesToRemove, onlyLocalCopy, listener)
finishActionMode()
}
} ?: run {
finishActionMode()
}
}

Expand Down Expand Up @@ -222,6 +220,7 @@ class RemoveFilesDialogFragment :
val list = ArrayList<OCFile>().apply {
add(file)
}

return newInstance(list)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ public boolean onLongItemClicked(OCFile file) {

private void folderOnItemClick(OCFile file, int position) {
if (requireActivity() instanceof FolderPickerActivity fpa) {
String filenameErrorMessage = FileNameValidator.INSTANCE.checkFileName(file.getFileName(), getCapabilities(), requireContext(), null);
String filenameErrorMessage = FileNameValidator.INSTANCE.checkFileName(file.getFileName(), getCapabilities(), requireContext());
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Crash fix

if (filenameErrorMessage != null) {
DisplayUtils.showSnackMessage(fpa, filenameErrorMessage);
return;
Expand Down Expand Up @@ -1463,7 +1463,7 @@ private OCCapability getCapabilities() {

private String checkInvalidFilenames(Set<OCFile> checkedFiles) {
for (OCFile file : checkedFiles) {
String errorMessage = FileNameValidator.INSTANCE.checkFileName(file.getFileName(), getCapabilities(), requireContext(), null);
String errorMessage = FileNameValidator.INSTANCE.checkFileName(file.getFileName(), getCapabilities(), requireContext());
if (errorMessage != null) {
return errorMessage;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class NavigatorActivity : DrawerActivity() {
/**
* Handles action bar leading button action
*/
@Suppress("NestedBlockDepth")
Copy link
Copy Markdown
Collaborator Author

@alperozturk96 alperozturk96 Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to supress kotlin spotless

override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == android.R.id.home) {
val onBackPressListener =
Expand Down
Loading