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

android {
    compileSdk 35
    namespace 'it.niedermann.nextcloud.deck'

    defaultConfig {
        applicationId "it.niedermann.nextcloud.deck"
        minSdk 24
        targetSdk 35
        versionCode 1024005
        versionName "1.24.5"
        vectorDrawables.useSupportLibrary true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
    }
    buildFeatures {
        viewBinding true
        buildConfig true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        coreLibraryDesugaringEnabled true
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = '17'
    }
    flavorDimensions = ["version"]
    productFlavors {
        fdroid {
            dimension "version"
        }
        dev {
            dimension "version"
            applicationIdSuffix ".dev"
        }
        play {
            dimension "version"
            applicationIdSuffix ".play"
        }
        pfungstadt {
            dimension "version"
            applicationIdSuffix ".pfungstadt"
        }
        mdm {
            dimension "version"
            applicationIdSuffix ".mdm"
        }
    }
    testOptions {
        unitTests {
            includeAndroidResources true
        }
    }
    lint {
        abortOnError false
        disable 'MissingTranslation'
    }
}

dependencies {
    def cameraVersion = "1.4.1"
    def lifecycleVersion = "2.8.7"
    def roomVersion = "2.6.1"
    def glideVersion = "4.16.0"
    def nextcloudCommonsVersion = "2.3.5"
    def androidCommonsVersion = "1.0.4"

    implementation project(path: ':cross-tab-drag-and-drop')
    implementation project(path: ':tab-layout-helper')

    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4'

    // Android X
    implementation 'androidx.appcompat:appcompat:1.7.0'
    implementation "androidx.camera:camera-camera2:$cameraVersion"
    implementation "androidx.camera:camera-lifecycle:$cameraVersion"
    implementation "androidx.camera:camera-view:$cameraVersion"
    implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
    implementation 'androidx.preference:preference-ktx:1.2.1'
    implementation "androidx.room:room-runtime:$roomVersion"
    annotationProcessor "androidx.room:room-compiler:$roomVersion"
    implementation 'androidx.core:core-splashscreen:1.0.1'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
    implementation 'androidx.work:work-runtime:2.10.0'
    implementation "com.google.android.material:material:$rootProject.materialVersion"

    // Glide
    implementation "com.github.bumptech.glide:glide:$glideVersion"
    annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"

    // Image compression
    implementation 'id.zelory:compressor:3.0.1'

    // Single-Sign-On
    implementation 'com.github.nextcloud:Android-SingleSignOn:1.3.2'
    implementation 'com.github.nextcloud:android-common:0.24.0'
    implementation "com.github.stefan-niedermann.nextcloud-commons:sso-glide:$nextcloudCommonsVersion"
    implementation "com.github.stefan-niedermann.nextcloud-commons:exception:$nextcloudCommonsVersion"
    implementation("com.github.stefan-niedermann.nextcloud-commons:markdown:$nextcloudCommonsVersion") {
        exclude group: 'org.jetbrains', module: 'annotations-java5'
    }
    implementation "com.github.stefan-niedermann.android-commons:util:$androidCommonsVersion"
    implementation "com.github.stefan-niedermann.android-commons:shared-preferences:$androidCommonsVersion"
    implementation "com.github.stefan-niedermann.android-commons:reactive-livedata:$androidCommonsVersion"

    // Custom Date / Time Picker for branding support
    implementation 'com.wdullaer:materialdatetimepicker:4.2.3'

    // Flexbox
    implementation 'com.google.android.flexbox:flexbox:3.0.0'

    // Custom Color Picker
    implementation 'com.github.skydoves:colorpickerview:2.3.0'

    // Gson
    implementation 'com.google.code.gson:gson:2.11.0'

    // Retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.11.0'

    // Zoom Layout
    implementation("com.otaliastudios:zoomlayout:1.9.0")

    // Tests
    testImplementation 'junit:junit:4.13.2'
    testImplementation 'org.robolectric:robolectric:4.14.1'
    testImplementation 'org.mockito:mockito-core:5.15.2'
    testImplementation 'androidx.test:core:1.6.1'
    testImplementation 'androidx.arch.core:core-testing:2.2.0'
}
