Pin setup with fake lock
This commit is contained in:
parent
e1a5c4dc86
commit
a2ebf39cb5
12 changed files with 211 additions and 40 deletions
|
|
@ -16,6 +16,12 @@
|
||||||
|
|
||||||
package io.element.android.appnav
|
package io.element.android.appnav
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.ContextWrapper
|
||||||
|
import androidx.activity.ComponentActivity
|
||||||
|
import androidx.activity.compose.BackHandler
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import com.bumble.appyx.navmodel.backstack.BackStack
|
import com.bumble.appyx.navmodel.backstack.BackStack
|
||||||
import com.bumble.appyx.navmodel.backstack.operation.NewRoot
|
import com.bumble.appyx.navmodel.backstack.operation.NewRoot
|
||||||
import com.bumble.appyx.navmodel.backstack.operation.Remove
|
import com.bumble.appyx.navmodel.backstack.operation.Remove
|
||||||
|
|
@ -41,3 +47,18 @@ fun <T : Any> BackStack<T>.removeLast(element: T) {
|
||||||
accept(Remove(lastExpectedNavElement.key))
|
accept(Remove(lastExpectedNavElement.key))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun FinishActivityBackHandler(enabled: Boolean = true) {
|
||||||
|
|
||||||
|
fun Context.findActivity(): ComponentActivity? = when (this) {
|
||||||
|
is ComponentActivity -> this
|
||||||
|
is ContextWrapper -> baseContext.findActivity()
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
|
||||||
|
val context = LocalContext.current
|
||||||
|
BackHandler(enabled = enabled) {
|
||||||
|
context.findActivity()?.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,9 @@ import io.element.android.features.ftue.api.state.FtueState
|
||||||
import io.element.android.features.invitelist.api.InviteListEntryPoint
|
import io.element.android.features.invitelist.api.InviteListEntryPoint
|
||||||
import io.element.android.features.networkmonitor.api.NetworkMonitor
|
import io.element.android.features.networkmonitor.api.NetworkMonitor
|
||||||
import io.element.android.features.networkmonitor.api.NetworkStatus
|
import io.element.android.features.networkmonitor.api.NetworkStatus
|
||||||
|
import io.element.android.features.pin.api.PinEntryPoint
|
||||||
|
import io.element.android.features.pin.api.PinState
|
||||||
|
import io.element.android.features.pin.api.PinStateDataSource
|
||||||
import io.element.android.features.preferences.api.PreferencesEntryPoint
|
import io.element.android.features.preferences.api.PreferencesEntryPoint
|
||||||
import io.element.android.features.roomlist.api.RoomListEntryPoint
|
import io.element.android.features.roomlist.api.RoomListEntryPoint
|
||||||
import io.element.android.features.verifysession.api.VerifySessionEntryPoint
|
import io.element.android.features.verifysession.api.VerifySessionEntryPoint
|
||||||
|
|
@ -90,6 +93,8 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
private val networkMonitor: NetworkMonitor,
|
private val networkMonitor: NetworkMonitor,
|
||||||
private val notificationDrawerManager: NotificationDrawerManager,
|
private val notificationDrawerManager: NotificationDrawerManager,
|
||||||
private val ftueState: FtueState,
|
private val ftueState: FtueState,
|
||||||
|
private val pinEntryPoint: PinEntryPoint,
|
||||||
|
private val pinStateDataSource: PinStateDataSource,
|
||||||
private val matrixClient: MatrixClient,
|
private val matrixClient: MatrixClient,
|
||||||
snackbarDispatcher: SnackbarDispatcher,
|
snackbarDispatcher: SnackbarDispatcher,
|
||||||
) : BackstackNode<LoggedInFlowNode.NavTarget>(
|
) : BackstackNode<LoggedInFlowNode.NavTarget>(
|
||||||
|
|
@ -98,7 +103,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
savedStateMap = buildContext.savedStateMap,
|
savedStateMap = buildContext.savedStateMap,
|
||||||
),
|
),
|
||||||
permanentNavModel = PermanentNavModel(
|
permanentNavModel = PermanentNavModel(
|
||||||
NavTarget.Permanent,
|
navTargets = setOf(NavTarget.LoggedInPermanent, NavTarget.LockPermanent),
|
||||||
savedStateMap = buildContext.savedStateMap,
|
savedStateMap = buildContext.savedStateMap,
|
||||||
),
|
),
|
||||||
buildContext = buildContext,
|
buildContext = buildContext,
|
||||||
|
|
@ -130,6 +135,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onStop = {
|
onStop = {
|
||||||
|
pinStateDataSource.lock()
|
||||||
//Counterpart startSync is done in observeSyncStateAndNetworkStatus method.
|
//Counterpart startSync is done in observeSyncStateAndNetworkStatus method.
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
syncService.stopSync()
|
syncService.stopSync()
|
||||||
|
|
@ -167,7 +173,10 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
|
|
||||||
sealed interface NavTarget : Parcelable {
|
sealed interface NavTarget : Parcelable {
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data object Permanent : NavTarget
|
data object LoggedInPermanent : NavTarget
|
||||||
|
|
||||||
|
@Parcelize
|
||||||
|
data object LockPermanent : NavTarget
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data object RoomList : NavTarget
|
data object RoomList : NavTarget
|
||||||
|
|
@ -196,9 +205,12 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
|
|
||||||
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {
|
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {
|
||||||
return when (navTarget) {
|
return when (navTarget) {
|
||||||
NavTarget.Permanent -> {
|
NavTarget.LoggedInPermanent -> {
|
||||||
createNode<LoggedInNode>(buildContext)
|
createNode<LoggedInNode>(buildContext)
|
||||||
}
|
}
|
||||||
|
NavTarget.LockPermanent -> {
|
||||||
|
pinEntryPoint.nodeBuilder(this, buildContext).build()
|
||||||
|
}
|
||||||
NavTarget.RoomList -> {
|
NavTarget.RoomList -> {
|
||||||
val callback = object : RoomListEntryPoint.Callback {
|
val callback = object : RoomListEntryPoint.Callback {
|
||||||
override fun onRoomClicked(roomId: RoomId) {
|
override fun onRoomClicked(roomId: RoomId) {
|
||||||
|
|
@ -324,17 +336,24 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
@Composable
|
@Composable
|
||||||
override fun View(modifier: Modifier) {
|
override fun View(modifier: Modifier) {
|
||||||
Box(modifier = modifier) {
|
Box(modifier = modifier) {
|
||||||
Children(
|
val pinState by pinStateDataSource.pinState.collectAsState()
|
||||||
navModel = backstack,
|
when (pinState) {
|
||||||
modifier = Modifier,
|
PinState.Unlocked -> {
|
||||||
// Animate navigation to settings and to a room
|
Children(
|
||||||
transitionHandler = rememberDefaultTransitionHandler(),
|
navModel = backstack,
|
||||||
)
|
modifier = Modifier,
|
||||||
|
// Animate navigation to settings and to a room
|
||||||
val isFtueDisplayed by ftueState.shouldDisplayFlow.collectAsState()
|
transitionHandler = rememberDefaultTransitionHandler(),
|
||||||
|
)
|
||||||
if (!isFtueDisplayed) {
|
val isFtueDisplayed by ftueState.shouldDisplayFlow.collectAsState()
|
||||||
PermanentChild(permanentNavModel = permanentNavModel, navTarget = NavTarget.Permanent)
|
if (!isFtueDisplayed) {
|
||||||
|
PermanentChild(permanentNavModel = permanentNavModel, navTarget = NavTarget.LoggedInPermanent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PinState.Locked -> {
|
||||||
|
FinishActivityBackHandler()
|
||||||
|
PermanentChild(permanentNavModel = permanentNavModel, navTarget = NavTarget.LockPermanent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ import io.element.android.appnav.root.RootPresenter
|
||||||
import io.element.android.appnav.root.RootView
|
import io.element.android.appnav.root.RootView
|
||||||
import io.element.android.features.login.api.oidc.OidcAction
|
import io.element.android.features.login.api.oidc.OidcAction
|
||||||
import io.element.android.features.login.api.oidc.OidcActionFlow
|
import io.element.android.features.login.api.oidc.OidcActionFlow
|
||||||
|
import io.element.android.features.pin.api.PinEntryPoint
|
||||||
import io.element.android.features.rageshake.api.bugreport.BugReportEntryPoint
|
import io.element.android.features.rageshake.api.bugreport.BugReportEntryPoint
|
||||||
import io.element.android.libraries.architecture.BackstackNode
|
import io.element.android.libraries.architecture.BackstackNode
|
||||||
import io.element.android.libraries.architecture.animation.rememberDefaultTransitionHandler
|
import io.element.android.libraries.architecture.animation.rememberDefaultTransitionHandler
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,10 @@ class LoggedInNode @AssistedInject constructor(
|
||||||
@Assisted buildContext: BuildContext,
|
@Assisted buildContext: BuildContext,
|
||||||
@Assisted plugins: List<Plugin>,
|
@Assisted plugins: List<Plugin>,
|
||||||
private val loggedInPresenter: LoggedInPresenter,
|
private val loggedInPresenter: LoggedInPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(
|
||||||
|
buildContext = buildContext,
|
||||||
|
plugins = plugins
|
||||||
|
) {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun View(modifier: Modifier) {
|
override fun View(modifier: Modifier) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.element.android.features.pin.api
|
||||||
|
|
||||||
|
sealed interface PinState {
|
||||||
|
data object Unlocked : PinState
|
||||||
|
data object Locked : PinState
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.element.android.features.pin.api
|
||||||
|
|
||||||
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
|
||||||
|
interface PinStateDataSource {
|
||||||
|
val pinState: StateFlow<PinState>
|
||||||
|
|
||||||
|
fun lock()
|
||||||
|
fun unlock()
|
||||||
|
}
|
||||||
|
|
@ -17,5 +17,5 @@
|
||||||
package io.element.android.features.pin.impl.auth
|
package io.element.android.features.pin.impl.auth
|
||||||
|
|
||||||
sealed interface PinAuthenticationEvents {
|
sealed interface PinAuthenticationEvents {
|
||||||
object MyEvent : PinAuthenticationEvents
|
data object Unlock : PinAuthenticationEvents
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,20 +17,21 @@
|
||||||
package io.element.android.features.pin.impl.auth
|
package io.element.android.features.pin.impl.auth
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import io.element.android.features.pin.api.PinStateDataSource
|
||||||
import io.element.android.libraries.architecture.Presenter
|
import io.element.android.libraries.architecture.Presenter
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class PinAuthenticationPresenter @Inject constructor() : Presenter<PinAuthenticationState> {
|
class PinAuthenticationPresenter @Inject constructor(
|
||||||
|
private val pinStateDataSource: PinStateDataSource,
|
||||||
|
) : Presenter<PinAuthenticationState> {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun present(): PinAuthenticationState {
|
override fun present(): PinAuthenticationState {
|
||||||
|
|
||||||
fun handleEvents(event: PinAuthenticationEvents) {
|
fun handleEvents(event: PinAuthenticationEvents) {
|
||||||
when (event) {
|
when (event) {
|
||||||
PinAuthenticationEvents.MyEvent -> Unit
|
PinAuthenticationEvents.Unlock -> pinStateDataSource.unlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PinAuthenticationState(
|
return PinAuthenticationState(
|
||||||
eventSink = ::handleEvents
|
eventSink = ::handleEvents
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ open class PinAuthenticationStateProvider : PreviewParameterProvider<PinAuthenti
|
||||||
override val values: Sequence<PinAuthenticationState>
|
override val values: Sequence<PinAuthenticationState>
|
||||||
get() = sequenceOf(
|
get() = sequenceOf(
|
||||||
aPinAuthenticationState(),
|
aPinAuthenticationState(),
|
||||||
// Add other states here
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,29 +16,64 @@
|
||||||
|
|
||||||
package io.element.android.features.pin.impl.auth
|
package io.element.android.features.pin.impl.auth
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.systemBarsPadding
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Lock
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
|
import io.element.android.libraries.designsystem.atomic.molecules.IconTitleSubtitleMolecule
|
||||||
|
import io.element.android.libraries.designsystem.atomic.pages.HeaderFooterPage
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||||
import io.element.android.libraries.designsystem.theme.components.Text
|
import io.element.android.libraries.designsystem.theme.components.Button
|
||||||
|
import io.element.android.libraries.designsystem.theme.components.Surface
|
||||||
|
import io.element.android.libraries.designsystem.utils.OnLifecycleEvent
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun PinAuthenticationView(
|
fun PinAuthenticationView(
|
||||||
state: PinAuthenticationState,
|
state: PinAuthenticationState,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Box(modifier, contentAlignment = Alignment.Center) {
|
Surface(modifier) {
|
||||||
Text(
|
HeaderFooterPage(
|
||||||
"PinAuthentication feature view",
|
modifier = Modifier
|
||||||
color = MaterialTheme.colorScheme.primary,
|
.systemBarsPadding()
|
||||||
|
.fillMaxSize(),
|
||||||
|
header = { PinAuthenticationHeader(modifier = Modifier.padding(top = 60.dp, bottom = 12.dp)) },
|
||||||
|
footer = { PinAuthenticationFooter(state) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun PinAuthenticationHeader(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
) {
|
||||||
|
IconTitleSubtitleMolecule(
|
||||||
|
modifier = modifier,
|
||||||
|
title = "Element X is locked",
|
||||||
|
subTitle = null,
|
||||||
|
iconImageVector = Icons.Default.Lock,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun PinAuthenticationFooter(state: PinAuthenticationState) {
|
||||||
|
Button(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
text = "Unlock",
|
||||||
|
onClick = {
|
||||||
|
state.eventSink(PinAuthenticationEvents.Unlock)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@PreviewsDayNight
|
@PreviewsDayNight
|
||||||
fun PinAuthenticationViewLightPreview(@PreviewParameter(PinAuthenticationStateProvider::class) state: PinAuthenticationState) =
|
fun PinAuthenticationViewLightPreview(@PreviewParameter(PinAuthenticationStateProvider::class) state: PinAuthenticationState) =
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.element.android.features.pin.impl.state
|
||||||
|
|
||||||
|
import com.squareup.anvil.annotations.ContributesBinding
|
||||||
|
import io.element.android.features.pin.api.PinState
|
||||||
|
import io.element.android.features.pin.api.PinStateDataSource
|
||||||
|
import io.element.android.libraries.di.AppScope
|
||||||
|
import io.element.android.libraries.di.SingleIn
|
||||||
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@SingleIn(AppScope::class)
|
||||||
|
@ContributesBinding(AppScope::class)
|
||||||
|
class DefaultPinStateDataSource @Inject constructor() : PinStateDataSource {
|
||||||
|
|
||||||
|
private val _pinState = MutableStateFlow<PinState>(PinState.Locked)
|
||||||
|
override val pinState: StateFlow<PinState> = _pinState
|
||||||
|
|
||||||
|
override fun unlock() {
|
||||||
|
_pinState.value = PinState.Unlocked
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun lock() {
|
||||||
|
_pinState.value = PinState.Locked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -31,8 +31,8 @@ import androidx.compose.ui.unit.dp
|
||||||
import io.element.android.libraries.designsystem.R
|
import io.element.android.libraries.designsystem.R
|
||||||
import io.element.android.libraries.designsystem.atomic.atoms.RoundedIconAtom
|
import io.element.android.libraries.designsystem.atomic.atoms.RoundedIconAtom
|
||||||
import io.element.android.libraries.designsystem.atomic.atoms.RoundedIconAtomSize
|
import io.element.android.libraries.designsystem.atomic.atoms.RoundedIconAtomSize
|
||||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||||
|
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||||
import io.element.android.libraries.designsystem.theme.components.Text
|
import io.element.android.libraries.designsystem.theme.components.Text
|
||||||
import io.element.android.libraries.theme.ElementTheme
|
import io.element.android.libraries.theme.ElementTheme
|
||||||
|
|
||||||
|
|
@ -49,7 +49,7 @@ import io.element.android.libraries.theme.ElementTheme
|
||||||
@Composable
|
@Composable
|
||||||
fun IconTitleSubtitleMolecule(
|
fun IconTitleSubtitleMolecule(
|
||||||
title: String,
|
title: String,
|
||||||
subTitle: String,
|
subTitle: String?,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
iconResourceId: Int? = null,
|
iconResourceId: Int? = null,
|
||||||
iconImageVector: ImageVector? = null,
|
iconImageVector: ImageVector? = null,
|
||||||
|
|
@ -73,14 +73,16 @@ fun IconTitleSubtitleMolecule(
|
||||||
style = ElementTheme.typography.fontHeadingMdBold,
|
style = ElementTheme.typography.fontHeadingMdBold,
|
||||||
color = MaterialTheme.colorScheme.primary,
|
color = MaterialTheme.colorScheme.primary,
|
||||||
)
|
)
|
||||||
Spacer(Modifier.height(8.dp))
|
if (subTitle != null) {
|
||||||
Text(
|
Spacer(Modifier.height(8.dp))
|
||||||
text = subTitle,
|
Text(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
text = subTitle,
|
||||||
textAlign = TextAlign.Center,
|
modifier = Modifier.fillMaxWidth(),
|
||||||
style = ElementTheme.typography.fontBodyMdRegular,
|
textAlign = TextAlign.Center,
|
||||||
color = MaterialTheme.colorScheme.secondary,
|
style = ElementTheme.typography.fontBodyMdRegular,
|
||||||
)
|
color = MaterialTheme.colorScheme.secondary,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,6 +92,6 @@ internal fun IconTitleSubtitleMoleculePreview() = ElementPreview {
|
||||||
IconTitleSubtitleMolecule(
|
IconTitleSubtitleMolecule(
|
||||||
iconResourceId = R.drawable.ic_compound_chat,
|
iconResourceId = R.drawable.ic_compound_chat,
|
||||||
title = "Title",
|
title = "Title",
|
||||||
subTitle = "Sub iitle",
|
subTitle = "Subtitle",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue