Skip to content

Add QR code dialog UX improvements#518

Merged
torlando-tech merged 1 commit intomainfrom
feature/qr-code
Feb 21, 2026
Merged

Add QR code dialog UX improvements#518
torlando-tech merged 1 commit intomainfrom
feature/qr-code

Conversation

@torlando-tech
Copy link
Copy Markdown
Owner

@torlando-tech torlando-tech commented Feb 21, 2026

image image image

Summary

  • Set max screen brightness and FLAG_KEEP_SCREEN_ON when any QR code dialog is open, restoring original values on dismiss
  • Add tap-to-expand on QrCodeImage — tapping opens a full-screen white overlay with a large QR code (tap or back to dismiss)
  • Add QR code quick-access button and bottom sheet to ChatsScreen
  • Add Context.findActivity() helper to safely unwrap ContextThemeWrapper inside Compose Dialogs

Test plan

  • Open any QR dialog — screen brightness should jump to max, screen stays on
  • Dismiss dialog — brightness restores to previous value
  • Tap the QR code image — full-screen white overlay with large QR code appears
  • Tap overlay or press back — returns to normal dialog
  • QR code button in ChatsScreen top bar opens bottom sheet with scan/show options

🤖 Generated with Claude Code

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 21, 2026

Greptile Summary

This 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:

  • Introduced Context.findActivity() helper to safely unwrap ContextThemeWrapper in Compose Dialogs
  • Added DisposableEffect blocks to set max brightness and FLAG_KEEP_SCREEN_ON when QR dialogs open, with proper restoration on dismiss
  • Implemented tap-to-expand on QrCodeImage component for full-screen white overlay viewing
  • Added QR code quick-access button and bottom sheet to ChatsScreen for easy scanning/showing
  • Applied brightness/screen-on controls consistently across IdentityQrCodeDialogContent, QrCodeImage expanded view, and MyIdentityScreen

Implementation Quality:
The implementation properly uses DisposableEffect with onDispose callbacks to ensure screen settings are restored when dialogs are dismissed. The findActivity() helper correctly walks the context chain to find the Activity. The tap-to-expand feature provides intuitive UX for better QR code scanning.

Confidence Score: 4/5

  • Safe to merge with minor style considerations
  • The implementation follows good patterns with proper cleanup in DisposableEffect blocks. The findActivity() helper correctly unwraps ContextThemeWrapper. Screen brightness and keep-screen-on flags are properly restored on dismiss. Minor style improvement suggested for consistency in activity context capture.
  • No files require special attention - all changes follow established patterns

Important Files Changed

Filename Overview
app/src/main/java/com/lxmf/messenger/ui/components/QrCodeComposables.kt Adds findActivity() helper and tap-to-expand QR code with brightness/screen-on controls
app/src/main/java/com/lxmf/messenger/ui/screens/ChatsScreen.kt Adds QR code quick-access button and bottom sheet integration to ChatsScreen

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
Loading

Last reviewed commit: d58cbc9

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

}

// Full-screen expanded QR code overlay
val activity = LocalContext.current.findActivity()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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.

@sentry
Copy link
Copy Markdown
Contributor

sentry bot commented Feb 21, 2026

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>
@torlando-tech torlando-tech merged commit 565e775 into main Feb 21, 2026
13 checks passed
@torlando-tech torlando-tech deleted the feature/qr-code branch February 21, 2026 17:52
@torlando-tech torlando-tech linked an issue Feb 22, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(UX) Make qr code sharing one button click away.

1 participant