apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
apply plugin: "com.google.gms.google-services"
apply plugin: "com.google.firebase.crashlytics"


react {
    autolinkLibrariesWithApp()
}

def enableProguardInReleaseBuilds = false
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'

android {
    namespace "com.performics"
    compileSdk rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        applicationId "com.performics"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 183
        versionName "7.3"
        missingDimensionStrategy 'react-native-camera', 'general'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = "17"
    }

    signingConfigs {
        debug {
            if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
                storeFile file(MYAPP_UPLOAD_STORE_FILE)
                storePassword MYAPP_UPLOAD_STORE_PASSWORD
                keyAlias MYAPP_UPLOAD_KEY_ALIAS
                keyPassword MYAPP_UPLOAD_KEY_PASSWORD
            }
            else{
                storeFile file('debug.keystore')
                storePassword 'android'
                keyAlias 'androiddebugkey'
                keyPassword 'android'
            }
        }
        release {
            if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
                storeFile file(MYAPP_UPLOAD_STORE_FILE)
                storePassword MYAPP_UPLOAD_STORE_PASSWORD
                keyAlias MYAPP_UPLOAD_KEY_ALIAS
                keyPassword MYAPP_UPLOAD_KEY_PASSWORD
            }
            else{
                storeFile file('debug.keystore')
                storePassword 'android'
                keyAlias 'androiddebugkey'
                keyPassword 'android'
            }
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            shrinkResources false 
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

    configurations.configureEach {
        resolutionStrategy {
            force 'androidx.core:core:1.16.0'
            force 'androidx.appcompat:appcompat:1.6.1'
        }
    }
}

dependencies {
    implementation("com.facebook.react:react-android")
    // Agar Hermes band kar ke JSC chahie to:
    // implementation jscFlavor
    implementation 'com.google.android.gms:play-services-location:21.0.1'
    implementation project(':CameraAI')
    implementation "androidx.activity:activity-ktx:1.8.0"
    // 🔹 ML Kit dependencies (IMPORTANT)
    // Barcode scanning
    implementation "com.google.mlkit:barcode-scanning:17.2.0"
    // Text recognition (kyunki error me TextRecognizer aa raha hai)
    implementation "com.google.mlkit:text-recognition:16.0.0"
    // Import the Firebase BoM
     implementation(platform("com.google.firebase:firebase-bom:34.10.0"))
     implementation("com.google.firebase:firebase-analytics")
     implementation 'com.google.firebase:firebase-messaging'
     implementation "com.google.firebase:firebase-crashlytics"
     implementation 'com.facebook.fresco:animated-gif:3.6.0'
}

