[optimize] merge network write

This commit is contained in:
acite
2025-09-14 01:02:39 +08:00
parent ffa70d9d34
commit c330a1e70c
5 changed files with 54 additions and 13 deletions

View File

@@ -1,5 +1,6 @@
package com.acitelight.aether.view
import android.util.Log
import android.widget.Toast
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
@@ -36,8 +37,13 @@ import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.viewModelScope
import androidx.lifecycle.viewmodel.compose.viewModel
import com.acitelight.aether.service.ApiClient.api
import com.acitelight.aether.viewModel.MeScreenViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@Composable
fun MeScreen(meScreenViewModel: MeScreenViewModel = hiltViewModel()) {
@@ -189,13 +195,28 @@ fun MeScreen(meScreenViewModel: MeScreenViewModel = hiltViewModel()) {
Spacer(modifier = Modifier.height(24.dp))
// Save Button
Button(
onClick = {
meScreenViewModel.updateServer(url, cert, context)
},
modifier = Modifier.fillMaxWidth()
) {
Text("Save")
Row{
Button(
onClick = {
meScreenViewModel.updateServer(url, cert, context)
},
modifier = Modifier.fillMaxWidth(0.5f)
) {
Text("Save")
}
Button(
onClick = {
meScreenViewModel.viewModelScope.launch {
Log.i("Delay Analyze", "Start Abyss Hello")
val h = api!!.hello()
Log.i("Delay Analyze", "Abyss Hello: ${h.string()}")
}
},
modifier = Modifier.fillMaxWidth(0.5f)
) {
Text("Ping")
}
}
}
}