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()
      mavenCentral()
    }

    dependencies {
      classpath("com.android.tools.build:gradle:7.0.3")
    }
  }
}

plugins {
  id "io.invertase.gradle.build" version "1.5"
}

project.evaluationDependsOn(':app')

project.ext {
  set('react-native', [
    versions: [
      android: [
        minSdk    : 20,
        targetSdk : 34,
        compileSdk: 34,
        // optional as gradle.buildTools comes with one by default
        // overriding here though to match the version RN uses
        // buildTools: "29.0.2"
      ],
    ],
  ])
}

android {
  defaultConfig {
    multiDexEnabled true
  }
  lintOptions {
    disable 'GradleCompatible'
    abortOnError false
  }
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
  buildTypes {
    release {
      consumerProguardFiles 'proguard-rules.pro'
    }
  }
  compileSdkVersion = 34
}

repositories {
  google()
  mavenCentral()
}

dependencies {
  if (findProject(':notifee_core')) {
    implementation findProject(':notifee_core')
  } else {
    implementation(group: 'app.notifee', name:'core', version: '+')
  }
  implementation 'androidx.concurrent:concurrent-futures:1.1.0' // https://developer.android.com/jetpack/androidx/releases/concurrent
  implementation 'com.google.android.gms:play-services-tasks:18.0.1' // https://developers.google.com/android/guides/releases
  implementation 'androidx.work:work-runtime:2.7.1' // https://developer.android.com/jetpack/androidx/releases/work
  implementation 'org.greenrobot:eventbus:3.2.0' // https://github.com/greenrobot/EventBus/releases

  // needed to enforce version and avoid clashes
  // https://github.com/square/okhttp/blob/master/docs/changelog_3x.md
  implementation 'com.squareup.okhttp3:okhttp:3.12.13' // okhttp must stay on 3.12.x to support minSdkVersion < 21
}

ReactNative.shared.applyPackageVersion()
ReactNative.shared.applyDefaultExcludes()
ReactNative.module.applyAndroidVersions()
ReactNative.module.applyReactNativeDependency("api")
