apply plugin: 'com.android.application'
apply plugin: 'realm-android'
def apikeyPropertiesFile = rootProject.file("api.properties");
def apikeyProperties = new Properties()
apikeyProperties.load(new FileInputStream(apikeyPropertiesFile))
android {
    productFlavors {
        fda {
            dimension 'version'
            // Update `applicationId` with your Applicaiton ID (see https://developer.android.com/studio/build/application-id)
            // For example, you could set `applicationId` to "<prefix>_<env>.<domain>" or "com.<domain>.<subdomain>"
            applicationId "YOUR_APPLICATION_ID"
            versionCode 15
            versionName "1.0"
        }
    }
    
    compileSdkVersion 31
    buildToolsVersion "28.0.3"
    defaultConfig {

        minSdkVersion 21
        targetSdkVersion 31
        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
        multiDexEnabled true
        buildConfigField("String", "API_KEY", apikeyProperties['API_KEY'])
        buildConfigField("String", "BASE_URL_STUDY_DATASTORE", apikeyProperties['BASE_URL_STUDY_DATASTORE'])
        buildConfigField("String", "BASE_URL_PARTICIPANT_DATASTORE", apikeyProperties['BASE_URL_PARTICIPANT_DATASTORE'])
        buildConfigField("String", "BASE_URL_PARTICIPANT_CONSENT_DATASTORE", apikeyProperties['BASE_URL_PARTICIPANT_CONSENT_DATASTORE'])
        buildConfigField("String", "BASE_URL_PARTICIPANT_ENROLLMENT_DATASTORE", apikeyProperties['BASE_URL_PARTICIPANT_ENROLLMENT_DATASTORE'])
        buildConfigField("String", "BASE_URL_AUTH_SERVER", apikeyProperties['BASE_URL_AUTH_SERVER'])
        buildConfigField("String", "BASE_URL_HYDRA_SERVER", apikeyProperties['BASE_URL_HYDRA_SERVER'])
        buildConfigField("String", "BASE_URL_RESPONSE_DATASTORE", apikeyProperties['BASE_URL_RESPONSE_DATASTORE'])
        buildConfigField("String", "APP_TYPE", apikeyProperties['APP_TYPE'])
        buildConfigField("String", "APP_ID", apikeyProperties['APP_ID'])
        buildConfigField("String", "HYDRA_CLIENT_ID", apikeyProperties['HYDRA_CLIENT_ID'])
        buildConfigField("String", "STUDY_ID", apikeyProperties['STUDY_ID'])
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    repositories {
        maven {
            url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/MANIFEST.MF'
        exclude 'META-INF/NOTICE'
    }

    testOptions {
        unitTests.returnDefaultValues = true
    }
    android {
        useLibrary 'org.apache.http.legacy'
        aaptOptions.cruncherEnabled = false
        aaptOptions.useNewCruncher = false
        lintOptions {
            abortOnError false
        }
    }
    flavorDimensions("version")
}

dependencies {
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.multidex:multidex:2.0.0'
    implementation 'com.google.firebase:firebase-messaging:17.4.0'
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'de.greenrobot:eventbus:2.4.0'
    implementation 'org.researchstack:backbone:1.1.1'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    implementation 'com.kovachcode:timePickerWithSeconds:1.0.1'
    implementation 'com.tom_roush:pdfbox-android:1.8.10.1'
    implementation 'androidx.browser:browser:1.0.0'
    implementation 'junit:junit:4.13'


    implementation 'com.github.LucasFsc:Html2Pdf:0.2-beta'
    implementation 'com.github.naveenr-btc:RangeSeekBar:3.0.2'

    implementation 'com.github.chrisbanes:PhotoView:2.3.0'

    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    androidTestImplementation "com.squareup.okhttp3:mockwebserver:4.4.0"
    testImplementation 'org.mockito:mockito-android:2.11.0'
    androidTestImplementation 'androidx.test:rules:1.2.0'
    testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
