From 466c9551161b1240cc4963d7108a342355b983de Mon Sep 17 00:00:00 2001 From: "mdmunir.hossain" <84305007+munir-rakuten@users.noreply.github.com> Date: Wed, 18 Oct 2023 19:25:07 +0900 Subject: [PATCH] remove unnecessary changes. (#586) --- miniapp/src/main/assets/js-miniapp | 2 +- .../mobile/miniapp/js/MiniAppMessageBridge.kt | 29 +------------------ 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/miniapp/src/main/assets/js-miniapp b/miniapp/src/main/assets/js-miniapp index b634fa9af..9e8e8f42f 160000 --- a/miniapp/src/main/assets/js-miniapp +++ b/miniapp/src/main/assets/js-miniapp @@ -1 +1 @@ -Subproject commit b634fa9af8eb1d956ab499122d932ce2484b395f +Subproject commit 9e8e8f42fcf227438f50aedf5a470eda56ef70ed diff --git a/miniapp/src/main/java/com/rakuten/tech/mobile/miniapp/js/MiniAppMessageBridge.kt b/miniapp/src/main/java/com/rakuten/tech/mobile/miniapp/js/MiniAppMessageBridge.kt index 29eae8e4e..9413b6c8e 100644 --- a/miniapp/src/main/java/com/rakuten/tech/mobile/miniapp/js/MiniAppMessageBridge.kt +++ b/miniapp/src/main/java/com/rakuten/tech/mobile/miniapp/js/MiniAppMessageBridge.kt @@ -40,7 +40,6 @@ import com.rakuten.tech.mobile.miniapp.permission.CustomPermissionBridgeDispatch import com.rakuten.tech.mobile.miniapp.permission.MiniAppCustomPermissionResult import com.rakuten.tech.mobile.miniapp.permission.ui.MiniAppCustomPermissionWindow import com.rakuten.tech.mobile.miniapp.storage.DownloadedManifestCache -import java.nio.charset.Charset @Suppress( "TooGenericExceptionCaught", @@ -711,35 +710,9 @@ internal object ErrorBridgeMessage { @Suppress("ExpressionBodySyntax", "SwallowedException", "TooGenericExceptionCaught") fun String.base64Encoded(): String = try { Base64.encodeToString( - encodeToNonLossyAscii(this).toByteArray(charset("UTF-8")), + this.toByteArray(charset("UTF-8")), Base64.DEFAULT ) } catch (e: Exception) { "" } - -/** - * convert the unicode/octal characters. - */ -@Suppress("MagicNumber") -private fun encodeToNonLossyAscii(original: String): String { - val asciiCharset = Charset.forName("US-ASCII") - if (asciiCharset.newEncoder().canEncode(original)) { - return original - } - val stringBuffer = StringBuffer() - for (element in original) { - if (element.code < 128) { - stringBuffer.append(element) - } else if (element.code < 256) { - val octal = Integer.toOctalString(element.code) - stringBuffer.append("\\") - stringBuffer.append(octal) - } else { - val hex = Integer.toHexString(element.code) - stringBuffer.append("\\u") - stringBuffer.append(hex) - } - } - return stringBuffer.toString() -}