Skip to content

refactor(settings): improve compile-time type safety for QR scanner quick tile - #72

Closed
Balajitechlabs wants to merge 1 commit into
masterfrom
demo/qr-tile-typesafety
Closed

Balajitechlabs wants to merge 1 commit into
masterfrom
demo/qr-tile-typesafety

Conversation

@Balajitechlabs

@Balajitechlabs Balajitechlabs commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Description

This PR refactors the Quick Settings QR Scanner tile request in SettingsFloatingWindowSection.kt to use compile-time type-safe class references instead of raw package string literals, preventing runtime failures under code minification or future package refactorings.

Changes Made

  • Replaced "com.balajitechlabs.quickdash.core.quicktile.QrScannerTileService" with QrScannerTileService::class.java.
  • Modernized getSystemService(Context.STATUS_BAR_SERVICE) as StatusBarManager to idiomatic getSystemService(StatusBarManager::class.java).

Screencast / Verification

  • Verified clean compilation with zero warnings (w:) and zero errors (e:).
  • Verified runtime tile request compatibility on Android 13+ (API 33+).

Checklist

  • Tested on device / compiled with zero warnings
  • Code follows project clean architecture
  • No breaking API changes introduced

Summary by CodeRabbit

  • Refactor
    • Updated QR scanner Quick Settings tile registration without changing user-visible behavior.
    • Existing API handling and fallback notification behavior remain unchanged.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Welcome @Balajitechlabs! Thank you for contributing to QuickDash! ⚡

We really appreciate your time and effort to improve QuickDash. Before maintainers review this PR, please double-check the following:

  • 🔨 Automated Checks: Please wait for all CI checks (Android Build, Unit Tests, Lint Check, and Security Scan) to pass with green checkmarks ✅.
  • 🧪 Local Tests: Ensure ./gradlew testDebugUnitTest and ./gradlew assembleDebug execute cleanly.
  • 📋 Scope & Rules: Confirm changes comply with our architecture and thread-safety rules (all Compose UI writes on Dispatchers.Main).

💡 Tip: If your PR is still in progress, please keep it as a Draft. Once all checks pass and it is ready for maintainer review, mark it as Ready for review! 🚀

@Balajitechlabs
Balajitechlabs marked this pull request as draft September 13, 2026 18:09
@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 66aa4eec-e1c1-49c6-865a-b2ffbe51f3d5

📥 Commits

Reviewing files that changed from the base of the PR and between 42cd77f and 765f4df.

📒 Files selected for processing (1)
  • app/src/main/java/com/balajitechlabs/quickdash/features/settings/presentation/sections/SettingsFloatingWindowSection.kt

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The QR scanner tile registration now uses typed Android service and component references. API 33+ handling and the pre-33 fallback toast remain unchanged.

Changes

QR tile registration

Layer / File(s) Summary
Typed QR tile registration
app/src/main/java/com/balajitechlabs/quickdash/features/settings/presentation/sections/SettingsFloatingWindowSection.kt
The scan tile handler uses getSystemService(StatusBarManager::class.java) and QrScannerTileService::class.java instead of a cast and hard-coded class name.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 765f4

The refactor preserves the QR tile registration behavior while replacing fragile string and cast usage with typed references.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: a type-safety refactor for the QR scanner Quick Settings tile.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch demo/qr-tile-typesafety

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Balajitechlabs

This comment was marked as outdated.

@Balajitechlabs Balajitechlabs left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@Balajitechlabs please review the changes

Recommendation

The type-safe refactoring for the QR Scanner quick tile is a solid addition. Before merging into master, consider:

  1. Validating that QrScannerTileService is declared with android.permission.BIND_QUICK_SETTINGS_TILE in AndroidManifest.xml.
  2. Verifying that proguard keep rules protect QrScannerTileService if custom reflection is used elsewhere.
  3. Adding debug logging in the catch block to log system tile request rejections.

val componentName = ComponentName(
context,
"com.balajitechlabs.quickdash.core.quicktile.QrScannerTileService"
QrScannerTileService::class.java

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

[suggestion] Type-safe class reference prevents R8/ProGuard obfuscation breakage.

Suggested change
QrScannerTileService::class.java
val componentName = ComponentName(
context,
QrScannerTileService::class.java
)

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.

1 participant