fix: save as on android

This commit is contained in:
PeanutMelonSeedBigAlmond
2024-05-25 00:54:14 +08:00
parent 1e6ee09265
commit 50f7f63b16
2 changed files with 17 additions and 1 deletions

View File

@@ -77,6 +77,7 @@ object MethodChannelUtils {
args: List<Any?>?, args: List<Any?>?,
instance: Any? instance: Any?
): Any? { ): Any? {
Log.i("MethodChannel", "invoke method: ${method}")
method.isAccessible = true method.isAccessible = true
return if (method.isStaticMethod()) { // 静态方法调用 return if (method.isStaticMethod()) { // 静态方法调用
if (args == null) { if (args == null) {

View File

@@ -18,7 +18,7 @@ class SAFPlugin(private val activity: MainActivity) {
private var onSAFAuthFailed: (() -> Unit)? = null private var onSAFAuthFailed: (() -> Unit)? = null
companion object { companion object {
const val safAuthorizationCode = 0x10086 const val safAuthorizationCode = 0xabcd
} }
init { init {
@@ -66,6 +66,17 @@ class SAFPlugin(private val activity: MainActivity) {
} }
} }
/**
* 打开文件
* @param channelResult Result
* @param filenameWithoutExtension String
* @param dir String
* @param mimeType String
* @param readFlag Boolean ignored
* @param writeFlag Boolean ignored
* @param appendFlag Boolean ignored
* @param saveAsFlag Boolean ignored
*/
@ChannelMethod(responseManually = true) @ChannelMethod(responseManually = true)
@Suppress("unused") @Suppress("unused")
private fun openFile( private fun openFile(
@@ -73,6 +84,10 @@ class SAFPlugin(private val activity: MainActivity) {
filenameWithoutExtension: String, filenameWithoutExtension: String,
dir: String, dir: String,
mimeType: String, mimeType: String,
@Suppress("UNUSED_PARAMETER") readFlag: Boolean,
@Suppress("UNUSED_PARAMETER") writeFlag: Boolean,
@Suppress("UNUSED_PARAMETER") appendFlag: Boolean,
@Suppress("UNUSED_PARAMETER") saveAsFlag: Boolean,
) { ) {
if (!checkSafPermission()) { if (!checkSafPermission()) {
onSAFAuthSuccess = { onSAFAuthSuccess = {