plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-parcelize'
}

android {
    compileSdk COMPILE_SDK

    defaultConfig {
        applicationId APPLICATION_ID
        minSdk MIN_SDK
        targetSdk TARGET_SDK
        versionCode gitVersionCode
        versionName gitVersionName

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        archivesBaseName = "${rootProject.name}-v${versionName}-${versionCode}"
    }

    signingConfigs {
        release {
            def locale, keystorePwd, alias, pwd
            if (project.rootProject.file('local.properties').exists()) {
                Properties properties = new Properties()
                properties.load(project.rootProject.file('local.properties').newDataInputStream())
                locale = properties.getProperty("STORE_FILE_PATH")
                alias = properties.getProperty("KEY_ALIAS")
                pwd = properties.getProperty("KEY_PASSWORD")
                keystorePwd = properties.getProperty("STORE_PASSWORD")
            }
            if (locale != null) {
                storeFile file(locale)
                storePassword keystorePwd
                keyAlias alias
                keyPassword pwd
            }
        }
    }

    buildTypes {
        debug {
            if (signingConfigs.release.storeFile != null &&
                    signingConfigs.release.storeFile.exists()) {
                signingConfig signingConfigs.release
            }
        }
        release {
            if (signingConfigs.release.storeFile != null &&
                    signingConfigs.release.storeFile.exists()) {
                signingConfig signingConfigs.release
            }
            minifyEnabled true
            shrinkResources true
            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 kotlin_compiler_extension_version
    }
}
def lifecycle_version = "2.6.1"
def activity_version = "1.7.2"
def nav_version = "2.7.2"

dependencies {
    api project(":common")
    api project(":xposed")

    //remove this line will cause proguard to remove code from library module
    compileOnly 'de.robv.android.xposed:api:82'

    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
    implementation "androidx.activity:activity-ktx:$activity_version"

    //compose
    implementation platform('androidx.compose:compose-bom:2023.08.00')
    implementation "androidx.compose.material3:material3"
    implementation "androidx.compose.animation:animation"
    implementation "androidx.compose.ui:ui"
    debugImplementation "androidx.compose.ui:ui-tooling"
    implementation "androidx.compose.ui:ui-tooling-preview"
    implementation "androidx.compose.foundation:foundation"
    implementation "androidx.compose.material:material-icons-core"
    implementation "androidx.compose.material:material-icons-extended"

    implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version"
    implementation "com.google.accompanist:accompanist-drawablepainter:0.25.1"

    implementation "androidx.activity:activity-compose:$activity_version"
    implementation "androidx.navigation:navigation-runtime-ktx:$nav_version"
    implementation "androidx.navigation:navigation-compose:$nav_version"

    implementation 'de.charlex.compose:html-text:1.3.1'
}
