def DEFAULT_COMPILE_SDK_VERSION = 34
def DEFAULT_MIN_SDK_VERSION = 21
def DEFAULT_TARGET_SDK_VERSION = 34

buildscript {
    if (project == rootProject) {
        repositories {
            google()
            mavenCentral()
        }

        dependencies {
            classpath 'com.android.tools.build:gradle:8.1.1'
        }
    }
}

apply plugin: 'com.android.library'

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

android {
    compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
    namespace = "com.withpersona.sdk2.reactnative"
    defaultConfig {
        minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
        targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            minifyEnabled false
        }
    }
    lintOptions {
        disable 'GradleCompatible'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    dexOptions {
        preDexLibraries = false
    }
}

repositories {
    google()
    mavenLocal()
    mavenCentral()
    maven {
        url "https://sdk.withpersona.com/android/releases"
    }
    maven {
        url 'https://jitpack.io'
    }
}

dependencies {
    //noinspection GradleDynamicVersion
    implementation("com.facebook.react:react-android")

    // NB: be sure to bump `nfc-impl` in example/android/app/build.gradle as well
    implementation 'com.withpersona.sdk2:inquiry:2.14.2'
}
