<?xml version="1.0" encoding="UTF-8"?>
<plugin id="urbanairship-cordova"
        version="14.11.0"
        xmlns="http://apache.org/cordova/ns/plugins/1.0"
        xmlns:android="http://schemas.android.com/apk/res/android">

    <name>Urban Airship</name>
    <description>Urban Airship Cordova plugin</description>
    <license>Apache 2.0</license>
    <keywords>cordova,urbanairship</keywords>
    <repo>https://github.com/urbanairship/urbanairship-cordova.git</repo>

    <engines>
        <engine name="cordova-android" version=">=10.0.0"/>
        <engine name="cordova-ios" version=">=6.2.0"/>
        <engine name="cordova" version=">=9.0.1"/>
    </engines>

    <js-module name="UrbanAirship" src="www/UrbanAirship.js">
        <clobbers target="UAirship"/>
    </js-module>

    <!-- android -->
    <platform name="android">
        <config-file target="config.xml" parent="/*">
            <preference name="GradlePluginGoogleServicesEnabled" value="true" />
            <preference name="GradlePluginGoogleServicesVersion" value="4.3.10" />
        </config-file>
        <config-file parent="/widget" target="res/xml/config.xml">
            <feature name="UAirship">
                <param
                    name="android-package"
                    value="com.urbanairship.cordova.UAirshipPlugin"/>
                <param
                    name="onload"
                    value="true"/>
            </feature>
        </config-file>

        <config-file parent="/manifest/application" target="AndroidManifest.xml">
            <meta-data
                android:name="com.urbanairship.cordova.version"
                android:value="14.11.0"/>

            <meta-data
                android:name="com.urbanairship.autopilot"
                android:value="com.urbanairship.cordova.CordovaAutopilot"/>

            <meta-data
                android:name="com.urbanairship.webview.ENABLE_LOCAL_STORAGE"
                android:value="true" />

            <activity
                android:name="com.urbanairship.cordova.CustomMessageActivity"
                android:exported="false">
                <intent-filter>
                    <action android:name="com.urbanairship.VIEW_RICH_PUSH_MESSAGE"/>
                    <data android:scheme="message"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                </intent-filter>
            </activity>

            <activity
                android:exported="false"
                android:name="com.urbanairship.cordova.CustomMessageCenterActivity"
                android:launchMode="singleTask">
                <intent-filter>
                    <action android:name="com.urbanairship.VIEW_RICH_PUSH_INBOX"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                </intent-filter>
            </activity>

        </config-file>

        <source-file
            src="src/android/UAirshipPlugin.java"
            target-dir="src/com/urbanairship/cordova"/>
        <source-file
            src="src/android/CordovaAutopilot.java"
            target-dir="src/com/urbanairship/cordova"/>
        <source-file
            src="src/android/CustomMessageActivity.java"
            target-dir="src/com/urbanairship/cordova"/>
        <source-file
            src="src/android/CustomMessageCenterActivity.java"
            target-dir="src/com/urbanairship/cordova"/>
        <source-file
            src="src/android/PluginManager.java"
            target-dir="src/com/urbanairship/cordova"/>
        <source-file
            src="src/android/ConfigUtils.java"
            target-dir="src/com/urbanairship/cordova"/>
        <source-file
            src="src/android/CordovaNotificationProvider.java"
            target-dir="src/com/urbanairship/cordova"/>
        <source-file
            src="src/android/Utils.java"
            target-dir="src/com/urbanairship/cordova"/>
        <source-file
            src="src/android/PluginLogger.java"
            target-dir="src/com/urbanairship/cordova"/>
        <source-file
            src="src/android/events/RegistrationEvent.java"
            target-dir="src/com/urbanairship/cordova/events"/>
        <source-file
            src="src/android/events/DeepLinkEvent.java"
            target-dir="src/com/urbanairship/cordova/events"/>
        <source-file
            src="src/android/events/InboxEvent.java"
            target-dir="src/com/urbanairship/cordova/events"/>
        <source-file
            src="src/android/events/ShowInboxEvent.java"
            target-dir="src/com/urbanairship/cordova/events"/>
        <source-file
            src="src/android/events/PushEvent.java"
            target-dir="src/com/urbanairship/cordova/events"/>
        <source-file
            src="src/android/events/PreferenceCenterEvent.java"
            target-dir="src/com/urbanairship/cordova/events"/>
        <source-file
            src="src/android/events/NotificationOpenedEvent.java"
            target-dir="src/com/urbanairship/cordova/events"/>
        <source-file
            src="src/android/events/NotificationOptInEvent.java"
            target-dir="src/com/urbanairship/cordova/events"/>
        <source-file
            src="src/android/events/Event.java"
            target-dir="src/com/urbanairship/cordova/events"/>

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

    </platform>

    <!-- ios -->
    <platform name="ios">

        <!-- Background push -->
        <config-file parent="UIBackgroundModes" target="*-Info.plist">
            <array>
                <string>remote-notification</string>
            </array>
        </config-file>

        <config-file target="*-Info.plist" parent="UACordovaPluginVersion">
            <string>14.11.0</string>
        </config-file>

        <config-file parent="/widget" target="config.xml">
            <feature name="UAirship">
                <param
                    name="ios-package"
                    value="UAirshipPlugin"/>
                <param
                    name="onload"
                    value="true"/>
            </feature>
        </config-file>

        <config-file parent="aps-environment" target="*/Entitlements-Debug.plist">
            <string>development</string>
        </config-file>

        <config-file parent="aps-environment" target="*/Entitlements-Release.plist">
            <string>production</string>
        </config-file>

        <!-- Plugin -->
        <header-file src="src/ios/UAirshipPlugin.h"/>
        <source-file src="src/ios/UAirshipPlugin.m"/>
        <header-file src="src/ios/UAMessageViewController.h"/>
        <source-file src="src/ios/UAMessageViewController.m"/>
        <header-file src="src/ios/UACordovaPluginManager.h"/>
        <source-file src="src/ios/UACordovaPluginManager.m"/>
        <header-file src="src/ios/events/UACordovaEvent.h"/>
        <header-file src="src/ios/events/UACordovaDeepLinkEvent.h"/>
        <source-file src="src/ios/events/UACordovaDeepLinkEvent.m"/>
        <header-file src="src/ios/events/UACordovaInboxUpdatedEvent.h"/>
        <source-file src="src/ios/events/UACordovaInboxUpdatedEvent.m"/>
        <header-file src="src/ios/events/UACordovaNotificationOpenedEvent.h"/>
        <source-file src="src/ios/events/UACordovaNotificationOpenedEvent.m"/>
        <header-file src="src/ios/events/UACordovaNotificationOptInEvent.h"/>
        <source-file src="src/ios/events/UACordovaNotificationOptInEvent.m"/>
        <header-file src="src/ios/events/UACordovaPushEvent.h"/>
        <source-file src="src/ios/events/UACordovaPushEvent.m"/>
        <header-file src="src/ios/events/UACordovaRegistrationEvent.h"/>
        <source-file src="src/ios/events/UACordovaRegistrationEvent.m"/>
        <header-file src="src/ios/events/UACordovaShowInboxEvent.h"/>
        <source-file src="src/ios/events/UACordovaShowInboxEvent.m"/>
        <header-file src="src/ios/events/UACordovaPreferenceCenterEvent.h"/>
        <source-file src="src/ios/events/UACordovaPreferenceCenterEvent.m"/>

        <!-- Airship library -->
        <podspec>
            <config>
                <source url="https://cdn.cocoapods.org/"/>
            </config>
            <pods use-frameworks="true">
                <pod name="Airship/Core" spec="16.12.5" />
                <pod name="Airship/MessageCenter" spec="16.12.5" />
                <pod name="Airship/Automation" spec="16.12.5" />
                <pod name="Airship/ExtendedActions" spec="16.12.5" />
                <pod name="Airship/PreferenceCenter" spec="16.12.5" />
            </pods>
        </podspec>

    </platform>
</plugin>
