Skip to content

Remove dead code, resources and build config - #75

Merged
dadachi merged 8 commits into
mainfrom
cleanup/dead-code
Oct 13, 2026
Merged

dadachi merged 8 commits into
mainfrom
cleanup/dead-code

Conversation

@dadachi

@dadachi dadachi commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Phase 3 (dead code removal). Every deletion was checked by grepping Kotlin, XML, the manifest, navigation, Gradle and ProGuard files. Reflection was ruled out too: the app never calls getIdentifier, and every Json that decodes the models sets ignoreUnknownKeys.

Changes

  • NetModule.okHttpCallFactory(): nothing injects Call.Factory; Retrofit uses provideOkHttp. This unused client also logged full request and response bodies, unredacted, in debug builds.
  • model/proguard-rules.pro: no build reads it. :model doesn't minify and doesn't list it in consumerProguardFiles. Its only line, -keep com...model.**, was malformed: it has no class keyword. Removed the file and the no-op release {} block that pointed to it.
  • Hilt test modules (TestDispatcherModule, TestDispatchersModule, TestCryptoModule, TestDataStoreModule): no test is @HiltAndroidTest and the test source set has no Hilt processor, so Hilt never installs them. With them gone nothing uses hilt-android-testing, so I removed it from app/build.gradle.kts and from the version catalog. InMemoryDataStore stays because tests use it.
  • Unused resources (lint UnusedResources reported all of them):
    • strings instructions, open, role, unauthorized, cancel, shop_name_is_required, removed from values and values-ja together
    • drawable/ic_placeholder_default
    • mipmap/ic_launcher_round: the manifest has no android:roundIcon
  • Model:
    • Shopkeeper is never used; sign-in and sign-up use LoggedInShopkeeper.
    • Shopkeepers and Relationships.shopkeepers are for organizations, which the Free edition doesn't have; nothing reads them.
    • Attributes.shopkeeperId, ownerId, ownerName, isAdmin and shopsCount are never read.
    • Data.getCreatedAt and ItemTag.getCreatedAt have no callers.
  • kotlin.parcelize plugin in :app: no app source uses @Parcelize. :model keeps the plugin. The release R8 seeds are unchanged apart from the deleted classes.
  • App ProGuard rules that repeat library rules: the -dontwarn lines for bouncycastle, conscrypt and openjsse are covered by OkHttp's own rules, and the Response/Continuation keeps by Retrofit's. With these rules removed, the release classes.dex is byte-identical (same md5). The retrofit2.Call, GeneratedMessageLite and @Parcelize rules stay: removing the Call or Parcelize rule does change the dex.
  • Separate text fix (from paid #107): sent_reset_password_instruction and sent_confirmation_instruction read "An email has been sent the email containing ...", and the reset one had a stray ". Both now say what the Japanese text already says. The test was ported from paid SentInstructionsMessagesTest. Red check: both tests failed on the old strings, then passed after the fix.

Not done (considered)

  • docs/images/nfc.gif (15 MB), screenshots_nfc.png and overview_before/after.png are not referenced in the repo, but they may be linked from outside (website or blog), so I left them.
  • Some model getters and fields are used only by tests (ItemTag.getPosition/getShopName/getShopId/getState, Attributes.createdAt/updatedAt, Meta.totalCount). They mirror the API schema, so I left them.
  • The proto DataStore fields stay because they are needed for compatibility with stored data.

Checks

  • ./gradlew :app:compileDebugKotlin builds with no warnings.
  • Pre-push steps: spotless, lintDebug, :app:minifyReleaseWithR8 and test all pass. The Gradle daemon crashed during lint because of concurrent builds, so I re-ran those steps with --no-daemon.
  • 352 test cases, 0 failures (debug, release and :model).
  • ./gradlew :app:assembleRelease passes.
  • Device (Pixel 1C081FDF600CMG, debug build against the local API): launched while signed in. The shop list and Sample Shop's item tags load and decode correctly, with no crashes. Everything else in this PR is a deletion with no runtime effect.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K5hZEFqXhBsUQwSWsgR6eH

dadachi and others added 8 commits October 13, 2026 09:09
Nothing injects Call.Factory: Retrofit gets the OkHttpClient from
provideOkHttp. The unused client also logged full bodies, unredacted,
in debug builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K5hZEFqXhBsUQwSWsgR6eH
:model never minifies (false is also the library default) and does not
list the file as a consumer ProGuard file, so its rules never reached R8.
Its only line was also malformed: `-keep com...model.**` has no class
specification keyword. The app's proguard-rules.pro is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K5hZEFqXhBsUQwSWsgR6eH
TestDispatcher(s)Module, TestCryptoModule and TestDataStoreModule are
@TestInstallIn/@Installin modules, but no test is a @HiltAndroidTest and
the test source set has no Hilt annotation processor, so Hilt never builds
a test component that would use them. The tests construct their
dependencies directly (InMemoryDataStore stays: tests use it). With the
modules gone nothing uses hilt-android-testing, so drop that dependency.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K5hZEFqXhBsUQwSWsgR6eH
Nothing references these (Kotlin R.*, XML @string/@drawable/@Mipmap,
or getIdentifier, which the app never calls), and lint's
UnusedResources check reports each of them:
- strings instructions, open, role, unauthorized, cancel and
  shop_name_is_required, from values/ and values-ja/ together;
- drawable ic_placeholder_default;
- mipmap ic_launcher_round: the manifest sets no android:roundIcon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K5hZEFqXhBsUQwSWsgR6eH
- Shopkeeper: no code decodes or builds it (sign-in, sign-up and profile
  responses use LoggedInShopkeeper).
- Shopkeepers and Relationships.shopkeepers: organization membership,
  which the Free edition does not have; nothing reads the field.
- Attributes.shopkeeperId, ownerId, ownerName, isAdmin and shopsCount:
  decoded but never read.
- Data.getCreatedAt and ItemTag.getCreatedAt: no callers.

Every Json that decodes these models sets ignoreUnknownKeys (networkJson
for Retrofit, and the demo repositories' Json in tests), so responses that
still carry those keys decode exactly as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K5hZEFqXhBsUQwSWsgR6eH
No :app source uses @parcelize; the Parcelable model classes are compiled
in :model, which keeps the plugin. The release R8 seeds are unchanged
apart from the classes removed in this branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K5hZEFqXhBsUQwSWsgR6eH
R8 reads OkHttp's rules (-dontwarn org.conscrypt.**, org.bouncycastle.**,
okhttp3.internal.platform.**) and Retrofit's (keep Response and
kotlin.coroutines.Continuation), so the app's copies changed nothing:
the release classes.dex built without them is byte-identical to the one
built with them, and R8 reports no missing classes. The retrofit2.Call,
GeneratedMessageLite and @parcelize rules stay; dropping the Call or
Parcelize rule does change the dex.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K5hZEFqXhBsUQwSWsgR6eH
sent_reset_password_instruction and sent_confirmation_instruction read
"An email has been sent the email containing ...", the reset one with a
stray ". Say what values-ja says: an email with the instructions has
been sent. SentInstructionsMessagesTest (as in the paid edition) failed
on the old text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K5hZEFqXhBsUQwSWsgR6eH
@dadachi
dadachi merged commit 74c88ad into main Oct 13, 2026
1 check passed
@dadachi
dadachi deleted the cleanup/dead-code branch October 13, 2026 00:32
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