diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e3a3765..1625c13 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -58,8 +58,10 @@ dependencies { implementation(libs.androidx.core.splashscreen) implementation(libs.androidx.compose.runtime) implementation(libs.androidx.lifecycle.runtime.ktx) + implementation(libs.androidx.compose.runtime.tracing) + implementation(libs.androidx.compose.material3.windowSizeClass) implementation(libs.androidx.lifecycle.runtimeCompose) - implementation(libs.accompanist.systemuicontroller) + implementation(libs.androidx.lifecycle.livedata.ktx) implementation(libs.androidx.hilt.navigation.compose) implementation(libs.androidx.navigation.compose) implementation(libs.androidx.fragment.ktx) @@ -69,7 +71,6 @@ dependencies { testImplementation(libs.junit4) androidTestImplementation(libs.androidx.test.junit) androidTestImplementation(libs.androidx.test.espresso.core) - androidTestImplementation(libs.compose.ui.test.junit) androidTestImplementation(libs.hilt.android.testing) androidTestImplementation(libs.androidx.navigation.testing) debugImplementation(libs.square.leakcanary) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7082050..709b93d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -10,6 +10,7 @@ android:name="com.loodos.MainApplication" android:allowBackup="true" android:dataExtractionRules="@xml/data_extraction_rules" + android:enableOnBackInvokedCallback="true" android:fullBackupContent="@xml/backup_rules" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" diff --git a/app/src/main/java/com/loodos/samplecomposeandroid/feature/main/MainActivity.kt b/app/src/main/java/com/loodos/samplecomposeandroid/feature/main/MainActivity.kt index 90cf5af..a4fc066 100644 --- a/app/src/main/java/com/loodos/samplecomposeandroid/feature/main/MainActivity.kt +++ b/app/src/main/java/com/loodos/samplecomposeandroid/feature/main/MainActivity.kt @@ -19,6 +19,7 @@ import androidx.lifecycle.lifecycleScope import androidx.lifecycle.repeatOnLifecycle import androidx.metrics.performance.JankStats import com.loodos.data.util.NetworkMonitor +import com.loodos.designsystems.theme.SampleComposeAndroidTheme import com.loodos.samplecomposeandroid.feature.appstate.MainApp import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.flow.collect @@ -87,7 +88,7 @@ class MainActivity : ComponentActivity() { private fun setContent() { setContent { - com.loodos.designsystems.theme.SampleComposeAndroidTheme { + SampleComposeAndroidTheme { MainApp(networkMonitor = networkMonitor) } } diff --git a/build-logic/convention/src/main/kotlin/samplecomposeandroid/AndroidCompose.kt b/build-logic/convention/src/main/kotlin/samplecomposeandroid/AndroidCompose.kt index 5302aec..4892ed5 100644 --- a/build-logic/convention/src/main/kotlin/samplecomposeandroid/AndroidCompose.kt +++ b/build-logic/convention/src/main/kotlin/samplecomposeandroid/AndroidCompose.kt @@ -28,7 +28,7 @@ internal fun Project.configureAndroidCompose( dependencies { - val bom = libs.findLibrary("compose-bom").get() + val bom = libs.findLibrary("android-compose-bom").get() add("implementation", platform(bom)) add("androidTestImplementation", platform(bom)) // Add ComponentActivity to debug manifest diff --git a/core/data/build.gradle.kts b/core/data/build.gradle.kts index bdd4f1b..cf80ead 100644 --- a/core/data/build.gradle.kts +++ b/core/data/build.gradle.kts @@ -29,10 +29,7 @@ dependencies { implementation(libs.kotlinx.coroutines.android) implementation(libs.kotlinx.serialization.json) implementation(libs.kotlinx.datetime) - implementation(libs.retrofit.converter.gson) - implementation(libs.square.retrofit) - implementation(libs.square.retrofit.converter.moshi) - implementation(libs.okhttp.logging.interceptor) + implementation(libs.bundles.network.retrofit) debugImplementation(libs.chucker) releaseImplementation(libs.chucker.no.op) diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts index 9358f42..262fa10 100644 --- a/core/ui/build.gradle.kts +++ b/core/ui/build.gradle.kts @@ -23,6 +23,8 @@ dependencies { api(libs.androidx.compose.ui.tooling.preview) api(libs.androidx.compose.ui.util) api(libs.androidx.metrics) + api(libs.androidx.tracing.ktx) + debugApi(libs.androidx.compose.ui.tooling) diff --git a/feature/login/src/main/java/com/merttoptas/login/LoginScreen.kt b/feature/login/src/main/java/com/merttoptas/login/LoginScreen.kt index 130ba9e..adabab4 100644 --- a/feature/login/src/main/java/com/merttoptas/login/LoginScreen.kt +++ b/feature/login/src/main/java/com/merttoptas/login/LoginScreen.kt @@ -35,6 +35,7 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.loodos.designsystems.component.CustomTextField +import com.loodos.designsystems.component.MainAppScaffold import com.loodos.samplecomposeandroid.feature.login.R import de.palm.composestateevents.EventEffect @@ -73,7 +74,7 @@ fun LoginScreen( modifier: Modifier = Modifier, onLoginClicked: () -> Unit, ) { - com.loodos.designsystems.component.MainAppScaffold( + MainAppScaffold( modifier = modifier.fillMaxSize(), ) { Content( diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6eadc87..0c8f343 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,9 +1,16 @@ [versions] -accompanist = "0.30.1" +accompanist = "0.32.0" appCompat = "1.6.1" androidDesugarJdkLibs = "2.0.3" androidGradlePlugin = "8.0.2" androidxActivity = "1.8.0" +androidxComposeRuntimeTracing = "1.0.0-alpha03" +androidxTestCore = "1.5.0" +androidxTestExt = "1.1.5" +androidxTestRules = "1.5.0" +androidxTestRunner = "1.5.1" +androidxUiAutomator = "2.2.0" +androidxTracing = "1.1.0" navigationCompose = "2.7.4" fragmentKtx = "1.6.1" okhttp = "4.10.0" @@ -50,71 +57,79 @@ room = "2.5.1" chucker = "3.5.2" firebase-pref = "1.4.1" secrets = "2.0.1" +turbine = "0.12.1" [libraries] -androidx-core-splashscreen = { group = "androidx.core", name = "core-splashscreen", version.ref = "androidxCoreSplashscreen" } -accompanist-systemuicontroller = { group = "com.google.accompanist", name = "accompanist-systemuicontroller", version.ref = "accompanist" } android-desugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" } -android-material = { group = "com.google.android.material", name = "material", version.ref = "material" } androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "androidxActivity" } -androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "ktxCore" } androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appCompat" } -androidx-fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "fragmentKtx" } -androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle" } -androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "androidxNavigation" } -androidx-room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "room" } -androidx-room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room" } -androidx-room-paging = { group = "androidx.room", name = "room-paging", version.ref = "room" } +android-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" } androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation" } -androidx-compose-runtime = { group = "androidx.compose.runtime", name = "runtime" } -androidx-compose-runtime-livedata = { group = "androidx.compose.runtime", name = "runtime-livedata" } androidx-compose-foundation-layout = { group = "androidx.compose.foundation", name = "foundation-layout" } +androidx-compose-material-iconsExtended = { group = "androidx.compose.material", name = "material-icons-extended" } androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" } androidx-compose-material3-windowSizeClass = { group = "androidx.compose.material3", name = "material3-window-size-class" } +androidx-compose-runtime = { group = "androidx.compose.runtime", name = "runtime" } +androidx-compose-runtime-livedata = { group = "androidx.compose.runtime", name = "runtime-livedata" } +androidx-compose-runtime-tracing = { group = "androidx.compose.runtime", name = "runtime-tracing", version.ref = "androidxComposeRuntimeTracing" } +androidx-compose-ui-test = { group = "androidx.compose.ui", name = "ui-test-junit4" } +androidx-compose-ui-testManifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } +androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } +androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } +androidx-compose-ui-util = { group = "androidx.compose.ui", name = "ui-util" } +androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "ktxCore" } +androidx-core-splashscreen = { group = "androidx.core", name = "core-splashscreen", version.ref = "androidxCoreSplashscreen" } +androidx-hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "hiltNavigationCompose" } +androidx-lifecycle-livedata-ktx = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version.ref = "androidxLifecycle" } +androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle" } androidx-lifecycle-runtimeCompose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidxLifecycle" } androidx-lifecycle-viewModelCompose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "androidxLifecycle" } +androidx-metrics = { group = "androidx.metrics", name = "metrics-performance", version.ref = "androidxMetrics" } +androidx-fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "fragmentKtx" } +androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "androidxNavigation" } +androidx-navigation-testing = { group = "androidx.navigation", name = "navigation-testing", version.ref = "androidxNavigation" } +androidx-test-core = { group = "androidx.test", name = "core", version.ref = "androidxTestCore" } +androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidxEspresso" } +androidx-test-ext = { group = "androidx.test.ext", name = "junit-ktx", version.ref = "androidxTestExt" } +androidx-test-rules = { group = "androidx.test", name = "rules", version.ref = "androidxTestRules" } +androidx-test-runner = { group = "androidx.test", name = "runner", version.ref = "androidxTestRunner" } +androidx-test-uiautomator = { group = "androidx.test.uiautomator", name = "uiautomator", version.ref = "androidxUiAutomator" } +androidx-tracing-ktx = { group = "androidx.tracing", name = "tracing-ktx", version.ref = "androidxTracing" } +coil-kt = { group = "io.coil-kt", name = "coil", version.ref = "coil" } +coil-kt-compose = { group = "io.coil-kt", name = "coil-compose", version.ref = "coil" } +coil-kt-svg = { group = "io.coil-kt", name = "coil-svg", version.ref = "coil" } +hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" } +hilt-android-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "hilt" } +hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" } +junit4 = { module = "junit:junit", version.ref = "junit" } kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinxCoroutines" } +kotlinx-coroutines-guava = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-guava", version.ref = "kotlinxCoroutines" } +kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" } +kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" } +kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinxDatetime" } +androidx-room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "room" } +androidx-room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room" } +androidx-room-paging = { group = "androidx.room", name = "room-paging", version.ref = "room" } androidx-room-ktx = { group = "androidx.room", name = "room-ktx", version.ref = "room" } -androidx-metrics = { group = "androidx.metrics", name = "metrics-performance", version.ref = "androidxMetrics" } androidx-room-testing = { group = "androidx.room", name = "room-testing", version.ref = "room" } -androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso" } +turbine = { group = "app.cash.turbine", name = "turbine", version.ref = "turbine" } + androidx-test-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidxTest" } -androidx-compose-ui-testManifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } -compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" } -androidx-compose-material-iconsExtended = { group = "androidx.compose.material", name = "material-icons-extended" } compose-material = { group = "androidx.compose.material3", name = "material3" } compose-ui = { group = "androidx.compose.ui", name = "ui" } -compose-ui-test-junit = { group = "androidx.compose.ui", name = "ui-test-junit4" } -compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" } chucker = { group = "com.github.chuckerteam.chucker", name = "library", version.ref = "chucker" } chucker-no-op = { group = "com.github.chuckerteam.chucker", name = "library-no-op", version.ref = "chucker" } -compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } -kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" } -androidx-navigation-testing = { group = "androidx.navigation", name = "navigation-testing", version.ref = "androidxNavigation" } -androidx-hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "hiltNavigationCompose" } retrofit-converter-gson = { group = "com.squareup.retrofit2", name = "converter-gson", version.ref = "retrofit" } -compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } -androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } -androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } -androidx-compose-ui-util = { group = "androidx.compose.ui", name = "ui-util" } +square-retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } +square-retrofit-converter-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit" } okhttp-logging-interceptor = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" } compose-ui-util = { group = "androidx.compose.ui", name = "ui-util" } dependency-versions-plugin = { module = "com.github.ben-manes:gradle-versions-plugin", version.ref = "gradleVersionsPlugin" } -hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" } -hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hilt" } -hilt-android-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "hilt" } -hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" } -junit4 = { module = "junit:junit", version.ref = "junit" } -kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinxDatetime" } -coil-kt = { group = "io.coil-kt", name = "coil", version.ref = "coil" } -coil-kt-compose = { group = "io.coil-kt", name = "coil-compose", version.ref = "coil" } -coil-kt-svg = { group = "io.coil-kt", name = "coil-svg", version.ref = "coil" } + square-leakcanary = { module = "com.squareup.leakcanary:leakcanary-android", version.ref = "leakCanary" } square-moshi-kotlin = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "moshi" } square-moshi-kotlin-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi" } -square-retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } -square-retrofit-converter-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit" } compose-state-events = { group = "com.github.leonard-palm", name = "compose-state-events", version.ref = "composeStateEvents" } # Dependencies of the included build-logic @@ -123,6 +138,10 @@ kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-pl firebase-crashlytics-gradlePlugin = { group = "com.google.firebase", name = "firebase-crashlytics-gradle", version.ref = "firebaseCrashlyticsPlugin" } ksp-gradlePlugin = { group = "com.google.devtools.ksp", name = "com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" } +[bundles] +# Bundle with retrofit dependencies needed to compile. +network-retrofit = ["retrofit-converter-gson", "square-retrofit","square-retrofit-converter-moshi", "okhttp-logging-interceptor"] + [plugins] com-android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }