<?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" /> <!-- Mandatory permission -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- [Optional]  Used for database backups and to download videos/thumbnails -->
    <!-- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> -->
    <!-- [Optional]  If enabled via the preferences, the app will periodically check for new videos published by the subscribed channels -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application
        android:name=".app.SkyTubeApp"
        android:allowBackup="true"
        android:hardwareAccelerated="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:resizeableActivity="true"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <!-- This will allow the app to use update its self (due to security changes in Android 7.0+) -->
        <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/provider_paths" />
        </provider>

        <activity
            android:name=".gui.activities.MainActivity"
            android:theme="@style/NoActionBarActivityTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".gui.activities.YouTubePlayerActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:theme="@style/VideoPlayerActivityTheme" />
        <activity
            android:name=".gui.activities.PreferencesActivity"
            android:theme="@style/AppTheme.Preferences"
            android:label="@string/preferences"
            android:exported="true"
            android:parentActivityName=".gui.activities.MainActivity"
            tools:targetApi="jelly_bean">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".gui.activities.MainActivity" />
        </activity>
        <activity
            android:name=".gui.activities.ThumbnailViewerActivity"
            android:theme="@style/NoActionBarActivityTheme" /> <!-- <service android:name=".businessobjects.FeedUpdaterService"/> -->
        <!-- <receiver -->
        <!-- android:name=".businessobjects.FeedUpdaterSetupReceiver" -->
        <!-- android:enabled="true"> -->
        <!-- <intent-filter> -->
        <!-- <action android:name="android.intent.action.BOOT_COMPLETED"/> -->
        <!-- </intent-filter> -->
        <!-- </receiver> -->
        <!-- <receiver -->
        <!-- android:name=".businessobjects.FeedUpdaterReceiver" -->
        <!-- android:enabled="true"> -->
        <!-- </receiver> -->
        <activity
            android:name=".gui.activities.PermissionsActivity"
            android:theme="@style/TransparentActivity" />
        <activity
            android:name=".gui.activities.ShareBookmarkActivity"
            android:theme="@style/TransparentActivity">
            <intent-filter android:label="@string/bookmark_share_label">
                <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=".gui.activities.RouterActivity"
            android:theme="@style/TransparentActivity">

            <!-- Youtube filter -->
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
                <action android:name="android.nfc.action.NDEF_DISCOVERED" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="http" />
                <data android:scheme="https" />
                <data android:host="youtube.com" />
                <data android:host="m.youtube.com" />
                <data android:host="www.youtube.com" />
                <data android:host="music.youtube.com" />
                <!-- video prefix -->
                <data android:pathPrefix="/v/" />
                <data android:pathPrefix="/embed/" />
                <data android:pathPrefix="/watch" />
                <data android:pathPrefix="/shorts/" />
                <data android:pathPrefix="/live/" />
                <data android:pathPrefix="/podcasts/" />
                <data android:pathPrefix="/attribution_link" />
                <!-- channel prefix -->
                <data android:pathPrefix="/channel/" />
                <data android:pathPrefix="/user/" />
                <data android:pathPrefix="/c/" />
                <data android:pathPrefix="/@"/>
                <!-- playlist prefix -->
                <data android:pathPrefix="/playlist" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
                <action android:name="android.nfc.action.NDEF_DISCOVERED" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="http" />
                <data android:scheme="https" />
                <data android:host="youtu.be" />
                <data android:pathPrefix="/" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
                <action android:name="android.nfc.action.NDEF_DISCOVERED" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="http" />
                <data android:scheme="https" />
                <data android:host="www.youtube-nocookie.com" />
                <data android:pathPrefix="/embed/" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
                <action android:name="android.nfc.action.NDEF_DISCOVERED" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="vnd.youtube" />
                <data android:scheme="vnd.youtube.launch" />
            </intent-filter>

            <!-- Invidious filter -->
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
                <action android:name="android.nfc.action.NDEF_DISCOVERED" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="http" />
                <data android:scheme="https" />
                <data android:host="invidio.us" />
                <data android:host="invidious.site" />
                <data android:host="redirect.invidious.io" />
                <data android:host="yewtu.be" />
                <data android:host="invidious.zapashcanon.fr" />
                <data android:host="invidious.fdn.fr" />
                <data android:host="vid.puffyan.us" />
                <data android:pathPrefix="/" />
            </intent-filter>
        </activity> <!-- Version < 3.0. DeX Mode and Screen Mirroring support -->
        <meta-data
            android:name="com.samsung.android.keepalive.density"
            android:value="true" /> <!-- Version >= 3.0. DeX Dual Mode support -->
        <meta-data
            android:name="com.samsung.android.multidisplay.keep_process_alive"
            android:value="true" />
        <service
            android:name="androidx.appcompat.app.AppLocalesMetadataHolderService"
            android:enabled="false"
            android:exported="false">
            <meta-data
                android:name="autoStoreLocales"
                android:value="true" />
        </service>
    </application>

</manifest>
