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

	<uses-permission android:name="android.permission.INTERNET" />
	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
	<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
	<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
	<uses-permission android:name="android.permission.USE_BIOMETRIC" />
	<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
	<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
	<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

	<uses-permission
		android:name="android.permission.GET_ACCOUNTS"
		tools:node="remove" />
	<uses-permission
		android:name="android.permission.USE_CREDENTIALS"
		tools:node="remove" />
	<uses-permission
		android:name="android.permission.MANAGE_ACCOUNTS"
		tools:node="remove" />

	<application
		android:name=".CryptomatorApp"
		android:allowBackup="true"
		android:icon="@mipmap/ic_launcher"
		android:label="@string/app_name"
		android:requestLegacyExternalStorage="true"
		android:supportsRtl="true"
		android:theme="@style/AppTheme"
		android:usesCleartextTraffic="true">
		<!-- Necessary for OneDrive https://stackoverflow.com/a/50779232/825532 -->
		<uses-library
			android:name="org.apache.http.legacy"
			android:required="false" />

		<activity
			android:name=".ui.activity.SplashActivity"
			android:screenOrientation="portrait"
			android:theme="@style/SplashTheme">
			<intent-filter>
				<action android:name="android.intent.action.MAIN" />

				<category android:name="android.intent.category.LAUNCHER" />
			</intent-filter>
		</activity>
		<activity
			android:name=".ui.activity.VaultListActivity"
			android:windowSoftInputMode="adjustPan" />
		<activity android:name=".ui.activity.ChooseCloudServiceActivity" />
		<activity
			android:name=".ui.activity.CreateVaultActivity"
			android:windowSoftInputMode="stateVisible" />
		<activity
			android:name=".ui.activity.BrowseFilesActivity"
			android:windowSoftInputMode="adjustPan" />
		<activity
			android:name=".ui.activity.SetPasswordActivity"
			android:windowSoftInputMode="stateVisible" />

		<activity
			android:name=".ui.activity.TextEditorActivity"
			android:windowSoftInputMode="stateVisible" />

		<activity
			android:name=".ui.activity.SharedFilesActivity"
			android:excludeFromRecents="true"
			android:taskAffinity=".share"
			android:windowSoftInputMode="stateHidden|adjustPan">
			<intent-filter android:label="@string/share_with_label">
				<action android:name="android.intent.action.SEND" />
				<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.activity.AutoUploadChooseVaultActivity" />

		<!-- Cloud Services -->
		<activity
			android:name="com.dropbox.core.android.AuthActivity"
			android:configChanges="orientation|keyboard"
			android:launchMode="singleTask">
			<intent-filter>
				<data android:scheme="db-${DROPBOX_API_KEY}" />

				<action android:name="android.intent.action.VIEW" />

				<category android:name="android.intent.category.BROWSABLE" />
				<category android:name="android.intent.category.DEFAULT" />
			</intent-filter>
		</activity>


		<activity android:name=".ui.activity.EmptyDirIdFileInfoActivity" />


		<!-- Settings -->
		<activity android:name=".ui.activity.BiometricAuthSettingsActivity" />
		<activity android:name=".ui.activity.CloudConnectionListActivity" />
		<activity android:name=".ui.activity.CloudSettingsActivity" />
		<activity android:name=".ui.activity.LicensesActivity" />
		<activity android:name=".ui.activity.SettingsActivity" />
		<activity android:name=".ui.activity.WebDavAddOrChangeActivity" />

		<activity
			android:name=".ui.activity.AuthenticateCloudActivity"
			android:theme="@style/Theme.Transparent" />

		<activity
			android:name=".ui.activity.ImagePreviewActivity"
			android:theme="@style/FullscreenTheme" />

		<activity
			android:name=".ui.activity.LicenseCheckActivity"
			android:launchMode="singleTask">
			<intent-filter android:label="@string/dialog_enter_license_title">
				<action android:name="android.intent.action.VIEW" />

				<category android:name="android.intent.category.DEFAULT" />
				<category android:name="android.intent.category.BROWSABLE" />

				<data
					android:host="*"
					android:scheme="cryptomator" />
			</intent-filter>
			<intent-filter android:label="@string/dialog_enter_license_title">
				<action android:name="android.intent.action.VIEW" />

				<category android:name="android.intent.category.DEFAULT" />
				<category android:name="android.intent.category.BROWSABLE" />

				<data
					android:host="android.cryptomator.org"
					android:pathPrefix="/app/license"
					android:scheme="https" />
			</intent-filter>
		</activity>


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

		<meta-data
			android:name="android.max_aspect"
			android:value="2.1" />

		<service
			android:name=".service.CryptorsService"
			android:enabled="true" />

		<service
			android:name=".service.AutoUploadService"
			android:enabled="true" />

		<service
			android:name=".service.PhotoContentJob"
			android:exported="true"
			android:permission="android.permission.BIND_JOB_SERVICE" />

		<receiver
			android:name=".AutoPhotoUploadReceiver"
			android:label="AutoPhotoUploadReceiver">
			<intent-filter>
				<action android:name="android.hardware.action.NEW_PICTURE" />
				<action android:name="com.android.camera.NEW_PICTURE" />

				<data android:mimeType="image/*" />
			</intent-filter>
		</receiver>

		<receiver android:name=".BootAwareReceiver">
			<intent-filter>
				<action android:name="android.intent.action.BOOT_COMPLETED" />
				<action android:name="android.intent.action.ACTION_SHUTDOWN" />
			</intent-filter>
		</receiver>

	</application>

</manifest>
