|
@@ -53,13 +53,18 @@ import com.fastest.pass.R
|
|
|
|
|
|
enum class ClickType {
|
|
|
GO_BACK,
|
|
|
- OPEN_FORGOT_VERIFY
|
|
|
+ OPEN_FORGOT_VERIFY,
|
|
|
+ FORGOT_API
|
|
|
}
|
|
|
|
|
|
@Composable
|
|
|
-fun ForgotPasswordScreen(clickType: (ClickType) -> Unit) {
|
|
|
+fun ForgotPasswordScreen(
|
|
|
+ clickType: (ClickType) -> Unit,
|
|
|
+ onSendButtonClicked: (String) -> Unit
|
|
|
+ ) {
|
|
|
val keyboardController = LocalSoftwareKeyboardController.current
|
|
|
val focusManager = LocalFocusManager.current
|
|
|
+ var email by remember { mutableStateOf("") }
|
|
|
|
|
|
Box(
|
|
|
modifier = Modifier
|
|
@@ -92,11 +97,19 @@ fun ForgotPasswordScreen(clickType: (ClickType) -> Unit) {
|
|
|
)
|
|
|
) {
|
|
|
ForgotPasswordText(R.string.email_associated_account)
|
|
|
- LoginTextFieldFP(keyboardController = keyboardController, focusManager = focusManager)
|
|
|
+ LoginTextFieldFP(
|
|
|
+ keyboardController = keyboardController,
|
|
|
+ focusManager = focusManager,
|
|
|
+ onEmailText = { email = it }
|
|
|
+ )
|
|
|
Spacer(modifier = Modifier.height(25.dp))
|
|
|
- SendCodeButton(buttonText = R.string.send_email) { clickType ->
|
|
|
- clickType(clickType)
|
|
|
- }
|
|
|
+ SendCodeButton(
|
|
|
+ buttonText = R.string.send_email,
|
|
|
+ clickType = { clickType -> clickType(clickType) },
|
|
|
+ onSendButtonClicked = {
|
|
|
+ if (email.isNotEmpty()) { onSendButtonClicked.invoke(email) }
|
|
|
+ }
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -174,7 +187,8 @@ fun ColumnScope.ForgotPasswordText(
|
|
|
@Composable
|
|
|
fun ColumnScope.LoginTextFieldFP(
|
|
|
keyboardController: SoftwareKeyboardController?,
|
|
|
- focusManager: FocusManager
|
|
|
+ focusManager: FocusManager,
|
|
|
+ onEmailText: (String) -> Unit
|
|
|
) {
|
|
|
var emailText by remember { mutableStateOf("") }
|
|
|
|
|
@@ -182,6 +196,7 @@ fun ColumnScope.LoginTextFieldFP(
|
|
|
value = emailText,
|
|
|
onValueChange = {
|
|
|
emailText = it
|
|
|
+ onEmailText.invoke(emailText)
|
|
|
},
|
|
|
textStyle = MaterialTheme.typography.displayMedium,
|
|
|
modifier = Modifier
|
|
@@ -241,7 +256,11 @@ fun ColumnScope.LoginTextFieldFP(
|
|
|
}
|
|
|
|
|
|
@Composable
|
|
|
-fun ColumnScope.SendCodeButton(buttonText: Int, clickType: (ClickType) -> Unit) {
|
|
|
+fun ColumnScope.SendCodeButton(
|
|
|
+ buttonText: Int,
|
|
|
+ clickType: (ClickType) -> Unit,
|
|
|
+ onSendButtonClicked: () -> Unit
|
|
|
+) {
|
|
|
Button(
|
|
|
modifier = Modifier
|
|
|
.padding(start = 30.dp, end = 30.dp,)
|
|
@@ -250,7 +269,7 @@ fun ColumnScope.SendCodeButton(buttonText: Int, clickType: (ClickType) -> Unit)
|
|
|
.height(60.dp)
|
|
|
.clickable() {},
|
|
|
onClick = {
|
|
|
-// clickType.invoke(ClickType.OPEN_FORGOT_VERIFY)
|
|
|
+ onSendButtonClicked.invoke()
|
|
|
},
|
|
|
shape = RoundedCornerShape(15.dp),
|
|
|
// border = BorderStroke(25.dp, colorResource(id = R.color.black)),
|