<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-moodleapp" version="0.0.0">
    <name>MoodleApp</name>
    <description>Plugin with custom functionality for the Moodle App</description>
    <js-module src="www/index.js" name="moodleapp">
        <clobbers target="cordova.MoodleApp" />
    </js-module>
    <platform name="android">
        <framework src="com.android.installreferrer:installreferrer:2.2" />
        <config-file target="res/xml/config.xml" parent="/*">
            <feature name="SecureStorage">
                <param name="android-package" value="com.moodle.moodlemobile.SecureStorage"/>
            </feature>
            <feature name="InstallReferrer">
                <param name="android-package" value="com.moodle.moodlemobile.InstallReferrer"/>
            </feature>
        </config-file>

        <config-file target="res/xml/config.xml" parent="/*">
            <feature name="Diagnostic">
                <param name="android-package" value="com.moodle.moodlemobile.Diagnostic"/>
                <param name="onload" value="true" />
            </feature>
            <feature name="Diagnostic_Location">
                <param name="android-package" value="com.moodle.moodlemobile.Diagnostic_Location"/>
                <param name="onload" value="true" />
            </feature>
        </config-file>

        <source-file src="src/android/Diagnostic.java" target-dir="src/cordova/plugins" />
        <source-file src="src/android/Diagnostic_Location.java" target-dir="src/cordova/plugins" />

        <preference name="ANDROIDX_VERSION" default="1.0.0" />
        <preference name="ANDROIDX_APPCOMPAT_VERSION" default="1.3.1" />
        <framework src="androidx.legacy:legacy-support-v4:$ANDROIDX_VERSION" />
        <framework src="androidx.appcompat:appcompat:$ANDROIDX_APPCOMPAT_VERSION" />

        <source-file src="src/android/SecureStorage.java" target-dir="src/com/moodle/moodlemobile" />
        <source-file src="src/android/InstallReferrer.java" target-dir="src/com/moodle/moodlemobile" />
    </platform>

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

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

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

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

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

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

        <framework src="CoreLocation.framework" />

        <config-file target="*-Info.plist" parent="NSLocationAlwaysAndWhenInUseUsageDescription" comment="Default usage descriptions: override as necessary in .plist">
            <string>We need your location so you can attach it as part of your submissions.</string>
        </config-file>

        <config-file target="*-Info.plist" parent="NSLocationWhenInUseUsageDescription" comment="Default usage descriptions: override as necessary in .plist">
            <string>We need your location so you can attach it as part of your submissions.</string>
        </config-file>

        <config-file target="*-Info.plist" parent="NSLocationAlwaysUsageDescription" comment="iOS 10">
           <string>We need your location so you can attach it as part of your submissions.</string>
        </config-file>
        <!--END_MODULE LOCATION-->

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

        <framework src="AVFoundation.framework" />

        <config-file target="*-Info.plist" parent="NSMicrophoneUsageDescription">
            <string>We need microphone access to record sounds so you can attach them as part of your submissions.</string>
        </config-file>

        <header-file src="src/ios/Diagnostic_Microphone.h" />
        <source-file src="src/ios/Diagnostic_Microphone.m" />
        <!--END_MODULE MICROPHONE-->

    </platform>
</plugin>
