apply plugin: 'com.android.library'

def safeExtGet(prop, fallback) {
    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

android {
    compileSdkVersion safeExtGet('compileSdkVersion', 28)
    buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')

    defaultConfig {
        minSdkVersion safeExtGet('minSdkVersion', 16)
    }
    buildTypes {
        release {
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"

    // api is used instead of implementation so the parent :app project can access any of the OneSignal Java
    //   classes if needed. Such as com.onesignal.NotificationExtenderService
    api 'com.onesignal:OneSignal:4.2.0'

    testImplementation 'junit:junit:4.12'
}

// Add the following to the top (Line 1) of your app/build.gradle if you run into any issues with duplicate classes.
// Such as the following error
//   Error: more than one library with package name 'com.google.android.gms.license'

/*
plugins {
    id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
*/
