apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

android {
    signingConfigs {
        release {
            storeFile file("$project.rootDir/keystores/CanZeKeyStore.jks")
            storePassword 'canze4us!'
            keyAlias = 'canze-upload'
            keyPassword 'canze4us!'
        }
    }
    compileSdk 33

    defaultConfig {
        applicationId "lu.fisch.canze"
        minSdkVersion 21
        versionName '1.68beta2'
        versionCode 102
    }
    buildTypes {
        release {
        //  minifyEnabled false
        //  minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        //debug {
        //    minifyEnabled true
        //    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        //}
    }
    flavorDimensions "edition"
    productFlavors {
        playstore {
            dimension "edition"
        }
        fdroid {
            dimension "edition"
        }
    }
    defaultConfig {

        targetSdk 33
        buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"
        buildConfigField "String", "BRANCH", "\"" + getGitRevParseInfo() + "\""
        signingConfig signingConfigs.release
    }
    namespace 'lu.fisch.canze'
    lint {
        abortOnError false
        checkReleaseBuilds false
        disable 'TypographyFractions'
    }
}

def getGitRevParseInfo() {
    def cmd = "git rev-parse --abbrev-ref HEAD"
    def proc = cmd.execute()
    proc.text.trim()
}

dependencies {
    // BoM for the Firebase platform
    playstoreImplementation platform('com.google.firebase:firebase-bom:32.2.2')

    // Dependencies for the desired Firebase products without specifying versions
    playstoreImplementation 'com.google.firebase:firebase-analytics:21.3.0'
    playstoreImplementation 'com.google.firebase:firebase-crashlytics:18.4.0'

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'me.drakeet.support:toastcompat:1.1.0'
    implementation 'com.google.code.gson:gson:2.10.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.preference:preference:1.2.1'

    implementation 'com.google.firebase:firebase-crashlytics-ktx:18.4.0'
    implementation 'com.google.firebase:firebase-analytics-ktx:21.3.0'

    //implementation 'com.firebase:firebase-client-android:2.5.0'


}
