apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

buildscript {
  ext.kotlin_version = '1.5.20'

  repositories {
    google()
    mavenCentral()
    maven { url "https://maven.google.com" }
  }

  dependencies {
    classpath 'com.android.tools.build:gradle:7.0.3'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  }
}

android {
  compileSdkVersion 31

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }

  defaultConfig {
    minSdkVersion 21
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"
  }
}
// func () { echo var is set to \"$1\"; echo valsasd is set to ${broadpeakConfig};}; func
dependencies {

  implementation fileTree(dir: "libs", include: ["*.jar"])

  def kalturaPlayerVersion = '4.24.1'

  implementation "com.kaltura.player:tvplayer:$kalturaPlayerVersion"
  implementation "com.kaltura.playkit:vrplugin:$kalturaPlayerVersion"

//  api project(":tvplayer")
//  implementation project(":ima")
//  implementation project(":youbora")

  // Kotlin Config
  implementation 'androidx.core:core-ktx:1.3.2'
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

  //noinspection GradleDynamicVersion
  implementation "com.facebook.react:react-native:+"  // From node_modules
  debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.fbjni'
  }

  debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.flipper'
    exclude group:'com.squareup.okhttp3', module:'okhttp'
  }

  debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.flipper'
  }
}

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

allprojects {
  configurations.all {
    resolutionStrategy {
      force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
    }
  }
  repositories {
    google()

    mavenCentral()
    maven { url "https://jitpack.io" }
    maven { url  "https://npaw.jfrog.io/artifactory/youbora/" }

    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")
    }
  }
}
