Move AppErrorView to the api module so that :appnav:root does not have to depend on a impl module.
This commit is contained in:
parent
2a5e9956e4
commit
ef97d135cc
5 changed files with 5 additions and 8 deletions
|
|
@ -10,7 +10,7 @@ import extension.testCommonDependencies
|
|||
*/
|
||||
|
||||
plugins {
|
||||
id("io.element.android-compose-library")
|
||||
id("io.element.android-library")
|
||||
}
|
||||
|
||||
setupDependencyInjection()
|
||||
|
|
@ -22,8 +22,6 @@ android {
|
|||
dependencies {
|
||||
implementation(projects.libraries.core)
|
||||
implementation(projects.libraries.di)
|
||||
implementation(projects.libraries.designsystem)
|
||||
implementation(projects.libraries.uiStrings)
|
||||
implementation(projects.services.toolbox.api)
|
||||
|
||||
implementation(libs.coroutines.core)
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2025 Element Creations Ltd.
|
||||
* Copyright 2023-2025 New Vector Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
* Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
package io.element.android.services.apperror.impl
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import io.element.android.libraries.designsystem.components.dialogs.ErrorDialog
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||
import io.element.android.services.apperror.api.AppErrorState
|
||||
import io.element.android.services.apperror.api.aAppErrorState
|
||||
|
||||
@Composable
|
||||
fun AppErrorView(
|
||||
state: AppErrorState,
|
||||
) {
|
||||
if (state is AppErrorState.Error) {
|
||||
AppErrorViewContent(
|
||||
title = state.title,
|
||||
body = state.body,
|
||||
onDismiss = state.dismiss,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AppErrorViewContent(
|
||||
title: String,
|
||||
body: String,
|
||||
onDismiss: () -> Unit = { },
|
||||
) {
|
||||
ErrorDialog(
|
||||
title = title,
|
||||
content = body,
|
||||
onSubmit = onDismiss,
|
||||
)
|
||||
}
|
||||
|
||||
@PreviewsDayNight
|
||||
@Composable
|
||||
internal fun AppErrorViewPreview() = ElementPreview {
|
||||
AppErrorView(
|
||||
state = aAppErrorState()
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue