aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt
diff options
context:
space:
mode:
authorDiogenes Molinares <amolinares19@gmail.com>2020-06-10 10:35:03 +0200
committerGitHub <noreply@github.com>2020-06-10 14:05:03 +0530
commit0050deb5012d158f83f04bc6be61a52596fa99c2 (patch)
tree51417971d7b7dbcbeb3d34d688c9a8d45a9c24ca /app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt
parent7569d4027081d27a6e3d975c14cfc9bdcd879257 (diff)
downloadHardenedPass-0050deb5012d158f83f04bc6be61a52596fa99c2.tar.gz
HardenedPass-0050deb5012d158f83f04bc6be61a52596fa99c2.zip
Remove Apache Commons dependencies (#840)
Co-authored-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt9
1 files changed, 4 insertions, 5 deletions
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)
}
/**