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

plugins {
    id("com.android.application")
    id ("org.jetbrains.kotlin.android")
    id("com.google.gms.google-services")
    id("com.google.firebase.crashlytics")
}

// 加载 keystore 配置
val keystorePropertiesFile = rootProject.file("keystore.properties")
val keystoreProperties = Properties()
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}

val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
android {
    namespace = "com.draw.painting.canvas"
    compileSdk = 36

    defaultConfig {
        //com.draw.painting.helper
        applicationId = "com.draw.painting.canvas"
        minSdk = 24
        targetSdk = 36
        versionCode = 2
        versionName = "1.1"
        setProperty("archivesBaseName", "Ar Canvas_V" + versionName + "(${versionCode})_$timestamp")
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
        create("release") {
            if (keystorePropertiesFile.exists()) {
                keyAlias = keystoreProperties["keyAlias"] as String
                keyPassword = keystoreProperties["keyPassword"] as String
                storeFile = file(keystoreProperties["storeFile"] as String)
                storePassword = keystoreProperties["storePassword"] as String
            }
        }
    }

    buildTypes {
        release {
            isMinifyEnabled = true
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
            signingConfig = signingConfigs.getByName("release")
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
    buildFeatures{
        viewBinding = true
    }
}

dependencies {

    implementation("androidx.appcompat:appcompat:1.7.1")
    implementation("com.google.android.material:material:1.13.0")
    implementation("androidx.constraintlayout:constraintlayout:2.1.4")
    implementation("androidx.activity:activity-ktx:1.9.0")
    testImplementation("junit:junit:4.13.2")
    androidTestImplementation("androidx.test.ext:junit:1.1.5")
    androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")

    val camerax_version = "1.5.1"
    implementation ("androidx.camera:camera-core:${camerax_version}")
    implementation ("androidx.camera:camera-camera2:${camerax_version}")
    implementation ("androidx.camera:camera-lifecycle:${camerax_version}")
    implementation ("androidx.camera:camera-view:${camerax_version}")
    implementation ("androidx.camera:camera-extensions:${camerax_version}")





    implementation(files("libs/UpLoadLibrary_12_03_15_13-release.aar"))
    implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
    implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
    implementation("com.google.android.gms:play-services-location:21.0.1")
    implementation("com.google.android.gms:play-services-appset:16.0.1")
    // Import the Firebase BoM
    implementation(platform("com.google.firebase:firebase-bom:34.6.0"))
    implementation("com.google.firebase:firebase-crashlytics-ndk")
    implementation("com.google.firebase:firebase-analytics")
    // okhttp
    implementation ("com.squareup.okhttp3:okhttp:4.12.0")
    implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")

    // TradPlus
    implementation("com.tradplusad:tradplus:15.1.10.1")
//noinspection GradleCompatible
    implementation("androidx.legacy:legacy-support-v4:1.0.0")
    implementation("androidx.appcompat:appcompat:1.3.0-alpha02")
// Ironsource
    implementation("com.ironsource.sdk:mediationsdk:9.0.0")
    implementation("com.tradplusad:tradplus-ironsource:10.15.1.10.1")
// Pangle
    implementation("com.tradplusad:tradplus-pangle:19.15.1.10.1")
    implementation("com.pangle.global:pag-sdk:7.7.0.2")
// UnityAds
    implementation("com.tradplusad:tradplus-unity:5.15.1.10.1")
    implementation("com.unity3d.ads:unity-ads:4.16.3")
//optional dependency for better targeting
    implementation("androidx.browser:browser:1.8.0")
    implementation("com.squareup.picasso:picasso:2.8")
    implementation("androidx.viewpager:viewpager:1.0.0")
    implementation("androidx.recyclerview:recyclerview:1.2.1")
// Mintegral
    implementation("com.tradplusad:tradplus-mintegralx_overseas:18.15.1.10.1")
    implementation("androidx.recyclerview:recyclerview:1.1.0")
    implementation("com.mbridge.msdk.oversea:mbridge_android_sdk:16.10.11")
// Liftoff
    implementation("com.tradplusad:tradplus-vunglex:7.15.1.10.1")
    implementation("com.vungle:vungle-ads:7.6.0")
// Cross Promotion
    implementation("com.tradplusad:tradplus-crosspromotion:27.15.1.10.1")
// TP Exchange
// 请注意保持与主包版本同步更新
    implementation("com.google.code.gson:gson:2.8.6")
    implementation("com.tradplusad:tp_exchange:40.15.1.10.1")



}