Bugfix: pending reply lost when reopening chat after passcode unlock#388
Bugfix: pending reply lost when reopening chat after passcode unlock#388dazewell wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughIn ChangesReply Preview Panel Restoration
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.43.0)TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.javaThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
can’t reproduce this on my end. |
Problem
With a passcode lock enabled (and set to be locked Immediately for easier repro), the following sequence loses the pending reply reference:
Expected:
pending reply + draft text.
Actual:
draft text restored, reply reference lost (or at least not visible).
Root cause
On passcode unlock,
LaunchActivity.showPasscodeActivity()callsActionBarLayout.rebuildFragments(REBUILD_FLAG_REBUILD_LAST), which rebuilds theChatActivityviews viaclearViews()while keeping the same fragment instance.replyingMessageObjectsurvives, but the recreatedChatActivityEnterViewno longer shows the reply panel. IncreateView()onlysetReplyingMessageObject()was called (internal state only), andapplyDraftMaybe()skips restoring the panel becausereplyingMessageObject != null. So the visible reply preview is never re-shown.Fix
In
createView(), when a reply is still pending after a view rebuild, re-show the visible reply panel viashowFieldPanelForReply()/showFieldPanelForReplyQuote()(mirroringfallbackFieldPanellogic). This only runs whenreplyingMessageObject != null, so the normal chat-open path is unaffected.