Skip to content

Commit

Permalink
fix some problems && v2.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
FunnySaltyFish committed Jul 15, 2024
1 parent f1ccc0e commit 72d27ce
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ VALUES ?;
deleteJsByName:
DELETE FROM plugin WHERE fileName = ?;

-- Update a JsBean
updateJs:
INSERT OR REPLACE INTO plugin (fileName, code, author, version, description, enabled, minSupportVersion, maxSupportVersion, targetSupportVersion, isOffline, debugMode, supportLanguages)
VALUES ?;
-- update by name
updateJsByName:
UPDATE plugin SET code = ?, author = ?, version = ?, description = ?, enabled = ?, minSupportVersion = ?, maxSupportVersion = ?, targetSupportVersion = ?, isOffline = ?, debugMode = ?, supportLanguages = ? WHERE fileName = ?;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import com.codingfeline.buildkonfig.gradle.BuildKonfigExtension
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure

var debug = true

fun configureBuildKonfigFlavorFromTasks(project: Project) {
val configuredKey = "TranstationConfiguredBuildKonfigFlavor"
if (System.getProperty(configuredKey, "false") == "true") {
Expand All @@ -25,18 +27,17 @@ fun configureBuildKonfigFlavorFromTasks(project: Project) {

val m = pattern.find(matchingTask) ?: return

val flavor = m.groupValues[2]
val buildType = m.groupValues[3]
val flavor = m.groupValues[3]
val buildType = m.groupValues[2]
// println("module: ${project.name}, match task=$matchingTask, flavor=$flavor, buildType=$buildType")
val envKey = "TranslationDebug"
when (buildType) {
"Release" -> System.setProperty(envKey, "false")
"Debug" -> System.setProperty(envKey, "true")
"Release" -> debug = false
"Debug" -> debug = true
// packageExe, packageDmg, packageDeb, packageMsi
else -> System.setProperty(envKey, "true")
else -> debug = true
}
val buildkonfigFlavor = "common"
println("module: ${project.name}, flavor=$flavor, buildType=$buildType; final buildkonfig.flavor=$buildkonfigFlavor")
println("module: ${project.name}, flavor=$flavor, buildType=$buildType, debug=$debug; final buildkonfig.flavor=$buildkonfigFlavor")
project.setProperty("buildkonfig.flavor", buildkonfigFlavor)
System.setProperty(configuredKey, "true")
}
Expand All @@ -54,7 +55,6 @@ fun Project.setupBuildKonfig() {
buildConfigField(FieldSpec.Type.STRING, "VERSION_NAME", libs.findVersion("project.versionName").get().toString())
buildConfigField(FieldSpec.Type.INT, "VERSION_CODE", libs.findVersion("project.versionCode").get().toString())
// DEBUG
val debug = System.getProperty("TranslationDebug", "true") == "true"
println("module: ${project.name}, TranslationDebug=$debug")
buildConfigField(FieldSpec.Type.BOOLEAN, "DEBUG", debug.toString())
val buildType = if (debug) "Debug" else "Release"
Expand Down
2 changes: 2 additions & 0 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ compose.desktop {
// 如果运行报错 java.lang.ClassNotFoundException: java.sql.DriverManager
// 你需要下面这行
modules("java.sql")
// javax.script
modules("java.scripting")
// 加上 -Dfile.encoding=UTF-8,这样 slf4j 输出的日志就不会乱码了
jvmArgs += listOf("-Dfile.encoding=UTF-8")

Expand Down
6 changes: 3 additions & 3 deletions composeApp/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 63,
"versionName": "2.8.0",
"outputFile": "composeApp-release.apk"
"versionCode": 64,
"versionName": "2.8.1",
"outputFile": "Transtation__release_2.8.1_202407151302.APK"
}
],
"elementType": "File"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Badge
import androidx.compose.material3.FilterChip
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -61,7 +63,7 @@ internal fun EngineSelectDialog(
isActiveClose = false
) {
EngineSelect(
modifier = Modifier,
modifier = Modifier.fillMaxWidth().verticalScroll(rememberScrollState()),
bindEngines,
jsEngines,
modelEngines,
Expand Down Expand Up @@ -131,8 +133,9 @@ private fun EnginePart(
FlowRow(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 4.dp, horizontal = 4.dp),
.padding(vertical = 0.dp, horizontal = 4.dp),
horizontalArrangement = spacedBy(8.dp),
verticalArrangement = spacedBy(0.dp)
) {
engines.forEach { engine ->
key(engine.name) {
Expand All @@ -147,7 +150,6 @@ private fun EnginePart(
},
label = {
Text(text = engine.name)

},
leadingIcon = {
if (engine is ModelTranslationTask) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,20 @@ class PluginViewModel : BaseViewModel() {

fun updatePlugin(jsBean: JsBean){
viewModelScope.launch(Dispatchers.IO) {
val origin = appDB.jsDao.queryJsByName(jsBean.fileName)
if(origin != null){
val new = jsBean.copy(id = origin.id)
appDB.jsQueries.updateJs(new)
}
appDB.jsQueries.updateJsByName(
fileName = jsBean.fileName,
code = jsBean.code,
author = jsBean.author,
version = jsBean.version,
description = jsBean.description,
enabled = jsBean.enabled,
minSupportVersion = jsBean.minSupportVersion,
maxSupportVersion = jsBean.maxSupportVersion,
targetSupportVersion = jsBean.targetSupportVersion,
isOffline = jsBean.isOffline,
debugMode = jsBean.debugMode,
supportLanguages = jsBean.supportLanguages,
)
}
}

Expand Down

0 comments on commit 72d27ce

Please sign in to comment.