// Top-level build file where you can add configuration options common to all sub-projects/modules.
import groovy.json.JsonSlurper

buildscript {
    ext{
        androidGradlePluginVersion = '4.0.0'
        kotlinVersion = "1.3.61"
        googleServices = "4.3.3"
        androidSdkVersion = 31
    }

    repositories {
        mavenLocal()
        mavenCentral()
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:$androidGradlePluginVersion"
        classpath "com.google.gms:google-services:$googleServices"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    }
}

allprojects {
    repositories {
        mavenLocal()
        mavenCentral()
        google()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../../node_modules/react-native/android"
        }
    }
}
subprojects {
    afterEvaluate { project ->
        if ((project.plugins.hasPlugin('android') || project.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion rootProject.ext.androidSdkVersion
            }
        }
        if (project.hasProperty('defaultConfig')) {
            defaultConfig {
                minSdkVersion rootProject.ext.androidMinSdkVersion
                targetSdkVersion rootProject.ext.androidSdkVersion
            }
        }
    }
}