Skip to content

Commit 07b77ad

Browse files
dadachiclaude
andauthored
Remove dead code across utils and designsystem (#43)
- Drop shareImage / toUriCompat / isAlphanumeric from Utility (no production callers; deletes the matching tests) - Drop cardTimeAgoInWordsDateString from DateUtility (unused, was the only consumer of android.text.format.DateUtils) - Delete Tint.kt (TintTheme / LocalTintTheme) — provided by NatTheme but never read anywhere - Drop successContainer / onSuccessContainer from CustomColorScheme and the now-orphaned Teal10 / Teal30 / Teal90 color tokens Net: 7 files touched, 110 lines deleted. No production behavior changes. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0d35787 commit 07b77ad

7 files changed

Lines changed: 0 additions & 110 deletions

File tree

app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/theme/Color.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,9 @@ internal val Red20 = Color(0xFF690005)
3333
internal val Red30 = Color(0xFF93000A)
3434
internal val Red40 = Color(0xFFBA1A1A)
3535
internal val Red90 = Color(0xFFFFDAD6)
36-
internal val Teal10 = Color(0xFF014D40)
3736
internal val Teal20 = Color(0xFF0C6B58)
38-
internal val Teal30 = Color(0xFF147D64)
3937
internal val Teal40 = Color(0xFF199473)
4038
internal val Teal80 = Color(0xFF8EEDC7)
41-
internal val Teal90 = Color(0xFFC6F7E2)
4239

4340
internal val Yellow10 = Color(0xFF8D2B0B)
4441
internal val Yellow20 = Color(0xFFB44D12)

app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/theme/CustomColorScheme.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,16 @@ import androidx.compose.ui.graphics.Color
88
data class CustomColorScheme(
99
val success: Color = Color.Unspecified,
1010
val onSuccess: Color = Color.Unspecified,
11-
val successContainer: Color = Color.Unspecified,
12-
val onSuccessContainer: Color = Color.Unspecified,
1311
)
1412

1513
val LightCustomColorScheme = CustomColorScheme(
1614
success = Teal40,
1715
onSuccess = Color.White,
18-
successContainer = Teal90,
19-
onSuccessContainer = Teal10,
2016
)
2117

2218
val DarkCustomColorScheme = CustomColorScheme(
2319
success = Teal80,
2420
onSuccess = Teal20,
25-
successContainer = Teal30,
26-
onSuccessContainer = Teal90,
2721
)
2822

2923
val LocalCustomColorScheme = staticCompositionLocalOf { CustomColorScheme() }

app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/theme/Theme.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ fun NatTheme(
7777
tonalElevation = 2.dp,
7878
)
7979

80-
val tintTheme = TintTheme()
81-
8280
val customColorsPalette =
8381
if (darkTheme) {
8482
DarkCustomColorScheme
@@ -90,7 +88,6 @@ fun NatTheme(
9088
CompositionLocalProvider(
9189
LocalCustomColorScheme provides customColorsPalette,
9290
LocalBackgroundTheme provides backgroundTheme,
93-
LocalTintTheme provides tintTheme,
9491
) {
9592
MaterialTheme(
9693
colorScheme = colorScheme,

app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/designsystem/theme/Tint.kt

Lines changed: 0 additions & 18 deletions
This file was deleted.

app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/DateUtility.kt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.nativeapptemplate.nativeapptemplatefree.utils
22

3-
import android.text.format.DateUtils
43
import java.time.ZoneId
54
import java.time.ZonedDateTime
65

@@ -39,15 +38,4 @@ object DateUtility {
3938
val date = ZonedDateTime.parse(this).withZoneSameInstant(zoneId)
4039
return date.cardDateTimeString()
4140
}
42-
43-
fun ZonedDateTime.cardTimeAgoInWordsDateString(): String {
44-
return DateUtils.getRelativeTimeSpanString(this.toInstant().toEpochMilli(), System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS).toString()
45-
}
46-
47-
fun String.cardTimeAgoInWordsDateString(zoneId: ZoneId = ZoneId.systemDefault()): String {
48-
if (this.isBlank()) return ""
49-
50-
val date = ZonedDateTime.parse(this).withZoneSameInstant(zoneId)
51-
return date.cardTimeAgoInWordsDateString()
52-
}
5341
}

app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/Utility.kt

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,12 @@ package com.nativeapptemplate.nativeapptemplatefree.utils
33
import android.content.Context
44
import android.content.ContextWrapper
55
import android.content.Intent
6-
import android.graphics.Bitmap
76
import android.net.Uri
87
import android.os.Build
98
import androidx.activity.ComponentActivity
10-
import androidx.compose.ui.graphics.ImageBitmap
11-
import androidx.compose.ui.graphics.asAndroidBitmap
12-
import androidx.core.content.FileProvider
139
import com.nativeapptemplate.nativeapptemplatefree.BuildConfig
1410
import com.nativeapptemplate.nativeapptemplatefree.NatConstants
1511
import com.nativeapptemplate.nativeapptemplatefree.R
16-
import java.io.File
17-
import java.io.FileOutputStream
1812
import java.util.Locale
1913

2014
object Utility {
@@ -28,12 +22,6 @@ object Utility {
2822
else -> null
2923
}
3024

31-
fun isAlphanumeric(text: String?): Boolean {
32-
if (text.isNullOrBlank()) return false
33-
34-
return text.matches("^[a-zA-Z0-9]*$".toRegex())
35-
}
36-
3725
fun marketUri(): Uri {
3826
val appId = BuildConfig.APPLICATION_ID
3927
return Uri.parse("market://details?id=$appId")
@@ -44,30 +32,6 @@ object Utility {
4432
return Uri.parse("https://play.google.com/store/apps/details?id=$appId")
4533
}
4634

47-
// https://stackoverflow.com/a/75714502/1160200
48-
// https://qiita.com/irgaly/items/b942bd985a4647e372ea
49-
fun Context.shareImage(title: String, image: ImageBitmap, filename: String) {
50-
val file = File(cacheDir, "$filename.png").also { outputFile ->
51-
FileOutputStream(outputFile).use { outputStream ->
52-
image.asAndroidBitmap().compress(Bitmap.CompressFormat.PNG, 100, outputStream)
53-
}
54-
}
55-
56-
val uri = file.toUriCompat(this)
57-
58-
val shareIntent = Intent().apply {
59-
action = Intent.ACTION_SEND
60-
type = "image/png"
61-
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
62-
putExtra(Intent.EXTRA_STREAM, uri)
63-
}
64-
startActivity(Intent.createChooser(shareIntent, title))
65-
}
66-
67-
private fun File.toUriCompat(context: Context): Uri {
68-
return FileProvider.getUriForFile(context, context.packageName + ".fileprovider", this)
69-
}
70-
7135
// https://stackoverflow.com/a/78039163/1160200
7236
fun Context.restartApp() {
7337
val packageManager = packageManager

app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/utils/UtilityTest.kt

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,36 +31,4 @@ class UtilityTest {
3131
fun validateEmail_noDomain_returnsFalse() {
3232
assertFalse("test@".validateEmail())
3333
}
34-
35-
// isAlphanumeric tests
36-
37-
@Test
38-
fun isAlphanumeric_alphanumericText_returnsTrue() {
39-
assertTrue(Utility.isAlphanumeric("abc123"))
40-
}
41-
42-
@Test
43-
fun isAlphanumeric_lettersOnly_returnsTrue() {
44-
assertTrue(Utility.isAlphanumeric("abcdef"))
45-
}
46-
47-
@Test
48-
fun isAlphanumeric_numbersOnly_returnsTrue() {
49-
assertTrue(Utility.isAlphanumeric("123456"))
50-
}
51-
52-
@Test
53-
fun isAlphanumeric_specialChars_returnsFalse() {
54-
assertFalse(Utility.isAlphanumeric("abc!@#"))
55-
}
56-
57-
@Test
58-
fun isAlphanumeric_null_returnsFalse() {
59-
assertFalse(Utility.isAlphanumeric(null))
60-
}
61-
62-
@Test
63-
fun isAlphanumeric_blank_returnsFalse() {
64-
assertFalse(Utility.isAlphanumeric(""))
65-
}
6634
}

0 commit comments

Comments
 (0)