plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'com.google.devtools.ksp'
    id 'kotlin-parcelize'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "cn.geektang.privacyspace"
        minSdk 26
        targetSdk 32
        versionCode 21
        versionName "1.3.7"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }

    signingConfigs {
        release {
            keyAlias System.env.Space_keyAlias
            keyPassword System.env.Space_keyPassword
            storeFile file(System.env.Space_storeFile)
            storePassword System.env.Space_storePassword
        }
    }

    buildTypes {
        debug {
            buildConfigField('String', 'APP_CENTER_SECRET', "\"${System.env.Space_AppCenterSecret}\"")
            signingConfig signingConfigs.release
        }
        release {
            buildConfigField('String', 'APP_CENTER_SECRET', "\"${System.env.Space_AppCenterSecret}\"")
            minifyEnabled false
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion compose_version
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/**'
            excludes += 'okhttp3/**'
            excludes += 'kotlin/**'
            excludes += '**.bin'
            excludes += '**.properties'
        }
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation "androidx.compose.ui:ui:$compose_version"
    implementation "androidx.compose.material:material:$compose_version"
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
    implementation 'androidx.activity:activity-compose:1.4.0'
    implementation 'io.coil-kt:coil-compose:1.4.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
    debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
    compileOnly 'de.robv.android.xposed:api:82'
    compileOnly 'de.robv.android.xposed:api:82:sources'
    compileOnly files('libs/android-30.jar')
    implementation 'androidx.navigation:navigation-compose:2.4.2'
    implementation 'com.google.accompanist:accompanist-insets:0.23.1'
    implementation 'com.google.accompanist:accompanist-insets-ui:0.23.1'
    implementation "com.google.accompanist:accompanist-flowlayout:0.23.1"
    implementation 'com.squareup.moshi:moshi:1.13.0'
    ksp("com.squareup.moshi:moshi-kotlin-codegen:1.13.0")
    def appCenterSdkVersion = '4.4.2'
    implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
    implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
    compileOnly 'androidx.recyclerview:recyclerview:1.2.1'
}