Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Patterns.EMAIL_ADDRESS regex. #3128

Merged
merged 1 commit into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.github.libretube.ui.dialogs
import android.app.Dialog
import android.os.Bundle
import android.util.Log
import android.util.Patterns
import android.widget.Toast
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope
Expand All @@ -14,7 +15,6 @@ import com.github.libretube.api.obj.Token
import com.github.libretube.databinding.DialogLoginBinding
import com.github.libretube.extensions.TAG
import com.github.libretube.helpers.PreferenceHelper
import com.github.libretube.util.TextUtils
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.serialization.decodeFromString
import retrofit2.HttpException
Expand Down Expand Up @@ -113,6 +113,6 @@ class LoginDialog(
}

private fun isEmail(text: String): Boolean {
return TextUtils.EMAIL_REGEX.toRegex().matches(text)
return Patterns.EMAIL_ADDRESS.toRegex().matches(text)
}
}
5 changes: 0 additions & 5 deletions app/src/main/java/com/github/libretube/util/TextUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ object TextUtils {
*/
const val SEPARATOR = " • "

/**
* Regex to check for e-mails
*/
const val EMAIL_REGEX = "^[A-Za-z](.*)([@]{1})(.{1,})(\\.)(.{1,})"

/**
* Reserved characters by unix which can not be used for file name.
*/
Expand Down