diff --git a/app/build.gradle b/app/build.gradle
index 510d62e2..a6974079 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -197,6 +197,7 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines"
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-guava:$coroutines"
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.core:core-splashscreen:1.0.1'
@@ -204,6 +205,7 @@ dependencies {
implementation "androidx.appcompat:appcompat:1.6.1"
implementation "androidx.fragment:fragment-ktx:1.7.0"
implementation "androidx.annotation:annotation:1.7.1"
+ implementation "androidx.javascriptengine:javascriptengine:1.0.0-beta01"
implementation "androidx.preference:preference-ktx:1.2.1"
implementation "androidx.recyclerview:recyclerview:1.3.2"
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 79d75bc0..a4257893 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -3,6 +3,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="internalOnly">
+
+
@@ -42,9 +44,9 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
+ android:resizeableActivity="true"
android:supportsRtl="false"
android:theme="@style/WulkanowyTheme"
- android:resizeableActivity="true"
tools:ignore="DataExtractionRules,UnusedAttribute">
()
+ private val sandbox: ListenableFuture? =
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && JavaScriptSandbox.isSupported())
+ JavaScriptSandbox.createConnectedInstanceAsync(context)
+ else null
private val sdk = Sdk().apply {
- androidVersion = android.os.Build.VERSION.RELEASE
- buildTag = android.os.Build.MODEL
+ androidVersion = Build.VERSION.RELEASE
+ buildTag = Build.MODEL
userAgentTemplate = remoteConfig.userAgentTemplate
setSimpleHttpLogger { Timber.d(it) }
setAdditionalCookieManager(webkitCookieManagerProxy)
@@ -48,6 +60,22 @@ class WulkanowySdkFactory @Inject constructor(
endpointsMapping = mapping.endpoints
vTokenMapping = mapping.vTokens
vTokenSchemeMapping = mapping.vTokenScheme
+ vParamsEvaluation = createIsolate()
+ }
+ }
+ }
+
+ private suspend fun createIsolate(): suspend () -> EvaluateHandler {
+ return {
+ val isolate = sandbox?.await()?.createIsolate()
+ object : EvaluateHandler {
+ override suspend fun evaluate(code: String): String? {
+ return isolate?.evaluateJavaScriptAsync(code)?.await()
+ }
+
+ override fun close() {
+ isolate?.close()
+ }
}
}
}