apply plugin: 'com.android.application'

if (!project.hasProperty("disable-performance-plugin")) {
    apply plugin: 'com.google.firebase.firebase-perf'
}

apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'

android {

    def appVersionCode = 412
    def appVersionName = '1.38.02'

    signingConfigs {
        release {
            keyAlias 'wms key'
            keyPassword 'inpmiy'
            storeFile file('Integry.jks')
            storePassword 'inpmiy'

            enableV3Signing true
            enableV4Signing true
        }
    }

    applicationVariants.configureEach { variant ->
        variant.outputs.configureEach { output ->
            output.outputFileName = "android-release.apk"
        }
    }

    defaultConfig {
        applicationId "it.integry.integrywmsnative"
        minSdkVersion 21
        targetSdkVersion 34
        versionCode appVersionCode
        versionName appVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        signingConfig signingConfigs.release

        javaCompileOptions {
            annotationProcessorOptions {
                arguments += ["room.schemaLocation":
                                      "$projectDir/schemas".toString()]
            }
        }
    }

    buildTypes {
        debug {
            ext.enableCrashlytics = false
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }

    android.buildFeatures.dataBinding true
    android.buildFeatures.buildConfig true

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
        coreLibraryDesugaringEnabled true
    }

    productFlavors {
    }


    build {
        doLast {
            delete "$projectDir/build/outputs/apk/release/version.txt"
            file("$projectDir/build/outputs/apk/release/version.txt").text = appVersionCode + '\n' + appVersionName
        }
    }

    gradle.projectsEvaluated {
        tasks.withType(JavaCompile.class) {
            options.compilerArgs << "-Xmaxerrs" << "10000"
        }
    }
    lint {
        abortOnError false
    }
    namespace 'it.integry.integrywmsnative'
    compileSdk 34
}

dependencies {
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.github.lupaulus:logger:2.3.2'

    //Firebase

    // Import the Firebase BoM
    implementation platform('com.google.firebase:firebase-bom:29.1.0')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-core'
    implementation 'com.google.firebase:firebase-crashlytics'
    implementation 'com.google.firebase:firebase-perf'
    implementation 'com.google.android.gms:play-services-basement:18.2.0'


    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.10.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.3.2'

    implementation('androidx.preference:preference-ktx:1.2.1') {
        exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel'
        exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx'
    }

    implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
    implementation 'com.squareup.okhttp3:okhttp:4.10.0'
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.annimon:stream:1.2.2'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
//    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'org.apache.commons:commons-text:1.9'

    //MVVM
    def dagger2_version = '2.46.1'
    api "com.google.dagger:dagger:$dagger2_version"
    annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version"
    api "com.google.dagger:dagger-android:$dagger2_version"
    api "com.google.dagger:dagger-android-support:$dagger2_version"
    // if you use the support libraries
    annotationProcessor "com.google.dagger:dagger-android-processor:$dagger2_version"

    //FAB
    implementation 'com.github.clans:fab:1.6.4'
    //CUSTOM VIEWS
    implementation 'com.github.NaimishTrivedi:FBToast:1.0'
    implementation 'com.github.cachapa:ExpandableLayout:2.9.2'
    implementation 'com.github.frankiesardo:linearlistview:1.0.1@aar'
    implementation 'com.github.fede87:StatusBarAlert:1.0.1'
    implementation 'com.github.zhukic:sectioned-recyclerview:1.2.3'
    implementation 'com.github.pedromassango:doubleClick:3.0'

    //SQLite ROOM
    def room_version = "2.6.1"

    implementation "androidx.room:room-runtime:$room_version"
    annotationProcessor "androidx.room:room-compiler:$room_version"
    implementation "androidx.room:room-rxjava3:$room_version"

    //AppUpdate
    implementation 'com.github.javiersantos:AppUpdater:2.7'

    //Barcode
    implementation project(':pointmobilescannerlibrary')
    implementation project(':zebrascannerlibrary')
    implementation project(':barcode_base_android_library')
    implementation project(':honeywellscannerlibrary')
    implementation project(':keyobardemulatorscannerlibrary')


    implementation 'com.github.RaviKoradiya:LiveAdapter:1.3.4'

    // Required -- JUnit 4 framework
//    testImplementation "org.junit.jupiter:junit-jupiter-api:5.8.1"
//    androidTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
//    androidTestImplementation 'org.testng:testng:7.4.0'


    //Bluetooth device manager
    implementation 'com.github.harry1453:android-bluetooth-serial:v1.1'

    // RxJava is also required.
    implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
}

repositories {
    mavenCentral()
    google()
    maven { url 'https://jitpack.io' }
}
