Commit c1e613a1 by huangzhicong

现在base64不再进行编码转换了

parent 6b2485ff
...@@ -14,7 +14,6 @@ import com.maxrocky.nativeview.model.Result ...@@ -14,7 +14,6 @@ import com.maxrocky.nativeview.model.Result
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.net.URLEncoder
class WebViewProxy( class WebViewProxy(
private val fragment: Fragment, private val fragment: Fragment,
...@@ -76,7 +75,7 @@ class WebViewProxy( ...@@ -76,7 +75,7 @@ class WebViewProxy(
val bytes = ByteArray(this.available()) val bytes = ByteArray(this.available())
this.read(bytes) this.read(bytes)
val base64 = Base64.encodeToString(bytes, Base64.DEFAULT) val base64 = Base64.encodeToString(bytes, Base64.DEFAULT)
val encodeBase64 = "$encoder;base64,${URLEncoder.encode(base64, "UTF-8")}" val encodeBase64 = "$encoder;base64,$base64"
val data = MediaResult(uri.toString(), encodeBase64) val data = MediaResult(uri.toString(), encodeBase64)
withContext(Dispatchers.Main) { success(method, result, data) } withContext(Dispatchers.Main) { success(method, result, data) }
}.onFailure { }.onFailure {
...@@ -105,7 +104,7 @@ class WebViewProxy( ...@@ -105,7 +104,7 @@ class WebViewProxy(
val bytes = ByteArray(this.available()) val bytes = ByteArray(this.available())
this.read(bytes) this.read(bytes)
val base64 = Base64.encodeToString(bytes, Base64.DEFAULT) val base64 = Base64.encodeToString(bytes, Base64.DEFAULT)
val encodeBase64 = "$encoder;base64,${URLEncoder.encode(base64, "UTF-8")}" val encodeBase64 = "$encoder;base64,$base64"
return@runCatching MediaResult(it.toString(), encodeBase64) return@runCatching MediaResult(it.toString(), encodeBase64)
}.getOrNull() }.getOrNull()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment