build: Migrate major breaking changes from all dependencies (except Placeholder)

This commit is contained in:
Pun Butrach
2025-09-23 20:11:20 +07:00
parent c9fbc8eb46
commit 8e9a564e53
7 changed files with 46 additions and 23 deletions

View File

@@ -16,8 +16,12 @@ import io.ktor.http.isSuccess
import io.ktor.utils.io.ByteReadChannel
import io.ktor.utils.io.core.isNotEmpty
import io.ktor.utils.io.core.readBytes
import io.ktor.utils.io.core.remaining
import io.ktor.utils.io.exhausted
import io.ktor.utils.io.readRemaining
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import kotlinx.io.asSink
import kotlinx.serialization.json.Json
import java.io.File
import java.io.OutputStream
@@ -69,14 +73,14 @@ class HttpService(
) {
http.prepareGet(builder).execute { httpResponse ->
if (httpResponse.status.isSuccess()) {
val stream = outputStream.asSink()
val channel: ByteReadChannel = httpResponse.body()
withContext(Dispatchers.IO) {
while (!channel.isClosedForRead) {
val packet = channel.readRemaining(DEFAULT_BUFFER_SIZE.toLong())
while (packet.isNotEmpty) {
val bytes = packet.readBytes()
outputStream.write(bytes)
}
var count = 0L
stream.use {
while (!channel.exhausted()) {
val chunk = channel.readRemaining()
count += chunk.remaining
chunk.transferTo(stream)
}
}

View File

@@ -2,7 +2,9 @@ package app.revanced.manager.ui.component
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.text.TextLinkStyles
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextDecoration
import com.mikepenz.markdown.compose.Markdown
import com.mikepenz.markdown.m3.markdownColor
import com.mikepenz.markdown.m3.markdownTypography
@@ -18,15 +20,29 @@ fun Markdown(
colors = markdownColor(
text = MaterialTheme.colorScheme.onSurfaceVariant,
codeBackground = MaterialTheme.colorScheme.secondaryContainer,
codeText = MaterialTheme.colorScheme.onSecondaryContainer,
linkText = MaterialTheme.colorScheme.primary
),
typography = markdownTypography(
h1 = MaterialTheme.typography.headlineSmall.copy(fontWeight = FontWeight.Bold),
h2 = MaterialTheme.typography.titleLarge.copy(fontWeight = FontWeight.Bold),
h3 = MaterialTheme.typography.titleMedium.copy(fontWeight = FontWeight.Bold),
text = MaterialTheme.typography.bodyMedium,
list = MaterialTheme.typography.bodyMedium
code = markdownTypography().code.copy(color = MaterialTheme.colorScheme.onSecondaryContainer),
list = MaterialTheme.typography.bodyMedium,
textLink = TextLinkStyles(
style = MaterialTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold, textDecoration = TextDecoration.Underline,
color = MaterialTheme.colorScheme.primary
).toSpanStyle(),
hoveredStyle = MaterialTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold, textDecoration = TextDecoration.Underline,
color = MaterialTheme.colorScheme.secondary
).toSpanStyle(),
pressedStyle = MaterialTheme.typography.bodyMedium.copy(
fontWeight = FontWeight.Bold, textDecoration = TextDecoration.Underline,
color = MaterialTheme.colorScheme.tertiary
).toSpanStyle()
),
)
)
}

View File

@@ -87,7 +87,7 @@ class UpdateViewModel(
url(release.downloadUrl)
onDownload { bytesSentTotal, contentLength ->
downloadedSize = bytesSentTotal
totalSize = contentLength
totalSize = contentLength ?: 0
}
}
installUpdate()

View File

@@ -42,7 +42,6 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.launch
import kotlinx.datetime.Clock
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.TimeZone
import kotlinx.datetime.format.MonthNames
@@ -53,6 +52,7 @@ import java.util.Locale
import kotlin.properties.PropertyDelegateProvider
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
import kotlin.time.ExperimentalTime
typealias PatchSelection = Map<Int, Set<String>>
typealias Options = Map<Int, Map<String, Map<String, Any?>>>
@@ -141,9 +141,10 @@ suspend fun <T> Flow<Iterable<T>>.collectEach(block: suspend (T) -> Unit) {
}
}
@OptIn(ExperimentalTime::class)
fun LocalDateTime.relativeTime(context: Context): String {
try {
val now = Clock.System.now()
val now = kotlin.time.Clock.System.now()
val duration = now - this.toInstant(TimeZone.UTC)
return when {