<!--
  Android manifest snippets. After `pnpm tauri android init`, merge these into
  gen/android/app/src/main/AndroidManifest.xml. Replace ultimail/space.ulti.mail
  per app (ultidrive/ultiagenda/ultichat/ulticontacts, space.ulti.<x>).
-->

<!-- ============ Permissions (top-level, inside <manifest>) ============ -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<!-- contacts-import (device source). Optional: only request at runtime. -->
<uses-permission android:name="android.permission.READ_CONTACTS" />

<!-- ============ Inside the <activity> for the main Tauri activity ============ -->

<!-- (a) Deep links: custom scheme + universal/app links -->
<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" />
  <!-- custom scheme, e.g. ultimail:// -->
  <data android:scheme="ultimail" />
</intent-filter>
<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" />
  <!-- App Link (requires assetlinks.json hosted at the host). -->
  <data android:scheme="https" android:host="space.ulti.app" android:pathPrefix="/app/mail" />
</intent-filter>

<!-- (b) Share TARGET: receive content shared *into* the app (ACTION_SEND) -->
<intent-filter>
  <action android:name="android.intent.action.SEND" />
  <category android:name="android.intent.category.DEFAULT" />
  <data android:mimeType="text/*" />
</intent-filter>
<intent-filter>
  <action android:name="android.intent.action.SEND" />
  <action android:name="android.intent.action.SEND_MULTIPLE" />
  <category android:name="android.intent.category.DEFAULT" />
  <!-- UltiDrive/UltiMail accept any file; narrow per app as desired. -->
  <data android:mimeType="*/*" />
</intent-filter>

<!-- ============ DRIVE-MOUNT: DocumentsProvider (UltiDrive only) ============ -->
<!-- Place as a sibling <provider> of <activity> inside <application>. -->
<provider
    android:name=".drive.UltiDriveDocumentsProvider"
    android:authorities="space.ulti.drive.documents"
    android:exported="true"
    android:grantUriPermissions="true"
    android:permission="android.permission.MANAGE_DOCUMENTS">
  <intent-filter>
    <action android:name="android.content.action.DOCUMENTS_PROVIDER" />
  </intent-filter>
</provider>
