buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
        maven { url 'https://maven.fabric.io/public' }
        jcenter()
    }

    dependencies {
        classpath "com.hiya:jacoco-android:0.2"
    }
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'com.hiya.jacoco-android'
apply from: '../../FiremaplesAndroidSign/playstore_sign.gradle'

repositories {
    mavenCentral()
}

android {
    packagingOptions {
        exclude 'META-INF/main.kotlin_module'
    }
    compileSdkVersion 29
    buildToolsVersion '29.0.3'
    defaultConfig {
        applicationId "tw.firemaples.onscreenocr"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 71
        versionName "2.4.8"
    }
    buildTypes {
//        debug {
//            minifyEnabled true
//            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    //https://gist.github.com/keyboardsurfer/a6a5bcf2b62f9aa41ae2
//    applicationVariants.all { variant ->
//        if (variant.buildType.isDebuggable()) {
//            def flavor = variant.mergedFlavor
//            def name = flavor.getVersionName()
//            def versionName = name + '-debug'
//            flavor.versionName = versionName;
//            flavor.applicationId = 'tw.firemaples.onscreenocr_debug'
//        }
//    }
    flavorDimensions "tier"
    productFlavors {
        dev {
            dimension "tier"
            applicationId "tw.firemaples.onscreenocr_debug"
            versionCode 100
            versionName "10.0.0"
        }
        prod {
            dimension "tier"
            signingConfig signingConfigs.playStore
        }
    }
    // Instead, use the bundle block to control which types of configuration APKs
    // you want your app bundle to support.
    bundle {
        language {
            // Specifies that the app bundle should not support
            // configuration APKs for language resources. These
            // resources are instead packaged with each base and
            // dynamic feature APK.
            enableSplit = false
        }
        density {
            // This property is set to true by default.
            enableSplit = true
        }
        abi {
            // This property is set to true by default.
            enableSplit = false
        }
    }
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}

dependencies {
    implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
    implementation platform('com.google.firebase:firebase-bom:26.1.0')
    implementation 'com.google.firebase:firebase-crashlytics'
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-core'
    implementation 'com.google.firebase:firebase-config'
    implementation 'com.google.firebase:firebase-perf'

    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.annotation:annotation:1.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
    implementation 'com.rmtheis:tess-two:9.0.0'
    implementation 'com.muddzdev:styleabletoast:2.1.2'
    implementation 'io.github.firemaples:microsoft-translator-java-api:0.8.8'
    //noinspection GradleDependency // The newer version of exoplayer using the androidx
    implementation 'com.google.android.exoplayer:exoplayer:2.9.5'
    implementation 'com.amitshekhar.android:android-networking:1.0.2'
    implementation 'com.facebook.stetho:stetho:1.5.0'
    implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
    //    implementation 'com.loopj.android:android-async-http:1.4.9'
    testImplementation 'junit:junit:4.12'
    //For logger
    implementation 'com.github.tony19:logback-android-core:1.1.1-4'
    implementation('com.github.tony19:logback-android-classic:1.1.1-4') {
        exclude(group: 'xpp3', module: 'xpp3')
        exclude group: 'com.google.android'
    }
    implementation 'org.slf4j:slf4j-api:1.7.25'
    implementation 'org.greenrobot:eventbus:3.1.1'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'

    // ML Kit Text Translate
    implementation 'com.google.mlkit:translate:16.1.1'

    // ML Kit Text Recognition
    implementation 'com.google.android.gms:play-services-mlkit-text-recognition:16.1.1'
}

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