Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
MFlisarWork committed Nov 12, 2024
1 parent e387091 commit c7556ee
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ fun main() {
}

// automatic changelog dialog

ShowChangelogDialogIfNecessary(changelogStateSaver, versionName, setup)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ actual fun stringOk() = stringResource(android.R.string.ok)

@Composable
internal actual fun ShowChangelogDialog(
visible: MutableState<Boolean>,
data: ChangelogData,
setup: ChangelogSetup,
onDismiss: () -> Unit
) {
AlertDialog(
onDismissRequest = {
onDismiss()
visible.value = false
},
title = {
Text(text = setup.texts.dialogTitle)
Expand All @@ -39,7 +37,6 @@ internal actual fun ShowChangelogDialog(
TextButton(
onClick = {
onDismiss()
visible.value = false
}) {
Text(setup.texts.dialogButtonDismiss)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.michaelflisar.composechangelog
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import com.michaelflisar.composechangelog.classes.ChangelogData
import com.michaelflisar.composechangelog.classes.DataItemRelease

Expand All @@ -12,7 +11,6 @@ expect fun stringOk() : String

@Composable
internal expect fun ShowChangelogDialog(
visible: MutableState<Boolean>,
data: ChangelogData,
setup: ChangelogSetup,
onDismiss: () -> Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,13 @@ fun ShowChangelogDialog(

val data = changelog.value
if (data != null && !data.isEmpty()) {
val openDialog = remember { mutableStateOf(true) }
if (openDialog.value) {
ShowChangelogDialog(
visible = openDialog,
data = data,
setup = setup,
onDismiss = {
onDismiss()
openDialog.value = false
}
)
}
ShowChangelogDialog(
data = data,
setup = setup,
onDismiss = {
onDismiss()
}
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.fromHtml
import androidx.compose.ui.unit.dp
import com.michaelflisar.composechangelog.classes.DataItem

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ import com.michaelflisar.composechangelog.classes.ChangelogData
import com.michaelflisar.composechangelog.classes.DataItemRelease
import com.michaelflisar.composechangelog.composables.Changelog
import com.michaelflisar.composechangelog.internal.ChangelogParserUtil
import java.io.File

@Composable
actual fun stringOk() = "OK"

@Composable
internal actual fun ShowChangelogDialog(
visible: MutableState<Boolean>,
data: ChangelogData,
setup: ChangelogSetup,
onDismiss: () -> Unit
) {
DialogWindow(
visible = visible.value,
visible = true,
title = setup.texts.dialogTitle,
onCloseRequest = { visible.value = false },
onCloseRequest = {
onDismiss()
},
state = rememberDialogState(
position = WindowPosition(Alignment.Center),
width = 600.dp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ internal object ChangelogParserUtil {
for (i in 0..<node.childNodes.length) {
val n = node.childNodes.item(i)
if (n.nodeType == Node.ELEMENT_NODE) {
val tag = node.tagName
val element2 = n as Element
val tag = element2.tagName
items.add(readReleaseRowNode(tag, n, idProvider))
}
}
Expand Down

0 comments on commit c7556ee

Please sign in to comment.