Skip to content

Commit

Permalink
detekt
Browse files Browse the repository at this point in the history
  • Loading branch information
pauljohanneskraft committed Nov 22, 2024
1 parent 1e2b0a9 commit d61539f
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package edu.stanford.spezi.core.design.component.markdown

data class MarkdownUiState(
val elements: List<MarkdownElement>? = null
)
val elements: List<MarkdownElement>? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ data class ConsentDocument(
internal fun Composable(
modifier: Modifier = Modifier,
uiState: ConsentUiState,
onAction: (ConsentAction) -> Unit
onAction: (ConsentAction) -> Unit,
) {
val givenName = uiState.name.givenName ?: ""
val familyName = uiState.name.familyName ?: ""
Expand Down Expand Up @@ -86,7 +86,6 @@ data class ConsentDocument(
}
)


if (givenName.isNotBlank() && familyName.isNotBlank()) {
Spacer(modifier = Modifier.height(Spacings.medium))
Text("Signature:")
Expand Down Expand Up @@ -128,7 +127,7 @@ private fun ConsentDocumentComposablePreview(
ConsentDocument(
markdown = { "".toByteArray(StandardCharsets.UTF_8) },
viewState = remember { mutableStateOf(ConsentViewState.Base(ViewState.Idle)) },
).Composable(
).Composable(
uiState = ConsentUiState(
name = data.name,
paths = data.paths
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.graphics.pdf.PdfDocument

class ConsentDocumentExport(
private val documentIdentifier: String = Defaults.DOCUMENT_IDENTIFIER,
private val document: suspend () -> PdfDocument
private val document: suspend () -> PdfDocument,
) {
private object Defaults {
const val DOCUMENT_IDENTIFIER = "ConsentDocument"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ sealed interface ConsentAction {
data object Undo : ConsentAction
data class Consent(
val documentIdentifier: String,
val exportConfiguration: ConsentDocumentExportConfiguration
val exportConfiguration: ConsentDocumentExportConfiguration,
) : ConsentAction
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ internal fun OnboardingConsentComposableContent(
identifier: String,
exportConfiguration: ConsentDocumentExportConfiguration,
uiState: ConsentUiState,
onAction: (ConsentAction) -> Unit
onAction: (ConsentAction) -> Unit,
) {
val actionScope = rememberCoroutineScope()
OnboardingComposable(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fun OnboardingActions(
primaryText: StringResource,
primaryAction: suspend () -> Unit,
secondaryText: StringResource? = null,
secondaryAction: (suspend () -> Unit)? = null
secondaryAction: (suspend () -> Unit)? = null,
) {
val primaryActionState = remember { mutableStateOf<ViewState>(ViewState.Idle) }
val secondaryActionState = remember { mutableStateOf<ViewState>(ViewState.Idle) }
Expand All @@ -45,4 +45,4 @@ fun OnboardingActions(
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.unit.dp


@Composable
fun OnboardingComposable(
modifier: Modifier = Modifier,
Expand All @@ -40,4 +39,4 @@ fun OnboardingComposable(
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import androidx.compose.runtime.Composable

data class OnboardingStep(
val identifier: String,
val composable: @Composable () -> Unit
val composable: @Composable () -> Unit,
)

data class OnboardingComposableBuilder(
var list: MutableList<OnboardingStep>
var list: MutableList<OnboardingStep>,
) {
fun step(id: String, composable: @Composable () -> Unit) {
list.add(OnboardingStep(id, composable))
}
}

fun buildOnboardingSteps(
build: OnboardingComposableBuilder.() -> Unit
build: OnboardingComposableBuilder.() -> Unit,
): List<OnboardingStep> {
val builder = OnboardingComposableBuilder(mutableListOf())
build(builder)
Expand All @@ -38,4 +38,4 @@ fun test() {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ import edu.stanford.spezi.core.design.component.StringResource
@Composable
internal fun IllegalOnboardingStepComposable() {
Text(StringResource("Illegal onboarding step").text())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch

private enum class SuspendButtonState {
IDLE, DISABLED, DISABLED_AND_PROCESSING;
IDLE, DISABLED, DISABLED_AND_PROCESSING
}

@Composable
fun SuspendButton(
state: MutableState<ViewState>,
action: suspend () -> Unit,
label: @Composable () -> Unit
label: @Composable () -> Unit,
) {
val buttonState = remember { mutableStateOf(SuspendButtonState.IDLE) }
val coroutineScope = rememberCoroutineScope()
Expand Down Expand Up @@ -58,4 +58,4 @@ fun SuspendButton(
) {
label()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ sealed interface ViewState {

val errorDescription: String
@Composable @ReadOnlyComposable get() = if (this is Error) throwable?.localizedMessage ?: "" else ""
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ fun ViewStateAlert(state: MutableState<ViewState>) {
}
)
}
}
}

0 comments on commit d61539f

Please sign in to comment.