From aad061bd5e2ef7b941ccd5f1b2d97ad0aeb46dc2 Mon Sep 17 00:00:00 2001 From: maxrave-dev Date: Tue, 31 Dec 2024 15:34:22 +0700 Subject: [PATCH] =?UTF-8?q?```=20=F0=9F=90=9B=20fix(MediaServiceModule):?= =?UTF-8?q?=20Increase=20stream=20chunk=20length?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✨ feat(changelog): Add changelog for version 25 🐛 fix(Settings): Fix bugs in the Settings screen ✨ feat(UI): Add swipe gesture for next/previous track ✨ feat(language): Add Korean language support 🐛 fix(redirect): Improve redirect logging ⬆️ chore(deps): Upgrade Kotlin and Ktor versions ``` --- .../simpmusic/di/MediaServiceModule.kt | 2 +- app/src/main/res/values-fr/strings.xml | 1 - .../metadata/android/en-US/changelogs/25.txt | 5 +++++ .../metadata/android/vi-VN/changelogs/25.txt | 5 +++++ gradle/libs.versions.toml | 8 ++++---- .../encoder/BrotliEncoder.kt | 19 +++++++++++++------ .../utils/CustomRedirectConfig.kt | 6 +++--- .../maxrave/spotify/encoder/BrotliEncoder.kt | 19 +++++++++++++------ 8 files changed, 44 insertions(+), 21 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/25.txt create mode 100644 fastlane/metadata/android/vi-VN/changelogs/25.txt diff --git a/app/src/main/java/com/maxrave/simpmusic/di/MediaServiceModule.kt b/app/src/main/java/com/maxrave/simpmusic/di/MediaServiceModule.kt index c3c6f94d..006bd328 100644 --- a/app/src/main/java/com/maxrave/simpmusic/di/MediaServiceModule.kt +++ b/app/src/main/java/com/maxrave/simpmusic/di/MediaServiceModule.kt @@ -177,7 +177,7 @@ private fun provideResolvingDataSourceFactory( mainRepository: MainRepository, coroutineScope: CoroutineScope, ): DataSource.Factory { - val CHUNK_LENGTH = 5 * 512 * 1024L + val CHUNK_LENGTH = 8 * 512 * 1024L return ResolvingDataSource.Factory(cacheDataSourceFactory) { dataSpec -> val mediaId = dataSpec.key ?: error("No media id") Log.w("Stream", mediaId) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 3a045e31..005a5ca4 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -154,7 +154,6 @@ Votre appareil ne dispose pas d\'égaliseur Ouvrir l\'égaliseur du système Utilisez votre égaliseur système - v0.2.5 Fournisseur de données de streaming (Piped) Itag Type MIME diff --git a/fastlane/metadata/android/en-US/changelogs/25.txt b/fastlane/metadata/android/en-US/changelogs/25.txt new file mode 100644 index 00000000..7fa92ebe --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/25.txt @@ -0,0 +1,5 @@ +- Fixed "Send back to Google" feature +- Added swipe to next or previous inside now playing screen +- Improve performance and stability +- Fixed some bugs inside Setting screen +- Added new language: Korean \ No newline at end of file diff --git a/fastlane/metadata/android/vi-VN/changelogs/25.txt b/fastlane/metadata/android/vi-VN/changelogs/25.txt new file mode 100644 index 00000000..ecffecc4 --- /dev/null +++ b/fastlane/metadata/android/vi-VN/changelogs/25.txt @@ -0,0 +1,5 @@ +- Sửa lỗi tính năng "Gửi lại dữ liệu cho Google" +- Thêm chức năng vuốt để chuyển bài tiếp theo hoặc trước đó trong màn hình đang phát +- Cải thiện hiệu suất và ổn định +- Sửa một số lỗi trong màn hình cài đặt +- Thêm ngôn ngữ mới: Hàn Quốc \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 55a1349d..1f21c27e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,8 +1,8 @@ [versions] android = "8.7.3" -kotlin = "2.0.10" -serialization = "2.0.10" -ksp = "2.0.10-1.0.24" +kotlin = "2.1.0" +serialization = "2.1.0" +ksp = "2.1.0-1.0.29" compose-bom = "2024.12.01" constraintlayout-compose = "1.1.0" activity-compose = "1.9.3" @@ -48,7 +48,7 @@ aboutlibraries = "10.10.0" flexbox = "3.0.0" balloon = "1.6.4" insetsx = "0.1.0-alpha10" -ktor = "2.3.12" +ktor = "3.0.3" brotli = "0.1.2" ksoup = "0.3.1" desugaring = "2.1.4" diff --git a/kotlinYtmusicScraper/src/main/java/com/maxrave/kotlinytmusicscraper/encoder/BrotliEncoder.kt b/kotlinYtmusicScraper/src/main/java/com/maxrave/kotlinytmusicscraper/encoder/BrotliEncoder.kt index a4b88cba..33ac1276 100644 --- a/kotlinYtmusicScraper/src/main/java/com/maxrave/kotlinytmusicscraper/encoder/BrotliEncoder.kt +++ b/kotlinYtmusicScraper/src/main/java/com/maxrave/kotlinytmusicscraper/encoder/BrotliEncoder.kt @@ -1,22 +1,29 @@ package com.maxrave.kotlinytmusicscraper.encoder -import io.ktor.client.plugins.compression.ContentEncoder -import io.ktor.client.plugins.compression.ContentEncoding +import io.ktor.client.plugins.compression.ContentEncodingConfig +import io.ktor.util.ContentEncoder import io.ktor.utils.io.ByteReadChannel +import io.ktor.utils.io.ByteWriteChannel import io.ktor.utils.io.jvm.javaio.toByteReadChannel import io.ktor.utils.io.jvm.javaio.toInputStream -import kotlinx.coroutines.CoroutineScope import org.brotli.dec.BrotliInputStream +import kotlin.coroutines.CoroutineContext object BrotliEncoder : ContentEncoder { override val name: String = "br" + override fun decode(source: ByteReadChannel, coroutineContext: CoroutineContext): ByteReadChannel { + return BrotliInputStream(source.toInputStream()).toByteReadChannel(coroutineContext) + } - override fun CoroutineScope.decode(source: ByteReadChannel): ByteReadChannel = BrotliInputStream(source.toInputStream()).toByteReadChannel() + override fun encode(source: ByteReadChannel, coroutineContext: CoroutineContext): ByteReadChannel { + throw UnsupportedOperationException("Encode not implemented by the library yet.") + } - override fun CoroutineScope.encode(source: ByteReadChannel): ByteReadChannel = + override fun encode(source: ByteWriteChannel, coroutineContext: CoroutineContext): ByteWriteChannel { throw UnsupportedOperationException("Encode not implemented by the library yet.") + } } -fun ContentEncoding.Config.brotli(quality: Float? = null) { +fun ContentEncodingConfig.brotli(quality: Float? = null) { customEncoder(BrotliEncoder, quality) } \ No newline at end of file diff --git a/kotlinYtmusicScraper/src/main/java/com/maxrave/kotlinytmusicscraper/utils/CustomRedirectConfig.kt b/kotlinYtmusicScraper/src/main/java/com/maxrave/kotlinytmusicscraper/utils/CustomRedirectConfig.kt index b841ed62..d3de9a63 100644 --- a/kotlinYtmusicScraper/src/main/java/com/maxrave/kotlinytmusicscraper/utils/CustomRedirectConfig.kt +++ b/kotlinYtmusicScraper/src/main/java/com/maxrave/kotlinytmusicscraper/utils/CustomRedirectConfig.kt @@ -20,9 +20,9 @@ import io.ktor.http.authority import io.ktor.http.isSecure import io.ktor.http.takeFrom import io.ktor.util.AttributeKey -import io.ktor.util.InternalAPI -import io.ktor.util.KtorDsl import io.ktor.util.logging.KtorSimpleLogger +import io.ktor.utils.io.InternalAPI +import io.ktor.utils.io.KtorDsl private val ALLOWED_FOR_REDIRECT: Set = setOf(HttpMethod.Get, HttpMethod.Head) @@ -106,7 +106,7 @@ class CustomRedirectConfig private constructor( client.monitor.raise(HttpResponseRedirect, call.response) var location = call.response.headers[HttpHeaders.Location] - LOGGER.trace("Received redirect response to $location for request ${context.url}") + LOGGER.trace("Received redirect response to {} for request {}", location, context.url) println("Location header: $location") requestBuilder = diff --git a/spotify/src/main/java/com/maxrave/spotify/encoder/BrotliEncoder.kt b/spotify/src/main/java/com/maxrave/spotify/encoder/BrotliEncoder.kt index 0487d120..7897cc63 100644 --- a/spotify/src/main/java/com/maxrave/spotify/encoder/BrotliEncoder.kt +++ b/spotify/src/main/java/com/maxrave/spotify/encoder/BrotliEncoder.kt @@ -1,22 +1,29 @@ package com.maxrave.spotify.encoder -import io.ktor.client.plugins.compression.ContentEncoder -import io.ktor.client.plugins.compression.ContentEncoding +import io.ktor.client.plugins.compression.ContentEncodingConfig +import io.ktor.util.ContentEncoder import io.ktor.utils.io.ByteReadChannel +import io.ktor.utils.io.ByteWriteChannel import io.ktor.utils.io.jvm.javaio.toByteReadChannel import io.ktor.utils.io.jvm.javaio.toInputStream -import kotlinx.coroutines.CoroutineScope import org.brotli.dec.BrotliInputStream +import kotlin.coroutines.CoroutineContext object BrotliEncoder : ContentEncoder { override val name: String = "br" + override fun decode(source: ByteReadChannel, coroutineContext: CoroutineContext): ByteReadChannel { + return BrotliInputStream(source.toInputStream()).toByteReadChannel(coroutineContext) + } - override fun CoroutineScope.decode(source: ByteReadChannel): ByteReadChannel = BrotliInputStream(source.toInputStream()).toByteReadChannel() + override fun encode(source: ByteReadChannel, coroutineContext: CoroutineContext): ByteReadChannel { + throw UnsupportedOperationException("Encode not implemented by the library yet.") + } - override fun CoroutineScope.encode(source: ByteReadChannel): ByteReadChannel = + override fun encode(source: ByteWriteChannel, coroutineContext: CoroutineContext): ByteWriteChannel { throw UnsupportedOperationException("Encode not implemented by the library yet.") + } } -fun ContentEncoding.Config.brotli(quality: Float? = null) { +fun ContentEncodingConfig.brotli(quality: Float? = null) { customEncoder(BrotliEncoder, quality) } \ No newline at end of file