mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 22:05:59 +00:00
test(dual-screen): write the chat layout probe to events.jsonl
The Retroid Pocket Duo's logcat keeps only error-level app lines, so the
Log.i probe from 083bdc05 never showed up. Test-only; remove with the fix.
This commit is contained in:
1 parent
abca04336a
commit
499b06ff2c
1 file changed
+6
-4
@@ -35,6 +35,7 @@ import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.session.SessionEvents
|
||||
import com.droiddeck.launcher.session.SessionService
|
||||
import com.droiddeck.launcher.session.SessionState
|
||||
import com.droiddeck.launcher.session.SteamWebLogin
|
||||
@@ -74,8 +75,9 @@ internal fun steamChatFitScript(cssWidth: Int, scale: Float): String {
|
||||
"window.dispatchEvent(new Event('resize'));})()"
|
||||
}
|
||||
|
||||
// Test builds only: logs the chat page's element structure (tags, ids, classes, sizes; no text) to find what
|
||||
// holds the header and limits the friends list height. Remove once the layout is fixed.
|
||||
// Test builds only: records the chat page's element structure (tags, ids, classes, sizes; no text) to find what
|
||||
// holds the header and limits the friends list height. Remove once the layout is fixed. It goes to the session's
|
||||
// events.jsonl because the Retroid Pocket Duo's logcat drops app lines below error level.
|
||||
private const val CHAT_LAYOUT_PROBE = "(function(){" +
|
||||
"function m(v){return String(v).replace(/\\d{6,}/g,'#');}" +
|
||||
"function d(e){if(!e||!e.tagName)return null;var r=e.getBoundingClientRect(),c=getComputedStyle(e);" +
|
||||
@@ -90,7 +92,7 @@ private const val CHAT_LAYOUT_PROBE = "(function(){" +
|
||||
|
||||
private fun logChatLayout(view: WebView, round: Int) {
|
||||
view.evaluateJavascript(CHAT_LAYOUT_PROBE) { json ->
|
||||
json.orEmpty().chunked(3000).forEachIndexed { i, part -> android.util.Log.i("BottomChatLayout", "r$round p$i $part") }
|
||||
SessionEvents.record("chat.layout", mapOf("round" to round, "layout" to json))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +181,7 @@ private fun SteamChatView() {
|
||||
override fun onPageFinished(view: WebView, url: String) {
|
||||
val scale = view.resources.displayMetrics.density * CHAT_PAGE_SCALE
|
||||
if (view.width > 0) view.evaluateJavascript(steamChatFitScript((view.width / scale).roundToInt(), CHAT_PAGE_SCALE), null)
|
||||
android.util.Log.i("BottomChatLayout", "page finished ${url.substringBefore('?')} view ${view.width}x${view.height}")
|
||||
SessionEvents.record("chat.page_finished", mapOf("url" to url.substringBefore('?'), "view" to "${view.width}x${view.height}"))
|
||||
view.postDelayed({ logChatLayout(view, 1) }, 4_000L)
|
||||
view.postDelayed({ logChatLayout(view, 2) }, 12_000L)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user