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

    defaultConfig {
        applicationId = "com.base.locationsharewhite"
        minSdk = 24
        targetSdk = 34
        versionCode = 1
        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", "phone-tracker-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 = 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)
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.junit)
    androidTestImplementation(libs.androidx.espresso.core)


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

    //第三方UI
    implementation("io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.1.4")
    implementation("io.github.youth5201314:banner:2.2.3")
    implementation("de.hdodenhof:circleimageview:3.1.0")
    implementation("io.supercharge:shimmerlayout:2.1.0")

    //google地图
    implementation(libs.play.services.maps)
    //google位置服务
    implementation("com.google.android.gms:play-services-location:21.0.1")


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

    //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")

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


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

    // 语种切换框架：https://github.com/getActivity/MultiLanguages
    implementation("com.github.getActivity:MultiLanguages:9.3")
}