fix media picking not working (#4989)

regression from https://github.com/tuskyapp/Tusky/pull/4978

I'm sure this `BottomSheetCallback` business had a reason, but it works
fine without on all the devices I tried it with 🤷
This commit is contained in:
Konrad Pozniak 2025-03-13 19:48:12 +01:00 committed by GitHub
commit 271514f2ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -996,24 +996,12 @@ class ComposeActivity :
}
private fun onMediaPick() {
addMediaBehavior.addBottomSheetCallback(
object : BottomSheetCallback() {
override fun onStateChanged(bottomSheet: View, newState: Int) {
// Wait until bottom sheet is not collapsed and show next screen after
if (newState == BottomSheetBehavior.STATE_COLLAPSED) {
addMediaBehavior.removeBottomSheetCallback(this)
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
pickMediaFilePermissionLauncher.launch(Manifest.permission.READ_EXTERNAL_STORAGE)
} else {
pickMediaFileLauncher.launch(true)
}
}
}
override fun onSlide(bottomSheet: View, slideOffset: Float) {}
}
)
addMediaBehavior.state = BottomSheetBehavior.STATE_HIDDEN
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
pickMediaFilePermissionLauncher.launch(Manifest.permission.READ_EXTERNAL_STORAGE)
} else {
pickMediaFileLauncher.launch(true)
}
addMediaBehavior.setState(BottomSheetBehavior.STATE_HIDDEN)
}
private fun openPollDialog() = lifecycleScope.launch {