Skip to content

Commit 93052c3

Browse files
committed
💪 [kmp] 一些错别字的更正
1 parent c3532ff commit 93052c3

4 files changed

Lines changed: 17 additions & 14 deletions

File tree

next/kmp/app/iosApp/DwebBrowser/DwebBrowser/Desktop/DwebDeskVCStore.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class DwebVCData {
2323

2424
@Observable class DwebDeskVCStore {
2525
var vcs = [DwebVCData]()
26-
var navgationBarVisible: Visibility = .visible
26+
var navigationBarVisible: Visibility = .visible
2727
var shouldEnableEdgeSwipe: Bool = false
2828
init() {
29-
regiserDeskEvent()
29+
registryDeskEvent()
3030
}
3131

3232
class func startUpNMMs(_ app: UIApplication) {
@@ -38,7 +38,7 @@ class DwebVCData {
3838
Main_iosKt.startDwebBrowser(app: app, debugMode: debugMode, debugTags: ["/.+/"]) { Log("Main_iosKt.startDwebBrowser launch: \($1?.localizedDescription ?? "Success")") }
3939
}
4040

41-
private func regiserDeskEvent() {
41+
private func registryDeskEvent() {
4242
Main_iosKt.dwebViewController.setNavigationBarHook(hook: navigationBarHok(visible:))
4343
Main_iosKt.dwebViewController.setAddHook(hook: addHook(vc:prop:))
4444
Main_iosKt.dwebViewController.setUpdateHook(hook: updateHook(prop:))
@@ -51,7 +51,7 @@ class DwebVCData {
5151
}
5252

5353
private func navigationBarHok(visible: KotlinBoolean) {
54-
navgationBarVisible = visible.boolValue ? .visible : .hidden
54+
navigationBarVisible = visible.boolValue ? .visible : .hidden
5555
}
5656

5757
private func addHook(vc: UIViewController, prop: HelperComposeDwebUIViewControllerProperty) {

next/kmp/app/iosApp/DwebBrowser/DwebBrowser/DwebBrowserApp.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct DwebBrowserApp: App {
2020
ZStack(alignment: .center, content: {
2121
DwebFrameworkContentView()
2222
.ignoresSafeArea(.all, edges: .all)
23-
.persistentSystemOverlays(deskVCStore.navgationBarVisible)
23+
.persistentSystemOverlays(deskVCStore.navigationBarVisible)
2424
.environment(deskVCStore)
2525
.onChange(of: deskVCStore.shouldEnableEdgeSwipe) { _, enable in
2626

next/kmp/core/src/commonMain/kotlin/org/dweb_browser/core/ipc/Ipc.kt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import io.ktor.http.Url
44
import kotlinx.atomicfu.atomic
55
import kotlinx.coroutines.CancellationException
66
import kotlinx.coroutines.CompletableDeferred
7+
import kotlinx.coroutines.CoroutineName
78
import kotlinx.coroutines.CoroutineStart
89
import kotlinx.coroutines.Job
910
import kotlinx.coroutines.SupervisorJob
@@ -69,11 +70,17 @@ class Ipc internal constructor(
6970
private val reqIdAcc = atomic(0)
7071
}
7172

72-
private val job = SupervisorJob()
73-
val scope = endpoint.scope + job
74-
7573
override fun toString() = "Ipc@$debugId"
7674

75+
private val job = SupervisorJob() // 使用独立的 SupervisorJob,基于 endpoint.onClosed 去做关闭关联
76+
val scope = endpoint.scope + job + CoroutineName("$this")
77+
78+
init {
79+
endpoint.onClosed {
80+
tryClose(CancellationException("endpoint closed", it))
81+
}
82+
}
83+
7784
/**
7885
* 这部分得放最前面,因为有些地方需要立刻使用 onClosed
7986
*/
@@ -445,11 +452,6 @@ class Ipc internal constructor(
445452
}
446453
//#endregion
447454

448-
init {
449-
endpoint.onClosed {
450-
tryClose(CancellationException("endpoint closed", it))
451-
}
452-
}
453455
}
454456

455457
data class IpcRequestInit(

next/kmp/core/src/commonMain/kotlin/org/dweb_browser/core/ipc/NativeEndpoint.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package org.dweb_browser.core.ipc
33
import kotlinx.coroutines.CoroutineName
44
import kotlinx.coroutines.CoroutineScope
55
import kotlinx.coroutines.CoroutineStart
6+
import kotlinx.coroutines.Job
67
import kotlinx.coroutines.SupervisorJob
78
import kotlinx.coroutines.channels.Channel
89
import kotlinx.coroutines.flow.MutableStateFlow
@@ -97,7 +98,7 @@ class NativeEndpoint(
9798
) : IpcEndpoint() {
9899
override fun toString() = "NativeEndpoint@$debugId"
99100

100-
override val scope = parentScope + SupervisorJob() + CoroutineName("$this")
101+
override val scope = parentScope + SupervisorJob(parentScope.coroutineContext[Job]) + CoroutineName("$this")
101102

102103
/**
103104
* 发送消息

0 commit comments

Comments
 (0)