From 33baa24cdd39769368307f1bc18a902b05adaf42 Mon Sep 17 00:00:00 2001 From: Teodor Grigor Date: Sun, 29 Oct 2023 11:38:06 +0200 Subject: [PATCH] Refactor AboutComponentsKt and AboutScreenRoute in About Module --- screen/ui/api/ui.api | 26 ++++++------ .../ceres/screen/ui/about/AboutComponents.kt | 40 ++++++++++++------- 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/screen/ui/api/ui.api b/screen/ui/api/ui.api index 9ba10a55..ddc571aa 100644 --- a/screen/ui/api/ui.api +++ b/screen/ui/api/ui.api @@ -1,8 +1,12 @@ public final class dev/teogor/ceres/screen/ui/about/AboutComponentsKt { - public static final fun aboutApkSignature (Landroidx/compose/foundation/lazy/LazyListScope;)V - public static final fun aboutAppVersion (Landroidx/compose/foundation/lazy/LazyListScope;)V - public static final fun aboutBuildDate (Landroidx/compose/foundation/lazy/LazyListScope;)V - public static final fun aboutBuildHash (Landroidx/compose/foundation/lazy/LazyListScope;)V + public static final fun aboutApkSignature (Landroidx/compose/foundation/lazy/LazyListScope;Ljava/lang/String;)V + public static synthetic fun aboutApkSignature$default (Landroidx/compose/foundation/lazy/LazyListScope;Ljava/lang/String;ILjava/lang/Object;)V + public static final fun aboutAppVersion (Landroidx/compose/foundation/lazy/LazyListScope;Ljava/lang/String;)V + public static synthetic fun aboutAppVersion$default (Landroidx/compose/foundation/lazy/LazyListScope;Ljava/lang/String;ILjava/lang/Object;)V + public static final fun aboutBuildDate (Landroidx/compose/foundation/lazy/LazyListScope;Ljava/time/LocalDateTime;)V + public static synthetic fun aboutBuildDate$default (Landroidx/compose/foundation/lazy/LazyListScope;Ljava/time/LocalDateTime;ILjava/lang/Object;)V + public static final fun aboutBuildHash (Landroidx/compose/foundation/lazy/LazyListScope;Ljava/lang/String;)V + public static synthetic fun aboutBuildHash$default (Landroidx/compose/foundation/lazy/LazyListScope;Ljava/lang/String;ILjava/lang/Object;)V public static final fun aboutCeresFramework (Landroidx/compose/foundation/lazy/LazyListScope;Ljava/lang/String;)V public static synthetic fun aboutCeresFramework$default (Landroidx/compose/foundation/lazy/LazyListScope;Ljava/lang/String;ILjava/lang/Object;)V public static final fun aboutHeaderAboutUs (Landroidx/compose/foundation/lazy/LazyListScope;)V @@ -38,26 +42,20 @@ public final class dev/teogor/ceres/screen/ui/about/AboutScreenRoute : dev/teogo public final class dev/teogor/ceres/screen/ui/about/ComposableSingletons$AboutComponentsKt { public static final field INSTANCE Ldev/teogor/ceres/screen/ui/about/ComposableSingletons$AboutComponentsKt; public static field lambda-1 Lkotlin/jvm/functions/Function3; - public static field lambda-10 Lkotlin/jvm/functions/Function3; - public static field lambda-11 Lkotlin/jvm/functions/Function3; - public static field lambda-12 Lkotlin/jvm/functions/Function3; public static field lambda-2 Lkotlin/jvm/functions/Function3; - public static field lambda-3 Lkotlin/jvm/functions/Function3; + public static field lambda-3 Lkotlin/jvm/functions/Function2; public static field lambda-4 Lkotlin/jvm/functions/Function2; - public static field lambda-5 Lkotlin/jvm/functions/Function2; + public static field lambda-5 Lkotlin/jvm/functions/Function3; public static field lambda-6 Lkotlin/jvm/functions/Function3; public static field lambda-7 Lkotlin/jvm/functions/Function3; public static field lambda-8 Lkotlin/jvm/functions/Function3; public static field lambda-9 Lkotlin/jvm/functions/Function3; public fun ()V public final fun getLambda-1$ui_release ()Lkotlin/jvm/functions/Function3; - public final fun getLambda-10$ui_release ()Lkotlin/jvm/functions/Function3; - public final fun getLambda-11$ui_release ()Lkotlin/jvm/functions/Function3; - public final fun getLambda-12$ui_release ()Lkotlin/jvm/functions/Function3; public final fun getLambda-2$ui_release ()Lkotlin/jvm/functions/Function3; - public final fun getLambda-3$ui_release ()Lkotlin/jvm/functions/Function3; + public final fun getLambda-3$ui_release ()Lkotlin/jvm/functions/Function2; public final fun getLambda-4$ui_release ()Lkotlin/jvm/functions/Function2; - public final fun getLambda-5$ui_release ()Lkotlin/jvm/functions/Function2; + public final fun getLambda-5$ui_release ()Lkotlin/jvm/functions/Function3; public final fun getLambda-6$ui_release ()Lkotlin/jvm/functions/Function3; public final fun getLambda-7$ui_release ()Lkotlin/jvm/functions/Function3; public final fun getLambda-8$ui_release ()Lkotlin/jvm/functions/Function3; diff --git a/screen/ui/src/main/kotlin/dev/teogor/ceres/screen/ui/about/AboutComponents.kt b/screen/ui/src/main/kotlin/dev/teogor/ceres/screen/ui/about/AboutComponents.kt index 029bc89d..1cf8f700 100644 --- a/screen/ui/src/main/kotlin/dev/teogor/ceres/screen/ui/about/AboutComponents.kt +++ b/screen/ui/src/main/kotlin/dev/teogor/ceres/screen/ui/about/AboutComponents.kt @@ -58,6 +58,7 @@ import dev.teogor.ceres.ui.designsystem.Surface import dev.teogor.ceres.ui.designsystem.Text import dev.teogor.ceres.ui.foundation.graphics.asImageVectorIcon import dev.teogor.ceres.ui.theme.MaterialTheme +import java.time.LocalDateTime import java.time.format.DateTimeFormatter import java.time.format.FormatStyle @@ -86,10 +87,12 @@ fun ScreenListScope.aboutHeaderVersion() = item { ) } -fun ScreenListScope.aboutAppVersion() = item { +fun ScreenListScope.aboutAppVersion( + version: String = AppMetadataManager.versionName, +) = item { SimpleView( title = "App version", - subtitle = AppMetadataManager.versionName, + subtitle = version, icon = Icons.Default.Info, ) } @@ -145,14 +148,19 @@ fun ScreenListScope.aboutCeresFramework( } } -fun ScreenListScope.aboutBuildDate() = item { - SimpleView( - title = "Build date", - subtitle = AppMetadataManager.buildDateTime.format( +fun ScreenListScope.aboutBuildDate( + buildDateTime: LocalDateTime = AppMetadataManager.buildDateTime, +) { + item { + val formattedDate = buildDateTime.format( DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM), - ), - icon = Icons.Default.DateRange, - ) + ) + SimpleView( + title = "Build date", + subtitle = formattedDate, + icon = Icons.Default.DateRange, + ) + } } fun ScreenListScope.aboutHeaderAboutUs() = item { @@ -175,20 +183,24 @@ fun ScreenListScope.aboutHeaderSecurityPatch() = item { ) } -fun ScreenListScope.aboutBuildHash() = item { +fun ScreenListScope.aboutBuildHash( + hash: String = AppMetadataManager.gitHash, +) = item { SimpleView( title = "Build hash", - subtitle = AppMetadataManager.gitHash, + subtitle = hash, icon = Icons.Default.DomainVerification, ) } -fun ScreenListScope.aboutApkSignature() { - AppMetadataManager.apkSignature?.let { apkSignature -> +fun ScreenListScope.aboutApkSignature( + apkSignature: String? = AppMetadataManager.apkSignature, +) { + apkSignature?.let { signature -> item { SimpleView( title = "APK signature", - subtitle = apkSignature, + subtitle = signature, icon = Icons.Default.Verified, ) }