Pause story playback while saving media.

Story playback was previously paused when the context menu is opened, but resumed while saving the media.

With this change, playback will remain paused while saving media, so the user doesn't potentially miss any stories while clicking through the dialogs to save media to their device storage.
This commit is contained in:
Jeffrey Starke
2025-03-20 15:49:30 -04:00
committed by Cody Henthorne
parent c876c7847e
commit bf8f603dcf
3 changed files with 10 additions and 2 deletions

View File

@@ -1198,10 +1198,12 @@ class StoryViewerPageFragment :
},
onSave = {
lifecycleScope.launch {
viewModel.setIsSavingMedia(true)
StoryContextMenu.save(
host = AttachmentSaver.FragmentHost(this@StoryViewerPageFragment),
messageRecord = it.conversationMessage.messageRecord
)
viewModel.setIsSavingMedia(false)
}
},
onDelete = {

View File

@@ -299,6 +299,10 @@ class StoryViewerPageViewModel(
storyViewerPlaybackStore.update { it.copy(isDisplayingPartialSendDialog = isDisplayingPartialSendDialog) }
}
fun setIsSavingMedia(isSavingMedia: Boolean) {
storyViewerPlaybackStore.update { it.copy(isSavingMedia = isSavingMedia) }
}
private fun resolveSwipeToReplyState(state: StoryViewerPageState, index: Int): StoryViewerPageState.ReplyState {
if (index !in state.posts.indices) {
return StoryViewerPageState.ReplyState.NONE

View File

@@ -23,7 +23,8 @@ data class StoryViewerPlaybackState(
val isUserScrollingChild: Boolean = false,
val isUserScaling: Boolean = false,
val isDisplayingPartialSendDialog: Boolean = false,
val isDisplayingRecipientBottomSheet: Boolean = false
val isDisplayingRecipientBottomSheet: Boolean = false,
val isSavingMedia: Boolean = false
) {
val hideChromeImmediate: Boolean = isRunningSharedElementAnimation || isDisplayingFirstTimeNavigation
@@ -53,5 +54,6 @@ data class StoryViewerPlaybackState(
isUserScaling ||
isDisplayingHideDialog ||
isDisplayingPartialSendDialog ||
isDisplayingRecipientBottomSheet
isDisplayingRecipientBottomSheet ||
isSavingMedia
}