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

android {
    compileSdk rootProject.ext.compileSdkVersion
    defaultConfig {
        applicationId "in.beaconcha.mobile"
        namespace "in.beaconcha.mobile"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 120
        versionName "5.0.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_17.toString()
    }

    flavorDimensions += "environment"
    productFlavors {
        prod {
            dimension "environment"
            manifestPlaceholders = [appLabel:"@string/app_name", loginCallbackScheme:"@string/custom_url_scheme", "appAuthRedirectScheme": "beaconchainmobile"]
        }
        beta {
            dimension "environment"
            applicationIdSuffix ".beta"
            manifestPlaceholders = [appLabel:"@string/app_name_beta", loginCallbackScheme:"@string/custom_url_scheme_beta", "appAuthRedirectScheme": "beaconchainmobilebeta"]
        }
        nogoogle {
            dimension "environment"
            applicationIdSuffix ".nogoo"
            manifestPlaceholders = [appLabel:"@string/app_name", loginCallbackScheme:"@string/custom_url_scheme", "appAuthRedirectScheme": "beaconchainmobile"]
        }
    }
}

repositories {
    flatDir {
        dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
    }
    mavenCentral()
}

dependencies {
    implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
    implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
    implementation project(':capacitor-android')
    testImplementation "junit:junit:$junitVersion"
    androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
    androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
    implementation project(':capacitor-cordova-android-plugins')
    implementation "androidx.core:core-ktx:1.8.0"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "com.squareup.okhttp3:okhttp:4.9.0"
    implementation 'com.google.code.gson:gson:2.8.9'
    //implementation 'com.google.firebase:firebase-iid:21.1.0'
    def work_version = "2.7.1"

    implementation "androidx.work:work-runtime-ktx:$work_version"

}

apply from: 'capacitor.build.gradle'

if (!getGradle().getStartParameter().getTaskRequests().toString().contains("Nogoogle")){
    apply plugin: 'com.google.gms.google-services'
}