2 Commits

Author SHA1 Message Date
b0c4a7e05a UPDATE: Support TCP, Apply Singleton pattern, Replace reflection with Type Factory + sync.Pool for optimization, Optimize file release process
All checks were successful
Build / build (push) Successful in 8m47s
2025-10-19 13:20:56 +07:00
0a44f56c2f Re-optima apk
All checks were successful
Build / build (push) Successful in 6m3s
2025-10-18 09:13:43 +07:00
9 changed files with 76 additions and 56 deletions

1
.idea/gradle.xml generated
View File

@@ -15,5 +15,6 @@
</option>
</GradleProjectSettings>
</option>
<option name="parallelModelFetch" value="true" />
</component>
</project>

View File

@@ -22,6 +22,8 @@ android {
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@@ -32,6 +34,9 @@ android {
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
ndk {
abiFilters.addAll(listOf("arm64-v8a"))
}
}
}
@@ -89,6 +94,6 @@ dependencies {
// Local AAR library
implementation(files("libs/firefly-go.aar"))
implementation("org.slf4j:slf4j-android:1.7.36")
implementation(libs.slf4j.android)
}

BIN
app/libs/firefly-go.aar (Stored with Git LFS)

Binary file not shown.

View File

@@ -66,6 +66,7 @@ import androidx.compose.ui.window.DialogProperties
import kotlinx.coroutines.delay
import org.json.JSONObject
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontFamily
data class AppVersion(
val latestVersion: String,
@@ -421,64 +422,60 @@ fun parseGoLogLine(line: String): String? {
return if (content.isNullOrBlank()) null else content
}
fun parseAnsi(text: String): AnnotatedString {
fun parseAnsi(text: String, defaultColor: Color): AnnotatedString {
val regex = Regex("\u001B\\[(\\d+)(;\\d+)*m")
val builder = buildAnnotatedString {
var lastIndex = 0
var currentColor = Color.Black
var currentColor = defaultColor
for (match in regex.findAll(text)) {
val start = match.range.first
// 1. Thêm phần text TRƯỚC mã ANSI với màu HIỆN TẠI
val before = text.substring(lastIndex, start)
if (before.isNotEmpty()) {
withStyle(SpanStyle(color = currentColor)) {
append(before)
}
}
// 2. Lấy mã code (ví dụ 31, 36, hoặc 0)
val code = try {
match.groupValues[1].toInt()
} catch (e: NumberFormatException) {
0
}
val code = match.groupValues[1].toInt()
currentColor = when (code) {
30 -> {
Color.Black
}
31 -> {
Color.Red
}
32 -> {
Color(0xFF00C853)
}
33 -> {
Color(0xFFFFD600)
}
34 -> {
Color(0xFF2962FF)
}
35 -> {
Color(0xFFD500F9)
}
36 -> {
Color(0xFF00B8D4)
}
37 -> {
Color.White
}
else -> {
Color.Black
}
0 -> defaultColor
30 -> Color.Black
31 -> Color.Red
32 -> Color(0xFF00C853) // Green
33 -> Color(0xFFFFD600) // Yellow
34 -> Color(0xFF2962FF) // Blue
35 -> Color(0xFFD500F9) // Magenta
36 -> Color(0xFF00B8D4) // Cyan
37 -> Color.White
else -> currentColor
}
lastIndex = match.range.last + 1
}
if (lastIndex < text.length) {
val remain = text.substring(lastIndex)
if (remain.isNotEmpty()) {
withStyle(SpanStyle(color = currentColor)) {
append(remain)
}
}
}
}
return builder
}
@Composable
fun LogPopup(
onDismiss: () -> Unit
@@ -512,6 +509,8 @@ fun LogPopup(
}
}
val defaultTextColor = LocalContentColor.current
Dialog(onDismissRequest = { onDismiss() }) {
Surface(
shape = RoundedCornerShape(12.dp),
@@ -531,8 +530,15 @@ fun LogPopup(
LazyColumn(state = listState, modifier = Modifier.weight(1f)) {
items(logs.size) { index ->
Text(
text = parseAnsi(logs[index]),
text = parseAnsi(logs[index], defaultTextColor),
fontSize = 12.sp,
// 2. DÙNG FONT MONOSPACE
fontFamily = FontFamily.Monospace,
// 3. (Tuỳ chọn) Giảm chiều cao dòng để logo liền mạch
lineHeight = 14.sp,
modifier = Modifier.padding(vertical = 2.dp)
)
}

View File

@@ -1,5 +1,5 @@
{
"latest_version": "3.6.4-02",
"changelog": "UPDATE: Update to 3.6.54",
"apk_url": "https://git.kain.io.vn/Firefly-Shelter/FireflyGo_Android/releases/download/3.6.4-02/firefly_go_android.apk"
"latest_version": "3.6.4-04",
"changelog": "UPDATE: Support TCP, Re-optima",
"apk_url": "https://git.kain.io.vn/Firefly-Shelter/FireflyGo_Android/releases/download/3.6.4-04/firefly_go_android.apk"
}

View File

@@ -23,3 +23,4 @@ kotlin.code.style=official
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
#org.gradle.configuration-cache=false
android.r8.optimizedResourceShrinking=true

View File

@@ -2,23 +2,24 @@
activityComposeVersion = "1.11.0"
agp = "8.13.0"
androidxJunit = "1.3.0"
animationCore = "1.9.2"
animationCore = "1.9.3"
autoupdater = "1.0.1"
espressoCoreVersion = "3.7.0"
foundation = "1.9.2"
foundation = "1.9.3"
kotlin = "2.2.20"
coreKtx = "1.17.0"
junit = "4.13.2"
lifecycleRuntimeKtxVersion = "2.9.4"
material = "1.9.2"
material = "1.9.3"
material3WindowSizeClass = "1.4.0"
materialIconsExtended = "1.7.8"
ui = "1.9.2"
uiGraphics = "1.9.2"
uiTestJunit4 = "1.9.2"
uiTestManifest = "1.9.2"
uiTooling = "1.9.2"
uiToolingPreview = "1.9.2"
slf4jAndroidVersion = "1.7.36"
ui = "1.9.3"
uiGraphics = "1.9.3"
uiTestJunit4 = "1.9.3"
uiTestManifest = "1.9.3"
uiTooling = "1.9.3"
uiToolingPreview = "1.9.3"
[libraries]
androidx-activity-compose-v1101 = { module = "androidx.activity:activity-compose", version.ref = "activityComposeVersion" }
@@ -35,6 +36,7 @@ androidx-material3-window-size-class1 = { module = "androidx.compose.material3:m
autoupdater = { module = "com.github.CSAbhiOnline:AutoUpdater", version.ref = "autoupdater" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
material3 = { module = "androidx.compose.material3:material3", version.ref = "material3WindowSizeClass" }
slf4j-android = { module = "org.slf4j:slf4j-android", version.ref = "slf4jAndroidVersion" }
ui = { module = "androidx.compose.ui:ui", version.ref = "ui" }
ui-graphics = { module = "androidx.compose.ui:ui-graphics", version.ref = "uiGraphics" }
ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "uiTestJunit4" }

View File

@@ -1,2 +1,7 @@
# Changelog
## - FIX: I forgot update new data
## - UPDATE:
* Support TCP
* Apply Singleton pattern
* Replace reflection with Type Factory + sync.Pool for optimization
* Optimize file release process

View File

@@ -1,5 +1,5 @@
{
"tag": "3.6.4-02",
"title": "PreBuild Version 3.6.54 - 02"
"tag": "3.6.4-04",
"title": "PreBuild Version 3.6.54 - 04"
}