Filter out bad E164s from GV1 groups.

This commit is contained in:
Greyson Parrelli
2025-04-18 10:52:02 -04:00
committed by Cody Henthorne
parent e45eabc714
commit a2a10fb0c1
2 changed files with 11 additions and 0 deletions

View File

@@ -53,6 +53,14 @@ object SignalE164Util {
return getFormatter().formatAsE164(input)
}
/**
* Returns true if the input string can be considered an E164. Specifically, it returns true if we could figure out how to format it as an E164.
*/
@JvmStatic
fun isPotentialE164(input: String): Boolean {
return formatAsE164(input) != null
}
private fun getFormatter(): E164Util.Formatter {
val localNumber = SignalStore.account.e164 ?: return defaultFormatter
val formatter = cachedFormatters[localNumber]