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

buildscript {
    repositories {
        mavenCentral()
        google()
    }

    dependencies {
        classpath "com.android.tools.build:gradle:4.2.1"
    }
}

apply plugin: "com.android.library"

android {
    namespace "com.conviva.react.apptracker"
    compileSdkVersion safeExtGet('compileSdkVersion', 33)
    buildToolsVersion safeExtGet('buildToolsVersion', '30.0.2')

    defaultConfig {
        minSdkVersion safeExtGet('minSdkVersion', 21)
        targetSdkVersion safeExtGet('targetSdkVersion', 33)
        versionCode 1
        versionName "1.0"
    }
    lintOptions {
        abortOnError false
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

repositories {
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url "$rootDir/../node_modules/react-native/android"
    }
    mavenCentral()
    google()
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.+'

    // Required Dependency for the Tracker
    implementation "com.squareup.okhttp3:okhttp:4.9.3"
    implementation "com.facebook.react:react-native:+"
    implementation 'com.googlecode.json-simple:json-simple:1.1'
    implementation 'com.conviva.sdk:conviva-android-tracker:1.5.0'
}
