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

def debugKeyProps = new Properties()
def debugKeyPropsFile = rootProject.file('key_debug.properties')
if (debugKeyPropsFile.exists()) {
    debugKeyProps.load(new FileInputStream(debugKeyPropsFile))
}

android {
    signingConfigs {
        debug {
            storeFile file(debugKeyProps['storeFile'])
            storePassword debugKeyProps['storePassword']
            keyAlias debugKeyProps['keyAlias']
            keyPassword debugKeyProps['keyPassword']
        }
    }

    compileSdk 31

    defaultConfig {
        applicationId "com.pushdeer.os"
        minSdk 22
        targetSdk 31
        versionCode 15
        versionName "1.0-alpha-5"

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

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
        useIR = true
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion compose_version
        kotlinCompilerVersion '1.5.31'
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.4.0'
    implementation 'com.google.android.material:material:1.4.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.0'
    implementation 'androidx.activity:activity-compose:1.4.0'
    implementation files('libs/MiPush_SDK_Client_5_0_5-C_3rd.aar')
    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"

    implementation project(path: ':common')
    implementation project(path: ':compose')

    // navigation
    implementation "androidx.navigation:navigation-compose:2.4.0-rc01"

    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.0.0'
    implementation 'com.google.code.gson:gson:2.8.9'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'


    def accompanist_version = "0.22.0-rc"
//    implementation "com.google.accompanist:accompanist-pager:$accompanist_version"
//    implementation "com.google.accompanist:accompanist-pager-indicators:$accompanist_version"
//    implementation "com.google.accompanist:accompanist-navigation-material:$accompanist_version"
    implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version"
    implementation "com.google.accompanist:accompanist-insets:$accompanist_version"
//    implementation "com.google.accompanist:accompanist-insets-ui:$accompanist_version"
//    implementation "com.google.accompanist:accompanist-swiperefresh:$accompanist_version"

    // room
    def room_version = "2.4.0"
    implementation "androidx.room:room-ktx:$room_version"
    implementation "androidx.room:room-runtime:$room_version"
    kapt "androidx.room:room-compiler:$room_version"

    // qr
    implementation 'com.google.zxing:core:3.2.1'
    implementation 'cn.bingoogolapple:bga-qrcodecore:1.1.7@aar'
    implementation 'cn.bingoogolapple:bga-zxing:1.1.7@aar'

    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'

    final def markwon_version = '4.6.2'
    implementation "io.noties.markwon:core:$markwon_version"
    implementation "io.noties.markwon:ext-tables:$markwon_version"
    implementation "io.noties.markwon:ext-tasklist:$markwon_version"
    implementation "io.noties.markwon:image-coil:$markwon_version"
//    implementation "io.noties.markwon:linkify:$markwon_version"
    implementation "io.noties.markwon:html:$markwon_version"
    implementation "io.coil-kt:coil:1.4.0"

    implementation 'com.github.vishalkumarsinghvi:sign-in-with-apple-button-android:0.6'

    api 'com.tencent.mm.opensdk:wechat-sdk-android:6.8.0'

//    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
}