<?xml version='1.0' encoding='utf-8'?>
<plugin id="cordova-plugin-appcenter-crashes"
        version="0.5.1"
        xmlns="http://apache.org/cordova/ns/plugins/1.0"
        xmlns:android="http://schemas.android.com/apk/res/android">

    <name>App Center Crashes for Cordova</name>
    <description>
        Provides Microsoft Azure App Center Crashes client for Cordova
    </description>
    <license>MIT</license>
    <keywords>microsoft, azure, app center, crashes</keywords>
    <repo>https://github.com/Microsoft/appcenter-sdk-cordova</repo>
    <issue>https://github.com/Microsoft/appcenter-sdk-cordova/issues</issue>


    <!-- Required gradle functionality support -->
    <engine name="cordova-android" version=">=4.1.0" />
    <!-- Cordova 6.4.0 and iOS 4.3.0 are required for Cocoapods support -->
    <engine name="cordova" version=">=6.4.0" />
    <engine name="cordova-ios" version=">=4.3.0" />

    <dependency id="cordova-plugin-appcenter-shared" version="0.5.1"/>

    <js-module name="Crashes" src="www/Crashes.js">
        <clobbers target="AppCenter.Crashes" />
    </js-module>

    <platform name="android">
        <config-file target="res/xml/config.xml" parent="/*">
            <feature name="AppCenterCrashes">
                <param name="onload" value="true" />
                <param name="android-package"
                       value="com.microsoft.azure.mobile.cordova.AppCenterCrashesPlugin"/>
            </feature>
        </config-file>

        <config-file target="AndroidManifest.xml" parent="/manifest">
            <!-- TODO: check if permission below is needed -->
            <uses-permission android:name="android.permission.INTERNET" />
        </config-file>

        <framework src="com.microsoft.appcenter:appcenter-crashes:2.4.1" />

        <source-file src="src/android/AppCenterCrashesPlugin.java"
                     target-dir="src/com/microsoft/azure/mobile/cordova" />

        <source-file src="src/android/CordovaCrashListener.java"
                     target-dir="src/com/microsoft/azure/mobile/cordova" />

        <source-file src="src/android/CrashesUtils.java"
                     target-dir="src/com/microsoft/azure/mobile/cordova" />
    </platform>

    <platform name="ios">
        <config-file target="config.xml" parent="/*">
            <feature name="AppCenterCrashes">
                <param name="ios-package" value="AppCenterCrashesPlugin" />
                <param name="onload" value="true" />
            </feature>
        </config-file>

        <header-file src="src/ios/AppCenterCrashesPlugin.h" />
        <source-file src="src/ios/AppCenterCrashesPlugin.m" />

        <header-file src="src/ios/CordovaCrashesDelegate.h" />
        <source-file src="src/ios/CordovaCrashesDelegate.m" />

        <header-file src="src/ios/CrashesUtils.h" />
        <source-file src="src/ios/CrashesUtils.m" />

        <podspec>
            <config>
                <source url="https://github.com/CocoaPods/Specs.git"/>
            </config>
            <pods use-frameworks="true">
                <pod name="AppCenter/Crashes" spec="~> 2.5.0" />
            </pods>
        </podspec>

        <framework src="AppCenter" type="podspec" spec="~> 2.5.0" />
    </platform>
</plugin>
