apply plugin: 'com.android.application'

android {
    compileSdkVersion 33
    defaultConfig {
        applicationId "com.adafruit.bluefruit.le.connect"
        minSdkVersion 27
        targetSdkVersion 33
        versionCode 51
        versionName "3.5.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        resValue "string", "app_name", "Bluefruit Connect"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    buildTypes {
        beta {
            initWith debug

            applicationIdSuffix ".beta"
            resValue "string", "app_name", "BlueConnect Beta"
        }

        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    androidResources {
        noCompress 'zip'
    }
    namespace 'com.adafruit.bluefruit.le.connect'
}

dependencies {
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    // Support library
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.9.0'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
    implementation 'androidx.recyclerview:recyclerview:1.3.0'
    implementation 'androidx.percentlayout:percentlayout:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'

    // Google Play Services
    implementation 'com.google.android.gms:play-services-base:18.2.0'
    implementation 'com.google.android.gms:play-services-location:21.0.1'
    implementation 'com.google.android.gms:play-services-vision:20.1.3'

    // Needed to download files with SSL on Android 4.4
    implementation 'com.google.android.gms:play-services-auth:20.5.0'

    // Nordic
    implementation 'no.nordicsemi.android.support.v18:scanner:1.6.0'
    implementation 'no.nordicsemi.android:dfu:2.3.0'

    //  Architecture Components
    implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"

    implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"

    // Mqtt
    implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0'
    // Warning: Paho library is no longer compatible with Android 12+: https://github.com/eclipse/paho.mqtt.android/issues/485
    /*
    implementation(group: 'org.eclipse.paho', name: 'org.eclipse.paho.android.service', version: '1.1.1') {
        exclude module: 'support-v4'
    }*/
    implementation 'androidx.work:work-runtime:2.8.1'

    // Charts
    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'

    // Color Picker
    implementation 'com.larswerkman:HoloColorPicker:1.5'

    // LeakCanary
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'

    // FileProvider
    implementation 'com.commonsware.cwac:provider:0.5.3'

    // Image Crop
    implementation "com.naver.android.helloyako:imagecropview:1.2.4"

    //
    testImplementation 'junit:junit:4.13.2'


    // Fix kotlin-stdlib duplicate class errors: https://stackoverflow.com/questions/75263047/duplicate-class-in-kotlin-android
    constraints {
        implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0") {
            because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib")
        }
        implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0") {
            because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib")
        }
    }
}
