Skip to content

Conversation

@vijay2909
Copy link

@vijay2909 vijay2909 commented Oct 1, 2025

Resolves #2489

refactor(about): Modernize AboutActivity architecture and expand test coverage

This commit overhauls the About screen and its associated tests to align with modern Android development best practices, improving maintainability, performance, and reliability.

AboutActivity Refactor

  • UI/UX Improvements: The screen layout has been optimized for better readability and a cleaner visual appearance.
  • Code Organization: All Jetpack Compose functions related to the About screen have been moved from the Activity into their own dedicated files (compose/AboutScreen.kt). This improves maintainability and separates UI rendering from the Activity's lifecycle logic.

Test Suite Improvements

  • Fixed/Replaced Tests:
    • Removed a broken Robolectric lifecycle test that incorrectly mixed test rules.
    • Replaced it with a robust instrumented test that verifies UI state is preserved across configuration changes (screen rotation).
  • New Tests Added:
    • Added comprehensive tests for dialog interactions

Kotlin Conversion

  • OpenWebLinkHandler: Migrated from Java to Kotlin for improved conciseness and null safety when handling URL intents.
  • AboutContent: Fully converted to a Kotlin object.

@TheLastProject
Copy link
Member

Before I review this, just one question: where did my and realjoni's code in #2576 go? I'm not seeing my WIP commit in there, nor their commit, so it's very hard for me to know which code is new and which are your fixes, which will make review a lot harder and more time consuming 😅

Are you asking for a full review? Because I don't think this is ready to merge, the second I start scrolling I see some pretty weird unrelated changes like the build config being removed, which is needed for Google Play policy compliance 😅

@vijay2909
Copy link
Author

I’ve separated the AboutActivity tests into unit and instrumented tests, migrated them to be Compose-compatible, and covered all scenarios from component visibility to functionality.

Regarding the build features, I removed them from the default config since they were defined there instead of being separated for debug and release builds. Keeping them in the default config would require manually toggling values between builds. Instead, I’m now relying on BuildConfig.DEBUG, which automatically resolves to false in release builds. This ensures both the Donate and Rate the app buttons remain visible to users in the release version.

@TheLastProject
Copy link
Member

Regarding the build features, I removed them from the default config since they were defined there instead of being separated for debug and release builds. Keeping them in the default config would require manually toggling values between builds. Instead, I’m now relying on BuildConfig.DEBUG, which automatically resolves to false in release builds. This ensures both the Donate and Rate the app buttons remain visible to users in the release version.

The donate and rate app button is not shown on release and hidden on debug though.

The donate button is shown only on the foss flavour, because Google bans apps from having donate buttons. The rate is only shown in the Google Play version because it's silly to ask people to rate on Google Play if that's not where they got the app from.

I'm going to have to find some time soon to manually review and compare things (after the BuildConfig thing is fixed again) because everything moved to different files, so the git diff view is basically useless :)

Copy link
Member

@TheLastProject TheLastProject left a comment

Choose a reason for hiding this comment

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

On a very quick scroll a lot of this looks fine I think, will have to test and look more closely later. But I'm seeing some things that seem off from a quick look

Comment on lines +207 to +220

<!--
In Android 11 (API level 30) and higher, package visibility restrictions apply.
Without declaring this <queries> element, calls like
intent.resolveActivity(activity.packageManager) will return null,
because the system hides apps that can handle the intent.
-->
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
</queries>
Copy link
Member

Choose a reason for hiding this comment

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

What is this for? Catima has been running on Android 11 and up for ages and has never needed this before.

Comment on lines -30 to -32

buildConfigField("boolean", "showDonate", "true")
buildConfigField("boolean", "showRateOnGooglePlay", "false")
Copy link
Member

Choose a reason for hiding this comment

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

As explained, this change is wrong.

androidTestImplementation("androidx.test:core:$androidXTestVersion")
androidTestImplementation("junit:junit:$junitVersion")
androidTestImplementation("androidx.test.ext:junit:1.2.1")
// androidTestImplementation("androidx.test.ext:junit:1.3.0")
Copy link
Member

Choose a reason for hiding this comment

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

Why commented out code?


// Test rules and transitive dependencies:
implementation("androidx.compose.ui:ui-test-junit4:1.9.2")
// Needed for createComposeRule(), but not for createAndroidComposeRule<YourActivity>():
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Needed for createComposeRule(), but not for createAndroidComposeRule<YourActivity>():
// Needed for createComposeRule(), but not for createAndroidComposeRule<YourActivity>():

Comment on lines +59 to +70
// Use reflection to test private methods
with(composableTestRule) {
onNodeWithTag(context.getString(R.string.license))
.performClick()

onNodeWithText(context.getString(R.string.ok))
.assertIsDisplayed()
.performClick()

onNodeWithText(context.getString(R.string.ok))
.assertIsNotDisplayed()
}
Copy link
Member

Choose a reason for hiding this comment

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

Is this reflection? Are these private methods?

Comment on lines +31 to +32
showDonate = !BuildConfig.DEBUG, // show donate button only in release builds
showRateOnGooglePlay = !BuildConfig.DEBUG, // show rate button only in release builds
Copy link
Member

Choose a reason for hiding this comment

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

Incorrect logic

Comment on lines +106 to +112
usedLibraries.add(
ThirdPartyInfo(
"NumberPickerPreference",
"https://github.com/invissvenska/NumberPickerPreference",
"GNU LGPL 3.0"
)
)
Copy link
Member

Choose a reason for hiding this comment

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

Note for self: this needs updating, see #2712

Comment on lines +19 to +21
// Ensure it opens in browser, not your own app
addCategory(Intent.CATEGORY_BROWSABLE)
flags = Intent.FLAG_ACTIVITY_NEW_TASK
Copy link
Member

Choose a reason for hiding this comment

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

Why did we never need to do this before? Bit confused by this change. I'm not sure why Catima would ever handle these URLs?

@vijay2909 vijay2909 closed this Oct 4, 2025
@vijay2909
Copy link
Author

Hi @TheLastProject , I've closed my previous pull request for this issue as it had a number of mistakes and was becoming difficult to follow. My apologies for any confusion.

I'm happy to start over with a fresh branch and a clean implementation to get this done correctly. Before I begin, could you please let me know if help is still needed on this? If so, I'll get started right away.

Thanks!

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.

3 participants