apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'


buildscript {
    ext.kotlin_version = '1.7.20'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}


android {
    compileSdkVersion 34

    defaultConfig {
        minSdkVersion 23
        targetSdkVersion 34
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        ndk {
            abiFilters "armeabi-v7a","arm64-v8a"
        }

        //load the Tuya secrets from local.properties file
        def secretsFile = file("local.properties")
        def properties = new Properties()
        properties.load(new FileInputStream(secretsFile))

        //fetch the keys
        def appKey = properties.getProperty("THING_SMART_APPKEY") ?: ""
        def secret = properties.getProperty("THING_SMART_SECRET") ?: ""

        //inject the key dynamically into the manifest
        manifestPlaceholders = [
          THING_SMART_APPKEY: appKey,
          THING_SMART_SECRET: secret
        ]
    }

    namespace 'com.tuya.smart.rnsdk'

    packagingOptions {
        pickFirst 'lib/*/libc++_shared.so'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

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

configurations.all {
  exclude group: "com.thingclips.smart", module: 'thingsmart-modularCampAnno'
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.aar'])
    implementation 'com.alibaba:fastjson:1.1.67.android'
    implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.14.9'
    implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0'
    implementation 'com.thingclips.smart:thingsmart:6.2.1'
    implementation 'com.facebook.soloader:soloader:0.10.4+'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.facebook.react:react-android:0.76.6'
    implementation 'com.facebook.react:hermes-android:0.76.6'
    implementation 'de.greenrobot:eventbus:2.4.0'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.7'
    implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
    implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
}

repositories {
    google()
    mavenCentral()
    maven { url 'https://maven-other.tuya.com/repository/maven-releases/' }
    maven { 
      url "https://maven-other.tuya.com/repository/maven-commercial-releases/"
      mavenContent {
        releasesOnly()
      }
    }
    maven { url 'https://jitpack.io' }
    maven { url 'https://maven.aliyun.com/repository/public/' }
    maven { url 'https://maven.aliyun.com/repository/central/' }
    maven { url 'https://maven.aliyun.com/nexus/content/repositories/central/' }
    maven { url 'https://repo1.maven.org/maven2/' }
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
    maven { url 'https://developer.huawei.com/repo/' }
}

allprojects {
  repositories {
    maven { url 'https://maven-other.tuya.com/repository/maven-releases/' }
    maven { 
      url "https://maven-other.tuya.com/repository/maven-commercial-releases/"
      mavenContent {
        releasesOnly()
      }
    }
  }
}
