diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index ca6aa36..cc5ebe8 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -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 diff --git a/config/detekt.yml b/config/detekt.yml index c62f268..4ac71c5 100644 --- a/config/detekt.yml +++ b/config/detekt.yml @@ -300,7 +300,6 @@ naming: BooleanPropertyNaming: active: false allowedPattern: '^(is|has|are)' - ignoreOverridden: true ClassNaming: active: true classPattern: '[A-Z][a-zA-Z0-9]*' @@ -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]*' @@ -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: '' @@ -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 @@ -515,12 +510,11 @@ style: includeLineWrapping: false ForbiddenComment: active: true - values: + comments: - 'FIXME:' - 'STOPSHIP:' - 'TODO:' allowedPatterns: '' - customMessage: '' ForbiddenImport: active: false imports: [ ] @@ -564,7 +558,7 @@ style: ignoreRanges: false ignoreExtensionFunctions: true ignoreAnnotated: [ 'Composable' ] - MandatoryBracesIfStatements: + BracesOnIfStatements: active: false MandatoryBracesLoops: active: false @@ -597,7 +591,7 @@ style: active: true OptionalUnit: active: false - OptionalWhenBraces: + BracesOnWhenStatements: active: false PreferToOverPairSyntax: active: false diff --git a/data/build.gradle.kts b/data/build.gradle.kts index 67b77fc..821209c 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -11,7 +11,6 @@ android { defaultConfig { minSdk = Config.minSdk - targetSdk = Config.targetSdk group = Config.maven_group version = Config.versionName testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" @@ -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") { @@ -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 { diff --git a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/DataProviderJson.kt b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/DataProviderJson.kt index 431a0b1..1759c01 100644 --- a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/DataProviderJson.kt +++ b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/DataProviderJson.kt @@ -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 diff --git a/dataprovider-paging/build.gradle.kts b/dataprovider-paging/build.gradle.kts index 6e006c6..6d6733d 100644 --- a/dataprovider-paging/build.gradle.kts +++ b/dataprovider-paging/build.gradle.kts @@ -10,7 +10,6 @@ android { defaultConfig { minSdk = Config.minSdk - targetSdk = Config.targetSdk group = Config.maven_group version = Config.versionName testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" @@ -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") { @@ -52,7 +52,7 @@ android { dependencies { api(project(":dataprovider-retrofit")) - api(libs.paging.common) + api(libs.androidx.paging.common) } publishing { diff --git a/dataprovider-paging/src/main/java/ch/srgssr/dataprovider/paging/DataProviderPaging.kt b/dataprovider-paging/src/main/java/ch/srgssr/dataprovider/paging/DataProviderPaging.kt index a1101af..7fb8e0e 100644 --- a/dataprovider-paging/src/main/java/ch/srgssr/dataprovider/paging/DataProviderPaging.kt +++ b/dataprovider-paging/src/main/java/ch/srgssr/dataprovider/paging/DataProviderPaging.kt @@ -256,7 +256,9 @@ class DataProviderPaging( fun getRadioAlphabeticalShowsByChannelId(bu: Bu, radioChannelId: String, pageSize: Int = DEFAULT_PAGE_SIZE): Flow> { 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) } ) } diff --git a/dataprovider-retrofit/build.gradle.kts b/dataprovider-retrofit/build.gradle.kts index cab7109..f9c1aa4 100644 --- a/dataprovider-retrofit/build.gradle.kts +++ b/dataprovider-retrofit/build.gradle.kts @@ -10,7 +10,6 @@ android { defaultConfig { minSdk = Config.minSdk - targetSdk = Config.targetSdk group = Config.maven_group version = Config.versionName testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" @@ -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") { @@ -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 { diff --git a/dataprovider-retrofit/src/main/java/ch/srg/dataProvider/integrationlayer/dependencies/modules/IlServiceModule.kt b/dataprovider-retrofit/src/main/java/ch/srg/dataProvider/integrationlayer/dependencies/modules/IlServiceModule.kt index ab81ec9..8db26f4 100644 --- a/dataprovider-retrofit/src/main/java/ch/srg/dataProvider/integrationlayer/dependencies/modules/IlServiceModule.kt +++ b/dataprovider-retrofit/src/main/java/ch/srg/dataProvider/integrationlayer/dependencies/modules/IlServiceModule.kt @@ -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. @@ -28,6 +29,6 @@ object IlServiceModule { .client(httpClient) .baseUrl(uri.toString()) .build() - .create(IlService::class.java) + .create() } } diff --git a/dataprovider-retrofit/src/main/java/ch/srg/dataProvider/integrationlayer/dependencies/modules/IlStatisticServiceModule.kt b/dataprovider-retrofit/src/main/java/ch/srg/dataProvider/integrationlayer/dependencies/modules/IlStatisticServiceModule.kt index d058299..071a3f3 100644 --- a/dataprovider-retrofit/src/main/java/ch/srg/dataProvider/integrationlayer/dependencies/modules/IlStatisticServiceModule.kt +++ b/dataprovider-retrofit/src/main/java/ch/srg/dataProvider/integrationlayer/dependencies/modules/IlStatisticServiceModule.kt @@ -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 { @@ -22,6 +23,6 @@ object IlStatisticServiceModule { .client(httpClient) .baseUrl(uri.toString()) .build() - .create(IlStatisticService::class.java) + .create() } } diff --git a/dataprovider-retrofit/src/main/java/ch/srg/dataProvider/integrationlayer/request/IlStatisticService.kt b/dataprovider-retrofit/src/main/java/ch/srg/dataProvider/integrationlayer/request/IlStatisticService.kt index 6c310aa..deaf656 100644 --- a/dataprovider-retrofit/src/main/java/ch/srg/dataProvider/integrationlayer/request/IlStatisticService.kt +++ b/dataprovider-retrofit/src/main/java/ch/srg/dataProvider/integrationlayer/request/IlStatisticService.kt @@ -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( diff --git a/dataproviderdemo/build.gradle.kts b/dataproviderdemo/build.gradle.kts index 0520cbe..78915a4 100644 --- a/dataproviderdemo/build.gradle.kts +++ b/dataproviderdemo/build.gradle.kts @@ -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 { @@ -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) } diff --git a/dataproviderdemo/src/main/java/ch/srgssr/dataprovider/demo/MainActivity.kt b/dataproviderdemo/src/main/java/ch/srgssr/dataprovider/demo/MainActivity.kt index a377463..7161d52 100644 --- a/dataproviderdemo/src/main/java/ch/srgssr/dataprovider/demo/MainActivity.kt +++ b/dataproviderdemo/src/main/java/ch/srgssr/dataprovider/demo/MainActivity.kt @@ -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 @@ -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) diff --git a/dataproviderdemo/src/main/res/layout/activity_main.xml b/dataproviderdemo/src/main/res/layout/activity_main.xml index 4fc2444..5e8e3dd 100644 --- a/dataproviderdemo/src/main/res/layout/activity_main.xml +++ b/dataproviderdemo/src/main/res/layout/activity_main.xml @@ -1,6 +1,5 @@ - - - \ No newline at end of file + android:layout_gravity="center" + android:text="Hello World!" /> + diff --git a/dataproviderdemo/src/main/res/values-night/themes.xml b/dataproviderdemo/src/main/res/values-night/themes.xml index f9ee8ca..234fb4a 100644 --- a/dataproviderdemo/src/main/res/values-night/themes.xml +++ b/dataproviderdemo/src/main/res/values-night/themes.xml @@ -1,16 +1,4 @@ - + +