-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement E2EE for locations & journeys
Implement E2EE for locations & journeys
- Loading branch information
Showing
45 changed files
with
2,502 additions
and
490 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
app/src/main/java/com/canopas/yourspace/ui/flow/pin/enterpin/EnterPinScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
package com.canopas.yourspace.ui.flow.pin.enterpin | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TopAppBar | ||
import androidx.compose.material3.TopAppBarDefaults | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.collectAsState | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.input.KeyboardType | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.dp | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import com.canopas.yourspace.R | ||
import com.canopas.yourspace.ui.component.OtpInputField | ||
import com.canopas.yourspace.ui.component.PrimaryButton | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun EnterPinScreen() { | ||
Scaffold( | ||
topBar = { | ||
TopAppBar( | ||
title = { Text(stringResource(R.string.enter_pin_top_bar_title)) }, | ||
colors = TopAppBarDefaults.topAppBarColors( | ||
containerColor = MaterialTheme.colorScheme.background | ||
) | ||
) | ||
}, | ||
containerColor = MaterialTheme.colorScheme.background | ||
) { | ||
EnterPinContent(modifier = Modifier.padding(it)) | ||
} | ||
} | ||
|
||
@Composable | ||
private fun EnterPinContent(modifier: Modifier) { | ||
val viewModel = hiltViewModel<EnterPinViewModel>() | ||
val state by viewModel.state.collectAsState() | ||
|
||
Column( | ||
modifier = modifier | ||
.padding(32.dp) | ||
.fillMaxSize(), | ||
verticalArrangement = Arrangement.Center, | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
Text( | ||
text = stringResource(R.string.enter_pin_header_text_part_one), | ||
style = MaterialTheme.typography.bodyLarge, | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(bottom = 24.dp), | ||
textAlign = TextAlign.Center | ||
) | ||
|
||
Text( | ||
text = stringResource(R.string.enter_pin_header_text_part_two), | ||
style = MaterialTheme.typography.bodyLarge, | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(bottom = 24.dp), | ||
textAlign = TextAlign.Center | ||
) | ||
|
||
OtpInputField( | ||
pinText = state.pin, | ||
onPinTextChange = { viewModel.onPinChanged(it) }, | ||
digitCount = 4, | ||
keyboardType = KeyboardType.Number | ||
) | ||
|
||
Spacer(modifier = Modifier.height(16.dp)) | ||
|
||
if (state.isPinInvalid) { | ||
Text( | ||
text = stringResource(R.string.enter_pin_invalid_pin_text), | ||
color = MaterialTheme.colorScheme.error, | ||
style = MaterialTheme.typography.bodyMedium, | ||
modifier = Modifier.padding(top = 8.dp) | ||
) | ||
} | ||
|
||
Spacer(modifier = Modifier.height(24.dp)) | ||
|
||
PrimaryButton( | ||
label = stringResource(R.string.enter_pin_continue_button_text), | ||
onClick = { | ||
viewModel.processPin() | ||
}, | ||
enabled = state.pin != "" && !state.isPinInvalid && state.pin.length == 4, | ||
modifier = Modifier.fillMaxWidth(), | ||
showLoader = state.showLoader | ||
) | ||
} | ||
} |
Oops, something went wrong.