plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"

    id "com.google.gms.google-services"
    id "com.google.firebase.crashlytics"
    id "com.google.firebase.firebase-perf"
}


def devStore = new Properties()
def devStoreFile = rootProject.file('dev.properties')
if (devStoreFile.exists()) {
    devStore.load(new FileInputStream(devStoreFile))
}

def prodStore = new Properties()
def prodStoreFile = rootProject.file('prod.properties')
if (prodStoreFile.exists()) {
    prodStore.load(new FileInputStream(prodStoreFile))
}


android {
    namespace "com.onemdev.flutter_ui_challenges"
    compileSdk 35
    ndkVersion '27.2.12479018'

    compileOptions {
        coreLibraryDesugaringEnabled true
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        applicationId "com.onemdev.flutter_ui_challenges"
        vectorDrawables.useSupportLibrary = true
        minSdk 23
        targetSdk 35
        multiDexEnabled true
        buildToolsVersion '35.0.0'
        versionCode = flutter.versionCode
        versionName = flutter.versionName
    }
    signingConfigs {
        debug {
            keyAlias devStore['keyAlias']
            keyPassword devStore['keyPassword']
            storeFile file(devStore['storeFile'])
            storePassword devStore['storePassword']
        }
        release {
            keyAlias prodStore['keyAlias']
            keyPassword prodStore['keyPassword']
            storeFile file(prodStore['storeFile'])
            storePassword prodStore['storePassword']
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            signingConfig signingConfigs.release
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2'
    implementation 'androidx.window:window:1.0.0'
    implementation 'androidx.window:window-java:1.0.0'
}
