plugins {
  id("com.android.application")
  id("kotlin-android")
  id("kotlin-android-extensions")
  id("kotlin-kapt")
  id "com.github.triplet.play" version "2.7.2"
}

android {
  compileSdkVersion rootProject.ext.compileSdkVersion
  defaultConfig {
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 14
    versionName "3.0.1"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
  }
  if (project.hasProperty('CHICAGO_ROBOTO_STORE_FILE')) {
    signingConfigs {
      release {
        storeFile file(CHICAGO_ROBOTO_STORE_FILE)
        storePassword CHICAGO_ROBOTO_STORE_PASSWORD
        keyAlias CHICAGO_ROBOTO_KEY_ALIAS
        keyPassword CHICAGO_ROBOTO_KEY_PASSWORD
      }
    }
  }
  buildTypes {
    release {
      if (project.hasProperty('CHICAGO_ROBOTO_STORE_FILE')) {
        signingConfig signingConfigs.release
      }
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
  flavorDimensions 'version'
  productFlavors {
    roboto {
      applicationId "com.chicagoroboto"
      buildConfigField "String", "EVENT_ID", "\"chicagoroboto-2019\""
      resValue "string", "app_name", "Roboto"
      resValue "string", "event_name", "Chicago Roboto"
      resValue "string", "github_link", "https://github.com/360Conferences/chicago-roboto"
    }
    andev {
      applicationId "com.threesixtyconferences.andev"
      buildConfigField "String", "EVENT_ID", "\"360andev-2018\""
      resValue "string", "app_name", "360|AnDev"
      resValue "string", "event_name", "360|AnDev"
      resValue "string", "github_link", "https://github.com/360Conferences/chicago-roboto"
    }
  }
  sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
    test.java.srcDirs += 'src/test/kotlin'
    androidTest.java.srcDirs += 'src/androidTest/kotlin'
  }

  viewBinding.enabled = true
}

play {
  serviceAccountCredentials = rootProject.file("play-service-account.json")
  resolutionStrategy = "auto"
  track = "beta"
}

dependencies {
  implementation libs.firebase.auth
  implementation libs.firebase.database
  implementation libs.firebase.storage
  implementation libs.kotlin.stdlib
  implementation libs.kotlin.coroutines.android
  implementation libs.kotlin.coroutines.firebase
  implementation libs.multilineToolbar
  implementation libs.playServicesMaps
  implementation libs.androidx.recyclerview
  implementation libs.androidx.fragment
  implementation libs.androidx.lifecycle.runtime
  implementation libs.androidx.viewpager
  implementation libs.androidx.constraintlayout
  implementation libs.androidx.appcompat
  implementation libs.material
  implementation libs.timber.android
  implementation libs.insetter

  implementation project(':core')

  implementation libs.glide

  implementation libs.dagger.core
  kapt libs.dagger.compiler
  compileOnly 'org.glassfish:javax.annotation:10.0-b28'

  androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
    exclude group: 'com.android.support', module: 'support-annotations'
  })

  testImplementation libs.junit4
}

apply plugin: 'com.google.gms.google-services'
