diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index ef6bda9ebc..34a8fe31f5 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -147,14 +147,6 @@
-
-
-
-
@@ -171,7 +163,7 @@
-
+
,
private val appErrorStateService: AppErrorStateService,
private val analyticsService: AnalyticsService,
- private val shareService: ShareService,
private val sdkMetadata: SdkMetadata,
) : Presenter {
@Composable
@@ -45,10 +43,6 @@ class RootPresenter @Inject constructor(
)
}
- LaunchedEffect(Unit) {
- shareService.observeFeatureFlag(this)
- }
-
return RootState(
rageshakeDetectionState = rageshakeDetectionState,
crashDetectionState = crashDetectionState,
diff --git a/appnav/src/test/kotlin/io/element/android/appnav/RootPresenterTest.kt b/appnav/src/test/kotlin/io/element/android/appnav/RootPresenterTest.kt
index 6d0878d812..4c8b2a803d 100644
--- a/appnav/src/test/kotlin/io/element/android/appnav/RootPresenterTest.kt
+++ b/appnav/src/test/kotlin/io/element/android/appnav/RootPresenterTest.kt
@@ -14,16 +14,12 @@ import com.google.common.truth.Truth.assertThat
import io.element.android.appnav.root.RootPresenter
import io.element.android.features.rageshake.api.crash.aCrashDetectionState
import io.element.android.features.rageshake.api.detection.aRageshakeDetectionState
-import io.element.android.features.share.api.ShareService
-import io.element.android.features.share.test.FakeShareService
import io.element.android.libraries.matrix.test.FakeSdkMetadata
import io.element.android.services.analytics.test.FakeAnalyticsService
import io.element.android.services.apperror.api.AppErrorState
import io.element.android.services.apperror.api.AppErrorStateService
import io.element.android.services.apperror.impl.DefaultAppErrorStateService
import io.element.android.tests.testutils.WarmUpRule
-import io.element.android.tests.testutils.lambda.lambdaRecorder
-import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test
@@ -43,22 +39,6 @@ class RootPresenterTest {
}
}
- @Test
- fun `present - check that share service is invoked`() = runTest {
- val lambda = lambdaRecorder { _ -> }
- val presenter = createRootPresenter(
- shareService = FakeShareService {
- lambda(it)
- }
- )
- moleculeFlow(RecompositionMode.Immediate) {
- presenter.present()
- }.test {
- skipItems(1)
- lambda.assertions().isCalledOnce()
- }
- }
-
@Test
fun `present - passes app error state`() = runTest {
val presenter = createRootPresenter(
@@ -82,14 +62,12 @@ class RootPresenterTest {
private fun createRootPresenter(
appErrorService: AppErrorStateService = DefaultAppErrorStateService(),
- shareService: ShareService = FakeShareService {},
): RootPresenter {
return RootPresenter(
crashDetectionPresenter = { aCrashDetectionState() },
rageshakeDetectionPresenter = { aRageshakeDetectionState() },
appErrorStateService = appErrorService,
analyticsService = FakeAnalyticsService(),
- shareService = shareService,
sdkMetadata = FakeSdkMetadata("sha")
)
}
diff --git a/features/share/api/src/main/kotlin/io/element/android/features/share/api/ShareService.kt b/features/share/api/src/main/kotlin/io/element/android/features/share/api/ShareService.kt
deleted file mode 100644
index db5bdd7f29..0000000000
--- a/features/share/api/src/main/kotlin/io/element/android/features/share/api/ShareService.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright 2024 New Vector 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.api
-
-import kotlinx.coroutines.CoroutineScope
-
-interface ShareService {
- fun observeFeatureFlag(coroutineScope: CoroutineScope)
-}
diff --git a/features/share/impl/src/main/kotlin/io/element/android/features/share/impl/DefaultShareService.kt b/features/share/impl/src/main/kotlin/io/element/android/features/share/impl/DefaultShareService.kt
deleted file mode 100644
index 87f8088fdc..0000000000
--- a/features/share/impl/src/main/kotlin/io/element/android/features/share/impl/DefaultShareService.kt
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2024 New Vector 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.impl
-
-import android.content.ComponentName
-import android.content.Context
-import android.content.pm.PackageManager
-import com.squareup.anvil.annotations.ContributesBinding
-import io.element.android.features.share.api.ShareService
-import io.element.android.libraries.di.AppScope
-import io.element.android.libraries.di.ApplicationContext
-import io.element.android.libraries.featureflag.api.FeatureFlagService
-import io.element.android.libraries.featureflag.api.FeatureFlags
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.flow.launchIn
-import kotlinx.coroutines.flow.onEach
-import timber.log.Timber
-import javax.inject.Inject
-
-@ContributesBinding(AppScope::class)
-class DefaultShareService @Inject constructor(
- private val featureFlagService: FeatureFlagService,
- @ApplicationContext private val context: Context,
-) : ShareService {
- override fun observeFeatureFlag(coroutineScope: CoroutineScope) {
- val shareActivityComponent = getShareActivityComponent()
- ?: return Unit.also {
- Timber.w("ShareActivity not found")
- }
- featureFlagService.isFeatureEnabledFlow(FeatureFlags.IncomingShare)
- .onEach { enabled ->
- shareActivityComponent.enableOrDisable(enabled)
- }
- .launchIn(coroutineScope)
- }
-
- private fun getShareActivityComponent(): ComponentName? {
- return context.packageManager
- .getPackageInfo(
- context.packageName,
- PackageManager.GET_ACTIVITIES or PackageManager.MATCH_DISABLED_COMPONENTS
- )
- .activities
- ?.firstOrNull { it.name.endsWith(".ShareActivity") }
- ?.let { shareActivityInfo ->
- ComponentName(
- shareActivityInfo.packageName,
- shareActivityInfo.name,
- )
- }
- }
-
- private fun ComponentName.enableOrDisable(enabled: Boolean) {
- val state = if (enabled) {
- PackageManager.COMPONENT_ENABLED_STATE_DEFAULT
- } else {
- PackageManager.COMPONENT_ENABLED_STATE_DISABLED
- }
- try {
- context.packageManager.setComponentEnabledSetting(
- this,
- state,
- PackageManager.DONT_KILL_APP,
- )
- } catch (e: Exception) {
- Timber.e(e, "Failed to enable or disable the component")
- }
- }
-}
diff --git a/features/share/test/build.gradle.kts b/features/share/test/build.gradle.kts
deleted file mode 100644
index 871e856adb..0000000000
--- a/features/share/test/build.gradle.kts
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright 2024 New Vector 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(libs.coroutines.core)
- implementation(projects.tests.testutils)
-}
diff --git a/features/share/test/src/main/kotlin/io/element/android/features/share/test/FakeShareService.kt b/features/share/test/src/main/kotlin/io/element/android/features/share/test/FakeShareService.kt
deleted file mode 100644
index b5b6111004..0000000000
--- a/features/share/test/src/main/kotlin/io/element/android/features/share/test/FakeShareService.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2024 New Vector 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 io.element.android.features.share.api.ShareService
-import io.element.android.tests.testutils.lambda.lambdaError
-import kotlinx.coroutines.CoroutineScope
-
-class FakeShareService(
- private val observeFeatureFlagLambda: (CoroutineScope) -> Unit = { lambdaError() }
-) : ShareService {
- override fun observeFeatureFlag(coroutineScope: CoroutineScope) {
- observeFeatureFlagLambda(coroutineScope)
- }
-}
diff --git a/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeatureFlags.kt b/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeatureFlags.kt
index 16a6d6839a..02c25bb7b8 100644
--- a/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeatureFlags.kt
+++ b/libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeatureFlags.kt
@@ -82,13 +82,6 @@ enum class FeatureFlags(
defaultValue = { OnBoardingConfig.CAN_LOGIN_WITH_QR_CODE },
isFinished = false,
),
- IncomingShare(
- key = "feature.incomingShare",
- title = "Incoming Share support",
- description = "Allow the application to receive data from other applications",
- defaultValue = { true },
- isFinished = false,
- ),
PinnedEvents(
key = "feature.pinnedEvents",
title = "Pinned Events",