aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/crypto')
-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)
}
/**