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

plugins {
    alias(libs.plugins.android.application)
    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().apply {
    load(FileInputStream(keystorePropertiesFile))
}
android {
    namespace = "com.wall.exquisite.wallpaper"
    compileSdk = 36

    defaultConfig {
        applicationId = "com.wall.exquisite.wallpaper"
        minSdk = 24
        targetSdk = 36
        versionCode = 3
        versionName = "2.1"
        setProperty("archivesBaseName","Wallpaper Exquisite_v"+versionName+"(${versionCode})_$timestamp")
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
        create("release") {
            storeFile = file(keystoreProperties["keystoreFile"] as String)
            storePassword = keystoreProperties["key_store_password"] as String
            keyAlias = keystoreProperties["key_alias"] as String
            keyPassword = keystoreProperties["key_password"] as String
        }
    }

    buildTypes {
        release {
            isMinifyEnabled = true
            signingConfig = signingConfigs.getByName("release")
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }

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

    buildFeatures {
      viewBinding = true
    }
}

dependencies {
    implementation(libs.appcompat)
    implementation(libs.material)
    implementation("androidx.activity:activity:1.10.0")
    implementation(libs.constraintlayout)
    testImplementation(libs.junit)
    androidTestImplementation(libs.ext.junit)
    androidTestImplementation(libs.espresso.core)

    // 图片加载库
    implementation("com.github.bumptech.glide:glide:4.16.0")
    annotationProcessor("com.github.bumptech.glide:compiler:4.16.0")

    // JSON解析
    implementation("com.google.code.gson:gson:2.10.1")

    // 其他UI组件
    implementation("androidx.viewpager2:viewpager2:1.0.0")
    implementation("androidx.recyclerview:recyclerview:1.3.2")
    // 图片缩放库（必加，否则无法缩放大图）
//    implementation("com.github.chrisbanes:PhotoView:2.3.0")


    implementation("androidx.core:core-ktx:1.12.0")
    implementation("androidx.appcompat:appcompat:1.6.1")

    // 新增：Glide Transform扩展（用于圆角变换）
    implementation ("jp.wasabeef:glide-transformations:4.3.0")

    implementation ("androidx.constraintlayout:constraintlayout:2.1.4")

    implementation(files("libs/UpLoadLibrary_12_03_15_13-release.aar"))
    implementation ("com.squareup.okhttp3:okhttp:4.12.0")
    implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")

    implementation ("com.google.android.gms:play-services-ads-identifier:18.0.1")


    //firebase
    implementation(platform("com.google.firebase:firebase-bom:33.7.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")
}