<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
    <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
    <uses-permission android:name="android.permission.ACTION_OPEN_DOCUMENT" />

    <application
        android:name=".App"
        android:allowBackup="false"
        android:localeConfig="@xml/locales_config"
        android:extractNativeLibs="true"
        android:icon="@mipmap/ic_launcher"
        android:configChanges="layoutDirection|locale"
        android:label="@string/app_name"
        android:requestLegacyExternalStorage="true"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:enableOnBackInvokedCallback="true"
        android:theme="@style/AppTheme"
        tools:targetApi="tiramisu"
        android:dataExtractionRules="@xml/data_extraction_rules"
        tools:ignore="DataExtractionRules">
        <activity android:name=".MainActivity"
            android:windowSoftInputMode="adjustResize"
            android:configChanges="layoutDirection|locale"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT"/>
                <data android:mimeType="application/txt" />
            </intent-filter>

        </activity>
        <activity android:name=".receiver.ShareActivity"
            android:theme="@style/Theme.BottomSheet"
            android:configChanges="layoutDirection|locale"
            android:launchMode="singleInstance"
            android:excludeFromRecents="true"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="text/plain" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ui.more.downloadLogs.DownloadLogListActivity"
            android:configChanges="layoutDirection|locale"
            android:parentActivityName=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="ytdlnis.downloadLogs.DownloadLogListActivity" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ui.downloads.DownloadQueueActivity"
            android:configChanges="layoutDirection|locale"
            android:parentActivityName=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="ytdlnis.DownloadQueueActivity" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ui.more.downloadLogs.DownloadLogActivity"
            android:configChanges="layoutDirection|locale"
            android:parentActivityName=".ui.more.downloadLogs.DownloadLogListActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="ytdlnis.downloadLogs.DownloadLogActivity" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ui.more.settings.SettingsActivity"
            android:configChanges="layoutDirection|locale"
            android:parentActivityName=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="ytdlnis.settings.SettingsActivity" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ui.more.TerminalActivity"
            android:configChanges="layoutDirection|locale"
            android:theme="@style/AppDefaultTheme"
            android:parentActivityName=".MainActivity"
            android:label="@string/run_command"
            android:exported="true">
            <intent-filter>
                <action android:name="ytdlnis.CustomCommandActivity" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="text/plain" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ui.more.CommandTemplatesActivity"
            android:windowSoftInputMode="adjustResize"
            android:configChanges="layoutDirection|locale"
            android:parentActivityName=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="ytdlnis.CommandTemplatesActivity" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>


        <receiver android:name=".receiver.CancelDownloadNotificationReceiver" />
        <service
            android:name="androidx.appcompat.app.AppLocalesMetadataHolderService"
            android:enabled="false"
            android:exported="false">
            <meta-data
                android:name="autoStoreLocales"
                android:value="true" />
        </service>
        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="com.deniscerri.ytdl.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
        </provider>
        <provider
            android:name="androidx.startup.InitializationProvider"
            android:authorities="${applicationId}.androidx-startup"
            android:exported="false"
            tools:node="merge">
            <!-- If you are using androidx.startup to initialize other components -->
            <meta-data
                android:name="androidx.work.WorkManagerInitializer"
                android:value="androidx.startup"
                tools:node="remove" />
        </provider>
    </application>

</manifest>