apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'
//apply plugin: 'com.google.firebase.crashlytics'
//apply plugin: 'com.google.gms.google-services'

android {
	namespace 'com.dimowner.audiorecorder'
	compileSdkVersion 34
	defaultConfig {
		applicationId "com.dimowner.audiorecorder"
		minSdkVersion 23
		targetSdkVersion 34
		versionCode 935
		versionName "0.9.99"
	}

	buildFeatures {
		viewBinding true
		buildConfig true
	}

	def keystorePropertiesFile = rootProject.file("keystore.properties")
	def keystoreProperties = new Properties()
	keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

	signingConfigs {
		dev {
			storeFile file('key/debug/debug.keystore')
			storePassword 'android'
			keyAlias 'androiddebugkey'
			keyPassword 'android'
		}
		release {
			storeFile file(keystoreProperties['prodStoreFile'])
			storePassword keystoreProperties['prodStorePassword']
			keyAlias keystoreProperties['prodKeyAlias']
			keyPassword keystoreProperties['prodKeyPassword']
		}
	}

	buildTypes {
		release {
			minifyEnabled true
			shrinkResources true
			proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//			firebaseCrashlytics {
//				mappingFileUploadEnabled true
//			}
		}
		debug {
			minifyEnabled false
		}
	}

	flavorDimensions "default"

	productFlavors {
		debugConfig {
			dimension "default"
			applicationId "com.dimowner.audiorecorder.debug"
			signingConfig = signingConfigs.dev
		}
		releaseConfig {
			dimension "default"
			signingConfig = signingConfigs.dev
			applicationId "com.dimowner.audiorecorder"
		}
	}

	compileOptions {
		sourceCompatibility = JavaVersion.VERSION_17
		targetCompatibility = JavaVersion.VERSION_17
	}

	lintOptions {
		abortOnError false
	}
}

// Remove not needed buildVariants.
android.variantFilter { variant ->
	if (variant.buildType.name == 'release'
			&& variant.getFlavors().get(0).name == 'debugConfig') {
		variant.setIgnore(true)
	}
	if (variant.buildType.name == 'debug'
			&& variant.getFlavors().get(0).name == 'releaseConfig') {
		variant.setIgnore(true)
	}
}

dependencies {
	def androidX = "1.3.2"
	def coroutines = "1.8.0"
	def timber = "5.0.1"

	//Kotlin
	implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
	implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines"
	implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines"

	//Timber
	implementation "com.jakewharton.timber:timber:$timber"
	implementation "androidx.recyclerview:recyclerview:$androidX"

	testImplementation("junit:junit:4.13.2")
	testImplementation("io.mockk:mockk:1.13.10")

//	// Import the BoM for the Firebase platform
//	implementation platform('com.google.firebase:firebase-bom:26.1.0')
//	// Declare the dependencies for the Crashlytics and Analytics libraries
//	// When using the BoM, you don't specify versions in Firebase library dependencies
//	implementation 'com.google.firebase:firebase-crashlytics'
//	implementation 'com.google.firebase:firebase-analytics'
}
