buildscript {
    ext.kotlin_version = '1.6.20'
    ext.safeExtGet = { prop, fallback ->
        rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
    }
    repositories {
        google()
        jcenter()
        mavenCentral()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // Matches recent template from React Native (0.62)
        // https://github.com/facebook/react-native/blob/0.62-stable/template/android/build.gradle#L16
        classpath("com.android.tools.build:gradle:${safeExtGet('gradlePluginVersion', '4.0.0')}")
    }
}

apply plugin: 'com.android.library'
apply plugin: "kotlin-android"
apply plugin: "kotlin-android-extensions"
// apply plugin: 'maven'

// Matches values in recent template from React Native (0.62)
// https://github.com/facebook/react-native/blob/0.62-stable/template/android/build.gradle#L5-L9
def DEFAULT_COMPILE_SDK_VERSION = 33
def DEFAULT_BUILD_TOOLS_VERSION = "33.0.0"
def DEFAULT_MIN_SDK_VERSION = 21
def DEFAULT_TARGET_SDK_VERSION = 33

android {
  compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
  buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)

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

repositories {
    // Matches recent template from React Native (0.62)
    // https://github.com/facebook/react-native/blob/0.62-stable/template/android/build.gradle#L30
    mavenLocal()
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url("$rootDir/../node_modules/react-native/android")
    }
    maven {
        // Android JSC is installed from npm
        url("$rootDir/../node_modules/jsc-android/dist")
    }

    google()
    jcenter()
    mavenCentral()
    maven { url 'https://www.jitpack.io' }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation "com.facebook.react:react-native:${safeExtGet('reactnativeVersion', '+')}"
    def androidX = '1.2.0'
    implementation "androidx.appcompat:appcompat:$androidX"
    implementation "com.google.code.gson:gson:2.8.6"
    implementation('com.ziggeo:android-sdk-reactnativeblur:2.6.20') {
        transitive = true
    }
    //todo old implementation
//    implementation("com.github.ZiggeoJitpackService:Android-SDK:2.6.4:reactnativeblur@aar") {
//        transitive = true
//    }
    implementation 'com.karumi:dexter:6.2.1'
}
