apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'org.jetbrains.kotlin.plugin.parcelize'

dependencies {
    api project(":app:ui:base")
    debugImplementation project(":app:ui:setup")
    implementation project(":app:core")
    implementation project(":app:autodiscovery:api")
    implementation project(":app:autodiscovery:providersxml")
    implementation project(":mail:common")

    //TODO: Remove AccountSetupIncoming's dependency on these
    compileOnly project(":mail:protocols:imap")
    compileOnly project(":mail:protocols:webdav")

    implementation project(':plugins:openpgp-api-lib:openpgp-api')

    implementation "androidx.appcompat:appcompat:${versions.androidxAppCompat}"
    implementation "androidx.preference:preference:${versions.androidxPreference}"
    implementation "com.takisoft.preferencex:preferencex:${versions.preferencesFix}"
    implementation "com.takisoft.preferencex:preferencex-datetimepicker:${versions.preferencesFix}"
    implementation "com.takisoft.preferencex:preferencex-colorpicker:${versions.preferencesFix}"
    implementation "androidx.recyclerview:recyclerview:${versions.androidxRecyclerView}"
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:${versions.androidxLifecycle}"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${versions.androidxLifecycle}"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:${versions.androidxLifecycle}"
    implementation "androidx.constraintlayout:constraintlayout:${versions.androidxConstraintLayout}"
    implementation "androidx.cardview:cardview:${versions.androidxCardView}"
    implementation "androidx.localbroadcastmanager:localbroadcastmanager:${versions.androidxLocalBroadcastManager}"
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
    implementation "de.cketti.library.changelog:ckchangelog-core:2.0.0-beta02"
    implementation "com.splitwise:tokenautocomplete:4.0.0-beta01"
    implementation "de.cketti.safecontentresolver:safe-content-resolver-v21:1.0.0"
    implementation 'com.mikepenz:materialdrawer:8.4.1'
    implementation 'com.mikepenz:materialdrawer-iconics:8.3.3'
    implementation 'com.mikepenz:fontawesome-typeface:5.9.0.0-kotlin@aar'
    implementation 'com.github.ByteHamster:SearchPreference:v2.0.0'
    implementation "com.mikepenz:fastadapter:${versions.fastAdapter}"
    implementation "com.mikepenz:fastadapter-extensions-drag:${versions.fastAdapter}"
    implementation "com.mikepenz:fastadapter-extensions-utils:${versions.fastAdapter}"
    implementation 'de.hdodenhof:circleimageview:3.1.0'

    implementation "commons-io:commons-io:${versions.commonsIo}"
    implementation "androidx.core:core-ktx:${versions.androidxCore}"
    implementation "net.jcip:jcip-annotations:1.0"
    implementation "com.jakewharton.timber:timber:${versions.timber}"
    implementation "org.apache.james:apache-mime4j-core:${versions.mime4j}"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinCoroutines}"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.kotlinCoroutines}"

    implementation "com.github.bumptech.glide:glide:${versions.glide}"
    annotationProcessor "com.github.bumptech.glide:compiler:${versions.glide}"

    testImplementation project(':mail:testing')
    testImplementation project(':app:storage')
    testImplementation project(':app:testing')
    testImplementation "org.robolectric:robolectric:${versions.robolectric}"
    testImplementation "androidx.test:core:${versions.androidxTestCore}"
    testImplementation "junit:junit:${versions.junit}"
    testImplementation "org.jetbrains.kotlin:kotlin-test:${versions.kotlin}"
    testImplementation "com.google.truth:truth:${versions.truth}"
    testImplementation "org.mockito:mockito-inline:${versions.mockito}"
    testImplementation "org.mockito.kotlin:mockito-kotlin:${versions.mockitoKotlin}"
    testImplementation "io.insert-koin:koin-test-junit4:${versions.koin}"
    testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:${versions.kotlinCoroutines}"
    testImplementation "app.cash.turbine:turbine:${versions.turbine}"
}

android {
    compileSdkVersion buildConfig.compileSdk
    buildToolsVersion buildConfig.buildTools

    defaultConfig {
        minSdkVersion buildConfig.minSdk
        targetSdkVersion buildConfig.robolectricSdk
    }

    buildTypes {
        debug {
            def useNewSetupUi = project.hasProperty('k9mail.useNewSetupUi') ? project.property('k9mail.useNewSetupUi') : "false"
            buildConfigField "boolean", "USE_NEW_SETUP_UI_FOR_ONBOARDING", useNewSetupUi
        }
        release {
            buildConfigField "boolean", "USE_NEW_SETUP_UI_FOR_ONBOARDING", "false"
        }
    }

    lintOptions {
        abortOnError false
        lintConfig file("$rootProject.projectDir/config/lint/lint.xml")
    }

    compileOptions {
        sourceCompatibility javaVersion
        targetCompatibility javaVersion
    }

    kotlinOptions {
        jvmTarget = kotlinJvmVersion
    }

    testOptions {
        unitTests {
            includeAndroidResources = true
        }
    }
}