11package com.flipcash.app.permissions.internal.contacts
22
3+ import androidx.compose.foundation.Image
4+ import androidx.compose.foundation.layout.Arrangement
35import androidx.compose.foundation.layout.Box
46import androidx.compose.foundation.layout.Column
57import androidx.compose.foundation.layout.fillMaxSize
@@ -10,6 +12,7 @@ import androidx.compose.runtime.Composable
1012import androidx.compose.runtime.CompositionLocalProvider
1113import androidx.compose.ui.Alignment
1214import androidx.compose.ui.Modifier
15+ import androidx.compose.ui.res.painterResource
1316import androidx.compose.ui.res.stringResource
1417import androidx.compose.ui.text.style.TextAlign
1518import androidx.compose.ui.tooling.preview.Preview
@@ -31,10 +34,21 @@ import com.getcode.util.permissions.rememberContactPermission
3134@Composable
3235fun ContactScreenContent (
3336 accessHandle : ContactAccessHandle ,
37+ simplified : Boolean = false,
3438 onSkip : (() -> Unit )? = null,
3539 isLoading : Boolean = false,
3640 isSuccess : Boolean = false,
3741) {
42+ if (simplified) {
43+ SimplifiedContactScreenContent (
44+ accessHandle = accessHandle,
45+ onSkip = onSkip,
46+ isLoading = isLoading,
47+ isSuccess = isSuccess,
48+ )
49+ return
50+ }
51+
3852 CodeScaffold (
3953 bottomBar = {
4054 ContactPermissionBottomBar (
@@ -76,6 +90,74 @@ fun ContactScreenContent(
7690 }
7791}
7892
93+ @Composable
94+ private fun SimplifiedContactScreenContent (
95+ accessHandle : ContactAccessHandle ,
96+ onSkip : (() -> Unit )? = null,
97+ isLoading : Boolean = false,
98+ isSuccess : Boolean = false,
99+ ) {
100+ CodeScaffold (
101+ bottomBar = {
102+ ContactPermissionBottomBar (
103+ accessHandle = accessHandle,
104+ onSkip = onSkip,
105+ isLoading = isLoading,
106+ isSuccess = isSuccess,
107+ action = stringResource(R .string.action_continue),
108+ )
109+ }
110+ ) { padding ->
111+ Box (modifier = Modifier .fillMaxSize(), contentAlignment = Alignment .Center ) {
112+ Column (
113+ modifier = Modifier .fillMaxWidth(),
114+ verticalArrangement = Arrangement .spacedBy(CodeTheme .dimens.grid.x6),
115+ horizontalAlignment = Alignment .CenterHorizontally ,
116+ ) {
117+ Image (
118+ painter = painterResource(R .drawable.ic_send_large),
119+ contentDescription = null ,
120+ )
121+ Column (
122+ modifier = Modifier .fillMaxWidth(0.8f ),
123+ verticalArrangement = Arrangement .spacedBy(CodeTheme .dimens.grid.x2),
124+ horizontalAlignment = Alignment .CenterHorizontally ,
125+ ) {
126+ Text (
127+ text = stringResource(R .string.permissions_title_contactsSimple),
128+ style = CodeTheme .typography.textLarge,
129+ color = CodeTheme .colors.textMain,
130+ )
131+ Text (
132+ modifier = Modifier .fillMaxWidth(),
133+ text = stringResource(R .string.permissions_description_contactsSimple),
134+ style = CodeTheme .typography.textSmall,
135+ color = CodeTheme .colors.textSecondary,
136+ textAlign = TextAlign .Center ,
137+ )
138+ }
139+ Column (
140+ modifier = Modifier .fillMaxWidth(),
141+ verticalArrangement = Arrangement .spacedBy(CodeTheme .dimens.grid.x2),
142+ horizontalAlignment = Alignment .CenterHorizontally ,
143+
144+ ) {
145+ BulletRow (
146+ painter = painterResource(com.flipcash.core.R .drawable.ic_checklist),
147+ text = stringResource(com.flipcash.core.R .string.rationale_bullet_contactChoice),
148+ textColor = CodeTheme .colors.textMain,
149+ )
150+ BulletRow (
151+ painter = painterResource(com.flipcash.core.R .drawable.ic_people_gear),
152+ text = stringResource(com.flipcash.core.R .string.rationale_bullet_changeAccess),
153+ textColor = CodeTheme .colors.textMain,
154+ )
155+ }
156+ }
157+ }
158+ }
159+ }
160+
79161@Composable
80162@Preview
81163@PreviewWrapper(FlipcashThemeWrapper ::class )
@@ -86,4 +168,16 @@ private fun PreviewContactPermissionScreen() {
86168 ContactScreenContent (state.asContactAccessHandle(), onSkip = { })
87169 }
88170 }
171+ }
172+
173+ @Composable
174+ @Preview
175+ @PreviewWrapper(FlipcashThemeWrapper ::class )
176+ private fun PreviewSimplifiedContactPermissionScreen () {
177+ CompositionLocalProvider (LocalAnalytics provides StubFlipcashAnalytics ()) {
178+ ProvideTestPermissions (granted = emptySet()) {
179+ val state = rememberContactPermission()
180+ ContactScreenContent (state.asContactAccessHandle(), simplified = true )
181+ }
182+ }
89183}
0 commit comments