mirror of
https://github.com/InvertGeek/MixFile.git
synced 2026-06-03 01:53:24 +08:00
+自定导出列表名称
This commit is contained in:
@@ -14,8 +14,8 @@ android {
|
||||
applicationId = "com.donut.mixfile"
|
||||
minSdk = 24
|
||||
targetSdk = 34
|
||||
versionCode = 45
|
||||
versionName = "1.4.14"
|
||||
versionCode = 46
|
||||
versionName = "1.4.15"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.donut.mixfile.ui.routes.favorites
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
@@ -39,6 +41,7 @@ import com.donut.mixfile.util.file.favorites
|
||||
import com.donut.mixfile.util.file.selectAndUploadFile
|
||||
import com.donut.mixfile.util.file.updateMark
|
||||
import com.donut.mixfile.util.formatFileSize
|
||||
import com.donut.mixfile.util.getCurrentTime
|
||||
import com.donut.mixfile.util.truncate
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -157,12 +160,23 @@ val Favorites = MixNavPage(
|
||||
Button(
|
||||
onClick = {
|
||||
MixDialogBuilder("确定导出?").apply {
|
||||
var listName by mutableStateOf("文件列表-${getCurrentTime()}")
|
||||
setContent {
|
||||
Text(text = "将会导出当前筛选的文件列表上传为一键分享链接")
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalArrangement = Arrangement.spacedBy(5.dp)
|
||||
) {
|
||||
OutlinedTextField(value = listName, onValueChange = {
|
||||
listName = it
|
||||
}, modifier = Modifier.fillMaxWidth(), label = {
|
||||
Text(text = "列表名称")
|
||||
})
|
||||
Text(text = "将会导出当前筛选的文件列表上传为一键分享链接")
|
||||
}
|
||||
}
|
||||
setDefaultNegative()
|
||||
setPositiveButton("确定") {
|
||||
exportFileList(result)
|
||||
exportFileList(result, listName)
|
||||
closeDialog()
|
||||
}
|
||||
show()
|
||||
@@ -204,7 +218,7 @@ val Favorites = MixNavPage(
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = colorScheme.primary,
|
||||
)
|
||||
FileCardList(cardList = result){
|
||||
FileCardList(cardList = result) {
|
||||
deleteFavoriteLog(it)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,8 @@ fun showFileInfoDialog(shareInfo: MixShareInfo, onDismiss: () -> Unit = {}) {
|
||||
}, label = {
|
||||
Text(text = "复制分享码", color = colorScheme.primary)
|
||||
})
|
||||
if (shareInfo.fileName.startsWith("__mixfile_list")) {
|
||||
val fileName = shareInfo.fileName
|
||||
if (fileName.startsWith("__mixfile_list") || fileName.endsWith(".mix_list")) {
|
||||
AssistChip(onClick = {
|
||||
importFileList(shareInfo.downloadUrl)
|
||||
}, label = {
|
||||
|
||||
@@ -25,12 +25,12 @@ import io.ktor.utils.io.core.readBytes
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
fun exportFileList(fileList: List<FileDataLog>) {
|
||||
fun exportFileList(fileList: List<FileDataLog>,name: String) {
|
||||
val strData = fileList.toJsonString()
|
||||
val compressedData = compressGzip(strData)
|
||||
doUploadFile(
|
||||
compressedData,
|
||||
"__mixfile_list_${compressedData.hashSHA256().decodeHex().encodeToBase64().take(8)}",
|
||||
"${name}.mix_list",
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user