I am trying to convert a view based screen to Compose and while what I need should be very basic, somehow I can't get this to work. The use case at hand is a serial task where one step follows the other and the UI should reflect progress. But I seem to miss something fundamental because none of my Text() will update. Below is a simplified example of what I got:
override fun onCreate(savedInstanceState: Bundle?) {
…
setContent {
Import()
}
}
@Composable
fun Import() {
var step1 by remember { mutableStateOf("") }
var step2 by remember { mutableStateOf("") }
Column() {
Text(text = step1)
Text(text = step2)
}
}
step1 = "Open ZIP file"
val zipIn: ZipInputStream = openZIPFile()
step1 = "✓ $step1"
step2 = "Extract files"
val count = extractFiles()
step2 = "✓ $step2"
…
}
If I set the initial text in the remember line, like this
var step1 by remember { mutableStateOf("Open ZIP file") }
the text will show, but also never gets updated.
I also tried to move the logic part into a separate function which gets executed right after setContent() but then the step1/step2 aren't available for me to update.
#######
Edit:
Well, as expected this turned out to be really easy. I have to break this one
var step1 by remember { mutableStateOf("Open ZIP file") }
into 2 statements:
var step1String = mutableStateOf("Open ZIP file")
With step1String as a class wide variable so I can change it from other functions. In the Import() composable function al I need is this:
var step1 by remember { step1String }
Have to say Compose is growing on me… :-)
You would expose the port to your host which makes the db acessible by anything running on the host, docker or native. Something like
`port
But I would recommend running a dedicated db for each service. At least that's what I do.
Isn't the point about containers that you keep things which depend on each other together, eliminating dependencies? A single db would be a unecessary dependency in my view. What if one service requires a new version of MySQL, and another one does not yet support the new version?
I also run all my databases via a bind mount
`volume
and each service in it's own directory. E.g. /opt/docker/nextcloud
That way I have everything which makes up a service contained in one folder. Easy to backup/restore, easy to move, and not the least, clean.