Skip to content

Commit

Permalink
Update dependency org.jlleitschuh.gradle:ktlint-gradle to v12
Browse files Browse the repository at this point in the history
  • Loading branch information
Renovate Bot authored and birdbird committed Dec 3, 2023
1 parent 2cf2cf3 commit 94979ae
Show file tree
Hide file tree
Showing 142 changed files with 930 additions and 960 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*.{kt,kts}]
ktlint_code_style = android_studio
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ data class Album(
override var genre: String? = null,
override var starred: Boolean = false,
override var path: String? = null,
override var closeness: Int = 0,
override var closeness: Int = 0
) : MusicDirectory.Child() {
override var isDirectory = true
override var isVideo = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ class MusicDirectory : ArrayList<MusicDirectory.Child>() {
var name: String? = null

@JvmOverloads
fun getChildren(
includeDirs: Boolean = true,
includeFiles: Boolean = true
): List<Child> {
fun getChildren(includeDirs: Boolean = true, includeFiles: Boolean = true): List<Child> {
if (includeDirs && includeFiles) {
return toList()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import org.moire.ultrasonic.api.subsonic.rules.MockWebServerRule
* Base class for integration tests for [SubsonicAPIClient] class.
*/
abstract class SubsonicAPIClientTest {
@JvmField @Rule val mockWebServerRule = MockWebServerRule()
@JvmField @Rule
val mockWebServerRule = MockWebServerRule()

protected lateinit var config: SubsonicClientConfiguration
protected lateinit var client: SubsonicAPIClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import org.moire.ultrasonic.api.subsonic.rules.MockWebServerRule
* Base class for testing [okhttp3.Interceptor] implementations.
*/
abstract class BaseInterceptorTest {
@Rule @JvmField val mockWebServerRule = MockWebServerRule()
@Rule @JvmField
val mockWebServerRule = MockWebServerRule()

lateinit var client: OkHttpClient

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ internal class ApiVersionCheckWrapper(
checkVersion(V1_4_0)
checkParamVersion(musicFolderId, V1_12_0)
return api.search2(
query, artistCount, artistOffset, albumCount, albumOffset, songCount, musicFolderId
query,
artistCount,
artistOffset,
albumCount,
albumOffset,
songCount,
musicFolderId
)
}

Expand All @@ -108,7 +114,13 @@ internal class ApiVersionCheckWrapper(
checkVersion(V1_8_0)
checkParamVersion(musicFolderId, V1_12_0)
return api.search3(
query, artistCount, artistOffset, albumCount, albumOffset, songCount, musicFolderId
query,
artistCount,
artistOffset,
albumCount,
albumOffset,
songCount,
musicFolderId
)
}

Expand Down Expand Up @@ -228,7 +240,13 @@ internal class ApiVersionCheckWrapper(
checkParamVersion(estimateContentLength, V1_8_0)
checkParamVersion(converted, V1_14_0)
return api.stream(
id, maxBitRate, format, timeOffset, videoSize, estimateContentLength, converted
id,
maxBitRate,
format,
timeOffset,
videoSize,
estimateContentLength,
converted
)
}

Expand Down Expand Up @@ -335,8 +353,9 @@ internal class ApiVersionCheckWrapper(
private fun checkVersion(expectedVersion: SubsonicAPIVersions) {
// If it is true, it is probably the first call with this server
if (!isRealProtocolVersion) return
if (currentApiVersion < expectedVersion)
if (currentApiVersion < expectedVersion) {
throw ApiNotSupportedException(currentApiVersion)
}
}

private fun checkParamVersion(param: Any?, expectedVersion: SubsonicAPIVersions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ interface SubsonicAPIDefinition {
): Call<SubsonicResponse>

@GET("setRating.view")
fun setRating(
@Query("id") id: String,
@Query("rating") rating: Int
): Call<SubsonicResponse>
fun setRating(@Query("id") id: String, @Query("rating") rating: Int): Call<SubsonicResponse>

@GET("getArtist.view")
fun getArtist(@Query("id") id: String): Call<GetArtistResponse>
Expand Down Expand Up @@ -158,8 +155,7 @@ interface SubsonicAPIDefinition {
@Query("public") public: Boolean? = null,
@Query("songIdToAdd") songIdsToAdd: List<String>? = null,
@Query("songIndexToRemove") songIndexesToRemove: List<Int>? = null
):
Call<SubsonicResponse>
): Call<SubsonicResponse>

@GET("getPodcasts.view")
fun getPodcasts(
Expand Down Expand Up @@ -227,10 +223,7 @@ interface SubsonicAPIDefinition {

@Streaming
@GET("getCoverArt.view")
fun getCoverArt(
@Query("id") id: String,
@Query("size") size: Long? = null
): Call<ResponseBody>
fun getCoverArt(@Query("id") id: String, @Query("size") size: Long? = null): Call<ResponseBody>

@Streaming
@GET("stream.view")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ enum class SubsonicAPIVersions(val subsonicVersions: String, val restApiVersion:
V1_13_0("5.3", "1.13.0"),
V1_14_0("6.0", "1.14.0"),
V1_15_0("6.1", "1.15.0"),
V1_16_0("6.1.2", "1.16.0");
V1_16_0("6.1.2", "1.16.0")
;

companion object {
@JvmStatic @Throws(IllegalArgumentException::class)
@JvmStatic
@Throws(IllegalArgumentException::class)
fun getClosestKnownClientApiVersion(apiVersion: String): SubsonicAPIVersions {
val versionComponents = apiVersion.split(".")

Expand All @@ -41,8 +43,11 @@ enum class SubsonicAPIVersions(val subsonicVersions: String, val restApiVersion:
try {
val majorVersion = versionComponents[0].toInt()
val minorVersion = versionComponents[1].toInt()
val patchVersion = if (versionComponents.size > 2) versionComponents[2].toInt()
else 0
val patchVersion = if (versionComponents.size > 2) {
versionComponents[2].toInt()
} else {
0
}

when (majorVersion) {
1 -> when {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ class VersionAwareJacksonConverterFactory(
retrofit: Retrofit
): Converter<*, RequestBody>? {
return jacksonConverterFactory?.requestBodyConverter(
type, parameterAnnotations, methodAnnotations, retrofit
type,
parameterAnnotations,
methodAnnotations,
retrofit
)
}

Expand All @@ -63,7 +66,7 @@ class VersionAwareJacksonConverterFactory(
}
}

class VersionAwareResponseBodyConverter<T> (
class VersionAwareResponseBodyConverter<T>(
private val notifier: (SubsonicAPIVersions) -> Unit = {},
private val adapter: ObjectReader
) : Converter<ResponseBody, T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import okhttp3.Interceptor.Chain
import okhttp3.Response

internal const val SOCKET_READ_TIMEOUT_DOWNLOAD = 30 * 1000

// Allow 20 seconds extra timeout pear MB offset.
internal const val TIMEOUT_MILLIS_PER_OFFSET_BYTE = 0.02

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ enum class AlbumListType(val typeName: String) {
SORTED_BY_ARTIST("alphabeticalByArtist"),
STARRED("starred"),
BY_YEAR("byYear"),
BY_GENRE("byGenre");
BY_GENRE("byGenre")
;

override fun toString(): String {
return typeName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ enum class JukeboxAction(val action: String) {
CLEAR("clear"),
REMOVE("remove"),
SHUFFLE("shuffle"),
SET_GAIN("setGain");
SET_GAIN("setGain")
;

override fun toString(): String {
return action
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class BookmarksResponse(
version: SubsonicAPIVersions,
error: SubsonicError?
) : SubsonicResponse(status, version, error) {
@JsonProperty("bookmarks") private val bookmarksWrapper = BookmarkWrapper()
@JsonProperty("bookmarks")
private val bookmarksWrapper = BookmarkWrapper()

val bookmarkList: List<Bookmark> get() = bookmarksWrapper.bookmarkList
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class ChatMessagesResponse(
version: SubsonicAPIVersions,
error: SubsonicError?
) : SubsonicResponse(status, version, error) {
@JsonProperty("chatMessages") private val wrapper = ChatMessagesWrapper()
@JsonProperty("chatMessages")
private val wrapper = ChatMessagesWrapper()

val chatMessages: List<ChatMessage> get() = wrapper.messagesList
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class GenresResponse(
version: SubsonicAPIVersions,
error: SubsonicError?
) : SubsonicResponse(status, version, error) {
@JsonProperty("genres") private val genresWrapper = GenresWrapper()
@JsonProperty("genres")
private val genresWrapper = GenresWrapper()
val genresList: List<Genre> get() = genresWrapper.genresList
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class GetAlbumList2Response(
version: SubsonicAPIVersions,
error: SubsonicError?
) : SubsonicResponse(status, version, error) {
@JsonProperty("albumList2") private val albumWrapper2 = AlbumWrapper2()
@JsonProperty("albumList2")
private val albumWrapper2 = AlbumWrapper2()

val albumList: List<Album>
get() = albumWrapper2.albumList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class GetAlbumListResponse(
version: SubsonicAPIVersions,
error: SubsonicError?
) : SubsonicResponse(status, version, error) {
@JsonProperty("albumList") private val albumWrapper = AlbumWrapper()
@JsonProperty("albumList")
private val albumWrapper = AlbumWrapper()

val albumList: List<Album>
get() = albumWrapper.albumList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class GetPodcastsResponse(
version: SubsonicAPIVersions,
error: SubsonicError?
) : SubsonicResponse(status, version, error) {
@JsonProperty("podcasts") private val channelsWrapper = PodcastChannelWrapper()
@JsonProperty("podcasts")
private val channelsWrapper = PodcastChannelWrapper()

val podcastChannels: List<PodcastChannel>
get() = channelsWrapper.channelsList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class GetRandomSongsResponse(
version: SubsonicAPIVersions,
error: SubsonicError?
) : SubsonicResponse(status, version, error) {
@JsonProperty("randomSongs") private val songsWrapper = RandomSongsWrapper()
@JsonProperty("randomSongs")
private val songsWrapper = RandomSongsWrapper()

val songsList
get() = songsWrapper.songsList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class GetSongsByGenreResponse(
version: SubsonicAPIVersions,
error: SubsonicError?
) : SubsonicResponse(status, version, error) {
@JsonProperty("songsByGenre") private val songsByGenreList = SongsByGenreWrapper()
@JsonProperty("songsByGenre")
private val songsByGenreList = SongsByGenreWrapper()

val songsList get() = songsByGenreList.songsList
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ class JukeboxResponse(
error: SubsonicError?,
var jukebox: JukeboxStatus = JukeboxStatus()
) : SubsonicResponse(status, version, error) {
@JsonSetter("jukeboxStatus") fun setJukeboxStatus(jukebox: JukeboxStatus) {
@JsonSetter("jukeboxStatus")
fun setJukeboxStatus(jukebox: JukeboxStatus) {
this.jukebox = jukebox
}

@JsonSetter("jukeboxPlaylist") fun setJukeboxPlaylist(jukebox: JukeboxStatus) {
@JsonSetter("jukeboxPlaylist")
fun setJukeboxPlaylist(jukebox: JukeboxStatus) {
this.jukebox = jukebox
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class MusicFoldersResponse(
version: SubsonicAPIVersions,
error: SubsonicError?
) : SubsonicResponse(status, version, error) {
@JsonProperty("musicFolders") private val wrapper = MusicFoldersWrapper()
@JsonProperty("musicFolders")
private val wrapper = MusicFoldersWrapper()

val musicFolders get() = wrapper.musicFolders
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class SharesResponse(
version: SubsonicAPIVersions,
error: SubsonicError?
) : SubsonicResponse(status, version, error) {
@JsonProperty("shares") private val wrappedShares = SharesWrapper()
@JsonProperty("shares")
private val wrappedShares = SharesWrapper()

val shares get() = wrappedShares.share
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ open class SubsonicResponse(
) {
@JsonDeserialize(using = Status.Companion.StatusJsonDeserializer::class)
enum class Status(val jsonValue: String) {
OK("ok"), ERROR("failed");
OK("ok"),
ERROR("failed");

companion object {
fun getStatusFromJson(jsonValue: String) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class VideosResponse(
version: SubsonicAPIVersions,
error: SubsonicError?
) : SubsonicResponse(status, version, error) {
@JsonProperty("videos") private val videosWrapper = VideosWrapper()
@JsonProperty("videos")
private val videosWrapper = VideosWrapper()

val videosList: List<MusicDirectoryChild> get() = videosWrapper.videosList
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ class ProxyPasswordInterceptorTest {

private val proxyInterceptor = ProxyPasswordInterceptor(
V1_12_0,
mockPasswordHexInterceptor, mockPasswordMd5Interceptor, false
mockPasswordHexInterceptor,
mockPasswordMd5Interceptor,
false
)

@Test
Expand All @@ -40,8 +42,10 @@ class ProxyPasswordInterceptorTest {
@Test
fun `Should use hex password if forceHex is true`() {
val interceptor = ProxyPasswordInterceptor(
V1_16_0, mockPasswordHexInterceptor,
mockPasswordMd5Interceptor, true
V1_16_0,
mockPasswordHexInterceptor,
mockPasswordMd5Interceptor,
true
)

interceptor.intercept(mockChain)
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ navigation = "2.7.5"
gradlePlugin = "8.2.0"
androidxcar = "1.2.0"
androidxcore = "1.12.0"
ktlint = "0.43.2"
ktlintGradle = "11.6.1"
ktlint = "1.0.1"
ktlintGradle = "12.0.2"
detekt = "1.23.4"
preferences = "1.2.1"
media3 = "1.1.1"
Expand Down
Loading

0 comments on commit 94979ae

Please sign in to comment.