apply plugin: "com.android.library"

// def isNewArchitectureEnabled() {
//     return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
// }

// if (isNewArchitectureEnabled()) {
//   apply plugin: "com.facebook.react"
// }

buildscript {
  // The Android Gradle plugin is only required when opening the android folder stand-alone.
  // This avoids unnecessary downloads and potential conflicts when the library is included as a
  // module dependency in an application project.
  if (project == rootProject) {
    repositories {
      google()
      maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        // Matches the RN Hello World template
        // https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/local-cli/templates/HelloWorld/android/build.gradle#L21
        url "$projectDir/../node_modules/react-native/android"
      }
    }
    dependencies {
      classpath "com.android.tools.build:gradle:7.3.1"
      classpath "com.google.gms:google-services:4.3.3"
    }
  }
}


def safeExtGet(name) {
  rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties[name]
}

android {
  compileSdkVersion safeExtGet('compileSdkVersion')

  defaultConfig {
    minSdkVersion safeExtGet('minSdkVersion')
    targetSdkVersion safeExtGet('targetSdkVersion')
    versionCode 1
    versionName "1.0"
    // buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
  }
  // sourceSets {
  //   main {
  //       if (isNewArchitectureEnabled()) {
  //           java.srcDirs += ["src/newarch"]
  //       } else {
  //           java.srcDirs += ["src/oldarch"]
  //       }
  //   }
  // }
  buildTypes {
    release {
      minifyEnabled false
    }
  }
  lintOptions {
    disable "GradleCompatible"
  }
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
}


dependencies {
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation "com.google.android.play:review:${safeExtGet('playReviewVersion')}"
    implementation "com.google.android.gms:play-services-base:${safeExtGet('playServicesVersion')}"
}