Skip to content

Commit 6dcb4b1

Browse files
authored
Merge pull request #238 from BioforestChain/fix-android-16kb-page-size
Fix android 16kb page size
2 parents 44ed40c + 2cb2785 commit 6dcb4b1

File tree

23 files changed

+97
-513
lines changed

23 files changed

+97
-513
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.dweb_browser.browser.zip
22

3-
import ziplib.decompress as decompressByRust
3+
import org.dweb_browser.ziplib.decompress as decompressByRust
44

55
actual fun decompress(zipFilePath: String, destPath: String) =
66
decompressByRust(zipFilePath, destPath).toLong() == 0L

next/kmp/buildSrc/src/main/kotlin/target-android-ios-ffi.gradle.kts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import org.gradle.accessors.dm.LibrariesForLibs
2-
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
32

43
plugins {
54
id("target-common")
@@ -10,11 +9,6 @@ plugins {
109
val libs = the<LibrariesForLibs>()
1110

1211
kotlin {
13-
@OptIn(ExperimentalKotlinGradlePluginApi::class)
14-
compilerOptions {
15-
languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9)
16-
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9)
17-
}
1812
kmpCommonTarget(project) {
1913
dependencies {
2014
implementation(libs.squareup.okio)

next/kmp/buildSrc/src/main/kotlin/target-desktop-ffi.gradle.kts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ plugins {
1010
val libs = the<LibrariesForLibs>()
1111

1212
kotlin {
13-
// @OptIn(ExperimentalKotlinGradlePluginApi::class)
14-
// compilerOptions {
15-
// languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9)
16-
// apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9)
17-
// }
1813
kmpCommonTarget(project) {
1914
dependencies {
2015
implementation(libs.squareup.okio)

next/kmp/buildSrc/src/main/kotlin/target-desktop-ios-ffi.gradle.kts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import org.gradle.accessors.dm.LibrariesForLibs
32
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
43

@@ -10,11 +9,6 @@ plugins {
109
val libs = the<LibrariesForLibs>()
1110

1211
kotlin {
13-
@OptIn(ExperimentalKotlinGradlePluginApi::class)
14-
compilerOptions {
15-
languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9)
16-
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_9)
17-
}
1812
kmpCommonTarget(project) {
1913
dependencies {
2014
implementation(libs.squareup.okio)

next/kmp/core/src/commonMain/kotlin/org/dweb_browser/core/std/file/ext/MicroModuleBlob.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ private suspend fun MicroModule.Runtime.createBlobFromUrl(
3232
val data = response.binary()
3333
val mime = response.headers.get("Content-Type")
3434
?.let { ct -> ContentType.parse(ct).mime }
35-
val ext = url.pathSegments.lastOrNull()?.run {
35+
val ext = url.segments.lastOrNull()?.run {
3636
when (val index = lastIndexOf('.')) {
3737
-1 -> null
3838
else -> substring(index + 1, length)

next/kmp/core/src/commonMain/kotlin/org/dweb_browser/core/std/http/MultipartNMM.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import kotlinx.coroutines.runBlocking
88
import kotlinx.serialization.ExperimentalSerializationApi
99
import kotlinx.serialization.cbor.Cbor
1010
import kotlinx.serialization.encodeToByteArray
11-
import multipart.MultipartConsumer
12-
import multipart.getBoundary
13-
import multipart.processMultipartOpen
14-
import multipart.processMultipartWrite
11+
import org.dweb_browser.multipart.MultipartConsumer
12+
import org.dweb_browser.multipart.getBoundary
13+
import org.dweb_browser.multipart.processMultipartOpen
14+
import org.dweb_browser.multipart.processMultipartWrite
1515
import org.dweb_browser.core.http.router.ResponseException
1616
import org.dweb_browser.core.http.router.bind
1717
import org.dweb_browser.core.module.BootstrapContext

next/kmp/core/src/mobileMain/kotlin/org/dweb_browser/core/http/dwebProxyService.mobile.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import org.dweb_browser.core.std.http.debugHttp
1414
import org.dweb_browser.helper.eprintln
1515
import org.dweb_browser.helper.globalIoScope
1616
import org.dweb_browser.pure.http.onPortChange
17-
import reverse_proxy.VoidCallback
17+
import org.dweb_browser.reverse_proxy.VoidCallback
1818

1919
actual class DwebProxyService actual constructor() {
2020
private val lock = Mutex()
@@ -52,13 +52,13 @@ actual class DwebProxyService actual constructor() {
5252
}
5353
if (backendServerPort != newPort) {
5454
backendServerPort = newPort
55-
reverse_proxy.forward(newPort)
55+
org.dweb_browser.reverse_proxy.forward(newPort)
5656
debugHttp("DwebViewProxy/onPortChange", "ReverseProxySetForward done")
5757
}
5858
}
5959
}
6060
}
61-
reverse_proxy.start(DWEB_SSL_PEM, backendServerPort, proxyReadyCallback)
61+
org.dweb_browser.reverse_proxy.start(DWEB_SSL_PEM, backendServerPort, proxyReadyCallback)
6262
debugHttp("reverse_proxy", "stopped")
6363
} catch (e: Throwable) {
6464
debugHttp("reverse_proxy", "error", e)

next/kmp/dwebview/src/androidMain/kotlin/org/dweb_browser/dwebview/DWebProfile.android.kt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
package org.dweb_browser.dwebview
22

33

4+
import android.os.CancellationSignal
45
import android.webkit.CookieManager
56
import android.webkit.GeolocationPermissions
67
import android.webkit.ServiceWorkerController
78
import android.webkit.WebStorage
9+
import androidx.webkit.OutcomeReceiverCompat
10+
import androidx.webkit.PrefetchException
811
import androidx.webkit.Profile
12+
import androidx.webkit.SpeculativeLoadingConfig
13+
import androidx.webkit.SpeculativeLoadingParameters
914
import kotlinx.coroutines.Job
15+
import java.util.concurrent.Executor
1016

1117

18+
@Profile.ExperimentalUrlPrefetch
1219
class CompactDWebProfile internal constructor(override val profileName: ProfileName) : Profile,
1320
DWebProfile {
1421

@@ -34,4 +41,35 @@ class CompactDWebProfile internal constructor(override val profileName: ProfileN
3441
override fun getServiceWorkerController(): ServiceWorkerController {
3542
return CompactDWebProfileStore.serviceWorkerController
3643
}
44+
45+
override fun prefetchUrlAsync(
46+
url: String,
47+
cancellationSignal: CancellationSignal?,
48+
callbackExecutor: Executor,
49+
operationCallback: OutcomeReceiverCompat<Void?, PrefetchException?>
50+
) {
51+
52+
}
53+
54+
override fun prefetchUrlAsync(
55+
url: String,
56+
cancellationSignal: CancellationSignal?,
57+
callbackExecutor: Executor,
58+
speculativeLoadingParameters: SpeculativeLoadingParameters,
59+
operationCallback: OutcomeReceiverCompat<Void?, PrefetchException?>
60+
) {
61+
62+
}
63+
64+
override fun clearPrefetchAsync(
65+
url: String,
66+
callbackExecutor: Executor,
67+
operationCallback: OutcomeReceiverCompat<Void?, PrefetchException?>
68+
) {
69+
70+
}
71+
72+
override fun setSpeculativeLoadingConfig(speculativeLoadingConfig: SpeculativeLoadingConfig) {
73+
74+
}
3775
}

next/kmp/dwebview/src/androidMain/kotlin/org/dweb_browser/dwebview/engine/DWebDownloadListener.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class DWebDownloadListener(val engine: DWebViewEngine) : DownloadListener {
3737
) {
3838
val suggestedFilename = contentDisposition?.substringAfter("filename=")?.ifEmpty { null }
3939
// 否则使用链接的最后一部分作为文件名
40-
?: Url(url).pathSegments.lastOrNull()
40+
?: Url(url).segments.lastOrNull()
4141
// 否则使用随机文件名
4242
?: (randomUUID() + (ContentType.parse(mimetype).fileExtensions().firstOrNull() ?: ""))
4343

next/kmp/dwebview/src/iosMain/kotlin/org/dweb_browser/dwebview/engine/DWebViewEngine.ios.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ class DWebViewEngine(
107107
val preferences = WKPreferences()
108108
preferences.javaScriptEnabled = true
109109
preferences.javaScriptCanOpenWindowsAutomatically = false
110-
// @see: https://developer.apple.com/documentation/webkit/wkpreferences/inactiveschedulingpolicy-swift.enum/none
111-
preferences.inactiveSchedulingPolicy = WKInactiveSchedulingPolicy.WKInactiveSchedulingPolicyNone
110+
// // @see: https://developer.apple.com/documentation/webkit/wkpreferences/inactiveschedulingpolicy-swift.enum/none
111+
// preferences.inactiveSchedulingPolicy = WKInactiveSchedulingPolicy.WKInactiveSchedulingPolicyNone
112112
configuration.preferences = preferences
113113
configuration.allowsInlineMediaPlayback = true
114114
configuration.allowsAirPlayForMediaPlayback = true

0 commit comments

Comments
 (0)