plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-kapt'
    id 'com.google.dagger.hilt.android'
    id 'kotlinx-serialization'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.rdiot.yx485"
        minSdk 23
        targetSdk 32
        versionCode 6
        versionName "1.1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
        release {
            storeFile file('yx485.jks')
            storePassword "yx485123456"
            keyAlias 'yx485'
            keyPassword "yx485123456"
        }
    }

    namespace 'com.rdiot.yx485'

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

            applicationVariants.all { variant ->
                variant.outputs.all {
                    println(variant)
                    outputFileName = "RD-YX485-${buildType.name}-${defaultConfig.versionName}-${releaseTime()}.apk"
                }
            }
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }

    dataBinding {
        enabled true
    }
}


dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.7.1'
    implementation 'com.google.android.material:material:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'

    // ViewModel
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.5.1"
    implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.5.1"
    implementation "androidx.activity:activity-ktx:1.5.1"
    implementation "androidx.fragment:fragment-ktx:1.3.0"

    // Hilt
    implementation "com.google.dagger:hilt-android:2.44"
    kapt "com.google.dagger:hilt-compiler:2.44"


    // navigation
    implementation("androidx.navigation:navigation-fragment-ktx:2.5.3")
    implementation("androidx.navigation:navigation-ui-ktx:2.5.3")

    // 状态栏 https://github.com/gyf-dev/ImmersionBar
    // 基础依赖包，必须要依赖
    implementation 'com.geyifeng.immersionbar:immersionbar:3.2.2'
    // kotlin扩展（可选）
    implementation 'com.geyifeng.immersionbar:immersionbar-ktx:3.2.2'

    // PageView https://github.com/ckrgithub/PageRecyclerView/blob/master/README-ZH.md
    implementation project(path: ':pageview')

    // 弧形控制 https://github.com/jenly1314/ArcSeekBar
    implementation project(path: ':arcseekbar')

    // net https://liangjingkanji.github.io/Net/
    implementation 'com.squareup.okhttp3:okhttp:4.10.0' // 要求OkHttp4以上
    implementation 'com.github.liangjingkanji:Net:3.5.3'
    implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2" // JSON序列化库
    implementation 'com.google.code.gson:gson:2.9.0' // JSON序列化库, 会导致kotlin默认值无效, 故不推荐
    implementation 'com.github.liangjingkanji:Tooltip:1.2.2'
    // BRV https://github.com/liangjingkanji/BRV
    implementation 'com.github.liangjingkanji:BRV:1.3.88'
    implementation 'com.google.android.flexbox:flexbox:3.0.0'// flexbox伸缩(流式)布局
    implementation 'com.github.liangjingkanji:Net:3.6.4'

    //日志记录器
    implementation 'com.localebro:okhttpprofiler:1.0.8'

    //Serialize https://github.com/liangjingkanji/Serialize
    implementation 'com.github.liangjingkanji:Serialize:1.3.2'

    //分段SeekBar https://github.com/Jay-Goo/RangeSeekBar
    implementation project(path: ':RangeSeekBar')

    //BLE库 https://github.com/Jasonchenlijian/FastBle
    implementation project(path: ':FastBleLib')

    //Permission X https://github.com/guolindev/PermissionX
    implementation 'com.guolindev.permissionx:permissionx:1.7.1'

    //LiveEventBus https://github.com/JeremyLiao/LiveEventBus
    implementation 'io.github.jeremyliao:live-event-bus-x:1.8.0'

    //Dialog https://github.com/lindroy/iOSDialog
    implementation 'com.github.lindroy:iOSDialog:1.0.0'

    //ZXingLite https://github.com/jenly1314/ZXingLite
    implementation 'com.github.jenly1314:zxing-lite:2.2.1'

    //Glide  https://muyangmin.github.io/glide-docs-cn/
    implementation("com.github.bumptech.glide:glide:4.12.0") {
        exclude group: "com.android.support"
    }

    //picker https://github.com/gzu-liyujiang/AndroidPicker
    implementation 'com.github.gzu-liyujiang.AndroidPicker:Common:4.1.11'
    implementation 'com.github.gzu-liyujiang.AndroidPicker:ImagePicker:4.1.11'
    implementation 'com.github.gzu-liyujiang.AndroidPicker:WheelPicker:4.1.11'

    implementation 'com.github.JessYanCoding:AndroidAutoSize:v1.2.1'
    implementation  'com.github.lzyzsd:jsbridge:1.0.5'
}

// Allow references to generated code
kapt {
    correctErrorTypes true
}

static def releaseTime() {
    return new Date().format("MM-dd_HHmmss", TimeZone.getTimeZone("Asia/Shanghai"))
}