Fix kotlin and gradle issues

This commit is contained in:
Adith 2024-10-12 18:41:56 +11:00
parent ba7a559714
commit b851712370
7 changed files with 25 additions and 34 deletions

View file

@ -1,16 +1,12 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintNewerVersionAvailable" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ClassWithOnlyPrivateConstructors" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ConfusingElse" enabled="true" level="WARNING" enabled_by_default="true">
<option name="reportWhenNoStatementFollow" value="true" />
</inspection_tool>
<inspection_tool class="ControlFlowStatementWithoutBraces" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="DefaultNotLastCaseInSwitch" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ExplicitThis" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="FieldMayBeFinal" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="LocalCanBeFinal" enabled="true" level="WARNING" enabled_by_default="true">
<option name="REPORT_VARIABLES" value="true" />
<option name="REPORT_PARAMETERS" value="true" />
@ -25,13 +21,11 @@
<option name="ignoreInMatchingInstanceof" value="false" />
</inspection_tool>
<inspection_tool class="ProblematicWhitespace" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ProtectedMemberInFinalClass" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="RedundantFieldInitialization" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="RedundantImplements" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreSerializable" value="false" />
<option name="ignoreCloneable" value="false" />
</inspection_tool>
<inspection_tool class="RedundantMethodOverride" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SimplifiableEqualsExpression" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="TypeParameterExtendsFinalClass" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UnnecessarilyQualifiedStaticUsage" enabled="true" level="WARNING" enabled_by_default="true">
@ -47,6 +41,5 @@
<inspection_tool class="UnnecessaryQualifierForThis" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UnnecessarySuperConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UnnecessaryThis" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UnnecessaryToStringCall" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

View file

@ -380,7 +380,7 @@ android {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.3.2'
kotlinCompilerExtensionVersion '1.5.8'
}
namespace 'fr.free.nrw.commons'
lint {

View file

@ -15,19 +15,19 @@ abstract class NotForUploadStatusDao {
* Insert into Not For Upload status.
*/
@Insert(onConflict = OnConflictStrategy.REPLACE)
abstract suspend fun insert(notForUploadStatus: NotForUploadStatus)
abstract fun insert(notForUploadStatus: NotForUploadStatus)
/**
* Delete Not For Upload status entry.
*/
@Delete
abstract suspend fun delete(notForUploadStatus: NotForUploadStatus)
abstract fun delete(notForUploadStatus: NotForUploadStatus)
/**
* Query Not For Upload status with image sha1.
*/
@Query("SELECT * FROM images_not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ")
abstract suspend fun getFromImageSHA1(imageSHA1: String): NotForUploadStatus?
abstract fun getFromImageSHA1(imageSHA1: String): NotForUploadStatus?
/**
* Asynchronous image sha1 query.
@ -38,7 +38,7 @@ abstract class NotForUploadStatusDao {
* Deletion Not For Upload status with image sha1.
*/
@Query("DELETE FROM images_not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ")
abstract suspend fun deleteWithImageSHA1(imageSHA1: String)
abstract fun deleteWithImageSHA1(imageSHA1: String)
/**
* Asynchronous image sha1 deletion.
@ -49,5 +49,5 @@ abstract class NotForUploadStatusDao {
* Check whether the imageSHA1 is present in database
*/
@Query("SELECT COUNT() FROM images_not_for_upload_table WHERE imageSHA1 = (:imageSHA1) ")
abstract suspend fun find(imageSHA1: String): Int
abstract fun find(imageSHA1: String): Int
}

View file

@ -17,31 +17,31 @@ abstract class UploadedStatusDao {
* Insert into uploaded status.
*/
@Insert(onConflict = OnConflictStrategy.REPLACE)
abstract suspend fun insert(uploadedStatus: UploadedStatus)
abstract fun insert(uploadedStatus: UploadedStatus)
/**
* Update uploaded status entry.
*/
@Update
abstract suspend fun update(uploadedStatus: UploadedStatus)
abstract fun update(uploadedStatus: UploadedStatus)
/**
* Delete uploaded status entry.
*/
@Delete
abstract suspend fun delete(uploadedStatus: UploadedStatus)
abstract fun delete(uploadedStatus: UploadedStatus)
/**
* Query uploaded status with image sha1.
*/
@Query("SELECT * FROM uploaded_table WHERE imageSHA1 = (:imageSHA1) ")
abstract suspend fun getFromImageSHA1(imageSHA1: String): UploadedStatus?
abstract fun getFromImageSHA1(imageSHA1: String): UploadedStatus?
/**
* Query uploaded status with modified image sha1.
*/
@Query("SELECT * FROM uploaded_table WHERE modifiedImageSHA1 = (:modifiedImageSHA1) ")
abstract suspend fun getFromModifiedImageSHA1(modifiedImageSHA1: String): UploadedStatus?
abstract fun getFromModifiedImageSHA1(modifiedImageSHA1: String): UploadedStatus?
/**
* Asynchronous insert into uploaded status table.
@ -55,7 +55,7 @@ abstract class UploadedStatusDao {
* Check whether the imageSHA1 is present in database
*/
@Query("SELECT COUNT() FROM uploaded_table WHERE imageSHA1 = (:imageSHA1) AND imageResult = (:imageResult) ")
abstract suspend fun findByImageSHA1(
abstract fun findByImageSHA1(
imageSHA1: String,
imageResult: Boolean,
): Int
@ -66,7 +66,7 @@ abstract class UploadedStatusDao {
@Query(
"SELECT COUNT() FROM uploaded_table WHERE modifiedImageSHA1 = (:modifiedImageSHA1) AND modifiedImageResult = (:modifiedImageResult) ",
)
abstract suspend fun findByModifiedImageSHA1(
abstract fun findByModifiedImageSHA1(
modifiedImageSHA1: String,
modifiedImageResult: Boolean,
): Int

View file

@ -10,15 +10,13 @@ abstract class BaseDelegateAdapter<T>(
areContentsTheSame: (T, T) -> Boolean = { old, new -> old == new },
) : AsyncListDifferDelegationAdapter<T>(
object : DiffUtil.ItemCallback<T>() {
override fun areItemsTheSame(
oldItem: T,
newItem: T,
) = areItemsTheSame(oldItem, newItem)
override fun areItemsTheSame(oldItem: T & Any, newItem: T & Any): Boolean {
return areItemsTheSame(oldItem, newItem)
}
override fun areContentsTheSame(
oldItem: T,
newItem: T,
) = areContentsTheSame(oldItem, newItem)
override fun areContentsTheSame(oldItem: T & Any, newItem: T & Any): Boolean {
return areContentsTheSame(oldItem, newItem)
}
},
*delegates,
) {

View file

@ -22,16 +22,16 @@ abstract class DepictsDao {
private val maxItemsAllowed = 10
@Insert(onConflict = OnConflictStrategy.REPLACE)
abstract suspend fun insert(depictedItem: Depicts)
abstract fun insert(depictedItem: Depicts)
@Query("Select * From depicts_table order by lastUsed DESC")
abstract suspend fun getAllDepicts(): List<Depicts>
abstract fun getAllDepicts(): List<Depicts>
@Query("Select * From depicts_table order by lastUsed DESC LIMIT :n OFFSET 10")
abstract suspend fun getDepictsForDeletion(n: Int): List<Depicts>
abstract fun getDepictsForDeletion(n: Int): List<Depicts>
@Delete
abstract suspend fun delete(depicts: Depicts)
abstract fun delete(depicts: Depicts)
/**
* Gets all Depicts objects from the database, ordered by lastUsed in descending order.

View file

@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1536M
org.gradle.caching=true
android.enableR8.fullMode=false
KOTLIN_VERSION=1.7.20
KOTLIN_VERSION=1.9.22
LEAK_CANARY_VERSION=2.10
DAGGER_VERSION=2.23
ROOM_VERSION=2.5.0