Skip to content

Commit d5d10ac

Browse files
committed
build: update config, proguard rules, and blacklist parsing
1 parent bb93b6c commit d5d10ac

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

app/build.gradle.kts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ android {
2222
applicationId = "com.leanbitlab.leantype"
2323
minSdk = 21
2424
targetSdk = 35
25-
versionCode = 3860
26-
versionName = "3.8.6"
25+
versionCode = 3870
26+
versionName = "3.8.7"
2727

2828
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
2929

@@ -38,9 +38,11 @@ android {
3838
productFlavors {
3939
create("standard") {
4040
dimension = "privacy"
41+
minSdk = 23
4142
}
4243
create("standardOptimised") {
4344
dimension = "privacy"
45+
minSdk = 23
4446
}
4547
create("offline") {
4648
dimension = "privacy"

app/proguard-rules.pro

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,17 @@
3636
-dontwarn com.google.api.client.**
3737
-dontwarn java.lang.management.**
3838
-dontwarn org.joda.time.**
39+
40+
# Keep handwriting plugin interface and listener to prevent parameter removal/signature optimization
41+
-keep interface helium314.keyboard.latin.handwriting.HandwritingRecognizer {
42+
<methods>;
43+
}
44+
-keep interface helium314.keyboard.latin.handwriting.ModelDownloadListener {
45+
<methods>;
46+
}
47+
48+
# Keep ML Kit, GMS Tasks, and Firebase components for handwriting plugin dynamic linkage
49+
-keep class com.google.mlkit.** { *; }
50+
-keep class com.google.android.gms.tasks.** { *; }
51+
-keep class com.google.firebase.components.** { *; }
52+

app/src/main/java/helium314/keyboard/latin/DictionaryFacilitatorImpl.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,11 @@ private class DictionaryGroup(
891891
private var compiledBlacklistPatterns: List<Regex> = emptyList()
892892

893893
private fun rebuildCompiledPatterns() {
894-
compiledBlacklistPatterns = blacklist.map { pattern ->
894+
rebuildCompiledPatterns(blacklist)
895+
}
896+
897+
private fun rebuildCompiledPatterns(patterns: Collection<String>) {
898+
compiledBlacklistPatterns = patterns.map { pattern ->
895899
try {
896900
Regex(pattern, RegexOption.IGNORE_CASE)
897901
} catch (e: Exception) {
@@ -918,7 +922,7 @@ private class DictionaryGroup(
918922
}
919923
}
920924
addAll(loadedWords)
921-
rebuildCompiledPatterns()
925+
rebuildCompiledPatterns(this@apply)
922926
} catch (e: IOException) {
923927
Log.e(TAG, "Exception while trying to read blacklist from ${file.name}", e)
924928
}

0 commit comments

Comments
 (0)