Skip to content

Commit

Permalink
Update dependencies and fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed Jan 29, 2024
1 parent 57f0250 commit 5d4abd2
Show file tree
Hide file tree
Showing 23 changed files with 38 additions and 153 deletions.
3 changes: 0 additions & 3 deletions buildSrc/src/main/java/AppConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ object AppConfig {
const val compileSdk = 34
val javaVersion = JavaVersion.VERSION_17

// https://developer.android.com/jetpack/androidx/releases/compose-kotlin
const val composeCompiler = "1.5.8"

@Suppress("SimpleDateFormat")
fun getBuildDate(): String {
val sdf = java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
Expand Down
35 changes: 10 additions & 25 deletions buildSrc/src/main/java/VersionConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,57 +10,42 @@
*/
object VersionConfig {
/**
* Environement variable automatically set by Github actions.
* @see [github](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables)
* Environment variable automatically set by GitHub actions.
* @see [GitHub](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables)
*/
val isCI: Boolean = System.getenv("CI")?.toBooleanStrictOrNull() ?: false

/**
* Environement variable set by workflow.
* Environment variable set by workflow.
*/
private val ENV_VERSION_NAME: String? = System.getenv("VERSION_NAME")
private val versionRegex = "[0-9]+.[0-9].[0-9]-?\\S*".toRegex()
private val versionOnlyRegex = "[0-9]+.[0-9].[0-9]".toRegex()
private val versionSuffixRegex = "-\\S*".toRegex()

/**
* Maven artifact group
*/
const val GROUP = "ch.srgssr.pillarbox"

/**
* Semantic version
* @return Major.Minor.Patch string from [ENV_VERSION_NAME] or null if not set.
*/
fun semanticVersion(): String? {
return ENV_VERSION_NAME?.let { versionOnlyRegex.find(it)?.value }
}

/**
* Version name
*
* @return Local if [ENV_VERSION_NAME] no set.
* @return "Local" if [ENV_VERSION_NAME] no set.
*/
fun versionName(): String {
return ENV_VERSION_NAME ?: "Local"
}

/**
* @return -suffix from MARJOR.MINOR.PATCH-Suffix
*/
fun versionNameSuffix(): String? {
return ENV_VERSION_NAME?.let { versionSuffixRegex.find(it)?.value }
}

/**
* Version code
* It assumes that major.minor.patch each <= 99
* 0.0.0, 0.0.99, 0.1.0, 0.99.99
*/
fun versionCode(): Int {
return semanticVersion()?.let {
val versions = it.split(".").map { value -> value.toInt() }
versions[0] * 10000 + versions[1] * 100 + versions[2]
} ?: 9999
return ENV_VERSION_NAME
?.let { versionOnlyRegex.find(it)?.value }
?.let {
val versions = it.split(".").map { value -> value.toInt() }
versions[0] * 10000 + versions[1] * 100 + versions[2]
} ?: 9999
}
}
8 changes: 5 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
[versions]
accompanist = "0.32.0"
android-gradle-plugin = "8.2.1"
accompanist = "0.34.0"
android-gradle-plugin = "8.2.2"
androidx-activity = "1.8.2"
androidx-annotation = "1.7.1"
androidx-compose = "2023.10.01"
androidx-compose = "2024.01.00"
# https://developer.android.com/jetpack/androidx/releases/compose-kotlin
androidx-compose-compiler = "1.5.8"
androidx-core = "1.12.0"
androidx-fragment = "1.6.2"
androidx-leanback = "1.0.0"
Expand Down
1 change: 1 addition & 0 deletions pillarbox-analytics/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ android {
}
buildFeatures {
buildConfig = true
resValues = false
}
publishing {
singleVariant("release") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ class SRGAnalyticsTest {
SRGAnalytics.init(appContext as Application, config)
SRGAnalytics.init(appContext, config.copy(vendor = AnalyticsConfig.Vendor.RSI))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,5 @@ class TestComScoreSrg {
override fun onPageViewSend(labels: Map<String, String>) {
Assert.assertTrue(pageViewFlow.tryEmit(labels))
}

}
}
1 change: 1 addition & 0 deletions pillarbox-core-business/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ android {
}
buildFeatures {
buildConfig = true
resValues = false
}
publishing {
singleVariant("release") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import kotlin.time.Duration.Companion.seconds
class CommandersActTrackerTest {
private lateinit var commandersActDelegate: CommandersActDelegate


@Before
fun setup() {
CommandersActStreaming.HEART_BEAT_DELAY = HEART_BEAT_DELAY
Expand Down Expand Up @@ -259,7 +258,6 @@ class CommandersActTrackerTest {
val eventNames = ArrayList<String>()
val events = ArrayList<Event>()


override fun sendTcMediaEvent(event: TCMediaEvent) {
if (event.isPeriodicEvent() && ignorePeriodicEvents) return
eventNames.add(event.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@ class LocalMediaCompositionDataSource(context: Context) : MediaCompositionDataSo
*/
const val VodShort = "urn:rts:video:13444428"
}

}
3 changes: 3 additions & 0 deletions pillarbox-demo-shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ android {
kotlinOptions {
jvmTarget = AppConfig.javaVersion.majorVersion
}
buildFeatures {
resValues = false
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ package ch.srgssr.pillarbox.demo.shared.ui

import androidx.annotation.StringRes
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ViewList
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.Movie
import androidx.compose.material.icons.filled.Search
import androidx.compose.material.icons.filled.ViewList
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.navigation.NavController
import androidx.navigation.NavGraph.Companion.findStartDestination
Expand Down Expand Up @@ -40,7 +40,7 @@ sealed class HomeDestination(
/**
* Integration layer list home page
*/
data object Lists : HomeDestination(NavigationRoutes.homeLists, R.string.lists, Icons.Default.ViewList)
data object Lists : HomeDestination(NavigationRoutes.homeLists, R.string.lists, Icons.AutoMirrored.Filled.ViewList)

/**
* Info home page
Expand Down
3 changes: 2 additions & 1 deletion pillarbox-demo-tv/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ android {
}
buildFeatures {
compose = true
resValues = false
}
lint {
// https://developer.android.com/reference/tools/gradle-api/8.1/com/android/build/api/dsl/Lint
Expand All @@ -58,7 +59,7 @@ android {
sarifOutput = file("${rootProject.rootDir}/build/reports/android-lint/pillarbox-demo-tv.sarif")
}
composeOptions {
kotlinCompilerExtensionVersion = AppConfig.composeCompiler
kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get()
}
}

Expand Down
3 changes: 2 additions & 1 deletion pillarbox-demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ android {
buildFeatures {
buildConfig = true
compose = true
resValues = false
}

composeOptions {
kotlinCompilerExtensionVersion = AppConfig.composeCompiler
kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get()
}
lint {
// https://developer.android.com/reference/tools/gradle-api/8.1/com/android/build/api/dsl/Lint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package ch.srgssr.pillarbox.demo

import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material3.DropdownMenu
Expand Down Expand Up @@ -97,7 +97,7 @@ fun MainNavigation() {
if (!topLevelRoutes.contains(it)) {
IconButton(onClick = { navController.navigateUp() }) {
Icon(
imageVector = Icons.Default.ArrowBack,
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = stringResource(R.string.navigate_up)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import ch.srgssr.pillarbox.demo.shared.data.DemoItem
import ch.srgssr.pillarbox.demo.shared.di.PlayerModule
import ch.srgssr.pillarbox.player.extension.toRational
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import java.net.URL

/**
Expand All @@ -33,15 +32,6 @@ class SimplePlayerViewModel(application: Application, ilHost: URL) : AndroidView
*/
val player = PlayerModule.provideDefaultPlayer(application, ilHost)

private val _pauseOnBackground = MutableStateFlow(true)
private val _displayNotification = MutableStateFlow(false)

/**
* Pause on background state
* True means playback is paused when Activity goes in background
*/
val pauseOnBackground: StateFlow<Boolean> = _pauseOnBackground

/**
* Picture in picture enabled
*/
Expand Down Expand Up @@ -84,29 +74,6 @@ class SimplePlayerViewModel(application: Application, ilHost: URL) : AndroidView
player.play()
}

/**
* Enable pause on background
*
* @param enabled
*/
fun enablePauseOnBackground(enabled: Boolean) {
_pauseOnBackground.value = enabled
}

/**
* Toggle pause on background
*/
fun togglePauseOnBackground() {
_pauseOnBackground.value = !_pauseOnBackground.value
}

/**
* Toggle display notification
*/
fun toggleDisplayNotification() {
_displayNotification.value = !_displayNotification.value
}

override fun onCleared() {
super.onCleared()
Log.d(TAG, "onCleared => releasing the player")
Expand Down

This file was deleted.

3 changes: 3 additions & 0 deletions pillarbox-player-testutils/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ android {
kotlinOptions {
jvmTarget = AppConfig.javaVersion.majorVersion
}
buildFeatures {
resValues = false
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ open class AnalyticsListenerCommander(exoplayer: ExoPlayer) :
listeners.remove(listener)
}

private fun notifyAll(run: (Player: AnalyticsListener) -> Unit) {
private fun notifyAll(run: (player: AnalyticsListener) -> Unit) {
val list = listeners.toList()
for (listener in list) {
run(listener)
Expand Down
1 change: 1 addition & 0 deletions pillarbox-player/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ android {
}
buildFeatures {
buildConfig = true
resValues = false
}
publishing {
singleVariant("release") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import kotlin.time.Duration.Companion.hours
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds


class TestIsPlaybackSpeedPossibleAtPosition {

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class PillarboxMediaSource(
* @return
*/
override fun canUpdateMediaItem(mediaItem: MediaItem): Boolean {
if (mediaItem.mediaId != this.mediaItem.mediaId || mediaItem.localConfiguration != this.mediaItem.localConfiguration) return false
return true
return mediaItem.mediaId == this.mediaItem.mediaId &&
mediaItem.localConfiguration == this.mediaItem.localConfiguration
}

override fun updateMediaItem(mediaItem: MediaItem) {
Expand Down
Loading

0 comments on commit 5d4abd2

Please sign in to comment.