From f683b6bdb60cceaf6a167eb83726569414c19bc0 Mon Sep 17 00:00:00 2001 From: LooKeR Date: Wed, 19 Nov 2025 21:02:36 +0530 Subject: [PATCH] refactor: Add defaults for `AboutScreenContent` --- .../card_locker/ComposeAboutActivityTest.kt | 14 ++------------ .../main/java/protect/card_locker/AboutActivity.kt | 13 ++++--------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/app/src/androidTest/java/protect/card_locker/ComposeAboutActivityTest.kt b/app/src/androidTest/java/protect/card_locker/ComposeAboutActivityTest.kt index 261d854a1..f27672022 100644 --- a/app/src/androidTest/java/protect/card_locker/ComposeAboutActivityTest.kt +++ b/app/src/androidTest/java/protect/card_locker/ComposeAboutActivityTest.kt @@ -16,12 +16,7 @@ class ComposeAboutActivityTest { @Test fun testPasses(): Unit = with(rule) { setContent { - AboutScreenContent( - content = AboutContent(LocalContext.current), - showDonate = true, - showRateOnGooglePlay = false, - onBackPressedDispatcher = null - ) + AboutScreenContent(AboutContent(LocalContext.current)) } onNodeWithTag("topbar_catima").assertIsDisplayed() @@ -30,12 +25,7 @@ class ComposeAboutActivityTest { @Test fun testFails(): Unit = with(rule) { setContent { - AboutScreenContent( - content = AboutContent(LocalContext.current), - showDonate = true, - showRateOnGooglePlay = false, - onBackPressedDispatcher = null - ) + AboutScreenContent(AboutContent(LocalContext.current)) } onNodeWithTag("topbar_catima").assertIsNotDisplayed() diff --git a/app/src/main/java/protect/card_locker/AboutActivity.kt b/app/src/main/java/protect/card_locker/AboutActivity.kt index c9a955d96..b08d971df 100644 --- a/app/src/main/java/protect/card_locker/AboutActivity.kt +++ b/app/src/main/java/protect/card_locker/AboutActivity.kt @@ -54,9 +54,9 @@ class AboutActivity : ComponentActivity() { @Composable fun AboutScreenContent( content: AboutContent, - showDonate: Boolean, - showRateOnGooglePlay: Boolean, - onBackPressedDispatcher: OnBackPressedDispatcher?, + showDonate: Boolean = true, + showRateOnGooglePlay: Boolean = true, + onBackPressedDispatcher: OnBackPressedDispatcher? = null, ) { CatimaTheme { Scaffold( @@ -166,10 +166,5 @@ fun AboutScreenContent( @Preview @Composable fun AboutActivityPreview() { - AboutScreenContent( - content = AboutContent(LocalContext.current), - showDonate = true, - showRateOnGooglePlay = true, - onBackPressedDispatcher = null - ) + AboutScreenContent(AboutContent(LocalContext.current)) }