apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"
    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 29
        versionCode 377
        versionName "2.37.0-beta-1"
        multiDexEnabled true
        renderscriptTargetApi 28 as int
        renderscriptSupportModeEnabled true

    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    flavorDimensions "default"
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            pseudoLocalesEnabled true
        }
    }


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    productFlavors {
        fdroid {
            applicationId "fr.gouv.etalab.mastodon"
            buildConfigField "boolean", "DONATIONS", "true"
            buildConfigField "boolean", "lite", "false"
        }
        lite {
            minSdkVersion 21
            applicationId "app.fedilab.lite"
            buildConfigField "boolean", "DONATIONS", "true"
            buildConfigField "boolean", "lite", "true"
        }
        playstore {
            applicationId "app.fedilab.android"
            buildConfigField "boolean", "DONATIONS", "false"
            buildConfigField "boolean", "lite", "false"
        }
    }

    sourceSets {
        playstore {
            manifest.srcFile "src/common/AndroidManifest.xml"
            assets.srcDirs = ['/src/mains/assets', 'src/common/assets']
            java.srcDirs = ['src/main/java', 'src/playstore/java','src/common/java']
            res.srcDirs = ['src/main/res', 'src/playstore/res','src/common/res']
        }

        fdroid {
            manifest.srcFile "src/common/AndroidManifest.xml"
            assets.srcDirs = ['/src/mains/assets', 'src/common/assets']
            java.srcDirs = ['src/main/java', 'src/fdroid/java','src/common/java']
            res.srcDirs = ['src/main/res', 'src/fdroid/res','src/common/res']
        }
        lite {
            manifest.srcFile "src/lite/AndroidManifest.xml"
            assets.srcDirs = ['/src/mains/assets']
            java.srcDirs = ['src/main/java', 'src/lite/java']
            res.srcDirs = ['src/main/res', 'src/lite/res']
        }
    }

    packagingOptions {
        exclude 'META-INF/proguard/androidx-annotations.pro'
    }
    viewBinding.enabled = true
}
allprojects {
    repositories {
        maven { url "https://jitpack.io" }
        maven { url "https://maven.google.com"}
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    }
}


task copyAllReleaseNotes(type: Copy) {
    from "$buildDir/../src/main/assets/changelogs/"
    include "*.txt"
    into "$buildDir/../../fastlane/metadata/android/en-US/changelogs/"
}

task gitPushReleaseNotes(type: Exec, dependsOn: 'copyAllReleaseNotes') {
    ['sh', '-c', "git add $buildDir/../../fastlane/metadata/android/en-US/changelogs/*"].execute().text.trim()
    ['sh', '-c', "git commit -m 'copy release notes'"].execute().text.trim()
    ['sh', '-c', "git push"].execute().text.trim()
}



dependencies {
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.browser:browser:1.2.0'
    implementation 'androidx.exifinterface:exifinterface:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.0.2'
    implementation "com.github.bumptech.glide:glide:4.11.0"
    implementation ("com.github.bumptech.glide:recyclerview-integration:4.11.0") {
        // Excludes the support library because it's already included by Glide.
        transitive = false
    }
    annotationProcessor "com.github.bumptech.glide:compiler:4.11.0"
    annotationProcessor 'com.android.support:support-annotations:28.0.0'

    implementation "com.evernote:android-job:1.2.6"
    implementation "com.google.code.gson:gson:2.8.6"
    implementation "com.google.guava:guava:28.2-android"
    implementation "com.github.chrisbanes:PhotoView:2.3.0"
    implementation 'com.r0adkll:slidableactivity:2.1.0'
    implementation 'com.github.stom79:mytransl:2.0'
    implementation 'com.github.stom79:SparkButton:1.0.13'
    implementation "com.koushikdutta.async:androidasync:2.+"
    implementation 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
    implementation 'com.github.franmontiel:LocaleChanger:0.9.2'
    implementation 'com.github.GrenderG:Toasty:1.4.2'
    implementation 'com.elconfidencial.bubbleshowcase:bubbleshowcase:1.3.1'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.google.android.exoplayer:exoplayer:2.10.6'
    implementation 'org.apache.poi:poi:3.16'
    implementation 'com.github.mabbas007:TagsEditText:1.0.5'
    implementation "com.tonyodev.fetch2:fetch2:2.3.6"
    implementation 'jp.wasabeef:glide-transformations:4.0.0'



    implementation 'com.jaredrummler:cyanea:1.0.2'
    implementation "net.gotev:uploadservice:3.5.2"
    implementation "net.gotev:uploadservice-okhttp:3.5.2"
    implementation "info.guardianproject.netcipher:netcipher:2.0.0-alpha1"
    implementation "info.guardianproject.netcipher:netcipher-okhttp3:2.0.0-alpha1"

    implementation  'com.github.adrielcafe:AndroidAudioRecorder:0.3.0'
    implementation 'yogesh.firzen:MukkiyaSevaigal:1.0.6'
    implementation 'com.iceteck.silicompressorr:silicompressor:2.2.2'
    implementation "ch.acra:acra-mail:5.5.0"
    implementation "ch.acra:acra-limiter:5.5.0"
    implementation "ch.acra:acra-notification:5.5.0"
    implementation 'com.github.duanhong169:colorpicker:1.1.6'
    implementation 'com.github.penfeizhou.android.animation:glide-plugin:2.2.0'
    implementation 'com.github.stom79:Android-WYSIWYG-Editor:3.2.1'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
    implementation 'com.github.smarteist:autoimageslider:1.3.2'
    //debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'
    implementation 'com.huangyz0918:androidwm-light:0.1.2'

    //Flavors

    //Playstore
    playstoreApi 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
    playstoreImplementation "io.github.kobakei:ratethisapp:1.2.0"
    playstoreImplementation "org.conscrypt:conscrypt-android:2.4.0"
    playstoreImplementation 'com.github.stom79:country-picker-android:1.2.0'
    playstoreImplementation 'com.vanniktech:emoji-one:0.6.0'
    playstoreImplementation 'ja.burhanrashid52:photoeditor:0.4.0'


    //Fdroid
    fdroidApi 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
    fdroidImplementation "org.conscrypt:conscrypt-android:2.4.0"
    fdroidImplementation 'com.github.stom79:country-picker-android:1.2.0'
    fdroidImplementation 'com.vanniktech:emoji-one:0.6.0'
    fdroidImplementation 'ja.burhanrashid52:photoeditor:0.4.0'

}
