apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 31
    buildToolsVersion "32.0.0"

    defaultConfig {
        applicationId "me.ranko.autodark"
        minSdkVersion 29
        targetSdkVersion 31
        versionCode 15
        versionName "3.0.5"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }

    buildFeatures {
        // Determines whether to support Data Binding.
        dataBinding = true
    }

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

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

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    testImplementation "junit:junit:$ver_junit"
    //debugImplementation "com.squareup.leakcanary:leakcanary-android:$ver_leak"

    // Support libraries
    implementation "androidx.activity:activity-ktx:$ver_activity"
    implementation "androidx.appcompat:appcompat:$ver_appcompat"
    implementation "androidx.preference:preference:$ver_preference"
    implementation "com.google.android.material:material:$ver_material"
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"

    // Android KTX
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$ver_kotlin"
    implementation "androidx.core:core-ktx:$ver_core"

    // Coroutines
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$ver_kotlin_coroutines"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$ver_kotlin_coroutines"
    testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$ver_kotlin_coroutines"

    // LiveData
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:$ver_lifecycle_extensions"
    // ViewModel
    implementation "androidx.lifecycle:lifecycle-common-java8:$ver_lifecycle_extensions"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$ver_lifecycle_extensions"
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:$ver_lifecycle_extensions"

    // Image libraries for DarkWallpaper feature
    implementation "com.github.bumptech.glide:glide:$ver_glide"
    kapt "com.github.bumptech.glide:compiler:$ver_glide"
    implementation ("com.github.bumptech.glide:recyclerview-integration:$ver_glide") {
        // Excludes the support library because it's already included by Glide.
        transitive = false
    }
    implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'

    // Logging
    implementation "com.jakewharton.timber:timber:$ver_timber"

    // Shizuku API
    implementation project(':api')
    implementation project(':aidl')
    implementation project(':provider')
    compileOnly project(':hidden-api-dark')

    // Simple License Display
    implementation "com.marcdonald:simplelicensedisplay:$ver_license"

    // Sunrise Sunset calculator
    implementation "com.luckycatlabs:SunriseSunsetCalculator:$ver_sunrise_cal"

    // Xposed Framework API dependencies
    compileOnly "de.robv.android.xposed:api:$ver_xposed"
    compileOnly "de.robv.android.xposed:api:$ver_xposed:sources"

    implementation "org.lsposed.hiddenapibypass:hiddenapibypass:$ver_hiddenapi"
}