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

plugins {
    alias(libs.plugins.androidApplication)
    alias(libs.plugins.jetbrainsKotlinAndroid)
    id("com.google.gms.google-services")
    id("com.google.firebase.crashlytics")
}

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

    defaultConfig {
        applicationId = "com.ttesst.gododo.redause"
        minSdk = 24
        targetSdk = 34
        versionCode = 2
        versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

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

    //第三方UI
    implementation("io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.1.4")
    implementation("com.github.angcyo.DslTablayout:TabLayout:3.5.5")
    implementation("com.github.angcyo.DslTablayout:ViewPager2Delegate:3.5.5")
    implementation("com.airbnb.android:lottie:6.4.0")
    implementation("com.github.pokercc:ExpandableRecyclerView:0.9.3")


    //mlkit
    implementation("com.google.android.gms:play-services-mlkit-document-scanner:16.0.0-beta1")

    //Pdf库
    implementation("com.tom-roush:pdfbox-android:2.0.27.0")
    api(project(":pdflibrary"))
//

    //Word库
    //PPT库
    //Excel库
    api(project(":library"))

    //广告
    implementation("com.google.android.gms:play-services-ads:23.1.0")
    implementation("com.google.ads.mediation:applovin:12.4.3.0")
    implementation("com.google.ads.mediation:facebook:6.17.0.0")
    implementation("com.google.ads.mediation:mintegral:16.7.21.0")
    implementation("com.google.ads.mediation:pangle:5.9.0.4.0")

    //ump
    implementation("com.google.android.ump:user-messaging-platform:3.0.0")

    //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-database-ktx")
//    implementation("com.google.firebase:firebase-config-ktx")


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

    //网络请求和解析
    implementation("com.google.code.gson:gson:2.11.0")
    // define a BOM and its version
    implementation(platform("com.squareup.okhttp3:okhttp-bom:4.12.0"))
    // define any required OkHttp artifacts without version
    implementation("com.squareup.okhttp3:okhttp")
    implementation("com.squareup.okhttp3:logging-interceptor")

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


}