apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'androidx.navigation.safeargs.kotlin'
apply plugin: 'dagger.hilt.android.plugin'

def localProperties = new Properties()
localProperties.load(new FileInputStream(rootProject.file("local.properties")))

android {
    compileSdkVersion 29
    buildToolsVersion "30.0.0"

    defaultConfig {
        applicationId "com.fabirt.roka"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode 3
        versionName "0.0.3"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        buildConfigField "String", "API_KEY", localProperties['apiKey']
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            signingConfig signingConfigs.debug
        }
    }

    buildFeatures {
        viewBinding true
        dataBinding true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$version_kotlin"
    implementation 'androidx.core:core-ktx:1.3.1'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
    implementation 'com.google.android.material:material:1.2.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation "androidx.recyclerview:recyclerview:1.2.0-alpha05"

    // Navigation
    implementation "androidx.navigation:navigation-fragment-ktx:$version_nav"
    implementation "androidx.navigation:navigation-ui-ktx:$version_nav"
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'

    // Glide image loading
    implementation "com.github.bumptech.glide:glide:$version_glide"

    // Coroutines
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version_kotlin_coroutines"

    // LiveData
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:$version_lifecycle"

    // ViewPager2 page indicator
    implementation 'com.tbuonomo.andrui:viewpagerdotsindicator:4.1.2'

    // Retrofit
    implementation "com.squareup.retrofit2:retrofit:$version_retrofit"
    implementation "com.squareup.retrofit2:converter-gson:$version_retrofit"

    // Loading Indicators
    implementation "com.github.ybq:Android-SpinKit:1.4.0"

    // Hilt
    implementation "com.google.dagger:hilt-android:$version_hilt"
    kapt "com.google.dagger:hilt-android-compiler:$version_hilt"
    implementation "androidx.hilt:hilt-lifecycle-viewmodel:$version_hilt_jetpack"
    kapt "androidx.hilt:hilt-compiler:$version_hilt_jetpack"

    // Room Database
    implementation "androidx.room:room-runtime:$version_room"
    kapt "androidx.room:room-compiler:$version_room"
    implementation "androidx.room:room-ktx:$version_room" // Kotlin Extensions and Coroutines support
    testImplementation "androidx.room:room-testing:$version_room" // Test helpers

    // Preferences DataStore
    implementation "androidx.datastore:datastore-preferences:$version_datastore"

    // Photo View
    implementation 'com.github.chrisbanes:PhotoView:2.0.0'

    // Paging
    implementation "androidx.paging:paging-runtime:$version_paging"

    // Play Core
    implementation 'com.google.android.play:core:1.8.0'
    implementation 'com.google.android.play:core-ktx:1.8.1'
}