mirror of
https://github.com/bitfireAT/davx5-ose
synced 2024-09-06 18:01:11 +00:00
Provide snackbar to LoginTypesProvider (backport of bitfireAT/davx5#576)
This commit is contained in:
parent
fda96ac653
commit
0c748ebe73
|
@ -101,7 +101,7 @@ fun LoginScreenContent(
|
||||||
|
|
||||||
when (page) {
|
when (page) {
|
||||||
LoginScreenModel.Page.LoginType ->
|
LoginScreenModel.Page.LoginType ->
|
||||||
LoginTypePage()
|
LoginTypePage(snackbarHostState = snackbarHostState)
|
||||||
|
|
||||||
LoginScreenModel.Page.LoginDetails ->
|
LoginScreenModel.Page.LoginDetails ->
|
||||||
LoginDetailsPage(snackbarHostState = snackbarHostState)
|
LoginDetailsPage(snackbarHostState = snackbarHostState)
|
||||||
|
|
|
@ -4,17 +4,20 @@
|
||||||
|
|
||||||
package at.bitfire.davdroid.ui.setup
|
package at.bitfire.davdroid.ui.setup
|
||||||
|
|
||||||
|
import androidx.compose.material3.SnackbarHostState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LoginTypePage(
|
fun LoginTypePage(
|
||||||
|
snackbarHostState: SnackbarHostState,
|
||||||
model: LoginScreenModel = viewModel()
|
model: LoginScreenModel = viewModel()
|
||||||
) {
|
) {
|
||||||
val uiState = model.loginTypeUiState
|
val uiState = model.loginTypeUiState
|
||||||
|
|
||||||
// show login type selection page
|
// show login type selection page
|
||||||
model.loginTypesProvider.LoginTypePage(
|
model.loginTypesProvider.LoginTypePage(
|
||||||
|
snackbarHostState = snackbarHostState,
|
||||||
selectedLoginType = uiState.loginType,
|
selectedLoginType = uiState.loginType,
|
||||||
onSelectLoginType = { loginType ->
|
onSelectLoginType = { loginType ->
|
||||||
model.selectLoginType(loginType)
|
model.selectLoginType(loginType)
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
package at.bitfire.davdroid.ui.setup
|
package at.bitfire.davdroid.ui.setup
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import androidx.compose.material3.SnackbarHostState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
|
||||||
interface LoginTypesProvider {
|
interface LoginTypesProvider {
|
||||||
|
@ -19,6 +20,7 @@ interface LoginTypesProvider {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LoginTypePage(
|
fun LoginTypePage(
|
||||||
|
snackbarHostState: SnackbarHostState,
|
||||||
selectedLoginType: LoginType,
|
selectedLoginType: LoginType,
|
||||||
onSelectLoginType: (LoginType) -> Unit,
|
onSelectLoginType: (LoginType) -> Unit,
|
||||||
setInitialLoginInfo: (LoginInfo) -> Unit,
|
setInitialLoginInfo: (LoginInfo) -> Unit,
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
package at.bitfire.davdroid.ui.setup
|
package at.bitfire.davdroid.ui.setup
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import androidx.compose.material3.SnackbarHostState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ class StandardLoginTypesProvider @Inject constructor() : LoginTypesProvider {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun LoginTypePage(
|
override fun LoginTypePage(
|
||||||
|
snackbarHostState: SnackbarHostState,
|
||||||
selectedLoginType: LoginType,
|
selectedLoginType: LoginType,
|
||||||
onSelectLoginType: (LoginType) -> Unit,
|
onSelectLoginType: (LoginType) -> Unit,
|
||||||
setInitialLoginInfo: (LoginInfo) -> Unit,
|
setInitialLoginInfo: (LoginInfo) -> Unit,
|
||||||
|
|
Loading…
Reference in a new issue