apply plugin: 'com.android.application'

//def keystorePropertiesFile = rootProject.file("keystore.properties")
//def keystoreProperties = new Properties()
//keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
    compileSdkVersion = 31

    defaultConfig {
        applicationId = "eu.faircode.netguard"
        versionName = "2.303"
        minSdkVersion 22
        targetSdkVersion 31
        versionCode = 2022111001
        archivesBaseName = "NetGuard-v$versionName"

        externalNativeBuild {
            cmake {
                cppFlags ""
                arguments "-DANDROID_PLATFORM=android-22"
                // https://developer.android.com/ndk/guides/cmake.html
            }
        }

        //ndkVersion "21.4.7075529"
        ndk {
            // https://developer.android.com/ndk/guides/abis.html#sa
            abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
        }
    }
    signingConfigs {
        release {
            //storeFile file(keystoreProperties['storeFile'])
            //storePassword keystoreProperties['storePassword']
            //keyAlias keystoreProperties['keyAlias']
            //keyPassword keystoreProperties['keyPassword']
            storeFile file("my.keystore")
            storePassword "store_password"
            keyAlias "my_key_alias"
            keyPassword "key_password"

        }
    }


    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }

    buildTypes {
        release {
            minifyEnabled = true
            //proguardFiles.add(file('proguard-rules.pro'))
            signingConfig signingConfigs.release
            buildConfigField "boolean", "PLAY_STORE_RELEASE", "false"
            buildConfigField "String", "HOSTS_FILE_URI", "\"https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts\""
            buildConfigField "String", "GITHUB_LATEST_API", "\"https://api.github.com/repos/M66B/NetGuard/releases/latest\""
        }
        play {
            minifyEnabled = true
            signingConfig signingConfigs.release
            //proguardFiles.add(file('proguard-rules.pro'))
            buildConfigField "boolean", "PLAY_STORE_RELEASE", "true"
            buildConfigField "String", "HOSTS_FILE_URI", "\"\""
            buildConfigField "String", "GITHUB_LATEST_API", "\"\""
        }
        debug {
            minifyEnabled = true
            proguardFiles.add(file('proguard-rules.pro'))
            buildConfigField "boolean", "PLAY_STORE_RELEASE", "false"
            buildConfigField "String", "HOSTS_FILE_URI", "\"https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts\""
            buildConfigField "String", "GITHUB_LATEST_API", "\"https://api.github.com/repos/M66B/NetGuard/releases/latest\""
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    lint {
        disable 'MissingTranslation'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    // https://developer.android.com/jetpack/androidx/releases/
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
    implementation 'androidx.recyclerview:recyclerview:1.2.1'
    implementation 'androidx.preference:preference:1.1.1'
    implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    annotationProcessor 'androidx.annotation:annotation:1.2.0'

    // https://bumptech.github.io/glide/
    implementation('com.github.bumptech.glide:glide:4.11.0') {
        exclude group: "com.android.support"
    }
    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
}
