apply plugin: 'com.android.library'

// source:
// https://stackoverflow.com/questions/21329849/set-android-app-version-using-gradle
def computeVersionName() {
    return "1.0.15"
}

android {
    compileSdkVersion 27
    buildToolsVersion '28.0.3'
    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 26

        versionCode 41
        versionName computeVersionName()
    }

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

    lintOptions {
        abortOnError false
    }
}

dependencies {

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

    // android framework
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.android.support:cardview-v7:27.0.2'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'

    // firebase sdk
    implementation 'com.google.firebase:firebase-core:11.8.0'
    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.google.firebase:firebase-storage:11.8.0'
    implementation 'com.google.firebase:firebase-crash:11.8.0'
    implementation 'com.google.firebase:firebase-messaging:11.8.0'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.firebase:firebase-firestore:11.8.0'


//    compile 'com.firebaseui:firebase-ui:2.3.0'

    // image loading and caching
    implementation 'com.github.bumptech.glide:glide:3.7.0'

//    implementation 'org.ocpsoft.prettytime:prettytime:4.0.1.Final'
    implementation 'org.apache.httpcomponents:httpcore:4.3'

    // send message panel
    implementation 'com.vanniktech:emoji-ios:0.5.1'
    implementation 'com.vanniktech:emoji-google:0.5.1'

//    // file picker
//    // source: https://github.com/Angads25/android-filepicker
//    compile 'com.github.angads25:filepicker:1.1.1'

    // swipe layout
    // source : https://github.com/daimajia/AndroidSwipeLayout
    implementation "com.daimajia.swipelayout:library:1.2.0@aar"
}

// resolve conflicts
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        // android resolution
        // source : https://stackoverflow.com/questions/43280871/android-getting-manifest-merger-failed-error-after-update-to-new-version-of-grad
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '26.1.0'
            }
        }

        // firebase resolution
        // source : https://github.com/firebase/FirebaseUI-Android/issues/218
        if (details.requested.group == 'com.google.firebase' ||
                details.requested.group == 'com.google.android.gms') {
            details.useVersion '11.8.0'
        }
    }
}

ext {
    bintrayRepo = 'maven'
    bintrayName = 'chat21'

    publishedGroupId = 'org.chat21.android'
    libraryName = 'chat21'
    artifact = 'chat21'

    libraryDescription = 'Android Chat SDK built on Firebase'

    siteUrl = 'http://www.chat21.org/'
    gitUrl = 'https://github.com/chat21/chat21-android-sdk.git'

    libraryVersion = computeVersionName()
    developerId = 'frontiere21'
    developerName = 'Stefano De Pascalis'
    developerEmail = 'stefano.depascalis@frontiere21.it'

    licenseName = 'AGPL-V3'
    licenseUrl = 'https://github.com/chat21/chat21-android-sdk/blob/master/LICENSE.txt'
    allLicenses = ["AGPL-V3"]
}

//apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
//apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'