Fix Kotlin warnings (related to issue #5996) (#6320)

* refactor: replace unused exception variable with underscore

* refactor: code style fix

* fix: remove unnecessary latLng variable and return null directly

* fix: use explicit true/false instead of isFABsExpanded

* refactor: simplify marker update logic by reducing redundant conditions

* refactor: use data object instead of object

* fix: check placeBindings for null instead of checking each destructured value

* fix: check placeBindings for null instead of checking each destructured value

* docs: fix KDoc for contentUri property by removing incorrect @param tag

* docs: correct @see link in KDoc for showBadgesWithCount

* docs: fix KDoc tag from @property to @param for context in BottomSheetAdapter

* docs: comment out KDoc for disabled method to avoid unresolved @param warning

* docs: fix KDoc for onLongPress by removing invalid @param imageUri

* docs: clean up invalid KDoc tags on property and add docs to isEmpty

* docs: remove invalid @param originalImageCoordinates from findOtherImages KDoc

* docs: fix incorrect @param tag in checkDuplicateImage KDoc

* docs: fix incorrect @param in onLongPress KDoc

* docs: fix invalid @param and @return tags on author property

* docs: fix incorrect @param in provideWikidataMediaInterface KDoc

* docs: fix incorrect @param name in getWikiText KDoc

* docs: escape wikilinks with [[ ]] to avoid KDoc resolution warnings

* docs: fix KDoc by adding missing param descriptions to startActivityWithFlags

* docs: fix KDoc by replacing @param with @property for contentUri

* docs: fix malformed KDoc in startYourself, remove invalid @param line

* docs: remove invalid @param tag in createDialogsAndHandleLocationPermissions

* docs: remove invalid @param tags to @property

* @docs: remove invalid @property tags

* docs: clean up KDoc by removing invalid @param and @return tags

* docs: fix incorrect @param name in removeBlocklisted KDoc

* docs: fix incorrect @param name in checkDuplicateImage KDoc

* docs: fix incorrect @param tag

---------

Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
This commit is contained in:
rayane 2025-05-29 13:25:00 +02:00 committed by GitHub
parent ed1485ca22
commit cfc2cfcca1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 153 additions and 150 deletions

View file

@ -6,29 +6,29 @@ package fr.free.nrw.commons.upload
class Description {
/**
* The language code, e.g., "en" or "fr".
* @param languageCode The language code.
* @property languageCode The language code.
*/
var languageCode: String? = null
/**
* The description text for the item being uploaded.
* @param descriptionText The description text.
* @property descriptionText The description text.
*/
var descriptionText: String? = null
/**
* The index of the language selected in a spinner with [SpinnerLanguagesAdapter].
* @param selectedLanguageIndex The index of the selected language.
* @property selectedLanguageIndex The index of the selected language.
*/
var selectedLanguageIndex = -1
/**
* Indicates if the description was added manually (by the user or programmatically).
* @param manuallyAdded Sets to true if the description was manually added by the user.
* @return True if the description was manually added.
*/
var isManuallyAdded = false
/**
* Returns true if the description text is null or empty.
*/
val isEmpty: Boolean
get() = descriptionText == null || descriptionText!!.isEmpty()

View file

@ -137,13 +137,12 @@ class FileProcessor
}
}
/**
* Find other images around the same location that were taken within the last 20 sec
*
* @param originalImageCoordinates
* @param fileBeingProcessed
* @param similarImageInterface
*/
/**
* Finds other images around the same location that were taken within a ±120 sec window.
*
* @param fileBeingProcessed The file currently being checked.
* @param similarImageInterface Callback to display similar images if any are found.
*/
private fun findOtherImages(
fileBeingProcessed: File,
similarImageInterface: SimilarImageInterface?,

View file

@ -138,10 +138,10 @@ class ImageProcessingService @Inject constructor(
}
/**
* Checks for duplicate image
* Checks for duplicate image by calculating its SHA1 hash and querying the media client.
*
* @param filePath file to be checked
* @return IMAGE_DUPLICATE or IMAGE_OK
* @param inputStream The input stream of the file to check.
* @return IMAGE_DUPLICATE if the file exists, or IMAGE_OK otherwise.
*/
private fun checkDuplicateImage(inputStream: InputStream): Single<Int> {
return Single.fromCallable { fileUtilsWrapper.getSHA1(inputStream) }

View file

@ -10,18 +10,15 @@ import kotlinx.parcelize.Parcelize
@Parcelize
data class UploadMediaDetail(
/**
* The language code ie. "en" or "fr".
* @param languageCode The language code ie. "en" or "fr".
* The language code, e.g., "en" or "fr".
*/
var languageCode: String? = null,
/**
* The description text for the item being uploaded.
* @param descriptionText The description text.
*/
var descriptionText: String? = "",
/**
* The caption text for the item being uploaded.
* @param captionText The caption text.
*/
var captionText: String = "",
) : Parcelable {
@ -35,15 +32,11 @@ data class UploadMediaDetail(
/**
* The index of the language selected in a spinner with [SpinnerLanguagesAdapter].
* @return The index of the selected language.
* @param selectedLanguageIndex The index of the language selected.
*/
var selectedLanguageIndex: Int = -1
/**
* Returns if the description was added manually (by the user, or programmatically).
* @return True if the description was manually added.
* @param manuallyAdded Sets to true if the description was manually added.
* Indicates whether the description was added manually (by the user or programmatically).
*/
var isManuallyAdded: Boolean = false
}

View file

@ -30,9 +30,10 @@ class UploadMediaDetailInputFilter : InputFilter {
patterns.any { it.matcher(source).find() }
/**
* Removes any blocklisted characters from the source text.
* @param source input text
* @return a cleaned character sequence
* Removes any blocklisted characters from the input text.
*
* @param input The input text to be cleaned.
* @return A cleaned character sequence with blocklisted patterns removed.
*/
private fun removeBlocklisted(input: CharSequence): CharSequence {
var source = input

View file

@ -98,10 +98,11 @@ class UploadModel @Inject internal constructor(
imageProcessingService.validateImage(uploadItem, inAppPictureLocation)
/**
* Calls checkDuplicateImage() of ImageProcessingService to check if image is duplicate
* Calls checkDuplicateImage() of ImageProcessingService to check if the image is a duplicate.
*
* @param filePath file to be checked
* @return IMAGE_DUPLICATE or IMAGE_OK
* @param originalFilePath The original file URI.
* @param modifiedFilePath The modified file URI.
* @return IMAGE_DUPLICATE if the file already exists, IMAGE_OK otherwise.
*/
fun checkDuplicateImage(originalFilePath: Uri?, modifiedFilePath: Uri?): Single<Int> =
imageProcessingService.checkIfFileAlreadyExists(