From 48cb5ec26802a5f426538ea63667c16df5bae1aa Mon Sep 17 00:00:00 2001 From: mcarare Date: Fri, 3 Jun 2022 16:20:06 +0300 Subject: [PATCH] For #25505: Clear the stored result in case there is no listener with the same key set. This is the case when the sharing happens outside the tabs tray. --- app/src/main/java/org/mozilla/fenix/share/ShareFragment.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/org/mozilla/fenix/share/ShareFragment.kt b/app/src/main/java/org/mozilla/fenix/share/ShareFragment.kt index 64f3bd8921..17bf7d6650 100644 --- a/app/src/main/java/org/mozilla/fenix/share/ShareFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/share/ShareFragment.kt @@ -10,6 +10,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.appcompat.app.AppCompatDialogFragment +import androidx.fragment.app.clearFragmentResult import androidx.fragment.app.setFragmentResult import androidx.fragment.app.viewModels import androidx.lifecycle.ViewModelProvider.AndroidViewModelFactory @@ -128,6 +129,8 @@ class ShareFragment : AppCompatDialogFragment() { override fun onDestroy() { setFragmentResult(RESULT_KEY, Bundle()) + // Clear the stored result in case there is no listener with the same key set. + clearFragmentResult(RESULT_KEY) super.onDestroy() }