apply plugin: "com.android.application"
apply from: "../gradle/base.gradle"
apply plugin: "kotlin-parcelize"
apply plugin: "kotlin-android"
//apply plugin: 'kotlin-android-extensions'
android {
    compileSdkVersion 34

    defaultConfig {
        applicationId "com.flyjingfish.openimage"
        minSdkVersion rootProject.ext.minSdk
        targetSdkVersion 34
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildFeatures {
        viewBinding true
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion = "1.5.13" // ✅ 最新支持 Kotlin 2.0 的版本
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
//    compileOptions {
//        sourceCompatibility JavaVersion.VERSION_17
//        targetCompatibility JavaVersion.VERSION_17
//    }

//    kotlinOptions {
//        jvmTarget = "1.8"
//    }
    signingConfigs {
        release {
            storeFile file('../openimagekey')
            storePassword '123456'
            keyAlias 'key0'
            keyPassword '123456'
        }
    }
    flavorDimensions "env"
    productFlavors {
        coil2 {
            dimension "env"
        }
        coil3 {
            dimension "env"
        }
    }
    buildTypes {
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release

        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
    namespace 'com.flyjingfish.openimage'
}
configurations.all {
    resolutionStrategy {
        force 'androidx.core:core:1.13.1'
        force 'androidx.core:core-ktx:1.13.1'

        force 'androidx.appcompat:appcompat:1.6.1'
        force "androidx.activity:activity:1.6.1"
        force "androidx.fragment:fragment:1.6.1"
        force "androidx.recyclerview:recyclerview:1.2.1"
    }
}
dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    //glide
    annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
    implementation 'jp.wasabeef:glide-transformations:4.3.0'
    //picasso
    implementation 'com.squareup.picasso:picasso:2.8'
    implementation 'jp.wasabeef:picasso-transformations:2.4.0'

    //bannar
    implementation 'io.github.youth5201314:banner:2.2.2'

    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'

    implementation 'com.github.JessYanCoding:AndroidAutoSize:v1.2.1'

    // 依赖androidx, 已升级AndroidX的项目集成下面的依赖
    implementation "com.bytedance.tools.codelocator:codelocator-core:2.0.0"
    implementation 'com.github.tbruyelle:Rxpermissions:v0.12'
    implementation 'io.reactivex.rxjava3:rxjava:3.0.4'
    implementation 'com.google.android.flexbox:flexbox:3.0.0'
    implementation 'com.github.chrisbanes:PhotoView:2.3.0'
    implementation 'com.github.FlyJingFish:SwitchKeyboard:1.2.2'
    implementation 'com.github.FlyJingFish:TitleBar:1.2.8'

    implementation 'com.github.bumptech.glide:glide:4.12.0'
    implementation 'com.github.bumptech.glide:annotations:4.12.0'
    implementation 'com.github.bumptech.glide:okhttp3-integration:4.12.0'
//    if (TestCoil == "3"){
//        compileOnly "io.coil-kt:coil:2.4.0"
//        compileOnly "io.coil-kt:coil-gif:2.4.0"
//        implementation("io.coil-kt.coil3:coil:3.0.3")
//        implementation("io.coil-kt.coil3:coil-gif:3.0.3")
//        implementation("io.coil-kt.coil3:coil-network-okhttp:3.0.3")
//    }else {
//        implementation "io.coil-kt:coil:2.4.0"
//        implementation "io.coil-kt:coil-gif:2.4.0"
//        compileOnly("io.coil-kt.coil3:coil:3.0.3")
//        compileOnly("io.coil-kt.coil3:coil-gif:3.0.3")
//        compileOnly("io.coil-kt.coil3:coil-network-okhttp:3.0.3")
//    }

    coil2Implementation "io.coil-kt:coil:2.4.0"
    coil2Implementation "io.coil-kt:coil-gif:2.4.0"

    coil3Implementation("io.coil-kt.coil3:coil:3.0.3")
    coil3Implementation("io.coil-kt.coil3:coil-gif:3.0.3")
    coil3Implementation("io.coil-kt.coil3:coil-network-okhttp:3.0.3")

    compileOnly "io.coil-kt:coil:2.4.0"
    compileOnly "io.coil-kt:coil-gif:2.4.0"
    compileOnly("io.coil-kt.coil3:coil:3.0.3")
    compileOnly("io.coil-kt.coil3:coil-gif:3.0.3")
    compileOnly("io.coil-kt.coil3:coil-network-okhttp:3.0.3")


    if (TestType == "0"){
        implementation project(path: ':OpenImageFullLib')
        implementation project(path: ':OpenImageCoilLib')
    }else {
        implementation 'io.github.flyjingfish:openimage-full-lib:'+TestVersion
        implementation 'io.github.flyjingfish:openimage-coil-lib:'+TestVersion
    }

    implementation 'io.github.lucksiege:pictureselector:v3.11.2'

    implementation 'androidx.core:core:1.13.1'

    def composeBom = platform("androidx.compose:compose-bom:2024.05.00")
    implementation(composeBom)

    // 基础 UI
    implementation("androidx.activity:activity-compose:1.8.2")
    implementation("androidx.compose.ui:ui")
    implementation("androidx.compose.material3:material3") // 或 material2:material
    implementation("androidx.compose.ui:ui-tooling-preview")
    implementation "io.coil-kt:coil-compose:2.4.0"

    // 调试预览支持
    debugImplementation("androidx.compose.ui:ui-tooling")
    debugImplementation("androidx.compose.ui:ui-test-manifest")
}