buildscript {
  repositories {
    mavenCentral()
  }
  dependencies {
    classpath("org.jetbrains.kotlin.plugin.compose:org.jetbrains.kotlin.plugin.compose.gradle.plugin:${kotlinVersion}")
    classpath("org.jetbrains.kotlin.plugin.serialization:org.jetbrains.kotlin.plugin.serialization.gradle.plugin:${kotlinVersion}")
    classpath("com.apollographql.apollo:apollo-gradle-plugin:4.3.1")
  }
}

apply plugin: 'com.android.library'
apply plugin: 'expo-module-gradle-plugin'
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
apply plugin: 'org.jetbrains.kotlin.plugin.serialization'
apply plugin: 'com.apollographql.apollo'

expoModule {
  canBePublished false
}

group = "host.exp.exponent"
version = "6.0.21"

android {
  namespace "expo.modules.devlauncher"
  defaultConfig {
    versionCode 9
    versionName "6.0.21"
  }

  buildTypes {
    create("debugOptimized") {
      initWith(buildTypes.debug)
      matchingFallbacks += ["release"]
    }

    buildTypes.each {
      it.buildConfigField 'String', 'VERSION', "\"${defaultConfig.versionName}\""
    }
  }

  sourceSets {
    debugOptimized {
      setRoot 'src/debug'
    }
  }

  buildFeatures {
    buildConfig true
    viewBinding true
  }
}

apollo {
  service("service") {
    packageName.set("expo.modules.devlauncher")
    introspection {
      endpointUrl.set("https://api.expo.dev/graphql")
      schemaFile.set(file("src/main/graphql/schema.graphqls"))
    }
  }
}
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"
  }
  google()
}

dependencies {
  implementation project(":expo-dev-menu-interface")
  implementation project(":expo-manifests")
  implementation project(":expo-updates-interface")
  implementation project(":expo-dev-menu")

  implementation 'com.facebook.react:react-android'
  implementation 'com.facebook.soloader:soloader:0.11.0'

  implementation 'commons-io:commons-io:2.6'

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

  // 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.4.3")
  implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1")
  implementation "org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}"

  api project.dependencies.platform("io.insert-koin:koin-bom:3.5.6")
  api "io.insert-koin:koin-core"

  def composeVersion = "1.9.0"

  implementation "androidx.compose.foundation:foundation-android:$composeVersion"
  implementation "androidx.compose.ui:ui:$composeVersion"
  implementation "androidx.compose.ui:ui-tooling:$composeVersion"
  implementation "androidx.navigation:navigation-compose:2.9.0"
  implementation "com.google.android.gms:play-services-code-scanner:16.1.0"
  implementation "com.google.mlkit:barcode-scanning:17.3.0"

  implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.7.1")

  implementation("com.apollographql.apollo:apollo-runtime:4.3.1")

  implementation("com.composables:core:1.37.0")

  testImplementation 'androidx.test:core:1.4.0'
  testImplementation 'androidx.test:core-ktx:1.4.0'
  testImplementation "com.google.truth:truth:1.1.2"
  testImplementation 'com.squareup.okhttp3:mockwebserver:4.3.1'
  testImplementation "io.insert-koin:koin-test"
  testImplementation "io.insert-koin:koin-test-junit4"
  testImplementation 'io.mockk:mockk:1.12.3'
  testImplementation "org.robolectric:robolectric:4.10"
}
