Browse Source

Update libgocryptfs & Small UX fix

master
Hardcore Sushi 2 months ago
parent
commit
8aa2be2b05
Signed by: hardcoresushi
GPG Key ID: AFE384344A45E13A
  1. 4
      app/build.gradle
  2. 2
      app/libgocryptfs
  3. 38
      app/src/main/java/sushi/hardcore/droidfs/GocryptfsVolume.kt
  4. 3
      app/src/main/java/sushi/hardcore/droidfs/MainActivity.kt

4
app/build.gradle

@ -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"

2
app/libgocryptfs

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

38
app/src/main/java/sushi/hardcore/droidfs/GocryptfsVolume.kt

@ -141,32 +141,28 @@ class GocryptfsVolume(val applicationContext: Context, var sessionID: Int) {
return false
}
fun importFile(inputStream: InputStream, handleID: Int): Boolean {
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()
if (written == length.toLong()) {
offset += written
} else {
inputStream.close()
return false
}
}
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)
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(dstHandleId, offset, ioBuffer, length).toLong()
if (written == length.toLong()) {
offset += written
} else {
inputStream.close()
success = false
break
}
}
closeFile(dstHandleId)
inputStream.close()
return success
}
return success
return false
}
fun importFile(context: Context, src_uri: Uri, dst_path: String): Boolean {

3
app/src/main/java/sushi/hardcore/droidfs/MainActivity.kt

@ -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()

Loading…
Cancel
Save