import java.io.FileInputStream
import java.util.Date
import java.text.SimpleDateFormat
import java.util.Properties

plugins {
    id("com.android.application")
    id("org.jetbrains.kotlin.android")
    id("io.objectbox")
    kotlin("kapt")
    id("com.google.gms.google-services")
    id("com.google.firebase.crashlytics")
}
// 生成时间戳（保持原有格式，但后续文件名中不包含特殊字符）
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
val keystorePropertiesFile = rootProject.file("keystore.properties")
val keystoreProperties = Properties()
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}

android {
    namespace = "com.snap.wall"
    compileSdk = 36

    defaultConfig {
        applicationId = "com.snap.wall"
        minSdk = 24
        targetSdk = 36
        versionCode = 3
        versionName = "1.2"

        setProperty("archivesBaseName", "SnapWall_V" + versionName + "(${versionCode})_$timestamp")

        testInstrumentationRunner = "androidx.live.runner.AndroidJUnitRunner"
    }
    signingConfigs {
        create("release") {
            if (keystorePropertiesFile.exists()) {
                keyAlias = keystoreProperties["key_alias"] as String
                keyPassword = keystoreProperties["key_password"] as String
                storeFile = file(keystoreProperties["keystoreFile"] as String)
                storePassword = keystoreProperties["key_store_password"] as String
            }
        }
    }
    buildTypes {
        release {
            isMinifyEnabled = true
            signingConfig = signingConfigs.getByName("release")
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }

    buildFeatures {
        viewBinding = true
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }
}

dependencies {
    implementation("com.google.code.gson:gson:2.10.1")
    implementation("com.github.bumptech.glide:glide:5.0.5")
    implementation("androidx.activity:activity:1.12.0")
    kapt("com.github.bumptech.glide:compiler:4.16.0")
    implementation("androidx.appcompat:appcompat:1.7.1")
    implementation("com.google.android.material:material:1.11.0")
    implementation("androidx.constraintlayout:constraintlayout:2.2.1")
    implementation("androidx.test:monitor:1.8.0")
    implementation("androidx.test.ext:junit:1.3.0")
    testImplementation("junit:junit:4.13.2")
    implementation("jp.wasabeef:glide-transformations:4.3.0") // Glide图片变换库
    implementation("com.squareup.okhttp3:okhttp:5.3.1")





    implementation(platform("com.google.firebase:firebase-bom:34.6.0"))
    implementation("com.google.firebase:firebase-crashlytics")
    implementation("com.google.firebase:firebase-analytics")
    implementation("com.google.firebase:firebase-config")

    implementation(files("libs/IronSourceLibrary_01_07_18_13-release.aar"))

    //---------------------------ironSource
    implementation("com.unity3d.ads-mediation:mediation-sdk:9.2.0")
// Add BIGO Ads Network
    implementation("com.unity3d.ads-mediation:bigo-adapter:5.2.0")
    implementation("com.bigossp:bigo-ads:5.6.2")
// Add Chartboost Network
    implementation("com.unity3d.ads-mediation:chartboost-adapter:5.2.0")
//    implementation("com.chartboost:chartboost-sdk:9.10.2")

    implementation("com.chartboost:chartboost-sdk:9.8.3")
// Add DT Exchange Network
    implementation("com.unity3d.ads-mediation:fyber-adapter:5.2.0")
    implementation("com.fyber:marketplace-sdk:8.4.1")
// Add InMobi Network
    implementation("com.unity3d.ads-mediation:inmobi-adapter:5.3.0")
    implementation("com.inmobi.monetization:inmobi-ads-kotlin:11.1.0")
// Add Liftoff Monetize Network
    implementation("com.unity3d.ads-mediation:vungle-adapter:5.2.0")
    implementation("com.vungle:vungle-ads:7.6.1")
// Add Mintegral Network
    implementation("com.unity3d.ads-mediation:mintegral-adapter:5.3.0")
    implementation("com.mbridge.msdk.oversea:mbridge_android_sdk:17.0.31")
// Add Moloco Network
    implementation("com.unity3d.ads-mediation:moloco-adapter:5.5.0")
    implementation("com.moloco.sdk:moloco-sdk:4.3.1")
// Add Pangle Network
    implementation("com.unity3d.ads-mediation:pangle-adapter:5.4.0")
    implementation("com.pangle.global:pag-sdk:7.8.0.7")
// Add Unity Ads Network
    implementation("com.unity3d.ads-mediation:unityads-adapter:5.3.0")
    implementation("com.unity3d.ads:unity-ads:4.16.4")


}