<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Default permissions -->
    <uses-permission android:name="android.permission.INTERNET" />

    <!-- Permissions from Dioxus.toml [permissions] section -->
    {{#each permissions}}
    <uses-permission android:name="{{ this }}" />
    {{/each}}

    <!-- Hardware features from Dioxus.toml [android] section -->
    {{#each features}}
    <uses-feature android:name="{{ this }}" android:required="true" />
    {{/each}}

    <!-- Raw manifest XML from Dioxus.toml [android.raw.manifest] -->
    {{{ raw_manifest }}}

    <application android:hasCode="true" android:icon="@mipmap/ic_launcher"
        android:extractNativeLibs="true"
        android:allowNativeHeapPointerTagging="false"
        android:label="@string/app_name"
        android:supportsRtl="{{#if supports_rtl}}{{ supports_rtl }}{{else}}true{{/if}}"
        android:theme="{{#if app_theme}}{{ app_theme }}{{else}}@style/AppTheme{{/if}}"
        {{#if uses_cleartext_traffic}}android:usesCleartextTraffic="{{ uses_cleartext_traffic }}"{{/if}}
        {{#if large_heap}}android:largeHeap="{{ large_heap }}"{{/if}}
        android:networkSecurityConfig="@xml/network_security_config">
        <activity android:configChanges="orientation|screenLayout|screenSize|keyboardHidden" android:exported="true"
            android:label="@string/app_name" android:name="dev.dioxus.main.MainActivity">
            <meta-data android:name="android.app.lib_name" android:value="{{ lib_name }}" />
            <meta-data android:name="android.app.func_name" android:value="ANativeActivity_onCreate" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            {{#each url_schemes}}
            <!-- URL scheme deep link: {{ this }}:// -->
            <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:scheme="{{ this }}" />
            </intent-filter>
            {{/each}}

            {{#each app_link_hosts}}
            <!-- App link: https://{{ this }} -->
            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="https" android:host="{{ this }}" />
            </intent-filter>
            {{/each}}
        </activity>

        {{#if foreground_service_type}}
        <service
            android:name=".DioxusForegroundService"
            android:foregroundServiceType="{{ foreground_service_type }}"
            android:exported="false" />
        {{/if}}
    </application>
</manifest>
