Fix blank screen issue when entering through a quote.

This commit is contained in:
Alex Hart 2022-07-22 14:02:29 -03:00 committed by Cody Henthorne
parent c8612d5502
commit b9a225f6c6
5 changed files with 19 additions and 4 deletions

View file

@ -1731,6 +1731,7 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
requireContext(), requireContext(),
new StoryViewerArgs.Builder(messageRecord.getQuote().getAuthor(), Recipient.resolved(messageRecord.getQuote().getAuthor()).shouldHideStory()) new StoryViewerArgs.Builder(messageRecord.getQuote().getAuthor(), Recipient.resolved(messageRecord.getQuote().getAuthor()).shouldHideStory())
.withStoryId(messageRecord.getParentStoryId().asMessageId().getId()) .withStoryId(messageRecord.getParentStoryId().asMessageId().getId())
.isFromQuote(true)
.build())); .build()));
return; return;
} }

View file

@ -21,7 +21,8 @@ data class StoryViewerArgs(
val isFromNotification: Boolean = false, val isFromNotification: Boolean = false,
val groupReplyStartPosition: Int = -1, val groupReplyStartPosition: Int = -1,
val isUnviewedOnly: Boolean = false, val isUnviewedOnly: Boolean = false,
val isFromInfoContextMenuAction: Boolean = false val isFromInfoContextMenuAction: Boolean = false,
val isFromQuote: Boolean = false
) : Parcelable { ) : Parcelable {
class Builder(private val recipientId: RecipientId, private val isInHiddenStoryMode: Boolean) { class Builder(private val recipientId: RecipientId, private val isInHiddenStoryMode: Boolean) {
@ -35,6 +36,7 @@ data class StoryViewerArgs(
private var groupReplyStartPosition: Int = -1 private var groupReplyStartPosition: Int = -1
private var isUnviewedOnly: Boolean = false private var isUnviewedOnly: Boolean = false
private var isFromInfoContextMenuAction: Boolean = false private var isFromInfoContextMenuAction: Boolean = false
private var isFromQuote: Boolean = false
fun withStoryId(storyId: Long): Builder { fun withStoryId(storyId: Long): Builder {
this.storyId = storyId this.storyId = storyId
@ -76,6 +78,11 @@ data class StoryViewerArgs(
return this return this
} }
fun isFromQuote(isFromQuote: Boolean): Builder {
this.isFromQuote = isFromQuote
return this
}
fun build(): StoryViewerArgs { fun build(): StoryViewerArgs {
return StoryViewerArgs( return StoryViewerArgs(
recipientId = recipientId, recipientId = recipientId,
@ -88,7 +95,8 @@ data class StoryViewerArgs(
isFromNotification = isFromNotification, isFromNotification = isFromNotification,
groupReplyStartPosition = groupReplyStartPosition, groupReplyStartPosition = groupReplyStartPosition,
isUnviewedOnly = isUnviewedOnly, isUnviewedOnly = isUnviewedOnly,
isFromInfoContextMenuAction = isFromInfoContextMenuAction isFromInfoContextMenuAction = isFromInfoContextMenuAction,
isFromQuote = isFromQuote
) )
} }
} }

View file

@ -86,6 +86,10 @@ class StoryViewerFragment :
requireActivity().supportStartPostponedEnterTransition() requireActivity().supportStartPostponedEnterTransition()
} }
if (state.skipCrossfade) {
viewModel.setCrossfaderIsReady(true)
}
if (state.loadState.isReady()) { if (state.loadState.isReady()) {
storyCrossfader.alpha = 0f storyCrossfader.alpha = 0f
} }

View file

@ -12,7 +12,8 @@ data class StoryViewerState(
val page: Int = -1, val page: Int = -1,
val crossfadeSource: CrossfadeSource, val crossfadeSource: CrossfadeSource,
val crossfadeTarget: CrossfadeTarget? = null, val crossfadeTarget: CrossfadeTarget? = null,
val loadState: LoadState = LoadState() val loadState: LoadState = LoadState(),
val skipCrossfade: Boolean = false
) { ) {
sealed class CrossfadeSource { sealed class CrossfadeSource {
object None : CrossfadeSource() object None : CrossfadeSource()

View file

@ -29,7 +29,8 @@ class StoryViewerViewModel(
storyViewerArgs.storyThumbTextModel != null -> StoryViewerState.CrossfadeSource.TextModel(storyViewerArgs.storyThumbTextModel) storyViewerArgs.storyThumbTextModel != null -> StoryViewerState.CrossfadeSource.TextModel(storyViewerArgs.storyThumbTextModel)
storyViewerArgs.storyThumbUri != null -> StoryViewerState.CrossfadeSource.ImageUri(storyViewerArgs.storyThumbUri, storyViewerArgs.storyThumbBlur) storyViewerArgs.storyThumbUri != null -> StoryViewerState.CrossfadeSource.ImageUri(storyViewerArgs.storyThumbUri, storyViewerArgs.storyThumbBlur)
else -> StoryViewerState.CrossfadeSource.None else -> StoryViewerState.CrossfadeSource.None
} },
skipCrossfade = storyViewerArgs.isFromNotification || storyViewerArgs.isFromQuote
) )
) )