apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

// Apply the Crashlytics Gradle plugin
apply plugin: 'com.google.firebase.crashlytics'

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

apply plugin: 'realm-android'

def apikeyPropertiesFile = rootProject.file("apikey.properties")
def apikeyProperties = new Properties()
apikeyProperties.load(new FileInputStream(apikeyPropertiesFile))

android {

    compileSdkVersion 30
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.tommasoberlose.anotherwidget"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode 136
        versionName "2.3.2"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        buildConfigField("String", "GOOGLE_API_KEY", apikeyProperties['GOOGLE_API_KEY'])

        renderscriptSupportModeEnabled true
    }

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

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8.toString()
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
    }

    buildFeatures {
        dataBinding = true
        viewBinding = true
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

    // UI
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.browser:browser:1.3.0'
    implementation 'net.idik:slimadapter:2.1.2'
    implementation 'com.google.android:flexbox:2.0.1'
    implementation 'com.kyleduo.switchbutton:library:2.0.3'

    // Lifecycle
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

    implementation "androidx.work:work-runtime-ktx:2.5.0"

    // EventBus
    implementation 'org.greenrobot:eventbus:3.2.0'

    // Navigation
    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
    implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'

    // Other
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'net.danlew:android.joda:2.10.9'
    implementation 'me.everything:providers-android:1.0.1'
    implementation 'com.github.warkiz.widget:indicatorseekbar:2.1.2'

    //Glide
    implementation 'com.github.bumptech.glide:glide:4.12.0'
    kapt 'com.github.bumptech.glide:compiler:4.11.0'

    // Fitness
    implementation 'com.google.android.gms:play-services-fitness:20.0.0'
    implementation 'com.google.android.gms:play-services-auth:19.0.0'

    //Weather
    implementation 'com.github.KwabenBerko:OpenWeatherMap-Android-Library:2.0.2'
    implementation 'com.google.android.gms:play-services-location:18.0.0'

    // Billing
    implementation 'com.android.billingclient:billing:3.0.3'
    implementation 'com.android.billingclient:billing-ktx:3.0.3'

    // KTX
    implementation "androidx.core:core-ktx:1.3.2"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
    implementation "androidx.palette:palette-ktx:1.0.0"
    implementation 'androidx.core:core-ktx:1.3.2'

    //Retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
    implementation "com.github.haroldadmin:NetworkResponseAdapter:4.0.1"

    //Coroutines
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'

    // Add the Firebase SDK for Crashlytics.
    implementation 'com.google.firebase:firebase-crashlytics:17.4.1'

    // Preferences
    implementation 'com.chibatching.kotpref:kotpref:2.13.1'
    implementation 'com.chibatching.kotpref:livedata-support:2.13.1'
    implementation 'androidx.preference:preference-ktx:1.1.1'

    // Permissions
    implementation 'com.karumi:dexter:6.2.1'

    // Fonts
    implementation 'com.github.firatkarababa:downloadable-font-list-library:1.0.2'
}
