plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.kotlin.compose)
}

android {
    namespace = "com.stand.standapp"
    compileSdk = 36
    
    defaultConfig {
        applicationId = "com.stand.standapp"
        minSdk = 24
        targetSdk = 34
        versionCode = 13
        versionName = "1.0.12"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

        ndk {
            abiFilters.addAll(listOf("armeabi-v7a"))
        }
    }

    signingConfigs {
        create("release") {
            storeFile = file("../key/StandAPP")
            storePassword = "StandAPP"
            keyAlias = "standapp"
            keyPassword = "StandAPP"
        }
    }

    buildTypes {
        release {
            signingConfig = signingConfigs.getByName("release")
            // 1. 开启代码混淆/压缩 (注意是 isMinifyEnabled)
            isMinifyEnabled = true

            // 2. 开启资源压缩 (注意是 isShrinkResources)
            // 必须配合 isMinifyEnabled = true 使用
            isShrinkResources = true
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
    packaging {
        jniLibs {
            useLegacyPackaging = true
        }
    }
    buildFeatures {
        compose = true
    }
}

dependencies {
    implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
    implementation("com.jakewharton.timber:timber:5.0.1")
    implementation("androidx.cardview:cardview:1.0.0")
    implementation("com.iqiyi.xcrash:xcrash-android-lib:3.1.0")
    implementation("org.mozilla.geckoview:geckoview-omni:115.0.20230710165010")
    implementation("com.google.android.material:material:1.12.0")
    implementation("com.squareup.okhttp3:okhttp:4.12.0")
    implementation("com.squareup.okhttp3:okhttp-sse:4.12.0")
    implementation("io.noties.markwon:core:4.6.2")
    implementation("io.noties.markwon:ext-tables:4.6.2")
    implementation("io.noties.markwon:html:4.6.2")
    implementation("io.noties.markwon:linkify:4.6.2") // 👈 链接自动识别
    implementation("io.noties.markwon:ext-strikethrough:4.6.2") // 👈 删除线支持
    implementation("io.noties.markwon:ext-tasklist:4.6.2") // 👈 任务列表支持
    implementation("com.github.getActivity:XXPermissions:18.2")
    implementation(libs.androidx.appcompat)
    implementation(libs.androidx.core.ktx)
    implementation(libs.androidx.lifecycle.runtime.ktx)
    implementation(libs.androidx.activity.compose)
    implementation(platform(libs.androidx.compose.bom))
    implementation(libs.androidx.compose.ui)
    implementation(libs.androidx.compose.ui.graphics)
    implementation(libs.androidx.compose.ui.tooling.preview)
    implementation(libs.androidx.compose.material3)
    implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.10.0") // 👈 新增这一行以支持 Compose 中的 viewModel()
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.junit)
    androidTestImplementation(libs.androidx.espresso.core)
    androidTestImplementation(platform(libs.androidx.compose.bom))
    androidTestImplementation(libs.androidx.compose.ui.test.junit4)
    debugImplementation(libs.androidx.compose.ui.tooling)
    debugImplementation(libs.androidx.compose.ui.test.manifest)
}