apply plugin: 'com.android.library'

def safeExtGet(prop, fallback) {
    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

android {
    compileSdkVersion safeExtGet("compileSdkVersion", 28)
    buildToolsVersion safeExtGet("buildToolsVersion", '28.0.3')

    defaultConfig {
        minSdkVersion safeExtGet('minSdkVersion', 16)
        targetSdkVersion safeExtGet('targetSdkVersion', 26)
        versionCode 1
        versionName "1.0"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

def customizableDependencies(name, defaultDependencies) {
    if (rootProject.ext.has(name)) {
        def libs = rootProject.ext.get(name)
        if (libs instanceof CharSequence) {
            libs.split(';').each {
                implementation it
            }
        } else {
            libs.delegate = defaultDependencies.owner.delegate
            libs.call()
        }
    } else {
        defaultDependencies.delegate = defaultDependencies.owner.delegate
        defaultDependencies.call()
    }
}

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

    // React Native
    implementation "com.facebook.react:react-native:+"

    implementation 'com.mapmyindia.sdk:mapmyindia-android-sdk:7.0.3'
    implementation 'com.mapmyindia.sdk:markerview-plugin:0.1.0'
    implementation 'com.mapmyindia.sdk:annotation-plugin:0.3.0'
    implementation 'com.mapmyindia.sdk:geoanalytics-plugin:0.2.0'


    // Dependencies
    implementation "com.android.support:support-vector-drawable:${safeExtGet('supportLibVersion', '28.0.0')}"
    implementation "com.android.support:support-annotations:${safeExtGet('supportLibVersion', '28.0.0')}"
    implementation "com.android.support:appcompat-v7:${safeExtGet('supportLibVersion', '28.0.0')}"
    implementation "com.squareup.okhttp3:okhttp:${safeExtGet('okhttpVersion', '4.9.0')}"
    implementation "com.squareup.okhttp3:okhttp-urlconnection:${safeExtGet('okhttpVersion', '4.9.0')}"


    //   implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-localization-v9:0.12.0'
    //  implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-markerview-v9:0.4.0'
//    api dependenciesList.mapboxJavaGeoJSON
//    api dependenciesList.mapboxAndroidGestures
//    api dependenciesList.mapboxAndroidAccounts

//    implementation dependenciesList.mapboxJavaTurf

}
