<?xml version="1.0" encoding="utf-8"?>
<plugin
    xmlns="http://www.phonegap.com/ns/plugins/1.0"
    xmlns:android="http://schemas.android.com/apk/res/android"
    id="kiot-phonegap-nfc"
    version="2.0.9">

    <name>NFC</name>

    <description>Near Field Communication (NFC) Plugin. Read and write NDEF messages to NFC tags and share NDEF messages with peers.</description>

    <license>MIT</license>
    <keywords>nfc, NFC, NDEF</keywords>
    <repo>https://github.com/chariotsolutions/phonegap-nfc.git</repo>
    <issue>https://github.com/chariotsolutions/phonegap-nfc/issues</issue>

    <platform name="android">
        <js-module src="www/phonegap-nfc.js" name="NFC">
            <runs />
        </js-module>

        <config-file target="res/xml/config.xml" parent="/*">
            <feature name="NfcPlugin">
                <param name="android-package" value="com.chariotsolutions.nfc.plugin.NfcPlugin"/>
                <param name="onload" value="true" />
            </feature>
        </config-file>

        <source-file src="src/android/src/com/chariotsolutions/nfc/plugin/NfcPlugin.java"
            target-dir="src/com/chariotsolutions/nfc/plugin"/>
        <source-file src="src/android/src/com/chariotsolutions/nfc/plugin/Util.java"
            target-dir="src/com/chariotsolutions/nfc/plugin"/>
        <source-file src="src/android/src/com/chariotsolutions/nfc/plugin/NfcActivity.java"
            target-dir="src/com/chariotsolutions/nfc/plugin"/>
        <source-file src="src/android/src/com/chariotsolutions/nfc/plugin/IncomingCallActivity.java"
            target-dir="src/com/chariotsolutions/nfc/plugin"/>
        <source-file src="src/android/src/com/chariotsolutions/nfc/plugin/QRNotificationHandler.java"
            target-dir="src/com/chariotsolutions/nfc/plugin"/>
        
         <config-file target="AndroidManifest.xml" parent="/manifest">
            <uses-permission android:name="android.permission.NFC"/>
            <uses-feature android:name="android.hardware.nfc" android:required="false"/>
            <!-- Required so the incoming-call (doorbell) CallStyle notification can post
                 on Android 14+ (targetSdk 34+). Without this, notify() throws
                 "CallStyle notifications must be for a foreground service ... or use a
                 fullScreenIntent" and the ring notification silently fails. -->
            <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT"/>
        </config-file>

        <config-file target="AndroidManifest.xml" parent="/manifest/application">
            <activity android:configChanges="orientation|keyboardHidden|screenSize" android:exported="false" android:launchMode="singleTop" android:name="com.chariotsolutions.nfc.plugin.IncomingCallActivity" android:screenOrientation="portrait" android:showOnLockScreen="true" android:theme="@style/Theme.Design.NoActionBar"/>
            <meta-data android:name="com.onesignal.NotificationServiceExtension" android:value="com.chariotsolutions.nfc.plugin.QRNotificationHandler"/>
            <receiver android:exported="true" android:name="com.chariotsolutions.nfc.plugin.QRNotificationHandler">
                <intent-filter>
                    <action android:name="com.yourpackage.QR_NOTIFICATION_ACTION"/>
                </intent-filter>
            </receiver>
        </config-file>

        <framework src="com.google.android.material:material:1.5.0" />

        <resource-file src="src/android/res/layout/activity_incomingcall.xml" target="res/layout/activity_incomingcall.xml" />


    </platform>

    <platform name="wp8">
        <js-module src="www/phonegap-nfc.js" name="NFC">
            <runs />
        </js-module>

        <config-file target="config.xml" parent="/*">
            <feature name="NfcPlugin">
                <param name="wp-package" value="NfcPlugin"/>
            </feature>
        </config-file>

        <config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
            <Capability Name="ID_CAP_PROXIMITY" />
        </config-file>

        <source-file src="src/windows-phone-8/Ndef.cs" />
        <source-file src="src/windows-phone-8/NfcPlugin.cs" />

    </platform>

    <!-- windows -->
    <platform name="windows">
        <js-module src="www/phonegap-nfc.js" name="NFC">
            <runs />
        </js-module>

        <config-file target="config.xml" parent="/*">
            <feature name="NfcPlugin">
                <param name="wp-package" value="NfcPlugin"/>
            </feature>
        </config-file>

        <config-file target="package.phone.appxmanifest" parent="/Package/Capabilities">
            <DeviceCapability Name="proximity" />
        </config-file>
        <config-file target="package.windows.appxmanifest" parent="/Package/Capabilities">
            <DeviceCapability Name="proximity" />
        </config-file>
        <config-file target="package.windows10.appxmanifest" parent="/Package/Capabilities">
            <DeviceCapability Name="proximity" />
        </config-file>
        <config-file target="package.windows80.appxmanifest" parent="/Package/Capabilities">
            <DeviceCapability Name="proximity" />
        </config-file>

        <js-module src="src/windows/nfc-plugin.js" name="NfcPlugin">
            <merges target="" />
        </js-module>
    </platform>

    <platform name="blackberry10">
        <js-module src="www/phonegap-nfc.js" name="NFC">
            <runs />
        </js-module>
        <!-- override defaults for BB10 -->
        <js-module src="www/phonegap-nfc-blackberry.js" name="NFCBB10">
            <runs />
        </js-module>

        <!-- "native" implementation -->
        <source-file src="src/blackberry10/index.js" />

        <config-file target="www/config.xml" parent="/widget">
            <!-- Note: mapping is broken in Cordova 3.1.0-0.2.0 -->
            <feature name="NfcPlugin" value="com.chariotsolutions.nfc.plugin" />
        </config-file>
    </platform>

    <platform name="ios">
        <js-module src="www/phonegap-nfc.js" name="NFC">
            <runs />
        </js-module>

        <config-file parent="/*" target="config.xml">
            <feature name="NfcPlugin">
                <param name="ios-package" value="NfcPlugin" />
            </feature>
        </config-file>
        
        <header-file src="src/ios/NfcPlugin.h" />
        <source-file src="src/ios/NfcPlugin.m" />
        
        <framework src="CoreNFC.framework" weak="true" />
    </platform>


</plugin>
