plugins {
    id "com.android.application"
    id "io.sentry.android.gradle" version "5.11.0"
    id "com.google.gms.google-services"
}

android {
    compileSdk = 36
    defaultConfig {
        applicationId "com.doubleangels.nextdnsmanagement"
        minSdkVersion 32
        targetSdk = 35
        versionCode 265
        versionName "5.5.16"
        resourceConfigurations += ["en", "zh", "nl", "fi", "fr", "de", "in", "it", "ja", "pl", "pt", "es", "sv", "tr"]
    }

    productFlavors {
        flavorDimensions "version"
        gms {
            dimension "version"
            applicationId "com.doubleangels.nextdnsmanagement"
        }
        foss {
            dimension "version"
            applicationId "com.doubleangels.nextdnsmanagement"
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            shrinkResources = true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            debuggable false
        }
    }
    namespace = 'com.doubleangels.nextdnsmanagement'
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_21
        targetCompatibility JavaVersion.VERSION_21
    }
    dependenciesInfo {
        includeInApk = true
        includeInBundle = true
    }

    packagingOptions {
        jniLibs {
            useLegacyPackaging = true
        }
    }

    bundle {
        language {
            enableSplit = false
        }
    }

    buildFeatures {
        buildConfig = true
    }
}

dependencies {
    implementation "androidx.activity:activity:1.11.0"
    implementation 'androidx.appcompat:appcompat:1.7.1'
    implementation "androidx.biometric:biometric:1.4.0-alpha04"
    implementation 'androidx.preference:preference:1.2.1'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
    implementation 'androidx.webkit:webkit:1.14.0'
    implementation 'com.google.android.material:material:1.13.0'
    gmsImplementation 'com.google.firebase:firebase-messaging:25.0.1'
    implementation 'com.squareup.retrofit2:converter-gson:3.0.0'
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'io.sentry:sentry-android:8.21.1'
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.14'
}

sentry {
    authToken = System.getenv("SENTRY_AUTH_TOKEN")
    includeProguardMapping = true
    autoUploadProguardMapping = true
    uploadNativeSymbols = true
    autoUploadNativeSymbols = true
    includeNativeSources = true
    includeSourceContext = true
}

afterEvaluate {
    tasks.matching { task ->
        task.name.startsWith("processFoss") && task.name.endsWith("GoogleServices")
    }.configureEach { task ->
        task.enabled = false
    }
}
