apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
// Apply the Crashlytics Gradle plugin
//apply plugin: 'com.google.gms.google-services'
//apply plugin: 'com.google.firebase.crashlytics'
android {

    compileSdkVersion 32
    signingConfigs {
        release {
            storeFile rootProject.file("evaluation-testing.jks")
            //storeFile file('D:\\Desktop\\evaluation-testing.jks')
            storePassword "123456"
            keyAlias = "gdt"
            keyPassword "123456"
        }
    }
    defaultConfig {
        applicationId "com.khmer9.sbcmain"
        minSdkVersion 21
        targetSdkVersion 32
        versionCode 1
        versionName "1.0.1"
        signingConfig signingConfigs.release
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        debug {
            manifestPlaceholders = [enableCrashlytic: false]
//            firebaseCrashlytics.mappingFileUploadEnabled false
            minifyEnabled false
            debuggable true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        release {
            manifestPlaceholders = [enableCrashlytic: false]
            shrinkResources false
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

// To inline the bytecode built with JVM target 1.8 into
// bytecode that is being built with JVM target 1.6. (e.g. navArgs)


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
    androidExtensions {
        experimental = true
    }
    packagingOptions {
        resources {
            excludes += ['META-INF/DEPENDENCIES', 'META-INF/LICENSE', 'META-INF/LICENSE.txt', 'META-INF/license.txt', 'META-INF/NOTICE', 'META-INF/NOTICE.txt', 'META-INF/notice.txt', 'META-INF/ASL2.0']
        }
    }
    flavorDimensions 'env'
    productFlavors {
        dev {
            dimension 'env'
            //applicationIdSuffix = ".dev"
            versionNameSuffix "-dev"
        }
        prod {
            dimension 'env'
        }
    }
    lint {
        abortOnError false
        checkReleaseBuilds false
    }
    applicationVariants.all { variant ->
        variant.outputs.all {
            //def formattedDate = new Date().format('yyyy-MM-dd HH-mm')

            def appName = "SBCMAIN"
            def appId = variant.applicationId
            def versionName = variant.versionName
            def versionCode = variant.versionCode
            def flavorName = variant.flavorName // e. g. free
            def buildType = variant.buildType // e. g. debug
            def variantName = variant.name // e. g. freeDebug

            def apkName = appName + '_' + variantName + '_' + versionName + '.apk'
            outputFileName = apkName
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'com.google.android.material:material:1.2.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.3'
    implementation 'androidx.navigation:navigation-ui-ktx:2.3.3'
    implementation 'androidx.recyclerview:recyclerview:1.2.1'
    implementation project(path: ':sunmiprinterutill')

    //Architecture components
    def lifecycle_version = "2.2.0"
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"

    //RxJava & RxAndroid
    implementation "io.reactivex.rxjava2:rxjava:2.2.18"
    implementation "io.reactivex.rxjava2:rxkotlin:2.4.0"
    implementation "io.reactivex.rxjava2:rxandroid:2.1.1"

    //Retrofit
    def retrofit_version = "2.9.0"
    implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version"
    implementation "com.squareup.retrofit2:converter-moshi:$retrofit_version"
    implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2'
    implementation 'com.itkacher.okhttpprofiler:okhttpprofiler:1.0.7'

    /*Json Serialize & Deserialize Library*/
    implementation("com.squareup.moshi:moshi-kotlin:1.9.2")
    kapt("com.squareup.moshi:moshi-kotlin-codegen:1.9.2")

    //Socket io client
    implementation('io.socket:socket.io-client:2.0.0') {
        exclude group: 'org.json', module: 'json'
    }

    //Logging helper
    implementation 'com.jakewharton.timber:timber:4.7.1'
    implementation 'com.google.code.gson:gson:2.8.6'

    //implementation 'com.github.mazenrashed:Printooth:1.2.2'
    //Lib
    implementation project(path: ':printooth')
    implementation 'com.squareup.picasso:picasso:2.71828'

    implementation 'nl.dionsegijn:konfetti:1.3.2'

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}