summaryrefslogtreecommitdiff
path: root/openpgp-ktx
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2021-02-15 13:05:09 +0530
committerGitHub <noreply@github.com>2021-02-15 13:05:09 +0530
commit051d455c9f68d7edbc75abbc8d9293dd34d1d250 (patch)
tree2354ee3cf44c1bf09c97a3cabee3b37b0f717ef3 /openpgp-ktx
parent7fbe4be71143e0d57a14d19f66496213d8248b1d (diff)
Add tests for GPG identifier parsing (#1319)
Diffstat (limited to 'openpgp-ktx')
-rw-r--r--openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpUtils.kt9
1 files changed, 4 insertions, 5 deletions
diff --git a/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpUtils.kt b/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpUtils.kt
index cca90653..439c9278 100644
--- a/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpUtils.kt
+++ b/openpgp-ktx/src/main/java/me/msfjarvis/openpgpktx/util/OpenPgpUtils.kt
@@ -6,7 +6,6 @@ package me.msfjarvis.openpgpktx.util
import android.content.Context
import android.content.Intent
-import android.text.TextUtils
import java.io.Serializable
import java.util.Locale
import java.util.regex.Pattern
@@ -64,7 +63,7 @@ public object OpenPgpUtils {
* See SplitUserIdTest for examples.
*/
public fun splitUserId(userId: String): UserId {
- if (!TextUtils.isEmpty(userId)) {
+ if (userId.isNotEmpty()) {
val matcher = USER_ID_PATTERN.matcher(userId)
if (matcher.matches()) {
var name = if (matcher.group(1).isEmpty()) null else matcher.group(1)
@@ -95,15 +94,15 @@ public object OpenPgpUtils {
*/
public fun createUserId(userId: UserId): String? {
val userIdBuilder = StringBuilder()
- if (!TextUtils.isEmpty(userId.name)) {
+ if (!userId.name.isNullOrEmpty()) {
userIdBuilder.append(userId.name)
}
- if (!TextUtils.isEmpty(userId.comment)) {
+ if (!userId.comment.isNullOrEmpty()) {
userIdBuilder.append(" (")
userIdBuilder.append(userId.comment)
userIdBuilder.append(")")
}
- if (!TextUtils.isEmpty(userId.email)) {
+ if (!userId.email.isNullOrEmpty()) {
userIdBuilder.append(" <")
userIdBuilder.append(userId.email)
userIdBuilder.append(">")