Fix rig name showing obfuscated single letter on operator card#297
Conversation
The Settings operator card displayed the rig as a single letter (e.g. c) in release builds. It was reading baseRig.javaClass.simpleName, but R8 obfuscates the com.k1af.ft8af.rigs package (no keep rule), so the class name collapses to a meaningless short token. Selecting a different radio or rebooting did not help because every rig class is obfuscated the same way. Switch the card to GeneralVariables.myRigName, the user-selected model name from RigNameList that MainViewModel.connectRig already computes for exactly this reason (PSKReporter + display). Extract the resolution into a testable internal resolveRigDisplayName() helper and cover it with unit tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #297 +/- ##
============================================
+ Coverage 11.15% 11.18% +0.02%
Complexity 105 105
============================================
Files 81 81
Lines 11426 11430 +4
Branches 2051 2052 +1
============================================
+ Hits 1275 1278 +3
- Misses 10023 10024 +1
Partials 128 128
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR fixes the operator-card RIG display in release builds where R8 obfuscation caused baseRig.javaClass.simpleName to collapse to single-letter names (e.g., "c"). It switches the UI to display the user-selected rig model name already computed in MainViewModel.connectRig() and adds unit tests for the new resolution logic.
Changes:
- Added
internal fun resolveRigDisplayName(connected, modelName, notConnectedLabel)to compute the operator-card rig label from the persisted/user-selected model name, avoiding obfuscated class names. - Updated
SettingsLandingto useGeneralVariables.myRigName(trimmed, with"--"fallback) instead ofbaseRigclass name. - Added JVM unit tests covering connected/disconnected behavior, trimming, and blank/empty fallback.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ft8af/app/src/main/kotlin/radio/ks3ckc/ft8af/ui/settings/SettingsScreen.kt | Replaces rig label derivation with a deterministic model-name-based resolver to avoid R8-obfuscated class names. |
| ft8af/app/src/test/kotlin/radio/ks3ckc/ft8af/ui/settings/RigDisplayNameTest.kt | Adds unit coverage for the rig display-name resolution logic (connected/disconnected + trimming/fallback). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Problem
A user connected to a Lab599 Discovery TX-500 reported the RIG field on the Settings operator card showing just
c. Selecting a different radio and a full reboot didn't change it.Root cause
The operator card sourced the rig label from:
Release builds run R8 with
minifyEnabled true, andproguard-rules.prohas no keep rule forcom.k1af.ft8af.rigs.*. SoDiscoveryTX500Rig(and every other rig class) is obfuscated to a single-letter name likec, andsimpleNamereturns that. Picking another radio doesn't help — those classes are obfuscated the same way — and it survives reboots because it isn't stale state, it's the live (obfuscated) class name.Fix
Use
GeneralVariables.myRigNameinstead — the user-selected model name fromRigNameListthatMainViewModel.connectRig()already computes for exactly this reason (its comment notes the Java class name is unreliable; it's also used for the PSKReporter software string).The resolution logic is extracted into a testable top-level
internal fun resolveRigDisplayName(connected, modelName, notConnectedLabel)and the card calls that.Tests
Added
RigDisplayNameTestcovering connected/disconnected, trimming, and blank/empty fallback to--.testDebugUnitTestpasses.🤖 Generated with Claude Code