mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-08-18 13:26:09 +00:00
feat: support app versioning
This commit is contained in:
parent
c77db9afd3
commit
9a79a5a7e3
10 changed files with 90 additions and 7 deletions
|
|
@ -30,6 +30,12 @@ abstract class GenerateRuntimeConfigsTask : DefaultTask() {
|
|||
@get:Input
|
||||
abstract val appVersionCode: Property<Int>
|
||||
|
||||
@get:Input
|
||||
abstract val desktopAppVersionName: Property<String>
|
||||
|
||||
@get:Input
|
||||
abstract val desktopAppVersionCode: Property<Int>
|
||||
|
||||
@TaskAction
|
||||
fun generate() {
|
||||
val props = Properties()
|
||||
|
|
@ -116,6 +122,8 @@ abstract class GenerateRuntimeConfigsTask : DefaultTask() {
|
|||
|object AppVersionConfig {
|
||||
| const val VERSION_NAME = "${appVersionName.get()}"
|
||||
| const val VERSION_CODE = ${appVersionCode.get()}
|
||||
| const val DESKTOP_VERSION_NAME = "${desktopAppVersionName.get()}"
|
||||
| const val DESKTOP_VERSION_CODE = ${desktopAppVersionCode.get()}
|
||||
|}
|
||||
""".trimMargin()
|
||||
)
|
||||
|
|
@ -192,6 +200,23 @@ val releaseAppVersionName = readXcconfigValue(appVersionConfigFile, "MARKETING_V
|
|||
val releaseAppVersionCode = readXcconfigValue(appVersionConfigFile, "CURRENT_PROJECT_VERSION")
|
||||
?.toIntOrNull()
|
||||
?: error("CURRENT_PROJECT_VERSION is missing or invalid in ${appVersionConfigFile.path}")
|
||||
val desktopReleaseVersionName = (
|
||||
providers.gradleProperty("nuvio.desktop.versionName").orNull
|
||||
?: System.getenv("NUVIO_DESKTOP_VERSION_NAME")
|
||||
?: supabaseProps.getProperty("NUVIO_DESKTOP_VERSION_NAME")
|
||||
?: "0.1.0"
|
||||
).trim()
|
||||
require(desktopReleaseVersionName.isNotBlank()) {
|
||||
"Desktop version name must not be blank."
|
||||
}
|
||||
val desktopReleaseVersionCode = (
|
||||
providers.gradleProperty("nuvio.desktop.versionCode").orNull
|
||||
?: System.getenv("NUVIO_DESKTOP_VERSION_CODE")
|
||||
?: supabaseProps.getProperty("NUVIO_DESKTOP_VERSION_CODE")
|
||||
)?.trim()
|
||||
?.takeIf { it.isNotBlank() }
|
||||
?.toIntOrNull()
|
||||
?: 1
|
||||
val iosDistribution = (
|
||||
providers.gradleProperty("nuvio.ios.distribution").orNull
|
||||
?: System.getenv("NUVIO_IOS_DISTRIBUTION")
|
||||
|
|
@ -226,6 +251,8 @@ val generateRuntimeConfigs = tasks.register<GenerateRuntimeConfigsTask>("generat
|
|||
localPropertiesFile.set(rootProject.layout.projectDirectory.file("local.properties"))
|
||||
appVersionName.set(releaseAppVersionName)
|
||||
appVersionCode.set(releaseAppVersionCode)
|
||||
desktopAppVersionName.set(desktopReleaseVersionName)
|
||||
desktopAppVersionCode.set(desktopReleaseVersionCode)
|
||||
}
|
||||
|
||||
val isMacHost = System.getProperty("os.name").contains("mac", ignoreCase = true)
|
||||
|
|
@ -708,7 +735,7 @@ compose.desktop {
|
|||
nativeDistributions {
|
||||
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
|
||||
packageName = "Nuvio"
|
||||
packageVersion = releaseAppVersionName
|
||||
packageVersion = desktopReleaseVersionName
|
||||
macOS {
|
||||
iconFile.set(project.file("src/desktopMain/resources/icons/nuvio-app-icon.icns"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
package com.nuvio.app.core.build
|
||||
|
||||
actual object AppVersionPolicy {
|
||||
actual val displayVersionName: String = AppVersionConfig.VERSION_NAME
|
||||
actual val displayVersionCode: Int = AppVersionConfig.VERSION_CODE
|
||||
actual val basedOnVersionName: String? = null
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.nuvio.app.core.build
|
||||
|
||||
actual object AppVersionPolicy {
|
||||
actual val displayVersionName: String = AppVersionConfig.VERSION_NAME
|
||||
actual val displayVersionCode: Int = AppVersionConfig.VERSION_CODE
|
||||
actual val basedOnVersionName: String? = null
|
||||
}
|
||||
|
|
@ -300,6 +300,7 @@
|
|||
<string name="collections_pinned">Pinned</string>
|
||||
<string name="collections_tab_all">All</string>
|
||||
<string name="collections_your_collections">Your Collections</string>
|
||||
<string name="compose_about_based_on_version_format">Based on Nuvio %1$s</string>
|
||||
<string name="compose_about_made_with">Made with ❤️ by Tapframe and friends</string>
|
||||
<string name="compose_about_version_format">Version %1$s (%2$s)</string>
|
||||
<string name="compose_action_off">Off</string>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
package com.nuvio.app.core.build
|
||||
|
||||
expect object AppVersionPolicy {
|
||||
val displayVersionName: String
|
||||
val displayVersionCode: Int
|
||||
val basedOnVersionName: String?
|
||||
}
|
||||
|
|
@ -21,8 +21,9 @@ import androidx.compose.material3.Text
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.nuvio.app.core.build.AppVersionConfig
|
||||
import com.nuvio.app.core.build.AppVersionPolicy
|
||||
import nuvio.composeapp.generated.resources.Res
|
||||
import nuvio.composeapp.generated.resources.compose_about_based_on_version_format
|
||||
import nuvio.composeapp.generated.resources.compose_about_made_with
|
||||
import nuvio.composeapp.generated.resources.compose_about_version_format
|
||||
import nuvio.composeapp.generated.resources.compose_settings_page_account
|
||||
|
|
@ -258,14 +259,26 @@ internal fun LazyListScope.settingsRootContent(
|
|||
Text(
|
||||
text = stringResource(
|
||||
Res.string.compose_about_version_format,
|
||||
AppVersionConfig.VERSION_NAME,
|
||||
AppVersionConfig.VERSION_CODE,
|
||||
AppVersionPolicy.displayVersionName,
|
||||
AppVersionPolicy.displayVersionCode,
|
||||
),
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
AppVersionPolicy.basedOnVersionName?.let { basedOnVersionName ->
|
||||
Text(
|
||||
text = stringResource(
|
||||
Res.string.compose_about_based_on_version_format,
|
||||
basedOnVersionName,
|
||||
),
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.nuvio.app.features.trakt
|
||||
|
||||
import co.touchlab.kermit.Logger
|
||||
import com.nuvio.app.core.build.AppVersionConfig
|
||||
import com.nuvio.app.core.build.AppVersionPolicy
|
||||
import com.nuvio.app.features.addons.httpRequestRaw
|
||||
import com.nuvio.app.features.profiles.ProfileRepository
|
||||
import kotlinx.coroutines.CancellationException
|
||||
|
|
@ -243,7 +243,7 @@ internal object TraktScrobbleRepository {
|
|||
ids = item.ids.toRequestBodyOrNull(),
|
||||
),
|
||||
progress = clampedProgress,
|
||||
appVersion = AppVersionConfig.VERSION_NAME,
|
||||
appVersion = AppVersionPolicy.displayVersionName,
|
||||
)
|
||||
|
||||
is TraktScrobbleItem.Episode -> TraktScrobbleRequest(
|
||||
|
|
@ -258,7 +258,7 @@ internal object TraktScrobbleRepository {
|
|||
number = item.number,
|
||||
),
|
||||
progress = clampedProgress,
|
||||
appVersion = AppVersionConfig.VERSION_NAME,
|
||||
appVersion = AppVersionPolicy.displayVersionName,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
package com.nuvio.app.core.build
|
||||
|
||||
actual object AppVersionPolicy {
|
||||
actual val displayVersionName: String = AppVersionConfig.DESKTOP_VERSION_NAME
|
||||
actual val displayVersionCode: Int = AppVersionConfig.DESKTOP_VERSION_CODE
|
||||
actual val basedOnVersionName: String? = AppVersionConfig.VERSION_NAME.takeIf { it != displayVersionName }
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.nuvio.app.core.build
|
||||
|
||||
actual object AppVersionPolicy {
|
||||
actual val displayVersionName: String = AppVersionConfig.VERSION_NAME
|
||||
actual val displayVersionCode: Int = AppVersionConfig.VERSION_CODE
|
||||
actual val basedOnVersionName: String? = null
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.nuvio.app.core.build
|
||||
|
||||
actual object AppVersionPolicy {
|
||||
actual val displayVersionName: String = AppVersionConfig.VERSION_NAME
|
||||
actual val displayVersionCode: Int = AppVersionConfig.VERSION_CODE
|
||||
actual val basedOnVersionName: String? = null
|
||||
}
|
||||
Loading…
Reference in a new issue