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

        dependencies {
            classpath 'com.android.tools.build:gradle:8.7.2'

        }
    }
}

apply plugin: 'com.android.library'
// AGP 9 ships built-in Kotlin support and registers the `kotlin` extension
// itself. Applying the Kotlin plugin on top of it fails configuration with
// "Cannot add extension with name 'kotlin'". Only apply it when nothing has
// registered that extension yet.
if (project.extensions.findByName('kotlin') == null) {
    apply plugin: "kotlin-android"
}

apply plugin: "com.facebook.react"

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

android {
    namespace "com.reactnativewalletmanager"
    compileSdkVersion safeExtGet('WalletManager_compileSdkVersion', 34)
    buildToolsVersion safeExtGet('WalletManager_buildToolsVersion', '33.0.0')
    defaultConfig {
        minSdkVersion safeExtGet('WalletManager_minSdkVersion', 21)
        targetSdkVersion safeExtGet('WalletManager_targetSdkVersion', 33)
        versionCode 1
        versionName "1.0"

    }

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

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

dependencies {
  implementation "com.facebook.react:react-android"
  implementation 'com.google.android.gms:play-services-pay:16.5.0'
  implementation "com.google.android.gms:play-services-wallet:19.4.0"
}

  react {
    jsRootDir = file("../src/")
    libraryName = "NativeWalletManager"
    codegenJavaPackageName = "com.reactnativewalletmanager"
  }
