open forgot password link in chrome when user taps button

This commit is contained in:
Satindar Dhillon 2022-09-15 21:12:13 -07:00
parent e131e83fec
commit ae72de90d1
2 changed files with 7 additions and 5 deletions

View file

@ -19,6 +19,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.ImeAction
@ -26,10 +27,12 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
import app.omnivore.omnivore.BuildConfig
@SuppressLint("CoroutineCreationDuringComposition")
@Composable
fun EmailLoginView(viewModel: LoginViewModel) {
val uriHandler = LocalUriHandler.current
var email by rememberSaveable { mutableStateOf("") }
var password by rememberSaveable { mutableStateOf("") }
@ -75,7 +78,10 @@ fun EmailLoginView(viewModel: LoginViewModel) {
text = AnnotatedString("Forgot your password?"),
style = MaterialTheme.typography.titleMedium
.plus(TextStyle(textDecoration = TextDecoration.Underline)),
onClick = { viewModel.showForgotPasswordView() }
onClick = {
val uri = "${BuildConfig.OMNIVORE_WEB_URL}/auth/forgot-password"
uriHandler.openUri(uri)
}
)
}
}

View file

@ -69,10 +69,6 @@ class LoginViewModel @Inject constructor(
registrationStateLiveData.value = RegistrationState.EmailSignUp
}
fun showForgotPasswordView() {
// TODO: show webview
}
fun cancelNewUserSignUp() {
viewModelScope.launch {
datastoreRepo.clearValue(DatastoreKeys.omnivorePendingUserToken)