From 0050deb5012d158f83f04bc6be61a52596fa99c2 Mon Sep 17 00:00:00 2001 From: Diogenes Molinares Date: Wed, 10 Jun 2020 10:35:03 +0200 Subject: Remove Apache Commons dependencies (#840) Co-authored-by: Harsh Shandilya --- app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'app/src/main/java/com/zeapo/pwdstore/crypto') diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt index 35550d8d..c62b6293 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt @@ -43,6 +43,7 @@ import com.zeapo.pwdstore.autofill.oreo.AutofillPreferences import com.zeapo.pwdstore.autofill.oreo.DirectoryStructure import com.zeapo.pwdstore.ui.dialogs.PasswordGeneratorDialogFragment import com.zeapo.pwdstore.ui.dialogs.XkPasswordGeneratorDialogFragment +import com.zeapo.pwdstore.utils.FileUtils import kotlinx.android.synthetic.main.decrypt_layout.crypto_password_category_decrypt import kotlinx.android.synthetic.main.decrypt_layout.crypto_password_file import kotlinx.android.synthetic.main.decrypt_layout.crypto_password_last_changed @@ -69,8 +70,6 @@ import me.msfjarvis.openpgpktx.util.OpenPgpApi.Companion.RESULT_CODE_USER_INTERA import me.msfjarvis.openpgpktx.util.OpenPgpApi.Companion.RESULT_ERROR import me.msfjarvis.openpgpktx.util.OpenPgpApi.Companion.RESULT_INTENT import me.msfjarvis.openpgpktx.util.OpenPgpServiceConnection -import org.apache.commons.io.FileUtils -import org.apache.commons.io.FilenameUtils import org.openintents.openpgp.IOpenPgpService2 import org.openintents.openpgp.OpenPgpError import java.io.ByteArrayInputStream @@ -352,7 +351,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound { val data = receivedIntent ?: Intent() data.action = ACTION_DECRYPT_VERIFY - val iStream = FileUtils.openInputStream(File(fullPath)) + val iStream = File(fullPath).inputStream() val oStream = ByteArrayOutputStream() lifecycleScope.launch(IO) { @@ -478,7 +477,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound { try { // TODO This might fail, we should check that the write is successful val file = File(path) - val outputStream = FileUtils.openOutputStream(file) + val outputStream = file.outputStream() outputStream.write(oStream.toByteArray()) outputStream.close() @@ -772,7 +771,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound { * Gets the name of the password (excluding .gpg) */ fun getName(fullPath: String): String { - return FilenameUtils.getBaseName(fullPath) + return FileUtils.getBaseName(fullPath) } /** -- cgit v1.2.3