plugins {
  id 'com.android.library'
  id 'expo-module-gradle-plugin'
}

group = 'host.exp.exponent'
version = '6.1.11'

expoModule {
  canBePublished false
}

android {
  namespace "expo.modules.devmenu"
  defaultConfig {
    versionCode 10
    versionName '6.1.11'
  }

  sourceSets {
    debug {
      java {
        srcDirs += ['../vendored/react-native-gesture-handler/android/']
        srcDirs += ['../vendored/react-native-safe-area-context/android/']

      }
    }
  }
  buildFeatures {
    buildConfig true
  }
}

task clenupAssets(type: Delete) {
  // In the past, assets were placed in the `main` directory.
  // However, this is no longer the case. To ensure a smooth transition,
  // we’re also removing assets from the old location.
  delete files("src/main/assets")
}

task copyAssets(type: Copy) {
  dependsOn(clenupAssets)

  from('../assets') {
    exclude "*.ios.*"
  }
  into 'src/debug/assets'
}

project.afterEvaluate {
  preBuild.dependsOn copyAssets
}

repositories {
  // ref: https://www.baeldung.com/maven-local-repository
  mavenLocal()
  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"
  }
}

dependencies {
  implementation project(":expo-manifests")

  implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
  implementation 'com.google.android.material:material:1.2.1'

  implementation project(":expo-dev-menu-interface")

  implementation 'com.squareup.okhttp3:okhttp:3.14.9'
  implementation 'com.google.code.gson:gson:2.8.6'

  implementation 'com.facebook.react:react-android'
  implementation 'com.facebook.soloader:soloader:0.11.0'
  implementation "androidx.transition:transition:1.1.0" // use by react-native-reanimated

  // Fixes
  // Cannot access 'androidx....' which is a supertype of 'expo.modules.devmenu.DevMenuActivity'.
  // Check your module classpath for missing or conflicting dependencies
  api "androidx.appcompat:appcompat:1.1.0"
  api "androidx.lifecycle:lifecycle-extensions:2.2.0"

  implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
  implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.5'

  // Needed by gesture handler
  implementation "androidx.core:core-ktx:1.6.0"

  api "androidx.browser:browser:1.6.0"

  testImplementation "com.google.truth:truth:1.1.2"
  testImplementation "org.robolectric:robolectric:4.10"
  testImplementation 'com.squareup.okhttp3:mockwebserver:4.3.1'
  testImplementation 'androidx.test:core:1.4.0'
}
