buildscript {
  ext.getExtOrDefault = {name ->
    return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RNKakaoLogins_' + name]
  }

  repositories {
    mavenCentral()
    google()
  }

  dependencies {
    classpath "com.android.tools.build:gradle:${getExtOrDefault('gradleVersion')}"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
  }
}

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

android {
  compileSdkVersion getExtOrDefault('compileSdkVersion').toInteger()

  defaultConfig {
    minSdkVersion getExtOrDefault('minSdkVersion').toInteger()
    targetSdkVersion getExtOrDefault('targetSdkVersion').toInteger()
    versionCode 1
    versionName "1.0"
  }
  buildTypes {
    release {
      minifyEnabled false
    }
  }
  lintOptions {
    disable 'GradleCompatible'
  }
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
}

repositories {
  mavenCentral()
  google()
}

dependencies {
  //noinspection GradleDynamicVersion
  implementation "com.facebook.react:react-native:+"
  implementation "org.jetbrains.kotlin:kotlin-stdlib:${getExtOrDefault('kotlinVersion')}"

  // Kakao
  def kakaoVersion = getExtOrDefault('kakaoSdkVersion')
  implementation "com.kakao.sdk:v2-user:$kakaoVersion" // 카카오 로그인
  implementation "com.kakao.sdk:v2-talk:$kakaoVersion" // 친구, 메시지(카카오톡)
  implementation "com.kakao.sdk:v2-story:$kakaoVersion" // 카카오 스토리
}

rootProject.allprojects {
  repositories {
    maven {
      url 'https://devrepo.kakao.com/nexus/content/groups/public/'
    }
  }
}
