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


    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        tools:ignore="ScopedStorage" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

    <uses-feature
        android:name="android.hardware.camera"
        android:required="false" />
    <queries>
        <intent>
            <action android:name="android.media.action.IMAGE_CAPTURE" />
        </intent>
    </queries>
    <application
        android:name="app.fedilab.android.MainApplication"
        android:allowBackup="true"
        android:dataExtractionRules="@xml/extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:configChanges="orientation|screenSize"
        android:icon="@mipmap/ic_launcher_bubbles"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:requestLegacyExternalStorage="true"
        android:roundIcon="@mipmap/ic_launcher_bubbles_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true"
        tools:replace="android:allowBackup">

        <activity
            android:name=".activities.MainActivity"
            android:configChanges="orientation|screenSize|keyboardHidden|screenLayout|smallestScreenSize"
            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>
            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="image/*" />
                <data android:mimeType="video/*" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEND_MULTIPLE" />
                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="image/*" />
                <data android:mimeType="video/*" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <!-- The app is a good candidate for URL in https://domain.name/@xxxxxx-->
                <!-- It should cover every URLs for statuses but some others not related to mastodon matching this scheme -->
                <data
                    android:host="*"
                    android:pathPrefix="/@"
                    android:scheme="https" />
            </intent-filter>
        </activity>

        <activity-alias
            android:name=".activities.MainActivity.Bubbles"
            android:enabled="true"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_bubbles"
            android:roundIcon="@mipmap/ic_launcher_bubbles_round"
            android:targetActivity=".activities.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data
                android:name="android.app.shortcuts"
                android:resource="@xml/compose_shortcuts" />
        </activity-alias>

        <activity-alias
            android:name=".activities.MainActivity.Fediverse"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_fediverse"
            android:roundIcon="@mipmap/ic_launcher_fediverse_round"
            android:targetActivity=".activities.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data
                android:name="android.app.shortcuts"
                android:resource="@xml/compose_shortcuts" />
        </activity-alias>

        <activity-alias
            android:name=".activities.MainActivity.Hero"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_hero"
            android:roundIcon="@mipmap/ic_launcher_hero_round"
            android:targetActivity=".activities.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data
                android:name="android.app.shortcuts"
                android:resource="@xml/compose_shortcuts" />
        </activity-alias>

        <activity-alias
            android:name=".activities.MainActivity.Atom"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_atom"
            android:roundIcon="@mipmap/ic_launcher_atom_round"
            android:targetActivity=".activities.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data
                android:name="android.app.shortcuts"
                android:resource="@xml/compose_shortcuts" />
        </activity-alias>

        <activity-alias
            android:name=".activities.MainActivity.BrainCrash"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_crash"
            android:roundIcon="@mipmap/ic_launcher_crash_round"
            android:targetActivity=".activities.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data
                android:name="android.app.shortcuts"
                android:resource="@xml/compose_shortcuts" />
        </activity-alias>

        <activity-alias
            android:name=".activities.MainActivity.Mastalab"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/ic_launcher_mastalab"
            android:roundIcon="@mipmap/ic_launcher_mastalab_round"
            android:targetActivity=".activities.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data
                android:name="android.app.shortcuts"
                android:resource="@xml/compose_shortcuts" />
        </activity-alias>


        <activity
            android:name=".activities.LoginActivity"
            android:configChanges="orientation|screenSize"
            android:exported="true"
            android:windowSoftInputMode="stateAlwaysHidden">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

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

                <data
                    android:host="backtofedilab"
                    android:scheme="fedilab" />
            </intent-filter>
        </activity>


        <activity
            android:name=".mastodon.activities.StatusHistoryActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/status_history"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.ContextActivity"
            android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity
            android:name=".mastodon.activities.DirectMessageActivity"
            android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity
            android:name=".mastodon.activities.DraftActivity"
            android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity
            android:name=".mastodon.imageeditor.EditImageActivity"
            android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity
            android:name=".mastodon.activities.ComposeActivity"
            android:configChanges="orientation|screenSize"
            android:label="@string/compose" />
        <activity
            android:name=".mastodon.activities.StatusInfoActivity"
            android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity
            android:name=".mastodon.activities.FollowRequestActivity"
            android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity
            android:name=".mastodon.activities.ProfileActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/account" />
        <activity
            android:name=".mastodon.activities.admin.AdminAccountActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/account" />
        <activity
            android:name=".mastodon.activities.AccountReportActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/account"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.admin.AdminReportActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/report"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.ScheduledActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/scheduled" />
        <activity
            android:name="com.canhub.cropper.CropImageActivity"
            android:theme="@style/Base.Theme.AppCompat" />


        <activity
            android:name=".mastodon.activities.SearchResultTabActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/search"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.TrendsActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/trending"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.ReorderTimelinesActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/reorder_timelines"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".activities.AboutActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/action_about"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.TimelineActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.CheckHomeCacheActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/home_cache"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.admin.AdminDomainBlockActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/blocked_domains"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.SuggestionActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/Suggestions"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.DirectoryActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/Directory"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.PartnerShipActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/action_about"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.ActionActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/interactions"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.admin.AdminActionActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/administration"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.MastodonListActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/action_lists"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.FollowedTagActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/followed_tags"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.SettingsActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/settings"
            android:theme="@style/AppThemeBar" />
        <activity
            android:name=".mastodon.activities.HashTagActivity"
            android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity
            android:name=".mastodon.activities.AnnouncementActivity"
            android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity
            android:name=".mastodon.activities.MediaActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:theme="@style/Transparent" />

        <activity
            android:name=".mastodon.activities.ReportActivity"
            android:theme="@style/AppThemeBar"
            android:windowSoftInputMode="stateVisible" />

        <activity
            android:name=".mastodon.activities.CustomSharingActivity"
            android:label="@string/settings_title_custom_sharing"
            android:theme="@style/AppThemeBar"
            android:windowSoftInputMode="stateVisible" />
        <activity
            android:name=".mastodon.activities.FilterActivity"
            android:label="@string/filters"
            android:theme="@style/AppThemeBar"
            android:windowSoftInputMode="stateVisible" />
        <activity
            android:name=".mastodon.activities.EditProfileActivity"
            android:label="@string/edit_profile"
            android:theme="@style/AppThemeBar"
            android:windowSoftInputMode="stateVisible" />

        <activity
            android:name=".mastodon.activities.CacheActivity"
            android:label="@string/action_cache"
            android:theme="@style/AppThemeBar" />

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

        <receiver
            android:name=".mastodon.broadcastreceiver.ToastMessage"
            android:exported="false">
            <intent-filter>
                <action android:name="RECEIVE_TOAST_MESSAGE" />
            </intent-filter>
        </receiver>

        <receiver
            android:name=".mastodon.services.CustomReceiver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="org.unifiedpush.android.connector.MESSAGE" />
                <action android:name="org.unifiedpush.android.connector.UNREGISTERED" />
                <action android:name="org.unifiedpush.android.connector.NEW_ENDPOINT" />
                <action android:name="org.unifiedpush.android.connector.REGISTRATION_FAILED" />
                <action android:name="org.unifiedpush.android.connector.REGISTRATION_REFUSED" />
            </intent-filter>
        </receiver>


        <activity
            android:name=".peertube.activities.PeertubeMainActivity"
            android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity
            android:name=".peertube.activities.PeertubeActivity"
            android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout"
            android:launchMode="singleTask"
            android:resizeableActivity="true"
            android:supportsPictureInPicture="true"
            tools:targetApi="n" />
        <activity
            android:name=".peertube.activities.PeertubeEditUploadActivity"
            android:configChanges="orientation|screenSize"
            android:exported="false"
            android:windowSoftInputMode="stateAlwaysHidden" />

        <activity
            android:name=".peertube.activities.ShowChannelActivity"
            android:configChanges="orientation|screenSize"
            android:windowSoftInputMode="stateAlwaysHidden" />
        <activity
            android:name=".peertube.activities.ShowAccountActivity"
            android:configChanges="orientation|screenSize"
            android:windowSoftInputMode="stateAlwaysHidden" />
        <activity
            android:name=".peertube.activities.AccountActivity"
            android:configChanges="orientation|screenSize"
            android:windowSoftInputMode="stateAlwaysHidden" />
        <activity
            android:name=".peertube.activities.MyAccountActivity"
            android:configChanges="orientation|screenSize"
            android:windowSoftInputMode="stateAlwaysHidden" />
        <activity
            android:name=".peertube.activities.SearchActivity"
            android:configChanges="orientation|screenSize"
            android:windowSoftInputMode="stateAlwaysHidden" />
        <activity
            android:name=".peertube.activities.AllPlaylistsActivity"
            android:configChanges="orientation|screenSize"
            android:windowSoftInputMode="stateAlwaysHidden" />
        <activity
            android:name=".peertube.activities.AllLocalPlaylistsActivity"
            android:configChanges="orientation|screenSize"
            android:windowSoftInputMode="stateAlwaysHidden" />
        <activity
            android:name=".peertube.activities.PlaylistsActivity"
            android:configChanges="orientation|screenSize"
            android:windowSoftInputMode="stateAlwaysHidden" />
        <activity
            android:name=".peertube.activities.VideosTimelineActivity"
            android:configChanges="orientation|screenSize"
            android:windowSoftInputMode="stateAlwaysHidden" />
        <activity
            android:name=".peertube.activities.SepiaSearchActivity"
            android:configChanges="orientation|screenSize"
            android:label="@string/sepia_search"
            android:windowSoftInputMode="stateAlwaysHidden" />
        <activity
            android:name=".peertube.activities.ManageInstancesActivity"
            android:configChanges="orientation|screenSize"
            android:label="@string/instances_picker"
            android:windowSoftInputMode="stateAlwaysHidden" />
        <activity
            android:name=".peertube.activities.WebviewActivity"
            android:configChanges="keyboardHidden|orientation|screenSize" />
        <activity
            android:name=".peertube.activities.LoginActivity"
            android:configChanges="orientation|screenSize"
            android:exported="true"
            android:windowSoftInputMode="stateAlwaysHidden">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

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

                <data
                    android:host="backtotubelab"
                    android:scheme="tubelab" />
            </intent-filter>
        </activity>

        <activity
            android:name=".peertube.activities.SettingsActivity"
            android:configChanges="orientation|screenSize"
            android:label="@string/settings"
            android:windowSoftInputMode="stateAlwaysHidden" />
        <activity
            android:name=".peertube.activities.PeertubeUploadActivity"
            android:configChanges="orientation|screenSize"
            android:label="@string/upload_video"
            android:windowSoftInputMode="stateAlwaysHidden" />

        <service
            android:name=".peertube.services.RetrieveInfoService"
            android:exported="false" />


    </application>
</manifest>