#727 intent handling review

This commit is contained in:
Thibault Deckers 2023-09-02 18:45:30 +02:00
parent a4c81b06c2
commit 479f955ff5
2 changed files with 32 additions and 34 deletions

View file

@ -33,10 +33,10 @@
<!-- to access media with original metadata with scoped storage (API >=29) --> <!-- to access media with original metadata with scoped storage (API >=29) -->
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
<!-- to provide a foreground service type, as required by Android 14 (API 34) --> <!-- to provide a foreground service type, as required by Android 14 (API 34) -->
<!-- TODO TLAD revisit with Android 14 >beta5 --> <!-- TODO TLAD revisit with Android 14 >beta5 -->
<!-- <uses-permission--> <!-- <uses-permission-->
<!-- android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"--> <!-- android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"-->
<!-- tools:ignore="SystemPermissionTypo" />--> <!-- tools:ignore="SystemPermissionTypo" />-->
<!-- TODO TLAD still needed to fetch map tiles / reverse geocoding / else ? check in release mode --> <!-- TODO TLAD still needed to fetch map tiles / reverse geocoding / else ? check in release mode -->
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<!-- from Android 12 (API 31), users can optionally grant access to the media management special permission --> <!-- from Android 12 (API 31), users can optionally grant access to the media management special permission -->
@ -129,32 +129,44 @@
<category android:name="android.intent.category.LEANBACK_LAUNCHER" /> <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.GET_CONTENT" />
<action android:name="android.intent.action.PICK" />
<action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.VIEW" />
<action android:name="com.android.camera.action.REVIEW" />
<action android:name="com.android.camera.action.SPLIT_SCREEN_REVIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.OPENABLE" />
<data android:mimeType="image/*" /> <data android:mimeType="image/*" />
<data android:mimeType="video/*" /> <data android:mimeType="video/*" />
<data android:mimeType="vnd.android.cursor.dir/image" /> <data android:mimeType="vnd.android.cursor.dir/image" />
<data android:mimeType="vnd.android.cursor.dir/video" /> <data android:mimeType="vnd.android.cursor.dir/video" />
<!-- no specified scheme -->
</intent-filter> </intent-filter>
<intent-filter tools:ignore="AppLinkUrlError"> <intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.GET_CONTENT" />
<action android:name="android.intent.action.PICK" />
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
<data android:mimeType="vnd.android.cursor.dir/image" />
<data android:mimeType="vnd.android.cursor.dir/video" />
</intent-filter>
<intent-filter>
<action android:name="com.android.camera.action.REVIEW" /> <action android:name="com.android.camera.action.REVIEW" />
<action android:name="com.android.camera.action.SPLIT_SCREEN_REVIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.OPENABLE" />
<data android:mimeType="image/*" /> <data android:mimeType="image/*" />
<data android:mimeType="video/*" /> <data android:mimeType="video/*" />
<data android:mimeType="vnd.android.cursor.dir/image" /> <data android:mimeType="vnd.android.cursor.dir/image" />
<data android:mimeType="vnd.android.cursor.dir/video" /> <data android:mimeType="vnd.android.cursor.dir/video" />
<data android:scheme="content" />
<data android:scheme="file" />
</intent-filter> </intent-filter>
<!-- <!--
<intent-filter> <intent-filter>
@ -165,26 +177,6 @@
<data android:mimeType="vnd.android.cursor.dir/image" /> <data android:mimeType="vnd.android.cursor.dir/image" />
</intent-filter> </intent-filter>
--> -->
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.OPENABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
<data android:mimeType="vnd.android.cursor.dir/image" />
<data android:mimeType="vnd.android.cursor.dir/video" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
<data android:mimeType="vnd.android.cursor.dir/image" />
<data android:mimeType="vnd.android.cursor.dir/video" />
</intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEARCH" /> <action android:name="android.intent.action.SEARCH" />
</intent-filter> </intent-filter>

View file

@ -194,6 +194,9 @@ open class MainActivity : FlutterFragmentActivity() {
override fun onNewIntent(intent: Intent) { override fun onNewIntent(intent: Intent) {
Log.i(LOG_TAG, "onNewIntent intent=$intent") Log.i(LOG_TAG, "onNewIntent intent=$intent")
intent.extras?.takeUnless { it.isEmpty }?.let {
Log.i(LOG_TAG, "onNewIntent intent extras=$it")
}
super.onNewIntent(intent) super.onNewIntent(intent)
intentStreamHandler.notifyNewIntent(extractIntentData(intent)) intentStreamHandler.notifyNewIntent(extractIntentData(intent))
} }
@ -265,7 +268,10 @@ open class MainActivity : FlutterFragmentActivity() {
} }
} }
Intent.ACTION_VIEW, Intent.ACTION_SEND, "com.android.camera.action.REVIEW" -> { Intent.ACTION_VIEW,
Intent.ACTION_SEND,
"com.android.camera.action.REVIEW",
"com.android.camera.action.SPLIT_SCREEN_REVIEW" -> {
(intent.data ?: intent.getParcelableExtraCompat<Uri>(Intent.EXTRA_STREAM))?.let { uri -> (intent.data ?: intent.getParcelableExtraCompat<Uri>(Intent.EXTRA_STREAM))?.let { uri ->
// MIME type is optional // MIME type is optional
val type = intent.type ?: intent.resolveType(this) val type = intent.type ?: intent.resolveType(this)