mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Rewrite App Settings in compose.
This commit is contained in:
committed by
Greyson Parrelli
parent
7f3ceea9fe
commit
b979be0cb9
@@ -7,8 +7,10 @@ package org.thoughtcrime.securesms.banner
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.rememberUpdatedState
|
||||
import androidx.compose.ui.platform.ComposeView
|
||||
import androidx.compose.ui.platform.ViewCompositionStrategy
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -60,4 +62,19 @@ class BannerManager @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the current banner.
|
||||
*/
|
||||
@Composable
|
||||
fun Banner() {
|
||||
val banner by rememberUpdatedState(banners.firstOrNull { it.enabled } as Banner<Any>?)
|
||||
|
||||
banner?.let { nonNullBanner ->
|
||||
val state by nonNullBanner.dataFlow.collectAsStateWithLifecycle(initialValue = null)
|
||||
state?.let { model ->
|
||||
nonNullBanner.DisplayBanner(model, PaddingValues(horizontal = 12.dp, vertical = 8.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user