Prep work for play store distribution (#301)

Allows for disabling in-app updates and more flexible tag/version codes
This commit is contained in:
damontecres 2025-11-22 12:57:47 -05:00 committed by GitHub
parent df78b42bac
commit 78e6304571
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 113 additions and 88 deletions

View file

@ -23,6 +23,7 @@ import androidx.compose.ui.input.key.KeyEventType
import androidx.compose.ui.input.key.key
import androidx.compose.ui.input.key.onKeyEvent
import androidx.compose.ui.input.key.type
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
import androidx.lifecycle.MutableLiveData
@ -42,6 +43,7 @@ import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.acra.util.versionCodeLong
import org.jellyfin.sdk.api.client.ApiClient
import org.jellyfin.sdk.api.client.extensions.clientLogApi
import org.jellyfin.sdk.model.ClientInfo
@ -151,6 +153,7 @@ fun DebugPage(
modifier: Modifier = Modifier,
viewModel: DebugViewModel = hiltViewModel(),
) {
val context = LocalContext.current
val scrollAmount = 100f
val columnState = rememberLazyListState()
val scope = rememberCoroutineScope()
@ -194,15 +197,28 @@ fun DebugPage(
modifier = Modifier.fillMaxWidth(),
) {
Text(
text = "AppPreferences",
text = "App Information",
style = MaterialTheme.typography.displaySmall,
color = MaterialTheme.colorScheme.onSurface,
)
Text(
text = preferences.appPreferences.toString(),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurface,
)
val pkgInfo = context.packageManager.getPackageInfo(context.packageName, 0)
val installSource = context.packageManager.getInstallSourceInfo(context.packageName)
listOf(
"Version Name: ${pkgInfo.versionName}",
"Version Code: ${pkgInfo.versionCodeLong}",
"Build type: ${BuildConfig.BUILD_TYPE}",
"Debug enabled: ${BuildConfig.DEBUG}",
"ABIs: ${Build.SUPPORTED_ABIS.toList()}",
"Install source: ${installSource.packageSource}",
"Installer: ${installSource.installingPackageName}",
"Initiator: ${installSource.initiatingPackageName}",
).forEach {
Text(
text = it,
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurface,
)
}
}
}
item {
@ -211,22 +227,12 @@ fun DebugPage(
modifier = Modifier.fillMaxWidth(),
) {
Text(
text = "App Information",
text = "AppPreferences",
style = MaterialTheme.typography.displaySmall,
color = MaterialTheme.colorScheme.onSurface,
)
Text(
text = "Build type: ${BuildConfig.BUILD_TYPE}",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurface,
)
Text(
text = "Debug enabled: ${BuildConfig.DEBUG}",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurface,
)
Text(
text = "ABIs: ${Build.SUPPORTED_ABIS.toList()}",
text = preferences.appPreferences.toString(),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurface,
)

View file

@ -48,6 +48,7 @@ import com.github.damontecres.wholphin.preferences.advancedPreferences
import com.github.damontecres.wholphin.preferences.basicPreferences
import com.github.damontecres.wholphin.preferences.uiPreferences
import com.github.damontecres.wholphin.preferences.updatePlaybackPreferences
import com.github.damontecres.wholphin.services.UpdateChecker
import com.github.damontecres.wholphin.ui.ifElse
import com.github.damontecres.wholphin.ui.nav.Destination
import com.github.damontecres.wholphin.ui.playOnClickSound
@ -86,7 +87,7 @@ fun PreferencesContent(
val release by updateVM.release.observeAsState(null)
LaunchedEffect(Unit) {
if (preferences.autoCheckForUpdates) {
if (UpdateChecker.ACTIVE && preferences.autoCheckForUpdates) {
updateVM.init(preferences.updateUrl)
}
}
@ -160,7 +161,8 @@ fun PreferencesContent(
.padding(vertical = 8.dp),
)
}
if (preferenceScreenOption == PreferenceScreenOption.BASIC &&
if (UpdateChecker.ACTIVE &&
preferenceScreenOption == PreferenceScreenOption.BASIC &&
preferences.autoCheckForUpdates &&
updateAvailable
) {