apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 28
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 28

        renderscriptTargetApi 28 //must match target sdk and build tools
        vectorDrawables.useSupportLibrary = true

        applicationId "code.name.monkey.retromusic"
        versionCode 397
        versionName '3.4.850'

        multiDexEnabled true

        buildConfigField("String", "GOOGLE_PLAY_LICENSING_KEY", "\"${getProperty(getProperties('../public.properties'), 'GOOGLE_PLAY_LICENSE_KEY')}\"")
    }
    signingConfigs {
        release {
            Properties properties = getProperties('/Users/hemanths/Desktop/KeepSafe/retro.properties')
            storeFile file(getProperty(properties, 'storeFile'))
            keyAlias getProperty(properties, 'keyAlias')
            storePassword getProperty(properties, 'storePassword')
            keyPassword getProperty(properties, 'keyPassword')
        }
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
        debug {
            applicationIdSuffix '.debug'
            versionNameSuffix ' DEBUG'
        }
    }


    flavorDimensions "default"

    productFlavors {
        normal {
            versionCode defaultConfig.versionCode + 10000
            versionName defaultConfig.versionName + "_" + getDate()
            dimension "default"
        }
        font {
            versionCode defaultConfig.versionCode + 10000
            versionName defaultConfig.versionName + "_" + getDate()
            dimension "default"
        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/rxjava.properties'
    }
    lintOptions {
        disable 'MissingTranslation'
        disable 'InvalidPackage'
        abortOnError false
    }
    compileOptions {
        sourceCompatibility '1.8'
        targetCompatibility '1.8'
    }
    buildToolsVersion = '29.0.2'

    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
    }
    androidExtensions {
        experimental = true
    }
    kapt {
        generateStubs = true
    }

}

def getProperties(String fileName) {
    final Properties properties = new Properties()
    def file = file(fileName)
    if (file.exists()) {
        file.withInputStream { stream -> properties.load(stream) }
    }
    return properties
}

static def getProperty(Properties properties, String name) {
    return properties.getProperty(name) ?: "$name missing"
}

static def getDate() {
    new Date().format('MMdd')
}


dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation project(':appthemehelper')
    implementation 'androidx.multidex:multidex:2.0.1'

    implementation "androidx.gridlayout:gridlayout:1.0.0"
    implementation "androidx.cardview:cardview:1.0.0"
    implementation "androidx.palette:palette:1.0.0"
    implementation 'androidx.palette:palette-ktx:1.0.0'

    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.annotation:annotation:1.1.0'
    implementation 'androidx.preference:preference:1.1.0'

    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.core:core-ktx:1.1.0'
    implementation 'androidx.fragment:fragment:1.2.0-rc02'
    implementation 'androidx.recyclerview:recyclerview:1.1.0-rc01'

    implementation 'com.google.android.material:material:1.2.0-alpha01'
    implementation 'com.google.android.play:core:1.6.4'

    def retrofit_version = "2.6.2"
    implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
    implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version"

    implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'

    def material_dialog_version = "3.1.1"
    implementation "com.afollestad.material-dialogs:core:$material_dialog_version"
    implementation "com.afollestad.material-dialogs:input:$material_dialog_version"
    implementation "com.afollestad.material-dialogs:color:$material_dialog_version"
    implementation "com.afollestad.material-dialogs:bottomsheets:$material_dialog_version"
    implementation 'com.afollestad:material-cab:0.1.12'


    implementation 'com.github.bumptech.glide:glide:3.8.0'
    implementation 'com.github.bumptech.glide:okhttp3-integration:1.5.0'

    implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.2.9'

    implementation('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.11.0@aar') {
        transitive = true
    }

    /*UI Library*/
    implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1'


    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    def kotlin_coroutines_version = "1.3.0"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"

    implementation 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:3.4.0.201406110918-r'

    implementation 'com.github.ksoichiro:android-observablescrollview:1.6.0'
    implementation 'com.github.kabouzeid:recyclerview-fastscroll:1.9-kmod'

    implementation 'com.github.AdrienPoupa:jaudiotagger:2.2.3'

    implementation 'com.anjlab.android.iab.v3:library:1.1.0'
    implementation 'com.r0adkll:slidableactivity:2.1.0'
    implementation 'com.heinrichreimersoftware:material-intro:1.6'

    def dagger_version = "2.23.1"
    implementation "com.google.dagger:dagger:$dagger_version"
    kapt "com.google.dagger:dagger-compiler:$dagger_version"


}