apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.devtools.ksp'


android {
    namespace = "es.verdnatura"
    compileSdk 34
    defaultConfig {
        applicationId "es.verdnatura"
        minSdkVersion 26
        targetSdkVersion 33 // se deja con target si no Play Protect la bloquea
        versionCode 330
        versionName = "24.38Beta"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            /*debuggable false
            shrinkResources true
            minifyEnabled true*/
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }

        //package de la app general =   "package_name": "es.verdnatura"
        //package de la app beta    =   "package_name": "es.verdnatura.sfusion"

        applicationVariants.all { variant ->
            variant.outputs.all { output ->
                def flavorName = variant.productFlavors[0].name
                def apkName

                if (flavorName == "beta") {
                    apkName = "vn-pickingBeta.apk"
                } else if (flavorName == "general") {
                    apkName = "vn-picking.apk"
                } else {
                    apkName = "vn-picking.apk"
                }

                output.outputFileName = apkName
            }
        }
    }

    flavorDimensions += "version"
    productFlavors {
        create("beta") {
            applicationIdSuffix = ".sfusion"
        }
        create("general") {
            //versionNameSuffix = "General"
        }
    }

    buildFeatures {
        viewBinding = true

    }
    /*kotlinOptions {
        jvmTarget = "1.8"
    }
    buildFeatures {
        compose = true
    }
    kotlin {
        jvmToolchain(8)
    }
    composeOptions {
        kotlinCompilerExtensionVersion = "1.4.3"
    }
    */
    dataBinding {
        enabled = true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.firebase:firebase-crashlytics-ktx:19.0.3'
    implementation 'com.google.firebase:firebase-analytics-ktx:22.0.2'
    implementation 'com.google.android.gms:play-services-location:21.3.0'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7'
    implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
    implementation 'androidx.core:core-ktx:1.13.1'
    kapt "androidx.room:room-compiler:2.6.1"
    implementation 'androidx.room:room-ktx:2.6.1'
    debugImplementation fileTree(dir: 'libs/debug', include: ['*.jar'])
    releaseImplementation fileTree(dir: 'libs/release', include: ['*.jar'])

    //canvas
    implementation 'com.simplify:ink:1.0.0'

    // Kotlin  and Android
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.7.0'
    implementation 'androidx.core:core-ktx:1.13.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

//tests
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.2.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
    implementation 'com.google.android.material:material:1.12.0'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
    implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
    implementation "com.airbnb.android:lottie:$lottieVersion"
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

    //Fragments
    implementation("androidx.fragment:fragment-ktx:1.8.2")

    // Architecture components
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.4"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.8.4"
    implementation "androidx.legacy:legacy-support-v4:1.0.0"

    //Koin new resolve
    implementation "io.insert-koin:koin-core:$koin"
    implementation "io.insert-koin:koin-android:$koin"
    implementation "io.insert-koin:koin-androidx-scope:$koin"
    implementation "io.insert-koin:koin-androidx-viewmodel:$koin"

    // Image libraries
    implementation "io.coil-kt:coil:$coil"
    implementation "com.github.bumptech.glide:glide:$glide"
    implementation "com.github.bumptech.glide:okhttp3-integration:$glide"
    //kapt "com.github.bumptech.glide:compiler:$glide"
    ksp("com.github.bumptech.glide:ksp:$glide")

    // Add the Firebase Crashlytics SDK.
    implementation 'com.google.firebase:firebase-analytics:22.0.2'

    //search
    implementation 'com.github.mirrajabi:search-dialog:1.1'

    //logs
    implementation 'com.jakewharton.timber:timber:4.7.1'

    //pickerImage
    implementation 'com.github.esafirm:android-image-picker:3.0.0-beta5'

    //preferences
    implementation("androidx.datastore:datastore-preferences:1.1.1")
    implementation 'androidx.datastore:datastore-core:1.1.1'


    // Compose
    /*  implementation(platform("androidx.compose:compose-bom:2024.02.01"))
      implementation("androidx.compose.ui:ui")
      implementation("androidx.compose.material:material")
      implementation("androidx.compose.runtime:runtime")
      implementation("androidx.activity:activity-compose:1.8.2")
      implementation("androidx.compose.ui:ui-graphics")
      implementation("androidx.compose.ui:ui-tooling-preview")*/
}
