<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application
        android:allowBackup="false"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation|density"
            android:name=".MainActivity"
            android:label="@string/title_activity_main"
            android:theme="@style/AppTheme.NoActionBarLaunch"
            android:launchMode="singleTask"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <!--
                Deep-link scheme ending the mobile OIDC flow: routes the
                stmessages://auth?token=… redirect from the Custom Tab back to
                the app (caught by App.addListener("appUrlOpen")).
                Source of truth: src/features/native/auth.ts (AUTH_CALLBACK_SCHEME).
            -->
            <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="stmessages" />
            </intent-filter>
        </activity>

        <!--
            FCM rendering defaults for pushes arriving while the app is killed
            (the SDK builds the notification itself then). The channel id must
            match ANDROID_NOTIFICATION_CHANNEL_ID (features/native/push.ts,
            where the channel is created) and FCM_ANDROID_CHANNEL_ID
            (core/services/push/fcm.py); the icon is the monochrome status
            silhouette (colored launcher icons render as a flat disc there).
        -->
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_channel_id"
            android:value="new_messages" />
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/ic_stat_notification" />

        <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>
    </application>

    <!-- Permissions -->

    <uses-permission android:name="android.permission.INTERNET" />
    <!--
        Android 13+ runtime permission behind the notification prompt driven by
        PushNotifications.requestPermissions() (features/native/push.ts).
    -->
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
</manifest>
