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.scanqr"
    compileSdk = 34

    defaultConfig {
        applicationId = "com.tool.advanced.cleaner"
        minSdk = 24
        targetSdk = 34
        versionCode = 4
        versionName = "1.3"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

        fun Long.toFormatTime3(): String {
            return SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.ENGLISH).format(this)
        }
        setProperty("archivesBaseName", "scanQR-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
    }

}

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)
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.junit)
    androidTestImplementation(libs.androidx.espresso.core)

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

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


    //facebook
    implementation("com.facebook.android:facebook-android-sdk:[8,9)")
    //solar 归因
    implementation("com.reyun.solar.engine.oversea:solar-engine-core:1.2.8.3")


    //第三方UI控件
    implementation("io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.1.4")
    implementation("io.supercharge:shimmerlayout:2.1.0")
    implementation("com.github.Kunzisoft:Android-SwitchDateTimePicker:2.1")


    //机器学习二维码扫描
    implementation("com.google.mlkit:barcode-scanning:17.3.0")

    //相机
    val cameraxVersion = "1.2.2"
    implementation("androidx.camera:camera-core:${cameraxVersion}")
    implementation("androidx.camera:camera-camera2:${cameraxVersion}")
    implementation("androidx.camera:camera-view:${cameraxVersion}")
    implementation("androidx.camera:camera-lifecycle:${cameraxVersion}")


    val zxing = "3.5.0"
    implementation("com.google.zxing:core:$zxing")
//    implementation("com.google.zxing:android-integration:$zxing")
//    implementation("com.google.zxing:zxing-android-embedded:$zxing")

    //广告
    //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

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


    //冲突版本确定版本
    implementation("com.google.guava:guava:32.1.3-android")


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

