apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: "com.diffplug.gradle.spotless"
apply plugin: "kotlin-kapt"

spotless {
    java {
        target "**/*.java"
        removeUnusedImports()
        googleJavaFormat()
    }
    kotlin {
        target "**/*.kt"
        ktlint("0.31.0")
        trimTrailingWhitespace()
        endWithNewline()
    }
}

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.android_academy.covid_19"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        buildConfigField "String", "BASE_URL", '"http://ec2-52-23-173-222.compute-1.amazonaws.com:8080"'
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation":
                                     "$projectDir/schemas".toString()]
            }
        }
    }

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

    kotlinOptions {
        jvmTarget = "1.8"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

}

dependencies {
    def koin = "2.0.1"
    def roomVersion = "2.2.4"
    def loggingInterceptor = "3.9.1"
    def retrofit = "2.7.2"
    def timber = "4.7.1"
    def joda = "2.10.3"

    debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.4'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.4'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
    implementation 'com.google.android.gms:play-services-maps:17.0.0'

    implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01'
    implementation 'com.google.firebase:firebase-analytics:17.2.3'

    implementation 'com.google.android.material:material:1.2.0-alpha05'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'


    /* Network */
    implementation "com.squareup.retrofit2:retrofit:$retrofit"
    implementation("com.squareup.okhttp3:logging-interceptor:$loggingInterceptor") {
        exclude module: "okhttp"
    }

    implementation("com.squareup.retrofit2:converter-gson:$retrofit") {
        exclude module: "okhttp"
    }

    /* Workmanager */
    implementation "android.arch.work:work-runtime-ktx:2.3.2"

    /* Location */
    implementation "com.google.android.gms:play-services-location:17.0.0"
    implementation 'com.github.quickpermissions:quickpermissions-kotlin:0.4.0'
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.0-alpha01'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-alpha01'
    implementation 'com.google.maps.android:android-maps-utils:1.0.0'


    /* Koin */
    implementation "org.koin:koin-java:$koin"
    implementation "org.koin:koin-test:$koin"
    implementation "org.koin:koin-android:$koin"
    implementation "org.koin:koin-androidx-scope:$koin"
    implementation "org.koin:koin-androidx-viewmodel:$koin"

    implementation 'com.google.androidbrowserhelper:androidbrowserhelper:1.1.0'

    /* Room DB */
    implementation "androidx.room:room-runtime:$roomVersion"
    kapt "androidx.room:room-compiler:$roomVersion"
    implementation "androidx.room:room-ktx:$roomVersion"

    /* Logger */
    implementation "com.jakewharton.timber:timber:$timber"

    /* Date Time*/
    implementation 'com.github.Jay-Goo:RangeSeekBar:v3.0.0'
    implementation "net.danlew:android.joda:$joda"

    /* Responsive text size*/
     implementation 'com.intuit.ssp:ssp-android:1.0.6'

}
