Fix shared mobile regression checks

This commit is contained in:
tapframe 2026-06-11 01:17:33 +05:30
parent b420dcaf71
commit b5389915a4
3 changed files with 34 additions and 9 deletions

View file

@ -777,6 +777,10 @@ afterEvaluate {
}
}
configurations.matching { it.name == "iosMainImplementation" }.configureEach {
project.dependencies.add(name, libs.ktor.client.darwin)
}
dependencies {
coreLibraryDesugaring(libs.desugar.jdk.libs)
debugImplementation(libs.compose.uiTooling)

View file

@ -16,11 +16,6 @@ import com.nuvio.app.features.trakt.effectiveLibrarySourceMode as resolveEffecti
import com.nuvio.app.features.trakt.shouldUseTraktLibrary
import io.github.jan.supabase.postgrest.postgrest
import io.github.jan.supabase.postgrest.rpc
import kotlinx.coroutines.runBlocking
import nuvio.composeapp.generated.resources.Res
import nuvio.composeapp.generated.resources.library_local_tab_title
import nuvio.composeapp.generated.resources.library_other
import org.jetbrains.compose.resources.getString
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
@ -33,6 +28,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.decodeFromString
@ -41,6 +37,11 @@ import kotlinx.serialization.json.Json
import kotlinx.serialization.json.buildJsonObject
import kotlinx.serialization.json.encodeToJsonElement
import kotlinx.serialization.json.put
import nuvio.composeapp.generated.resources.Res
import nuvio.composeapp.generated.resources.library_local_tab_title
import nuvio.composeapp.generated.resources.library_other
import org.jetbrains.compose.resources.StringResource
import org.jetbrains.compose.resources.getString
@Serializable
private data class StoredLibraryPayload(
@ -476,11 +477,16 @@ object LibraryRepository {
}
internal const val LOCAL_LIBRARY_LIST_KEY = "local"
private const val DEFAULT_LOCAL_LIBRARY_TAB_TITLE = "Nuvio Library"
private const val DEFAULT_LIBRARY_OTHER_TITLE = "Other"
internal fun localLibraryListTab(): TraktListTab =
TraktListTab(
key = LOCAL_LIBRARY_LIST_KEY,
title = runBlocking { getString(Res.string.library_local_tab_title) },
title = localizedStringOrDefault(
resource = Res.string.library_local_tab_title,
fallback = DEFAULT_LOCAL_LIBRARY_TAB_TITLE,
),
type = TraktListType.WATCHLIST,
)
@ -552,7 +558,7 @@ private fun PosterShape.toSyncName(): String =
internal fun String.toLibraryDisplayTitle(): String {
val normalized = trim()
if (normalized.isBlank()) return runBlocking { getString(Res.string.library_other) }
if (normalized.isBlank()) return localizedLibraryOtherTitle()
return normalized
.split('-', '_', ' ')
@ -560,5 +566,15 @@ internal fun String.toLibraryDisplayTitle(): String {
.joinToString(" ") { token ->
token.lowercase().replaceFirstChar { char -> char.uppercase() }
}
.ifBlank { runBlocking { getString(Res.string.library_other) } }
.ifBlank { localizedLibraryOtherTitle() }
}
private fun localizedLibraryOtherTitle(): String =
localizedStringOrDefault(
resource = Res.string.library_other,
fallback = DEFAULT_LIBRARY_OTHER_TITLE,
)
private fun localizedStringOrDefault(resource: StringResource, fallback: String): String =
runCatching { runBlocking { getString(resource) } }
.getOrDefault(fallback)

View file

@ -198,7 +198,12 @@ object StreamAutoPlaySelector {
activeResolverProviderId: String?,
): Boolean =
playableDirectUrl != null ||
(AppFeaturePolicy.p2pEnabled && needsLocalDebridResolve && p2pInfoHash != null) ||
(
AppFeaturePolicy.p2pEnabled &&
needsLocalDebridResolve &&
p2pInfoHash != null &&
!isPendingDebridAutoPlay(debridEnabled, activeResolverProviderId)
) ||
(debridEnabled && isAddonDebridCandidate && isReadyDebridAutoPlay(activeResolverProviderId))
private fun StreamItem.isReadyDebridAutoPlay(activeResolverProviderId: String?): Boolean =