diff --git a/app/src/main/java/org/thoughtcrime/securesms/mediasend/v2/MediaSelectionNavigator.kt b/app/src/main/java/org/thoughtcrime/securesms/mediasend/v2/MediaSelectionNavigator.kt index 0209f2398b5..a2af3355eab 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/mediasend/v2/MediaSelectionNavigator.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/mediasend/v2/MediaSelectionNavigator.kt @@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.mediasend.v2 import android.Manifest import android.widget.Toast +import androidx.core.os.bundleOf import androidx.fragment.app.Fragment import androidx.navigation.NavController import org.thoughtcrime.securesms.R @@ -29,6 +30,12 @@ class MediaSelectionNavigator( navController.safeNavigate(toGallery) } + fun goToGalleryWithDisabledCamera(navController: NavController) { + if (toGallery == -1) return + + navController.safeNavigate(toGallery, bundleOf("isCameraEnabled" to false)) + } + companion object { fun Fragment.requestPermissionsForCamera( onGranted: () -> Unit diff --git a/app/src/main/java/org/thoughtcrime/securesms/mediasend/v2/capture/MediaCaptureFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/mediasend/v2/capture/MediaCaptureFragment.kt index ec9690a67d1..77357ea2d46 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/mediasend/v2/capture/MediaCaptureFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/mediasend/v2/capture/MediaCaptureFragment.kt @@ -169,7 +169,7 @@ class MediaCaptureFragment : Fragment(R.layout.fragment_container), CameraFragme override fun onGalleryClicked() { val controller = findNavController() captureChildFragment.fadeOutControls { - navigator.goToGallery(controller) + navigator.goToGalleryWithDisabledCamera(controller) } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/mediasend/v2/gallery/MediaSelectionGalleryFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/mediasend/v2/gallery/MediaSelectionGalleryFragment.kt index 569126564ed..92c258a772c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/mediasend/v2/gallery/MediaSelectionGalleryFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/mediasend/v2/gallery/MediaSelectionGalleryFragment.kt @@ -129,6 +129,10 @@ class MediaSelectionGalleryFragment : Fragment(R.layout.fragment_container), Med navigator.goToReview(findNavController()) } + override fun isCameraEnabled(): Boolean { + return arguments?.getBoolean("isCameraEnabled") ?: super.isCameraEnabled() + } + override fun onNavigateToCamera() { val controller = findNavController() requestPermissionsForCamera {