diff --git a/app/src/main/java/li/songe/gkd/data/NodeInfo.kt b/app/src/main/java/li/songe/gkd/data/NodeInfo.kt index 8f18063..9113af6 100644 --- a/app/src/main/java/li/songe/gkd/data/NodeInfo.kt +++ b/app/src/main/java/li/songe/gkd/data/NodeInfo.kt @@ -32,7 +32,7 @@ data class NodeInfo( quickFind: Boolean?, ): Boolean? { // 如果父节点是无法查找的, 则所有子节点都是无法查找的 - // 如果一个节点是可查找的, 则所有兄弟节点都是可查找的(如果满足条件) + // 如果一个节点是可查找的, 则所有兄弟节点及其祖先节点都是可查找的(如果满足条件) return if (nodeInfo != null) { val viewId = nodeInfo.viewIdResourceName if (viewId != null && viewId.isNotEmpty()) { // id='' 不满足查找 diff --git a/app/src/main/java/li/songe/gkd/debug/SnapshotExt.kt b/app/src/main/java/li/songe/gkd/debug/SnapshotExt.kt index 6ada029..2dfe4c8 100644 --- a/app/src/main/java/li/songe/gkd/debug/SnapshotExt.kt +++ b/app/src/main/java/li/songe/gkd/debug/SnapshotExt.kt @@ -112,7 +112,7 @@ object SnapshotExt { val stream = File(getScreenshotPath(snapshot.id)).outputStream() bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream) stream.close() - val text = Singleton.json.encodeToString(snapshot) + val text = Singleton.keepNullJson.encodeToString(snapshot) File(getSnapshotPath(snapshot.id)).writeText(text) DbSet.snapshotDao.insert(snapshot.toSnapshot()) } diff --git a/app/src/main/java/li/songe/gkd/util/Singleton.kt b/app/src/main/java/li/songe/gkd/util/Singleton.kt index 71dfcef..655caad 100644 --- a/app/src/main/java/li/songe/gkd/util/Singleton.kt +++ b/app/src/main/java/li/songe/gkd/util/Singleton.kt @@ -20,6 +20,14 @@ object Singleton { } } + val keepNullJson by lazy { + Json { + isLenient = true + ignoreUnknownKeys = true + encodeDefaults = true + } + } + val client by lazy { HttpClient(OkHttp) { install(ContentNegotiation) {