<?xml version='1.0' encoding='utf-8'?>
<plugin id="cordova-plugin-square-reader-ios" version="0.0.1" 
    xmlns="http://apache.org/cordova/ns/plugins/1.0" 
    xmlns:android="http://schemas.android.com/apk/res/android">

    <name>CordovaSquareReaderIOS</name>

    <dependency id="cordova-plugin-add-swift-support" version="2.0.2"/>

    <js-module name="CordovaSquareReader" src="www/CordovaSquareReader.js">
        <clobbers target="cordova.plugins.squareReaderIOS" />
    </js-module>

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

        <header-file src="resources/ios/SquareReaderSDK.framework/Headers/SquareReaderSDK.h" />
        <source-file src="src/ios/CordovaSquareReader.swift" />

        <config-file target="*-Info.plist" parent="NSLocationWhenInUseUsageDescription">
            <string>This app integrates with Square for card processing. To protect buyers and sellers, Square requires your location to process payments.</string>
        </config-file>
        <config-file target="*-Info.plist" parent="NSMicrophoneUsageDescription">
            <string>This app integrates with Square for card processing. To swipe magnetic cards via the headphone jack, Square requires access to the microphone.</string>
        </config-file>
        <config-file target="*-Info.plist" parent="NSBluetoothPeripheralUsageDescription">
            <string>This app integrates with Square for card processing. Square uses Bluetooth to connect your device to compatible hardware.</string>
        </config-file>
        <config-file target="*-Info.plist" parent="NSCameraUsageDescription">
            <string>This app integrates with Square for card processing. Upload your account logo, feature photo and product images with the photos stored on your mobile device.</string>
        </config-file>
        <config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
            <string>This app integrates with Square for card processing. Upload your account logo, feature photo and product images with the photos stored on your mobile device.</string>
        </config-file>

        <framework custom="true" embed="true" src="./resources/ios/SquareReaderSDK.framework" />

        <hook src="scripts/ios/add_SquareReaderSDK_build_phase_and_settings.js" type="after_platform_add" />
    </platform>
</plugin>