plugins {
    alias(libs.plugins.androidApplication)
    alias(libs.plugins.jetbrainsKotlinAndroid)
    id 'kotlin-kapt'
    id 'kotlin-parcelize'
    id 'com.huawei.agconnect'
}

android {
    namespace 'com.cheng.blzb'
    compileSdk 34
    buildFeatures.buildConfig = true

    lintOptions{
        checkReleaseBuilds false
        abortOnError false
    }

    defaultConfig {
        applicationId "com.cheng.BoLe"
        minSdk 26
        targetSdk 34
        versionCode 270
        versionName "2.7.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
        ndk {
            abiFilters 'arm64-v8a'  //'armeabi-v7a'
        }
        multiDexEnabled true

        flavorDimensions = ["channel"]

        productFlavors {
            xiaomi {}
            oppo {}
            vivo {}
            huawei {}
            honor {}
            baidu {}
            yyb {}
            upgrade {}
            bd_tg {}
            dy_tg {}
            tx_tg {}
            ks_tg {}
            dd_tg {}
            sm_tg {}
            oc_tg {}
        }

        productFlavors.configureEach {
            dimension "channel"
            manifestPlaceholders = [UMENG_CHANNEL: name]
        }

        manifestPlaceholders = [
                GETUI_APPID       : "ej3hUPd0LR8G1CzkNtyZS3",
                GT_INSTALL_CHANNEL: "test",
                // 华为 相关应用参数
                HUAWEI_APP_ID     : "116691541",

                // 小米相关应用参数
                XIAOMI_APP_ID     : "2882303761520492130",
                XIAOMI_APP_KEY    : "5942049244130",

                // OPPO 相关应用参数
                OPPO_APP_KEY      : "14c5c2d077404b5f987e34f3d4fd2e97",
                OPPO_APP_SECRET   : "cfe7bd2037cf4f16aa1579ff6113d6c1",

                // VIVO 相关应用参数
                VIVO_APP_ID       : "106026636",
                VIVO_APP_KEY      : "be86ca063884357ff7eeb87a2de537d6",

                // 荣耀相关应用参数
                HONOR_APP_ID      : "104542383"
        ]
    }

    // 配置签名信息
    signingConfigs {
        config {
            storeFile file(RELEASE_STORE_FILE)
            storePassword RELEASE_STORE_PASSWORD
            keyAlias RELEASE_KEY_ALIAS
            keyPassword RELEASE_KEY_PASSWORD
            enableV1Signing true
            enableV2Signing true
            enableV3Signing true
        }
    }

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

    applicationVariants.configureEach { variant ->
        if (variant.buildType.name == "release") {
            variant.outputs.forEach {
                it.outputFileName = "bole_v${defaultConfig.versionName}_${variant.productFlavors[0].name}.apk"
            }

            variant.assembleProvider.get().doLast {
                copy {
                    variant.outputs.forEach { file ->
                        //移动到指定文件夹
                        ant.move file: file.outputFile,
                                todir: "${project.rootDir}/apk"
                    }
                }
            }

            variant.assembleProvider.get().doLast {
                android.buildTypes.each { buildType ->
                    file("build/outputs/apk/$buildType").listFiles().each { channelFolder ->
                        if (channelFolder.isDirectory() && channelFolder.getName() != outputApkFolder) {
                            delete(channelFolder)
                        }
                    }
                }
            }

        }

    }

    buildFeatures {
        viewBinding true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
    implementation project(':base')

    implementation libs.androidx.appcompat
    implementation libs.com.google.android.material.material
    implementation libs.androidx.constraintlayout.constraintlayout
    testImplementation libs.junit
    androidTestImplementation libs.androidx.junit
    androidTestImplementation libs.androidx.espresso.core

//    implementation "androidx.core:core-splashscreen:1.0.1"
    implementation 'com.jakewharton:disklrucache:2.0.2' // disklrucache

    // tabLayout
    implementation 'com.github.angcyo.DslTablayout:TabLayout:3.7.2'
    implementation 'com.github.angcyo.DslTablayout:ViewPager1Delegate:3.7.2'

    implementation 'com.github.FlyJingFish:GradientTextView:1.2.5' //渐变文字
    implementation 'com.github.aitsuki:SwipeMenuRecyclerView:2.1.5' // 侧滑菜单
    implementation 'com.github.chrisbanes:PhotoView:2.3.0'  //图片浏览
    implementation 'io.github.billywei01:fastaes:1.1.3'  //解密
    implementation 'com.github.gzu-liyujiang:Android_CN_OAID:4.2.12'  //获取手机设备id
    implementation 'com.google.android.flexbox:flexbox:3.0.0'  //recyclerview flexbox

    implementation files('libs/channelsdk-0.2.2.aar')  //快手分包
    implementation 'com.tencent.vasdolly:helper:3.0.4'  //腾讯分包
    implementation files('libs/humesdk-1.0.0.aar')  //巨量分包

    implementation 'com.getui:gysdk:3.1.7.0'  //一键认证sdk
    implementation 'com.getui:gtsdk:3.3.8.0'  // 推送sdk
    implementation 'com.getui:gtc:3.2.16.0'  //个推公共库，如已接其他个推sdk则保留一个最高版本即可

    // 根据所需厂商选择集成
    implementation 'com.getui.opt:hwp:3.1.2'   // 华为
    implementation 'com.getui.opt:xmp:3.3.3'   // 小米
    implementation 'com.assist-v3:oppo:3.5.0'  // oppo
    implementation 'com.assist-v3:vivo:3.2.0'  // vivo
    implementation 'com.getui.opt:honor:3.6.0' // 荣耀
    //华为厂商推送配置
    implementation 'com.huawei.hms:push:6.11.0.300'
    implementation 'com.huawei.agconnect:agconnect-core:1.9.1.300'
    //荣耀厂商推送配置
    implementation 'com.hihonor.mcs:push:7.0.61.303'
    //oppo厂商推送配置
    implementation 'commons-codec:commons-codec:1.6'

    //微信
    implementation 'com.tencent.mm.opensdk:wechat-sdk-android:+'
    //友盟
    implementation 'com.umeng.umsdk:common:+'// 必选
    implementation 'com.umeng.umsdk:asms:+'// 必选
    implementation 'com.umeng.umsdk:apm:+'// U-APM产品包依赖，必选
    implementation 'com.umeng.umsdk:share-core:+'//分享核心库，必选
    implementation 'com.umeng.umsdk:share-wx:+' //微信完整版

    implementation 'top.zibin:Luban:1.1.8'  //图片压缩
    implementation 'com.github.Dimezis:BlurView:version-2.0.6'  //毛玻璃效果
    implementation 'com.bytedance.ads:AppConvert:2.0.0'  //巨量融合
    implementation 'com.github.gzu-liyujiang.AndroidPicker:WheelPicker:4.1.14'  // 滚轮选择器
    implementation 'com.github.lihangleo2:ShadowLayout:3.4.1' //阴影布局
    implementation 'com.github.YvesCheung.RollingText:RollingText:1.3.0'  //数字滚动效果
    implementation 'com.tencent.tav:libpag:4.4.25'  //libpag动画加载
    //media3视频播放
    implementation "androidx.media3:media3-exoplayer:1.4.1"
    implementation "androidx.media3:media3-ui:1.4.1"
    implementation "androidx.media3:media3-common:1.4.1"
}