Skip to content

Add Open-source Licenses screen to Settings#141

Merged
malkoG merged 2 commits intohackers-pub:mainfrom
dalinaum:claude/licenses-screen
Apr 20, 2026
Merged

Add Open-source Licenses screen to Settings#141
malkoG merged 2 commits intohackers-pub:mainfrom
dalinaum:claude/licenses-screen

Conversation

@dalinaum
Copy link
Copy Markdown
Contributor

@dalinaum dalinaum commented Apr 19, 2026

Summary

  • Integrate mikepenz/AboutLibraries 14.0.1 so the app can surface third-party licenses. The Gradle plugin generates aboutlibraries.json at build time, so the license list stays in sync with the version catalog automatically.
  • Add a clickable Open-source Licenses row in Settings, positioned directly above the existing About row.
  • New LicensesScreen loads the generated data via produceLibraries() and renders it with the Material 3 LibrariesContainer.

Screens / navigation

  • Settings → Open-source Licenses row (icon: Icons.AutoMirrored.Outlined.Article) → LicensesScreen.
  • LicensesScreen is registered on the NavHost as DetailScreen.Licenses and has a standard TopAppBar with back navigation, matching WebViewScreen.

Notes

  • String is English-only for now (no values-ko/ exists in this repo yet).
  • aboutlibraries.json is emitted under app/build/generated/aboutLibraries/…/res/raw/ and is bundled as a raw resource, so there is no runtime network dependency.
  • Verified that 238 libraries are picked up on a local build, including compose, hilt, apollo, coil, mlkit, credentials, etc.

Test plan

  • ./gradlew :app:assembleDebug succeeds
  • ./gradlew :app:lintDebug succeeds with no new warnings
  • ./gradlew :app:testDebugUnitTest passes
  • Launch app, open Settings, tap Open-source Licenses, verify the list renders and back navigation returns to Settings
  • Tap a library entry and confirm its license dialog opens

🤖 Generated with Claude Code

Integrate mikepenz/AboutLibraries 14.0.1 so the app can display the
licenses of every runtime dependency. The Gradle plugin generates
aboutlibraries.json at build time, so the list stays in sync with the
version catalog automatically — no manual upkeep per library change.

A new clickable "Open-source Licenses" row is added just above About
in Settings. It navigates to LicensesScreen, which loads the generated
data via produceLibraries() and renders it with the Material 3
LibrariesContainer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 19, 2026

Warning

Rate limit exceeded

@dalinaum has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 50 minutes and 16 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 50 minutes and 16 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 250bd4a9-e565-4c93-bbb4-b327a54f71f5

📥 Commits

Reviewing files that changed from the base of the PR and between 508fc24 and ff28a65.

📒 Files selected for processing (2)
  • app/src/main/java/pub/hackers/android/ui/screens/licenses/LicensesScreen.kt
  • app/src/main/java/pub/hackers/android/ui/screens/settings/SettingsScreen.kt
📝 Walkthrough

Walkthrough

This pull request adds AboutLibraries integration to enable displaying open-source licenses in the app. The implementation includes updating the Gradle build configuration with the AboutLibraries plugin and dependencies, creating a new LicensesScreen composable to display libraries, integrating it into the navigation system via HackersPubApp, adding a "Licenses" menu item to SettingsScreen, and adding corresponding string resources.

Changes

Cohort / File(s) Summary
Build Configuration
build.gradle.kts, app/build.gradle.kts, gradle/libs.versions.toml
Added AboutLibraries Gradle plugin and M3 Compose dependency; introduced version reference 14.0.1 in the version catalog.
New Licenses Screen
app/src/main/java/pub/hackers/android/ui/screens/licenses/LicensesScreen.kt
New composable that displays a Material 3 Scaffold with TopAppBar, fetches libraries via produceLibraries(), and renders them using LibrariesContainer.
Navigation Integration
app/src/main/java/pub/hackers/android/ui/HackersPubApp.kt
Added DetailScreen.Licenses route and composable destination wired to LicensesScreen; connected SettingsScreen's onLicensesClick callback to trigger navigation.
Settings Screen Update
app/src/main/java/pub/hackers/android/ui/screens/settings/SettingsScreen.kt
Added onLicensesClick parameter and new tappable "Licenses" row with icon and dividers.
String Resources
app/src/main/res/values/strings.xml
Added licenses string resource with value "Open-source Licenses".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a new Open-source Licenses screen accessible from Settings, which is the primary objective of this PR.
Description check ✅ Passed The pull request description comprehensively covers the changeset, detailing the AboutLibraries integration, UI changes, navigation flow, and test results.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
app/src/main/java/pub/hackers/android/ui/screens/settings/SettingsScreen.kt (1)

397-401: Icon duplicates the "My Drafts" row.

Icons.AutoMirrored.Outlined.Article is already used for the "My Drafts" row at lines 222-225. Using the same icon for "Open-source Licenses" may confuse users scanning the Settings list. Consider a more distinctive icon such as Icons.Outlined.Description, Icons.Outlined.Gavel, or Icons.AutoMirrored.Outlined.LibraryBooks.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/src/main/java/pub/hackers/android/ui/screens/settings/SettingsScreen.kt`
around lines 397 - 401, The "Open-source Licenses" row in SettingsScreen.kt is
using the same icon as "My Drafts" (Icons.AutoMirrored.Outlined.Article) which
can confuse users; locate the Icon composable within the Open-source Licenses
row (the Icon call using Icons.AutoMirrored.Outlined.Article) and replace it
with a more distinctive icon such as Icons.Outlined.Description,
Icons.Outlined.Gavel, or Icons.AutoMirrored.Outlined.LibraryBooks, keeping the
same contentDescription and tint (colors.textSecondary) so only the imageVector
changes.
app/src/main/java/pub/hackers/android/ui/screens/licenses/LicensesScreen.kt (1)

28-51: Consider scroll behavior and edge-to-edge insets on the TopAppBar.

Minor polish suggestions for consistency with other detail screens:

  • TopAppBar is not wired to a scrollBehavior, so it won't collapse/elevate on scroll. If other detail screens (e.g., WebViewScreen) use TopAppBarDefaults.pinnedScrollBehavior() or similar, matching that here keeps the UX consistent.
  • Scaffold uses default contentWindowInsets; other screens in this app (e.g., SettingsScreen at line 133) pass contentWindowInsets = WindowInsets(0). Worth verifying the licenses list doesn't double-pad under system bars.
  • LibrariesContainer handles its own LazyColumn; passing Modifier.fillMaxSize().padding(innerPadding) plus a separate contentPadding of 8dp vertical is fine, but you may want horizontal content padding too so license cards don't hug the screen edges.

None of these are blocking.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/src/main/java/pub/hackers/android/ui/screens/licenses/LicensesScreen.kt`
around lines 28 - 51, The TopAppBar in LicensesScreen isn't using a scroll
behavior and Scaffold is using default window insets which can cause
inconsistent edge-to-edge padding; update LicensesScreen to create a
scrollBehavior (e.g., val scrollBehavior =
TopAppBarDefaults.pinnedScrollBehavior()) and pass it into
TopAppBar(scrollBehavior = scrollBehavior) and Scaffold (topBar = { ... },
contentWindowInsets = WindowInsets(0)) so the app bar collapses/elevates like
other detail screens; also adjust the LibrariesContainer invocation (or its
Modifier) to add horizontal padding (or set contentPadding =
PaddingValues(horizontal = 16.dp, vertical = 8.dp)) so license cards don't hug
screen edges while keeping innerPadding applied from Scaffold and using
produceLibraries() as the data source.
app/build.gradle.kts (1)

9-9: Consider configuring the AboutLibraries plugin explicitly if stricter license metadata validation is desired.

The default settings are already reasonable: fetchRemoteLicense defaults to false in plugin v14.0.1, so build determinism and offline-friendliness are already protected. If you want stricter license checks during CI builds, add an aboutLibraries { } extension block with strictMode = StrictMode.FAIL under the license block to catch missing metadata before shipping.

Optional; the current defaults are generally fine for 238 libraries detected.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/build.gradle.kts` at line 9, The AboutLibraries plugin is applied via
alias(libs.plugins.aboutlibraries) but not configured; to enable stricter
license metadata validation add an aboutLibraries { license { strictMode =
StrictMode.FAIL } } extension so CI fails on missing/invalid license info.
Update the Gradle Kotlin DSL to declare the aboutLibraries extension and set
license.strictMode to StrictMode.FAIL (referencing aboutLibraries, license, and
StrictMode) so missing metadata are caught during builds.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/src/main/java/pub/hackers/android/ui/screens/licenses/LicensesScreen.kt`:
- Line 43: produceLibraries() is asynchronous so `libraries` can be null
initially and after config changes—update LicensesScreen to guard against null
by showing a loading indicator or an explicit empty-state and only call
LibrariesContainer when `libraries` is non-null (reference the val libraries by
produceLibraries() and the LibrariesContainer composable); additionally add an
R8/resource-keep entry to prevent release builds stripping the generated
aboutlibraries.json by adding the rule `-keepresources `@raw/aboutlibraries.json``
to app/proguard-rules.pro so the libraries resource can be loaded in release
builds.

In `@app/src/main/res/values/strings.xml`:
- Line 158: The string resource named "licenses" is currently English-only;
either provide localized translations for it to match the app's other locales or
explicitly mark it as non-translatable to avoid lint warnings — update the
<string name="licenses"> entry (or add corresponding localized versions in the
locale-specific values folders) or add translatable="false" to the "licenses"
string to indicate it should not be translated.

---

Nitpick comments:
In `@app/build.gradle.kts`:
- Line 9: The AboutLibraries plugin is applied via
alias(libs.plugins.aboutlibraries) but not configured; to enable stricter
license metadata validation add an aboutLibraries { license { strictMode =
StrictMode.FAIL } } extension so CI fails on missing/invalid license info.
Update the Gradle Kotlin DSL to declare the aboutLibraries extension and set
license.strictMode to StrictMode.FAIL (referencing aboutLibraries, license, and
StrictMode) so missing metadata are caught during builds.

In `@app/src/main/java/pub/hackers/android/ui/screens/licenses/LicensesScreen.kt`:
- Around line 28-51: The TopAppBar in LicensesScreen isn't using a scroll
behavior and Scaffold is using default window insets which can cause
inconsistent edge-to-edge padding; update LicensesScreen to create a
scrollBehavior (e.g., val scrollBehavior =
TopAppBarDefaults.pinnedScrollBehavior()) and pass it into
TopAppBar(scrollBehavior = scrollBehavior) and Scaffold (topBar = { ... },
contentWindowInsets = WindowInsets(0)) so the app bar collapses/elevates like
other detail screens; also adjust the LibrariesContainer invocation (or its
Modifier) to add horizontal padding (or set contentPadding =
PaddingValues(horizontal = 16.dp, vertical = 8.dp)) so license cards don't hug
screen edges while keeping innerPadding applied from Scaffold and using
produceLibraries() as the data source.

In `@app/src/main/java/pub/hackers/android/ui/screens/settings/SettingsScreen.kt`:
- Around line 397-401: The "Open-source Licenses" row in SettingsScreen.kt is
using the same icon as "My Drafts" (Icons.AutoMirrored.Outlined.Article) which
can confuse users; locate the Icon composable within the Open-source Licenses
row (the Icon call using Icons.AutoMirrored.Outlined.Article) and replace it
with a more distinctive icon such as Icons.Outlined.Description,
Icons.Outlined.Gavel, or Icons.AutoMirrored.Outlined.LibraryBooks, keeping the
same contentDescription and tint (colors.textSecondary) so only the imageVector
changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b3b0ea75-a993-4b29-9a38-9b731af30755

📥 Commits

Reviewing files that changed from the base of the PR and between d7afce1 and 508fc24.

📒 Files selected for processing (7)
  • app/build.gradle.kts
  • app/src/main/java/pub/hackers/android/ui/HackersPubApp.kt
  • app/src/main/java/pub/hackers/android/ui/screens/licenses/LicensesScreen.kt
  • app/src/main/java/pub/hackers/android/ui/screens/settings/SettingsScreen.kt
  • app/src/main/res/values/strings.xml
  • build.gradle.kts
  • gradle/libs.versions.toml

Comment thread app/src/main/res/values/strings.xml
- Switch the Licenses row icon from Icons.AutoMirrored.Outlined.Article
  (shared with My Drafts) to Icons.AutoMirrored.Outlined.LibraryBooks
  so the row is distinguishable at a glance.
- Set contentWindowInsets = WindowInsets(0) on LicensesScreen's Scaffold
  to match the rest of the detail screens and avoid double-padding under
  system bars.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dalinaum
Copy link
Copy Markdown
Contributor Author

Thanks for the review! Addressed the reasonable ones in ff28a65 and documented why the rest are skipped.

Applied

  • Switched the Licenses row icon to Icons.AutoMirrored.Outlined.LibraryBooks (confirmed the previous Article icon was already used for My Drafts at line 222-225).
  • Added contentWindowInsets = WindowInsets(0) to the LicensesScreen Scaffold for parity with SettingsScreen.

Skipped — with reasons

  • -keepresources @raw/aboutlibraries.json in proguard-rules.pro: I tried this first. -keepresources is an AGP resource-shrinker directive, not an R8 option — R8 fails the release build with Unknown option "-keepresources". This project also doesn't set isShrinkResources = true, so no resource shrinker runs. The library itself references the raw resource by ID (context.resources.openRawResource(R.raw.aboutlibraries) inside Libs.Builder().withContext(context)), which both R8 and AGP's resource shrinker can trace statically. aboutlibraries-core 14.0.1 also ships no consumer proguard rules, confirming none are needed. Release build (minifyReleaseWithR8) succeeds without any extra rule.

  • Null-state guard around LibrariesContainer: produceLibraries() flips from null to a populated Libs on the first Dispatcher.IO hop. LibrariesContainer already renders an empty list during that window, which is a single frame on a modern device. Adding a spinner for that tiny window felt like defensive UI code for a practically unreachable path, so left as-is.

  • translatable="false" on the licenses string: the strings catalog is currently 100% English-only (no values-*/ locales exist yet). Marking a single string non-translatable while the rest stay implicitly translatable would send a misleading signal. Revisit when localization is actually introduced.

  • TopAppBarDefaults.pinnedScrollBehavior(): WebViewScreen — the detail-screen template this follows — also doesn't use a scroll behavior, so keeping consistency with existing detail screens.

  • aboutLibraries { license { strictMode = StrictMode.FAIL } }: defaults catch 238 libraries cleanly in this project. Can be revisited if license metadata gaps show up.

@malkoG malkoG merged commit f064059 into hackers-pub:main Apr 20, 2026
2 checks passed
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.

2 participants