fixed app redownloading on configuration change

This commit is contained in:
X1nto 2021-11-09 11:46:09 +04:00
parent a162a71629
commit afd5bfef36
2 changed files with 23 additions and 7 deletions

View File

@ -23,7 +23,6 @@ import com.vanced.manager.domain.model.InstallationOption
import com.vanced.manager.ui.component.card.ManagerTonalCard
import com.vanced.manager.ui.component.layout.ManagerLazyColumn
import com.vanced.manager.ui.component.layout.ManagerScaffold
import com.vanced.manager.ui.component.progressindicator.ManagerProgressIndicator
import com.vanced.manager.ui.component.text.ManagerText
import com.vanced.manager.ui.component.topappbar.ManagerTopAppBar
import com.vanced.manager.ui.resources.managerString

View File

@ -7,10 +7,10 @@ import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.ArrowDropDown
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material.icons.rounded.Done
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.rotate
@ -43,7 +43,16 @@ fun InstallScreen(
) {
val viewModel: InstallViewModel = getViewModel()
viewModel.startAppProcess(appName, appVersions)
var startedProcess by rememberSaveable { mutableStateOf(false) }
// I don't know why, I don't know how,
// but it works as intended
LaunchedEffect(startedProcess) {
if (!startedProcess) {
startedProcess = true
viewModel.startAppProcess(appName, appVersions)
}
}
ManagerScaffold(
topBar = {
@ -63,12 +72,20 @@ fun InstallScreen(
}
},
floatingActionButton = {
if (viewModel.status is InstallViewModel.Status.Installed) {
ExtendedFloatingActionButton(
text = { /*TODO*/ },
icon = {
Icon(Icons.Rounded.Done, null)
},
onClick = { /*TODO*/ },
)
}
}
) { paddingValues ->
ManagerLazyColumn(
modifier = Modifier
.fillMaxWidth()
.fillMaxSize()
.padding(paddingValues),
) {
items(viewModel.logs) { log ->