import java.text.SimpleDateFormat
import java.util.Locale

plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.kotlin.android)
    id("com.google.gms.google-services")
    id("com.google.firebase.crashlytics")
}

android {
    namespace = "com.base.appzxhy"
    compileSdk = 34

    defaultConfig {
        //只有这个pkg可以播放
        applicationId = "com.example.dramasdk"
        minSdk = 24
        targetSdk = 34
        versionCode = 1
        versionName = "1.0"
        multiDexEnabled = true

        ndk {
            abiFilters.addAll(listOf("arm64-v8a", "armeabi-v7a"))
        }
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        fun Long.toFormatTime3(): String {
            return SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.ENGLISH).format(this)
        }
        setProperty("archivesBaseName", "appzxhy-v$versionName($versionCode)-${System.currentTimeMillis().toFormatTime3()}")

        signingConfigs {
            create("release") {
                //E6:A2:DD:0A:E6:73:22:32:4E:98:08:78:73:29:01:C4:8D:A0:38:DB:D8:B2:DD:B9:AC:55:69:B2:6B:DF:B0:B4
                storeFile = file("../smartcl.jks")
                storePassword = "123456"
                keyAlias = "key0"
                keyPassword = "123456"
            }
        }
    }

    buildTypes {
        release {
            isMinifyEnabled = true
            proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
            // 设置是否要自动上传
            firebaseCrashlytics {
                mappingFileUploadEnabled = true
            }
            signingConfig = signingConfigs.getByName("release")
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }

    buildFeatures {
        viewBinding = true
        buildConfig = true
    }

}
gradle.taskGraph.whenReady {
    tasks.forEach { task ->
        if (task.name.contains("uploadCrashlyticsMappingFile")) {
            task.enabled = false
        }
    }
}
dependencies {

    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.appcompat)
    implementation(libs.material)
    implementation(libs.androidx.activity)
    implementation(libs.androidx.constraintlayout)
    implementation(libs.androidx.navigation.fragment.ktx)
    implementation(libs.androidx.navigation.ui.ktx)
    implementation(libs.androidx.palette.ktx)
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.junit)
    androidTestImplementation(libs.androidx.espresso.core)
    implementation("androidx.multidex:multidex:2.0.1")


    //glide
    implementation("com.github.bumptech.glide:glide:4.16.0")

    //网络请求
    implementation("com.google.code.gson:gson:2.11.0")
    implementation("com.squareup.okhttp3:okhttp:4.2.1")

    // 语种切换框架：https://github.com/getActivity/MultiLanguages
    implementation("com.github.getActivity:MultiLanguages:9.3")
    // 沉浸式状态栏，基础依赖包，必须要依赖
    api(libs.immersionbar)
    // 沉浸式状态栏kotlin扩展（可选）
    api(libs.immersionbar.ktx)


    //solar 归因
    implementation("com.reyun.solar.engine.oversea:solar-engine-core:1.2.8.3")

    //第三方UI控件
    implementation("io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.1.4")
    implementation("com.github.zhpanvip:bannerviewpager:3.5.12")
    implementation("com.github.angcyo.DslTablayout:TabLayout:3.6.4")
    implementation("com.github.angcyo.DslTablayout:ViewPager2Delegate:3.6.4")
    implementation("io.github.litao0621:nifty-slider:2.0.2")
    implementation("io.github.razerdp:BasePopup:3.2.1")
    implementation("com.github.Dimezis:BlurView:version-2.0.6")
    implementation("de.hdodenhof:circleimageview:3.1.0")

    //firebase
    implementation(platform("com.google.firebase:firebase-bom:32.3.1"))
    implementation("com.google.firebase:firebase-messaging")
    implementation("com.google.firebase:firebase-messaging-directboot")
    implementation("com.google.firebase:firebase-analytics-ktx")
    implementation("com.google.firebase:firebase-crashlytics")
    implementation("com.google.firebase:firebase-config")

    //facebook
    implementation("com.facebook.android:facebook-android-sdk:[8,9)")

    //广告
    //admob渠道
    implementation(libs.vungle)
    implementation(libs.facebook)
    implementation(libs.mintegral)
    implementation(libs.pangle)
    //applovin sdk
    implementation(libs.applovin)
    //applovin渠道
    implementation(libs.applovin.google)
    implementation(libs.applovin.admob)
    implementation(libs.applovin.facebook) //meta
    implementation(libs.applovin.mintegral)//mintegral
    implementation(libs.applovin.pangle) //pangle
    implementation(libs.applovin.vungle) //vungle

    //work
    implementation("androidx.work:work-runtime-ktx:2.7.1") // 请使用最新版本

    //短剧依赖的sdk:
    //aar
    implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.aar"))))
    // APM
    implementation("com.pangle.global:crash_monitor:1.3.8.22")
    // Pangle广告，便于测试信息流广告
    implementation("com.bytedanceapi:ttsdk-player_standard:1.42.300.1")
    //Pangle广告，便于测试信息流广告
    implementation("com.pangle.global:ads-sdk:6.2.0.4")
}