diff --git a/native/android/app/build.gradle.kts b/native/android/app/build.gradle.kts index 669b08b..5dcf6ce 100644 --- a/native/android/app/build.gradle.kts +++ b/native/android/app/build.gradle.kts @@ -30,6 +30,7 @@ android { val apiBaseUrl = project.findProperty("API_BASE_URL") as String? ?: "https://www.matchlivetv.it" buildConfigField("String", "API_BASE_URL", "\"$apiBaseUrl\"") + buildConfigField("boolean", "IS_COLLAUDO", "false") testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" // Anche in defaultConfig: AGP estrae simboli se le .so non sono giĆ  stripped. @@ -38,6 +39,23 @@ android { } } + flavorDimensions += "env" + productFlavors { + create("prod") { + dimension = "env" + isDefault = true + } + create("collaudo") { + dimension = "env" + applicationId = "com.matchlivetv.match_live_tv.collaudo" + versionNameSuffix = "-collaudo" + val collaudoApi = project.findProperty("API_BASE_URL") as String? + ?: "https://collaudo.matchlivetv.it" + buildConfigField("String", "API_BASE_URL", "\"$collaudoApi\"") + buildConfigField("boolean", "IS_COLLAUDO", "true") + } + } + signingConfigs { if (keystorePropertiesFile.exists()) { create("release") { @@ -138,31 +156,31 @@ fun findLlvmObjcopy(): File { val injectNativeDebugSymbolsInReleaseBundle by tasks.registering { description = "Embed native-debug-symbols.zip (.so.sym) into the release AAB intermediary" - val mergeNative = tasks.named("mergeReleaseNativeLibs") - val packageBundle = tasks.named("packageReleaseBundle") + val mergeNative = tasks.named("mergeProdReleaseNativeLibs") + val packageBundle = tasks.named("packageProdReleaseBundle") dependsOn(mergeNative, packageBundle) inputs.dir( layout.buildDirectory.dir( - "intermediates/merged_native_libs/release/mergeReleaseNativeLibs/out/lib", + "intermediates/merged_native_libs/prodRelease/mergeProdReleaseNativeLibs/out/lib", ), ) inputs.file( layout.buildDirectory.file( - "intermediates/intermediary_bundle/release/packageReleaseBundle/intermediary-bundle.aab", + "intermediates/intermediary_bundle/prodRelease/packageProdReleaseBundle/intermediary-bundle.aab", ), ) outputs.file( layout.buildDirectory.file( - "intermediates/intermediary_bundle/release/packageReleaseBundle/intermediary-bundle.aab", + "intermediates/intermediary_bundle/prodRelease/packageProdReleaseBundle/intermediary-bundle.aab", ), ) doLast { val libsDir = layout.buildDirectory - .dir("intermediates/merged_native_libs/release/mergeReleaseNativeLibs/out/lib") + .dir("intermediates/merged_native_libs/prodRelease/mergeProdReleaseNativeLibs/out/lib") .get() .asFile val aabFile = layout.buildDirectory - .file("intermediates/intermediary_bundle/release/packageReleaseBundle/intermediary-bundle.aab") + .file("intermediates/intermediary_bundle/prodRelease/packageProdReleaseBundle/intermediary-bundle.aab") .get() .asFile require(libsDir.isDirectory) { "Native libs missing: $libsDir" } @@ -234,6 +252,6 @@ val injectNativeDebugSymbolsInReleaseBundle by tasks.registering { } } -tasks.matching { it.name == "signReleaseBundle" }.configureEach { +tasks.matching { it.name == "signProdReleaseBundle" }.configureEach { dependsOn(injectNativeDebugSymbolsInReleaseBundle) } diff --git a/native/android/app/src/collaudo/AndroidManifest.xml b/native/android/app/src/collaudo/AndroidManifest.xml new file mode 100644 index 0000000..f95f1bb --- /dev/null +++ b/native/android/app/src/collaudo/AndroidManifest.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + diff --git a/native/android/app/src/collaudo/res/mipmap-hdpi/ic_launcher.png b/native/android/app/src/collaudo/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..dce2b29 Binary files /dev/null and b/native/android/app/src/collaudo/res/mipmap-hdpi/ic_launcher.png differ diff --git a/native/android/app/src/collaudo/res/mipmap-mdpi/ic_launcher.png b/native/android/app/src/collaudo/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c568538 Binary files /dev/null and b/native/android/app/src/collaudo/res/mipmap-mdpi/ic_launcher.png differ diff --git a/native/android/app/src/collaudo/res/mipmap-xhdpi/ic_launcher.png b/native/android/app/src/collaudo/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..7d4c2ba Binary files /dev/null and b/native/android/app/src/collaudo/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/native/android/app/src/collaudo/res/mipmap-xxhdpi/ic_launcher.png b/native/android/app/src/collaudo/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..a790bda Binary files /dev/null and b/native/android/app/src/collaudo/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/native/android/app/src/collaudo/res/mipmap-xxxhdpi/ic_launcher.png b/native/android/app/src/collaudo/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..2dd2587 Binary files /dev/null and b/native/android/app/src/collaudo/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/native/android/app/src/collaudo/res/values-de/strings.xml b/native/android/app/src/collaudo/res/values-de/strings.xml new file mode 100644 index 0000000..4d4dd7d --- /dev/null +++ b/native/android/app/src/collaudo/res/values-de/strings.xml @@ -0,0 +1,4 @@ + + + Match Live TV Collaudo + diff --git a/native/android/app/src/collaudo/res/values-en/strings.xml b/native/android/app/src/collaudo/res/values-en/strings.xml new file mode 100644 index 0000000..4d4dd7d --- /dev/null +++ b/native/android/app/src/collaudo/res/values-en/strings.xml @@ -0,0 +1,4 @@ + + + Match Live TV Collaudo + diff --git a/native/android/app/src/collaudo/res/values-es/strings.xml b/native/android/app/src/collaudo/res/values-es/strings.xml new file mode 100644 index 0000000..4d4dd7d --- /dev/null +++ b/native/android/app/src/collaudo/res/values-es/strings.xml @@ -0,0 +1,4 @@ + + + Match Live TV Collaudo + diff --git a/native/android/app/src/collaudo/res/values-fr/strings.xml b/native/android/app/src/collaudo/res/values-fr/strings.xml new file mode 100644 index 0000000..4d4dd7d --- /dev/null +++ b/native/android/app/src/collaudo/res/values-fr/strings.xml @@ -0,0 +1,4 @@ + + + Match Live TV Collaudo + diff --git a/native/android/app/src/collaudo/res/values/strings.xml b/native/android/app/src/collaudo/res/values/strings.xml new file mode 100644 index 0000000..4d4dd7d --- /dev/null +++ b/native/android/app/src/collaudo/res/values/strings.xml @@ -0,0 +1,4 @@ + + + Match Live TV Collaudo + diff --git a/native/android/app/src/main/kotlin/com/matchlivetv/match_live_tv/ui/login/LoginScreen.kt b/native/android/app/src/main/kotlin/com/matchlivetv/match_live_tv/ui/login/LoginScreen.kt index 808b223..92102e7 100644 --- a/native/android/app/src/main/kotlin/com/matchlivetv/match_live_tv/ui/login/LoginScreen.kt +++ b/native/android/app/src/main/kotlin/com/matchlivetv/match_live_tv/ui/login/LoginScreen.kt @@ -1,5 +1,6 @@ package com.matchlivetv.match_live_tv.ui.login +import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer @@ -7,6 +8,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.verticalScroll @@ -31,6 +33,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip import androidx.compose.ui.focus.FocusDirection import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalFocusManager @@ -38,6 +41,7 @@ import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.testTagsAsResourceId +import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.PasswordVisualTransformation @@ -45,6 +49,7 @@ import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.unit.dp +import com.matchlivetv.match_live_tv.BuildConfig import com.matchlivetv.match_live_tv.R import com.matchlivetv.match_live_tv.data.AppContainer import com.matchlivetv.match_live_tv.ui.components.LanguagePickerDialog @@ -122,6 +127,20 @@ fun LoginScreen( .padding(horizontal = 24.dp, vertical = 16.dp), horizontalAlignment = Alignment.CenterHorizontally, ) { + if (BuildConfig.IS_COLLAUDO) { + Text( + text = stringResource(R.string.collaudo_banner), + color = Color.Black, + fontWeight = FontWeight.Bold, + textAlign = TextAlign.Center, + modifier = Modifier + .fillMaxWidth() + .clip(RoundedCornerShape(8.dp)) + .background(MatchColors.AccentYellow) + .padding(vertical = 8.dp), + ) + Spacer(Modifier.height(16.dp)) + } MatchLiveWordmark(showSlogan = true) Spacer(Modifier.height(48.dp)) Text( diff --git a/native/android/app/src/main/res/values/strings.xml b/native/android/app/src/main/res/values/strings.xml index d91925b..d547316 100644 --- a/native/android/app/src/main/res/values/strings.xml +++ b/native/android/app/src/main/res/values/strings.xml @@ -1,6 +1,7 @@ Match Live TV + AMBIENTE COLLAUDO Ogni partita, ogni evento, per i tuoi tifosi. Lingua Sistema diff --git a/scripts/build_native_android_apk_collaudo.sh b/scripts/build_native_android_apk_collaudo.sh new file mode 100755 index 0000000..67efac3 --- /dev/null +++ b/scripts/build_native_android_apk_collaudo.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -euo pipefail +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +ANDROID_DIR="$ROOT/native/android" +API_BASE_URL="${API_BASE_URL:-https://collaudo.matchlivetv.it}" + +cd "$ANDROID_DIR" +chmod +x gradlew +./gradlew assembleCollaudoRelease -PAPI_BASE_URL="$API_BASE_URL" + +APK="$ANDROID_DIR/app/build/outputs/apk/collaudo/release/app-collaudo-release.apk" +echo "APK: $APK" +echo "API_BASE_URL=$API_BASE_URL" +echo "applicationId=com.matchlivetv.match_live_tv.collaudo" diff --git a/scripts/build_native_android_apk_prod.sh b/scripts/build_native_android_apk_prod.sh index 6d10aa3..44751f2 100755 --- a/scripts/build_native_android_apk_prod.sh +++ b/scripts/build_native_android_apk_prod.sh @@ -6,8 +6,8 @@ API_BASE_URL="${API_BASE_URL:-https://www.matchlivetv.it}" cd "$ANDROID_DIR" chmod +x gradlew -./gradlew assembleRelease -PAPI_BASE_URL="$API_BASE_URL" +./gradlew assembleProdRelease -PAPI_BASE_URL="$API_BASE_URL" -APK="$ANDROID_DIR/app/build/outputs/apk/release/app-release.apk" +APK="$ANDROID_DIR/app/build/outputs/apk/prod/release/app-prod-release.apk" echo "APK: $APK" echo "API_BASE_URL=$API_BASE_URL" diff --git a/scripts/e2e_native_android_emulator.sh b/scripts/e2e_native_android_emulator.sh index 3a70a0b..da2b30e 100755 --- a/scripts/e2e_native_android_emulator.sh +++ b/scripts/e2e_native_android_emulator.sh @@ -14,7 +14,7 @@ echo "==> Device: $DEVICE" cd "$ANDROID_DIR" chmod +x gradlew echo "==> Build debug + androidTest APK (API_BASE_URL=$API_BASE_URL)" -./gradlew assembleDebug assembleDebugAndroidTest -PAPI_BASE_URL="$API_BASE_URL" +./gradlew assembleProdDebug assembleProdDebugAndroidTest -PAPI_BASE_URL="$API_BASE_URL" echo "==> Reset app state on $DEVICE" "$ADB" -s "$DEVICE" shell am force-stop com.matchlivetv.match_live_tv @@ -24,11 +24,11 @@ echo "==> Reset app state on $DEVICE" "$ADB" -s "$DEVICE" shell pm grant com.matchlivetv.match_live_tv android.permission.POST_NOTIFICATIONS echo "==> Install on $DEVICE" -"$ADB" -s "$DEVICE" install -r app/build/outputs/apk/debug/app-debug.apk -"$ADB" -s "$DEVICE" install -r app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk +"$ADB" -s "$DEVICE" install -r app/build/outputs/apk/prod/debug/app-prod-debug.apk +"$ADB" -s "$DEVICE" install -r app/build/outputs/apk/androidTest/prod/debug/app-prod-debug-androidTest.apk echo "==> Run E2E tests" -./gradlew connectedDebugAndroidTest \ +./gradlew connectedProdDebugAndroidTest \ -Pandroid.testInstrumentationRunnerArguments.class=com.matchlivetv.match_live_tv.E2EWizardFlowTest \ -PAPI_BASE_URL="$API_BASE_URL"