@@ -4,7 +4,6 @@ import android.annotation.SuppressLint
4
4
import android.content.Intent
5
5
import android.net.Uri
6
6
import androidx.compose.foundation.Image
7
- import androidx.compose.foundation.isSystemInDarkTheme
8
7
import androidx.compose.foundation.layout.*
9
8
import androidx.compose.foundation.text.ClickableText
10
9
import androidx.compose.material3.*
@@ -22,31 +21,16 @@ import androidx.compose.ui.text.style.TextDecoration
22
21
import androidx.compose.ui.unit.dp
23
22
import app.omnivore.omnivore.R
24
23
import app.omnivore.omnivore.feature.theme.OmnivoreTheme
25
- import com.google.accompanist.systemuicontroller.rememberSystemUiController
26
24
import com.google.android.gms.common.GoogleApiAvailability
27
25
import kotlinx.coroutines.launch
28
26
29
27
@Composable
30
28
fun WelcomeScreen (viewModel : LoginViewModel ) {
31
-
32
- val systemUiController = rememberSystemUiController()
33
- val useDarkIcons = ! isSystemInDarkTheme()
34
-
35
- DisposableEffect (systemUiController, useDarkIcons) {
36
- systemUiController.setSystemBarsColor(
37
- color = Color .Black ,
38
- darkIcons = true
39
- )
40
- onDispose {
41
- systemUiController.setSystemBarsColor(
42
- color = Color .Black ,
43
- darkIcons = useDarkIcons
44
- )
45
- }
46
- }
47
-
48
29
OmnivoreTheme (darkTheme = false ) {
49
- Surface (modifier = Modifier .fillMaxSize(), color = Color (0xFFFCEBA8 )) {
30
+ Surface (
31
+ modifier = Modifier .fillMaxSize(),
32
+ color = Color (0xFFFCEBA8 )
33
+ ) {
50
34
WelcomeScreenContent (viewModel = viewModel)
51
35
}
52
36
}
@@ -55,9 +39,9 @@ fun WelcomeScreen(viewModel: LoginViewModel) {
55
39
@SuppressLint(" CoroutineCreationDuringComposition" )
56
40
@Composable
57
41
fun WelcomeScreenContent (viewModel : LoginViewModel ) {
58
- val registrationState: RegistrationState by viewModel
59
- .registrationStateLiveData
60
- .observeAsState( RegistrationState . SocialLogin )
42
+ val registrationState: RegistrationState by viewModel.registrationStateLiveData.observeAsState(
43
+ RegistrationState . SocialLogin
44
+ )
61
45
62
46
val snackBarHostState = remember { SnackbarHostState () }
63
47
val coroutineScope = rememberCoroutineScope()
@@ -92,11 +76,13 @@ fun WelcomeScreenContent(viewModel: LoginViewModel) {
92
76
RegistrationState .SocialLogin -> {
93
77
Text (
94
78
text = stringResource(id = R .string.welcome_title),
79
+ color = MaterialTheme .colorScheme.onSurface,
95
80
style = MaterialTheme .typography.headlineLarge
96
81
)
97
82
98
83
Text (
99
84
text = stringResource(id = R .string.welcome_subtitle),
85
+ color = MaterialTheme .colorScheme.onSurface,
100
86
style = MaterialTheme .typography.titleSmall
101
87
)
102
88
@@ -117,8 +103,7 @@ fun WelcomeScreenContent(viewModel: LoginViewModel) {
117
103
118
104
if (viewModel.errorMessage != null ) {
119
105
coroutineScope.launch {
120
- val result = snackBarHostState
121
- .showSnackbar(
106
+ val result = snackBarHostState.showSnackbar(
122
107
viewModel.errorMessage!! ,
123
108
actionLabel = " Dismiss" ,
124
109
duration = SnackbarDuration .Indefinite
@@ -135,9 +120,8 @@ fun WelcomeScreenContent(viewModel: LoginViewModel) {
135
120
136
121
@Composable
137
122
fun AuthProviderView (viewModel : LoginViewModel ) {
138
- val isGoogleAuthAvailable: Boolean = GoogleApiAvailability
139
- .getInstance()
140
- .isGooglePlayServicesAvailable(LocalContext .current) == 0
123
+ val isGoogleAuthAvailable: Boolean =
124
+ GoogleApiAvailability .getInstance().isGooglePlayServicesAvailable(LocalContext .current) == 0
141
125
142
126
Row (
143
127
horizontalArrangement = Arrangement .Center
@@ -153,22 +137,17 @@ fun AuthProviderView(viewModel: LoginViewModel) {
153
137
154
138
AppleAuthButton (viewModel)
155
139
156
- ClickableText (
157
- text = AnnotatedString (stringResource(R .string.welcome_screen_action_continue_with_email)),
158
- style = MaterialTheme .typography.titleMedium
159
- .plus(TextStyle (textDecoration = TextDecoration .Underline )),
160
- onClick = { viewModel.showEmailSignIn() }
161
- )
140
+ ClickableText (text = AnnotatedString (stringResource(R .string.welcome_screen_action_continue_with_email)),
141
+ style = MaterialTheme .typography.titleMedium.plus(TextStyle (textDecoration = TextDecoration .Underline )),
142
+ onClick = { viewModel.showEmailSignIn() })
162
143
163
144
Spacer (modifier = Modifier .weight(1.0F ))
164
145
165
146
ClickableText (
166
147
text = AnnotatedString (stringResource(R .string.welcome_screen_action_self_hosting_options)),
167
- style = MaterialTheme .typography.titleMedium
168
- .plus(TextStyle (textDecoration = TextDecoration .Underline )),
148
+ style = MaterialTheme .typography.titleMedium.plus(TextStyle (textDecoration = TextDecoration .Underline )),
169
149
onClick = { viewModel.showSelfHostedSettings() },
170
- modifier = Modifier
171
- .padding(vertical = 10 .dp)
150
+ modifier = Modifier .padding(vertical = 10 .dp)
172
151
)
173
152
}
174
153
Spacer (modifier = Modifier .weight(1.0F ))
@@ -184,8 +163,7 @@ fun MoreInfoButton() {
184
163
text = AnnotatedString (
185
164
stringResource(id = R .string.learn_more),
186
165
),
187
- style = MaterialTheme .typography.titleSmall
188
- .plus(TextStyle (textDecoration = TextDecoration .Underline )),
166
+ style = MaterialTheme .typography.titleSmall.plus(TextStyle (textDecoration = TextDecoration .Underline )),
189
167
onClick = {
190
168
context.startActivity(intent)
191
169
},
0 commit comments