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

    <name>Neosurance</name>

    <license>Apache 2.0</license>
    
    <description>Use Neosurance SDK</description>

    <author>Alessandro Infurna</author>

    <license>Apache 2.0</license>

    <keywords>Neosurance, Android, Insurance, Digital, NSR</keywords>

    <repo>https://github.com/neosurance/cordova-nsr-plugin-v2.git</repo>
	
    <engines>
        <engine name="cordova" version=">=3.0.0" />
    </engines>

	<dependency id="cordova-plugin-cocoapod-support" />


	<js-module src="www/script.js" name="scriptJS">
		<clobbers target="scriptJS" />
	</js-module>

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

	<js-module src="www/nsr.js" name="Neosurance">
		<clobbers target="Neosurance" />
	</js-module>


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

		<edit-config file="AndroidManifest.xml" target="/manifest/uses-sdk" mode="merge">
			<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="29" />
		</edit-config>

		<config-file target="res/xml/config.xml" parent="/*">
			<feature name="Neosurance">
				<param name="android-package" value="eu.neosurance.cordova.NSRCordovaInterface" />
				<param name="onload" value="true"/>
			</feature>
		</config-file>

        <config-file target="AndroidManifest.xml" parent="/manifest">

			<uses-permission android:name="android.permission.INTERNET" />
			<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
			<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
			<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
			<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
			<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
			<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
			<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
			<uses-permission android:name="android.permission.CAMERA" />
			<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
			<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION" />
			<uses-permission android:name="android.permission.BLUETOOTH" />
			<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

		</config-file>

		<config-file target="AndroidManifest.xml" parent="/manifest/application">
			<receiver android:name="eu.neosurance.sdk.NSRBootReceiver">
				<intent-filter>
					<action android:name="android.intent.action.BOOT_COMPLETED" />
				</intent-filter>
			</receiver>
			<receiver android:name="eu.neosurance.sdk.NSRFenceCallback" />
			<receiver android:name="eu.neosurance.sdk.NSRActivityCallback" />
			<receiver android:name="eu.neosurance.sdk.NSRDelayedPush" />
			<receiver android:name="eu.neosurance.sdk.NSRBackground" />

			<service android:name="eu.neosurance.sdk.NSRForeground" android:exported="false" />

			<provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true">
				<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
			</provider>

			<activity
					android:name="eu.neosurance.sdk_ext.NSRActivity"
					android:configChanges="orientation|screenSize|keyboardHidden"
					android:screenOrientation="portrait"
					android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
			<activity
					android:name="eu.neosurance.sdk.NSRActivityWebView"
					android:configChanges="orientation|screenSize|keyboardHidden"
					android:screenOrientation="portrait"
					android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
			
        </config-file>

		<source-file src="src/android/cordova/NSRCordovaInterface.java" target-dir="src/eu/neosurance/cordova" />

		<source-file src="src/android/sdk_ext/NSRActivity.java" target-dir="src/eu/neosurance/sdk_ext" />
		<source-file src="src/android/sdk_ext/WFDelegate.java" target-dir="src/eu/neosurance/sdk_ext" />
		<source-file src="src/android/sdk_ext/WFReceiver.java" target-dir="src/eu/neosurance/sdk_ext" />

		<source-file src="src/android/sdk/NSR.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRAction.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRActivityCallback.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRActivityWebView.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRAuth.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRBackground.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRBootReceiver.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRConnection.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRDefaultSecurity.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRDelayedPush.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSREvent.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSREventWebView.java" target-dir="src/eu/neosurance/sdk" />

		<source-file src="src/android/sdk/NSRFenceCallback.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRFences.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRForeground.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRHttpRunner.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRLocationCallback.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRLog.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRPower.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRPush.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRPushDelegate.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRSecurityDelegate.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRSecurityResponse.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRSettings.java" target-dir="src/eu/neosurance/sdk" />

		<source-file src="src/android/sdk/NSRTrace.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRUser.java" target-dir="src/eu/neosurance/sdk" />
		<source-file src="src/android/sdk/NSRWorkflowDelegate.java" target-dir="src/eu/neosurance/sdk" />

		<source-file src="src/android/utils/NSRJsonAdapter.java" target-dir="src/eu/neosurance/utils" />
		<source-file src="src/android/utils/NSRShake.java" target-dir="src/eu/neosurance/utils" />
		<source-file src="src/android/utils/NSRUtils.java" target-dir="src/eu/neosurance/utils" />
		<source-file src="src/android/utils/PackageChangeReceiver.java" target-dir="src/eu/neosurance/utils" />

		<source-file src="assets/config.properties" target-dir="app/src/main/assets" />
		<source-file src="assets/nsr.html" target-dir="app/src/main/assets" />

		<source-file src="drawable/nsr_logo.png" target-dir="app/src/main/res/drawable" />
		<source-file src="raw/push.wav" target-dir="app/src/main/res/raw" />
		<source-file src="xml/file_paths.xml" target-dir="app/src/main/res/xml" />

    </platform>


	<platform name="ios">

		<!-- <framework src="NSR" type="podspec" spec="2.2.3"/> -->
		<pods-config ios-min-version="9.0" use-frameworks="true">
		</pods-config>
		<!--pod name="NSR" /-->

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

		<header-file src="src/ios/Neosurance.h" />
		<source-file src="src/ios/Neosurance.m" />
		<header-file src="src/ios/NSRSampleWFDelegate.h" />
		<source-file src="src/ios/NSRSampleWFDelegate.m" />

		<header-file src="src/ios/NSR.h" />
		<source-file src="src/ios/NSR.m" />
		<header-file src="src/ios/NSRControllerWebView.h" />
		<source-file src="src/ios/NSRControllerWebView.m" />
		<header-file src="src/ios/NSRDefaultSecurityDelegate.h" />
		<source-file src="src/ios/NSRDefaultSecurityDelegate.m" />
		<header-file src="src/ios/NSREventWebView.h" />
		<source-file src="src/ios/NSREventWebView.m" />
		<header-file src="src/ios/NSRUser.h" />
		<source-file src="src/ios/NSRUser.m" />
		<header-file src="src/ios/NSRWebView.h" />
		<source-file src="src/ios/NSRWebView.m" />
		<source-file src="src/ios/Reachability.h" />
		<source-file src="src/ios/Reachability.m" />
		
		<source-file src="assets/eventCruncher.html"/>
		<source-file src="assets/config.properties" target-dir="assets" />
		<source-file src="drawable/nsr_logo.png" target-dir="assets" />
		<source-file src="raw/push.wav" target-dir="assets" />

	</platform>

</plugin>
