apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 31

    defaultConfig {
        applicationId "io.heckel.ntfy"
        minSdkVersion 21
        targetSdkVersion 31

        versionCode 23
        versionName "1.9.1"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        /* Required for Room schema migrations */
        javaCompileOptions {
            annotationProcessorOptions {
                arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
    }

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

    flavorDimensions "store"
    productFlavors {
        play {
            buildConfigField 'boolean', 'FIREBASE_AVAILABLE', 'true'
            buildConfigField 'boolean', 'RATE_APP_AVAILABLE', 'true'
        }
        fdroid {
            buildConfigField 'boolean', 'FIREBASE_AVAILABLE', 'false'
            buildConfigField 'boolean', 'RATE_APP_AVAILABLE', 'false'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

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

dependencies {
    // AndroidX, The Basics
    implementation "androidx.appcompat:appcompat:1.4.1"
    implementation "androidx.core:core-ktx:1.7.0"
    implementation "androidx.constraintlayout:constraintlayout:2.1.3"
    implementation "androidx.activity:activity-ktx:1.4.0"
    implementation "androidx.fragment:fragment-ktx:1.4.1"
    implementation "androidx.work:work-runtime-ktx:2.7.1"
    implementation 'androidx.preference:preference-ktx:1.2.0'

    // JSON serialization
    implementation 'com.google.code.gson:gson:2.8.9'

    // Room (SQLite)
    def room_version = "2.4.1"
    implementation "androidx.room:room-ktx:$room_version"
    kapt "androidx.room:room-compiler:$room_version"

    // OkHttp (HTTP library)
    implementation 'com.squareup.okhttp3:okhttp:4.9.3'

    // Firebase, sigh ... (only Google Play)
    playImplementation 'com.google.firebase:firebase-messaging:23.0.0'

    // RecyclerView
    implementation "androidx.recyclerview:recyclerview:1.3.0-alpha01"

    // Swipe down to refresh
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

    // Material design
    implementation "com.google.android.material:material:1.5.0"

    // LiveData
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.1"
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'

    // Image viewer
    implementation 'com.github.stfalcon-studio:StfalconImageViewer:v1.0.1'
}
