apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.aefyr.sai"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 60
        versionName "4.5"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    flavorDimensions "version"
    productFlavors {
        normal {
            dimension "version"
            buildConfigField "int", "DEFAULT_THEME", "0"
            buildConfigField "int", "DEFAULT_DARK_THEME", "1"
            buildConfigField "boolean", "HIDE_DONATE_BUTTON", "false"
        }

        fdroid {
            dimension "version"
            applicationId "com.aefyr.sai.fdroid"
            buildConfigField "int", "DEFAULT_THEME", "6"
            buildConfigField "int", "DEFAULT_DARK_THEME", "11"
            buildConfigField "boolean", "HIDE_DONATE_BUTTON", "false"
        }
    }

    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.documentfile:documentfile:1.0.1'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-common-java8:2.2.0'
    implementation 'androidx.preference:preference:1.1.1'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'com.google.android.material:material:1.3.0-rc01'

    implementation 'com.github.bumptech.glide:glide:4.11.0'
    implementation 'com.google.android:flexbox:2.0.1'
    implementation 'com.tomergoldst.android:tooltips:1.0.11'
    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'com.facebook.shimmer:shimmer:0.5.0'
    implementation 'com.github.aefyr.flexfilter:flexfilter:0.9-alpha'
    implementation 'com.github.aefyr:pseudoapksigner:1.6'

    def room_version = "2.2.6"
    implementation "androidx.room:room-runtime:$room_version"
    annotationProcessor "androidx.room:room-compiler:$room_version"

    //Google services
    normalImplementation 'com.google.firebase:firebase-analytics:18.0.2'
    normalImplementation 'com.google.firebase:firebase-crashlytics:17.3.1'
    normalImplementation 'com.android.billingclient:billing:3.0.2'

    //Shizuku/Sui
    def shizuku_version = '11.0.1'
    implementation "rikka.shizuku:api:$shizuku_version"
    implementation "rikka.shizuku:provider:$shizuku_version"

    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.3'
}

if (getGradle().getStartParameter().getTaskRequests().toString().contains("Normal")){
    println "Google Play build detected, applying Google Services and Crashlytics plugins"
    apply plugin: 'com.google.gms.google-services'
    apply plugin: 'com.google.firebase.crashlytics'
}


