Compare commits
No commits in common. "2ba5674850a43c843d45da57a389db229d684759" and "c14b3a7f58a22c948924fb14950e4f833f3e67f9" have entirely different histories.
2ba5674850
...
c14b3a7f58
@ -7,7 +7,7 @@ object MimeUtils {
|
|||||||
"image/apng" to ".apng",
|
"image/apng" to ".apng",
|
||||||
"image/avif" to ".avif",
|
"image/avif" to ".avif",
|
||||||
"image/gif" to ".gif",
|
"image/gif" to ".gif",
|
||||||
"image/jpeg" to ".jpg",
|
"image/jpeg" to ".jpeg",
|
||||||
"image/webp" to ".webp",
|
"image/webp" to ".webp",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -21,26 +21,6 @@ import java.io.IOException
|
|||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.io.OutputStream
|
import java.io.OutputStream
|
||||||
|
|
||||||
/*
|
|
||||||
* Attempt to replace the file extension in @fileName with @newExtension. If @newExtension is null,
|
|
||||||
* then @fileName is returned verbatim.
|
|
||||||
* */
|
|
||||||
private fun maybeReplaceExtension(fileName: String, newExtension: String?): String {
|
|
||||||
if (newExtension == null) {
|
|
||||||
return fileName
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(newExtension[0] == '.')
|
|
||||||
val parts = fileName.split(".")
|
|
||||||
return if (parts.size == 1) {
|
|
||||||
"$fileName$newExtension"
|
|
||||||
} else {
|
|
||||||
// Split at the ".", join all but the list end together and append the new extension
|
|
||||||
val fileNameWithoutExtension = parts.subList(0, parts.size - 1).joinToString(".")
|
|
||||||
"$fileNameWithoutExtension$newExtension"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class PickerResultListener(private val context: Context) : ActivityResultListener {
|
class PickerResultListener(private val context: Context) : ActivityResultListener {
|
||||||
/*
|
/*
|
||||||
* Attempt to deduce the filename for the URI @uri.
|
* Attempt to deduce the filename for the URI @uri.
|
||||||
@ -64,7 +44,7 @@ class PickerResultListener(private val context: Context) : ActivityResultListene
|
|||||||
|
|
||||||
// Note: This is a workaround for the Dart image library failing to parse the file
|
// Note: This is a workaround for the Dart image library failing to parse the file
|
||||||
// because displayName somehow is always ".jpg", which confuses image.
|
// because displayName somehow is always ".jpg", which confuses image.
|
||||||
result = maybeReplaceExtension(displayName, fileExtension)
|
result = if (fileExtension != null) "$displayName$fileExtension" else displayName
|
||||||
Log.d(TAG, "Returning $result as filename (MIME: $mimeType)")
|
Log.d(TAG, "Returning $result as filename (MIME: $mimeType)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: moxxy_native
|
name: moxxy_native
|
||||||
description: Interactions with the system for Moxxy
|
description: Interactions with the system for Moxxy
|
||||||
version: 0.3.2
|
version: 0.3.1
|
||||||
publish_to: https://git.polynom.me/api/packages/Moxxy/pub
|
publish_to: https://git.polynom.me/api/packages/Moxxy/pub
|
||||||
homepage:
|
homepage:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user