plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-kapt'
    id 'androidx.navigation.safeargs.kotlin'
    id 'dagger.hilt.android.plugin'
    id 'com.google.secrets_gradle_plugin' version '0.5'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.harukeyua.fintrack"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        javaCompileOptions {
            annotationProcessorOptions {
                arguments += [
                        "room.schemaLocation"  : "$projectDir/schemas".toString(),
                        "room.incremental"     : "true",
                        "room.expandProjection": "true"]
            }
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        coreLibraryDesugaringEnabled true
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        viewBinding true
        dataBinding true
    }
}

dependencies {
    def lifecycle_version = "2.3.0"
    def paging_version = '3.0.0-beta02'
    def work_version = "2.5.0"
    def room_version = '2.3.0-beta03'
    def moshi_version = "1.11.0"
    def retrofit_version = "2.9.0"
    def recyclerview_version = "1.2.0-beta02"
    def coroutines_version = "1.4.2"
    def constraint_version = "2.0.4"
    def material_version = "1.3.0"
    def core_ktx_version = "1.3.2"
    def appcompat_version = "1.2.0"
    def viewpager2_version = "1.0.0"
    def hiltViewModel_version = "1.0.0-alpha03"
    def gmsLocation_version = "18.0.0"
    def activity_version = "1.2.1"
    def maps_version = "17.0.1"
    def places_version = "2.4.0"
    def mpachart_version = "v3.1.0"
    def crypto_version = "1.1.0-alpha03"
    def logging_interceptor_version = "5.0.0-alpha.2"
    def hilt_worker_version = "1.0.0-beta01"

    implementation "com.github.PhilJay:MPAndroidChart:$mpachart_version"

    // Location services
    // KTX for the Maps SDK for Android library
    implementation 'com.google.maps.android:maps-ktx:3.0.0'

    // KTX for the Maps SDK for Android Utility Library
    implementation 'com.google.maps.android:maps-utils-ktx:3.0.0'
    implementation "com.google.android.gms:play-services-location:$gmsLocation_version"
    implementation "com.google.android.gms:play-services-maps:$maps_version"
    implementation "com.google.android.libraries.places:places:$places_version"

    implementation 'com.android.volley:volley:1.2.0'

    implementation "androidx.activity:activity-ktx:$activity_version"

    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation "androidx.core:core-ktx:$core_ktx_version"
    implementation "androidx.appcompat:appcompat:$appcompat_version"
    implementation "com.google.android.material:material:$material_version"
    implementation "androidx.constraintlayout:constraintlayout:$constraint_version"
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
    implementation "androidx.viewpager2:viewpager2:$viewpager2_version"
    implementation "androidx.security:security-crypto:$crypto_version"

    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"

    implementation "androidx.recyclerview:recyclerview:$recyclerview_version"

    // Lifecycle
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"

    // Paging
    implementation "androidx.paging:paging-runtime-ktx:$paging_version"

    // Work manager
    implementation "androidx.work:work-runtime-ktx:$work_version"

    // Navigation
    implementation "androidx.navigation:navigation-runtime-ktx:$rootProject.nav_version"
    implementation "androidx.navigation:navigation-fragment-ktx:$rootProject.nav_version"
    implementation "androidx.navigation:navigation-ui-ktx:$rootProject.nav_version"

    // Room
    implementation "androidx.room:room-runtime:$room_version"
    kapt "androidx.room:room-compiler:$room_version"
    implementation "androidx.room:room-ktx:$room_version"

    // Hilt di
    implementation "com.google.dagger:hilt-android:$hilt_version"
    implementation "androidx.hilt:hilt-lifecycle-viewmodel:$hiltViewModel_version"
    implementation "androidx.hilt:hilt-work:$hilt_worker_version"
    kapt "com.google.dagger:hilt-compiler:$hilt_version"
    kapt "androidx.hilt:hilt-compiler:$hiltViewModel_version"

    // Moshi
    implementation "com.squareup.moshi:moshi:$moshi_version"
    kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"

    // Retrofit
    implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
    implementation "com.squareup.retrofit2:converter-moshi:$retrofit_version"
    implementation "com.squareup.okhttp3:logging-interceptor:$logging_interceptor_version"


    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    testImplementation "androidx.room:room-testing:$room_version"
    androidTestImplementation 'androidx.test:core:1.3.0'
    androidTestImplementation 'androidx.test:runner:1.3.0'
    androidTestImplementation 'androidx.test:rules:1.3.0'
    androidTestImplementation "androidx.arch.core:core-testing:2.1.0"

    // Assertions
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.ext:truth:1.3.0'
    androidTestImplementation 'com.google.truth:truth:1.1.2'
}

secrets {
    defaultPropertiesFileName 'local.defaults.properties'
}