From 563754d50244fe7dfafd9a92d3aabff7525590ee Mon Sep 17 00:00:00 2001 From: chinosk <2248589280@qq.com> Date: Tue, 25 Jun 2024 23:55:42 +0800 Subject: [PATCH] add config file update submodule --- app/src/main/assets/gakumas-local | 2 +- .../gakumas/localify/hookUtils/FileHotUpdater.kt | 4 ---- .../chinosk/gakumas/localify/models/ProgramConfig.kt | 12 ++++++++++++ .../gakumas/localify/ui/pages/subPages/HomePage.kt | 10 ++-------- 4 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 app/src/main/java/io/github/chinosk/gakumas/localify/models/ProgramConfig.kt diff --git a/app/src/main/assets/gakumas-local b/app/src/main/assets/gakumas-local index cdd0ad0..a60a171 160000 --- a/app/src/main/assets/gakumas-local +++ b/app/src/main/assets/gakumas-local @@ -1 +1 @@ -Subproject commit cdd0ad064cf6d3f13107e19b5d08c582d8d0664e +Subproject commit a60a171b40b22b04d567ab39a8fd7f571c7921f5 diff --git a/app/src/main/java/io/github/chinosk/gakumas/localify/hookUtils/FileHotUpdater.kt b/app/src/main/java/io/github/chinosk/gakumas/localify/hookUtils/FileHotUpdater.kt index fa4d61f..b96dc99 100644 --- a/app/src/main/java/io/github/chinosk/gakumas/localify/hookUtils/FileHotUpdater.kt +++ b/app/src/main/java/io/github/chinosk/gakumas/localify/hookUtils/FileHotUpdater.kt @@ -2,19 +2,15 @@ package io.github.chinosk.gakumas.localify.hookUtils import android.app.Activity import android.net.Uri -import android.os.Build import android.util.Log import io.github.chinosk.gakumas.localify.GakumasHookMain import io.github.chinosk.gakumas.localify.TAG import java.io.BufferedReader -import java.io.ByteArrayInputStream -import java.io.ByteArrayOutputStream import java.io.File import java.io.FileInputStream import java.io.FileOutputStream import java.io.InputStream import java.io.InputStreamReader -import java.util.zip.ZipEntry import java.util.zip.ZipInputStream object FileHotUpdater { diff --git a/app/src/main/java/io/github/chinosk/gakumas/localify/models/ProgramConfig.kt b/app/src/main/java/io/github/chinosk/gakumas/localify/models/ProgramConfig.kt new file mode 100644 index 0000000..50a2ff7 --- /dev/null +++ b/app/src/main/java/io/github/chinosk/gakumas/localify/models/ProgramConfig.kt @@ -0,0 +1,12 @@ +package io.github.chinosk.gakumas.localify.models + + +data class ProgramConfig ( + var checkBuiltInAssets: Boolean = true, + var transRemoteZipUrl: String = "", + var useRemoteAssets: Boolean = true, + var delRemoteAfterUpdate: Boolean = true, + var cleanLocalAssets: Boolean = false, + + var p: Boolean = false +) diff --git a/app/src/main/java/io/github/chinosk/gakumas/localify/ui/pages/subPages/HomePage.kt b/app/src/main/java/io/github/chinosk/gakumas/localify/ui/pages/subPages/HomePage.kt index e8701d9..8d5d9c5 100644 --- a/app/src/main/java/io/github/chinosk/gakumas/localify/ui/pages/subPages/HomePage.kt +++ b/app/src/main/java/io/github/chinosk/gakumas/localify/ui/pages/subPages/HomePage.kt @@ -2,13 +2,11 @@ package io.github.chinosk.gakumas.localify.ui.pages.subPages import GakuGroupBox import android.content.res.Configuration.UI_MODE_NIGHT_NO -import android.util.Log import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding @@ -20,11 +18,7 @@ import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableFloatStateOf -import androidx.compose.runtime.mutableIntStateOf -import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -38,7 +32,6 @@ import androidx.compose.ui.unit.sp import androidx.lifecycle.viewmodel.compose.viewModel import io.github.chinosk.gakumas.localify.MainActivity import io.github.chinosk.gakumas.localify.R -import io.github.chinosk.gakumas.localify.TAG import io.github.chinosk.gakumas.localify.getConfigState import io.github.chinosk.gakumas.localify.getProgramConfigState import io.github.chinosk.gakumas.localify.getProgramDownloadAbleState @@ -197,6 +190,7 @@ fun HomePage(modifier: Modifier = Modifier, onDownload = { progress, _, _ -> context?.mainPageAssetsViewDataUpdate(downloadProgressState = progress) }, + onSuccess = { byteArray -> context?.mainPageAssetsViewDataUpdate( downloadAbleState = true, @@ -219,8 +213,8 @@ fun HomePage(modifier: Modifier = Modifier, errorString = context.getString(R.string.invalid_zip_file_warn) ) } - }, + onFailed = { code, reason -> context?.mainPageAssetsViewDataUpdate( downloadAbleState = true,