Use ShareIntentHandler early to avoid distributing the whole intent (#6274)
* Use `ShareIntentHandler` early to avoid distributing the whole intent This would make the intent be serialized as part of `NavTarget` and could potentially lead to `TransactionTooLargeException`s. We now pass a new `ShareIntentData` class around, containing the minimum amount of data needed. We also have a new `OnSharedData` post-processor to revoke uri access after they've been shared. * Move `UriToShare` next to `ShareIntentData` and add docs
This commit is contained in:
parent
7c97ec1155
commit
9c8757e38b
20 changed files with 285 additions and 141 deletions
21
features/share/test/build.gradle.kts
Normal file
21
features/share/test/build.gradle.kts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (c) 2026 Element Creations Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id("io.element.android-library")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "io.element.android.features.share.test"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.features.share.api)
|
||||
implementation(projects.libraries.architecture)
|
||||
implementation(projects.libraries.matrix.api)
|
||||
implementation(projects.tests.testutils)
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (c) 2026 Element Creations Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.features.share.test
|
||||
|
||||
import android.content.Intent
|
||||
import io.element.android.features.share.api.ShareIntentData
|
||||
import io.element.android.features.share.api.ShareIntentHandler
|
||||
|
||||
class FakeShareIntentHandler(
|
||||
private val onIncomingShareIntent: (Intent) -> ShareIntentData? = { null },
|
||||
) : ShareIntentHandler {
|
||||
override fun handleIncomingShareIntent(
|
||||
intent: Intent,
|
||||
): ShareIntentData? {
|
||||
return onIncomingShareIntent(intent)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue