Conversation
Greptile SummaryThis PR enhances the QR code experience across the app with three key improvements: automatic screen brightness maximization and keep-screen-on when displaying QR codes, tap-to-expand functionality for a full-screen view, and quick-access QR code button in ChatsScreen. Key Changes:
Implementation Quality: Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[ChatsScreen] -->|Tap QR Code Button| B[QrCodeBottomSheet]
B -->|Select Scan QR Code| C[QR Scanner Screen]
B -->|Select Show QR Code| D[IdentityQrCodeDialog]
E[MyIdentityScreen] -->|View QR Code| D
F[QrCodeImage Component] -->|Tap QR Code| G[Full-Screen Overlay]
D -->|Contains| F
D -.->|DisposableEffect| H[Set Brightness=1.0<br/>FLAG_KEEP_SCREEN_ON]
G -.->|DisposableEffect| H
D -->|Dismiss| I[Restore Original Brightness<br/>Clear FLAG_KEEP_SCREEN_ON]
G -->|Tap/Back| I
style H fill:#90EE90
style I fill:#FFB6C1
style D fill:#87CEEB
style G fill:#87CEEB
Last reviewed commit: d58cbc9 |
| } | ||
|
|
||
| // Full-screen expanded QR code overlay | ||
| val activity = LocalContext.current.findActivity() |
There was a problem hiding this comment.
findActivity() called inside composable could fail if Context chain doesn't contain Activity
The findActivity() call at line 157 is outside the Dialog scope, which means LocalContext.current will be the Activity. However, this is inconsistent with line 54 where findActivity() is called before the Dialog. Consider moving this call before the expanded check for consistency and to avoid potential issues if the context changes.
| val activity = LocalContext.current.findActivity() | |
| val activity = LocalContext.current.findActivity() | |
| if (expanded && qrBitmap != null) { |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: app/src/main/java/com/lxmf/messenger/ui/components/QrCodeComposables.kt
Line: 157
Comment:
`findActivity()` called inside composable could fail if Context chain doesn't contain Activity
The `findActivity()` call at line 157 is outside the Dialog scope, which means `LocalContext.current` will be the Activity. However, this is inconsistent with line 54 where `findActivity()` is called before the Dialog. Consider moving this call before the expanded check for consistency and to avoid potential issues if the context changes.
```suggestion
val activity = LocalContext.current.findActivity()
if (expanded && qrBitmap != null) {
```
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…o-expand When showing a QR code for scanning, set max screen brightness and FLAG_KEEP_SCREEN_ON so the code stays readable. Restore original brightness on dismiss. Add tap-to-expand on QrCodeImage that opens a full-screen white overlay with a large QR code. Also add QR code button and bottom sheet to ChatsScreen for quick access. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d58cbc9 to
587619e
Compare
Summary
FLAG_KEEP_SCREEN_ONwhen any QR code dialog is open, restoring original values on dismissQrCodeImage— tapping opens a full-screen white overlay with a large QR code (tap or back to dismiss)Context.findActivity()helper to safely unwrapContextThemeWrapperinside Compose DialogsTest plan
🤖 Generated with Claude Code