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

	<uses-permission android:name="android.permission.INTERNET"/>
	<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
	<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
	<uses-permission android:name="android.permission.VIBRATE" />
	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28"/>
	<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE"/>
	<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
	<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

	<permission android:name="${applicationId}.permission.C2D_MESSAGE" android:protectionLevel="signature"/>

	<queries>
		<intent>
			<action android:name="android.intent.action.PROCESS_TEXT" />
			<data android:mimeType="text/plain" />
		</intent>
		<intent>
			<action android:name="android.intent.action.TRANSLATE" />
		</intent>
		<intent>
			<action android:name="android.intent.action.VIEW"/>
			<data android:scheme="http" android:host="*"/>
			<category android:name="android.intent.category.BROWSABLE"/>
		</intent>
		<intent>
			<action android:name="android.intent.action.VIEW"/>
			<data android:scheme="https" android:host="*"/>
			<category android:name="android.intent.category.BROWSABLE"/>
		</intent>
	</queries>

	<application
		android:name=".MastodonApp"
		android:allowBackup="true"
		android:label="@string/mo_app_name"
		android:supportsRtl="true"
		android:networkSecurityConfig="@xml/network_security_config"
		android:icon="@mipmap/ic_launcher"
		android:theme="@style/Theme.Mastodon.AutoLightDark"
		android:largeHeap="true"
		android:enableOnBackInvokedCallback="true">

		<meta-data
			android:name="com.google.mlkit.vision.DEPENDENCIES"
			android:value="barcode_ui"/>

		<activity android:name=".MainActivity" android:exported="true" android:configChanges="orientation|screenSize" android:windowSoftInputMode="adjustResize" android:launchMode="singleTask">
			<intent-filter>
				<action android:name="android.intent.action.MAIN"/>
				<category android:name="android.intent.category.LAUNCHER"/>
			</intent-filter>
			<intent-filter android:autoVerify="true">
				<action android:name="android.intent.action.VIEW"/>
				<category android:name="android.intent.category.BROWSABLE"/>
				<category android:name="android.intent.category.DEFAULT"/>
				<data android:scheme="https" android:host="mastodon.social" android:pathPrefix="/@"/>
			</intent-filter>
			<intent-filter android:autoVerify="true">
				<action android:name="android.intent.action.VIEW"/>
				<category android:name="android.intent.category.BROWSABLE"/>
				<category android:name="android.intent.category.DEFAULT"/>
				<data android:scheme="https" android:host="mastodon.online" android:pathPrefix="/@"/>
			</intent-filter>
		</activity>
		<activity android:name=".OAuthActivity" android:exported="true" android:configChanges="orientation|screenSize" android:launchMode="singleTask">
			<intent-filter>
				<action android:name="android.intent.action.VIEW"/>
				<category android:name="android.intent.category.BROWSABLE"/>
				<category android:name="android.intent.category.DEFAULT"/>
				<data android:scheme="${oAuthScheme}" android:host="callback"/>
			</intent-filter>
		</activity>
		<activity android:name=".ExternalShareActivity" android:exported="true" android:configChanges="orientation|screenSize" android:windowSoftInputMode="adjustResize">
			<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=".DonationFragmentActivity" android:exported="false" android:configChanges="orientation|screenSize" android:windowSoftInputMode="adjustResize"/>

		<service android:name=".AudioPlayerService" android:foregroundServiceType="mediaPlayback"/>
		<service android:name=".NotificationActionHandlerService" android:exported="false"/>

		<receiver android:name=".PushNotificationReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
			<intent-filter>
				<action android:name="com.google.android.c2dm.intent.RECEIVE" />
			</intent-filter>
		</receiver>
		<receiver android:name=".api.PushSubscriptionManager$RegistrationReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
			<intent-filter>
				<action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
				<category android:name="me.grishka.fcmtest"/>
			</intent-filter>
		</receiver>

		<provider
			android:authorities="${applicationId}.fileprovider"
			android:name=".TweakedFileProvider"
			android:grantUriPermissions="true"
			android:exported="false">
			<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/fileprovider_paths"/>
		</provider>

	</application>

</manifest>