plugins {
    id "com.android.application"
    // START: FlutterFire Configuration
    id 'com.google.gms.google-services'
    id 'com.google.firebase.crashlytics'
    // END: FlutterFire Configuration
    id "kotlin-android"
    // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
    id "dev.flutter.flutter-gradle-plugin"
}

android {
    namespace = "com.example.troywallet"
    compileSdk = 36
    ndkVersion = "25.1.8937393"
    //ndkVersion = flutter.ndkVersion

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

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId = "com.example.troywallet"
        namespace("com.example.troywallet")
        minSdk = 29
        targetSdk = 35
        versionCode = flutter.versionCode
        versionName = flutter.versionName
        multiDexEnabled true

    }

       // KeyStore //////////////////////////////////////////////////
    //  - kast.keystore..alias android..pw=android..pw=android
    def keystorePropertiesFileNameDev = 'kast_key_dev.properties'
    def keystorePropertiesDev = new Properties()
    keystorePropertiesDev.load(new FileInputStream(rootProject.file(keystorePropertiesFileNameDev)))

    def keystorePropertiesFileNameUat = 'kast_key_uat.properties'
    def keystorePropertiesUat = new Properties()
    keystorePropertiesUat.load(new FileInputStream(rootProject.file(keystorePropertiesFileNameUat)))

    def keystorePropertiesFileNameStaging = 'kast_key_staging.properties'
    def keystorePropertiesStaging = new Properties()
    keystorePropertiesStaging.load(new FileInputStream(rootProject.file(keystorePropertiesFileNameStaging)))

    def keystorePropertiesFileNameProd = 'kast_key_prod.properties'
    def keystorePropertiesProd = new Properties()
    keystorePropertiesProd.load(new FileInputStream(rootProject.file(keystorePropertiesFileNameProd)))


    signingConfigs {
        configDev {
            keyAlias keystorePropertiesDev['keyAlias']
            keyPassword keystorePropertiesDev['keyPassword']
            storeFile file('../kast_android_dev.jks') //keystorePropertiesSit['storeFile']
            storePassword keystorePropertiesDev['storePassword']
        }
        configUat {
            keyAlias keystorePropertiesUat['keyAlias']
            keyPassword keystorePropertiesUat['keyPassword']
            storeFile file('../kast_android_uat.jks') //keystorePropertiesPat['storeFile']
            storePassword keystorePropertiesUat['storePassword']
        }

        configStaging {
            keyAlias keystorePropertiesStaging['keyAlias']
            keyPassword keystorePropertiesStaging['keyPassword']
            storeFile file('../kast_android_staging.jks') //keystorePropertiesPat['storeFile']
            storePassword keystorePropertiesStaging['storePassword']
        }
        configProd {
            keyAlias keystorePropertiesProd['keyAlias']
            keyPassword keystorePropertiesProd['keyPassword']
            storeFile file('../kast_android_prod.jks')
            storePassword keystorePropertiesProd['storePassword']
        }
    }

    flavorDimensions "default"
    productFlavors {
        dev {
            dimension "default"
            applicationId "dev.kastcard.com"
            resValue "string", "app_name", "KAST DEV"
            resValue "string", "deeplink_prefix", "/dls"
            resValue "drawable", "ic_launcher", "@mipmap/ic_launcher_dev"
            signingConfig signingConfigs.configDev
        }
        uat {
            dimension "default"
            applicationId "uat.kastcard.com"
            resValue "string", "app_name", "KAST UAT"
            resValue "string", "deeplink_prefix", "/dlp"
            resValue "drawable", "ic_launcher", "@mipmap/ic_launcher_uat"
            signingConfig signingConfigs.configUat
        }
        staging {
            dimension "default"
            applicationId "stg.kastcard.com"
            resValue "string", "app_name", "KAST Staging"
            resValue "string", "deeplink_prefix", "/dlp"
            resValue "drawable", "ic_launcher", "@mipmap/ic_launcher_staging"
            signingConfig signingConfigs.configStaging
        }
        prod {
            dimension "default"
            applicationId "com.kastfinance.app"
            resValue "string", "app_name", "KAST"
            resValue "string", "deeplink_prefix", "/dlp"
            resValue "drawable", "ic_launcher", "@mipmap/ic_launcher_prod"
            signingConfig signingConfigs.configProd
        }

    }

    buildTypes {
        release {
            shrinkResources false
            minifyEnabled false
        }

    }
}

flutter {
    source = "../.."
}

dependencies {
    implementation "com.sumsub.sns:idensic-mobile-sdk-videoident:1.33.1"
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2'
    implementation(files("libs/mdisdk-release-1.2.54.aar"))
}
