Skip to content

Commit

Permalink
Update dependencies (#47)
Browse files Browse the repository at this point in the history
This PR updates all the dependencies in the project:
- Android Gradle Plugin 8.6.0.
- AndroidX Activity 1.9.1 (was added to replace AndroidX Appcompat).
- AndroidX Annotation 1.8.2.
- AndroidX Appcomat was removed (only used in the demo app).
- AndroidX ConstraintLayout was removed (only used in the demo app).
- AndroidX Lifecycle 2.8.4.
- AndroidX Paging 3.3.2.
- AndroidX Test Ext jUnit 1.2.1.
- Compile SDK 34.
- Detekt 1.23.6.
- JVM target 17.
- Kotlin 2.0.20.
- KotlinX Serialization 1.7.2.
- Material was removed (only used in the demo app).
- OkHttp 4.12.0.
- Retrofit 2.11.0.
- Robolectric 4.13.
- Target SDK 34.
  • Loading branch information
MGaetan89 authored Aug 30, 2024
1 parent bf8419c commit ccc76cb
Show file tree
Hide file tree
Showing 18 changed files with 84 additions and 132 deletions.
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Config.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
object Config {
const val compileSdk = 33
const val targetSdk = 33
const val compileSdk = 34
const val targetSdk = 34
const val minSdk = 21

const val major = 0
Expand Down
12 changes: 3 additions & 9 deletions config/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ naming:
BooleanPropertyNaming:
active: false
allowedPattern: '^(is|has|are)'
ignoreOverridden: true
ClassNaming:
active: true
classPattern: '[A-Z][a-zA-Z0-9]*'
Expand All @@ -309,7 +308,6 @@ naming:
parameterPattern: '[a-z][A-Za-z0-9]*'
privateParameterPattern: '[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true
EnumNaming:
active: true
enumEntryPattern: '[A-Z][_a-zA-Z0-9]*'
Expand All @@ -327,13 +325,11 @@ naming:
excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ]
functionPattern: '[a-z][a-zA-Z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true
ignoreAnnotated: [ 'Composable' ]
FunctionParameterNaming:
active: true
parameterPattern: '[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true
InvalidPackageDeclaration:
active: true
rootPackage: ''
Expand Down Expand Up @@ -375,7 +371,6 @@ naming:
variablePattern: '[a-z][A-Za-z0-9]*'
privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true

performance:
active: true
Expand Down Expand Up @@ -515,12 +510,11 @@ style:
includeLineWrapping: false
ForbiddenComment:
active: true
values:
comments:
- 'FIXME:'
- 'STOPSHIP:'
- 'TODO:'
allowedPatterns: ''
customMessage: ''
ForbiddenImport:
active: false
imports: [ ]
Expand Down Expand Up @@ -564,7 +558,7 @@ style:
ignoreRanges: false
ignoreExtensionFunctions: true
ignoreAnnotated: [ 'Composable' ]
MandatoryBracesIfStatements:
BracesOnIfStatements:
active: false
MandatoryBracesLoops:
active: false
Expand Down Expand Up @@ -597,7 +591,7 @@ style:
active: true
OptionalUnit:
active: false
OptionalWhenBraces:
BracesOnWhenStatements:
active: false
PreferToOverPairSyntax:
active: false
Expand Down
12 changes: 6 additions & 6 deletions data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ android {

defaultConfig {
minSdk = Config.minSdk
targetSdk = Config.targetSdk
group = Config.maven_group
version = Config.versionName
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -31,17 +30,18 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "17"
}
lint {
// https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/LintOptions
abortOnError = false
sarifReport = true
sarifOutput = rootProject.layout.buildDirectory.file("reports/android-lint/${project.name}.sarif").get().asFile
targetSdk = Config.targetSdk
}
publishing {
singleVariant("release") {
Expand All @@ -54,9 +54,9 @@ android {
dependencies {
api(libs.kotlinx.serialization.json)

testImplementation(libs.robolectric)
testRuntimeOnly(libs.robolectric)
testImplementation(libs.junit)
testImplementation(libs.ext.junit)
testImplementation(libs.androidx.test.ext.junit)
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package ch.srg.dataProvider.integrationlayer.data

import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.json.Json

@OptIn(ExperimentalSerializationApi::class)
val DataProviderJson = Json {
ignoreUnknownKeys = true
encodeDefaults = true
Expand Down
10 changes: 5 additions & 5 deletions dataprovider-paging/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ android {

defaultConfig {
minSdk = Config.minSdk
targetSdk = Config.targetSdk
group = Config.maven_group
version = Config.versionName
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -30,17 +29,18 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "17"
}
lint {
// https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/LintOptions
abortOnError = false
sarifReport = true
sarifOutput = rootProject.layout.buildDirectory.file("reports/android-lint/${project.name}.sarif").get().asFile
targetSdk = Config.targetSdk
}
publishing {
singleVariant("release") {
Expand All @@ -52,7 +52,7 @@ android {

dependencies {
api(project(":dataprovider-retrofit"))
api(libs.paging.common)
api(libs.androidx.paging.common)
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ class DataProviderPaging(
fun getRadioAlphabeticalShowsByChannelId(bu: Bu, radioChannelId: String, pageSize: Int = DEFAULT_PAGE_SIZE): Flow<PagingData<Show>> {
return createNextUrlPagingData(
pageSize = pageSize,
initialCall = { ilService.getRadioAlphabeticalShowsByChannelId(bu = bu, channelId = radioChannelId, pageSize = it.toIlPaging()) },
initialCall = {
ilService.getRadioAlphabeticalShowsByChannelId(bu = bu, channelId = radioChannelId, pageSize = it.toIlPaging())
},
nextCall = { ilService.getShowListNextUrl(it) }
)
}
Expand Down
15 changes: 8 additions & 7 deletions dataprovider-retrofit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ android {

defaultConfig {
minSdk = Config.minSdk
targetSdk = Config.targetSdk
group = Config.maven_group
version = Config.versionName
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -30,17 +29,18 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "17"
}
lint {
// https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/dsl/LintOptions
abortOnError = false
sarifReport = true
sarifOutput = rootProject.layout.buildDirectory.file("reports/android-lint/${project.name}.sarif").get().asFile
targetSdk = Config.targetSdk
}
publishing {
singleVariant("release") {
Expand All @@ -54,12 +54,13 @@ dependencies {
api(project(":data"))
api(libs.retrofit)
compileOnly(libs.androidx.annotation)
implementation(libs.retrofit2.kotlinx.serialization.converter)
implementation(libs.logging.interceptor)
api(platform(libs.retrofit.bom))
implementation(libs.retrofit.converter.kotlinx.serialization)
implementation(libs.okhttp.logging.interceptor)

testImplementation(libs.junit)
testRuntimeOnly(libs.robolectric)
testImplementation(libs.ext.junit)
testImplementation(libs.androidx.test.ext.junit)
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import ch.srg.dataProvider.integrationlayer.SRGUrlFactory
import ch.srg.dataProvider.integrationlayer.data.DataProviderJson
import ch.srg.dataProvider.integrationlayer.request.IlHost
import ch.srg.dataProvider.integrationlayer.request.IlService
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.kotlinx.serialization.asConverterFactory
import retrofit2.create

/**
* Copyright (c) SRG SSR. All rights reserved.
Expand All @@ -28,6 +29,6 @@ object IlServiceModule {
.client(httpClient)
.baseUrl(uri.toString())
.build()
.create(IlService::class.java)
.create()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import ch.srg.dataProvider.integrationlayer.SRGUrlFactory
import ch.srg.dataProvider.integrationlayer.data.DataProviderJson
import ch.srg.dataProvider.integrationlayer.request.IlHost
import ch.srg.dataProvider.integrationlayer.request.IlStatisticService
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.kotlinx.serialization.asConverterFactory
import retrofit2.create

object IlStatisticServiceModule {

Expand All @@ -22,6 +23,6 @@ object IlStatisticServiceModule {
.client(httpClient)
.baseUrl(uri.toString())
.build()
.create(IlStatisticService::class.java)
.create()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ interface IlStatisticService {
suspend fun getMediaStatisticByUrn(@Path("urn") urn: String): MediaStatisticResult

@POST("2.0/mediaStatistic/byUrn/{urn}/clicked")
suspend fun postMediaClicked(@Path("urn") urn: String, @Body mediaStatisticsBody: MediaStatisticPost): MediaStatisticResult
suspend fun postMediaClicked(
@Path("urn") urn: String,
@Body mediaStatisticsBody: MediaStatisticPost
): MediaStatisticResult

@POST("2.0/mediaStatistic/byUrn/{urn}/liked")
suspend fun postMediaLiked(@Path("urn") urn: String, @Body mediaStatisticsBody: MediaStatisticPost): MediaStatisticResult
suspend fun postMediaLiked(
@Path("urn") urn: String,
@Body mediaStatisticsBody: MediaStatisticPost
): MediaStatisticResult

@POST("2.0/mediaStatistic/byUrn/{urn}/shared/{service}")
suspend fun postMediaShared(
Expand Down
13 changes: 5 additions & 8 deletions dataproviderdemo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "17"
}

lint {
Expand All @@ -57,9 +57,6 @@ android {

dependencies {
implementation(project(":dataprovider-retrofit"))
implementation(libs.appcompat)
implementation(libs.material)
implementation(libs.constraintlayout)
implementation(libs.lifecycle.runtime)
implementation(libs.lifecycle.viewmodel)
implementation(libs.androidx.activity)
implementation(libs.androidx.lifecycle.runtime)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package ch.srgssr.dataprovider.demo

import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import androidx.activity.ComponentActivity
import androidx.activity.enableEdgeToEdge
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
Expand All @@ -16,14 +17,15 @@ import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.launch
import okhttp3.OkHttpClient

class MainActivity : AppCompatActivity() {
class MainActivity : ComponentActivity(R.layout.activity_main) {

private lateinit var okHttp: OkHttpClient
private lateinit var ilService: IlService

override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()

super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

okHttp = OkHttpModule.createOkHttpClient(this)
ilService = IlServiceModule.createIlService(okHttp, ilHost = IlHost.PROD)
Expand Down
13 changes: 4 additions & 9 deletions dataproviderdemo/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand All @@ -9,10 +8,6 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
android:layout_gravity="center"
android:text="Hello World!" />
</FrameLayout>
14 changes: 1 addition & 13 deletions dataproviderdemo/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
<resources>
<!-- Base application theme. -->
<style name="Theme.SRGDataProvider" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<style name="Theme.SRGDataProvider" parent="android:Theme.Material.NoActionBar" />
</resources>
10 changes: 0 additions & 10 deletions dataproviderdemo/src/main/res/values/colors.xml

This file was deleted.

Loading

0 comments on commit ccc76cb

Please sign in to comment.