Update libgocryptfs & Small UX fix

This commit is contained in:
Matéo Duparc 2022-04-22 12:12:57 +02:00
parent e2248220c4
commit 8aa2be2b05
Signed by untrusted user: hardcoresushi
GPG Key ID: AFE384344A45E13A
4 changed files with 21 additions and 26 deletions

View File

@ -15,8 +15,8 @@ android {
minSdkVersion 21
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 29
versionCode 26
versionName "1.10.0"
versionCode 27
versionName "1.10.1"
ndk {
abiFilters "x86", "x86_64", "armeabi-v7a", "arm64-v8a"

@ -1 +1 @@
Subproject commit 985d8523434814cd9cba61b666a1f888bdcbaded
Subproject commit 9e98192442b08362660b45f4e2e50221ba7bc65b

View File

@ -141,33 +141,29 @@ class GocryptfsVolume(val applicationContext: Context, var sessionID: Int) {
return false
}
fun importFile(inputStream: InputStream, handleID: Int): Boolean {
fun importFile(inputStream: InputStream, dst_path: String): Boolean {
val dstHandleId = openWriteMode(dst_path)
if (dstHandleId != -1) {
var success = true
var offset: Long = 0
val ioBuffer = ByteArray(DefaultBS)
var length: Int
while (inputStream.read(ioBuffer).also { length = it } > 0) {
val written = writeFile(handleID, offset, ioBuffer, length).toLong()
val written = writeFile(dstHandleId, offset, ioBuffer, length).toLong()
if (written == length.toLong()) {
offset += written
} else {
inputStream.close()
return false
success = false
break
}
}
closeFile(handleID)
inputStream.close()
return true
}
fun importFile(inputStream: InputStream, dst_path: String): Boolean {
var success = false
val dstHandleId = openWriteMode(dst_path)
if (dstHandleId != -1) {
success = importFile(inputStream, dstHandleId)
closeFile(dstHandleId)
}
inputStream.close()
return success
}
return false
}
fun importFile(context: Context, src_uri: Uri, dst_path: String): Boolean {
val inputStream = context.contentResolver.openInputStream(src_uri)

View File

@ -594,8 +594,7 @@ class MainActivity : BaseActivity(), VolumeAdapter.Listener {
CustomAlertDialogBuilder(this, themeValue)
.setTitle(R.string.open_volume_failed)
.setMessage(R.string.open_volume_failed_msg)
.setPositiveButton(R.string.ok, null)
.setOnDismissListener {
.setPositiveButton(R.string.ok) { _, _ ->
askForPassword(volume, position, savePasswordHash)
}
.show()