apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

def secretPropertiesFile = rootProject.file('secret.properties')
def secretProperties = new Properties()
secretProperties.load(secretPropertiesFile.newInputStream())

android {
    compileSdkVersion rootProject.ext.targetSdkVersion

    defaultConfig {
        applicationId "info.papdt.express.helper"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode rootProject.ext.versionCode
        versionName rootProject.ext.versionName
        resConfigs "en", "zh_cn", "zh_tw", "zh_hk", "yue"
        multiDexEnabled true

        manifestPlaceholders = [fabric_api_key: secretProperties.myFabricApiKey]
    }
    buildTypes {
        release {
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            pseudoLocalesEnabled true
        }
        debug {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            pseudoLocalesEnabled true
        }
    }
    sourceSets {
        main {
            java.srcDirs += 'src/main/kotlin'
        }
    }
}

kotlin {
	experimental {
		coroutines "enable"
	}
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    def room_version = "2.1.0-alpha04"

    implementation 'androidx.multidex:multidex:2.0.1'

    // Kotlin & Kotlinyan
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.12"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
    implementation "moe.feng.kotlinyan:kotlinyan-common:$kotlinyanVersion"
    implementation "moe.feng.kotlinyan:kotlinyan-appcompat-support:$kotlinyanVersion"

    // Android Support Libraries
    implementation "androidx.appcompat:appcompat:1.0.2"
    implementation "androidx.cardview:cardview:1.0.0"
    implementation "androidx.recyclerview:recyclerview:1.0.0"
    implementation "com.google.android.material:material:1.0.0"
    implementation "androidx.legacy:legacy-support-v13:1.0.0"
    implementation "androidx.browser:browser:1.0.0"
    implementation "androidx.room:room-runtime:$room_version"
    kapt "androidx.room:room-compiler:$room_version"
    implementation "androidx.room:room-coroutines:$room_version"

    // Network & Data
    implementation 'com.squareup.okhttp3:okhttp:3.12.0'
    implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.9.1'
    implementation 'com.google.code.gson:gson:2.8.5'

    // Common UI Library
    implementation 'me.drakeet.multitype:multitype:3.5.0'
    implementation "moe.shizuku.preference:preference:$materialPrefLibVersion"
    implementation "moe.shizuku.preference:preference-simplemenu:$materialPrefLibVersion"
    implementation "moe.shizuku.preference:preference-dialog-android:$materialPrefLibVersion"
    implementation 'moe.shizuku.fontprovider:api:10'

    // View & Widget
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-andx-3'
    implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-andx-3'
    implementation 'moe.feng:MaterialStepperView:0.2.4.2'
    implementation 'me.dm7.barcodescanner:zxing:1.9.8'

    // Utils
    api 'moe.feng:AlipayZeroSdk:1.1'
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {
        transitive = true
    }
    api 'com.github.promeg:tinypinyin:2.0.3'

    // Firebase SDK
    implementation "com.google.firebase:firebase-core:16.0.7"
    implementation "com.google.firebase:firebase-messaging:17.3.4"
}

apply plugin: 'com.google.gms.google-services'