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.
This commit is contained in:
mcarare 2022-06-03 16:20:06 +03:00 committed by mergify[bot]
parent e01647a7e8
commit 48cb5ec268

View File

@ -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()
}