<?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.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.CAMERA" />

    <uses-feature android:name="android.hardware.camera.any" android:required="false" />

    <uses-sdk tools:overrideLibrary="androidx.camera.core, androidx.camera.camera2, androidx.camera.lifecycle, androidx.camera.view" />

    <queries>
        <package android:name="com.nextcloud.client" />
        <package android:name="com.nextcloud.android.qa" />
        <package android:name="com.nextcloud.android.beta" />
    </queries>

    <application
        android:name="it.niedermann.nextcloud.deck.DeckApplication"
        android:allowBackup="false"
        android:fullBackupContent="false"
        android:hardwareAccelerated="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:networkSecurityConfig="@xml/network_security_config"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:enableOnBackInvokedCallback="true"
        tools:ignore="GoogleAppIndexingWarning"
        tools:targetApi="tiramisu">

        <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=".ui.main.MainActivity"
            android:label="@string/app_name_short"
            android:theme="@style/SplashTheme"
            android:exported="true">

            <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/shortcuts" />
            <meta-data
                android:name="android.app.searchable"
                android:resource="@xml/searchable" />
            <meta-data
                android:name="android.app.default_searchable"
                android:value=".ui.MainActivity" />
        </activity>

        <activity
            android:name=".ui.manageaccounts.ManageAccountsActivity"
            android:label="@string/manage_accounts"
            android:parentActivityName=".ui.main.MainActivity"
            android:windowSoftInputMode="stateHidden" />

        <activity
            android:name=".ui.takephoto.TakePhotoActivity"
            android:theme="@style/TakePhotoTheme"
            android:windowSoftInputMode="stateHidden" />

        <activity
            android:name=".ui.sharetarget.ShareTargetActivity"
            android:label="@string/share_add_to_card"
            android:theme="@style/SplashTheme"
            android:exported="true">

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

        <activity
            android:name=".ui.archivedboards.ArchivedBoardsActivity"
            android:label="@string/archived_boards"
            android:parentActivityName="it.niedermann.nextcloud.deck.ui.main.MainActivity" />

        <activity
            android:name=".ui.upcomingcards.UpcomingCardsActivity"
            android:label="@string/widget_upcoming_title"
            android:parentActivityName="it.niedermann.nextcloud.deck.ui.main.MainActivity" />

        <activity
            android:name=".ui.card.EditActivity"
            android:label="@string/edit"
            android:parentActivityName="it.niedermann.nextcloud.deck.ui.main.MainActivity" />

        <activity
            android:name=".ui.attachments.AttachmentsActivity"
            android:label="@string/attachments"
            android:parentActivityName="it.niedermann.nextcloud.deck.ui.card.EditActivity"
            android:theme="@style/TransparentTheme" />

        <activity
            android:name=".ui.settings.SettingsActivity"
            android:label="@string/simple_settings"
            android:parentActivityName="it.niedermann.nextcloud.deck.ui.main.MainActivity" />

        <activity
            android:name=".ui.ImportAccountActivity"
            android:label="@string/app_name" />

        <activity
            android:name=".ui.preparecreate.PrepareCreateActivity"
            android:description="@string/add_a_new_card_using_the_button"
            android:label="@string/add_card"
            android:exported="true">

            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="text/*" />
            </intent-filter>
        </activity>

        <activity
            android:name=".ui.about.AboutActivity"
            android:label="@string/about"
            android:parentActivityName="it.niedermann.nextcloud.deck.ui.main.MainActivity" />

        <activity
            android:name=".ui.PushNotificationActivity"
            android:label="@string/app_name"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
        </activity>

        <activity
            android:name=".ui.exception.ExceptionActivity"
            android:process=":error_activity" />

<!--        <receiver-->
<!--            android:name="it.niedermann.nextcloud.deck.ui.widget.filter.FilterWidget"-->
<!--            android:label="@string/widget_filter_title">-->

<!--            <intent-filter>-->
<!--                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />-->
<!--            </intent-filter>-->

<!--            <meta-data-->
<!--                android:name="android.appwidget.provider"-->
<!--                android:resource="@xml/filter_widget_provider" />-->
<!--        </receiver>-->

        <service
            android:name=".ui.widget.upcoming.UpcomingWidgetService"
            android:permission="android.permission.BIND_REMOTEVIEWS" />

        <receiver
            android:name="it.niedermann.nextcloud.deck.ui.widget.upcoming.UpcomingWidget"
            android:label="@string/widget_upcoming_title"
            android:exported="true">

            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>

            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/upcoming_widget_provider" />
        </receiver>

        <activity android:name=".ui.widget.stack.StackWidgetConfigurationActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
            </intent-filter>
        </activity>

        <receiver
            android:name="it.niedermann.nextcloud.deck.ui.widget.stack.StackWidget"
            android:label="@string/widget_stack_title"
            android:exported="true">

            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>

            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/stack_widget_provider" />
        </receiver>

        <service
            android:name=".ui.tiles.EditCardTileService"
            android:description="@string/add_a_new_card_using_the_button"
            android:icon="@drawable/ic_app_logo"
            android:label="@string/add_card"
            android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
            android:exported="true">
            <intent-filter>
                <action android:name="android.service.quicksettings.action.QS_TILE" />
            </intent-filter>
        </service>

        <service
            android:name=".ui.widget.stack.StackWidgetService"
            android:permission="android.permission.BIND_REMOTEVIEWS" />

        <activity
            android:name=".ui.widget.singlecard.SelectCardForWidgetActivity"
            android:label="@string/share_add_to_card"
            android:theme="@style/SplashTheme"
            android:exported="true">

            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
            </intent-filter>
        </activity>

        <service
            android:name=".ui.widget.singlecard.SingleCardWidgetService"
            android:permission="android.permission.BIND_REMOTEVIEWS" />

        <receiver
            android:name=".ui.widget.singlecard.SingleCardWidget"
            android:label="@string/single_card"
            android:exported="true">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>
            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/widget_single_card_info" />
        </receiver>

        <!-- Trigger Google Play services to install the backported photo picker module. -->
        <!-- https://developer.android.com/training/data-storage/shared/photopicker#device-availability -->
        <!--suppress AndroidDomInspection -->
        <service android:name="com.google.android.gms.metadata.ModuleDependencies"
            android:enabled="false" android:exported="false" tools:ignore="MissingClass">
            <intent-filter>
                <action android:name="com.google.android.gms.metadata.MODULE_DEPENDENCIES" />
            </intent-filter>
            <meta-data android:name="photopicker_activity:0:required" android:value="" />
        </service>

    </application>
</manifest>
