diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 68e42a1..80c8eeb 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,11 +1,11 @@ plugins { - id("com.android.application") - id("org.jetbrains.kotlin.android") - id("com.google.dagger.hilt.android") + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.hilt.android) id("kotlin-parcelize") - id("com.google.devtools.ksp") - id("com.google.gms.google-services") - id("com.google.firebase.crashlytics") + alias(libs.plugins.devtools.ksp) + alias(libs.plugins.google.services) + alias(libs.plugins.firebase.crashlytics) } android { @@ -17,7 +17,7 @@ android { minSdk = 24 targetSdk = 34 versionCode = 1 - versionName = "1.0" + versionName = "1.0.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { @@ -27,7 +27,7 @@ android { buildTypes { debug { - buildConfigField("String", "BASE_URL", "\"http://192.168.1.6:3000/\"") + buildConfigField("String", "BASE_URL", "\"http://192.168.1.5:3000/\"") buildConfigField("String", "API_KEY", "\"1D3F2DD1A5DE725DD4DF1D82BBB37\"") } release { @@ -65,131 +65,91 @@ android { } dependencies { + implementation(libs.core) - val core = "1.12.0" - implementation("androidx.core:core-ktx:$core") - - // Material Design 3 - val material3 = "1.1.2" - implementation("androidx.compose.material3:material3:$material3") - - // lifecycle - val lifecycle = "2.7.0" - implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle") - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle") - implementation("androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle") - implementation("androidx.lifecycle:lifecycle-runtime-compose:$lifecycle") + // Lifecycle + implementation(libs.lifecycle.runtime) + implementation(libs.lifecycle.viewmodel) + implementation(libs.lifecycle.viewmodel.compose) + implementation(libs.lifecycle.runtime.compose) // Compose - val compose = "2023.03.00" - implementation(platform("androidx.compose:compose-bom:$compose")) - implementation("androidx.compose.ui:ui") - implementation("androidx.compose.ui:ui-graphics") - implementation("androidx.compose.material3:material3") - implementation("androidx.compose.ui:ui-tooling-preview") - debugImplementation("androidx.compose.ui:ui-tooling") - implementation("androidx.compose.material:material-icons-extended") - implementation("androidx.compose.material3:material3-window-size-class") + implementation(platform(libs.compose.bom)) + implementation(libs.compose.ui) + implementation(libs.compose.ui.graphics) + implementation(libs.compose.ui.tooling.preview) + debugImplementation(libs.compose.ui.tooling) + implementation(libs.compose.material3) + implementation(libs.compose.material.icons) + implementation(libs.compose.material3.windowsize) - val navigation = "2.7.6" - implementation("androidx.navigation:navigation-compose:$navigation") + implementation(libs.navigation.compose) - val constraintlayout = "1.0.1" - implementation("androidx.constraintlayout:constraintlayout-compose:$constraintlayout") + implementation(libs.constraintlayout.compose) - val activity = "1.8.2" - implementation("androidx.activity:activity-compose:$activity") + implementation(libs.activity.compose) - val browser = "1.7.0" - implementation("androidx.browser:browser:$browser") + implementation(libs.browser) - val charty = "2.0.0-alpha01" - implementation("com.himanshoe:charty:$charty") + implementation(libs.charty) // Coroutine - val coroutines = "1.7.3" - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines") + implementation(libs.coroutines.android) // Log - val timber = "5.0.1" - implementation("com.jakewharton.timber:timber:$timber") + implementation(libs.timber) // Network - val retrofit2 = "2.9.0" - implementation("com.squareup.retrofit2:retrofit:$retrofit2") - implementation("com.squareup.retrofit2:converter-moshi:${retrofit2}") + implementation(libs.retrofit2) + implementation(libs.retrofit2.moshi) - val okhttp3 = "4.11.0" - implementation(platform("com.squareup.okhttp3:okhttp-bom:$okhttp3")) - implementation("com.squareup.okhttp3:okhttp") - implementation("com.squareup.okhttp3:logging-interceptor") + implementation(platform(libs.okhttp.bom)) + implementation(libs.okhttp) + implementation(libs.okhttp.logging) // Firebase - val firebase = "32.7.0" - implementation(platform("com.google.firebase:firebase-bom:$firebase")) - implementation("com.google.firebase:firebase-analytics") - implementation("com.google.firebase:firebase-messaging") - implementation("com.google.firebase:firebase-crashlytics") - implementation("com.google.firebase:firebase-config") - - val crashlytics = "2.9.9" - implementation("com.google.firebase:firebase-crashlytics-buildtools:$crashlytics") + implementation(platform(libs.firebase.bom)) + implementation(libs.firebase.analytics) + implementation(libs.firebase.messaging) + implementation(libs.firebase.crashlytics) + implementation(libs.firebase.config) + implementation(libs.firebase.crashlytics.buildtools) // Work - val work = "2.9.0" - implementation("androidx.work:work-runtime-ktx:$work") + implementation(libs.work.runtime) // JSON - val moshi = "1.15.0" - implementation("com.squareup.moshi:moshi:$moshi") - ksp("com.squareup.moshi:moshi-kotlin-codegen:$moshi") + implementation(libs.moshi) + ksp(libs.moshi.codegen) // Database - val room = "2.6.1" - implementation("androidx.room:room-runtime:$room") - ksp("androidx.room:room-compiler:$room") - implementation("androidx.room:room-ktx:$room") + implementation(libs.room.runtime) + ksp(libs.room.compiler) + implementation(libs.room) // Dependency Management - val hilt = "2.50" - implementation("com.google.dagger:hilt-android:$hilt") - ksp("com.google.dagger:hilt-android-compiler:$hilt") - - val hiltKtx = "1.1.0" - implementation("androidx.hilt:hilt-navigation-compose:$hiltKtx") - implementation("androidx.hilt:hilt-work:$hiltKtx") - ksp("androidx.hilt:hilt-compiler:$hiltKtx") + implementation(libs.hilt.android) + ksp(libs.hilt.android.compiler) + implementation(libs.hilt.navigation.compose) + implementation(libs.hilt.work) + ksp(libs.hilt.compiler) // Image - val coil = "2.5.0" - implementation("io.coil-kt:coil:$coil") - implementation("io.coil-kt:coil-compose:$coil") - - val lottie = "6.3.0" - implementation("com.airbnb.android:lottie-compose:$lottie") + implementation(libs.coil) + implementation(libs.coil.compose) + implementation(libs.lottie.compose) // Unit Test - val junit = "4.13.2" - testImplementation("junit:junit:$junit") - - val mockk = "1.13.9" - testImplementation("io.mockk:mockk:$mockk") - - val coroutinesTest = "1.7.3" - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesTest") + testImplementation(libs.junit) + testImplementation(libs.mockk) + testImplementation(libs.coroutines.test) // Android Test - val junitExt = "1.1.5" - androidTestImplementation("androidx.test.ext:junit:$junitExt") - - val espresso = "3.5.1" - androidTestImplementation("androidx.test.espresso:espresso-core:$espresso") - - androidTestImplementation("io.mockk:mockk-android:$mockk") - - androidTestImplementation(platform("androidx.compose:compose-bom:$compose")) - androidTestImplementation("androidx.compose.ui:ui-test-junit4") - debugImplementation("androidx.compose.ui:ui-tooling") - debugImplementation("androidx.compose.ui:ui-test-manifest") - + androidTestImplementation(libs.junit.ext) + androidTestImplementation(libs.espresso.core) + androidTestImplementation(libs.mockk.android) + androidTestImplementation(platform(libs.compose.bom)) + androidTestImplementation(libs.compose.ui.test.junit4) + debugImplementation(libs.compose.ui.tooling) + debugImplementation(libs.compose.ui.test.manifest) } \ No newline at end of file diff --git a/app/src/main/kotlin/com/whereismymotivation/ui/MainActivity.kt b/app/src/main/kotlin/com/whereismymotivation/ui/MainActivity.kt index fc1860b..dfa502b 100644 --- a/app/src/main/kotlin/com/whereismymotivation/ui/MainActivity.kt +++ b/app/src/main/kotlin/com/whereismymotivation/ui/MainActivity.kt @@ -40,7 +40,7 @@ class MainActivity : ComponentActivity() { handleIntent(intent) } - override fun onNewIntent(intent: Intent?) { + override fun onNewIntent(intent: Intent) { super.onNewIntent(intent) handleIntent(intent) } diff --git a/app/src/main/kotlin/com/whereismymotivation/ui/navigation/Destination.kt b/app/src/main/kotlin/com/whereismymotivation/ui/navigation/Destination.kt index 0a85bae..16ccdb8 100644 --- a/app/src/main/kotlin/com/whereismymotivation/ui/navigation/Destination.kt +++ b/app/src/main/kotlin/com/whereismymotivation/ui/navigation/Destination.kt @@ -24,11 +24,11 @@ object Destination { abstract class Screen(baseRoute: String) { companion object { - const val baseDeeplinkUrl = "app://wimm" + const val BASE_DEEPLINK_URL = "app://wimm" } open val route = baseRoute - open val deeplink = "${baseDeeplinkUrl}/$baseRoute" + open val deeplink = "${BASE_DEEPLINK_URL}/$baseRoute" } abstract class DynamicScreen( @@ -39,11 +39,11 @@ object Destination { val navArguments = listOf(navArgument(routeArgName) { type = NavType.StringType }) override val route = "$baseRoute/{$routeArgName}" - override val deeplink = "${baseDeeplinkUrl}/$baseRoute/{$routeArgName}" + override val deeplink = "${BASE_DEEPLINK_URL}/$baseRoute/{$routeArgName}" fun dynamicRoute(param: String) = "$baseRoute/$param" - fun dynamicDeeplink(param: String) = "$baseDeeplinkUrl/$baseRoute/${param}" + fun dynamicDeeplink(param: String) = "$BASE_DEEPLINK_URL/$baseRoute/${param}" } } diff --git a/build.gradle.kts b/build.gradle.kts index c17167e..511aec0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,9 +1,9 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id("com.android.application") version "8.2.1" apply false - id("org.jetbrains.kotlin.android") version "1.9.22" apply false - id("com.google.dagger.hilt.android") version "2.50" apply false - id("com.google.devtools.ksp") version "1.9.22-1.0.17" apply false - id("com.google.gms.google-services") version "4.4.0" apply false - id("com.google.firebase.crashlytics") version "2.9.9" apply false + alias(libs.plugins.android.application) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.hilt.android) apply false + alias(libs.plugins.devtools.ksp) apply false + alias(libs.plugins.google.services) apply false + alias(libs.plugins.firebase.crashlytics) apply false } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..164c529 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,121 @@ +[versions] +application = "8.3.2" +kotlin = "1.9.22" +hilt = "2.50" +ksp = "1.9.22-1.0.17" +google-services = "4.4.2" +crashlytics = "3.0.2" +android-core = "1.13.1" +lifecycle = "2.8.3" +compose = "2024.06.00" +navigation = "2.7.7" +constraintlayout = "1.0.1" +activity = "1.9.0" +browser = "1.8.0" +charty = "2.0.0-alpha01" +coroutines = "1.7.3" +timber = "5.0.1" +retrofit2 = "2.9.0" +okhttp3 = "4.11.0" +firebase = "33.1.1" +work = "2.9.0" +moshi = "1.15.1" +room = "2.6.1" +hiltKtx = "1.2.0" +coil = "2.5.0" +lottie = "6.3.0" +junit = "4.13.2" +mockk = "1.13.9" +coroutines-test = "1.7.3" +junit-ext = "1.2.1" +espresso = "3.6.1" + +[plugins] +android-application = { id = "com.android.application", version.ref = "application" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +hilt-android = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } +devtools-ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } +google-services = { id = "com.google.gms.google-services", version.ref = "google-services" } +firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "crashlytics" } + +[libraries] +core = { module = "androidx.core:core-ktx", version.ref = "android-core" } + +# Lifecycle +lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle" } +lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycle" } +lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycle" } +lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "lifecycle" } + +# Compose +compose-bom = { module = "androidx.compose:compose-bom", version.ref = "compose" } +compose-material3 = { module = "androidx.compose.material3:material3" } +compose-ui = { module = "androidx.compose.ui:ui" } +compose-ui-graphics = { module = "androidx.compose.ui:ui-graphics" } +compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" } +compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" } +compose-material-icons = { module = "androidx.compose.material:material-icons-extended" } +compose-material3-windowsize = { module = "androidx.compose.material3:material3-window-size-class" } + +navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigation"} +constraintlayout-compose = { module = "androidx.constraintlayout:constraintlayout-compose", version.ref = "constraintlayout"} +activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity"} +browser = { module = "androidx.browser:browser", version.ref = "browser"} +charty = { module = "com.himanshoe:charty", version.ref = "charty"} + +# Coroutine +coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines"} + +# Log +timber = { module = "com.jakewharton.timber:timber", version.ref = "timber"} + +# Network +retrofit2 = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit2"} +retrofit2-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit2"} +okhttp-bom = { module = "com.squareup.okhttp3:okhttp-bom", version.ref = "okhttp3"} +okhttp = { module = "com.squareup.okhttp3:okhttp"} +okhttp-logging = { module = "com.squareup.okhttp3:logging-interceptor"} + +# Firebase +firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebase"} +firebase-analytics = { module = "com.google.firebase:firebase-analytics"} +firebase-messaging = { module = "com.google.firebase:firebase-messaging"} +firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics"} +firebase-config = { module = "com.google.firebase:firebase-config"} +firebase-crashlytics-buildtools = { module = "com.google.firebase:firebase-crashlytics-buildtools", version.ref = "crashlytics"} + +# Work +work-runtime = { module = "androidx.work:work-runtime-ktx", version.ref = "work"} + +# Moshi +moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi"} +moshi-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi"} + +# Database +room-runtime = { module = "androidx.room:room-runtime", version.ref = "room"} +room-compiler = { module = "androidx.room:room-compiler", version.ref = "room"} +room = { module = "androidx.room:room-ktx", version.ref = "room"} + +# Dependency Management +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-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hiltKtx"} +hilt-work = { module = "androidx.hilt:hilt-work", version.ref = "hiltKtx"} +hilt-compiler = { module = "androidx.hilt:hilt-compiler", version.ref = "hiltKtx"} + +# Image +coil = { module = "io.coil-kt:coil", version.ref = "coil"} +coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil"} +lottie-compose = { module = "com.airbnb.android:lottie-compose", version.ref = "lottie"} + +# Unit Test +junit = { module = "junit:junit", version.ref = "junit"} +mockk = { module = "io.mockk:mockk", version.ref = "mockk"} +coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines-test"} + +# Android Test +junit-ext = { module = "androidx.test.ext:junit", version.ref = "junit-ext"} +espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso"} +mockk-android = { module = "io.mockk:mockk-android", version.ref = "mockk"} +compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4"} +compose-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest"} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 12a1063..cfa05b2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Tue Dec 12 17:24:00 IST 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists