<?xml version="1.0" encoding="UTF-8"?>

<plugin id="cordova-fabric-plugin" version="1.1.10" xmlns="http://www.phonegap.com/ns/plugins/1.0">

    <name>cordova-fabric-plugin</name>
    <description>Cordova Fabric.io Plugin</description>
    <license>MIT</license>
    <keywords>cordova,fabric,craslytics,answers,events,device,ios,android</keywords>

    <preference name="FABRIC_API_KEY" />
    <preference name="FABRIC_API_SECRET" />

    <hook type="after_plugin_install" src="hooks/after_plugin_add.js" />
    <hook type="after_platform_add" src="hooks/after_plugin_add.js" />
    <hook type="before_plugin_uninstall" src="hooks/before_plugin_rm.js" />

    <js-module name="FabricPlugin" src="www/FabricPlugin.js">
        <clobbers target="window.cordovaFabricIoPlugin.core"/>
    </js-module>

    <js-module name="FabricAnswersPlugin" src="www/FabricPlugin.Answers.js">
        <clobbers target="window.cordovaFabricIoPlugin.Answers"/>
    </js-module>

    <js-module name="FabricCrashlyticsPlugin" src="www/FabricPlugin.Crashlytics.js">
        <clobbers target="window.cordovaFabricIoPlugin.Crashlytics"/>
    </js-module>

    <!-- android -->
    <platform name="android">
        <config-file parent="/*" target="res/xml/config.xml">
            <feature name="FabricPlugin">
                <param name="android-package" value="com.sarriaroman.fabric.FabricPlugin"/>
                <param name="onload" value="true" />
            </feature>
        </config-file>

        <config-file target="AndroidManifest.xml" parent="/*">
            <uses-permission android:name="android.permission.INTERNET" />
        </config-file>

        <config-file target="AndroidManifest.xml" parent="application">
            <meta-data android:name="io.fabric.ApiKey" android:value="$FABRIC_API_KEY"/>
        </config-file>

        <source-file src="src/android/FabricPlugin.java" target-dir="src/com/sarriaroman/fabric"/>
        <source-file src="src/android/JavaScriptException.java" target-dir="src/com/sarriaroman/fabric"/>

        <framework src="src/android/build-extras.gradle" custom="true" type="gradleReference" />
    </platform>

    <!-- ios -->
    <platform name="ios">
        <config-file parent="/*" target="config.xml">
            <feature name="FabricPlugin">
                <param name="ios-package" value="FabricPlugin"/>
                <param name="onload" value="true" />
            </feature>
        </config-file>

        <config-file target="*-Info.plist" parent="Fabric">
            <dict>
                <key>APIKey</key>
                <string>$FABRIC_API_KEY</string>
                <key>Kits</key>
                <array>
                    <dict>
                        <key>KitInfo</key>
                        <dict/>
                        <key>KitName</key>
                        <string>Crashlytics</string>
                    </dict>
                    <dict>
                        <key>KitInfo</key>
                        <dict/>
                        <key>KitName</key>
                        <string>Answers</string>
                    </dict>
                </array>
            </dict>
        </config-file>

        <source-file src="src/ios/FabricPlugin.m"/>

        <framework src="libz.dylib" />
        <framework src="libc++.dylib" />
        <framework src="SystemConfiguration.framework" />
        <framework src="Security.framework" weak="true" />

        <framework src="lib/ios/Fabric.framework" custom="true" />
        <framework src="lib/ios/Crashlytics.framework" custom="true" />
    </platform>

</plugin>