<?xml version="1.0" encoding="utf-8"?>
<plugin 
    id="vritra-plugin-fileexplorer" version="1.1.0" 
    xmlns="http://apache.org/cordova/ns/plugins/1.0" 
    xmlns:android="http://schemas.android.com/apk/res/android"
>
    <name>FileExplorer</name>
    <js-module name="fileexplorer" src="www/index.js">
        <clobbers target="FileExplorer"/>
    </js-module>
    
    <platform name="android">
        <config-file target="res/xml/config.xml" parent="/*">
            <feature name="FileExplorer">
                <param name="android-package" value="com.vritra.fileexplorer.FileExplorer"/>
            </feature>
        </config-file>
        <config-file target="AndroidManifest.xml" parent="application">
            <provider
                android:name="androidx.core.content.FileProvider"
                android:authorities="${applicationId}.provider"
                android:exported="false"
                android:grantUriPermissions="true"
            >
                <meta-data
                    android:name="android.support.FILE_PROVIDER_PATHS"
                    android:resource="@xml/fileexplorer_provider_paths"
                />
            </provider>
        </config-file>
        <source-file src="src/android/FileExplorer.java" target-dir="src/com/vritra/FileExplorer"/>
        <source-file src="src/android/fileexplorer_provider_paths.xml" target-dir="res/xml"/>
        <config-file target="AndroidManifest.xml" parent=".">
            <uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>
            <uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
            <uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
            <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
            <queries>
                <intent>
                    <action android:name="android.intent.action.VIEW"/>
                    <category android:name="android.intent.category.BROWSABLE"/>
                    <data android:scheme="https"/>
                </intent>
            </queries>
        </config-file>
    </platform>
    
    <platform name="ios">
        <config-file parent="/*" target="config.xml">
            <feature name="FileExplorer">
                <param name="ios-package" value="FileExplorer" onload="false"/>
            </feature>
        </config-file>
        <source-file src="src/ios/MimeTyper.swift"/>
        <source-file src="src/ios/FileExplorer.swift"/>
    </platform>

    <platform name="browser">
        <js-module src="src/browser/FileExplorer.js" name="browserFileExplorer">
            <clobbers target="FileExplorer"/>
        </js-module>
    </platform>

    <dependency 
        id="vritra-plugin-common"
        url="https://github.com/AhmedAyachi/vritra-plugin-common"
    />
</plugin>
